@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,265 @@
|
|
|
1
|
+
import { FormProps } from "./Form.props";
|
|
2
|
+
import CheckboxArgs from "../Checkbox/Checkbox.args";
|
|
3
|
+
import ChoiceGroupArgs from "../ChoiceGroup/ChoiceGroup.args";
|
|
4
|
+
import DatePickerArgs from "../DatePicker/DatePicker.args";
|
|
5
|
+
import DropdownArgs from "../Dropdown/Dropdown.args";
|
|
6
|
+
import FileUploadArgs from "../FileUpload/FileUpload.args";
|
|
7
|
+
import FormGroupArgs from "../FormGroup/FormGroup.args";
|
|
8
|
+
import InputArgs from "../Input/Input.args";
|
|
9
|
+
import NumberPickerArgs from "../NumberPicker/NumberPicker.args";
|
|
10
|
+
import TextareaArgs from "../Textarea/Textarea.args";
|
|
11
|
+
|
|
12
|
+
const basic: FormProps = {
|
|
13
|
+
action: "https://my.action.url",
|
|
14
|
+
formid: "exampleform",
|
|
15
|
+
items: [
|
|
16
|
+
{
|
|
17
|
+
field: InputArgs.basic,
|
|
18
|
+
type: "input",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
field: DropdownArgs.basic,
|
|
22
|
+
type: "dropdown",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
field: FormGroupArgs.basic,
|
|
26
|
+
type: "formgroup",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
field: { ...CheckboxArgs.basic },
|
|
30
|
+
type: "checkbox",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
choicegroupid: "multiplecheckboxes",
|
|
34
|
+
field: ChoiceGroupArgs.checkboxes.items,
|
|
35
|
+
legend: "Multiple Checkboxes",
|
|
36
|
+
type: "checkbox",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
choicegroupid: "radios",
|
|
40
|
+
field: ChoiceGroupArgs.radios.items,
|
|
41
|
+
legend: "Radio Group",
|
|
42
|
+
type: "radio",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
field: FileUploadArgs.basic,
|
|
46
|
+
type: "file",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
field: DatePickerArgs.hasrange,
|
|
50
|
+
type: "date",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
field: NumberPickerArgs.basic,
|
|
54
|
+
type: "number",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
field: TextareaArgs.basic,
|
|
58
|
+
type: "textarea",
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
submitlabel: "Submit",
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const hashelper: FormProps = {
|
|
65
|
+
action: "https://my.action.url",
|
|
66
|
+
formid: "exampleform",
|
|
67
|
+
items: [
|
|
68
|
+
{
|
|
69
|
+
field: InputArgs.hashelper,
|
|
70
|
+
type: "input",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
field: DropdownArgs.hashelper,
|
|
74
|
+
type: "dropdown",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
choicegroupid: "multiplecheckboxes",
|
|
78
|
+
field: ChoiceGroupArgs.checkboxeshelper.items,
|
|
79
|
+
grouphelper: ChoiceGroupArgs.checkboxeshelper.grouphelper,
|
|
80
|
+
legend: "Multiple Checkboxes",
|
|
81
|
+
type: "checkbox",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
choicegroupid: "radios",
|
|
85
|
+
field: ChoiceGroupArgs.radioshelper.items,
|
|
86
|
+
grouphelper: ChoiceGroupArgs.radioshelper.grouphelper,
|
|
87
|
+
legend: "Radio Group",
|
|
88
|
+
type: "radio",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
field: FileUploadArgs.hashelper,
|
|
92
|
+
type: "file",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
field: DatePickerArgs.hashelper,
|
|
96
|
+
type: "date",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
field: NumberPickerArgs.hashelper,
|
|
100
|
+
type: "number",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
field: TextareaArgs.hashelper,
|
|
104
|
+
type: "textarea",
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
submitlabel: "Submit",
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const haserror: FormProps = {
|
|
111
|
+
action: "https://my.action.url",
|
|
112
|
+
formid: "exampleform",
|
|
113
|
+
items: [
|
|
114
|
+
{
|
|
115
|
+
field: InputArgs.haserror,
|
|
116
|
+
type: "input",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
field: DropdownArgs.haserror,
|
|
120
|
+
type: "dropdown",
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
choicegroupid: "multiplecheckboxes",
|
|
124
|
+
field: ChoiceGroupArgs.checkboxeserror.items,
|
|
125
|
+
grouperror: ChoiceGroupArgs.checkboxeserror.grouperror,
|
|
126
|
+
legend: "Multiple Checkboxes",
|
|
127
|
+
type: "checkbox",
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
choicegroupid: "radios",
|
|
131
|
+
field: ChoiceGroupArgs.radioserror.items,
|
|
132
|
+
grouperror: ChoiceGroupArgs.radioserror.grouperror,
|
|
133
|
+
legend: "Radio Group",
|
|
134
|
+
type: "radio",
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
field: FileUploadArgs.haserror,
|
|
138
|
+
type: "file",
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
field: DatePickerArgs.haserror,
|
|
142
|
+
type: "date",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
field: NumberPickerArgs.haserror,
|
|
146
|
+
type: "number",
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
field: TextareaArgs.haserror,
|
|
150
|
+
type: "textarea",
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
submitlabel: "Submit",
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const hastooltip: FormProps = {
|
|
157
|
+
action: "https://my.action.url",
|
|
158
|
+
formid: "exampleform",
|
|
159
|
+
items: [
|
|
160
|
+
{
|
|
161
|
+
field: InputArgs.hastooltip,
|
|
162
|
+
type: "input",
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
field: DropdownArgs.hastooltip,
|
|
166
|
+
type: "dropdown",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
choicegroupid: "multiplecheckboxes",
|
|
170
|
+
field: ChoiceGroupArgs.checkboxestooltip.items,
|
|
171
|
+
grouptooltip: ChoiceGroupArgs.checkboxestooltip.grouptooltip,
|
|
172
|
+
legend: "Multiple Checkboxes",
|
|
173
|
+
type: "checkbox",
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
choicegroupid: "radios",
|
|
177
|
+
field: ChoiceGroupArgs.radiostooltip.items,
|
|
178
|
+
grouptooltip: ChoiceGroupArgs.radiostooltip.grouptooltip,
|
|
179
|
+
legend: "Radio Group",
|
|
180
|
+
type: "radio",
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
field: FileUploadArgs.hastooltip,
|
|
184
|
+
type: "file",
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
field: DatePickerArgs.hastooltip,
|
|
188
|
+
type: "date",
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
field: NumberPickerArgs.hastooltip,
|
|
192
|
+
type: "number",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
field: TextareaArgs.hastooltip,
|
|
196
|
+
type: "textarea",
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
submitlabel: "Submit",
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const hasdisabled: FormProps = {
|
|
203
|
+
action: "https://my.action.url",
|
|
204
|
+
formid: "exampleform",
|
|
205
|
+
items: [
|
|
206
|
+
{
|
|
207
|
+
field: InputArgs.isdisabled,
|
|
208
|
+
type: "input",
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
field: DropdownArgs.basic,
|
|
212
|
+
type: "dropdown",
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
field: FormGroupArgs.basic,
|
|
216
|
+
type: "formgroup",
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
field: { ...CheckboxArgs.basic },
|
|
220
|
+
type: "checkbox",
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
choicegroupid: "multiplecheckboxes",
|
|
224
|
+
field: ChoiceGroupArgs.checkboxes.items,
|
|
225
|
+
legend: "Multiple Checkboxes",
|
|
226
|
+
type: "checkbox",
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
choicegroupid: "radios",
|
|
230
|
+
field: ChoiceGroupArgs.radios.items,
|
|
231
|
+
legend: "Radio Group",
|
|
232
|
+
type: "radio",
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
field: FileUploadArgs.basic,
|
|
236
|
+
type: "file",
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
field: DatePickerArgs.hasrange,
|
|
240
|
+
type: "date",
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
field: NumberPickerArgs.basic,
|
|
244
|
+
type: "number",
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
field: TextareaArgs.basic,
|
|
248
|
+
type: "textarea",
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
submitlabel: "Submit",
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Sample prop definitions FormGroup's enumerable properties (imported in stories and test)
|
|
256
|
+
*/
|
|
257
|
+
const FormArgs = {
|
|
258
|
+
basic,
|
|
259
|
+
hasdisabled,
|
|
260
|
+
hashelper,
|
|
261
|
+
haserror,
|
|
262
|
+
hastooltip,
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
export default FormArgs;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { CheckboxProps } from "../Checkbox/Checkbox.props";
|
|
2
|
+
import { DatePickerProps } from "../DatePicker/DatePicker.props";
|
|
3
|
+
import { DropdownProps } from "../Dropdown/Dropdown.props";
|
|
4
|
+
import { FileUploadProps } from "../FileUpload/FileUpload.props";
|
|
5
|
+
import { FormGroupProps } from "../FormGroupProps/FormGroupProps.props";
|
|
6
|
+
import { InputProps } from "../InputProps/InputProps.props";
|
|
7
|
+
import { NumberPickerProps } from "../NumberPicker/NumberPicker.props";
|
|
8
|
+
import { RadioProps } from "../Radio/Radio.props";
|
|
9
|
+
import { TextareaProps } from "../Textarea/Textarea.props";
|
|
10
|
+
import { fieldTypes } from "../../types";
|
|
11
|
+
|
|
12
|
+
interface FormItems {
|
|
13
|
+
/**
|
|
14
|
+
* An optional ID if this is a group of checkboxes or radios
|
|
15
|
+
*/
|
|
16
|
+
choicegroupid?: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The inputs in this form group
|
|
20
|
+
*/
|
|
21
|
+
field: Required<
|
|
22
|
+
| FormGroupProps
|
|
23
|
+
| DropdownProps
|
|
24
|
+
| Array<CheckboxProps>
|
|
25
|
+
| Array<RadioProps>
|
|
26
|
+
| CheckboxProps
|
|
27
|
+
| FileUploadProps
|
|
28
|
+
| NumberPickerProps
|
|
29
|
+
| DatePickerProps
|
|
30
|
+
| TextareaProps
|
|
31
|
+
>;
|
|
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
|
+
* If this is an array of items, an optional legend
|
|
50
|
+
*/
|
|
51
|
+
legend?: string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* This item's field type
|
|
55
|
+
*/
|
|
56
|
+
type: Required<fieldTypes>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface FormProps {
|
|
60
|
+
/**
|
|
61
|
+
* The form's action attribute
|
|
62
|
+
*/
|
|
63
|
+
action: Required<string>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Specify an optional className to be added to your Form component.
|
|
67
|
+
*/
|
|
68
|
+
className?: string;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The ID of the form
|
|
72
|
+
*/
|
|
73
|
+
formid: Required<string>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The inputs in this form group
|
|
77
|
+
*/
|
|
78
|
+
items: Required<Array<FormItems>>;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The label for the form's submit button
|
|
82
|
+
*/
|
|
83
|
+
submitlabel: Required<string>;
|
|
84
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import useGlobalSettings from "../../hooks/useGlobalSettings";
|
|
4
|
+
import { Button } from "../Button";
|
|
5
|
+
import { FormProps } from "./Form.props";
|
|
6
|
+
import { FormGroup } from "../FormGroup";
|
|
7
|
+
import { Checkbox } from "../Checkbox";
|
|
8
|
+
import { ChoiceGroup } from "../ChoiceGroup";
|
|
9
|
+
import { DatePicker } from "../DatePicker";
|
|
10
|
+
import { Dropdown } from "../Dropdown";
|
|
11
|
+
import { FileUpload } from "../FileUpload";
|
|
12
|
+
import { Input } from "../Input";
|
|
13
|
+
import { NumberPicker } from "../NumberPicker";
|
|
14
|
+
import { Textarea } from "../Textarea";
|
|
15
|
+
|
|
16
|
+
const Form: FC<FormProps> = ({
|
|
17
|
+
action,
|
|
18
|
+
className,
|
|
19
|
+
formid,
|
|
20
|
+
items,
|
|
21
|
+
submitlabel,
|
|
22
|
+
}) => {
|
|
23
|
+
const { prefix } = useGlobalSettings();
|
|
24
|
+
const baseClass = `${prefix}--form`;
|
|
25
|
+
const formClasses = classNames(className, {
|
|
26
|
+
[baseClass]: true,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<form className={formClasses} id={formid} action={action}>
|
|
31
|
+
{items.map((item, i) => {
|
|
32
|
+
if (item?.type === "input") {
|
|
33
|
+
return <Input {...(item?.field as any)} key={i} />;
|
|
34
|
+
}
|
|
35
|
+
if (item?.type === "dropdown") {
|
|
36
|
+
return <Dropdown {...(item?.field as any)} key={i} />;
|
|
37
|
+
}
|
|
38
|
+
if (item?.type === "checkbox" && Array.isArray(item?.field) === false) {
|
|
39
|
+
return <Checkbox {...(item?.field as any)} key={i} />;
|
|
40
|
+
}
|
|
41
|
+
if (
|
|
42
|
+
(item?.type === "checkbox" || item?.type === "radio") &&
|
|
43
|
+
Array.isArray(item?.field)
|
|
44
|
+
) {
|
|
45
|
+
return (
|
|
46
|
+
<ChoiceGroup
|
|
47
|
+
items={item?.field as any}
|
|
48
|
+
legend={item?.legend as any}
|
|
49
|
+
choicegroupid={item?.choicegroupid as any}
|
|
50
|
+
grouperror={item?.grouperror as any}
|
|
51
|
+
grouphelper={item?.grouphelper as any}
|
|
52
|
+
grouptooltip={item?.grouptooltip as any}
|
|
53
|
+
key={i}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
if (item?.type === "file") {
|
|
58
|
+
return <FileUpload {...(item?.field as any)} key={i} />;
|
|
59
|
+
}
|
|
60
|
+
if (item?.type === "date") {
|
|
61
|
+
return <DatePicker {...(item?.field as any)} key={i} />;
|
|
62
|
+
}
|
|
63
|
+
if (item?.type === "number") {
|
|
64
|
+
return <NumberPicker {...(item?.field as any)} key={i} />;
|
|
65
|
+
}
|
|
66
|
+
if (item?.type === "textarea") {
|
|
67
|
+
return <Textarea {...(item?.field as any)} key={i} />;
|
|
68
|
+
}
|
|
69
|
+
if (item?.type === "formgroup") {
|
|
70
|
+
return <FormGroup {...(item?.field as any)} key={i} />;
|
|
71
|
+
}
|
|
72
|
+
})}
|
|
73
|
+
<Button
|
|
74
|
+
kind={"submit"}
|
|
75
|
+
label={submitlabel}
|
|
76
|
+
size={"large"}
|
|
77
|
+
type={"primary"}
|
|
78
|
+
/>
|
|
79
|
+
</form>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export default Form;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Form } from "./Form";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { inputTypes, fieldTypes } from "../../types";
|
|
2
|
+
|
|
3
|
+
export interface FormElementProps {
|
|
4
|
+
/**
|
|
5
|
+
* Specify the content of your FormElement.
|
|
6
|
+
*/
|
|
7
|
+
children: ReactElement<Input> | ReactElement<Select> | ReactElement<Textarea>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Specify an optional className to be added to your FormElement component.
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Is the field disabled?
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The fieldset's error message
|
|
21
|
+
*/
|
|
22
|
+
error: string | false;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The fieldset's helper text
|
|
26
|
+
*/
|
|
27
|
+
helper: string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The ID of the form element
|
|
31
|
+
*/
|
|
32
|
+
elemid: Required<string>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The fieldset's label
|
|
36
|
+
*/
|
|
37
|
+
label: Required<string>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Is this element required?
|
|
41
|
+
*/
|
|
42
|
+
required: boolean;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Does this fieldset have a tooltip?
|
|
46
|
+
*/
|
|
47
|
+
tooltip?: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The type of field
|
|
51
|
+
*/
|
|
52
|
+
type?: inputTypes | fieldTypes;
|
|
53
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { FormElementProps } from "./FormElement.props";
|
|
3
|
+
|
|
4
|
+
const FormElement: FC<FormElementProps> = ({
|
|
5
|
+
children,
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
className,
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
error,
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
elemid,
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
helper,
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
label,
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
required,
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
tooltip,
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
type,
|
|
22
|
+
}) => {
|
|
23
|
+
return <>{children}</>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default FormElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as FormElement } from "./FormElement";
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import CheckboxArgs from "../Checkbox/Checkbox.args";
|
|
2
|
+
import DatePickerArgs from "../DatePicker/DatePicker.args";
|
|
3
|
+
import DropdownArgs from "../Dropdown/Dropdown.args";
|
|
4
|
+
import FileUploadArgs from "../FileUpload/FileUpload.args";
|
|
5
|
+
import { FormGroupProps } from "./FormGroup.props";
|
|
6
|
+
import InputArgs from "../Input/Input.args";
|
|
7
|
+
import NumberPickerArgs from "../NumberPicker/NumberPicker.args";
|
|
8
|
+
import RadioArgs from "../Radio/Radio.args";
|
|
9
|
+
import TextareaArgs from "../Textarea/Textarea.args";
|
|
10
|
+
|
|
11
|
+
const fgcheckboxfields = [];
|
|
12
|
+
const fgradiofields = [];
|
|
13
|
+
|
|
14
|
+
for (let i = 0; i < 5; i++) {
|
|
15
|
+
const checkboxargs = { ...CheckboxArgs.basic };
|
|
16
|
+
const radioargs = { ...RadioArgs.basic };
|
|
17
|
+
fgcheckboxfields.push(checkboxargs);
|
|
18
|
+
fgcheckboxfields[i].label = `Checkbox ${i}`;
|
|
19
|
+
fgcheckboxfields[i].name = `fgcheckbox${i}`;
|
|
20
|
+
fgcheckboxfields[i].id = `fgcheckbox${i}`;
|
|
21
|
+
fgcheckboxfields[i].grouped = true;
|
|
22
|
+
fgradiofields.push(radioargs);
|
|
23
|
+
fgradiofields[i].label = `Radio ${i}`;
|
|
24
|
+
fgradiofields[i].name = `fgradio`;
|
|
25
|
+
fgradiofields[i].value = `fgradio${i}`;
|
|
26
|
+
fgradiofields[i].id = `fgradio${i}`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const basic: FormGroupProps = {
|
|
30
|
+
formgroupid: "examplegroup",
|
|
31
|
+
items: [
|
|
32
|
+
{
|
|
33
|
+
field: InputArgs.basic,
|
|
34
|
+
type: "input",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
field: DropdownArgs.basic,
|
|
38
|
+
type: "dropdown",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
field: { ...CheckboxArgs.basic },
|
|
42
|
+
type: "checkbox",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
choicegroupid: "multiplecheckboxes",
|
|
46
|
+
field: fgcheckboxfields,
|
|
47
|
+
legend: "Multiple Checkboxes",
|
|
48
|
+
type: "checkbox",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
choicegroupid: "radios",
|
|
52
|
+
field: fgradiofields,
|
|
53
|
+
legend: "Radio Group",
|
|
54
|
+
type: "radio",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
field: FileUploadArgs.basic,
|
|
58
|
+
type: "file",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
field: DatePickerArgs.basic,
|
|
62
|
+
type: "date",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
field: NumberPickerArgs.basic,
|
|
66
|
+
type: "number",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
field: TextareaArgs.basic,
|
|
70
|
+
type: "textarea",
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
legend: "Example Legend",
|
|
74
|
+
type: "default",
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Sample prop definitions FormGroup's enumerable properties (imported in stories and test)
|
|
79
|
+
*/
|
|
80
|
+
const FormGroupArgs = {
|
|
81
|
+
basic,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export default FormGroupArgs;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { CheckboxProps } from "../Checkbox/Checkbox.props";
|
|
2
|
+
import { DatePickerProps } from "../DatePicker/DatePicker.props";
|
|
3
|
+
import { DropdownProps } from "../Dropdown/Dropdown.props";
|
|
4
|
+
import { FileUploadProps } from "../FileUpload/FileUpload.props";
|
|
5
|
+
import { InputProps } from "../InputProps/InputProps.props";
|
|
6
|
+
import { NumberPickerProps } from "../NumberPicker/NumberPicker.props";
|
|
7
|
+
import { RadioProps } from "../Radio/Radio.props";
|
|
8
|
+
import { TextareaProps } from "../Textarea/Textarea.props";
|
|
9
|
+
import { fieldTypes, formGroupTypes } from "../../types";
|
|
10
|
+
|
|
11
|
+
// We can't put a form group inside a form group so let's remove that option
|
|
12
|
+
const formGroupFieldTypes = fieldTypes.filter((item) => item !== "formgroup");
|
|
13
|
+
|
|
14
|
+
interface FormGroupItems {
|
|
15
|
+
/**
|
|
16
|
+
* An optional ID if this is a group of checkboxes or radios
|
|
17
|
+
*/
|
|
18
|
+
choicegroupid?: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The inputs in this form group
|
|
22
|
+
*/
|
|
23
|
+
field: Required<
|
|
24
|
+
| InputProps
|
|
25
|
+
| DropdownProps
|
|
26
|
+
| Array<CheckboxProps>
|
|
27
|
+
| Array<RadioProps>
|
|
28
|
+
| CheckboxProps
|
|
29
|
+
| FileUploadProps
|
|
30
|
+
| NumberPickerProps
|
|
31
|
+
| DatePickerProps
|
|
32
|
+
| TextareaProps
|
|
33
|
+
>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* If this is an array of items, an optional legend
|
|
37
|
+
*/
|
|
38
|
+
legend?: string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* This item's field type
|
|
42
|
+
*/
|
|
43
|
+
type: Required<formGroupFieldTypes>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface FormGroupProps {
|
|
47
|
+
/**
|
|
48
|
+
* Specify an optional className to be added to your FormGroup component.
|
|
49
|
+
*/
|
|
50
|
+
className?: string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The ID of the FormGroup
|
|
54
|
+
*/
|
|
55
|
+
formgroupid: Required<string | boolean>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The inputs in this form group
|
|
59
|
+
*/
|
|
60
|
+
items: Required<Array<FormGroupItems>>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The FormGroups's legend
|
|
64
|
+
*/
|
|
65
|
+
legend: Required<string | false>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* This Form Groups's type
|
|
69
|
+
*/
|
|
70
|
+
type: Required<formGroupTypes>;
|
|
71
|
+
}
|