diff --git a/README.md b/README.md new file mode 100644 index 0000000..481424e --- /dev/null +++ b/README.md @@ -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). diff --git a/docs/public/asset-manifest.json b/docs/public/asset-manifest.json deleted file mode 100644 index a7625cc..0000000 --- a/docs/public/asset-manifest.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "files": { - "main.css": "./static/css/main.2451c968.css", - "main.js": "./static/js/main.f22e287a.js", - "static/js/453.ebf7af86.chunk.js": "./static/js/453.ebf7af86.chunk.js", - "index.html": "./index.html", - "main.2451c968.css.map": "./static/css/main.2451c968.css.map", - "main.f22e287a.js.map": "./static/js/main.f22e287a.js.map", - "453.ebf7af86.chunk.js.map": "./static/js/453.ebf7af86.chunk.js.map" - }, - "entrypoints": [ - "static/css/main.2451c968.css", - "static/js/main.f22e287a.js" - ] -} \ No newline at end of file diff --git a/docs/public/index.html b/docs/public/index.html deleted file mode 100644 index 07c6ec9..0000000 --- a/docs/public/index.html +++ /dev/null @@ -1 +0,0 @@ -Vectara UI library
\ No newline at end of file diff --git a/docs/public/robots.txt b/docs/public/robots.txt deleted file mode 100644 index e9e57dc..0000000 --- a/docs/public/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -# https://www.robotstxt.org/robotstxt.html -User-agent: * -Disallow: diff --git a/docs/public/vectara-favicon.png b/docs/public/vectara-favicon.png deleted file mode 100644 index 504028d..0000000 Binary files a/docs/public/vectara-favicon.png and /dev/null differ diff --git a/package-lock.json b/package-lock.json index e542e21..5bc04d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@vectara/vectara-ui", - "version": "0.0.2", + "version": "3.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@vectara/vectara-ui", - "version": "0.0.2", + "version": "3.5.0", "dependencies": { "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^12.1.5", diff --git a/package.json b/package.json index cf96bed..55a7802 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/src/docs/Docs.tsx b/src/docs/Docs.tsx index cf49daa..d78f738 100644 --- a/src/docs/Docs.tsx +++ b/src/docs/Docs.tsx @@ -81,6 +81,7 @@ const DocsContent = () => { target="_blank" color="neutral" size="m" + aria-label="Vectara UI GitHub repository" icon={ diff --git a/src/docs/Page.tsx b/src/docs/Page.tsx index 7f9f57a..10ee859 100644 --- a/src/docs/Page.tsx +++ b/src/docs/Page.tsx @@ -31,6 +31,7 @@ export const Page = ({ name, examples }: { name: string; examples: ExampleType[] @@ -42,8 +43,8 @@ export const Page = ({ name, examples }: { name: string; examples: ExampleType[] - {" "} diff --git a/src/docs/pages.tsx b/src/docs/pages.tsx index c0a0e6a..c716d24 100644 --- a/src/docs/pages.tsx +++ b/src/docs/pages.tsx @@ -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"; @@ -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"; @@ -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"; @@ -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", diff --git a/src/docs/pages/accountMenu/index.tsx b/src/docs/pages/accountMenu/index.tsx deleted file mode 100644 index a195aff..0000000 --- a/src/docs/pages/accountMenu/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { AccountMenu } from "./AccountMenu"; -const AccountMenuSource = require("!!raw-loader!./AccountMenu"); - -export const accountMenu = { - name: "Account Menu", - path: "/accountMenu", - examples: [ - { - component: , - source: AccountMenuSource.default.toString() - } - ] -}; diff --git a/src/docs/pages/button/IconButton.tsx b/src/docs/pages/button/IconButton.tsx index b3244a1..9370b0b 100644 --- a/src/docs/pages/button/IconButton.tsx +++ b/src/docs/pages/button/IconButton.tsx @@ -21,7 +21,14 @@ export const IconButton = () => { {BUTTON_COLOR.map((color) => ( - + console.log("click")} + onMouseOver={() => console.log("mouse over")} + onMouseOut={() => console.log("mouse out")} + /> ))} @@ -31,7 +38,7 @@ export const IconButton = () => { {BUTTON_SIZE.map((size) => ( - + ))} diff --git a/src/docs/pages/button/Link.tsx b/src/docs/pages/button/Link.tsx index be1a815..07f0cfa 100644 --- a/src/docs/pages/button/Link.tsx +++ b/src/docs/pages/button/Link.tsx @@ -2,7 +2,14 @@ import { VuiButtonPrimary } from "../../../lib"; export const Link = () => { return ( - + console.log("click")} + onMouseOver={() => console.log("mouse over")} + onMouseOut={() => console.log("mouse out")} + > Visit Vectara.com ); diff --git a/src/docs/pages/button/Sizes.tsx b/src/docs/pages/button/Sizes.tsx index 2f4ad8c..d6e820f 100644 --- a/src/docs/pages/button/Sizes.tsx +++ b/src/docs/pages/button/Sizes.tsx @@ -32,7 +32,15 @@ export const Sizes = () => { {BUTTON_SIZE.map((size) => ( - + console.log("click")} + onMouseOver={() => console.log("mouse over")} + onMouseOut={() => console.log("mouse out")} + > Size {size} diff --git a/src/docs/pages/code/FullHeight.tsx b/src/docs/pages/code/FullHeight.tsx index ec3abf3..21900bf 100644 --- a/src/docs/pages/code/FullHeight.tsx +++ b/src/docs/pages/code/FullHeight.tsx @@ -2,50 +2,49 @@ import { VuiCode } from "../../../lib"; export const 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 && ( - -

{name}

-
- )} - - - - - setTab("example")}> - Example - - - setTab("source")}> - Source - - - - {tab === "example" && ( - <> - - {component} - - )} - {tab === "source" && {source}} - - - - ); -}; -`} + {` +curl -X POST \ +-H "customer-id: 2219234556" \ +-H "Content-Type: application/json" \ +-H "Authorization: Bearer eyJraWQiOiJqUENhYmhHTndTTlBOdFE1bXh6NWQxOFV2a0xyQVc3aEZsS3N2dU9qcDNVPSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiI1ODAxMzNlMC05MDIxLTcwNzgtMThiNC03MjkwNmYxNDEwYWMiLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLXdlc3QtMi5hbWF6b25hd3MuY29tXC91cy13ZXN0LTJfYjlwMnUza2RHIiwiY29nbml0bzp1c2VybmFtZSI6ImNqK2F1ZzFAdmVjdGFyYS5jb20iLCJvcmlnaW5fanRpIjoiOWU5MDhmMmMtMTJlYy00NTEyLWFjMTEtOGNhYjI1YTlkNjM2IiwiYXVkIjoiNG0zdDBnc3MyZnJ0cTRodTc0YmMxNmVjN3IiLCJldmVudF9pZCI6IjFlZWIzZWQ5LTA1NzctNDg5YS05YWIwLTdhNGQ3YmIxMWRiYiIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNzIwNzM0MDEzLCJleHAiOjE3MjA3NjM0OTksImlhdCI6MTcyMDc1OTg5OSwianRpIjoiYmE0ZGMzYWQtNGU0Mi00NTJhLTg4NmMtNWVhYzIzM2Y2ODA0IiwiZW1haWwiOiJjaithdWcxQHZlY3RhcmEuY29tIn0.oyXW3uLvjaphK6-xXonHeU3OlK6FVdOEK3mNtb9EuLyS1d6HfO1fP0tvHYPzPOmg5tmdKGdHajmMxkehVN4kwRslYTQLRzBWiZgs1LcMPU9HbZ8_YUAu97MT_KW8erEIy9lRYIP3jAWBb7DN_At1NLri4pxXAvEFLNbgsmgjAJCmkVxM4MrKUC37lAR_f_prjb38LFZYNdkP_851UGWYblc2DNiIhGomIrCMVxrHDf5OTlH03sJwQoreFzdI9-W_izdfcCEayKZEDMjkOf9g-8uvdvQ_-817rcssu0DAlfWIuW9K2NRVfPw7L5ik-vZJyGnS23qlsyJ9vpRnXvUxeg" \ + https://api.vectara.dev:443/v2/chats \ +-d @- < ); diff --git a/src/docs/pages/formGroup/FormGroup.tsx b/src/docs/pages/formGroup/FormGroup.tsx index dd0e389..96f8632 100644 --- a/src/docs/pages/formGroup/FormGroup.tsx +++ b/src/docs/pages/formGroup/FormGroup.tsx @@ -1,5 +1,13 @@ import { useState } from "react"; -import { RadioButtonConfig, VuiFormGroup, VuiSelect, VuiSpacer, VuiSuperRadioGroup, VuiTextInput } from "../../../lib"; +import { + RadioButtonConfig, + VuiFormGroup, + VuiSelect, + VuiSpacer, + VuiSuperRadioGroup, + VuiTextArea, + VuiTextInput +} from "../../../lib"; import { Subsection } from "../../components/Subsection"; type Pizza = "pepperoni" | "mushrooms" | "jalapenos"; @@ -59,9 +67,15 @@ export const FormGroup = () => { - + + + + + + undefined} /> + diff --git a/src/docs/pages/formGroup/NonFormElement.tsx b/src/docs/pages/formGroup/NonFormElement.tsx new file mode 100644 index 0000000..6ddd8c8 --- /dev/null +++ b/src/docs/pages/formGroup/NonFormElement.tsx @@ -0,0 +1,19 @@ +import { VuiCallout, VuiFormGroup } from "../../../lib"; + +export const NonFormElement = () => { + return ( + <> + + + + + ); +}; diff --git a/src/docs/pages/formGroup/index.tsx b/src/docs/pages/formGroup/index.tsx index 40b2fad..ebc2edc 100644 --- a/src/docs/pages/formGroup/index.tsx +++ b/src/docs/pages/formGroup/index.tsx @@ -1,13 +1,22 @@ import { FormGroup } from "./FormGroup"; +import { NonFormElement } from "./NonFormElement"; + const FormGroupSource = require("!!raw-loader!./FormGroup"); +const NonFormElementSource = require("!!raw-loader!./NonFormElement"); export const formGroup = { name: "Form Group", path: "/formGroup", examples: [ { + name: "Form elements", component: , source: FormGroupSource.default.toString() + }, + { + name: "Non-form elements", + component: , + source: NonFormElementSource.default.toString() } ] }; diff --git a/src/docs/pages/icon/InlineText.tsx b/src/docs/pages/icon/InlineText.tsx new file mode 100644 index 0000000..ad1f991 --- /dev/null +++ b/src/docs/pages/icon/InlineText.tsx @@ -0,0 +1,15 @@ +import { BiStar } from "react-icons/bi"; +import { VuiIcon, VuiText } from "../../../lib"; + +export const InlineText = () => { + return ( + +

+ Here's some text inline with an icon{" "} + + + +

+
+ ); +}; diff --git a/src/docs/pages/icon/index.tsx b/src/docs/pages/icon/index.tsx index 51c2be4..c37811d 100644 --- a/src/docs/pages/icon/index.tsx +++ b/src/docs/pages/icon/index.tsx @@ -1,8 +1,10 @@ import { Sizes } from "./Sizes"; import { Colors } from "./Colors"; +import { InlineText } from "./InlineText"; const SizesSource = require("!!raw-loader!./Sizes"); const ColorsSource = require("!!raw-loader!./Colors"); +const InlineTextSource = require("!!raw-loader!./InlineText"); export const icon = { name: "Icon", @@ -17,6 +19,11 @@ export const icon = { name: "Colors", component: , source: ColorsSource.default.toString() + }, + { + name: "Inline Text", + component: , + source: InlineTextSource.default.toString() } ] }; diff --git a/src/docs/pages/infoList/InfoList.tsx b/src/docs/pages/infoList/InfoList.tsx new file mode 100644 index 0000000..fca4508 --- /dev/null +++ b/src/docs/pages/infoList/InfoList.tsx @@ -0,0 +1,28 @@ +import { VuiButtonSecondary, VuiSpacer, VuiText, VuiInfoList } from "../../../lib"; + +export const InfoList = () => { + return ( + + +

22 MB

+
+ + + + + Refresh + + + ) + } + ]} + /> + ); +}; diff --git a/src/docs/pages/infoList/index.tsx b/src/docs/pages/infoList/index.tsx new file mode 100644 index 0000000..b200922 --- /dev/null +++ b/src/docs/pages/infoList/index.tsx @@ -0,0 +1,13 @@ +import { InfoList } from "./InfoList"; +const InfoListSource = require("!!raw-loader!./InfoList"); + +export const infoList = { + name: "Info List", + path: "/InfoList", + examples: [ + { + component: , + source: InfoListSource.default.toString() + } + ] +}; diff --git a/src/docs/pages/accountMenu/AccountMenu.tsx b/src/docs/pages/infoMenu/InfoMenu.tsx similarity index 84% rename from src/docs/pages/accountMenu/AccountMenu.tsx rename to src/docs/pages/infoMenu/InfoMenu.tsx index 9755d34..733c3be 100644 --- a/src/docs/pages/accountMenu/AccountMenu.tsx +++ b/src/docs/pages/infoMenu/InfoMenu.tsx @@ -1,5 +1,5 @@ import { useState } from "react"; -import { VuiAccountMenu, VuiButtonSecondary, VuiIcon, VuiOptionsList, VuiSpacer, VuiText } from "../../../lib"; +import { VuiInfoMenu, VuiButtonSecondary, VuiIcon, VuiOptionsList, VuiSpacer, VuiText } from "../../../lib"; import { BiSolidUser } from "react-icons/bi"; const options = [ @@ -7,11 +7,13 @@ const options = [ { value: "signOut", label: "Sign out" } ]; -export const AccountMenu = () => { +export const InfoMenu = () => { const [isOpen, setIsOpen] = useState(false); return ( - { options={options} size="l" /> - + ); }; diff --git a/src/docs/pages/infoMenu/index.tsx b/src/docs/pages/infoMenu/index.tsx new file mode 100644 index 0000000..287eda2 --- /dev/null +++ b/src/docs/pages/infoMenu/index.tsx @@ -0,0 +1,13 @@ +import { InfoMenu } from "./InfoMenu"; +const InfoMenuSource = require("!!raw-loader!./InfoMenu"); + +export const infoMenu = { + name: "Info Menu", + path: "/InfoMenu", + examples: [ + { + component: , + source: InfoMenuSource.default.toString() + } + ] +}; diff --git a/src/docs/pages/modal/PrimaryModal.tsx b/src/docs/pages/modal/PrimaryModal.tsx index 5a8eb38..1e1a145 100644 --- a/src/docs/pages/modal/PrimaryModal.tsx +++ b/src/docs/pages/modal/PrimaryModal.tsx @@ -1,5 +1,6 @@ import { useState } from "react"; import { VuiButtonPrimary, VuiButtonSecondary, VuiModal, VuiSearchSelect, VuiSpacer, VuiText } from "../../../lib"; +import { BiInfoCircle } from "react-icons/bi"; const options = [ { value: "a", label: "Caffeine-free" }, @@ -27,7 +28,7 @@ export const PrimaryModal = () => { Open primary modal
- setIsOpen(false)} title="FYI"> + setIsOpen(false)} icon={} title="FYI">

I just thought you should know that your modal is showing.

diff --git a/src/docs/pages/optionsButton/Primary.tsx b/src/docs/pages/optionsButton/Primary.tsx index 17cb393..f223fb7 100644 --- a/src/docs/pages/optionsButton/Primary.tsx +++ b/src/docs/pages/optionsButton/Primary.tsx @@ -28,6 +28,8 @@ export const Primary = () => { {BUTTON_COLOR.map((color) => ( alert("Button clicked")} + href="https://www.vectara.com" size={size} isOpen={isOpen[`${size}-${color}`]} setIsOpen={(isButtonOpen) => diff --git a/src/docs/pages/optionsButton/Secondary.tsx b/src/docs/pages/optionsButton/Secondary.tsx index 74bc687..b105e5f 100644 --- a/src/docs/pages/optionsButton/Secondary.tsx +++ b/src/docs/pages/optionsButton/Secondary.tsx @@ -28,6 +28,8 @@ export const Secondary = () => { {BUTTON_COLOR.map((color) => ( alert("Button clicked")} + href="https://www.vectara.com" size={size} type="secondary" isOpen={isOpen[`${size}-${color}`]} diff --git a/src/docs/pages/statList/StatList.tsx b/src/docs/pages/statList/StatList.tsx index 85987f2..a0f9e50 100644 --- a/src/docs/pages/statList/StatList.tsx +++ b/src/docs/pages/statList/StatList.tsx @@ -1,22 +1,28 @@ -import { VuiStatList, VuiStatus } from "../../../lib"; +import { VuiSpacer, VuiStatList, VuiStatus } from "../../../lib"; + +const stats = [ + { + name: "Name", + value: "Nostromo" + }, + { + name: "Location", + value: "Deep space" + }, + { + name: "Status", + value: + } +]; export const StatList = () => { return ( - - } - ]} - /> + <> + + + + + + ); }; diff --git a/src/docs/pages/summary/Summary.tsx b/src/docs/pages/summary/Summary.tsx index eaf42d6..51b9d6f 100644 --- a/src/docs/pages/summary/Summary.tsx +++ b/src/docs/pages/summary/Summary.tsx @@ -11,5 +11,5 @@ const SummaryCitation = ({ reference }: { reference: string }) => ( ); export const Summary = () => { - return ; + return ; }; diff --git a/src/docs/pages/table/Table.tsx b/src/docs/pages/table/Table.tsx index 9572b4f..f571dce 100644 --- a/src/docs/pages/table/Table.tsx +++ b/src/docs/pages/table/Table.tsx @@ -34,6 +34,7 @@ export const Table = () => { const [canSelectRows, setCanSelectRows] = useState(true); const [canSearch, setCanSearch] = useState(true); const [areNicknamesVisible, setAreNicknamesVisible] = useState(false); + const [isAlignTop, setIsAlignTop] = useState(false); // Table state const [isLoading, setIsLoading] = useState(true); @@ -74,6 +75,15 @@ export const Table = () => { }; const columns = [ + { + name: "#", + header: { + render: () => { + return "#"; + } + }, + render: (person: Person, rowIndex: number) => rowIndex + 1 + }, { name: "name", header: { @@ -233,11 +243,11 @@ export const Table = () => { const search = canSearch ? { - searchValue, - searchPlaceholder: "Search people", - onSearchChange: (search: string) => { + value: searchValue, + placeholder: "Search people", + onChange: (e: React.ChangeEvent) => { setCurrentPage(1); - setSearchValue(search); + setSearchValue(e.target.value); } } : undefined; @@ -291,6 +301,10 @@ export const Table = () => { onChange={(e) => setAreNicknamesVisible(e.target.checked)} /> + + + setIsAlignTop(e.target.checked)} /> +
@@ -301,6 +315,7 @@ export const Table = () => { ({ className: "testRowClass", "data-testid": person.name })} columns={columns} rows={rows} content={content} @@ -312,6 +327,9 @@ export const Table = () => { onReload={onReload} search={search} isDisabled={isDisabled} + bodyStyle={{ + verticalAlign: isAlignTop ? "top" : undefined + }} /> ); diff --git a/src/docs/pages/timeline/Timeline.tsx b/src/docs/pages/timeline/Timeline.tsx new file mode 100644 index 0000000..d866c18 --- /dev/null +++ b/src/docs/pages/timeline/Timeline.tsx @@ -0,0 +1,150 @@ +import { useState } from "react"; +import { BiAnalyse, BiListCheck, BiSolidFlask } from "react-icons/bi"; +import { + VuiAccordion, + VuiButtonSecondary, + VuiCallout, + VuiIcon, + VuiInfoTable, + VuiSpacer, + VuiText, + VuiTimeline, + VuiTimelineItem, + VuiTitle +} from "../../../lib"; + +export const Timeline = () => { + const [isOpen, setIsOpen] = useState(false); + + const columns = [ + { + name: "ingredient", + render: "Ingredient" + }, + { + name: "amount", + render: "Amount", + width: "200px" + } + ]; + + const rows = [ + { + values: { + ingredient: { + render: ( + +

Plutonium

+
+ ) + }, + amount: { + render: ( + +

4 grams

+
+ ) + } + } + }, + { + values: { + ingredient: { + render: ( + +

TGRI secret sauce

+
+ ) + }, + amount: { + render: ( + +

8.25 microliters

+
+ ) + } + } + }, + { + values: { + ingredient: { + render: ( + +

Corn starch

+
+ ) + }, + amount: { + render: ( + +

1 tbsp

+
+ ) + } + } + } + ]; + + return ( + + + +
+ } + > + +

Ingredients for making ooze

+
+ + + + + + + + + } + > + +

How to prepare

+
+ + + + + + +
    +
  1. Secure mutagens
  2. +
  3. Put in beaker
  4. +
  5. Shake thoroughly
  6. +
  7. Do not drink!!
  8. +
  9. Baste teenage ninja turtles lightly and let sit 20 minutes
  10. +
+
+
+
+ + + + + } + > + + +

Mutated teenage ninja turtles.

+
+ + + Deploy to sewers +
+
+ + ); +}; diff --git a/src/docs/pages/timeline/index.tsx b/src/docs/pages/timeline/index.tsx new file mode 100644 index 0000000..98bfb84 --- /dev/null +++ b/src/docs/pages/timeline/index.tsx @@ -0,0 +1,13 @@ +import { Timeline } from "./Timeline"; +const TimelineSource = require("!!raw-loader!./Timeline"); + +export const timeline = { + name: "Timeline", + path: "/timeline", + examples: [ + { + component: , + source: TimelineSource.default.toString() + } + ] +}; diff --git a/src/docs/pages/validation/Validation.tsx b/src/docs/pages/validation/Validation.tsx index 80c6873..cf4d794 100644 --- a/src/docs/pages/validation/Validation.tsx +++ b/src/docs/pages/validation/Validation.tsx @@ -1,4 +1,4 @@ -import { VuiFormGroup, VuiNumberInput, VuiSelect, VuiSpacer, VuiTextInput } from "../../../lib"; +import { VuiFormGroup, VuiNumberInput, VuiSelect, VuiSpacer, VuiTextArea, VuiTextInput } from "../../../lib"; import { Subsection } from "../../components/Subsection"; export const Validation = () => { @@ -35,6 +35,20 @@ export const Validation = () => { > console.log(event.target.value)} /> + + + + + undefined} /> + diff --git a/src/lib/components/accountMenu/AccountMenu.tsx b/src/lib/components/accountMenu/AccountMenu.tsx deleted file mode 100644 index f08607a..0000000 --- a/src/lib/components/accountMenu/AccountMenu.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { VuiPopover } from "../popover/Popover"; -import { VuiSpacer } from "../spacer/Spacer"; - -type AccountMenuInfo = Array<{ - title: string; - value: React.ReactNode; -}>; - -type Props = { - isOpen: boolean; - setIsOpen: (isOpen: boolean) => void; - button: React.ReactElement; - info?: AccountMenuInfo; - children?: React.ReactNode; -}; - -export const VuiAccountMenu = ({ isOpen, setIsOpen, button, info, children }: Props) => { - return ( - setIsOpen(!isOpen)} - button={button} - header={ - info && - info.length > 0 && ( -
- {info.map((item, index) => ( -
-
{item.title}
-
{item.value}
- {index < info.length - 1 && } -
- ))} -
- ) - } - > - {children} -
- ); -}; diff --git a/src/lib/components/accountMenu/_index.scss b/src/lib/components/accountMenu/_index.scss deleted file mode 100644 index 33bf776..0000000 --- a/src/lib/components/accountMenu/_index.scss +++ /dev/null @@ -1,20 +0,0 @@ -.vuiAccountMenu { - min-width: 260px; -} - -.vuiAccounrMenuHeader { - padding: $sizeM; - border-bottom: 1px solid $borderColor; -} - -.vuiAccountMenuHeaderItem__title { - font-size: $fontSizeSmall; - font-weight: $fontWeightBold; - color: $colorDarkerShade; -} - -.vuiAccountMenuHeaderItem__value { - font-size: $fontSizeStandard; - color: $colorDarkerShade; - margin-top: $sizeXxs; -} diff --git a/src/lib/components/app/appSideNav/AppSideNav.tsx b/src/lib/components/app/appSideNav/AppSideNav.tsx index 022a78a..19f5989 100644 --- a/src/lib/components/app/appSideNav/AppSideNav.tsx +++ b/src/lib/components/app/appSideNav/AppSideNav.tsx @@ -56,7 +56,7 @@ export const VuiAppSideNav = ({ items = [], content }: Props) => { {isCollapsed ? ( setIsCollapsed(false)} className="vuiAppSideNavExpandButton" color="neutral" diff --git a/src/lib/components/app/appSideNav/AppSideNavTree.tsx b/src/lib/components/app/appSideNav/AppSideNavTree.tsx index 18c7643..e4d87df 100644 --- a/src/lib/components/app/appSideNav/AppSideNavTree.tsx +++ b/src/lib/components/app/appSideNav/AppSideNavTree.tsx @@ -70,6 +70,7 @@ const AppSideNavTreeSection = ({ name, path, children, iconBefore, iconAfter, is /> setIsOpen(!isOpen)} diff --git a/src/lib/components/button/BaseButton.tsx b/src/lib/components/button/BaseButton.tsx index 8d5b0d4..32b81a2 100644 --- a/src/lib/components/button/BaseButton.tsx +++ b/src/lib/components/button/BaseButton.tsx @@ -31,7 +31,10 @@ export type BaseButtonProps = { isSelected?: boolean; isInert?: boolean; isDisabled?: boolean; - onClick?: (e: React.MouseEvent) => void; + onClick?: React.MouseEventHandler; + onMouseOver?: React.MouseEventHandler; + onMouseOut?: React.MouseEventHandler; + onMouseMove?: React.MouseEventHandler; href?: LinkProps["href"]; target?: LinkProps["target"]; track?: LinkProps["track"]; @@ -57,6 +60,9 @@ export const BaseButton = forwardRef( size = "m", fullWidth, onClick, + onMouseOver, + onMouseOut, + onMouseMove, tabIndex, isInert, isDisabled, @@ -112,6 +118,9 @@ export const BaseButton = forwardRef( className: wrapperClasses, href, onClick, + onMouseOver, + onMouseOut, + onMouseMove, children: ( //* Wrap a button otherwise the flex layout breaks */}