@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,22 @@
|
|
|
1
|
+
import { CheckboxProps } from "./Checkbox.props";
|
|
2
|
+
|
|
3
|
+
const basic: CheckboxProps = {
|
|
4
|
+
callback: "",
|
|
5
|
+
disabled: false,
|
|
6
|
+
error: false,
|
|
7
|
+
grouped: false,
|
|
8
|
+
helper: false,
|
|
9
|
+
label: "Checkbox Label",
|
|
10
|
+
name: "checkbox",
|
|
11
|
+
required: false,
|
|
12
|
+
type: "checkbox",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Sample prop definitions Checkbox's enumerable properties (imported in stories and test)
|
|
17
|
+
*/
|
|
18
|
+
const CheckboxArgs = {
|
|
19
|
+
basic,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default CheckboxArgs;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export interface CheckboxProps {
|
|
2
|
+
/**
|
|
3
|
+
* The checkbox's onChange callback.
|
|
4
|
+
*/
|
|
5
|
+
callback: function;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Specify an optional className to be added to your checkbox.
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Is the checkbox disabled?
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Does the checkbox have an error?
|
|
19
|
+
*/
|
|
20
|
+
error?: string | false;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Is this checkbox part of a group?
|
|
24
|
+
*/
|
|
25
|
+
grouped?: boolean;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The checkbox's helper text
|
|
29
|
+
*/
|
|
30
|
+
helper: string | false;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The checkbox's id attribute
|
|
34
|
+
*/
|
|
35
|
+
id?: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Does this checkbox have a label?
|
|
39
|
+
*/
|
|
40
|
+
label: string;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The checkbox's name attribute
|
|
44
|
+
*/
|
|
45
|
+
name?: Required<string>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Specify whether this checkbox is required
|
|
49
|
+
*/
|
|
50
|
+
required?: boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Does this checkbox have a tooltip?
|
|
54
|
+
*/
|
|
55
|
+
tooltip?: string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The input's type.
|
|
59
|
+
*/
|
|
60
|
+
type?: "checkbox";
|
|
61
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { FC, useState } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import useGlobalSettings from "../../hooks/useGlobalSettings";
|
|
4
|
+
import { CheckboxProps } from "./Checkbox.props";
|
|
5
|
+
import { Fieldset } from "../Fieldset";
|
|
6
|
+
import { FormElement } from "../FormElement";
|
|
7
|
+
|
|
8
|
+
const Checkbox: FC<CheckboxProps> = ({
|
|
9
|
+
callback,
|
|
10
|
+
disabled = false,
|
|
11
|
+
error,
|
|
12
|
+
grouped,
|
|
13
|
+
helper,
|
|
14
|
+
id,
|
|
15
|
+
label,
|
|
16
|
+
name,
|
|
17
|
+
required,
|
|
18
|
+
tooltip,
|
|
19
|
+
}) => {
|
|
20
|
+
const { prefix } = useGlobalSettings();
|
|
21
|
+
const baseClass = `${prefix}--checkbox`;
|
|
22
|
+
|
|
23
|
+
const CheckboxClasses = classNames("", {
|
|
24
|
+
[baseClass]: true,
|
|
25
|
+
[`error`]: error,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const [checked, setChecked] = useState(false);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* On change, if there is a callback, call it
|
|
32
|
+
*/
|
|
33
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
34
|
+
setChecked(e.target.checked);
|
|
35
|
+
|
|
36
|
+
if (callback) {
|
|
37
|
+
callback(e);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<>
|
|
43
|
+
{grouped && (
|
|
44
|
+
<FormElement
|
|
45
|
+
elemid={id as any}
|
|
46
|
+
label={label}
|
|
47
|
+
helper={helper as any}
|
|
48
|
+
error={error as any}
|
|
49
|
+
required={required as any}
|
|
50
|
+
tooltip={tooltip}
|
|
51
|
+
>
|
|
52
|
+
<input
|
|
53
|
+
id={id}
|
|
54
|
+
name={name}
|
|
55
|
+
onChange={handleChange}
|
|
56
|
+
disabled={disabled}
|
|
57
|
+
required={required as any}
|
|
58
|
+
type={"checkbox"}
|
|
59
|
+
className={CheckboxClasses}
|
|
60
|
+
checked={checked}
|
|
61
|
+
/>
|
|
62
|
+
</FormElement>
|
|
63
|
+
)}
|
|
64
|
+
{!grouped && (
|
|
65
|
+
<Fieldset legend={false} fieldsetid={false}>
|
|
66
|
+
<FormElement
|
|
67
|
+
elemid={id as any}
|
|
68
|
+
label={label}
|
|
69
|
+
helper={helper as any}
|
|
70
|
+
error={error as any}
|
|
71
|
+
required={required as any}
|
|
72
|
+
tooltip={tooltip}
|
|
73
|
+
type={"checkbox"}
|
|
74
|
+
>
|
|
75
|
+
<input
|
|
76
|
+
id={id}
|
|
77
|
+
name={name}
|
|
78
|
+
onChange={handleChange}
|
|
79
|
+
disabled={disabled}
|
|
80
|
+
required={required as any}
|
|
81
|
+
type={"checkbox"}
|
|
82
|
+
className={CheckboxClasses}
|
|
83
|
+
checked={checked}
|
|
84
|
+
/>
|
|
85
|
+
</FormElement>
|
|
86
|
+
</Fieldset>
|
|
87
|
+
)}
|
|
88
|
+
</>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export default Checkbox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Checkbox } from "./Checkbox";
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { ChoiceGroupProps } from "./ChoiceGroup.props";
|
|
2
|
+
import CheckboxArgs from "../Checkbox/Checkbox.args";
|
|
3
|
+
import RadioArgs from "../Radio/Radio.args";
|
|
4
|
+
|
|
5
|
+
const checkboxfields = [];
|
|
6
|
+
const radiofields = [];
|
|
7
|
+
|
|
8
|
+
for (let i = 0; i < 5; i++) {
|
|
9
|
+
const checkboxargs = { ...CheckboxArgs.basic };
|
|
10
|
+
const radioargs = { ...RadioArgs.basic };
|
|
11
|
+
checkboxfields.push(checkboxargs);
|
|
12
|
+
checkboxfields[i].label = `Checkbox ${i}`;
|
|
13
|
+
checkboxfields[i].name = `checkbox${i}`;
|
|
14
|
+
checkboxfields[i].grouped = true;
|
|
15
|
+
checkboxfields[i].type = "checkbox";
|
|
16
|
+
radiofields.push(radioargs);
|
|
17
|
+
radiofields[i].label = `Radio ${i}`;
|
|
18
|
+
radiofields[i].name = `radio${i}`;
|
|
19
|
+
radiofields[i].type = "radio";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const checkboxes: ChoiceGroupProps = {
|
|
23
|
+
choicegroupid: "checkboxgroup",
|
|
24
|
+
items: checkboxfields,
|
|
25
|
+
legend: "Checkbox Legend",
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const radios: ChoiceGroupProps = {
|
|
29
|
+
choicegroupid: "radiogroup",
|
|
30
|
+
items: radiofields,
|
|
31
|
+
legend: "Radio Legend",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const checkboxeshelper: ChoiceGroupProps = {
|
|
35
|
+
choicegroupid: "checkboxgroup",
|
|
36
|
+
grouphelper: "This is the helper text",
|
|
37
|
+
items: checkboxfields,
|
|
38
|
+
legend: "Checkbox Legend",
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const radioshelper: ChoiceGroupProps = {
|
|
42
|
+
choicegroupid: "radiogroup",
|
|
43
|
+
grouphelper: "This is the helper text",
|
|
44
|
+
items: radiofields,
|
|
45
|
+
legend: "Radio Legend",
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const checkboxeserror: ChoiceGroupProps = {
|
|
49
|
+
choicegroupid: "checkboxgroup",
|
|
50
|
+
grouperror: "this one has an error",
|
|
51
|
+
items: checkboxfields,
|
|
52
|
+
legend: "Checkbox Legend",
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const radioserror: ChoiceGroupProps = {
|
|
56
|
+
choicegroupid: "radiogroup",
|
|
57
|
+
grouperror: "this one has an error",
|
|
58
|
+
items: radiofields,
|
|
59
|
+
legend: "Radio Legend",
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const checkboxestooltip: ChoiceGroupProps = {
|
|
63
|
+
choicegroupid: "checkboxgroup",
|
|
64
|
+
items: checkboxfields,
|
|
65
|
+
legend: "Checkbox Legend",
|
|
66
|
+
grouptooltip: "This is the tooltip",
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const radiostooltip: ChoiceGroupProps = {
|
|
70
|
+
choicegroupid: "radiogroup",
|
|
71
|
+
items: radiofields,
|
|
72
|
+
legend: "Radio Legend",
|
|
73
|
+
grouptooltip: "This is the tooltip",
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Sample prop definitions ChoiceGroup's enumerable properties (imported in stories and test)
|
|
78
|
+
*/
|
|
79
|
+
const ChoiceGroupArgs = {
|
|
80
|
+
checkboxes,
|
|
81
|
+
radios,
|
|
82
|
+
checkboxeshelper,
|
|
83
|
+
radioshelper,
|
|
84
|
+
checkboxeserror,
|
|
85
|
+
radioserror,
|
|
86
|
+
checkboxestooltip,
|
|
87
|
+
radiostooltip,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export default ChoiceGroupArgs;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { CheckboxProps } from "../Checkbox/Checkbox.props";
|
|
2
|
+
import { RadioProps } from "../RadioProps/RadioProps.props";
|
|
3
|
+
import { fieldTypes } from "../../types";
|
|
4
|
+
|
|
5
|
+
// We can't put a form group inside a form group so let's remove that option
|
|
6
|
+
const choiceGroupFieldTypes = fieldTypes.filter(
|
|
7
|
+
(item) => item === "checkbox" || item === "radio"
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
interface ChoiceGroupItems {
|
|
11
|
+
/**
|
|
12
|
+
* The inputs in this choice group
|
|
13
|
+
*/
|
|
14
|
+
field: Required<CheckboxProps | RadioProps>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This item's field type
|
|
18
|
+
*/
|
|
19
|
+
type: Required<choiceGroupFieldTypes>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface ChoiceGroupProps {
|
|
23
|
+
/**
|
|
24
|
+
* Specify an optional className to be added to your ChoiceGroup component.
|
|
25
|
+
*/
|
|
26
|
+
className?: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The ID of the ChoiceGroup
|
|
30
|
+
*/
|
|
31
|
+
choicegroupid: Required<string>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Optional error text for the choice group
|
|
35
|
+
*/
|
|
36
|
+
grouperror?: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Optional helper text for the choice group
|
|
40
|
+
*/
|
|
41
|
+
grouphelper?: string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Optional tooltip text for the choice group
|
|
45
|
+
*/
|
|
46
|
+
grouptooltip?: string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The inputs in this ChoiceGroup
|
|
50
|
+
*/
|
|
51
|
+
items: Required<Array<FormGroupItems>>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The ChoiceGroup's legend
|
|
55
|
+
*/
|
|
56
|
+
legend: Required<string | false>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { ChoiceGroupProps } from "./ChoiceGroup.props";
|
|
3
|
+
import { Checkbox } from "../Checkbox";
|
|
4
|
+
import { Fieldset } from "../Fieldset";
|
|
5
|
+
import { Radio } from "../Radio";
|
|
6
|
+
|
|
7
|
+
const ChoiceGroup: FC<ChoiceGroupProps> = ({
|
|
8
|
+
className,
|
|
9
|
+
choicegroupid,
|
|
10
|
+
grouperror,
|
|
11
|
+
grouphelper,
|
|
12
|
+
grouptooltip,
|
|
13
|
+
items,
|
|
14
|
+
legend,
|
|
15
|
+
}) => {
|
|
16
|
+
// whatever type the first item has we expect from the other items
|
|
17
|
+
const sanitzeditems = items.filter((item: any) => item !== items[0].type);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Fieldset
|
|
21
|
+
className={`ilo--choice-group ${className ? className : ""}`}
|
|
22
|
+
legend={legend}
|
|
23
|
+
fieldsetid={choicegroupid}
|
|
24
|
+
grouphelper={grouphelper}
|
|
25
|
+
grouperror={grouperror}
|
|
26
|
+
grouptooltip={grouptooltip}
|
|
27
|
+
>
|
|
28
|
+
{sanitzeditems.map((item: any, i: any) => {
|
|
29
|
+
console.log(item);
|
|
30
|
+
if (item?.type === "checkbox") {
|
|
31
|
+
return <Checkbox {...(item as any)} key={i} />;
|
|
32
|
+
}
|
|
33
|
+
if (item?.type === "radio") {
|
|
34
|
+
return <Radio {...(item as any)} key={i} />;
|
|
35
|
+
}
|
|
36
|
+
})}
|
|
37
|
+
;
|
|
38
|
+
</Fieldset>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default ChoiceGroup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ChoiceGroup } from "./ChoiceGroup";
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
type Dimension = "height" | "width";
|
|
4
|
+
|
|
5
|
+
export interface CollapseProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Show the component; triggers the expand or collapse animation
|
|
10
|
+
*/
|
|
11
|
+
panelIn?: boolean;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Wait until the first "enter" transition to mount the component (add it to the DOM)
|
|
15
|
+
*/
|
|
16
|
+
mountOnEnter?: boolean;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Unmount the component (remove it from the DOM) when it is collapsed
|
|
20
|
+
*/
|
|
21
|
+
unmountOnExit?: boolean;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Run the expand animation when the component mounts, if it is initially
|
|
25
|
+
* shown
|
|
26
|
+
*/
|
|
27
|
+
appear?: boolean;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Duration of the collapse animation in milliseconds, to ensure that
|
|
31
|
+
* finishing callbacks are fired even if the original browser transition end
|
|
32
|
+
* events are canceled
|
|
33
|
+
*/
|
|
34
|
+
timeout?: number;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The dimension used when collapsing, or a function that returns the
|
|
38
|
+
* dimension
|
|
39
|
+
*/
|
|
40
|
+
dimension?: Dimension | (() => Dimension);
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Function that returns the height or width of the animating DOM node
|
|
44
|
+
*
|
|
45
|
+
* Allows for providing some custom logic for how much the Collapse component
|
|
46
|
+
* should animate in its specified dimension. Called with the current
|
|
47
|
+
* dimension prop value and the DOM node.
|
|
48
|
+
*
|
|
49
|
+
* @default element.offsetWidth | element.offsetHeight
|
|
50
|
+
*/
|
|
51
|
+
getDimensionValue?: (dimension: Dimension, element: HTMLElement) => number;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* ARIA role of collapsible element
|
|
55
|
+
*/
|
|
56
|
+
role?: string;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* You must provide a single JSX child element to this component and that element cannot be a \<React.Fragment\>
|
|
60
|
+
*/
|
|
61
|
+
children: React.ReactElement;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Callback fired before the component expands
|
|
65
|
+
*/
|
|
66
|
+
onEnter?: () => void;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Callback fired after the component starts to expand
|
|
70
|
+
*/
|
|
71
|
+
onEntering?: () => void;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Callback fired after the component has expanded
|
|
75
|
+
*/
|
|
76
|
+
onEntered?: () => void;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Callback fired before the component collapses
|
|
80
|
+
*/
|
|
81
|
+
onExit?: () => void;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Callback fired after the component starts to collapse
|
|
85
|
+
*/
|
|
86
|
+
onExiting?: () => void;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Callback fired after the component has collapsed
|
|
90
|
+
*/
|
|
91
|
+
onExited?: () => void;
|
|
92
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { useMemo, forwardRef, cloneElement } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import Transition, {
|
|
4
|
+
TransitionStatus,
|
|
5
|
+
ENTERED,
|
|
6
|
+
ENTERING,
|
|
7
|
+
EXITED,
|
|
8
|
+
EXITING,
|
|
9
|
+
} from "react-transition-group/Transition";
|
|
10
|
+
import transitionEndListener from "../../utils/transitionEndListener";
|
|
11
|
+
import createChainedFunction from "../../utils/createChainedFunction";
|
|
12
|
+
import triggerBrowserReflow from "../../utils/triggerBrowserReflow";
|
|
13
|
+
import getDefaultDimensionValue from "../../utils/getDefaultDimensionValue";
|
|
14
|
+
import { CollapseProps } from "./Collapse.props";
|
|
15
|
+
|
|
16
|
+
const collapseStyles = {
|
|
17
|
+
[EXITED]: "collapse",
|
|
18
|
+
[EXITING]: "collapsing",
|
|
19
|
+
[ENTERING]: "expanding",
|
|
20
|
+
[ENTERED]: "collapse show",
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Collapse = forwardRef<Transition<any>, CollapseProps>(
|
|
24
|
+
(
|
|
25
|
+
{
|
|
26
|
+
dimension = "height",
|
|
27
|
+
panelIn = false,
|
|
28
|
+
getDimensionValue = getDefaultDimensionValue,
|
|
29
|
+
timeout = 300,
|
|
30
|
+
onEnter,
|
|
31
|
+
onEntering,
|
|
32
|
+
onEntered,
|
|
33
|
+
onExit,
|
|
34
|
+
onExiting,
|
|
35
|
+
className,
|
|
36
|
+
children,
|
|
37
|
+
role,
|
|
38
|
+
...rest
|
|
39
|
+
},
|
|
40
|
+
ref
|
|
41
|
+
) => {
|
|
42
|
+
/* Compute dimension */
|
|
43
|
+
const computedDimension =
|
|
44
|
+
typeof dimension === "function" ? dimension() : dimension;
|
|
45
|
+
|
|
46
|
+
/* -- Expanding -- */
|
|
47
|
+
const handleEnter = useMemo(
|
|
48
|
+
() =>
|
|
49
|
+
createChainedFunction((elem: HTMLElement) => {
|
|
50
|
+
elem.style[computedDimension] = "0";
|
|
51
|
+
elem.style.transitionDuration = `${timeout + 50}ms`;
|
|
52
|
+
}, onEnter),
|
|
53
|
+
[computedDimension, onEnter, timeout]
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const handleEntering = useMemo(
|
|
57
|
+
() =>
|
|
58
|
+
createChainedFunction((elem: HTMLElement) => {
|
|
59
|
+
const scroll =
|
|
60
|
+
`scroll${computedDimension[0].toUpperCase()}${computedDimension.slice(
|
|
61
|
+
1
|
|
62
|
+
)}` as keyof HTMLElement;
|
|
63
|
+
elem.style[computedDimension] = `${elem[scroll]}px`;
|
|
64
|
+
elem.style.transitionDuration = `${timeout + 50}ms`;
|
|
65
|
+
}, onEntering),
|
|
66
|
+
[computedDimension, onEntering, timeout]
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const handleEntered = useMemo(
|
|
70
|
+
() =>
|
|
71
|
+
createChainedFunction((elem: HTMLElement) => {
|
|
72
|
+
elem.style[computedDimension] = "none";
|
|
73
|
+
elem.style.transitionDuration = `${timeout + 50}ms`;
|
|
74
|
+
}, onEntered),
|
|
75
|
+
[computedDimension, onEntered, timeout]
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
/* -- Collapsing -- */
|
|
79
|
+
const handleExit = useMemo(
|
|
80
|
+
() =>
|
|
81
|
+
createChainedFunction((elem: HTMLElement) => {
|
|
82
|
+
elem.style[computedDimension] = `${getDimensionValue(
|
|
83
|
+
computedDimension,
|
|
84
|
+
elem
|
|
85
|
+
)}px`;
|
|
86
|
+
triggerBrowserReflow(elem);
|
|
87
|
+
elem.style.transitionDuration = `${timeout + 50}ms`;
|
|
88
|
+
}, onExit),
|
|
89
|
+
[onExit, getDimensionValue, computedDimension, timeout]
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const handleExiting = useMemo(
|
|
93
|
+
() =>
|
|
94
|
+
createChainedFunction((elem: HTMLElement) => {
|
|
95
|
+
elem.style[computedDimension] = "0px";
|
|
96
|
+
elem.style.transitionDuration = `${timeout + 50}ms`;
|
|
97
|
+
}, onExiting),
|
|
98
|
+
[computedDimension, onExiting, timeout]
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<Transition
|
|
103
|
+
nodeRef={ref}
|
|
104
|
+
addEndListener={transitionEndListener}
|
|
105
|
+
{...rest}
|
|
106
|
+
aria-expanded={role ? panelIn : null}
|
|
107
|
+
onEnter={handleEnter}
|
|
108
|
+
onEntering={handleEntering}
|
|
109
|
+
onEntered={handleEntered}
|
|
110
|
+
onExit={handleExit}
|
|
111
|
+
onExiting={handleExiting}
|
|
112
|
+
in={panelIn}
|
|
113
|
+
>
|
|
114
|
+
{(state: TransitionStatus, innerProps: Record<string, unknown>) => {
|
|
115
|
+
return cloneElement(children, {
|
|
116
|
+
...innerProps,
|
|
117
|
+
className: classNames(
|
|
118
|
+
className,
|
|
119
|
+
children.props.className,
|
|
120
|
+
collapseStyles[state],
|
|
121
|
+
computedDimension === "width" && "collapse-horizontal"
|
|
122
|
+
),
|
|
123
|
+
});
|
|
124
|
+
}}
|
|
125
|
+
</Transition>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
export default Collapse;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Collapse } from "./Collapse";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ContextMenuProps } from "./ContextMenu.props";
|
|
2
|
+
|
|
3
|
+
const basic: ContextMenuProps = {
|
|
4
|
+
links: [
|
|
5
|
+
{
|
|
6
|
+
label: "Link One",
|
|
7
|
+
url: "http://www.google.com",
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
label: "Link Two",
|
|
11
|
+
url: "http://www.google.com",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
label: "Link Three",
|
|
15
|
+
url: "http://www.google.com",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: "Link Four",
|
|
19
|
+
url: "http://www.google.com",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: "Link Five Is Much Longer",
|
|
23
|
+
url: "http://www.google.com",
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const withsection: ContextMenuProps = {
|
|
29
|
+
links: [
|
|
30
|
+
{
|
|
31
|
+
label: "Link One",
|
|
32
|
+
url: "http://www.google.com",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: "Link Two",
|
|
36
|
+
url: "http://www.google.com",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
endsection: true,
|
|
40
|
+
label: "Link Three Ends A Section",
|
|
41
|
+
url: "http://www.google.com",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: "Link Four",
|
|
45
|
+
url: "http://www.google.com",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: "Link Five Is Much Longer",
|
|
49
|
+
url: "http://www.google.com",
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Sample prop definitions for ContextMenus's enumerable properties (imported in stories and test)
|
|
56
|
+
*/
|
|
57
|
+
const ContextMenuArgs = {
|
|
58
|
+
basic,
|
|
59
|
+
withsection,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default ContextMenuArgs;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
interface LinkProps {
|
|
2
|
+
/**
|
|
3
|
+
* Specify whether this link marks the end of a section
|
|
4
|
+
*/
|
|
5
|
+
endsection?: boolean;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Specify the label for the the Context Menu's link
|
|
9
|
+
*/
|
|
10
|
+
label?: Required<string>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Specify the url for the Context Menu's link
|
|
14
|
+
*/
|
|
15
|
+
url?: Required<string>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ContextMenuProps {
|
|
19
|
+
/**
|
|
20
|
+
* Specify an optional className to be added to your Context Menu component.
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Specify the links to be displayed in the Context Menu
|
|
26
|
+
*/
|
|
27
|
+
links?: Required<Array<LinkProps>>;
|
|
28
|
+
}
|