@a-little-world/little-world-design-system 2.10.0
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/.babelrc +7 -0
- package/.storybook/main.ts +36 -0
- package/.storybook/preview-head.html +6 -0
- package/.storybook/preview.ts +15 -0
- package/.turbo/turbo-build.log +14 -0
- package/CHANGELOG.md +398 -0
- package/LICENSE +21 -0
- package/README.md +180 -0
- package/__mocks__/focus-trap-react.tsx +1 -0
- package/__mocks__/svg.tsx +6 -0
- package/dist/cjs/components/Accordion/Accordion.d.ts +15 -0
- package/dist/cjs/components/Accordion/Accordion.js +20 -0
- package/dist/cjs/components/Accordion/styles.d.ts +18 -0
- package/dist/cjs/components/Accordion/styles.js +100 -0
- package/dist/cjs/components/Button/Button.d.ts +9 -0
- package/dist/cjs/components/Button/Button.js +17 -0
- package/dist/cjs/components/Button/styles.d.ts +16 -0
- package/dist/cjs/components/Button/styles.js +313 -0
- package/dist/cjs/components/Card/Card.d.ts +11 -0
- package/dist/cjs/components/Card/Card.js +108 -0
- package/dist/cjs/components/Checkbox/Checkbox.d.ts +15 -0
- package/dist/cjs/components/Checkbox/Checkbox.js +24 -0
- package/dist/cjs/components/Checkbox/styles.d.ts +27 -0
- package/dist/cjs/components/Checkbox/styles.js +108 -0
- package/dist/cjs/components/CheckboxGrid/CheckboxGrid.d.ts +22 -0
- package/dist/cjs/components/CheckboxGrid/CheckboxGrid.js +73 -0
- package/dist/cjs/components/CheckboxGrid/styles.d.ts +64 -0
- package/dist/cjs/components/CheckboxGrid/styles.js +137 -0
- package/dist/cjs/components/Dropdown/Dropdown.d.ts +25 -0
- package/dist/cjs/components/Dropdown/Dropdown.js +70 -0
- package/dist/cjs/components/Dropdown/styles.d.ts +15 -0
- package/dist/cjs/components/Dropdown/styles.js +145 -0
- package/dist/cjs/components/Icon/Icon.d.ts +10 -0
- package/dist/cjs/components/Icon/Icon.js +82 -0
- package/dist/cjs/components/Icon/IconGradient.d.ts +4 -0
- package/dist/cjs/components/Icon/IconGradient.js +29 -0
- package/dist/cjs/components/Icon/createIconComponent.d.ts +10 -0
- package/dist/cjs/components/Icon/createIconComponent.js +31 -0
- package/dist/cjs/components/Icon/getDefaultIconProps.d.ts +2 -0
- package/dist/cjs/components/Icon/getDefaultIconProps.js +15 -0
- package/dist/cjs/components/Icon/index.d.ts +553 -0
- package/dist/cjs/components/Icon/index.js +342 -0
- package/dist/cjs/components/Illustrations/Illustration.d.ts +3 -0
- package/dist/cjs/components/Illustrations/Illustration.js +12 -0
- package/dist/cjs/components/Illustrations/createIllustrationComponent.d.ts +10 -0
- package/dist/cjs/components/Illustrations/createIllustrationComponent.js +23 -0
- package/dist/cjs/components/Illustrations/index.d.ts +152 -0
- package/dist/cjs/components/Illustrations/index.js +81 -0
- package/dist/cjs/components/InputError/InputError.d.ts +15 -0
- package/dist/cjs/components/InputError/InputError.js +79 -0
- package/dist/cjs/components/Label/Label.d.ts +10 -0
- package/dist/cjs/components/Label/Label.js +68 -0
- package/dist/cjs/components/Link/Link.d.ts +6 -0
- package/dist/cjs/components/Link/Link.js +48 -0
- package/dist/cjs/components/Link/styles.d.ts +22 -0
- package/dist/cjs/components/Link/styles.js +99 -0
- package/dist/cjs/components/Loading/Loading.d.ts +10 -0
- package/dist/cjs/components/Loading/Loading.js +27 -0
- package/dist/cjs/components/Loading/LoadingLogo.d.ts +8 -0
- package/dist/cjs/components/Loading/LoadingLogo.js +31 -0
- package/dist/cjs/components/Loading/styles.d.ts +15 -0
- package/dist/cjs/components/Loading/styles.js +107 -0
- package/dist/cjs/components/Modal/Modal.d.ts +20 -0
- package/dist/cjs/components/Modal/Modal.js +95 -0
- package/dist/cjs/components/Modal/styles.d.ts +4 -0
- package/dist/cjs/components/Modal/styles.js +102 -0
- package/dist/cjs/components/MultiCheckbox/MultiCheckbox.d.ts +15 -0
- package/dist/cjs/components/MultiCheckbox/MultiCheckbox.js +61 -0
- package/dist/cjs/components/MultiCheckbox/styles.d.ts +1 -0
- package/dist/cjs/components/MultiCheckbox/styles.js +15 -0
- package/dist/cjs/components/MultiDropdown/MultiDropdown.d.ts +28 -0
- package/dist/cjs/components/MultiDropdown/MultiDropdown.js +124 -0
- package/dist/cjs/components/MultiDropdown/styles.d.ts +7 -0
- package/dist/cjs/components/MultiDropdown/styles.js +44 -0
- package/dist/cjs/components/MultiSelection/MultiSelection.d.ts +16 -0
- package/dist/cjs/components/MultiSelection/MultiSelection.js +62 -0
- package/dist/cjs/components/MultiSelection/styles.d.ts +9 -0
- package/dist/cjs/components/MultiSelection/styles.js +99 -0
- package/dist/cjs/components/NavigationMenu/NavigationMenu.d.ts +35 -0
- package/dist/cjs/components/NavigationMenu/NavigationMenu.js +85 -0
- package/dist/cjs/components/NavigationMenu/styles.d.ts +81 -0
- package/dist/cjs/components/NavigationMenu/styles.js +296 -0
- package/dist/cjs/components/Popover/InfoPopover.d.ts +8 -0
- package/dist/cjs/components/Popover/InfoPopover.js +46 -0
- package/dist/cjs/components/Popover/Popover.d.ts +16 -0
- package/dist/cjs/components/Popover/Popover.js +61 -0
- package/dist/cjs/components/Popover/styles.d.ts +14 -0
- package/dist/cjs/components/Popover/styles.js +116 -0
- package/dist/cjs/components/ProgressBar/ProgressBar.d.ts +8 -0
- package/dist/cjs/components/ProgressBar/ProgressBar.js +85 -0
- package/dist/cjs/components/RadioGroup/RadioGroup.d.ts +16 -0
- package/dist/cjs/components/RadioGroup/RadioGroup.js +24 -0
- package/dist/cjs/components/RadioGroup/styles.d.ts +12 -0
- package/dist/cjs/components/RadioGroup/styles.js +126 -0
- package/dist/cjs/components/Separator/Separator.d.ts +11 -0
- package/dist/cjs/components/Separator/Separator.js +61 -0
- package/dist/cjs/components/Separator/styles.d.ts +6 -0
- package/dist/cjs/components/Separator/styles.js +57 -0
- package/dist/cjs/components/Slider/Slider.d.ts +12 -0
- package/dist/cjs/components/Slider/Slider.js +17 -0
- package/dist/cjs/components/Slider/styles.d.ts +6 -0
- package/dist/cjs/components/Slider/styles.js +57 -0
- package/dist/cjs/components/StarRating/StarRating.d.ts +22 -0
- package/dist/cjs/components/StarRating/StarRating.js +143 -0
- package/dist/cjs/components/StarRating/styles.d.ts +35 -0
- package/dist/cjs/components/StarRating/styles.js +104 -0
- package/dist/cjs/components/StatusMessage/StatusMessage.d.ts +4 -0
- package/dist/cjs/components/StatusMessage/StatusMessage.js +112 -0
- package/dist/cjs/components/Switch/Switch.d.ts +15 -0
- package/dist/cjs/components/Switch/Switch.js +19 -0
- package/dist/cjs/components/Switch/styles.d.ts +14 -0
- package/dist/cjs/components/Switch/styles.js +99 -0
- package/dist/cjs/components/Tags/Tags.d.ts +15 -0
- package/dist/cjs/components/Tags/Tags.js +17 -0
- package/dist/cjs/components/Tags/styles.d.ts +19 -0
- package/dist/cjs/components/Tags/styles.js +119 -0
- package/dist/cjs/components/Text/Text.d.ts +11 -0
- package/dist/cjs/components/Text/Text.js +13 -0
- package/dist/cjs/components/Text/styles.d.ts +8 -0
- package/dist/cjs/components/Text/styles.js +98 -0
- package/dist/cjs/components/Text/types.d.ts +8 -0
- package/dist/cjs/components/Text/types.js +2 -0
- package/dist/cjs/components/TextArea/TextArea.d.ts +19 -0
- package/dist/cjs/components/TextArea/TextArea.js +84 -0
- package/dist/cjs/components/TextArea/styles.d.ts +22 -0
- package/dist/cjs/components/TextArea/styles.js +81 -0
- package/dist/cjs/components/TextContent/TextContent.d.ts +28 -0
- package/dist/cjs/components/TextContent/TextContent.js +46 -0
- package/dist/cjs/components/TextContent/styles.d.ts +24 -0
- package/dist/cjs/components/TextContent/styles.js +75 -0
- package/dist/cjs/components/TextInput/TextInput.d.ts +8 -0
- package/dist/cjs/components/TextInput/TextInput.js +49 -0
- package/dist/cjs/components/TextInput/styles.d.ts +18 -0
- package/dist/cjs/components/TextInput/styles.js +150 -0
- package/dist/cjs/components/Toast/Toast.d.ts +5 -0
- package/dist/cjs/components/Toast/Toast.js +90 -0
- package/dist/cjs/components/Toast/styles.d.ts +27 -0
- package/dist/cjs/components/Toast/styles.js +164 -0
- package/dist/cjs/components/Tooltip/Tooltip.d.ts +9 -0
- package/dist/cjs/components/Tooltip/Tooltip.js +55 -0
- package/dist/cjs/components/Tooltip/styles.d.ts +2 -0
- package/dist/cjs/components/Tooltip/styles.js +24 -0
- package/dist/cjs/components/Widget/AttachmentWidget.d.ts +18 -0
- package/dist/cjs/components/Widget/AttachmentWidget.js +124 -0
- package/dist/cjs/components/Widget/CallWidget.d.ts +11 -0
- package/dist/cjs/components/Widget/CallWidget.js +84 -0
- package/dist/cjs/components/Widget/Widget.d.ts +26 -0
- package/dist/cjs/components/Widget/Widget.js +87 -0
- package/dist/cjs/globalStyles.d.ts +5 -0
- package/dist/cjs/globalStyles.js +66 -0
- package/dist/cjs/hooks/useAutosizeTextArea.d.ts +2 -0
- package/dist/cjs/hooks/useAutosizeTextArea.js +14 -0
- package/dist/cjs/index.d.ts +51 -0
- package/dist/cjs/index.js +139 -0
- package/dist/cjs/storybook/BreakpointDocumentation.d.ts +3 -0
- package/dist/cjs/storybook/BreakpointDocumentation.js +139 -0
- package/dist/cjs/storybook/Components.d.ts +2 -0
- package/dist/cjs/storybook/Components.js +30 -0
- package/dist/cjs/storybook/Documentation.d.ts +5 -0
- package/dist/cjs/storybook/Documentation.js +67 -0
- package/dist/cjs/storybook/RadiusDocumentation.d.ts +3 -0
- package/dist/cjs/storybook/RadiusDocumentation.js +150 -0
- package/dist/cjs/storybook/SpacingDocumentation.d.ts +3 -0
- package/dist/cjs/storybook/SpacingDocumentation.js +146 -0
- package/dist/cjs/theme/index.d.ts +17 -0
- package/dist/cjs/theme/index.js +90 -0
- package/dist/cjs/utils/animations.d.ts +12 -0
- package/dist/cjs/utils/animations.js +120 -0
- package/dist/cjs/utils/createReactSvg.d.ts +3 -0
- package/dist/cjs/utils/createReactSvg.js +77 -0
- package/dist/cjs/utils/parser.d.ts +12 -0
- package/dist/cjs/utils/parser.js +200 -0
- package/dist/cjs/utils/replaceUrlsWithAnchors.d.ts +6 -0
- package/dist/cjs/utils/replaceUrlsWithAnchors.js +32 -0
- package/dist/cjs/utils/status.d.ts +6 -0
- package/dist/cjs/utils/status.js +54 -0
- package/dist/cjs/utils/styles.d.ts +1 -0
- package/dist/cjs/utils/styles.js +5 -0
- package/dist/cjs/utils/types.d.ts +1 -0
- package/dist/cjs/utils/types.js +2 -0
- package/dist/esm/components/Accordion/Accordion.d.ts +15 -0
- package/dist/esm/components/Accordion/Accordion.js +14 -0
- package/dist/esm/components/Accordion/styles.d.ts +18 -0
- package/dist/esm/components/Accordion/styles.js +61 -0
- package/dist/esm/components/Button/Button.d.ts +9 -0
- package/dist/esm/components/Button/Button.js +10 -0
- package/dist/esm/components/Button/styles.d.ts +16 -0
- package/dist/esm/components/Button/styles.js +277 -0
- package/dist/esm/components/Card/Card.d.ts +11 -0
- package/dist/esm/components/Card/Card.js +66 -0
- package/dist/esm/components/Checkbox/Checkbox.d.ts +15 -0
- package/dist/esm/components/Checkbox/Checkbox.js +17 -0
- package/dist/esm/components/Checkbox/styles.d.ts +27 -0
- package/dist/esm/components/Checkbox/styles.js +69 -0
- package/dist/esm/components/CheckboxGrid/CheckboxGrid.d.ts +22 -0
- package/dist/esm/components/CheckboxGrid/CheckboxGrid.js +35 -0
- package/dist/esm/components/CheckboxGrid/styles.d.ts +64 -0
- package/dist/esm/components/CheckboxGrid/styles.js +98 -0
- package/dist/esm/components/Dropdown/Dropdown.d.ts +25 -0
- package/dist/esm/components/Dropdown/Dropdown.js +32 -0
- package/dist/esm/components/Dropdown/styles.d.ts +15 -0
- package/dist/esm/components/Dropdown/styles.js +106 -0
- package/dist/esm/components/Icon/Icon.d.ts +10 -0
- package/dist/esm/components/Icon/Icon.js +42 -0
- package/dist/esm/components/Icon/IconGradient.d.ts +4 -0
- package/dist/esm/components/Icon/IconGradient.js +24 -0
- package/dist/esm/components/Icon/createIconComponent.d.ts +10 -0
- package/dist/esm/components/Icon/createIconComponent.js +24 -0
- package/dist/esm/components/Icon/getDefaultIconProps.d.ts +2 -0
- package/dist/esm/components/Icon/getDefaultIconProps.js +11 -0
- package/dist/esm/components/Icon/index.d.ts +553 -0
- package/dist/esm/components/Icon/index.js +338 -0
- package/dist/esm/components/Illustrations/Illustration.d.ts +3 -0
- package/dist/esm/components/Illustrations/Illustration.js +5 -0
- package/dist/esm/components/Illustrations/createIllustrationComponent.d.ts +10 -0
- package/dist/esm/components/Illustrations/createIllustrationComponent.js +16 -0
- package/dist/esm/components/Illustrations/index.d.ts +152 -0
- package/dist/esm/components/Illustrations/index.js +78 -0
- package/dist/esm/components/InputError/InputError.d.ts +15 -0
- package/dist/esm/components/InputError/InputError.js +40 -0
- package/dist/esm/components/Label/Label.d.ts +10 -0
- package/dist/esm/components/Label/Label.js +30 -0
- package/dist/esm/components/Link/Link.d.ts +6 -0
- package/dist/esm/components/Link/Link.js +13 -0
- package/dist/esm/components/Link/styles.d.ts +22 -0
- package/dist/esm/components/Link/styles.js +63 -0
- package/dist/esm/components/Loading/Loading.d.ts +10 -0
- package/dist/esm/components/Loading/Loading.js +21 -0
- package/dist/esm/components/Loading/LoadingLogo.d.ts +8 -0
- package/dist/esm/components/Loading/LoadingLogo.js +26 -0
- package/dist/esm/components/Loading/styles.d.ts +15 -0
- package/dist/esm/components/Loading/styles.js +71 -0
- package/dist/esm/components/Modal/Modal.d.ts +20 -0
- package/dist/esm/components/Modal/Modal.js +59 -0
- package/dist/esm/components/Modal/styles.d.ts +4 -0
- package/dist/esm/components/Modal/styles.js +63 -0
- package/dist/esm/components/MultiCheckbox/MultiCheckbox.d.ts +15 -0
- package/dist/esm/components/MultiCheckbox/MultiCheckbox.js +23 -0
- package/dist/esm/components/MultiCheckbox/styles.d.ts +1 -0
- package/dist/esm/components/MultiCheckbox/styles.js +9 -0
- package/dist/esm/components/MultiDropdown/MultiDropdown.d.ts +28 -0
- package/dist/esm/components/MultiDropdown/MultiDropdown.js +86 -0
- package/dist/esm/components/MultiDropdown/styles.d.ts +7 -0
- package/dist/esm/components/MultiDropdown/styles.js +38 -0
- package/dist/esm/components/MultiSelection/MultiSelection.d.ts +16 -0
- package/dist/esm/components/MultiSelection/MultiSelection.js +24 -0
- package/dist/esm/components/MultiSelection/styles.d.ts +9 -0
- package/dist/esm/components/MultiSelection/styles.js +63 -0
- package/dist/esm/components/NavigationMenu/NavigationMenu.d.ts +35 -0
- package/dist/esm/components/NavigationMenu/NavigationMenu.js +40 -0
- package/dist/esm/components/NavigationMenu/styles.d.ts +81 -0
- package/dist/esm/components/NavigationMenu/styles.js +257 -0
- package/dist/esm/components/Popover/InfoPopover.d.ts +8 -0
- package/dist/esm/components/Popover/InfoPopover.js +8 -0
- package/dist/esm/components/Popover/Popover.d.ts +16 -0
- package/dist/esm/components/Popover/Popover.js +22 -0
- package/dist/esm/components/Popover/styles.d.ts +14 -0
- package/dist/esm/components/Popover/styles.js +80 -0
- package/dist/esm/components/ProgressBar/ProgressBar.d.ts +8 -0
- package/dist/esm/components/ProgressBar/ProgressBar.js +47 -0
- package/dist/esm/components/RadioGroup/RadioGroup.d.ts +16 -0
- package/dist/esm/components/RadioGroup/RadioGroup.js +19 -0
- package/dist/esm/components/RadioGroup/styles.d.ts +12 -0
- package/dist/esm/components/RadioGroup/styles.js +90 -0
- package/dist/esm/components/Separator/Separator.d.ts +11 -0
- package/dist/esm/components/Separator/Separator.js +23 -0
- package/dist/esm/components/Separator/styles.d.ts +6 -0
- package/dist/esm/components/Separator/styles.js +51 -0
- package/dist/esm/components/Slider/Slider.d.ts +12 -0
- package/dist/esm/components/Slider/Slider.js +12 -0
- package/dist/esm/components/Slider/styles.d.ts +6 -0
- package/dist/esm/components/Slider/styles.js +51 -0
- package/dist/esm/components/StarRating/StarRating.d.ts +22 -0
- package/dist/esm/components/StarRating/StarRating.js +107 -0
- package/dist/esm/components/StarRating/styles.d.ts +35 -0
- package/dist/esm/components/StarRating/styles.js +65 -0
- package/dist/esm/components/StatusMessage/StatusMessage.d.ts +4 -0
- package/dist/esm/components/StatusMessage/StatusMessage.js +74 -0
- package/dist/esm/components/Switch/Switch.d.ts +15 -0
- package/dist/esm/components/Switch/Switch.js +14 -0
- package/dist/esm/components/Switch/styles.d.ts +14 -0
- package/dist/esm/components/Switch/styles.js +63 -0
- package/dist/esm/components/Tags/Tags.d.ts +15 -0
- package/dist/esm/components/Tags/Tags.js +10 -0
- package/dist/esm/components/Tags/styles.d.ts +19 -0
- package/dist/esm/components/Tags/styles.js +80 -0
- package/dist/esm/components/Text/Text.d.ts +11 -0
- package/dist/esm/components/Text/Text.js +8 -0
- package/dist/esm/components/Text/styles.d.ts +8 -0
- package/dist/esm/components/Text/styles.js +62 -0
- package/dist/esm/components/Text/types.d.ts +8 -0
- package/dist/esm/components/Text/types.js +1 -0
- package/dist/esm/components/TextArea/TextArea.d.ts +19 -0
- package/dist/esm/components/TextArea/TextArea.js +45 -0
- package/dist/esm/components/TextArea/styles.d.ts +22 -0
- package/dist/esm/components/TextArea/styles.js +42 -0
- package/dist/esm/components/TextContent/TextContent.d.ts +28 -0
- package/dist/esm/components/TextContent/TextContent.js +40 -0
- package/dist/esm/components/TextContent/styles.d.ts +24 -0
- package/dist/esm/components/TextContent/styles.js +36 -0
- package/dist/esm/components/TextInput/TextInput.d.ts +8 -0
- package/dist/esm/components/TextInput/TextInput.js +42 -0
- package/dist/esm/components/TextInput/styles.d.ts +18 -0
- package/dist/esm/components/TextInput/styles.js +111 -0
- package/dist/esm/components/Toast/Toast.d.ts +5 -0
- package/dist/esm/components/Toast/Toast.js +54 -0
- package/dist/esm/components/Toast/styles.d.ts +27 -0
- package/dist/esm/components/Toast/styles.js +125 -0
- package/dist/esm/components/Tooltip/Tooltip.d.ts +9 -0
- package/dist/esm/components/Tooltip/Tooltip.js +16 -0
- package/dist/esm/components/Tooltip/styles.d.ts +2 -0
- package/dist/esm/components/Tooltip/styles.js +18 -0
- package/dist/esm/components/Widget/AttachmentWidget.d.ts +18 -0
- package/dist/esm/components/Widget/AttachmentWidget.js +85 -0
- package/dist/esm/components/Widget/CallWidget.d.ts +11 -0
- package/dist/esm/components/Widget/CallWidget.js +46 -0
- package/dist/esm/components/Widget/Widget.d.ts +26 -0
- package/dist/esm/components/Widget/Widget.js +46 -0
- package/dist/esm/globalStyles.d.ts +5 -0
- package/dist/esm/globalStyles.js +64 -0
- package/dist/esm/hooks/useAutosizeTextArea.d.ts +2 -0
- package/dist/esm/hooks/useAutosizeTextArea.js +12 -0
- package/dist/esm/index.d.ts +51 -0
- package/dist/esm/index.js +45 -0
- package/dist/esm/storybook/BreakpointDocumentation.d.ts +3 -0
- package/dist/esm/storybook/BreakpointDocumentation.js +101 -0
- package/dist/esm/storybook/Components.d.ts +2 -0
- package/dist/esm/storybook/Components.js +23 -0
- package/dist/esm/storybook/Documentation.d.ts +5 -0
- package/dist/esm/storybook/Documentation.js +62 -0
- package/dist/esm/storybook/RadiusDocumentation.d.ts +3 -0
- package/dist/esm/storybook/RadiusDocumentation.js +112 -0
- package/dist/esm/storybook/SpacingDocumentation.d.ts +3 -0
- package/dist/esm/storybook/SpacingDocumentation.js +108 -0
- package/dist/esm/theme/index.d.ts +17 -0
- package/dist/esm/theme/index.js +53 -0
- package/dist/esm/utils/animations.d.ts +12 -0
- package/dist/esm/utils/animations.js +117 -0
- package/dist/esm/utils/createReactSvg.d.ts +3 -0
- package/dist/esm/utils/createReactSvg.js +70 -0
- package/dist/esm/utils/parser.d.ts +12 -0
- package/dist/esm/utils/parser.js +195 -0
- package/dist/esm/utils/replaceUrlsWithAnchors.d.ts +6 -0
- package/dist/esm/utils/replaceUrlsWithAnchors.js +29 -0
- package/dist/esm/utils/status.d.ts +6 -0
- package/dist/esm/utils/status.js +49 -0
- package/dist/esm/utils/styles.d.ts +1 -0
- package/dist/esm/utils/styles.js +1 -0
- package/dist/esm/utils/types.d.ts +1 -0
- package/dist/esm/utils/types.js +1 -0
- package/jest.config.ts +30 -0
- package/package.json +98 -0
- package/src/components/Accordion/Accordion.stories.tsx +66 -0
- package/src/components/Accordion/Accordion.tsx +59 -0
- package/src/components/Accordion/styles.tsx +68 -0
- package/src/components/Button/Button.stories.tsx +119 -0
- package/src/components/Button/Button.tsx +59 -0
- package/src/components/Button/styles.tsx +313 -0
- package/src/components/Card/Card.stories.tsx +22 -0
- package/src/components/Card/Card.tsx +125 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +11 -0
- package/src/components/Checkbox/Checkbox.tsx +112 -0
- package/src/components/Checkbox/styles.tsx +96 -0
- package/src/components/CheckboxGrid/CheckboxGrid.stories.tsx +49 -0
- package/src/components/CheckboxGrid/CheckboxGrid.tsx +126 -0
- package/src/components/CheckboxGrid/styles.tsx +122 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +59 -0
- package/src/components/Dropdown/Dropdown.tsx +128 -0
- package/src/components/Dropdown/styles.tsx +120 -0
- package/src/components/Icon/Icon.stories.tsx +44 -0
- package/src/components/Icon/Icon.test.tsx +20 -0
- package/src/components/Icon/Icon.tsx +88 -0
- package/src/components/Icon/IconDocs.mdx +22 -0
- package/src/components/Icon/IconGradient.tsx +70 -0
- package/src/components/Icon/createIconComponent.tsx +63 -0
- package/src/components/Icon/getDefaultIconProps.ts +23 -0
- package/src/components/Icon/index.ts +499 -0
- package/src/components/Illustrations/Illustration.tsx +18 -0
- package/src/components/Illustrations/Illustrations.stories.tsx +53 -0
- package/src/components/Illustrations/createIllustrationComponent.tsx +39 -0
- package/src/components/Illustrations/index.ts +118 -0
- package/src/components/InputError/InputError.tsx +86 -0
- package/src/components/Label/Label.stories.tsx +18 -0
- package/src/components/Label/Label.tsx +76 -0
- package/src/components/Link/Link.stories.tsx +14 -0
- package/src/components/Link/Link.test.tsx +27 -0
- package/src/components/Link/Link.tsx +68 -0
- package/src/components/Link/styles.tsx +86 -0
- package/src/components/Loading/Loading.stories.tsx +26 -0
- package/src/components/Loading/Loading.tsx +65 -0
- package/src/components/Loading/LoadingLogo.tsx +141 -0
- package/src/components/Loading/styles.ts +95 -0
- package/src/components/Modal/Modal.stories.tsx +52 -0
- package/src/components/Modal/Modal.test.tsx +98 -0
- package/src/components/Modal/Modal.tsx +115 -0
- package/src/components/Modal/ModalDocs.mdx +21 -0
- package/src/components/Modal/styles.tsx +67 -0
- package/src/components/MultiCheckbox/MultiCheckbox.stories.tsx +24 -0
- package/src/components/MultiCheckbox/MultiCheckbox.tsx +73 -0
- package/src/components/MultiCheckbox/styles.tsx +10 -0
- package/src/components/MultiDropdown/MultiDropdown.stories.tsx +105 -0
- package/src/components/MultiDropdown/MultiDropdown.tsx +247 -0
- package/src/components/MultiDropdown/styles.tsx +45 -0
- package/src/components/MultiSelection/MultiSelection.stories.tsx +19 -0
- package/src/components/MultiSelection/MultiSelection.tsx +74 -0
- package/src/components/MultiSelection/styles.tsx +78 -0
- package/src/components/NavigationMenu/NavigationMenu.stories.tsx +108 -0
- package/src/components/NavigationMenu/NavigationMenu.tsx +151 -0
- package/src/components/NavigationMenu/styles.tsx +293 -0
- package/src/components/Popover/InfoPopover.tsx +40 -0
- package/src/components/Popover/Popover.stories.tsx +85 -0
- package/src/components/Popover/Popover.tsx +68 -0
- package/src/components/Popover/styles.tsx +109 -0
- package/src/components/ProgressBar/ProgressBar.stories.tsx +15 -0
- package/src/components/ProgressBar/ProgressBar.tsx +76 -0
- package/src/components/RadioGroup/RadioGroup.stories.tsx +42 -0
- package/src/components/RadioGroup/RadioGroup.tsx +91 -0
- package/src/components/RadioGroup/styles.tsx +100 -0
- package/src/components/Separator/Separator.stories.tsx +27 -0
- package/src/components/Separator/Separator.tsx +52 -0
- package/src/components/Separator/styles.tsx +57 -0
- package/src/components/Slider/Slider.stories.tsx +27 -0
- package/src/components/Slider/Slider.tsx +61 -0
- package/src/components/Slider/styles.tsx +57 -0
- package/src/components/StarRating/StarRating.stories.tsx +20 -0
- package/src/components/StarRating/StarRating.tsx +212 -0
- package/src/components/StarRating/styles.ts +76 -0
- package/src/components/StatusMessage/StatusMessage.stories.tsx +44 -0
- package/src/components/StatusMessage/StatusMessage.tsx +110 -0
- package/src/components/Switch/Switch.stories.tsx +12 -0
- package/src/components/Switch/Switch.tsx +83 -0
- package/src/components/Switch/styles.tsx +75 -0
- package/src/components/Tags/Tags.stories.tsx +44 -0
- package/src/components/Tags/Tags.tsx +68 -0
- package/src/components/Tags/styles.tsx +89 -0
- package/src/components/Text/Text.stories.tsx +288 -0
- package/src/components/Text/Text.tsx +58 -0
- package/src/components/Text/styles.tsx +75 -0
- package/src/components/Text/types.ts +9 -0
- package/src/components/Text/typography.mdx +91 -0
- package/src/components/TextArea/TextArea.stories.tsx +26 -0
- package/src/components/TextArea/TextArea.tsx +117 -0
- package/src/components/TextArea/styles.tsx +58 -0
- package/src/components/TextContent/TextContent.stories.tsx +54 -0
- package/src/components/TextContent/TextContent.tsx +154 -0
- package/src/components/TextContent/styles.tsx +47 -0
- package/src/components/TextInput/TextInput.stories.tsx +43 -0
- package/src/components/TextInput/TextInput.tsx +146 -0
- package/src/components/TextInput/styles.tsx +129 -0
- package/src/components/Toast/Toast.stories.tsx +55 -0
- package/src/components/Toast/Toast.tsx +139 -0
- package/src/components/Toast/styles.tsx +142 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +31 -0
- package/src/components/Tooltip/Tooltip.tsx +48 -0
- package/src/components/Tooltip/styles.tsx +20 -0
- package/src/components/Widget/AttachmentWidget.stories.tsx +14 -0
- package/src/components/Widget/AttachmentWidget.tsx +142 -0
- package/src/components/Widget/CallWidget.stories.tsx +38 -0
- package/src/components/Widget/CallWidget.tsx +114 -0
- package/src/components/Widget/Widget.stories.tsx +10 -0
- package/src/components/Widget/Widget.tsx +104 -0
- package/src/globalStyles.ts +68 -0
- package/src/hooks/useAutosizeTextArea.tsx +19 -0
- package/src/index.ts +107 -0
- package/src/setupTests.ts +8 -0
- package/src/storybook/BreakpointDocumentation.tsx +126 -0
- package/src/storybook/Components.tsx +29 -0
- package/src/storybook/Documentation.tsx +86 -0
- package/src/storybook/RadiusDocumentation.tsx +133 -0
- package/src/storybook/SpacingDocumentation.tsx +131 -0
- package/src/storybook/breakpoints.mdx +83 -0
- package/src/storybook/colors.mdx +118 -0
- package/src/storybook/radius.mdx +48 -0
- package/src/storybook/spacing.mdx +45 -0
- package/src/testUtils.tsx +49 -0
- package/src/theme/index.tsx +98 -0
- package/src/utils/animations.ts +129 -0
- package/src/utils/createReactSvg.tsx +140 -0
- package/src/utils/parser.mdx +41 -0
- package/src/utils/parser.test.tsx +542 -0
- package/src/utils/parser.tsx +333 -0
- package/src/utils/replaceUrlsWithAnchors.test.ts +42 -0
- package/src/utils/replaceUrlsWithAnchors.ts +32 -0
- package/src/utils/status.tsx +85 -0
- package/src/utils/styles.ts +1 -0
- package/src/utils/types.ts +1 -0
- package/tsconfig.json +34 -0
- package/tsconfig.test.json +16 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { isEmpty } from 'lodash';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import Button, { ButtonSizes, ButtonVariations } from '../Button/Button';
|
|
5
|
+
import Dropdown, { DropdownProps } from '../Dropdown/Dropdown';
|
|
6
|
+
import { PlusIcon, TrashIcon } from '../Icon';
|
|
7
|
+
import Label from '../Label/Label';
|
|
8
|
+
import Text from '../Text/Text';
|
|
9
|
+
import {
|
|
10
|
+
AddMore,
|
|
11
|
+
AddMoreButton,
|
|
12
|
+
DeleteButton,
|
|
13
|
+
MultiDropdownWrapper,
|
|
14
|
+
Segment,
|
|
15
|
+
} from './styles';
|
|
16
|
+
import { useTheme } from 'styled-components';
|
|
17
|
+
|
|
18
|
+
const DELETE_SEGMENT = 'delete segment';
|
|
19
|
+
|
|
20
|
+
interface DropdownInstanceProps extends Omit<DropdownProps, 'onValueChange'> {
|
|
21
|
+
lockedValue?: string;
|
|
22
|
+
dataField: string;
|
|
23
|
+
values: string[];
|
|
24
|
+
ariaLabel: string;
|
|
25
|
+
errors: string[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type Props = {
|
|
29
|
+
addMoreLabel: string;
|
|
30
|
+
error?: string;
|
|
31
|
+
label?: string;
|
|
32
|
+
labelTooltip?: string;
|
|
33
|
+
locked?: boolean;
|
|
34
|
+
defaultSegments?: number;
|
|
35
|
+
maxSegments?: number;
|
|
36
|
+
onValueChange: (value: { [x: string]: string }[]) => void;
|
|
37
|
+
firstDropdown: DropdownInstanceProps;
|
|
38
|
+
secondDropdown: DropdownInstanceProps;
|
|
39
|
+
restrictions?: { [key: string]: string[] };
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const formatValues = (
|
|
43
|
+
values: string[][],
|
|
44
|
+
firstDataField: string,
|
|
45
|
+
secondDataField: string,
|
|
46
|
+
) =>
|
|
47
|
+
values[0].reduce((newValues: { [x: string]: string }[], firstVal, index) => {
|
|
48
|
+
// only push the value if both values exist
|
|
49
|
+
if (firstVal && values[1][index]) {
|
|
50
|
+
newValues.push({
|
|
51
|
+
[firstDataField]: firstVal,
|
|
52
|
+
[secondDataField]: values[1][index],
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return newValues;
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
58
|
+
const setDropdownValues = (
|
|
59
|
+
firstDropdown: DropdownInstanceProps,
|
|
60
|
+
secondDropdown: DropdownInstanceProps,
|
|
61
|
+
) => {
|
|
62
|
+
const first =
|
|
63
|
+
(firstDropdown.lockedValue
|
|
64
|
+
? [firstDropdown.lockedValue, ...(firstDropdown.values.slice(1) || [])]
|
|
65
|
+
: firstDropdown.values) || [];
|
|
66
|
+
const second =
|
|
67
|
+
(secondDropdown.lockedValue
|
|
68
|
+
? [secondDropdown.lockedValue, ...(secondDropdown.values.slice(1) || [])]
|
|
69
|
+
: secondDropdown.values) || [];
|
|
70
|
+
|
|
71
|
+
return [first, second];
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const MultiDropdown: React.FC<Props> = ({
|
|
75
|
+
addMoreLabel = 'Add more rows',
|
|
76
|
+
label,
|
|
77
|
+
labelTooltip,
|
|
78
|
+
locked,
|
|
79
|
+
firstDropdown,
|
|
80
|
+
secondDropdown,
|
|
81
|
+
onValueChange,
|
|
82
|
+
defaultSegments = 1,
|
|
83
|
+
maxSegments = 4,
|
|
84
|
+
restrictions,
|
|
85
|
+
}) => {
|
|
86
|
+
const [segments, setSegments] = useState(
|
|
87
|
+
Math.max(
|
|
88
|
+
firstDropdown?.values?.length ?? 0,
|
|
89
|
+
secondDropdown?.values?.length ?? 0,
|
|
90
|
+
defaultSegments,
|
|
91
|
+
),
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const [values, setValues] = useState(
|
|
95
|
+
setDropdownValues(firstDropdown, secondDropdown),
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const theme = useTheme();
|
|
99
|
+
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
setValues(setDropdownValues(firstDropdown, secondDropdown));
|
|
102
|
+
setSegments(
|
|
103
|
+
Math.max(
|
|
104
|
+
firstDropdown?.values?.length ?? 0,
|
|
105
|
+
secondDropdown?.values?.length ?? 0,
|
|
106
|
+
defaultSegments,
|
|
107
|
+
),
|
|
108
|
+
);
|
|
109
|
+
}, [firstDropdown?.values, secondDropdown?.values]);
|
|
110
|
+
|
|
111
|
+
const handleValueChange = (
|
|
112
|
+
value: string,
|
|
113
|
+
position: number,
|
|
114
|
+
index: number,
|
|
115
|
+
) => {
|
|
116
|
+
setValues(values => {
|
|
117
|
+
const newValues = [...values];
|
|
118
|
+
newValues[position][index] = value;
|
|
119
|
+
|
|
120
|
+
if (values[position || 0])
|
|
121
|
+
onValueChange(
|
|
122
|
+
formatValues(
|
|
123
|
+
newValues,
|
|
124
|
+
firstDropdown.dataField,
|
|
125
|
+
secondDropdown.dataField,
|
|
126
|
+
),
|
|
127
|
+
);
|
|
128
|
+
return newValues;
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const handleDelete = (index: number) => {
|
|
133
|
+
setValues(values => {
|
|
134
|
+
const newValues = [...values];
|
|
135
|
+
(newValues[0].splice(index, 1),
|
|
136
|
+
newValues[1].splice(index, 1),
|
|
137
|
+
onValueChange(
|
|
138
|
+
formatValues(
|
|
139
|
+
newValues,
|
|
140
|
+
firstDropdown.dataField,
|
|
141
|
+
secondDropdown.dataField,
|
|
142
|
+
),
|
|
143
|
+
));
|
|
144
|
+
return newValues;
|
|
145
|
+
});
|
|
146
|
+
setSegments(currentNumber => currentNumber - 1);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<MultiDropdownWrapper>
|
|
151
|
+
{label && (
|
|
152
|
+
<Label
|
|
153
|
+
bold
|
|
154
|
+
htmlFor={firstDropdown.label}
|
|
155
|
+
marginBottom={theme.spacing.xsmall}
|
|
156
|
+
tooltipText={labelTooltip}
|
|
157
|
+
>
|
|
158
|
+
{label}
|
|
159
|
+
</Label>
|
|
160
|
+
)}
|
|
161
|
+
{Array(segments)
|
|
162
|
+
.fill('')
|
|
163
|
+
.map((_, index) => {
|
|
164
|
+
const isFirstSegment = index === 0;
|
|
165
|
+
const firstSegmentLockedVal1 = isFirstSegment
|
|
166
|
+
? firstDropdown.lockedValue
|
|
167
|
+
: undefined;
|
|
168
|
+
const firstSegmentLockedVal2 = isFirstSegment
|
|
169
|
+
? secondDropdown.lockedValue
|
|
170
|
+
: undefined;
|
|
171
|
+
const deletable = !!index && !locked;
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<Segment
|
|
175
|
+
$locked={locked}
|
|
176
|
+
key={`MultiDropdown Segment ${index}${values[0][index]}${values[1][index]}`}
|
|
177
|
+
>
|
|
178
|
+
<Dropdown
|
|
179
|
+
ariaLabel={firstDropdown.ariaLabel + index}
|
|
180
|
+
placeholder={firstDropdown.placeholder}
|
|
181
|
+
onValueChange={val => handleValueChange(val, 0, index)}
|
|
182
|
+
options={firstDropdown.options}
|
|
183
|
+
value={values[0][index]}
|
|
184
|
+
lockedValue={
|
|
185
|
+
firstSegmentLockedVal1 ||
|
|
186
|
+
(locked ? values[0][index] : undefined)
|
|
187
|
+
}
|
|
188
|
+
required={Boolean(values[1][index])}
|
|
189
|
+
error={firstDropdown.errors?.[index]}
|
|
190
|
+
/>
|
|
191
|
+
<Dropdown
|
|
192
|
+
ariaLabel={secondDropdown.ariaLabel + index}
|
|
193
|
+
placeholder={secondDropdown.placeholder}
|
|
194
|
+
onValueChange={val => handleValueChange(val, 1, index)}
|
|
195
|
+
options={
|
|
196
|
+
isEmpty(restrictions?.[values[0][index]])
|
|
197
|
+
? secondDropdown.options
|
|
198
|
+
: secondDropdown.options.filter(option =>
|
|
199
|
+
restrictions?.[values[0][index]]?.includes(
|
|
200
|
+
option.value,
|
|
201
|
+
),
|
|
202
|
+
)
|
|
203
|
+
}
|
|
204
|
+
value={values[1][index]}
|
|
205
|
+
lockedValue={
|
|
206
|
+
firstSegmentLockedVal2 ||
|
|
207
|
+
(locked ? values[1][index] : undefined)
|
|
208
|
+
}
|
|
209
|
+
required={Boolean(values[0][index])}
|
|
210
|
+
error={secondDropdown.errors?.[index]}
|
|
211
|
+
/>
|
|
212
|
+
{deletable && (
|
|
213
|
+
<DeleteButton
|
|
214
|
+
variation={ButtonVariations.Icon}
|
|
215
|
+
onClick={() => handleDelete(index)}
|
|
216
|
+
size={ButtonSizes.Small}
|
|
217
|
+
>
|
|
218
|
+
<TrashIcon label={DELETE_SEGMENT} color="orange" />
|
|
219
|
+
</DeleteButton>
|
|
220
|
+
)}
|
|
221
|
+
</Segment>
|
|
222
|
+
);
|
|
223
|
+
})}
|
|
224
|
+
{!locked && (
|
|
225
|
+
<AddMore>
|
|
226
|
+
<AddMoreButton
|
|
227
|
+
variation={ButtonVariations.Icon}
|
|
228
|
+
disabled={segments === maxSegments}
|
|
229
|
+
onClick={() => setSegments(currentNumber => currentNumber + 1)}
|
|
230
|
+
size={ButtonSizes.Small}
|
|
231
|
+
>
|
|
232
|
+
<PlusIcon label="add more dropdowns" width={10} />
|
|
233
|
+
</AddMoreButton>
|
|
234
|
+
<Button
|
|
235
|
+
variation={ButtonVariations.Inline}
|
|
236
|
+
disabled={segments === maxSegments}
|
|
237
|
+
onClick={() => setSegments(currentNumber => currentNumber + 1)}
|
|
238
|
+
>
|
|
239
|
+
<Text>{addMoreLabel}</Text>
|
|
240
|
+
</Button>
|
|
241
|
+
</AddMore>
|
|
242
|
+
)}
|
|
243
|
+
</MultiDropdownWrapper>
|
|
244
|
+
);
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
export default MultiDropdown;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import Button from '../Button/Button';
|
|
4
|
+
import { DROPDOWN_MAX_WIDTH } from '../Dropdown/styles';
|
|
5
|
+
|
|
6
|
+
export const MultiDropdownWrapper = styled.div``;
|
|
7
|
+
|
|
8
|
+
export const AddMore = styled.div`
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: ${({ theme }) => theme.spacing.xxsmall};
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export const AddMoreButton = styled(Button)`
|
|
15
|
+
color: ${({ theme }) => theme.color.text.highlight};
|
|
16
|
+
|
|
17
|
+
&:disabled {
|
|
18
|
+
color: ${({ theme }) => theme.color.text.disabled};
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
export const Segment = styled.section<{ $locked?: boolean }>`
|
|
23
|
+
display: grid;
|
|
24
|
+
max-width: calc(
|
|
25
|
+
${DROPDOWN_MAX_WIDTH} * 2 + ${({ theme }) => theme.spacing.small}
|
|
26
|
+
);
|
|
27
|
+
grid-template-columns: ${({ $locked, theme }) =>
|
|
28
|
+
$locked
|
|
29
|
+
? 'repeat(2, minmax(0, 1fr))'
|
|
30
|
+
: `repeat(2, minmax(0, 1fr)) minmax(
|
|
31
|
+
${theme.spacing.medium},
|
|
32
|
+
auto
|
|
33
|
+
)`};
|
|
34
|
+
align-items: start;
|
|
35
|
+
gap: ${({ theme }) => theme.spacing.small};
|
|
36
|
+
margin-bottom: ${({ theme }) => theme.spacing.xxsmall};
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
export const DeleteButton = styled(Button)`
|
|
40
|
+
top: ${({ theme }) => theme.spacing.xxsmall};
|
|
41
|
+
margin-left: calc(
|
|
42
|
+
${({ theme }) => theme.spacing.xxsmall} -
|
|
43
|
+
${({ theme }) => theme.spacing.small}
|
|
44
|
+
);
|
|
45
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import MultiSelection from './MultiSelection';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
component: MultiSelection,
|
|
6
|
+
title: 'Components/MultiSelection',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const Default = args => <MultiSelection {...args} />;
|
|
10
|
+
|
|
11
|
+
Default.args = {
|
|
12
|
+
id: 'multi selector id',
|
|
13
|
+
label: 'Select your interests',
|
|
14
|
+
onSelection: () => null,
|
|
15
|
+
options: [
|
|
16
|
+
{ tag: 'Love', value: 'love' },
|
|
17
|
+
{ tag: 'Cherish', value: 'cherish' },
|
|
18
|
+
],
|
|
19
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { MultiSelectionWrapper, Options, Option } from './styles';
|
|
3
|
+
|
|
4
|
+
import Label from '../Label/Label';
|
|
5
|
+
import InputError from '../InputError/InputError';
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
error?: string;
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
labelTooltip?: string;
|
|
12
|
+
options: { tag: string; value: string }[];
|
|
13
|
+
preSelected?: string[];
|
|
14
|
+
onSelection: (selected: string[]) => void;
|
|
15
|
+
withBackground?: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const MultiSelection: React.FC<Props> = ({
|
|
19
|
+
error,
|
|
20
|
+
label,
|
|
21
|
+
labelTooltip,
|
|
22
|
+
id,
|
|
23
|
+
options,
|
|
24
|
+
preSelected = [],
|
|
25
|
+
onSelection,
|
|
26
|
+
withBackground = true,
|
|
27
|
+
}: Props) => {
|
|
28
|
+
const [selected, setSelected] = useState<string[]>([]);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setSelected(preSelected);
|
|
32
|
+
}, [JSON.stringify([preSelected])]);
|
|
33
|
+
|
|
34
|
+
const handleOnClick = (newSelection: string[]) => {
|
|
35
|
+
setSelected(newSelection);
|
|
36
|
+
onSelection(newSelection);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<MultiSelectionWrapper>
|
|
41
|
+
{label && (
|
|
42
|
+
<Label bold htmlFor={id} tooltipText={labelTooltip}>
|
|
43
|
+
{label}
|
|
44
|
+
</Label>
|
|
45
|
+
)}
|
|
46
|
+
<Options $hasError={Boolean(error)} $withBackground={withBackground}>
|
|
47
|
+
{options.map(option => {
|
|
48
|
+
const isSelected = selected?.some(el => el === option.value);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Option
|
|
52
|
+
key={option.value}
|
|
53
|
+
$selected={isSelected}
|
|
54
|
+
$withBackground={withBackground}
|
|
55
|
+
onClick={() =>
|
|
56
|
+
handleOnClick(
|
|
57
|
+
isSelected
|
|
58
|
+
? selected.filter(el => el !== option.value)
|
|
59
|
+
: [...selected, option.value],
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
type="button"
|
|
63
|
+
>
|
|
64
|
+
{option.tag}
|
|
65
|
+
</Option>
|
|
66
|
+
);
|
|
67
|
+
})}
|
|
68
|
+
</Options>
|
|
69
|
+
<InputError visible={Boolean(error)}>{error}</InputError>
|
|
70
|
+
</MultiSelectionWrapper>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default MultiSelection;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { INPUT_ERROR_CSS } from '../InputError/InputError';
|
|
4
|
+
|
|
5
|
+
export const MultiSelectionWrapper = styled.div`
|
|
6
|
+
width: 100%:
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
export const Options = styled.div<{
|
|
10
|
+
$hasError: boolean;
|
|
11
|
+
$withBackground: boolean;
|
|
12
|
+
}>`
|
|
13
|
+
display: flex;
|
|
14
|
+
border-radius: 15px;
|
|
15
|
+
align-items: center;
|
|
16
|
+
text-align: center;
|
|
17
|
+
flex-wrap: wrap;
|
|
18
|
+
gap: ${({ theme }) => theme.spacing.xxsmall};
|
|
19
|
+
padding: 0px;
|
|
20
|
+
margin-bottom: ${({ theme }) => theme.spacing.xxsmall};
|
|
21
|
+
white-space: pre-line;
|
|
22
|
+
|
|
23
|
+
${({ theme, $withBackground }) =>
|
|
24
|
+
$withBackground &&
|
|
25
|
+
css`
|
|
26
|
+
background: ${theme.color.surface.secondary};
|
|
27
|
+
border: 1px solid ${theme.color.border.subtle};
|
|
28
|
+
padding: ${theme.spacing.xxsmall};
|
|
29
|
+
|
|
30
|
+
@media (min-width: ${theme.breakpoints.small}) {
|
|
31
|
+
padding: ${theme.spacing.small};
|
|
32
|
+
}
|
|
33
|
+
`}
|
|
34
|
+
|
|
35
|
+
${({ $hasError }) => $hasError && INPUT_ERROR_CSS}
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
export const Option = styled.button<{
|
|
39
|
+
$selected: boolean;
|
|
40
|
+
$withBackground: boolean;
|
|
41
|
+
}>`
|
|
42
|
+
font-family: 'Signika Negative';
|
|
43
|
+
color: ${({ theme, $selected, $withBackground }) =>
|
|
44
|
+
$withBackground || $selected
|
|
45
|
+
? theme.color.text.primary
|
|
46
|
+
: theme.color.text.disabled};
|
|
47
|
+
background: ${({ theme }) => theme.color.surface.primary};
|
|
48
|
+
border-radius: 10px;
|
|
49
|
+
box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.03);
|
|
50
|
+
border-radius: 1000px;
|
|
51
|
+
border: 2px solid
|
|
52
|
+
${({ theme, $withBackground }) =>
|
|
53
|
+
$withBackground
|
|
54
|
+
? theme.color.border.reversed
|
|
55
|
+
: theme.color.border.subtle};
|
|
56
|
+
padding: ${({ theme }) =>
|
|
57
|
+
`${theme.spacing.xxxsmall} ${theme.spacing.xsmall}`};
|
|
58
|
+
min-width: 60px;
|
|
59
|
+
height: 33px;
|
|
60
|
+
|
|
61
|
+
&:hover {
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
${({ theme }) => css`
|
|
66
|
+
@media (min-width: ${theme.breakpoints.small}) {
|
|
67
|
+
padding: ${theme.spacing.xxsmall} ${theme.spacing.small};
|
|
68
|
+
min-width: 80px;
|
|
69
|
+
height: 45px;
|
|
70
|
+
}
|
|
71
|
+
`}
|
|
72
|
+
|
|
73
|
+
${({ $selected, theme }) =>
|
|
74
|
+
$selected &&
|
|
75
|
+
css`
|
|
76
|
+
border-color: ${theme.color.border.selected};
|
|
77
|
+
`}
|
|
78
|
+
`;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react-webpack5';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { withRouter } from 'storybook-addon-remix-react-router';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
MenuContentLayout,
|
|
7
|
+
NavigationMenu,
|
|
8
|
+
NavigationMenuCallout,
|
|
9
|
+
NavigationMenuContent,
|
|
10
|
+
NavigationMenuContentItem,
|
|
11
|
+
NavigationMenuItem,
|
|
12
|
+
NavigationMenuLink,
|
|
13
|
+
NavigationMenuTrigger,
|
|
14
|
+
} from './NavigationMenu';
|
|
15
|
+
|
|
16
|
+
const meta: Meta<typeof NavigationMenu> = {
|
|
17
|
+
component: NavigationMenu,
|
|
18
|
+
title: 'Components/NavigationMenu',
|
|
19
|
+
decorators: [withRouter],
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
|
|
24
|
+
export const Default = () => (
|
|
25
|
+
<div style={{ height: '500px', width: '100%' }}>
|
|
26
|
+
<NavigationMenu>
|
|
27
|
+
<NavigationMenuItem>
|
|
28
|
+
<NavigationMenuTrigger>Callout With List</NavigationMenuTrigger>
|
|
29
|
+
<NavigationMenuContent layout={MenuContentLayout.calloutWithList}>
|
|
30
|
+
<NavigationMenuCallout
|
|
31
|
+
heading="New to Little World"
|
|
32
|
+
description="Amazing new feature offered by Little World. Go there now"
|
|
33
|
+
link="/"
|
|
34
|
+
/>
|
|
35
|
+
<NavigationMenuContentItem href="/" title="Stitches" active>
|
|
36
|
+
CSS-in-JS with best-in-class developer experience.
|
|
37
|
+
</NavigationMenuContentItem>
|
|
38
|
+
<NavigationMenuContentItem href="/" title="Colors">
|
|
39
|
+
Beautiful, thought-out palettes with auto dark mode.
|
|
40
|
+
</NavigationMenuContentItem>
|
|
41
|
+
<NavigationMenuContentItem href="/" title="Icons">
|
|
42
|
+
A crisp set of 15x15 icons, balanced and consistent.
|
|
43
|
+
</NavigationMenuContentItem>
|
|
44
|
+
</NavigationMenuContent>
|
|
45
|
+
</NavigationMenuItem>
|
|
46
|
+
|
|
47
|
+
<NavigationMenuItem>
|
|
48
|
+
<NavigationMenuTrigger>Callout</NavigationMenuTrigger>
|
|
49
|
+
<NavigationMenuContent layout={MenuContentLayout.callout}>
|
|
50
|
+
<NavigationMenuCallout
|
|
51
|
+
heading="New to Little World"
|
|
52
|
+
description="Amazing new feature offered by Little World. Go there now"
|
|
53
|
+
link="/"
|
|
54
|
+
/>
|
|
55
|
+
</NavigationMenuContent>
|
|
56
|
+
</NavigationMenuItem>
|
|
57
|
+
|
|
58
|
+
<NavigationMenuItem>
|
|
59
|
+
<NavigationMenuTrigger>One Column</NavigationMenuTrigger>
|
|
60
|
+
<NavigationMenuContent layout={MenuContentLayout.oneColumn}>
|
|
61
|
+
<NavigationMenuContentItem title="Introduction" href="/">
|
|
62
|
+
Build high-quality, accessible design systems and web apps.
|
|
63
|
+
</NavigationMenuContentItem>
|
|
64
|
+
<NavigationMenuContentItem title="Getting started" href="/">
|
|
65
|
+
A quick tutorial to get you up and running with LW.
|
|
66
|
+
</NavigationMenuContentItem>
|
|
67
|
+
<NavigationMenuContentItem
|
|
68
|
+
title="Styling"
|
|
69
|
+
href="/primitives/docs/guides/styling"
|
|
70
|
+
>
|
|
71
|
+
Unstyled and compatible with any styling solution.
|
|
72
|
+
</NavigationMenuContentItem>
|
|
73
|
+
</NavigationMenuContent>
|
|
74
|
+
</NavigationMenuItem>
|
|
75
|
+
|
|
76
|
+
<NavigationMenuItem>
|
|
77
|
+
<NavigationMenuTrigger>Learn</NavigationMenuTrigger>
|
|
78
|
+
<NavigationMenuContent layout={MenuContentLayout.twoColumns}>
|
|
79
|
+
<NavigationMenuContentItem title="Introduction" href="/">
|
|
80
|
+
Build high-quality, accessible design systems and web apps.
|
|
81
|
+
</NavigationMenuContentItem>
|
|
82
|
+
<NavigationMenuContentItem title="Getting started" href="/">
|
|
83
|
+
A quick tutorial to get you up and running with LW.
|
|
84
|
+
</NavigationMenuContentItem>
|
|
85
|
+
<NavigationMenuContentItem title="Styling" href="/">
|
|
86
|
+
Unstyled and compatible with any styling solution.
|
|
87
|
+
</NavigationMenuContentItem>
|
|
88
|
+
<NavigationMenuContentItem title="Animation" href="/">
|
|
89
|
+
Use CSS keyframes or any animation library of your choice.
|
|
90
|
+
</NavigationMenuContentItem>
|
|
91
|
+
<NavigationMenuContentItem title="Accessibility" href="/">
|
|
92
|
+
Tested in a range of browsers and assistive technologies.
|
|
93
|
+
</NavigationMenuContentItem>
|
|
94
|
+
<NavigationMenuContentItem title="Releases" href="/">
|
|
95
|
+
Releases and their changelogs.
|
|
96
|
+
</NavigationMenuContentItem>
|
|
97
|
+
</NavigationMenuContent>
|
|
98
|
+
</NavigationMenuItem>
|
|
99
|
+
|
|
100
|
+
<NavigationMenuItem>
|
|
101
|
+
<NavigationMenuLink href="" active>
|
|
102
|
+
Link
|
|
103
|
+
</NavigationMenuLink>
|
|
104
|
+
</NavigationMenuItem>
|
|
105
|
+
</NavigationMenu>
|
|
106
|
+
<div style={{ zIndex: 100 }}>Z-index Test: 100</div>
|
|
107
|
+
</div>
|
|
108
|
+
);
|