Skip to content

Commit

Permalink
Update to 3.5.0. (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcenizal authored Dec 6, 2024
1 parent 2a7f6c3 commit fc84b0c
Show file tree
Hide file tree
Showing 81 changed files with 1,000 additions and 282 deletions.
77 changes: 77 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Vectara UI

This is Vectara's design system, codified as a React component library. It's intended solely for consumption by Vectara and currently it isn't available for use by anybody else. For more information see [NO_LICENSE](./NO_LICENSE).

## Usage

Import components like this:

```tsx
import { VuiFlexContainer, VuiItem } from "@vectara/vectara-ui";
```

Import our utils like this:

```tsx
import { extractCitations } from "@vectara/vectara-ui/lib/utils/citations";
```

To import the CSS for the components, import this stylesheet at the root level:

```tsx
import "@vectara/vectara-ui/lib/styles/index";
```

If you are using Sass and need Vectara UI's Sass variables, you can use this import in the files that use the variables:

```scss
@import "@vectara/vectara-ui/lib/sassUtils/index";
```

## Publishing

Publishing a new version of the package consists of three steps:

1. Maintaining the CHANGELOG.
2. Versioning the package.
3. Publishing to NPM.

### Maintain the CHANGELOG

As you introduce changes, record them in the CHANGELOG beneath the `main` section. Before you create a new version, submit a PR that updates the `package.json` version and moves the `main` content into a new section for the new version. We follow semver, so breaking changes should result in a major version bump.

### Version the package

1. Run `npm version {number}` to update package.json with the new version number and create a tag to track the version.
2. Run `git push origin --tags` to push the new tag to the repo.
3. Optional: [Manually create a release in GitHub.](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository)

### Publish to NPM

1. Run `npm run buildPackage` to create the distributable files.
2. Run `npm login --scope=@vectara --registry="https://registry.npmjs.org/"` to log into the registry and scope.
3. Run `npm publish --access public` to publish the package to NPM.

## Local development

Use `npm run start` to run the docs site locally and interact with the code you're developing.

To test the package locally, use [`npm link`](https://docs.npmjs.com/cli/v9/commands/npm-link) to consume the distributable files in a sibling project.

If you get an error regarding an ["invalid hook call"](https://iws.io/2022/invalid-hook-multiple-react-instances), you might need to use `npm link` to temporarily link the consumer's React dependencies to Vectara-UI's React dependencies. In this example, we're consuming Vectara-UI in [Vectara-Answer](https://github.com/vectara/vectara-answer):

```bash
npm link ../vectara-answer/node_modules/react ../vectara-answer/node_modules/react-dom ../vectara-answer/node_modules/react-router-dom
```

When you're done testing out the consumer, you can unlink these dependencies:

```bash
npm unlink ../vectara-answer/node_modules/react ../vectara-answer/node_modules/react-dom ../vectara-answer/node_modules/react-router-dom
```

## Licensing and public use

Though the GitHub terms of service grant anybody the right to fork and look through this repository, we haven't yet licensed this code for use by anybody else. This means Vectara reserves all rights to the contents of this repository. You can't reproduce, distribute, or create derivative works from it. For more information on reserved copyright of GitHub repos, see https://choosealicense.com/no-permission/.

For more information on our lack of licensing, see [NO_LICENSE](./NO_LICENSE).
15 changes: 0 additions & 15 deletions docs/public/asset-manifest.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/public/index.html

This file was deleted.

3 changes: 0 additions & 3 deletions docs/public/robots.txt

This file was deleted.

Binary file removed docs/public/vectara-favicon.png
Binary file not shown.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vectara/vectara-ui",
"version": "1.0.2",
"version": "3.5.0",
"homepage": "https://vectara.github.io/vectara-ui/",
"description": "Vectara's design system, codified as a React and Sass component library",
"author": "Vectara",
Expand Down Expand Up @@ -28,11 +28,11 @@
"buildDocs": "BUILD_PATH='./docs/public' PUBLIC_URL='.' react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"buildLib": "npx tsc --project tsconfig.lib.json && npm run copyStyleUtils && npm run copyComponentStyles && npm run compileCss",
"build": "npx tsc --project tsconfig.lib.json && npm run copyStyleUtils && npm run copyComponentStyles && npm run compileCss",
"compileCss": "sass --no-source-map src/lib/styles/styles.scss lib/styles/index.css",
"copyStyleUtils": "copyfiles -u 2 src/lib/sassUtils/* lib",
"copyComponentStyles": "copyfiles -u 2 src/lib/components/index.scss lib && copyfiles -u 2 src/lib/components/**/*.scss lib && copyfiles -u 2 src/lib/components/**/**/*.scss lib",
"publishLib": "npm run buildLib && npm publish --access public"
"publish": "npm run build && npm publish --access public"
},
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
Expand Down
1 change: 1 addition & 0 deletions src/docs/Docs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const DocsContent = () => {
target="_blank"
color="neutral"
size="m"
aria-label="Vectara UI GitHub repository"
icon={
<VuiIcon>
<BiLogoGithub />
Expand Down
3 changes: 2 additions & 1 deletion src/docs/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const Page = ({ name, examples }: { name: string; examples: ExampleType[]
<VuiFlexContainer alignItems="center" spacing="xxs">
<VuiFlexItem grow={false}>
<VuiIconButton
aria-label="Go to previous example"
icon={
<VuiIcon>
<BiLeftArrowAlt />
Expand All @@ -42,8 +43,8 @@ export const Page = ({ name, examples }: { name: string; examples: ExampleType[]
</VuiFlexItem>

<VuiFlexItem>
{" "}
<VuiIconButton
aria-label="Go to next example"
icon={
<VuiIcon>
<BiRightArrowAlt />
Expand Down
12 changes: 7 additions & 5 deletions src/docs/pages.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Components
import { accordion } from "./pages/accordion";
import { accountMenu } from "./pages/accountMenu";
import { app } from "./pages/app";
import { badge } from "./pages/badge";
import { button } from "./pages/button";
Expand All @@ -16,6 +15,8 @@ import { formGroup } from "./pages/formGroup";
import { grid } from "./pages/grid";
import { horizontalRule } from "./pages/horizontalRule";
import { icon } from "./pages/icon";
import { infoList } from "./pages/infoList";
import { infoMenu } from "./pages/infoMenu";
import { infoTable } from "./pages/infoTable";
import { input } from "./pages/input";
import { label } from "./pages/label";
Expand Down Expand Up @@ -45,6 +46,7 @@ import { table } from "./pages/table";
import { tabs } from "./pages/tabs";
import { text } from "./pages/text";
import { textArea } from "./pages/textArea";
import { timeline } from "./pages/timeline";
import { toggle } from "./pages/toggle";
import { topicButton } from "./pages/topicButton";
import { validation } from "./pages/validation";
Expand All @@ -63,19 +65,19 @@ export const categories: Category[] = [
},
{
name: "Application",
pages: [app, accountMenu, drawer, modal, notifications]
pages: [app, drawer, modal, notifications]
},
{
name: "Info",
pages: [table, infoTable, statList, list]
pages: [table, infoTable, infoList, statList, list]
},
{
name: "Layout",
pages: [tabs, accordion, popover, flex, grid, spacer, card, horizontalRule]
pages: [tabs, accordion, popover, infoMenu, flex, grid, spacer, card, horizontalRule]
},
{
name: "Content",
pages: [badge, status, callout, code, icon, progressBar, spinner, text]
pages: [badge, status, callout, timeline, code, icon, progressBar, spinner, text]
},
{
name: "Form",
Expand Down
13 changes: 0 additions & 13 deletions src/docs/pages/accountMenu/index.tsx

This file was deleted.

11 changes: 9 additions & 2 deletions src/docs/pages/button/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ export const IconButton = () => {
<VuiFlexContainer>
{BUTTON_COLOR.map((color) => (
<VuiFlexItem grow={false} key={color}>
<VuiIconButton icon={icon} color={color} />
<VuiIconButton
aria-label="Example button"
icon={icon}
color={color}
onClick={() => console.log("click")}
onMouseOver={() => console.log("mouse over")}
onMouseOut={() => console.log("mouse out")}
/>
</VuiFlexItem>
))}
</VuiFlexContainer>
Expand All @@ -31,7 +38,7 @@ export const IconButton = () => {
<VuiFlexContainer>
{BUTTON_SIZE.map((size) => (
<VuiFlexItem grow={false} key={size}>
<VuiIconButton icon={icon} color="primary" size={size} />
<VuiIconButton aria-label="Example button" icon={icon} color="primary" size={size} />
</VuiFlexItem>
))}
</VuiFlexContainer>
Expand Down
9 changes: 8 additions & 1 deletion src/docs/pages/button/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ import { VuiButtonPrimary } from "../../../lib";

export const Link = () => {
return (
<VuiButtonPrimary color="accent" href="https://vectara.com" target="_blank">
<VuiButtonPrimary
color="accent"
href="https://vectara.com"
target="_blank"
onClick={() => console.log("click")}
onMouseOver={() => console.log("mouse over")}
onMouseOut={() => console.log("mouse out")}
>
Visit Vectara.com
</VuiButtonPrimary>
);
Expand Down
10 changes: 9 additions & 1 deletion src/docs/pages/button/Sizes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ export const Sizes = () => {
<VuiFlexContainer>
{BUTTON_SIZE.map((size) => (
<VuiFlexItem grow={false} key={size}>
<VuiButtonPrimary icon={icon} color="primary" size={size} isLoading={isLoading}>
<VuiButtonPrimary
icon={icon}
color="primary"
size={size}
isLoading={isLoading}
onClick={() => console.log("click")}
onMouseOver={() => console.log("mouse over")}
onMouseOut={() => console.log("mouse out")}
>
Size {size}
</VuiButtonPrimary>
</VuiFlexItem>
Expand Down
89 changes: 44 additions & 45 deletions src/docs/pages/code/FullHeight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,49 @@ import { VuiCode } from "../../../lib";

export const FullHeight = () => (
<VuiCode language="tsx" fullHeight>
{`import { useState } from "react";
import { VuiCode, VuiSpacer, VuiTab, VuiTabs, VuiTitle } from "../../lib";
type Props = {
name?: string;
component: React.ReactNode;
source: string;
};
export const Example = ({ name, component, source }: Props) => {
const [tab, setTab] = useState<"example" | "source">("example");
return (
<>
{name && (
<VuiTitle size="s">
<h3>{name}</h3>
</VuiTitle>
)}
<VuiSpacer size="xs" />
<VuiTabs>
<VuiTab isActive={tab === "example"} onClick={() => setTab("example")}>
Example
</VuiTab>
<VuiTab isActive={tab === "source"} onClick={() => setTab("source")}>
Source
</VuiTab>
</VuiTabs>
{tab === "example" && (
<>
<VuiSpacer size="m" />
{component}
</>
)}
{tab === "source" && <VuiCode language="tsx">{source}</VuiCode>}
<VuiSpacer size="l" />
</>
);
};
`}
{`
curl -X POST \
-H "customer-id: 2219234556" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJraWQiOiJqUENhYmhHT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
{
"query": "what is time?",
"search": {
"corpora": [
{
"corpus_key": "quanta_38",
"metadata_filter": "",
"lexical_interpolation": 0.005,
"custom_dimensions": {}
}
],
"offset": 0,
"limit": 10,
"context_configuration": {
"sentences_before": 2,
"sentences_after": 2,
"start_tag": "%START_SNIPPET%",
"end_tag": "%END_SNIPPET%"
},
"reranker": {
"type": "none"
}
},
"stream_response": true,
"generation": {
"prompt_name": "vectara-summary-ext-v1.3.0",
"max_used_search_results": 2,
"prompt_text": "",
"response_language": "eng",
"enable_factual_consistency_score": true
},
"chat": {
"store": true
}
}
END
`}
</VuiCode>
);
Loading

0 comments on commit fc84b0c

Please sign in to comment.