@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,30 @@
|
|
|
1
|
+
import * as RadixLabel from '@radix-ui/react-label';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import textParser from '../../utils/parser';
|
|
5
|
+
import Button, { ButtonSizes, ButtonVariations } from '../Button/Button';
|
|
6
|
+
import { QuestionIcon } from '../Icon';
|
|
7
|
+
import { BODY_5_CSS } from '../Text/styles';
|
|
8
|
+
import InfoPopover from '../Popover/InfoPopover';
|
|
9
|
+
const StyledLabel = styled(RadixLabel.Root) `
|
|
10
|
+
${BODY_5_CSS}
|
|
11
|
+
width: fit-content;
|
|
12
|
+
|
|
13
|
+
${({ $bold, $inline, $marginBottom, theme }) => css `
|
|
14
|
+
${$bold && 'font-weight: bold;'}
|
|
15
|
+
display: ${$inline ? 'inline-flex' : 'block'};
|
|
16
|
+
margin-bottom: ${$marginBottom ?? theme.spacing.xxsmall};
|
|
17
|
+
gap: ${theme.spacing.xxxsmall};
|
|
18
|
+
align-items: center;
|
|
19
|
+
`}
|
|
20
|
+
`;
|
|
21
|
+
const InfoPopoverTrigger = styled(Button) `
|
|
22
|
+
color: ${({ theme }) => theme.color.surface.bold};
|
|
23
|
+
`;
|
|
24
|
+
const Label = ({ bold, className, children, inline, marginBottom, asChild, htmlFor, tooltipText, }) => {
|
|
25
|
+
return (React.createElement(StyledLabel, { "$bold": bold, "$inline": Boolean(inline || tooltipText), "$marginBottom": inline ? '0px' : marginBottom, className: className, asChild: asChild, htmlFor: htmlFor },
|
|
26
|
+
typeof children === 'string' ? textParser(children) : children,
|
|
27
|
+
tooltipText && (React.createElement(InfoPopover, { trigger: React.createElement(InfoPopoverTrigger, { variation: ButtonVariations.Icon, size: ButtonSizes.Small },
|
|
28
|
+
React.createElement(QuestionIcon, { label: "questionIcon" })), text: tooltipText }))));
|
|
29
|
+
};
|
|
30
|
+
export default Label;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LinkProps as RouterLinkProps } from 'react-router-dom';
|
|
3
|
+
import { LinkBaseProps } from '@a-little-world/little-world-design-system-core';
|
|
4
|
+
export type LinkProps = Omit<RouterLinkProps, 'to'> & LinkBaseProps;
|
|
5
|
+
declare const Link: React.ForwardRefExoticComponent<Omit<RouterLinkProps, "to"> & LinkBaseProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
6
|
+
export default Link;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { TextTypes, } from '@a-little-world/little-world-design-system-core';
|
|
3
|
+
import { Anchor, AnchorText, RouterLink } from './styles';
|
|
4
|
+
const Variants = {
|
|
5
|
+
href: Anchor,
|
|
6
|
+
to: RouterLink,
|
|
7
|
+
};
|
|
8
|
+
const Link = forwardRef(({ active, bold, buttonAppearance, buttonSize, children, className, href, onClick, state, style, target, to, textType, textDecoration = true, ...props }, ref) => {
|
|
9
|
+
const Component = Variants[href ? 'href' : 'to'];
|
|
10
|
+
return (React.createElement(Component, { ...(href ? { href } : { to }), className: className, ref: ref, "$active": active, onClick: onClick, "$buttonAppearance": buttonAppearance, "$size": buttonSize, state: state, style: style, target: target, "$textDecoration": textDecoration, ...props },
|
|
11
|
+
React.createElement(AnchorText, { as: "span", "$type": textType || TextTypes.Body5, "$bold": Boolean(bold), "$center": false }, children)));
|
|
12
|
+
});
|
|
13
|
+
export default Link;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ButtonAppearance, ButtonSizes } from '../Button/Button';
|
|
2
|
+
export declare const LINK_HOVER_CSS: import("styled-components").RuleSet<object>;
|
|
3
|
+
export declare const RouterLink: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react-router-dom").LinkProps & import("react").RefAttributes<HTMLAnchorElement>, {
|
|
4
|
+
$active?: boolean;
|
|
5
|
+
$color?: string;
|
|
6
|
+
$buttonAppearance?: ButtonAppearance;
|
|
7
|
+
$size?: keyof typeof ButtonSizes;
|
|
8
|
+
$textDecoration: boolean;
|
|
9
|
+
}>> & string & Omit<import("react").ForwardRefExoticComponent<import("react-router-dom").LinkProps & import("react").RefAttributes<HTMLAnchorElement>>, keyof import("react").Component<any, {}, any>>;
|
|
10
|
+
export declare const Anchor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, {
|
|
11
|
+
$active?: boolean;
|
|
12
|
+
$color?: string;
|
|
13
|
+
$buttonAppearance?: ButtonAppearance;
|
|
14
|
+
$size?: keyof typeof ButtonSizes;
|
|
15
|
+
$textDecoration: boolean;
|
|
16
|
+
}>> & string;
|
|
17
|
+
export declare const AnchorText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$color" | "$type" | "$bold" | "$center"> & {
|
|
18
|
+
$bold: boolean;
|
|
19
|
+
$center: boolean;
|
|
20
|
+
$color?: string;
|
|
21
|
+
$type: keyof typeof import("@a-little-world/little-world-design-system-core").TextTypes;
|
|
22
|
+
}, never>> & string;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Link } from 'react-router-dom';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { ButtonAppearance } from '../Button/Button';
|
|
4
|
+
import { PrimaryButtonCss, SecondaryButtonCss } from '../Button/styles';
|
|
5
|
+
import { StyledElement } from '../Text/styles';
|
|
6
|
+
export const LINK_HOVER_CSS = css `
|
|
7
|
+
transition: all 0.3s ease-in-out;
|
|
8
|
+
background: transparent;
|
|
9
|
+
|
|
10
|
+
// underline hover effect
|
|
11
|
+
&::before {
|
|
12
|
+
content: '';
|
|
13
|
+
background: currentColor;
|
|
14
|
+
display: block;
|
|
15
|
+
position: absolute;
|
|
16
|
+
bottom: -1px;
|
|
17
|
+
left: 0;
|
|
18
|
+
width: 0;
|
|
19
|
+
height: 1px;
|
|
20
|
+
transition: all 0.3s ease-in-out;
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
const LINK_CSS = css `
|
|
24
|
+
position: relative;
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
text-decoration: none;
|
|
27
|
+
border: none;
|
|
28
|
+
|
|
29
|
+
> span {
|
|
30
|
+
color: currentColor;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
${({ theme, $buttonAppearance, $color, $textDecoration }) => $buttonAppearance
|
|
34
|
+
? css `
|
|
35
|
+
${$buttonAppearance === ButtonAppearance.Primary
|
|
36
|
+
? PrimaryButtonCss
|
|
37
|
+
: SecondaryButtonCss}
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
`
|
|
42
|
+
: css `
|
|
43
|
+
color: ${$color || theme.color.text.link};
|
|
44
|
+
|
|
45
|
+
${$textDecoration && LINK_HOVER_CSS}
|
|
46
|
+
|
|
47
|
+
&:hover {
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
background-position: 0;
|
|
50
|
+
|
|
51
|
+
&::before {
|
|
52
|
+
width: 100%;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`}
|
|
56
|
+
`;
|
|
57
|
+
export const RouterLink = styled(Link) `
|
|
58
|
+
${LINK_CSS}
|
|
59
|
+
`;
|
|
60
|
+
export const Anchor = styled.a `
|
|
61
|
+
${LINK_CSS}
|
|
62
|
+
`;
|
|
63
|
+
export const AnchorText = styled(StyledElement) ``;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LoadingBaseProps, LoadingSizes, LoadingType } from '@a-little-world/little-world-design-system-core';
|
|
3
|
+
export { LoadingSizes, LoadingType };
|
|
4
|
+
export declare const LOADING_RING_ID = "loadingRing";
|
|
5
|
+
export declare const LOADING_LOGO_ID = "loadingLogo";
|
|
6
|
+
export interface LoadingProps extends LoadingBaseProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const Loading: React.FC<LoadingProps>;
|
|
10
|
+
export default Loading;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LoadingSizes, LoadingType, } from '@a-little-world/little-world-design-system-core';
|
|
3
|
+
import { LoadingContainer, LoadingElement, LogoContainer } from './styles';
|
|
4
|
+
import LoadingLogo from './LoadingLogo';
|
|
5
|
+
// Re-export enum for easy access
|
|
6
|
+
export { LoadingSizes, LoadingType };
|
|
7
|
+
export const LOADING_RING_ID = 'loadingRing';
|
|
8
|
+
export const LOADING_LOGO_ID = 'loadingLogo';
|
|
9
|
+
const Loading = ({ align, className, color, inline = false, size = LoadingSizes.Small, type = LoadingType.Ring, }) => {
|
|
10
|
+
if (type === LoadingType.Logo) {
|
|
11
|
+
return (React.createElement(LoadingContainer, { className: className, "$align": align, "$color": color, "$inline": inline, "$size": size, "$type": type, "data-testid": LOADING_LOGO_ID },
|
|
12
|
+
React.createElement(LogoContainer, { "$size": size },
|
|
13
|
+
React.createElement(LoadingLogo, { size: size }))));
|
|
14
|
+
}
|
|
15
|
+
return (React.createElement(LoadingContainer, { className: className, "$align": align, "$color": color, "$inline": inline, "$size": size, "$type": type, "data-testid": LOADING_RING_ID },
|
|
16
|
+
React.createElement(LoadingElement, { "$color": color, "$size": size }),
|
|
17
|
+
React.createElement(LoadingElement, { "$color": color, "$size": size }),
|
|
18
|
+
React.createElement(LoadingElement, { "$color": color, "$size": size }),
|
|
19
|
+
React.createElement(LoadingElement, { "$color": color, "$size": size })));
|
|
20
|
+
};
|
|
21
|
+
export default Loading;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LoadingSizes } from '@a-little-world/little-world-design-system-core';
|
|
3
|
+
export interface LoadingLogoProps {
|
|
4
|
+
size?: LoadingSizes;
|
|
5
|
+
label?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const LoadingLogo: React.FC<LoadingLogoProps>;
|
|
8
|
+
export default LoadingLogo;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LoadingDimensions, LoadingSizes, } from '@a-little-world/little-world-design-system-core';
|
|
3
|
+
const LoadingLogo = ({ size = LoadingSizes.Small, label = 'Loading logo', }) => {
|
|
4
|
+
const dimension = LoadingDimensions[size];
|
|
5
|
+
return (React.createElement("svg", { "aria-label": label, role: "img", fill: "none", focusable: false, width: dimension, height: dimension, xmlns: "http://www.w3.org/2000/svg", viewBox: "-0.01 0 100.38 66.86" },
|
|
6
|
+
React.createElement("defs", null,
|
|
7
|
+
React.createElement("linearGradient", { id: "loadingOrangeGradient", y1: "35.21", x2: "80", y2: "35.21", gradientUnits: "userSpaceOnUse" },
|
|
8
|
+
React.createElement("stop", { offset: "0", stopColor: "#d85509", stopOpacity: "0.25" },
|
|
9
|
+
React.createElement("animate", { attributeName: "stop-opacity", values: "0.25;1;0.25", dur: "2s", repeatCount: "indefinite" })),
|
|
10
|
+
React.createElement("stop", { offset: "0.14", stopColor: "#df6510", stopOpacity: "0.25" },
|
|
11
|
+
React.createElement("animate", { attributeName: "stop-opacity", values: "0.25;1;0.25", dur: "2s", begin: "0.2s", repeatCount: "indefinite" })),
|
|
12
|
+
React.createElement("stop", { offset: "0.49", stopColor: "#ed861f", stopOpacity: "0.25" },
|
|
13
|
+
React.createElement("animate", { attributeName: "stop-opacity", values: "0.25;1;0.25", dur: "2s", begin: "0.4s", repeatCount: "indefinite" })),
|
|
14
|
+
React.createElement("stop", { offset: "0.67", stopColor: "#f39325", stopOpacity: "0.25" },
|
|
15
|
+
React.createElement("animate", { attributeName: "stop-opacity", values: "0.25;1;0.25", dur: "2s", begin: "0.6s", repeatCount: "indefinite" }))),
|
|
16
|
+
React.createElement("linearGradient", { id: "loadingBlueGradient", x1: "20.41", y1: "31.58", x2: "100.41", y2: "31.58", gradientUnits: "userSpaceOnUse" },
|
|
17
|
+
React.createElement("stop", { offset: "0.18", stopColor: "#36a9e1", stopOpacity: "0.4" },
|
|
18
|
+
React.createElement("animate", { attributeName: "stop-opacity", values: "0.25;1;0.25", dur: "2s", repeatCount: "indefinite" })),
|
|
19
|
+
React.createElement("stop", { offset: "0.56", stopColor: "#1f8bcc", stopOpacity: "0.4" },
|
|
20
|
+
React.createElement("animate", { attributeName: "stop-opacity", values: "0.25;1;0.25", dur: "2s", begin: "0.2s", repeatCount: "indefinite" })),
|
|
21
|
+
React.createElement("stop", { offset: "1", stopColor: "#0063af", stopOpacity: "0.4" },
|
|
22
|
+
React.createElement("animate", { attributeName: "stop-opacity", values: "0.25;1;0.25", dur: "2s", begin: "0.4s", repeatCount: "indefinite" })))),
|
|
23
|
+
React.createElement("path", { fill: "url(#loadingBlueGradient)", d: "M66.69,8.56H50.2a24.68,24.68,0,0,1,9.39,1.85c-.33.32-.65.65-1,1a1.38,1.38,0,0,0-.29,1.72c.17.35.38.68.57,1a8.33,8.33,0,0,0,1.66,1.94A1.61,1.61,0,0,1,61,17.68c-.09.36.12.71-.08,1,0,.06,0,.22.1.33.4.82.74,1,1.65.75a7.1,7.1,0,0,1,2.47-.17,1.76,1.76,0,0,1,1.56,1.05c.1.23.17.46.27.68a1.28,1.28,0,0,0,1.43.9,3,3,0,0,0,2.08-1.09c.25-.31.49-.64.73-1a24.69,24.69,0,0,1,2.5,21,2.7,2.7,0,0,0-.93-.46,1.74,1.74,0,0,1-1-2.71c.06-.1.14-.19.2-.3A1.19,1.19,0,0,0,72,36.37a6.42,6.42,0,0,0-.38-.53,1.24,1.24,0,0,0-2-.17A5.79,5.79,0,0,1,67.35,37c-.93.27-1.87.54-2.81.78a3.77,3.77,0,0,0-1.5.74,1.6,1.6,0,0,1-1.28.44,14.53,14.53,0,0,0-2.09-.23,3.28,3.28,0,0,0-3.29,1.45,2.3,2.3,0,0,1-1.84,1.15l-.22,0a1.23,1.23,0,0,0-.94,1.09,2.67,2.67,0,0,0,1.34,2.8,9.66,9.66,0,0,1,2.51,2.12,4.25,4.25,0,0,1,1.15,1.69c.33,1.14.28,1.77-.62,2.29a10.91,10.91,0,0,0-1.54,1.91A3.1,3.1,0,0,0,56,55.63c.16.58.28,1.17.4,1.75a24.84,24.84,0,0,1-6.2.79H29.8a24.81,24.81,0,1,1,0-49.61h3.92a29.6,29.6,0,0,1,16.48-5H29.8A29.77,29.77,0,0,0,6.94,52.45L4.83,66.86,15,59.22A29.61,29.61,0,0,0,29.8,63.16H50.2A29.79,29.79,0,0,0,66.69,8.56Z" }),
|
|
24
|
+
React.createElement("path", { fill: "url(#loadingOrangeGradient)", d: "M91.65,12.29,93.45,0,84.26,6.89A29.57,29.57,0,0,0,70.61,3.57H50.2a29.79,29.79,0,0,0-16.48,54.6H50.2a24.79,24.79,0,0,1-23-34.09,2.36,2.36,0,0,0,.59.24,8,8,0,0,1,1,.33c0,.1,0,.13,0,.15a.87.87,0,0,0,.32,1.12,1.43,1.43,0,0,1,.31,2,3.33,3.33,0,0,1-.43.67,4.31,4.31,0,0,0-1,3.61,6.84,6.84,0,0,0,.34,1.42A2.43,2.43,0,0,0,29.59,35a2.32,2.32,0,0,0,2.1.06,3.41,3.41,0,0,1,.76-.26,1.15,1.15,0,0,1,1.41.62c.28.48.56,1,.83,1.46a20.21,20.21,0,0,0,2.55,3.91,2.13,2.13,0,0,1,.49,1.33,1.67,1.67,0,0,1-.56,1.14,13,13,0,0,0-1.77,2.23,1.35,1.35,0,0,0,0,1.58c.35.47.8.57,1.52.36A8.92,8.92,0,0,1,38,47.14a12.34,12.34,0,0,0,2.8-.82,3.68,3.68,0,0,0,2.33-2.56,9.66,9.66,0,0,0,.21-2.84c-.06-1-.09-2.09-.11-3.14a.81.81,0,0,1,.22-.52,7.71,7.71,0,0,1,1.26-1.1,6.71,6.71,0,0,0,1.38-1A1.51,1.51,0,0,0,46.61,34c0-.39,0-.78-.09-1.16-.07-.81-.16-1.61-.2-2.41a2.34,2.34,0,0,1,1.31-2.48,1,1,0,0,0,.61-1.12c-.15-1-.28-2-.49-3a14.88,14.88,0,0,1-.38-3,4.85,4.85,0,0,0-.07-.55h-.83c-.62,0-1.23,0-1.84,0-.4,0-.63-.35-.44-.63a3.46,3.46,0,0,0,.4-1.89,1,1,0,0,0-.81-1c-.61,0-1.22,0-1.83.05a8,8,0,0,1-1.09.08,1.47,1.47,0,0,1-.79-.3,6.3,6.3,0,0,1-1.86-2.58,13.63,13.63,0,0,1-.53-1.82s0-.05,0-.09A24.64,24.64,0,0,1,50.2,8.56H70.61a24.81,24.81,0,0,1,0,49.61H66.69a29.61,29.61,0,0,1-16.49,5H70.61a29.78,29.78,0,0,0,21-50.87Z" })));
|
|
25
|
+
};
|
|
26
|
+
export default LoadingLogo;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LoadingSizes, LoadingType } from '@a-little-world/little-world-design-system-core';
|
|
2
|
+
export declare const LoadingContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
3
|
+
$align?: string;
|
|
4
|
+
$color?: string;
|
|
5
|
+
$inline?: boolean;
|
|
6
|
+
$size?: LoadingSizes;
|
|
7
|
+
$type?: LoadingType;
|
|
8
|
+
}>> & string;
|
|
9
|
+
export declare const LoadingElement: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
10
|
+
$color?: string;
|
|
11
|
+
$size?: LoadingSizes;
|
|
12
|
+
}>> & string;
|
|
13
|
+
export declare const LogoContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
14
|
+
$size?: LoadingSizes;
|
|
15
|
+
}>> & string;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import styled, { keyframes } from 'styled-components';
|
|
2
|
+
import { LoadingDimensions, LoadingSizes, } from '@a-little-world/little-world-design-system-core';
|
|
3
|
+
import { pixelate } from '../../utils/styles';
|
|
4
|
+
const loading = keyframes `
|
|
5
|
+
0% {
|
|
6
|
+
transform: rotate(0deg);
|
|
7
|
+
}
|
|
8
|
+
100% {
|
|
9
|
+
transform: rotate(360deg);
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
const logoPulse = keyframes `
|
|
13
|
+
0%, 100% {
|
|
14
|
+
transform: scale(1);
|
|
15
|
+
}
|
|
16
|
+
50% {
|
|
17
|
+
transform: scale(1.03);
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
export const LoadingContainer = styled.div `
|
|
21
|
+
display: ${({ $inline }) => ($inline ? 'inline-flex' : 'flex')};
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: ${({ $align }) => $align || 'center'};
|
|
24
|
+
position: relative;
|
|
25
|
+
width: ${({ $inline, $size }) => $inline
|
|
26
|
+
? pixelate(LoadingDimensions[$size || LoadingSizes.Small])
|
|
27
|
+
: '100%'};
|
|
28
|
+
height: 100%;
|
|
29
|
+
min-height: ${({ $size }) => pixelate(LoadingDimensions[$size || LoadingSizes.Small])};
|
|
30
|
+
`;
|
|
31
|
+
export const LoadingElement = styled.div `
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
display: block;
|
|
34
|
+
position: absolute;
|
|
35
|
+
width: ${({ $size }) => pixelate(LoadingDimensions[$size || LoadingSizes.Small])};
|
|
36
|
+
height: ${({ $size }) => pixelate(LoadingDimensions[$size || LoadingSizes.Small])};
|
|
37
|
+
border: 2px solid ${({ $color }) => $color || 'currentColor'};
|
|
38
|
+
border-width: ${({ $size }) => ($size === LoadingSizes.Large ? '4px' : '2px')};
|
|
39
|
+
border-radius: 50%;
|
|
40
|
+
animation: ${loading} 1.4s cubic-bezier(0.5, 0, 0.5, 1) infinite;
|
|
41
|
+
border-color: ${({ $color }) => $color || 'currentColor'} transparent
|
|
42
|
+
transparent transparent;
|
|
43
|
+
|
|
44
|
+
&:nth-child(1) {
|
|
45
|
+
animation-delay: -0.45s;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&:nth-child(2) {
|
|
49
|
+
animation-delay: -0.3s;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&:nth-child(3) {
|
|
53
|
+
animation-delay: -0.15s;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
export const LogoContainer = styled.div `
|
|
58
|
+
position: relative;
|
|
59
|
+
width: ${({ $size }) => pixelate(LoadingDimensions[$size || LoadingSizes.Small])};
|
|
60
|
+
height: ${({ $size }) => pixelate(LoadingDimensions[$size || LoadingSizes.Small])};
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
animation: ${logoPulse} 3s ease-in-out infinite;
|
|
65
|
+
|
|
66
|
+
svg {
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
transform-origin: center center;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const BACKDROP_LABEL = "dialog backdrop";
|
|
3
|
+
type BaseModalProps = {
|
|
4
|
+
children: any;
|
|
5
|
+
className?: string;
|
|
6
|
+
createInPortal?: boolean;
|
|
7
|
+
open: boolean;
|
|
8
|
+
parent?: any;
|
|
9
|
+
};
|
|
10
|
+
type UnlockedModalProps = BaseModalProps & {
|
|
11
|
+
locked?: false;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
};
|
|
14
|
+
type LockedModalProps = BaseModalProps & {
|
|
15
|
+
locked: true;
|
|
16
|
+
onClose?: () => void;
|
|
17
|
+
};
|
|
18
|
+
type ModalProps = UnlockedModalProps | LockedModalProps;
|
|
19
|
+
declare const Modal: ({ children, createInPortal, open, onClose, locked, parent, className, }: ModalProps) => React.JSX.Element | null;
|
|
20
|
+
export default Modal;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import { ButtonVariations } from '../Button/Button';
|
|
4
|
+
import { CloseIcon } from '../Icon';
|
|
5
|
+
import { BackdropContainer, CloseButton } from './styles';
|
|
6
|
+
export const BACKDROP_LABEL = 'dialog backdrop';
|
|
7
|
+
const ROOT_LABEL = '#root';
|
|
8
|
+
const CLOSE_BUTTON_LABEL = 'dialog close button';
|
|
9
|
+
const Modal = ({ children, createInPortal = true, open, onClose, locked, parent, className, }) => {
|
|
10
|
+
const [active, setActive] = useState(false);
|
|
11
|
+
const backdrop = useRef(null);
|
|
12
|
+
const el = useMemo(() => document.createElement('div'), []);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const target = parent?.appendChild ? parent : document.body;
|
|
15
|
+
target.appendChild(el);
|
|
16
|
+
return () => {
|
|
17
|
+
target.removeChild(el);
|
|
18
|
+
};
|
|
19
|
+
}, [el, parent, className]);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const { current } = backdrop;
|
|
22
|
+
const transitionEnd = () => setActive(open);
|
|
23
|
+
const keyHandler = (e) => !locked && e.key === 'Escape' && onClose();
|
|
24
|
+
const clickHandler = (e) => !locked && e.target === current && onClose();
|
|
25
|
+
let openTimeout;
|
|
26
|
+
if (current) {
|
|
27
|
+
current.addEventListener('transitionend', transitionEnd);
|
|
28
|
+
current.addEventListener('click', clickHandler);
|
|
29
|
+
window.addEventListener('keyup', keyHandler);
|
|
30
|
+
}
|
|
31
|
+
if (open) {
|
|
32
|
+
openTimeout = window.setTimeout(() => {
|
|
33
|
+
(document?.activeElement).blur();
|
|
34
|
+
setActive(open);
|
|
35
|
+
document.body.style.overflow = 'hidden';
|
|
36
|
+
document.querySelector(ROOT_LABEL)?.setAttribute('inert', 'true');
|
|
37
|
+
current?.focus();
|
|
38
|
+
}, 10);
|
|
39
|
+
}
|
|
40
|
+
return () => {
|
|
41
|
+
if (current) {
|
|
42
|
+
current.removeEventListener('transitionend', transitionEnd);
|
|
43
|
+
current.removeEventListener('click', clickHandler);
|
|
44
|
+
}
|
|
45
|
+
clearTimeout(openTimeout);
|
|
46
|
+
document.querySelector(ROOT_LABEL)?.removeAttribute('inert');
|
|
47
|
+
document.body.style.overflow = 'unset';
|
|
48
|
+
window.removeEventListener('keyup', keyHandler);
|
|
49
|
+
};
|
|
50
|
+
}, [open, locked, onClose]);
|
|
51
|
+
const Backdrop = (React.createElement(BackdropContainer, { "aria-modal": true, "aria-label": BACKDROP_LABEL, ref: backdrop, "$active": active && open },
|
|
52
|
+
!locked && (React.createElement(CloseButton, { variation: ButtonVariations.Icon, onClick: onClose },
|
|
53
|
+
React.createElement(CloseIcon, { label: CLOSE_BUTTON_LABEL, height: "24", width: "24" }))),
|
|
54
|
+
children));
|
|
55
|
+
if (open)
|
|
56
|
+
return createInPortal ? createPortal(Backdrop, el) : Backdrop;
|
|
57
|
+
return null;
|
|
58
|
+
};
|
|
59
|
+
export default Modal;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const BackdropContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>, {
|
|
2
|
+
$active: boolean;
|
|
3
|
+
}>> & string;
|
|
4
|
+
export declare const CloseButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("../Button/Button").ButtonProps, never>> & string & Omit<import("react").FC<import("../Button/Button").ButtonProps>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import Button from '../Button/Button';
|
|
3
|
+
export const BackdropContainer = styled.dialog `
|
|
4
|
+
position: fixed;
|
|
5
|
+
top: 0;
|
|
6
|
+
right: 0;
|
|
7
|
+
bottom: 0;
|
|
8
|
+
left: 0;
|
|
9
|
+
width: unset;
|
|
10
|
+
height: unset;
|
|
11
|
+
margin: 0;
|
|
12
|
+
padding: ${({ theme }) => theme.spacing.small};
|
|
13
|
+
border: none;
|
|
14
|
+
background-color: rgba(51, 51, 51, 0.3);
|
|
15
|
+
backdrop-filter: blur(8px);
|
|
16
|
+
opacity: 0;
|
|
17
|
+
transition: all 100ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
18
|
+
transition-delay: 200ms;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
z-index: 1000;
|
|
23
|
+
overflow: auto;
|
|
24
|
+
overscroll-behavior: contain;
|
|
25
|
+
|
|
26
|
+
> div {
|
|
27
|
+
transform: translateY(100px);
|
|
28
|
+
transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
29
|
+
opacity: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
${({ $active }) => $active &&
|
|
33
|
+
css `
|
|
34
|
+
transition-duration: 250ms;
|
|
35
|
+
transition-delay: 0ms;
|
|
36
|
+
opacity: 1;
|
|
37
|
+
|
|
38
|
+
> div {
|
|
39
|
+
transform: translateY(0);
|
|
40
|
+
opacity: 1;
|
|
41
|
+
transition-delay: 150ms;
|
|
42
|
+
transition-duration: 350ms;
|
|
43
|
+
}
|
|
44
|
+
`}
|
|
45
|
+
|
|
46
|
+
@media (min-width: ${({ theme }) => theme.breakpoints.medium}) {
|
|
47
|
+
padding: ${({ theme }) => theme.spacing.large};
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
export const CloseButton = styled(Button) `
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: ${({ theme }) => theme.spacing.xsmall};
|
|
53
|
+
right: ${({ theme }) => theme.spacing.xsmall};
|
|
54
|
+
z-index: 2;
|
|
55
|
+
padding: 7px;
|
|
56
|
+
background: ${({ theme }) => theme.color.surface.secondary};
|
|
57
|
+
border-radius: ${({ theme }) => theme.radius.full};
|
|
58
|
+
|
|
59
|
+
@media (min-width: ${({ theme }) => theme.breakpoints.medium}) {
|
|
60
|
+
top: ${({ theme }) => theme.spacing.medium};
|
|
61
|
+
right: ${({ theme }) => theme.spacing.medium};
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type MultiCheckboxProps = {
|
|
3
|
+
heading?: string;
|
|
4
|
+
options: {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}[];
|
|
8
|
+
onSelection: (selected: string[]) => void;
|
|
9
|
+
preSelected?: string[];
|
|
10
|
+
error?: string;
|
|
11
|
+
name: string;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const MultiCheckbox: React.FC<MultiCheckboxProps>;
|
|
15
|
+
export default MultiCheckbox;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useTheme } from 'styled-components';
|
|
3
|
+
import { CheckboxButton } from '../Checkbox/Checkbox';
|
|
4
|
+
import InputError from '../InputError/InputError';
|
|
5
|
+
import Label from '../Label/Label';
|
|
6
|
+
import { MultiCheckboxWrapper } from './styles';
|
|
7
|
+
const MultiCheckbox = ({ error, heading, preSelected, onSelection, options, name, readOnly, }) => {
|
|
8
|
+
const theme = useTheme();
|
|
9
|
+
const [selected, setSelected] = useState(preSelected || []);
|
|
10
|
+
const onSelect = ({ state, value, }) => {
|
|
11
|
+
const oldValues = selected || [];
|
|
12
|
+
const newValues = state
|
|
13
|
+
? [...oldValues, value]
|
|
14
|
+
: oldValues.filter(el => el !== value);
|
|
15
|
+
setSelected(newValues);
|
|
16
|
+
onSelection(newValues);
|
|
17
|
+
};
|
|
18
|
+
return (React.createElement("div", null,
|
|
19
|
+
heading && React.createElement(Label, { bold: true }, heading),
|
|
20
|
+
React.createElement(MultiCheckboxWrapper, null, options.map(({ value, label }) => (React.createElement(CheckboxButton, { key: label, error: error, label: label, name: name, checked: selected.includes(value), onCheckedChange: state => onSelect({ value, state }), color: theme.color.surface.selected, value: value, readOnly: readOnly })))),
|
|
21
|
+
React.createElement(InputError, { visible: Boolean(error), textAlign: "left" }, error)));
|
|
22
|
+
};
|
|
23
|
+
export default MultiCheckbox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MultiCheckboxWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export const MultiCheckboxWrapper = styled.div `
|
|
3
|
+
width: 100%;
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
gap: ${({ theme }) => theme.spacing.xxsmall};
|
|
8
|
+
margin-bottom: ${({ theme }) => theme.spacing.xxsmall};
|
|
9
|
+
`;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DropdownProps } from '../Dropdown/Dropdown';
|
|
3
|
+
interface DropdownInstanceProps extends Omit<DropdownProps, 'onValueChange'> {
|
|
4
|
+
lockedValue?: string;
|
|
5
|
+
dataField: string;
|
|
6
|
+
values: string[];
|
|
7
|
+
ariaLabel: string;
|
|
8
|
+
errors: string[];
|
|
9
|
+
}
|
|
10
|
+
type Props = {
|
|
11
|
+
addMoreLabel: string;
|
|
12
|
+
error?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
labelTooltip?: string;
|
|
15
|
+
locked?: boolean;
|
|
16
|
+
defaultSegments?: number;
|
|
17
|
+
maxSegments?: number;
|
|
18
|
+
onValueChange: (value: {
|
|
19
|
+
[x: string]: string;
|
|
20
|
+
}[]) => void;
|
|
21
|
+
firstDropdown: DropdownInstanceProps;
|
|
22
|
+
secondDropdown: DropdownInstanceProps;
|
|
23
|
+
restrictions?: {
|
|
24
|
+
[key: string]: string[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
declare const MultiDropdown: React.FC<Props>;
|
|
28
|
+
export default MultiDropdown;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { isEmpty } from 'lodash';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import Button, { ButtonSizes, ButtonVariations } from '../Button/Button';
|
|
4
|
+
import Dropdown from '../Dropdown/Dropdown';
|
|
5
|
+
import { PlusIcon, TrashIcon } from '../Icon';
|
|
6
|
+
import Label from '../Label/Label';
|
|
7
|
+
import Text from '../Text/Text';
|
|
8
|
+
import { AddMore, AddMoreButton, DeleteButton, MultiDropdownWrapper, Segment, } from './styles';
|
|
9
|
+
import { useTheme } from 'styled-components';
|
|
10
|
+
const DELETE_SEGMENT = 'delete segment';
|
|
11
|
+
const formatValues = (values, firstDataField, secondDataField) => values[0].reduce((newValues, firstVal, index) => {
|
|
12
|
+
// only push the value if both values exist
|
|
13
|
+
if (firstVal && values[1][index]) {
|
|
14
|
+
newValues.push({
|
|
15
|
+
[firstDataField]: firstVal,
|
|
16
|
+
[secondDataField]: values[1][index],
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return newValues;
|
|
20
|
+
}, []);
|
|
21
|
+
const setDropdownValues = (firstDropdown, secondDropdown) => {
|
|
22
|
+
const first = (firstDropdown.lockedValue
|
|
23
|
+
? [firstDropdown.lockedValue, ...(firstDropdown.values.slice(1) || [])]
|
|
24
|
+
: firstDropdown.values) || [];
|
|
25
|
+
const second = (secondDropdown.lockedValue
|
|
26
|
+
? [secondDropdown.lockedValue, ...(secondDropdown.values.slice(1) || [])]
|
|
27
|
+
: secondDropdown.values) || [];
|
|
28
|
+
return [first, second];
|
|
29
|
+
};
|
|
30
|
+
const MultiDropdown = ({ addMoreLabel = 'Add more rows', label, labelTooltip, locked, firstDropdown, secondDropdown, onValueChange, defaultSegments = 1, maxSegments = 4, restrictions, }) => {
|
|
31
|
+
const [segments, setSegments] = useState(Math.max(firstDropdown?.values?.length ?? 0, secondDropdown?.values?.length ?? 0, defaultSegments));
|
|
32
|
+
const [values, setValues] = useState(setDropdownValues(firstDropdown, secondDropdown));
|
|
33
|
+
const theme = useTheme();
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
setValues(setDropdownValues(firstDropdown, secondDropdown));
|
|
36
|
+
setSegments(Math.max(firstDropdown?.values?.length ?? 0, secondDropdown?.values?.length ?? 0, defaultSegments));
|
|
37
|
+
}, [firstDropdown?.values, secondDropdown?.values]);
|
|
38
|
+
const handleValueChange = (value, position, index) => {
|
|
39
|
+
setValues(values => {
|
|
40
|
+
const newValues = [...values];
|
|
41
|
+
newValues[position][index] = value;
|
|
42
|
+
if (values[position || 0])
|
|
43
|
+
onValueChange(formatValues(newValues, firstDropdown.dataField, secondDropdown.dataField));
|
|
44
|
+
return newValues;
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const handleDelete = (index) => {
|
|
48
|
+
setValues(values => {
|
|
49
|
+
const newValues = [...values];
|
|
50
|
+
(newValues[0].splice(index, 1),
|
|
51
|
+
newValues[1].splice(index, 1),
|
|
52
|
+
onValueChange(formatValues(newValues, firstDropdown.dataField, secondDropdown.dataField)));
|
|
53
|
+
return newValues;
|
|
54
|
+
});
|
|
55
|
+
setSegments(currentNumber => currentNumber - 1);
|
|
56
|
+
};
|
|
57
|
+
return (React.createElement(MultiDropdownWrapper, null,
|
|
58
|
+
label && (React.createElement(Label, { bold: true, htmlFor: firstDropdown.label, marginBottom: theme.spacing.xsmall, tooltipText: labelTooltip }, label)),
|
|
59
|
+
Array(segments)
|
|
60
|
+
.fill('')
|
|
61
|
+
.map((_, index) => {
|
|
62
|
+
const isFirstSegment = index === 0;
|
|
63
|
+
const firstSegmentLockedVal1 = isFirstSegment
|
|
64
|
+
? firstDropdown.lockedValue
|
|
65
|
+
: undefined;
|
|
66
|
+
const firstSegmentLockedVal2 = isFirstSegment
|
|
67
|
+
? secondDropdown.lockedValue
|
|
68
|
+
: undefined;
|
|
69
|
+
const deletable = !!index && !locked;
|
|
70
|
+
return (React.createElement(Segment, { "$locked": locked, key: `MultiDropdown Segment ${index}${values[0][index]}${values[1][index]}` },
|
|
71
|
+
React.createElement(Dropdown, { ariaLabel: firstDropdown.ariaLabel + index, placeholder: firstDropdown.placeholder, onValueChange: val => handleValueChange(val, 0, index), options: firstDropdown.options, value: values[0][index], lockedValue: firstSegmentLockedVal1 ||
|
|
72
|
+
(locked ? values[0][index] : undefined), required: Boolean(values[1][index]), error: firstDropdown.errors?.[index] }),
|
|
73
|
+
React.createElement(Dropdown, { ariaLabel: secondDropdown.ariaLabel + index, placeholder: secondDropdown.placeholder, onValueChange: val => handleValueChange(val, 1, index), options: isEmpty(restrictions?.[values[0][index]])
|
|
74
|
+
? secondDropdown.options
|
|
75
|
+
: secondDropdown.options.filter(option => restrictions?.[values[0][index]]?.includes(option.value)), value: values[1][index], lockedValue: firstSegmentLockedVal2 ||
|
|
76
|
+
(locked ? values[1][index] : undefined), required: Boolean(values[0][index]), error: secondDropdown.errors?.[index] }),
|
|
77
|
+
deletable && (React.createElement(DeleteButton, { variation: ButtonVariations.Icon, onClick: () => handleDelete(index), size: ButtonSizes.Small },
|
|
78
|
+
React.createElement(TrashIcon, { label: DELETE_SEGMENT, color: "orange" })))));
|
|
79
|
+
}),
|
|
80
|
+
!locked && (React.createElement(AddMore, null,
|
|
81
|
+
React.createElement(AddMoreButton, { variation: ButtonVariations.Icon, disabled: segments === maxSegments, onClick: () => setSegments(currentNumber => currentNumber + 1), size: ButtonSizes.Small },
|
|
82
|
+
React.createElement(PlusIcon, { label: "add more dropdowns", width: 10 })),
|
|
83
|
+
React.createElement(Button, { variation: ButtonVariations.Inline, disabled: segments === maxSegments, onClick: () => setSegments(currentNumber => currentNumber + 1) },
|
|
84
|
+
React.createElement(Text, null, addMoreLabel))))));
|
|
85
|
+
};
|
|
86
|
+
export default MultiDropdown;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const MultiDropdownWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
|
+
export declare const AddMore: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export declare const AddMoreButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("../Button/Button").ButtonProps, never>> & string & Omit<import("react").FC<import("../Button/Button").ButtonProps>, keyof import("react").Component<any, {}, any>>;
|
|
4
|
+
export declare const Segment: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {
|
|
5
|
+
$locked?: boolean;
|
|
6
|
+
}>> & string;
|
|
7
|
+
export declare const DeleteButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("../Button/Button").ButtonProps, never>> & string & Omit<import("react").FC<import("../Button/Button").ButtonProps>, keyof import("react").Component<any, {}, any>>;
|