@ilo-org/react 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +36 -0
- package/.storybook/main.js +28 -0
- package/.storybook/manager-head.html +7 -0
- package/.storybook/manager.js +6 -0
- package/.storybook/preview.tsx +33 -0
- package/.storybook/styles.scss +1 -0
- package/.storybook/theme.js +11 -0
- package/.turbo/turbo-build.log +513 -0
- package/.turbo/turbo-check.log +5 -0
- package/.turbo/turbo-test.log +1676 -0
- package/=6.4.0 +115 -0
- package/=7.21.4 +21 -0
- package/LICENSE +201 -0
- package/README.md +11 -0
- package/lib/index.esm.js +24 -0
- package/lib/index.esm.js.map +1 -0
- package/lib/index.js +24 -0
- package/lib/index.js.map +1 -0
- package/package.json +115 -0
- package/rollup.config.js +40 -0
- package/src/__tests__/Accordion.test.tsx +52 -0
- package/src/__tests__/Button.test.tsx +60 -0
- package/src/__tests__/Callout.test.tsx +41 -0
- package/src/__tests__/ContextMenu.test.tsx +19 -0
- package/src/__tests__/Dropdown.test.tsx +38 -0
- package/src/__tests__/Form.test.tsx +34 -0
- package/src/__tests__/Heading.test.tsx +51 -0
- package/src/__tests__/Hero.test.tsx +22 -0
- package/src/__tests__/Image.test.tsx +21 -0
- package/src/__tests__/LinkList.test.tsx +17 -0
- package/src/__tests__/List.test.tsx +37 -0
- package/src/__tests__/Loading.text.tsx +33 -0
- package/src/__tests__/Notification.test.tsx +39 -0
- package/src/__tests__/Pagination.test.tsx +58 -0
- package/src/__tests__/Profile.test.tsx +48 -0
- package/src/__tests__/ReadMore.test.tsx +42 -0
- package/src/__tests__/RichText.test.tsx +16 -0
- package/src/__tests__/SearchField.test.tsx +35 -0
- package/src/__tests__/TableOfContents.test.tsx +12 -0
- package/src/__tests__/Tag.test.tsx +10 -0
- package/src/components/Accordion/Accordion.args.ts +19 -0
- package/src/components/Accordion/Accordion.props.d.ts +39 -0
- package/src/components/Accordion/Accordion.tsx +70 -0
- package/src/components/Accordion/AccordionButton.props.d.ts +13 -0
- package/src/components/Accordion/AccordionButton.tsx +60 -0
- package/src/components/Accordion/AccordionItem.props.d.ts +25 -0
- package/src/components/Accordion/AccordionItem.tsx +33 -0
- package/src/components/Accordion/AccordionPanel.props.d.ts +20 -0
- package/src/components/Accordion/AccordionPanel.tsx +47 -0
- package/src/components/Accordion/index.ts +4 -0
- package/src/components/Button/Button.args.ts +353 -0
- package/src/components/Button/Button.props.d.ts +74 -0
- package/src/components/Button/Button.tsx +67 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Callout/Callout.args.ts +64 -0
- package/src/components/Callout/Callout.props.d.ts +61 -0
- package/src/components/Callout/Callout.tsx +80 -0
- package/src/components/Callout/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.args.ts +22 -0
- package/src/components/Checkbox/Checkbox.props.d.ts +61 -0
- package/src/components/Checkbox/Checkbox.tsx +92 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/ChoiceGroup/ChoiceGroup.args.ts +90 -0
- package/src/components/ChoiceGroup/ChoiceGroup.props.d.ts +57 -0
- package/src/components/ChoiceGroup/ChoiceGroup.tsx +42 -0
- package/src/components/ChoiceGroup/index.ts +1 -0
- package/src/components/Collapse/Collapse.props.d.ts +92 -0
- package/src/components/Collapse/Collapse.tsx +130 -0
- package/src/components/Collapse/index.ts +1 -0
- package/src/components/ContextMenu/ContextMenu.args.ts +62 -0
- package/src/components/ContextMenu/ContextMenu.props.d.ts +28 -0
- package/src/components/ContextMenu/ContextMenu.tsx +32 -0
- package/src/components/ContextMenu/index.ts +1 -0
- package/src/components/Credit/Credit.args.ts +14 -0
- package/src/components/Credit/Credit.props.d.ts +11 -0
- package/src/components/Credit/Credit.tsx +41 -0
- package/src/components/Credit/index.ts +1 -0
- package/src/components/DatePicker/DatePicker.args.ts +82 -0
- package/src/components/DatePicker/DatePicker.props.d.ts +68 -0
- package/src/components/DatePicker/DatePicker.tsx +119 -0
- package/src/components/DatePicker/index.ts +1 -0
- package/src/components/Dropdown/Dropdown.args.ts +220 -0
- package/src/components/Dropdown/Dropdown.props.d.ts +84 -0
- package/src/components/Dropdown/Dropdown.tsx +82 -0
- package/src/components/Dropdown/index.ts +1 -0
- package/src/components/Empty/Empty.args.ts +14 -0
- package/src/components/Empty/Empty.props.d.ts +6 -0
- package/src/components/Empty/Empty.tsx +16 -0
- package/src/components/Empty/index.ts +1 -0
- package/src/components/Fieldset/Fieldset.props.d.ts +36 -0
- package/src/components/Fieldset/Fieldset.tsx +90 -0
- package/src/components/Fieldset/index.ts +1 -0
- package/src/components/FileUpload/FileUpload.args.ts +62 -0
- package/src/components/FileUpload/FileUpload.props.d.ts +63 -0
- package/src/components/FileUpload/FileUpload.tsx +82 -0
- package/src/components/FileUpload/index.ts +1 -0
- package/src/components/Form/Form.args.ts +265 -0
- package/src/components/Form/Form.props.d.ts +84 -0
- package/src/components/Form/Form.tsx +83 -0
- package/src/components/Form/index.ts +1 -0
- package/src/components/FormElement/FormElement.props.d.ts +53 -0
- package/src/components/FormElement/FormElement.tsx +26 -0
- package/src/components/FormElement/index.ts +1 -0
- package/src/components/FormGroup/FormGroup.args.ts +84 -0
- package/src/components/FormGroup/FormGroup.props.d.ts +71 -0
- package/src/components/FormGroup/FormGroup.tsx +73 -0
- package/src/components/FormGroup/index.ts +1 -0
- package/src/components/GlobalProvider/GlobalProvider.props.d.ts +15 -0
- package/src/components/GlobalProvider/GlobalProvider.tsx +27 -0
- package/src/components/GlobalProvider/index.js +4 -0
- package/src/components/Heading/Heading.args.ts +46 -0
- package/src/components/Heading/Heading.props.d.ts +24 -0
- package/src/components/Heading/Heading.tsx +28 -0
- package/src/components/Heading/index.ts +1 -0
- package/src/components/Hero/Hero.args.ts +296 -0
- package/src/components/Hero/Hero.props.d.ts +29 -0
- package/src/components/Hero/Hero.tsx +35 -0
- package/src/components/Hero/HeroCard.props.d.ts +65 -0
- package/src/components/Hero/HeroCard.tsx +53 -0
- package/src/components/Hero/index.ts +2 -0
- package/src/components/Icon/Icon.args.ts +15 -0
- package/src/components/Icon/Icon.props.d.ts +16 -0
- package/src/components/Icon/Icon.tsx +25 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/Image/Image.args.ts +35 -0
- package/src/components/Image/Image.props.d.ts +38 -0
- package/src/components/Image/Image.tsx +51 -0
- package/src/components/Image/index.ts +1 -0
- package/src/components/Input/Input.args.ts +139 -0
- package/src/components/Input/Input.props.d.ts +63 -0
- package/src/components/Input/Input.tsx +63 -0
- package/src/components/Input/index.ts +1 -0
- package/src/components/Link/Link.args.ts +36 -0
- package/src/components/Link/Link.props.d.ts +34 -0
- package/src/components/Link/Link.tsx +49 -0
- package/src/components/Link/index.ts +1 -0
- package/src/components/LinkList/LinkList.args.ts +193 -0
- package/src/components/LinkList/LinkList.props.d.ts +52 -0
- package/src/components/LinkList/LinkList.tsx +59 -0
- package/src/components/LinkList/index.ts +1 -0
- package/src/components/List/List.args.ts +38 -0
- package/src/components/List/List.props.d.ts +36 -0
- package/src/components/List/List.tsx +47 -0
- package/src/components/List/ListItem.props.d.ts +25 -0
- package/src/components/List/ListItem.tsx +23 -0
- package/src/components/List/index.ts +2 -0
- package/src/components/Loading/Loading.args.ts +55 -0
- package/src/components/Loading/Loading.props.d.ts +23 -0
- package/src/components/Loading/Loading.tsx +24 -0
- package/src/components/Loading/index.ts +1 -0
- package/src/components/Notification/Notification.args.ts +157 -0
- package/src/components/Notification/Notification.props.d.ts +67 -0
- package/src/components/Notification/Notification.tsx +78 -0
- package/src/components/Notification/index.ts +1 -0
- package/src/components/NumberPicker/NumberPicker.args.ts +58 -0
- package/src/components/NumberPicker/NumberPicker.props.d.ts +56 -0
- package/src/components/NumberPicker/NumberPicker.tsx +65 -0
- package/src/components/NumberPicker/index.ts +1 -0
- package/src/components/Pagination/Pagination.args.ts +43 -0
- package/src/components/Pagination/Pagination.props.d.ts +66 -0
- package/src/components/Pagination/Pagination.tsx +114 -0
- package/src/components/Pagination/index.ts +1 -0
- package/src/components/Profile/Profile.args.ts +58 -0
- package/src/components/Profile/Profile.props.d.ts +43 -0
- package/src/components/Profile/Profile.tsx +43 -0
- package/src/components/Profile/index.ts +1 -0
- package/src/components/Radio/Radio.args.ts +22 -0
- package/src/components/Radio/Radio.props.d.ts +61 -0
- package/src/components/Radio/Radio.tsx +64 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/ReadMore/ReadMore.props.d.ts +38 -0
- package/src/components/ReadMore/ReadMore.tsx +55 -0
- package/src/components/ReadMore/index.ts +1 -0
- package/src/components/ReadMore/readMore.args.ts +35 -0
- package/src/components/RichText/RichText.props.d.ts +11 -0
- package/src/components/RichText/RichText.tsx +22 -0
- package/src/components/RichText/index.ts +1 -0
- package/src/components/RichText/richText.args.ts +15 -0
- package/src/components/SearchField/SearchField.args.ts +73 -0
- package/src/components/SearchField/SearchField.props.d.ts +35 -0
- package/src/components/SearchField/SearchField.tsx +55 -0
- package/src/components/SearchField/index.ts +1 -0
- package/src/components/TableOfContents/TableOfContents.args.ts +35 -0
- package/src/components/TableOfContents/TableOfContents.props.d.ts +23 -0
- package/src/components/TableOfContents/TableOfContents.tsx +32 -0
- package/src/components/TableOfContents/index.ts +1 -0
- package/src/components/Tag/Tag.args.ts +15 -0
- package/src/components/Tag/Tag.props.d.ts +34 -0
- package/src/components/Tag/Tag.tsx +99 -0
- package/src/components/Tag/TagSet.args.ts +39 -0
- package/src/components/Tag/TagSet.props.d.ts +36 -0
- package/src/components/Tag/TagSet.tsx +71 -0
- package/src/components/Tag/index.ts +2 -0
- package/src/components/Textarea/Textarea.args.ts +62 -0
- package/src/components/Textarea/Textarea.props.d.ts +71 -0
- package/src/components/Textarea/Textarea.tsx +67 -0
- package/src/components/Textarea/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.args.ts +43 -0
- package/src/components/Tooltip/Tooltip.props.d.ts +48 -0
- package/src/components/Tooltip/Tooltip.tsx +139 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Video/Video.args.ts +81 -0
- package/src/components/Video/Video.props.d.ts +82 -0
- package/src/components/Video/Video.tsx +29 -0
- package/src/components/Video/VideoPlayer.props.d.ts +80 -0
- package/src/components/Video/VideoPlayer.tsx +285 -0
- package/src/components/Video/index.ts +1 -0
- package/src/hooks/useGlobalSettings.ts +13 -0
- package/src/hooks/useVideoPlayer.ts +85 -0
- package/src/index.ts +19 -0
- package/src/public/favicon.ico +0 -0
- package/src/public/index.html +43 -0
- package/src/public/logo192.png +0 -0
- package/src/public/logo512.png +0 -0
- package/src/public/manifest.json +25 -0
- package/src/public/robots.txt +3 -0
- package/src/setup.ts +6 -0
- package/src/stories/Accordion.stories.tsx +94 -0
- package/src/stories/Button.stories.tsx +491 -0
- package/src/stories/Callout.stories.tsx +154 -0
- package/src/stories/ContextMenu.stories.tsx +72 -0
- package/src/stories/Dropdown.stories.tsx +85 -0
- package/src/stories/Empty.stories.tsx +48 -0
- package/src/stories/Form.stories.tsx +67 -0
- package/src/stories/Heading.stories.tsx +191 -0
- package/src/stories/Hero.stories.tsx +129 -0
- package/src/stories/Image.stories.tsx +71 -0
- package/src/stories/Introduction.stories.mdx +12 -0
- package/src/stories/Link.stories.tsx +99 -0
- package/src/stories/LinkList.stories.tsx +68 -0
- package/src/stories/List.stories.tsx +246 -0
- package/src/stories/Loading.stories.tsx +103 -0
- package/src/stories/Notification.stories.tsx +154 -0
- package/src/stories/Pagination.stories.tsx +63 -0
- package/src/stories/Profile.stories.tsx +84 -0
- package/src/stories/ReadMore.stories.tsx +80 -0
- package/src/stories/RichText.stories.tsx +59 -0
- package/src/stories/SearchField.stories.tsx +87 -0
- package/src/stories/TableOfContents.stories.tsx +50 -0
- package/src/stories/Tag.stories.tsx +194 -0
- package/src/stories/Tooltip.stories.tsx +83 -0
- package/src/stories/Video.stories.tsx +69 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/types/index.ts +49 -0
- package/src/types/temp.d.ts +9 -0
- package/src/utils/checkArrayDuplicates.ts +3 -0
- package/src/utils/createChainedFunction.ts +31 -0
- package/src/utils/getDefaultDimensionValue.ts +28 -0
- package/src/utils/hoursMinutesSeconds.ts +8 -0
- package/src/utils/transitionEndListener.ts +29 -0
- package/src/utils/triggerBrowserReflow.ts +4 -0
- package/storybook-static/0.f9bb25299a048d2bb825.manager.bundle.js +2 -0
- package/storybook-static/0.f9bb25299a048d2bb825.manager.bundle.js.LICENSE.txt +8 -0
- package/storybook-static/01daf23af61cc99e9d75.woff2 +0 -0
- package/storybook-static/06a2da828c8b6497ba7a.woff +0 -0
- package/storybook-static/0fa24adac56865ac7e5f.ttf +0 -0
- package/storybook-static/12ec02e7e66abaf38243.eot +0 -0
- package/storybook-static/164.8f6e5926.iframe.bundle.js +2 -0
- package/storybook-static/164.8f6e5926.iframe.bundle.js.LICENSE.txt +8 -0
- package/storybook-static/181.1d6d475b.iframe.bundle.js +1 -0
- package/storybook-static/1cc3364249fd0db446ad.ttf +0 -0
- package/storybook-static/1dbed2ef5cef8fcb4cbe.ttf +0 -0
- package/storybook-static/1fa1c16a4a45d13f0df8.ttf +0 -0
- package/storybook-static/23cdaa8575b5e003dcde.eot +0 -0
- package/storybook-static/248db78ddf1e3568728d.woff +0 -0
- package/storybook-static/27d33755a2b827666dc5.woff +0 -0
- package/storybook-static/29.8e0bc9a8.iframe.bundle.js +2 -0
- package/storybook-static/29.8e0bc9a8.iframe.bundle.js.LICENSE.txt +102 -0
- package/storybook-static/2ac1a95228cf06e17040.woff2 +0 -0
- package/storybook-static/337.b8defe66.iframe.bundle.js +2 -0
- package/storybook-static/337.b8defe66.iframe.bundle.js.LICENSE.txt +11 -0
- package/storybook-static/3579203659b1428de036.eot +0 -0
- package/storybook-static/36229f80a738c199462d.woff2 +0 -0
- package/storybook-static/409a9c398a28ee4d74ff.eot +0 -0
- package/storybook-static/431.8ab7c276.iframe.bundle.js +1 -0
- package/storybook-static/431.b32fed6077acc140df7c.manager.bundle.js +1 -0
- package/storybook-static/4bf5fc6f93ba10519c82.eot +0 -0
- package/storybook-static/51d7da3f5e58e3a24a84.woff +0 -0
- package/storybook-static/697.1f42ad69d33c2733c631.manager.bundle.js +1 -0
- package/storybook-static/697.9e56beef.iframe.bundle.js +1 -0
- package/storybook-static/6a159f0a2005668f1f78.woff +0 -0
- package/storybook-static/6f781753b674130d947a.ttf +0 -0
- package/storybook-static/70a240717e773fe567b3.woff2 +0 -0
- package/storybook-static/720.f44d4e1f5203b6083ae4.manager.bundle.js +1 -0
- package/storybook-static/730.1240c246.iframe.bundle.js +1 -0
- package/storybook-static/730.7223b772132e3e068755.manager.bundle.js +1 -0
- package/storybook-static/73ba1c910e0f7bfc6b18.woff2 +0 -0
- package/storybook-static/88739612501023fa15e3.woff +0 -0
- package/storybook-static/8a142c29a318c432117a.woff +0 -0
- package/storybook-static/914.8ddb80ae2badda1468b0.manager.bundle.js +2 -0
- package/storybook-static/914.8ddb80ae2badda1468b0.manager.bundle.js.LICENSE.txt +94 -0
- package/storybook-static/978.236a5d9d5736517b960e.manager.bundle.js +2 -0
- package/storybook-static/978.236a5d9d5736517b960e.manager.bundle.js.LICENSE.txt +12 -0
- package/storybook-static/978.32e8032b.iframe.bundle.js +2 -0
- package/storybook-static/978.32e8032b.iframe.bundle.js.LICENSE.txt +12 -0
- package/storybook-static/9db5d05810cb98f2831f.ttf +0 -0
- package/storybook-static/9ff97e342523931a4992.eot +0 -0
- package/storybook-static/a40d436619020fb67db5.woff +0 -0
- package/storybook-static/a41d7e330757fb4b2125.woff2 +0 -0
- package/storybook-static/ab3494afe25b712485ed.woff +0 -0
- package/storybook-static/b53d0e74edc5a5fbef0a.ttf +0 -0
- package/storybook-static/b70a9c0ad8e8b43f5e6c.ttf +0 -0
- package/storybook-static/c12a83f816844ff94375.ttf +0 -0
- package/storybook-static/c5116d16544f932eba4b.eot +0 -0
- package/storybook-static/c807e115c00aaffbac11.woff2 +0 -0
- package/storybook-static/cadb6b94d6b0ecc3a86a.woff2 +0 -0
- package/storybook-static/d0cff1b064bcd84324fe.eot +0 -0
- package/storybook-static/d3434771ad7e9030387e.ttf +0 -0
- package/storybook-static/d8610c2a4fe5c177f4f6.woff +0 -0
- package/storybook-static/d970f426740b938f39e1.woff +0 -0
- package/storybook-static/d9c7eba773ff1c8df5bb.eot +0 -0
- package/storybook-static/dd4645bdb2f1e1a47ed7.woff2 +0 -0
- package/storybook-static/e0a63577ac642885f067.eot +0 -0
- package/storybook-static/e2625b8a1277972c9240.ttf +0 -0
- package/storybook-static/f469ea3aa8aacf7ad83a.eot +0 -0
- package/storybook-static/f632ebfa0d7b7085d542.woff2 +0 -0
- package/storybook-static/f93e2252d7112c3bcca5.woff2 +0 -0
- package/storybook-static/favicon.ico +0 -0
- package/storybook-static/iframe.html +348 -0
- package/storybook-static/index.html +59 -0
- package/storybook-static/main.01e6a863.iframe.bundle.js +1 -0
- package/storybook-static/main.dc406261155f1ebb44ce.manager.bundle.js +1 -0
- package/storybook-static/reactPlayerDailyMotion.469cc00f.iframe.bundle.js +1 -0
- package/storybook-static/reactPlayerFacebook.1423bb15.iframe.bundle.js +1 -0
- package/storybook-static/reactPlayerFilePlayer.e19e24a0.iframe.bundle.js +1 -0
- package/storybook-static/reactPlayerKaltura.d1eb0868.iframe.bundle.js +1 -0
- package/storybook-static/reactPlayerMixcloud.9f1b1691.iframe.bundle.js +1 -0
- package/storybook-static/reactPlayerPreview.9295696b.iframe.bundle.js +1 -0
- package/storybook-static/reactPlayerSoundCloud.d420395c.iframe.bundle.js +1 -0
- package/storybook-static/reactPlayerStreamable.9b655bf3.iframe.bundle.js +1 -0
- package/storybook-static/reactPlayerTwitch.e90e6dea.iframe.bundle.js +1 -0
- package/storybook-static/reactPlayerVidyard.a37ae6b3.iframe.bundle.js +1 -0
- package/storybook-static/reactPlayerVimeo.a7f367ee.iframe.bundle.js +1 -0
- package/storybook-static/reactPlayerWistia.fb351944.iframe.bundle.js +1 -0
- package/storybook-static/reactPlayerYouTube.3514e11a.iframe.bundle.js +1 -0
- package/storybook-static/runtime~main.012769eac0433a7ec083.manager.bundle.js +1 -0
- package/storybook-static/runtime~main.f3168ed5.iframe.bundle.js +1 -0
- package/storybook-static/static/css/main.3d116812.css +3 -0
- package/storybook-static/static/css/main.3d116812.css.map +1 -0
- package/tsconfig.build.json +15 -0
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TableOfContentsProps } from "./TableOfContents.props";
|
|
2
|
+
|
|
3
|
+
const toc: TableOfContentsProps = {
|
|
4
|
+
items: [
|
|
5
|
+
{
|
|
6
|
+
href: "#example",
|
|
7
|
+
label: "Item One",
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
href: "#example",
|
|
11
|
+
label: "Item Two",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
href: "#example",
|
|
15
|
+
label: "Item Three",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
href: "#example",
|
|
19
|
+
label: "Item Four",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
href: "#example",
|
|
23
|
+
label: "Item Five",
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Sample prop definitions for Lists's enumerable properties (imported in stories and test)
|
|
30
|
+
*/
|
|
31
|
+
const TableOfContentsArgs = {
|
|
32
|
+
toc,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default TableOfContentsArgs;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface AnchorLink {
|
|
2
|
+
/**
|
|
3
|
+
* Specify the label for the anchor link
|
|
4
|
+
*/
|
|
5
|
+
label?: Required<string>;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Specify the href for the anchor link
|
|
9
|
+
*/
|
|
10
|
+
href?: Required<string>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface TableOfContentsProps {
|
|
14
|
+
/**
|
|
15
|
+
* Specify an optional className to be added to your accordion.
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Specify the items in the table of contents
|
|
21
|
+
*/
|
|
22
|
+
items?: Required<Array<AnchorLink>>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import useGlobalSettings from "../../hooks/useGlobalSettings";
|
|
4
|
+
import { TableOfContentsProps } from "./TableOfContents.props";
|
|
5
|
+
|
|
6
|
+
const TableOfContents: FC<TableOfContentsProps> = ({ className, items }) => {
|
|
7
|
+
const { prefix } = useGlobalSettings();
|
|
8
|
+
const baseClass = `${prefix}--table-of-contents`;
|
|
9
|
+
|
|
10
|
+
const TableOfContentsClasses = classNames(className, {
|
|
11
|
+
[baseClass]: true,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<nav className={TableOfContentsClasses}>
|
|
16
|
+
<ul className={`${baseClass}--list`}>
|
|
17
|
+
{items &&
|
|
18
|
+
items.map((item: any, index: any) => {
|
|
19
|
+
return (
|
|
20
|
+
<li className={`${baseClass}--list--item`} key={index}>
|
|
21
|
+
<a className={`${baseClass}--link`} href={item.href}>
|
|
22
|
+
{item.label}
|
|
23
|
+
</a>
|
|
24
|
+
</li>
|
|
25
|
+
);
|
|
26
|
+
})}
|
|
27
|
+
</ul>
|
|
28
|
+
</nav>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default TableOfContents;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TableOfContents } from "./TableOfContents";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TagProps } from "./Tag.props";
|
|
2
|
+
|
|
3
|
+
const tag: TagProps = {
|
|
4
|
+
children: "",
|
|
5
|
+
id: "tag1",
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Sample prop definitions for Tag's enumerable properties (imported in stories and tests).
|
|
10
|
+
*/
|
|
11
|
+
const TagArgs = {
|
|
12
|
+
tag,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default TagArgs;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { tagTypes } from "../../types";
|
|
3
|
+
|
|
4
|
+
export interface TagProps {
|
|
5
|
+
/**
|
|
6
|
+
* Callback to event;
|
|
7
|
+
*/
|
|
8
|
+
callback?: function;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Specify the label for the tag
|
|
12
|
+
*/
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The tag's unique id.
|
|
17
|
+
*/
|
|
18
|
+
id: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Specify an optional className to be added to your Tag.
|
|
22
|
+
*/
|
|
23
|
+
className?: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Specify a tag type
|
|
27
|
+
*/
|
|
28
|
+
type?: tagTypes;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Specify an optional url to be added to your Tag.
|
|
32
|
+
*/
|
|
33
|
+
url?: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { useContext, FC } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import useGlobalSettings from "../../hooks/useGlobalSettings";
|
|
4
|
+
import { TagProps } from "./Tag.props";
|
|
5
|
+
import { TagSetContext } from "./TagSet";
|
|
6
|
+
import { Icon } from "../Icon";
|
|
7
|
+
|
|
8
|
+
const Tag: FC<TagProps> = ({
|
|
9
|
+
className,
|
|
10
|
+
children,
|
|
11
|
+
id,
|
|
12
|
+
url,
|
|
13
|
+
type,
|
|
14
|
+
callback,
|
|
15
|
+
...rest
|
|
16
|
+
}) => {
|
|
17
|
+
const { prefix } = useGlobalSettings();
|
|
18
|
+
const { activeItems, setActiveItems, getUpdatedItems, allowMultipleActive } =
|
|
19
|
+
useContext(TagSetContext);
|
|
20
|
+
const active = activeItems.indexOf(id) > -1;
|
|
21
|
+
|
|
22
|
+
const baseClass = `${prefix}--tag`;
|
|
23
|
+
const itemClass = `${prefix}--tag-set__item`;
|
|
24
|
+
const stringType = type as string;
|
|
25
|
+
const tagClasses = classNames(className, {
|
|
26
|
+
[baseClass]: true,
|
|
27
|
+
[`${baseClass}--active`]: active,
|
|
28
|
+
[`${baseClass}--${type}`]: type,
|
|
29
|
+
[`icon icon__position--right`]: true,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
let visible = active;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* On click, get id of clicked item, and set that item in state to 'active', all others to 'closed'
|
|
36
|
+
*/
|
|
37
|
+
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
38
|
+
setActiveItems(
|
|
39
|
+
getUpdatedItems({ id, itemStatuses: activeItems, allowMultipleActive })
|
|
40
|
+
);
|
|
41
|
+
visible = false;
|
|
42
|
+
if (callback) {
|
|
43
|
+
callback(e);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
const renderButton = () => {
|
|
49
|
+
let button;
|
|
50
|
+
|
|
51
|
+
if (visible) {
|
|
52
|
+
button = (
|
|
53
|
+
<li className={itemClass}>
|
|
54
|
+
<button
|
|
55
|
+
type="button"
|
|
56
|
+
className={tagClasses}
|
|
57
|
+
onClick={(e) => handleClick(e)}
|
|
58
|
+
id={id}
|
|
59
|
+
{...rest}
|
|
60
|
+
>
|
|
61
|
+
{children}
|
|
62
|
+
<Icon name="close" hidden={true} />
|
|
63
|
+
</button>
|
|
64
|
+
</li>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return button;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<>
|
|
73
|
+
{stringType === "button" ? (
|
|
74
|
+
<>{renderButton()}</>
|
|
75
|
+
) : (
|
|
76
|
+
<li className={itemClass}>
|
|
77
|
+
{type === "anchor" && (
|
|
78
|
+
<a
|
|
79
|
+
className={tagClasses}
|
|
80
|
+
href={active ? url : ""}
|
|
81
|
+
id={id}
|
|
82
|
+
{...rest}
|
|
83
|
+
>
|
|
84
|
+
{children}
|
|
85
|
+
</a>
|
|
86
|
+
)}
|
|
87
|
+
|
|
88
|
+
{type === "display" && (
|
|
89
|
+
<span className={tagClasses} id={id} {...rest}>
|
|
90
|
+
{children}
|
|
91
|
+
</span>
|
|
92
|
+
)}
|
|
93
|
+
</li>
|
|
94
|
+
)}
|
|
95
|
+
</>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default Tag;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { TagSetProps } from "./TagSet.props";
|
|
2
|
+
|
|
3
|
+
const tag: TagSetProps = {
|
|
4
|
+
allowMultipleActive: true,
|
|
5
|
+
onButtonClick: (e) => {
|
|
6
|
+
console.log(e.target);
|
|
7
|
+
},
|
|
8
|
+
children: "",
|
|
9
|
+
defaultTagActive: ["tag1", "tag2"],
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const buttonTag: TagSetProps = {
|
|
13
|
+
allowMultipleActive: true,
|
|
14
|
+
onButtonClick: (e) => {
|
|
15
|
+
console.log(e.target);
|
|
16
|
+
},
|
|
17
|
+
children: "",
|
|
18
|
+
defaultTagActive: [
|
|
19
|
+
"tag1",
|
|
20
|
+
"tag2",
|
|
21
|
+
"tag3",
|
|
22
|
+
"tag4",
|
|
23
|
+
"tag5",
|
|
24
|
+
"tag6",
|
|
25
|
+
"tag7",
|
|
26
|
+
"tag8",
|
|
27
|
+
"tag9",
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Sample prop definitions for TagSet's enumerable properties (imported in stories and tests).
|
|
33
|
+
*/
|
|
34
|
+
const TagSetArgs = {
|
|
35
|
+
buttonTag,
|
|
36
|
+
tag,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default TagSetArgs;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export { default as TagSet } from "./TagSet";
|
|
2
|
+
|
|
3
|
+
export interface TagSetProps {
|
|
4
|
+
/**
|
|
5
|
+
* Allow multiple tags to be active at once
|
|
6
|
+
*/
|
|
7
|
+
allowMultipleActive?: boolean;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Callback to onButtonClick event;
|
|
11
|
+
*/
|
|
12
|
+
onButtonClick?: (e: MouseEvent<HTMLButtonElement>, i: any) => void;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Specify the content of your Tag.
|
|
16
|
+
*/
|
|
17
|
+
children: ReactElement<TagSet> | Array<ReactElement<TagSet>>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Specify an optional className to be added to your accordion.
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Default Tags that are active
|
|
26
|
+
*/
|
|
27
|
+
defaultTagActive?: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface TagSetContextProps {
|
|
31
|
+
activeItems: string[];
|
|
32
|
+
getUpdatedItems: getUpdatedItems;
|
|
33
|
+
setActiveItems: Dispatch<SetStateAction<string[]>>;
|
|
34
|
+
allowMultipleActive: boolean;
|
|
35
|
+
onButtonClick?: (e: MouseEvent<HTMLButtonElement>, i: any) => void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useState,
|
|
3
|
+
useEffect,
|
|
4
|
+
createContext,
|
|
5
|
+
FC,
|
|
6
|
+
ReactElement,
|
|
7
|
+
Children,
|
|
8
|
+
} from "react";
|
|
9
|
+
import classNames from "classnames";
|
|
10
|
+
import useGlobalSettings from "../../hooks/useGlobalSettings";
|
|
11
|
+
import { TagSetContextProps, TagSetProps } from "./TagSet.props";
|
|
12
|
+
import { getUpdatedItems } from "@ilo-org/utils";
|
|
13
|
+
import { checkArrayDuplicates } from "../../utils/checkArrayDuplicates";
|
|
14
|
+
|
|
15
|
+
export const TagSetContext = createContext({} as TagSetContextProps);
|
|
16
|
+
|
|
17
|
+
const TagSet: FC<TagSetProps> = ({
|
|
18
|
+
className,
|
|
19
|
+
children,
|
|
20
|
+
onButtonClick,
|
|
21
|
+
defaultTagActive = [],
|
|
22
|
+
allowMultipleActive = true,
|
|
23
|
+
...rest
|
|
24
|
+
}) => {
|
|
25
|
+
const { prefix } = useGlobalSettings();
|
|
26
|
+
const baseClass = `${prefix}--tag-set`;
|
|
27
|
+
const [activeItems, setActiveItems] = useState<string[]>([]);
|
|
28
|
+
|
|
29
|
+
const defaultTagActiveString = JSON.stringify(defaultTagActive);
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const tagOnLoad = allowMultipleActive
|
|
33
|
+
? defaultTagActive
|
|
34
|
+
: defaultTagActive.length > 0
|
|
35
|
+
? [defaultTagActive[0]]
|
|
36
|
+
: defaultTagActive;
|
|
37
|
+
setActiveItems(tagOnLoad);
|
|
38
|
+
}, [defaultTagActiveString, allowMultipleActive]); //eslint-disable-line react-hooks/exhaustive-deps
|
|
39
|
+
|
|
40
|
+
if (children) {
|
|
41
|
+
const ids: string[] = [];
|
|
42
|
+
Children.forEach(children, (child: ReactElement) => {
|
|
43
|
+
ids.push(child.props.id);
|
|
44
|
+
});
|
|
45
|
+
if (checkArrayDuplicates(ids)) {
|
|
46
|
+
console.warn("Warning: Tags must have unique ids.");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const tagClasses = classNames(className, {
|
|
51
|
+
[baseClass]: true,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<TagSetContext.Provider
|
|
56
|
+
value={{
|
|
57
|
+
activeItems,
|
|
58
|
+
setActiveItems,
|
|
59
|
+
getUpdatedItems,
|
|
60
|
+
allowMultipleActive,
|
|
61
|
+
onButtonClick,
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<ul className={tagClasses} {...rest}>
|
|
65
|
+
{children}
|
|
66
|
+
</ul>
|
|
67
|
+
</TagSetContext.Provider>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default TagSet;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { TextareaProps } from "./Textarea.props";
|
|
2
|
+
|
|
3
|
+
const basic: TextareaProps = {
|
|
4
|
+
callback: "",
|
|
5
|
+
disabled: false,
|
|
6
|
+
error: false,
|
|
7
|
+
helper: false,
|
|
8
|
+
label: "Textarea",
|
|
9
|
+
name: "textarea",
|
|
10
|
+
placeholder: "Textarea",
|
|
11
|
+
required: false,
|
|
12
|
+
spellcheck: false,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const hashelper: TextareaProps = {
|
|
16
|
+
callback: "",
|
|
17
|
+
disabled: false,
|
|
18
|
+
error: false,
|
|
19
|
+
helper: "This one has helper text",
|
|
20
|
+
label: "Textarea",
|
|
21
|
+
name: "textarea",
|
|
22
|
+
placeholder: "Textarea",
|
|
23
|
+
required: false,
|
|
24
|
+
spellcheck: false,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const haserror: TextareaProps = {
|
|
28
|
+
callback: "",
|
|
29
|
+
disabled: false,
|
|
30
|
+
error: "This one has an error",
|
|
31
|
+
helper: false,
|
|
32
|
+
label: "Textarea",
|
|
33
|
+
name: "textarea",
|
|
34
|
+
placeholder: "Textarea",
|
|
35
|
+
required: false,
|
|
36
|
+
spellcheck: false,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const hastooltip: TextareaProps = {
|
|
40
|
+
callback: "",
|
|
41
|
+
disabled: false,
|
|
42
|
+
error: false,
|
|
43
|
+
helper: false,
|
|
44
|
+
label: "Textarea",
|
|
45
|
+
name: "textarea",
|
|
46
|
+
placeholder: "Textarea",
|
|
47
|
+
required: false,
|
|
48
|
+
spellcheck: false,
|
|
49
|
+
tooltip: "This is the tooltip",
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Sample prop definitions Textarea's enumerable properties (imported in stories and test)
|
|
54
|
+
*/
|
|
55
|
+
const TextareaArgs = {
|
|
56
|
+
basic,
|
|
57
|
+
hashelper,
|
|
58
|
+
haserror,
|
|
59
|
+
hastooltip,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default TextareaArgs;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export interface TextareaProps {
|
|
2
|
+
/**
|
|
3
|
+
* The Textarea's onChange callback.
|
|
4
|
+
*/
|
|
5
|
+
callback: function;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Specify an optional className to be added to your Textarea.
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Is the Textarea disabled?
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Does the Textarea have an error?
|
|
19
|
+
*/
|
|
20
|
+
error?: string | false;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The Textarea's helper text
|
|
24
|
+
*/
|
|
25
|
+
helper: string | false;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The Textarea's id attribute
|
|
29
|
+
*/
|
|
30
|
+
id?: string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Does this Textarea have a label?
|
|
34
|
+
*/
|
|
35
|
+
label: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The Textarea's maxlength
|
|
39
|
+
*/
|
|
40
|
+
maxlength?: number;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The Textarea's minlength
|
|
44
|
+
*/
|
|
45
|
+
minlength?: number;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The Textarea's name attribute
|
|
49
|
+
*/
|
|
50
|
+
name?: Required<string>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Specify an optional className to be added to your Textarea component.
|
|
54
|
+
*/
|
|
55
|
+
placeholder?: string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Specify whether this Textarea is required
|
|
59
|
+
*/
|
|
60
|
+
required?: boolean;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Specify whether this Textarea employs browser-based spellcheck
|
|
64
|
+
*/
|
|
65
|
+
spellcheck?: boolean;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Does this Textarea have a tooltip?
|
|
69
|
+
*/
|
|
70
|
+
tooltip?: string;
|
|
71
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import useGlobalSettings from "../../hooks/useGlobalSettings";
|
|
4
|
+
import { TextareaProps } from "./Textarea.props";
|
|
5
|
+
import { Fieldset } from "../Fieldset";
|
|
6
|
+
import { FormElement } from "../FormElement";
|
|
7
|
+
|
|
8
|
+
const Textarea: FC<TextareaProps> = ({
|
|
9
|
+
callback,
|
|
10
|
+
disabled = false,
|
|
11
|
+
error,
|
|
12
|
+
helper,
|
|
13
|
+
id,
|
|
14
|
+
label,
|
|
15
|
+
maxlength,
|
|
16
|
+
minlength,
|
|
17
|
+
name,
|
|
18
|
+
placeholder,
|
|
19
|
+
required,
|
|
20
|
+
spellcheck,
|
|
21
|
+
tooltip,
|
|
22
|
+
}) => {
|
|
23
|
+
const { prefix } = useGlobalSettings();
|
|
24
|
+
const baseClass = `${prefix}--textarea`;
|
|
25
|
+
|
|
26
|
+
const TextareaClasses = classNames("", {
|
|
27
|
+
[baseClass]: true,
|
|
28
|
+
[`error`]: error,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* On change, if there is a callback, call it
|
|
33
|
+
*/
|
|
34
|
+
const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
35
|
+
if (callback) {
|
|
36
|
+
callback(e);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Fieldset legend={false} fieldsetid={false}>
|
|
42
|
+
<FormElement
|
|
43
|
+
elemid={name as any}
|
|
44
|
+
label={label}
|
|
45
|
+
helper={helper as any}
|
|
46
|
+
error={error as any}
|
|
47
|
+
required={required as any}
|
|
48
|
+
tooltip={tooltip}
|
|
49
|
+
>
|
|
50
|
+
<textarea
|
|
51
|
+
id={id}
|
|
52
|
+
name={name}
|
|
53
|
+
onChange={handleChange}
|
|
54
|
+
disabled={disabled}
|
|
55
|
+
placeholder={placeholder}
|
|
56
|
+
required={required as any}
|
|
57
|
+
className={TextareaClasses}
|
|
58
|
+
maxLength={maxlength}
|
|
59
|
+
minLength={minlength}
|
|
60
|
+
spellCheck={spellcheck}
|
|
61
|
+
/>
|
|
62
|
+
</FormElement>
|
|
63
|
+
</Fieldset>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default Textarea;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Textarea } from "./Textarea";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TooltipProps } from "./Tooltip.props";
|
|
2
|
+
|
|
3
|
+
const light: TooltipProps = {
|
|
4
|
+
children: "<button>test<button>",
|
|
5
|
+
label: "This is a tooltip",
|
|
6
|
+
theme: "light", // "light" | "dark" ;
|
|
7
|
+
isVisible: false,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const lighticon: TooltipProps = {
|
|
11
|
+
children: "<button>test<button>",
|
|
12
|
+
icon: true,
|
|
13
|
+
label: "This is a tooltip",
|
|
14
|
+
theme: "light", // "light" | "dark" ;
|
|
15
|
+
isVisible: false,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const dark: TooltipProps = {
|
|
19
|
+
children: "<button>test<button>",
|
|
20
|
+
label: "This is a tooltip",
|
|
21
|
+
theme: "dark", // "light" | "dark" ;
|
|
22
|
+
isVisible: false,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const darkicon: TooltipProps = {
|
|
26
|
+
children: "<button>test<button>",
|
|
27
|
+
icon: true,
|
|
28
|
+
label: "This is a tooltip",
|
|
29
|
+
theme: "dark", // "light" | "dark" ;
|
|
30
|
+
isVisible: false,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Sample prop definitions for Tooltip's enumerable properties (imported in stories and tests).
|
|
35
|
+
*/
|
|
36
|
+
const tooltipArgs = {
|
|
37
|
+
light,
|
|
38
|
+
lighticon,
|
|
39
|
+
dark,
|
|
40
|
+
darkicon,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default tooltipArgs;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { tooltipAlignment, tooltipPlacement, tooltipThemes } from "../../types";
|
|
2
|
+
|
|
3
|
+
export interface TooltipProps {
|
|
4
|
+
/**
|
|
5
|
+
* Specify the content of your Tooltip.
|
|
6
|
+
*/
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Specify an optional className to be added to your Tooltip.
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Should the tooltip appear on hover of an info icon?
|
|
16
|
+
*/
|
|
17
|
+
icon?: boolean;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Set the label for the tooltip
|
|
21
|
+
*/
|
|
22
|
+
label?: Required<string>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Set whether the tooltip is visible or not
|
|
26
|
+
*/
|
|
27
|
+
isVisible?: boolean;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Callback fired onMouseOver
|
|
31
|
+
*/
|
|
32
|
+
onMouseOver?: function;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Callback fired onMouseOut
|
|
36
|
+
*/
|
|
37
|
+
onMouseOut?: function;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Describe the theme of the tooltip
|
|
41
|
+
*/
|
|
42
|
+
theme?: Required<tooltipThemes>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Set a width for the tooltip
|
|
46
|
+
*/
|
|
47
|
+
width?: string;
|
|
48
|
+
}
|