@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,353 @@
|
|
|
1
|
+
import { ButtonProps } from "./Button.props";
|
|
2
|
+
|
|
3
|
+
const large: ButtonProps = {
|
|
4
|
+
label: "Large Button",
|
|
5
|
+
size: "large",
|
|
6
|
+
target: "_blank",
|
|
7
|
+
type: "primary",
|
|
8
|
+
url: "#",
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const medium: ButtonProps = {
|
|
12
|
+
label: "Medium Button",
|
|
13
|
+
size: "medium",
|
|
14
|
+
type: "primary",
|
|
15
|
+
url: "#",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const small: ButtonProps = {
|
|
19
|
+
label: "Small Button",
|
|
20
|
+
size: "small",
|
|
21
|
+
type: "primary",
|
|
22
|
+
url: "#",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const primary: ButtonProps = {
|
|
26
|
+
label: "Primary Button",
|
|
27
|
+
size: "large",
|
|
28
|
+
type: "primary",
|
|
29
|
+
url: "",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const secondary: ButtonProps = {
|
|
33
|
+
label: "Secondary Button",
|
|
34
|
+
size: "large",
|
|
35
|
+
type: "secondary",
|
|
36
|
+
url: "",
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const tertiary: ButtonProps = {
|
|
40
|
+
label: "Tertiary Button",
|
|
41
|
+
size: "large",
|
|
42
|
+
type: "tertiary",
|
|
43
|
+
url: "",
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const secondarym: ButtonProps = {
|
|
47
|
+
label: "Secondary medium",
|
|
48
|
+
size: "medium",
|
|
49
|
+
type: "secondary",
|
|
50
|
+
url: "",
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const tertiarym: ButtonProps = {
|
|
54
|
+
label: "Tertiary Medium",
|
|
55
|
+
size: "medium",
|
|
56
|
+
type: "tertiary",
|
|
57
|
+
url: "",
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const secondarysm: ButtonProps = {
|
|
61
|
+
label: "Secondary Small",
|
|
62
|
+
size: "small",
|
|
63
|
+
type: "secondary",
|
|
64
|
+
url: "",
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const tertiarysm: ButtonProps = {
|
|
68
|
+
label: "Tertiary Small",
|
|
69
|
+
size: "small",
|
|
70
|
+
type: "tertiary",
|
|
71
|
+
url: "",
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const alertm: ButtonProps = {
|
|
75
|
+
label: "Alert Medium",
|
|
76
|
+
size: "medium",
|
|
77
|
+
type: "alert",
|
|
78
|
+
url: "",
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const alertsm: ButtonProps = {
|
|
82
|
+
label: "Alert Small",
|
|
83
|
+
size: "small",
|
|
84
|
+
type: "alert",
|
|
85
|
+
url: "",
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const alert: ButtonProps = {
|
|
89
|
+
label: "Alert Button",
|
|
90
|
+
size: "large",
|
|
91
|
+
type: "alert",
|
|
92
|
+
url: "",
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const disabled: ButtonProps = {
|
|
96
|
+
disabled: true,
|
|
97
|
+
label: "Disabled Button",
|
|
98
|
+
size: "large",
|
|
99
|
+
type: "primary",
|
|
100
|
+
url: "",
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const iconleftlgprimary: ButtonProps = {
|
|
104
|
+
callback: "",
|
|
105
|
+
children: "",
|
|
106
|
+
icon: "close",
|
|
107
|
+
label: "Icon on left",
|
|
108
|
+
size: "large",
|
|
109
|
+
type: "primary",
|
|
110
|
+
url: "",
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const iconleftmprimary: ButtonProps = {
|
|
114
|
+
icon: "close",
|
|
115
|
+
label: "Icon on left",
|
|
116
|
+
size: "medium",
|
|
117
|
+
type: "primary",
|
|
118
|
+
url: "",
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const iconleftsmprimary: ButtonProps = {
|
|
122
|
+
icon: "close",
|
|
123
|
+
label: "Icon on left",
|
|
124
|
+
size: "small",
|
|
125
|
+
type: "primary",
|
|
126
|
+
url: "",
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const iconrightlgprimary: ButtonProps = {
|
|
130
|
+
icon: "close",
|
|
131
|
+
iconPosition: "right",
|
|
132
|
+
label: "Icon on right",
|
|
133
|
+
size: "large",
|
|
134
|
+
type: "primary",
|
|
135
|
+
url: "",
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const iconrightmprimary: ButtonProps = {
|
|
139
|
+
icon: "close",
|
|
140
|
+
iconPosition: "right",
|
|
141
|
+
label: "Icon on right",
|
|
142
|
+
size: "medium",
|
|
143
|
+
type: "primary",
|
|
144
|
+
url: "",
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const iconrightsmprimary: ButtonProps = {
|
|
148
|
+
icon: "close",
|
|
149
|
+
iconPosition: "right",
|
|
150
|
+
label: "Icon on right",
|
|
151
|
+
size: "small",
|
|
152
|
+
type: "primary",
|
|
153
|
+
url: "",
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const iconleftlgsecondary: ButtonProps = {
|
|
157
|
+
icon: "close",
|
|
158
|
+
label: "Icon on left",
|
|
159
|
+
size: "large",
|
|
160
|
+
type: "secondary",
|
|
161
|
+
url: "",
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const iconleftmsecondary: ButtonProps = {
|
|
165
|
+
icon: "close",
|
|
166
|
+
label: "Icon on left",
|
|
167
|
+
size: "medium",
|
|
168
|
+
type: "secondary",
|
|
169
|
+
url: "",
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const iconleftsmsecondary: ButtonProps = {
|
|
173
|
+
icon: "close",
|
|
174
|
+
label: "Icon on left",
|
|
175
|
+
size: "small",
|
|
176
|
+
type: "secondary",
|
|
177
|
+
url: "",
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const iconrightlgsecondary: ButtonProps = {
|
|
181
|
+
icon: "close",
|
|
182
|
+
iconPosition: "right",
|
|
183
|
+
label: "Icon on right",
|
|
184
|
+
size: "large",
|
|
185
|
+
type: "secondary",
|
|
186
|
+
url: "",
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const iconrightmsecondary: ButtonProps = {
|
|
190
|
+
icon: "close",
|
|
191
|
+
iconPosition: "right",
|
|
192
|
+
label: "Icon on right",
|
|
193
|
+
size: "medium",
|
|
194
|
+
type: "secondary",
|
|
195
|
+
url: "",
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const iconrightsmsecondary: ButtonProps = {
|
|
199
|
+
icon: "close",
|
|
200
|
+
iconPosition: "right",
|
|
201
|
+
label: "Icon on right",
|
|
202
|
+
size: "small",
|
|
203
|
+
type: "secondary",
|
|
204
|
+
url: "",
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const iconleftlgtertiary: ButtonProps = {
|
|
208
|
+
icon: "close",
|
|
209
|
+
label: "Icon on left",
|
|
210
|
+
size: "large",
|
|
211
|
+
type: "tertiary",
|
|
212
|
+
url: "",
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const iconleftmtertiary: ButtonProps = {
|
|
216
|
+
icon: "close",
|
|
217
|
+
label: "Icon on left",
|
|
218
|
+
size: "medium",
|
|
219
|
+
type: "tertiary",
|
|
220
|
+
url: "",
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const iconleftsmtertiary: ButtonProps = {
|
|
224
|
+
icon: "close",
|
|
225
|
+
label: "Icon on left",
|
|
226
|
+
size: "small",
|
|
227
|
+
type: "tertiary",
|
|
228
|
+
url: "",
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
const iconrightlgtertiary: ButtonProps = {
|
|
232
|
+
icon: "close",
|
|
233
|
+
iconPosition: "right",
|
|
234
|
+
label: "Icon on right",
|
|
235
|
+
size: "large",
|
|
236
|
+
type: "tertiary",
|
|
237
|
+
url: "",
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const iconrightmtertiary: ButtonProps = {
|
|
241
|
+
icon: "close",
|
|
242
|
+
iconPosition: "right",
|
|
243
|
+
label: "Icon on right",
|
|
244
|
+
size: "medium",
|
|
245
|
+
type: "tertiary",
|
|
246
|
+
url: "",
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
const iconrightsmtertiary: ButtonProps = {
|
|
250
|
+
icon: "close",
|
|
251
|
+
iconPosition: "right",
|
|
252
|
+
label: "Icon on right",
|
|
253
|
+
size: "small",
|
|
254
|
+
type: "tertiary",
|
|
255
|
+
url: "",
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
const iconleftlgalert: ButtonProps = {
|
|
259
|
+
icon: "close",
|
|
260
|
+
label: "Icon on left",
|
|
261
|
+
size: "large",
|
|
262
|
+
type: "alert",
|
|
263
|
+
url: "",
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const iconleftmalert: ButtonProps = {
|
|
267
|
+
icon: "close",
|
|
268
|
+
label: "Icon on left",
|
|
269
|
+
size: "medium",
|
|
270
|
+
type: "alert",
|
|
271
|
+
url: "",
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
const iconleftsmalert: ButtonProps = {
|
|
275
|
+
icon: "close",
|
|
276
|
+
label: "Icon on left",
|
|
277
|
+
size: "small",
|
|
278
|
+
type: "alert",
|
|
279
|
+
url: "",
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
const iconrightlgalert: ButtonProps = {
|
|
283
|
+
icon: "close",
|
|
284
|
+
iconPosition: "right",
|
|
285
|
+
label: "Icon on right",
|
|
286
|
+
size: "large",
|
|
287
|
+
type: "alert",
|
|
288
|
+
url: "",
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
const iconrightmalert: ButtonProps = {
|
|
292
|
+
icon: "close",
|
|
293
|
+
iconPosition: "right",
|
|
294
|
+
label: "Icon on right",
|
|
295
|
+
size: "medium",
|
|
296
|
+
type: "alert",
|
|
297
|
+
url: "",
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
const iconrightsmalert: ButtonProps = {
|
|
301
|
+
icon: "close",
|
|
302
|
+
iconPosition: "right",
|
|
303
|
+
label: "Icon on right",
|
|
304
|
+
size: "small",
|
|
305
|
+
type: "alert",
|
|
306
|
+
url: "",
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Sample prop definitions for Button's enumerable properties (imported in stories and tests).
|
|
311
|
+
*/
|
|
312
|
+
const ButtonArgs = {
|
|
313
|
+
large,
|
|
314
|
+
medium,
|
|
315
|
+
small,
|
|
316
|
+
primary,
|
|
317
|
+
secondary,
|
|
318
|
+
tertiary,
|
|
319
|
+
secondarym,
|
|
320
|
+
tertiarym,
|
|
321
|
+
secondarysm,
|
|
322
|
+
tertiarysm,
|
|
323
|
+
alert,
|
|
324
|
+
alertm,
|
|
325
|
+
alertsm,
|
|
326
|
+
disabled,
|
|
327
|
+
iconleftlgprimary,
|
|
328
|
+
iconleftmprimary,
|
|
329
|
+
iconleftsmprimary,
|
|
330
|
+
iconrightlgprimary,
|
|
331
|
+
iconrightmprimary,
|
|
332
|
+
iconrightsmprimary,
|
|
333
|
+
iconleftlgsecondary,
|
|
334
|
+
iconleftmsecondary,
|
|
335
|
+
iconleftsmsecondary,
|
|
336
|
+
iconrightlgsecondary,
|
|
337
|
+
iconrightmsecondary,
|
|
338
|
+
iconrightsmsecondary,
|
|
339
|
+
iconleftlgtertiary,
|
|
340
|
+
iconleftmtertiary,
|
|
341
|
+
iconleftsmtertiary,
|
|
342
|
+
iconrightlgtertiary,
|
|
343
|
+
iconrightmtertiary,
|
|
344
|
+
iconrightsmtertiary,
|
|
345
|
+
iconleftlgalert,
|
|
346
|
+
iconleftmalert,
|
|
347
|
+
iconleftsmalert,
|
|
348
|
+
iconrightlgalert,
|
|
349
|
+
iconrightmalert,
|
|
350
|
+
iconrightsmalert,
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
export default ButtonArgs;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { buttonFunctions, buttonTypes } from "../../types";
|
|
3
|
+
|
|
4
|
+
export interface ButtonProps {
|
|
5
|
+
/**
|
|
6
|
+
* Specify the callback of your Button.
|
|
7
|
+
*/
|
|
8
|
+
callback?: function;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Specify the content of your Button.
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Specify an optional className to be added to your Button.
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Specify whether or not the button is disabled.
|
|
22
|
+
*/
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Specify the icon for the Button
|
|
27
|
+
*/
|
|
28
|
+
icon?: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Specify the icon for the Button
|
|
32
|
+
*/
|
|
33
|
+
iconPosition?: positionTypes;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Does this button display an icon only?
|
|
37
|
+
*/
|
|
38
|
+
icononly?: boolean;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Specify which function the button performs
|
|
42
|
+
*/
|
|
43
|
+
kind?: buttonFunctions;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Specify the label for the Button
|
|
47
|
+
*/
|
|
48
|
+
label?: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Does this button open a modal?
|
|
52
|
+
*/
|
|
53
|
+
opensmodal?: boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Specify an optional className to be added to your Button.
|
|
57
|
+
*/
|
|
58
|
+
size?: sizeTypes;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Specify the target for when Button is really a link
|
|
62
|
+
*/
|
|
63
|
+
target?: string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Specify an optional className to be added to your Button.
|
|
67
|
+
*/
|
|
68
|
+
type?: buttonTypes;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Specify the url for the Button's href
|
|
72
|
+
*/
|
|
73
|
+
url?: string;
|
|
74
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import useGlobalSettings from "../../hooks/useGlobalSettings";
|
|
4
|
+
import { ButtonProps } from "./Button.props";
|
|
5
|
+
import { Link } from "../Link";
|
|
6
|
+
import { Icon } from "../Icon";
|
|
7
|
+
|
|
8
|
+
const Button: FC<ButtonProps> = ({
|
|
9
|
+
callback,
|
|
10
|
+
className,
|
|
11
|
+
disabled = false,
|
|
12
|
+
icon,
|
|
13
|
+
icononly,
|
|
14
|
+
iconPosition,
|
|
15
|
+
kind = "button",
|
|
16
|
+
label,
|
|
17
|
+
opensmodal,
|
|
18
|
+
size = "large",
|
|
19
|
+
target = "",
|
|
20
|
+
type = "primary",
|
|
21
|
+
url,
|
|
22
|
+
}) => {
|
|
23
|
+
const { prefix } = useGlobalSettings();
|
|
24
|
+
const baseClass = `${prefix}--button`;
|
|
25
|
+
const hasURL = !!url;
|
|
26
|
+
const icoPos = iconPosition || "left";
|
|
27
|
+
|
|
28
|
+
const ButtonClasses = classNames(className, {
|
|
29
|
+
[baseClass]: true,
|
|
30
|
+
[`${baseClass}--${size}`]: size,
|
|
31
|
+
[`${baseClass}--${type}`]: type,
|
|
32
|
+
[`icon icon__position--${icoPos}`]: icon,
|
|
33
|
+
[`icon--only`]: icononly,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* On click, if there is a callback, call it
|
|
38
|
+
*/
|
|
39
|
+
const handleClick = (e: React.MouseEvent<Element, MouseEvent>) => {
|
|
40
|
+
if (callback) {
|
|
41
|
+
callback(e);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
{hasURL ? (
|
|
48
|
+
<Link className={ButtonClasses} target={target} url={url} label={label}>
|
|
49
|
+
{icon && <Icon name={icon} hidden={true} />}
|
|
50
|
+
</Link>
|
|
51
|
+
) : (
|
|
52
|
+
<button
|
|
53
|
+
className={ButtonClasses}
|
|
54
|
+
onClick={(e) => handleClick(e)}
|
|
55
|
+
disabled={disabled}
|
|
56
|
+
type={kind}
|
|
57
|
+
aria-haspopup={opensmodal ? `dialog` : false}
|
|
58
|
+
>
|
|
59
|
+
{label && <span className="button__label">{label}</span>}
|
|
60
|
+
{icon && <Icon name={icon} hidden={true} />}
|
|
61
|
+
</button>
|
|
62
|
+
)}
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default Button;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Button } from "./Button";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { CalloutProps } from "./Callout.props";
|
|
2
|
+
|
|
3
|
+
const hascta: CalloutProps = {
|
|
4
|
+
className: "storybook",
|
|
5
|
+
copy: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
|
|
6
|
+
cta: {
|
|
7
|
+
label: "Optional CTA",
|
|
8
|
+
url: "http://www.google.com",
|
|
9
|
+
},
|
|
10
|
+
headline: "With CTA",
|
|
11
|
+
isCollapsible: true,
|
|
12
|
+
isOpen: false,
|
|
13
|
+
toggleOpenLabel: "Open",
|
|
14
|
+
toggleClosedLabel: "Closed",
|
|
15
|
+
type: "info",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const infoCallout: CalloutProps = {
|
|
19
|
+
copy: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
|
|
20
|
+
isCollapsible: false,
|
|
21
|
+
headline: "Notification Title",
|
|
22
|
+
type: "info",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const errorCallout: CalloutProps = {
|
|
26
|
+
cta: {
|
|
27
|
+
label: "Optional CTA",
|
|
28
|
+
url: "http://www.google.com",
|
|
29
|
+
},
|
|
30
|
+
copy: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
|
|
31
|
+
isCollapsible: true,
|
|
32
|
+
isOpen: false,
|
|
33
|
+
headline: "Notification Title",
|
|
34
|
+
toggleOpenLabel: "Open",
|
|
35
|
+
toggleClosedLabel: "Closed",
|
|
36
|
+
type: "error",
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const successCallout: CalloutProps = {
|
|
40
|
+
copy: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
|
|
41
|
+
isCollapsible: false,
|
|
42
|
+
headline: "Notification Title",
|
|
43
|
+
type: "success",
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const warningCallout: CalloutProps = {
|
|
47
|
+
copy: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
|
|
48
|
+
isCollapsible: false,
|
|
49
|
+
headline: "Notification Title",
|
|
50
|
+
type: "warning",
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Sample prop definitions for Callout's enumerable properties (imported in stories and tests).
|
|
55
|
+
*/
|
|
56
|
+
const CalloutArgs = {
|
|
57
|
+
hascta,
|
|
58
|
+
infoCallout,
|
|
59
|
+
errorCallout,
|
|
60
|
+
warningCallout,
|
|
61
|
+
successCallout,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default CalloutArgs;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { calloutTypes } from "../../types";
|
|
3
|
+
|
|
4
|
+
interface CTAProps {
|
|
5
|
+
/**
|
|
6
|
+
* Specify the label of the CTA
|
|
7
|
+
*/
|
|
8
|
+
label?: string;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Specify the url of the CTA
|
|
12
|
+
*/
|
|
13
|
+
url?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface CalloutProps {
|
|
17
|
+
/**
|
|
18
|
+
* Specify the settings for an option CTA
|
|
19
|
+
*/
|
|
20
|
+
cta?: CTAProps;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Specify an optional className to be added to your RichText.
|
|
24
|
+
*/
|
|
25
|
+
className?: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Specify the copy
|
|
29
|
+
*/
|
|
30
|
+
copy?: Required<string>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Specify if callout is collapsible
|
|
34
|
+
*/
|
|
35
|
+
isCollapsible?: boolean;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Specify if callout is open (only important for collapsible items)
|
|
39
|
+
*/
|
|
40
|
+
isOpen?: boolean;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Specify the callout headline
|
|
44
|
+
*/
|
|
45
|
+
headline?: string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Specify the open label
|
|
49
|
+
*/
|
|
50
|
+
toggleOpenLabel?: string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Specify the open label
|
|
54
|
+
*/
|
|
55
|
+
toggleClosedLabel?: string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Describe the type of callout
|
|
59
|
+
*/
|
|
60
|
+
type?: calloutTypes;
|
|
61
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, { useState, useEffect, FC } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import useGlobalSettings from "../../hooks/useGlobalSettings";
|
|
4
|
+
import { CalloutProps } from "./Callout.props";
|
|
5
|
+
import { ButtonProps } from "../Button/Button.props";
|
|
6
|
+
import { Button } from "../Button";
|
|
7
|
+
|
|
8
|
+
const Callout: FC<CalloutProps> = ({
|
|
9
|
+
className,
|
|
10
|
+
copy,
|
|
11
|
+
cta,
|
|
12
|
+
isCollapsible,
|
|
13
|
+
isOpen = true,
|
|
14
|
+
toggleOpenLabel = "Less",
|
|
15
|
+
toggleClosedLabel = "More",
|
|
16
|
+
headline,
|
|
17
|
+
type,
|
|
18
|
+
}) => {
|
|
19
|
+
const { prefix } = useGlobalSettings();
|
|
20
|
+
const baseClass = `${prefix}--callout`;
|
|
21
|
+
const [toggleOpen, setToggleOpen] = useState(isOpen);
|
|
22
|
+
let toggleLabel = toggleOpen ? toggleOpenLabel : toggleClosedLabel;
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
setToggleOpen(isOpen);
|
|
26
|
+
toggleLabel = toggleOpen ? toggleOpenLabel : toggleClosedLabel;
|
|
27
|
+
}, [isOpen]);
|
|
28
|
+
|
|
29
|
+
const calloutClasses = classNames(className, {
|
|
30
|
+
[baseClass]: true,
|
|
31
|
+
[`${baseClass}--${type}`]: type,
|
|
32
|
+
[`${baseClass}--open`]: toggleOpen,
|
|
33
|
+
[`${baseClass}--collapse`]: isCollapsible,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const iconClasses = `icon icon--${type}`;
|
|
37
|
+
|
|
38
|
+
const ctaprops: ButtonProps = {
|
|
39
|
+
callback: false,
|
|
40
|
+
className: `${baseClass}--cta`,
|
|
41
|
+
children: false,
|
|
42
|
+
label: cta?.label,
|
|
43
|
+
size: "small",
|
|
44
|
+
type: "tertiary",
|
|
45
|
+
url: cta?.url,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const handleToggle = (e: React.MouseEvent<Element, MouseEvent>) => {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
toggleLabel = toggleOpen ? toggleOpenLabel : toggleClosedLabel;
|
|
51
|
+
setToggleOpen(!toggleOpen);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<div className={calloutClasses}>
|
|
56
|
+
<div className={`${baseClass}--sidebar`}>
|
|
57
|
+
<span className={iconClasses}></span>
|
|
58
|
+
</div>
|
|
59
|
+
<div className={`${baseClass}--content`}>
|
|
60
|
+
<div className={`${baseClass}--header`}>
|
|
61
|
+
<h5 className={`${baseClass}--headline`}>{headline}</h5>
|
|
62
|
+
{isCollapsible && (
|
|
63
|
+
<button
|
|
64
|
+
className={`${baseClass}--toggle`}
|
|
65
|
+
onClick={handleToggle}
|
|
66
|
+
type="button"
|
|
67
|
+
>
|
|
68
|
+
{toggleLabel}
|
|
69
|
+
<span className={`${baseClass}--toggle--icon`}></span>
|
|
70
|
+
</button>
|
|
71
|
+
)}
|
|
72
|
+
</div>
|
|
73
|
+
<p className={`${baseClass}--copy`}>{copy}</p>
|
|
74
|
+
{cta && <Button {...ctaprops} />}
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default Callout;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Callout } from "./Callout";
|