@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,112 @@
|
|
|
1
|
+
import { CheckboxProps as RadixCheckboxProps } from '@radix-ui/react-checkbox';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { CheckIcon } from '../Icon';
|
|
5
|
+
import InputError from '../InputError/InputError';
|
|
6
|
+
import {
|
|
7
|
+
CheckboxButtonContainer,
|
|
8
|
+
CheckboxContainer,
|
|
9
|
+
CheckboxIndicator,
|
|
10
|
+
CheckboxRoot,
|
|
11
|
+
CheckboxWrapper,
|
|
12
|
+
NonInteractiveCheckbox,
|
|
13
|
+
StyledLabel,
|
|
14
|
+
} from './styles';
|
|
15
|
+
|
|
16
|
+
type CheckboxProps = {
|
|
17
|
+
className?: string;
|
|
18
|
+
color?: string;
|
|
19
|
+
error?: string;
|
|
20
|
+
id?: string;
|
|
21
|
+
inputRef?: React.RefObject<HTMLButtonElement>;
|
|
22
|
+
label?: string;
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
} & RadixCheckboxProps;
|
|
26
|
+
|
|
27
|
+
export const CheckboxButton: React.FC<CheckboxProps> = ({
|
|
28
|
+
checked,
|
|
29
|
+
className,
|
|
30
|
+
color,
|
|
31
|
+
error,
|
|
32
|
+
id,
|
|
33
|
+
inputRef,
|
|
34
|
+
label,
|
|
35
|
+
onCheckedChange,
|
|
36
|
+
value,
|
|
37
|
+
...rest
|
|
38
|
+
}) => (
|
|
39
|
+
<CheckboxButtonContainer
|
|
40
|
+
className={className}
|
|
41
|
+
ref={inputRef}
|
|
42
|
+
id={id}
|
|
43
|
+
checked={checked}
|
|
44
|
+
onCheckedChange={onCheckedChange}
|
|
45
|
+
value={value}
|
|
46
|
+
$hasError={Boolean(error)}
|
|
47
|
+
{...rest}
|
|
48
|
+
>
|
|
49
|
+
<NonInteractiveCheckbox $color={color} checked={checked}>
|
|
50
|
+
{checked && <CheckIcon label="check icon" width={10} />}
|
|
51
|
+
</NonInteractiveCheckbox>
|
|
52
|
+
{label && (
|
|
53
|
+
<StyledLabel htmlFor={id} inline>
|
|
54
|
+
{label}
|
|
55
|
+
</StyledLabel>
|
|
56
|
+
)}
|
|
57
|
+
</CheckboxButtonContainer>
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const Checkbox: React.FC<CheckboxProps> = ({
|
|
61
|
+
checked,
|
|
62
|
+
className,
|
|
63
|
+
color,
|
|
64
|
+
error,
|
|
65
|
+
required = true,
|
|
66
|
+
id,
|
|
67
|
+
inputRef,
|
|
68
|
+
label,
|
|
69
|
+
onCheckedChange,
|
|
70
|
+
readOnly,
|
|
71
|
+
value,
|
|
72
|
+
...rest
|
|
73
|
+
}) => {
|
|
74
|
+
return (
|
|
75
|
+
<CheckboxWrapper className={className}>
|
|
76
|
+
<CheckboxContainer>
|
|
77
|
+
{readOnly ? (
|
|
78
|
+
<NonInteractiveCheckbox $color={color} checked={checked}>
|
|
79
|
+
{checked && <CheckIcon label="check icon" width={10} />}
|
|
80
|
+
</NonInteractiveCheckbox>
|
|
81
|
+
) : (
|
|
82
|
+
<CheckboxRoot
|
|
83
|
+
ref={inputRef}
|
|
84
|
+
id={id}
|
|
85
|
+
checked={checked}
|
|
86
|
+
onCheckedChange={onCheckedChange}
|
|
87
|
+
value={value}
|
|
88
|
+
$hasError={Boolean(error)}
|
|
89
|
+
$color={color}
|
|
90
|
+
{...rest}
|
|
91
|
+
>
|
|
92
|
+
<CheckboxIndicator>
|
|
93
|
+
<CheckIcon label="check icon" width={10} />
|
|
94
|
+
</CheckboxIndicator>
|
|
95
|
+
</CheckboxRoot>
|
|
96
|
+
)}
|
|
97
|
+
{label && (
|
|
98
|
+
<StyledLabel htmlFor={id} inline>
|
|
99
|
+
{label}
|
|
100
|
+
</StyledLabel>
|
|
101
|
+
)}
|
|
102
|
+
</CheckboxContainer>
|
|
103
|
+
{required && (
|
|
104
|
+
<InputError visible={Boolean(error)} textAlign="left">
|
|
105
|
+
{error}
|
|
106
|
+
</InputError>
|
|
107
|
+
)}
|
|
108
|
+
</CheckboxWrapper>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export default Checkbox;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as Checkbox from '@radix-ui/react-checkbox';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import Label from '../Label/Label';
|
|
5
|
+
|
|
6
|
+
const ITEM_WIDTH = '16px';
|
|
7
|
+
|
|
8
|
+
export const CheckboxWrapper = styled.div``;
|
|
9
|
+
|
|
10
|
+
export const CheckboxButtonContainer = styled(Checkbox.Root)<{
|
|
11
|
+
$hasError?: boolean;
|
|
12
|
+
}>`
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
padding: ${({ theme }) => theme.spacing.xxsmall};
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
border: 1px solid
|
|
18
|
+
${({ theme, checked, $hasError }) =>
|
|
19
|
+
checked
|
|
20
|
+
? $hasError
|
|
21
|
+
? theme.color.border.error
|
|
22
|
+
: theme.color.border.selected
|
|
23
|
+
: theme.color.border.subtle};
|
|
24
|
+
border-radius: ${({ theme }) => theme.radius.xxsmall};
|
|
25
|
+
background: ${({ checked, $hasError, theme }) =>
|
|
26
|
+
checked
|
|
27
|
+
? $hasError
|
|
28
|
+
? theme.color.surface.error
|
|
29
|
+
: theme.color.surface.accent
|
|
30
|
+
: theme.color.surface.secondary};
|
|
31
|
+
|
|
32
|
+
label {
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
export const CheckboxContainer = styled.div`
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
margin: ${({ theme }) => theme.spacing.xxxxsmall} 0;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
const CHECKBOX_STYLES = css<{
|
|
45
|
+
$hasError?: boolean;
|
|
46
|
+
$color?: string;
|
|
47
|
+
checked: Checkbox.CheckboxProps['checked'];
|
|
48
|
+
}>`
|
|
49
|
+
all: unset;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
background: ${({ theme }) => theme.color.surface.primary};
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
border: 1px solid ${({ theme }) => theme.color.border.contrast};
|
|
54
|
+
color: ${({ theme }) => theme.color.text.primary};
|
|
55
|
+
width: ${ITEM_WIDTH};
|
|
56
|
+
height: ${ITEM_WIDTH};
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
border-color: ${({ $hasError, theme }) =>
|
|
61
|
+
$hasError ? theme.color.border.error : theme.color.border.contrast};
|
|
62
|
+
|
|
63
|
+
${({ $color, checked, theme }) =>
|
|
64
|
+
$color &&
|
|
65
|
+
checked &&
|
|
66
|
+
css`
|
|
67
|
+
background: ${$color};
|
|
68
|
+
border-color: ${$color};
|
|
69
|
+
color: ${theme.color.text.reversed};
|
|
70
|
+
`}
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
export const CheckboxRoot = styled(Checkbox.Root)<{
|
|
74
|
+
$hasError?: boolean;
|
|
75
|
+
$color?: string;
|
|
76
|
+
checked: Checkbox.CheckboxProps['checked'];
|
|
77
|
+
}>`
|
|
78
|
+
${CHECKBOX_STYLES}
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
export const NonInteractiveCheckbox = styled.div<{
|
|
82
|
+
$color?: string;
|
|
83
|
+
checked: Checkbox.CheckboxProps['checked'];
|
|
84
|
+
}>`
|
|
85
|
+
${CHECKBOX_STYLES}
|
|
86
|
+
`;
|
|
87
|
+
|
|
88
|
+
export const CheckboxIndicator = styled(Checkbox.Indicator)`
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
justify-content: center;
|
|
92
|
+
`;
|
|
93
|
+
|
|
94
|
+
export const StyledLabel = styled(Label)`
|
|
95
|
+
margin-left: ${({ theme }) => theme.spacing.xxsmall};
|
|
96
|
+
`;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import CheckboxGrid from './CheckboxGrid';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
component: CheckboxGrid,
|
|
7
|
+
title: 'Components/CheckboxGrid',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Default = args => <CheckboxGrid {...args} />;
|
|
11
|
+
|
|
12
|
+
const columnHeadingsDummy = [
|
|
13
|
+
'Uhrzeit',
|
|
14
|
+
'Monday',
|
|
15
|
+
'Teusday',
|
|
16
|
+
'Wednesday',
|
|
17
|
+
'Thursday',
|
|
18
|
+
'Friday',
|
|
19
|
+
'Saturday',
|
|
20
|
+
'Sunday',
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const rowHeadingsDummy = [
|
|
24
|
+
'8 bis 10 Uhr',
|
|
25
|
+
'10 bis 12 Uhr',
|
|
26
|
+
'12 bis 14 Uhr',
|
|
27
|
+
'14 bis 16 Uhr',
|
|
28
|
+
'16 bis 18 Uhr',
|
|
29
|
+
'18 bis 20 Uhr',
|
|
30
|
+
'20 bis 22 Uhr',
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const checkboxesByColumn = JSON.parse(
|
|
34
|
+
'[[{"name":"8 to 10 a.m.","value":"08_10","key":"mo"},{"name":"10 to 12 p.m.","value":"10_12","key":"mo"},{"name":"12 to 2 p.m.","value":"12_14","key":"mo"},{"name":"2 to 4 p.m.","value":"14_16","key":"mo"},{"name":"4 to 6 p.m.","value":"16_18","key":"mo"},{"name":"6 to 8 p.m.","value":"18_20","key":"mo"},{"name":"8 to 10 p.m.","value":"20_22","key":"mo"}],[{"name":"8 to 10 a.m.","value":"08_10","key":"tu"},{"name":"10 to 12 p.m.","value":"10_12","key":"tu"},{"name":"12 to 2 p.m.","value":"12_14","key":"tu"},{"name":"2 to 4 p.m.","value":"14_16","key":"tu"},{"name":"4 to 6 p.m.","value":"16_18","key":"tu"},{"name":"6 to 8 p.m.","value":"18_20","key":"tu"},{"name":"8 to 10 p.m.","value":"20_22","key":"tu"}],[{"name":"8 to 10 a.m.","value":"08_10","key":"we"},{"name":"10 to 12 p.m.","value":"10_12","key":"we"},{"name":"12 to 2 p.m.","value":"12_14","key":"we"},{"name":"2 to 4 p.m.","value":"14_16","key":"we"},{"name":"4 to 6 p.m.","value":"16_18","key":"we"},{"name":"6 to 8 p.m.","value":"18_20","key":"we"},{"name":"8 to 10 p.m.","value":"20_22","key":"we"}],[{"name":"8 to 10 a.m.","value":"08_10","key":"th"},{"name":"10 to 12 p.m.","value":"10_12","key":"th"},{"name":"12 to 2 p.m.","value":"12_14","key":"th"},{"name":"2 to 4 p.m.","value":"14_16","key":"th"},{"name":"4 to 6 p.m.","value":"16_18","key":"th"},{"name":"6 to 8 p.m.","value":"18_20","key":"th"},{"name":"8 to 10 p.m.","value":"20_22","key":"th"}],[{"name":"8 to 10 a.m.","value":"08_10","key":"fr"},{"name":"10 to 12 p.m.","value":"10_12","key":"fr"},{"name":"12 to 2 p.m.","value":"12_14","key":"fr"},{"name":"2 to 4 p.m.","value":"14_16","key":"fr"},{"name":"4 to 6 p.m.","value":"16_18","key":"fr"},{"name":"6 to 8 p.m.","value":"18_20","key":"fr"},{"name":"8 to 10 p.m.","value":"20_22","key":"fr"}],[{"name":"8 to 10 a.m.","value":"08_10","key":"sa"},{"name":"10 to 12 p.m.","value":"10_12","key":"sa"},{"name":"12 to 2 p.m.","value":"12_14","key":"sa"},{"name":"2 to 4 p.m.","value":"14_16","key":"sa"},{"name":"4 to 6 p.m.","value":"16_18","key":"sa"},{"name":"6 to 8 p.m.","value":"18_20","key":"sa"},{"name":"8 to 10 p.m.","value":"20_22","key":"sa"}],[{"name":"8 to 10 a.m.","value":"08_10","key":"su"},{"name":"10 to 12 p.m.","value":"10_12","key":"su"},{"name":"12 to 2 p.m.","value":"12_14","key":"su"},{"name":"2 to 4 p.m.","value":"14_16","key":"su"},{"name":"4 to 6 p.m.","value":"16_18","key":"su"},{"name":"6 to 8 p.m.","value":"18_20","key":"su"},{"name":"8 to 10 p.m.","value":"20_22","key":"su"}]]',
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
Default.args = {
|
|
38
|
+
id: 'multi selector id',
|
|
39
|
+
onSelection: () => null,
|
|
40
|
+
columnHeadings: columnHeadingsDummy,
|
|
41
|
+
rowHeadings: rowHeadingsDummy,
|
|
42
|
+
checkboxesByColumn,
|
|
43
|
+
highlightCells: {
|
|
44
|
+
mo: ['10_12'],
|
|
45
|
+
sa: ['12_14'],
|
|
46
|
+
th: ['08_10'],
|
|
47
|
+
we: ['16_18', '18_20', '20_22'],
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { CheckedState } from '@radix-ui/react-checkbox';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { useTheme } from 'styled-components';
|
|
4
|
+
|
|
5
|
+
import InputError from '../InputError/InputError';
|
|
6
|
+
import Text from '../Text/Text';
|
|
7
|
+
import {
|
|
8
|
+
BelowGrid,
|
|
9
|
+
CheckboxGridWrapper,
|
|
10
|
+
ColumnHeading,
|
|
11
|
+
Grid,
|
|
12
|
+
Legend,
|
|
13
|
+
RowHeading,
|
|
14
|
+
ScrollableWrapper,
|
|
15
|
+
Square,
|
|
16
|
+
StyledCheckbox,
|
|
17
|
+
} from './styles';
|
|
18
|
+
|
|
19
|
+
type SelectedType = { [x: string]: string[] };
|
|
20
|
+
|
|
21
|
+
type CheckboxGridProps = {
|
|
22
|
+
columnHeadings: string[];
|
|
23
|
+
rowHeadings: string[];
|
|
24
|
+
highlightCells: SelectedType;
|
|
25
|
+
checkboxesByColumn: { name: string; value: string; key: string }[][];
|
|
26
|
+
onSelection: (selected: SelectedType) => void;
|
|
27
|
+
preSelected?: SelectedType;
|
|
28
|
+
legendText?: string;
|
|
29
|
+
error?: string;
|
|
30
|
+
name: string;
|
|
31
|
+
readOnly?: boolean;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const CheckboxGrid: React.FC<CheckboxGridProps> = ({
|
|
35
|
+
columnHeadings,
|
|
36
|
+
error,
|
|
37
|
+
highlightCells,
|
|
38
|
+
legendText,
|
|
39
|
+
rowHeadings,
|
|
40
|
+
checkboxesByColumn,
|
|
41
|
+
preSelected,
|
|
42
|
+
onSelection,
|
|
43
|
+
name,
|
|
44
|
+
readOnly,
|
|
45
|
+
}) => {
|
|
46
|
+
const theme = useTheme();
|
|
47
|
+
const [selected, setSelected] = useState<SelectedType>(preSelected || {});
|
|
48
|
+
|
|
49
|
+
const onSelect = ({
|
|
50
|
+
key,
|
|
51
|
+
state,
|
|
52
|
+
value,
|
|
53
|
+
}: {
|
|
54
|
+
value: string;
|
|
55
|
+
key: string;
|
|
56
|
+
state: CheckedState;
|
|
57
|
+
}) => {
|
|
58
|
+
const oldValues = selected[key] || [];
|
|
59
|
+
const newValues = state
|
|
60
|
+
? [...oldValues, value]
|
|
61
|
+
: oldValues.filter(el => el !== value);
|
|
62
|
+
const newTotalSelection = { ...selected, [key]: newValues };
|
|
63
|
+
|
|
64
|
+
setSelected(newTotalSelection);
|
|
65
|
+
onSelection(newTotalSelection);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<CheckboxGridWrapper>
|
|
70
|
+
<Grid
|
|
71
|
+
$columns={columnHeadings.length}
|
|
72
|
+
$rows={rowHeadings.length}
|
|
73
|
+
$hasError={!!error}
|
|
74
|
+
>
|
|
75
|
+
<>
|
|
76
|
+
{/* on mobile, first column is fixed */}
|
|
77
|
+
<ColumnHeading tag="span" bold index={0}>
|
|
78
|
+
{columnHeadings[0]}
|
|
79
|
+
</ColumnHeading>
|
|
80
|
+
{rowHeadings.map((row, index) => (
|
|
81
|
+
<RowHeading tag="span" key={row} index={index}>
|
|
82
|
+
{row}
|
|
83
|
+
</RowHeading>
|
|
84
|
+
))}
|
|
85
|
+
<ScrollableWrapper>
|
|
86
|
+
{columnHeadings.slice(1).map((column, index) => (
|
|
87
|
+
<ColumnHeading key={column} tag="span" bold index={index + 1}>
|
|
88
|
+
{column}
|
|
89
|
+
</ColumnHeading>
|
|
90
|
+
))}
|
|
91
|
+
{checkboxesByColumn.map((column, columnIndex) =>
|
|
92
|
+
column.map(({ value, key }, rowIndex) => {
|
|
93
|
+
return (
|
|
94
|
+
<StyledCheckbox
|
|
95
|
+
key={key + value + rowIndex}
|
|
96
|
+
checked={selected[key]?.includes(value)}
|
|
97
|
+
name={name}
|
|
98
|
+
onCheckedChange={state => onSelect({ value, key, state })}
|
|
99
|
+
value={value}
|
|
100
|
+
color={theme.color.surface.selected}
|
|
101
|
+
$row={rowIndex + 2}
|
|
102
|
+
$column={columnIndex + 2}
|
|
103
|
+
$highlight={!!highlightCells?.[key]?.includes(value)}
|
|
104
|
+
readOnly={readOnly}
|
|
105
|
+
/>
|
|
106
|
+
);
|
|
107
|
+
}),
|
|
108
|
+
)}
|
|
109
|
+
</ScrollableWrapper>
|
|
110
|
+
</>
|
|
111
|
+
</Grid>
|
|
112
|
+
<BelowGrid>
|
|
113
|
+
{legendText && highlightCells && (
|
|
114
|
+
<Legend>
|
|
115
|
+
<Square />
|
|
116
|
+
<Text tag="span">=</Text>
|
|
117
|
+
<Text tag="span">{legendText}</Text>
|
|
118
|
+
</Legend>
|
|
119
|
+
)}
|
|
120
|
+
<InputError visible={Boolean(error)}>{error}</InputError>
|
|
121
|
+
</BelowGrid>
|
|
122
|
+
</CheckboxGridWrapper>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export default CheckboxGrid;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import Checkbox from '../Checkbox/Checkbox';
|
|
4
|
+
import Text from '../Text/Text';
|
|
5
|
+
|
|
6
|
+
export const CheckboxGridWrapper = styled.div`
|
|
7
|
+
width: 100%;
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
export const Grid = styled.div<{
|
|
11
|
+
$columns: number;
|
|
12
|
+
$rows: number;
|
|
13
|
+
$hasError: boolean;
|
|
14
|
+
}>`
|
|
15
|
+
display: grid;
|
|
16
|
+
width: 100%;
|
|
17
|
+
row-gap: ${({ theme }) => theme.spacing.xsmall};
|
|
18
|
+
column-gap: ${({ theme }) => theme.spacing.xxsmall};
|
|
19
|
+
grid-template-columns: ${({ $columns }) =>
|
|
20
|
+
`repeat(${$columns}, minmax(max-content, 1fr))`};
|
|
21
|
+
grid-template-rows: ${({ $rows }) => `repeat(${$rows}, 1fr)`};
|
|
22
|
+
grid-auto-rows: 27.5px;
|
|
23
|
+
margin-bottom: ${({ theme }) => theme.spacing.xxsmall};
|
|
24
|
+
padding-bottom: ${({ theme }) => theme.spacing.xxsmall};
|
|
25
|
+
overflow-x: scroll;
|
|
26
|
+
background: ${({ theme }) => theme.color.surface.primary};
|
|
27
|
+
color: ${({ theme }) => theme.color.text.primary};
|
|
28
|
+
align-items: center;
|
|
29
|
+
border-bottom: 1px solid
|
|
30
|
+
${({ $hasError, theme }) =>
|
|
31
|
+
$hasError ? theme.color.border.error : theme.color.surface.primary};
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
export const ColumnHeading = styled(Text)<{ index: number }>`
|
|
35
|
+
grid-column-start: ${({ index }) => index + 1};
|
|
36
|
+
grid-column-end: ${({ index }) => index + 1};
|
|
37
|
+
grid-row-start: 1;
|
|
38
|
+
grid-row-end: 1;
|
|
39
|
+
text-align: center;
|
|
40
|
+
max-width: 100%;
|
|
41
|
+
padding: ${({ theme }) => theme.spacing.xxxsmall};
|
|
42
|
+
background: ${({ theme }) => theme.color.surface.primary};
|
|
43
|
+
height: 100%;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
|
|
48
|
+
${({ index }) =>
|
|
49
|
+
!index &&
|
|
50
|
+
`
|
|
51
|
+
position: sticky;
|
|
52
|
+
left: 0;
|
|
53
|
+
`}
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
export const RowHeading = styled(Text)<{ index: number }>`
|
|
57
|
+
grid-column-start: 1;
|
|
58
|
+
grid-column-end: 1;
|
|
59
|
+
grid-row-start: ${({ index }) => index + 2};
|
|
60
|
+
grid-row-end: ${({ index }) => index + 2};
|
|
61
|
+
text-align: center;
|
|
62
|
+
position: sticky;
|
|
63
|
+
left: 0;
|
|
64
|
+
background: ${({ theme }) => theme.color.surface.primary};
|
|
65
|
+
height: 100%;
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
export const ScrollableWrapper = styled.div`
|
|
72
|
+
overflow: scroll-x;
|
|
73
|
+
width: 100%;
|
|
74
|
+
display: contents;
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
export const StyledCheckbox = styled(Checkbox)<{
|
|
78
|
+
checked: boolean;
|
|
79
|
+
$row: number;
|
|
80
|
+
$column: number;
|
|
81
|
+
$highlight: boolean;
|
|
82
|
+
}>`
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
grid-row-start: ${({ $row }) => $row};
|
|
87
|
+
grid-column-start: ${({ $column }) => $column};
|
|
88
|
+
height: 100%;
|
|
89
|
+
|
|
90
|
+
${({ checked, theme }) =>
|
|
91
|
+
checked &&
|
|
92
|
+
css`
|
|
93
|
+
border-color: ${theme.color.border.selected};
|
|
94
|
+
`};
|
|
95
|
+
|
|
96
|
+
${({ $highlight, theme }) =>
|
|
97
|
+
$highlight &&
|
|
98
|
+
css`
|
|
99
|
+
background: ${theme.color.surface.accent};
|
|
100
|
+
`};
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
export const BelowGrid = styled.div`
|
|
104
|
+
display: flex;
|
|
105
|
+
justify-content: space-between;
|
|
106
|
+
`;
|
|
107
|
+
|
|
108
|
+
export const Legend = styled.div`
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
gap: ${({ theme }) => theme.spacing.xxsmall};
|
|
113
|
+
`;
|
|
114
|
+
|
|
115
|
+
export const Square = styled.div`
|
|
116
|
+
${({ theme }) => css`
|
|
117
|
+
width: 20px;
|
|
118
|
+
height: 16px;
|
|
119
|
+
background: ${theme.color.surface.accent};
|
|
120
|
+
border: 1px solid ${theme.color.border.contrast};
|
|
121
|
+
`};
|
|
122
|
+
`;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import Dropdown from './Dropdown';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
component: Dropdown,
|
|
7
|
+
title: 'Components/Dropdown',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Default = args => <Dropdown {...args} />;
|
|
11
|
+
|
|
12
|
+
Default.args = {
|
|
13
|
+
label: 'Demo dropdown',
|
|
14
|
+
id: 'multi selector id',
|
|
15
|
+
onValueChange: () => null,
|
|
16
|
+
placeholder: 'out of town',
|
|
17
|
+
value: undefined,
|
|
18
|
+
disabled: false,
|
|
19
|
+
required: false,
|
|
20
|
+
options: [
|
|
21
|
+
{ label: 'English', value: 'english' },
|
|
22
|
+
{ label: 'German', value: 'german' },
|
|
23
|
+
{ label: 'Spanish', value: 'spanish' },
|
|
24
|
+
{ label: 'French', value: 'french' },
|
|
25
|
+
{ label: 'Italian', value: 'italian' },
|
|
26
|
+
{ label: 'Dutch', value: 'dutch' },
|
|
27
|
+
{ label: 'Portuguese', value: 'portuguese' },
|
|
28
|
+
{ label: 'Russian', value: 'russian' },
|
|
29
|
+
{ label: 'Chinese', value: 'chinese' },
|
|
30
|
+
{ label: 'Japanese', value: 'japanese' },
|
|
31
|
+
{ label: 'Korean', value: 'korean' },
|
|
32
|
+
{ label: 'Arabic', value: 'arabic' },
|
|
33
|
+
{ label: 'Turkish', value: 'turkish' },
|
|
34
|
+
{ label: 'Swedish', value: 'swedish' },
|
|
35
|
+
{ label: 'Polish', value: 'polish' },
|
|
36
|
+
{ label: 'Danish', value: 'danish' },
|
|
37
|
+
{ label: 'Norwegian', value: 'norwegian' },
|
|
38
|
+
{ label: 'Finnish', value: 'finnish' },
|
|
39
|
+
{ label: 'Greek', value: 'greek' },
|
|
40
|
+
{ label: 'Czech', value: 'czech' },
|
|
41
|
+
{ label: 'Hungarian', value: 'hungarian' },
|
|
42
|
+
{ label: 'Romanian', value: 'romanian' },
|
|
43
|
+
{ label: 'Indonesian', value: 'indonesian' },
|
|
44
|
+
{ label: 'Hebrew', value: 'hebrew' },
|
|
45
|
+
{ label: 'Thai', value: 'thai' },
|
|
46
|
+
{ label: 'Vietnamese', value: 'vietnamese' },
|
|
47
|
+
{ label: 'Ukrainian', value: 'ukrainian' },
|
|
48
|
+
{ label: 'Slovak', value: 'slovak' },
|
|
49
|
+
{ label: 'Croatian', value: 'croatian' },
|
|
50
|
+
{ label: 'Serbian', value: 'serbian' },
|
|
51
|
+
{ label: 'Bulgarian', value: 'bulgarian' },
|
|
52
|
+
{ label: 'Lithuanian', value: 'lithuanian' },
|
|
53
|
+
{ label: 'Latvian', value: 'latvian' },
|
|
54
|
+
{ label: 'Estonian', value: 'estonian' },
|
|
55
|
+
{ label: 'Persian', value: 'persian' },
|
|
56
|
+
{ label: 'Afrikaans', value: 'afrikaans' },
|
|
57
|
+
{ label: 'Swahili', value: 'swahili' },
|
|
58
|
+
],
|
|
59
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as Select from '@radix-ui/react-select';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { CheckIcon, ChevronDownIcon } from '../Icon';
|
|
5
|
+
import InputError from '../InputError/InputError';
|
|
6
|
+
import Label from '../Label/Label';
|
|
7
|
+
import Text from '../Text/Text';
|
|
8
|
+
import { InputHeight } from '../TextInput/TextInput';
|
|
9
|
+
import {
|
|
10
|
+
DropdownWrapper,
|
|
11
|
+
SelectContent,
|
|
12
|
+
SelectIcon,
|
|
13
|
+
SelectItem,
|
|
14
|
+
SelectItemIndicator,
|
|
15
|
+
SelectTrigger,
|
|
16
|
+
SelectValue,
|
|
17
|
+
SelectViewport,
|
|
18
|
+
} from './styles';
|
|
19
|
+
|
|
20
|
+
type Options = { value: string; label: string }[];
|
|
21
|
+
|
|
22
|
+
export type DropdownProps = {
|
|
23
|
+
ariaLabel?: string;
|
|
24
|
+
cannotError?: boolean;
|
|
25
|
+
error?: string;
|
|
26
|
+
height?: InputHeight;
|
|
27
|
+
label?: string;
|
|
28
|
+
labelTooltip?: string;
|
|
29
|
+
lockedValue?: string;
|
|
30
|
+
maxWidth?: string;
|
|
31
|
+
options: Options;
|
|
32
|
+
onValueChange: (value: string) => void;
|
|
33
|
+
placeholder: string;
|
|
34
|
+
value?: string;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
required?: boolean;
|
|
37
|
+
inputRef?: React.RefObject<HTMLButtonElement>;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const ARROW_DOWN_WIDTH = 13;
|
|
41
|
+
const ARROW_DOWN_HEIGHT = 8;
|
|
42
|
+
|
|
43
|
+
const isValidValue = (value: string, options: Options) =>
|
|
44
|
+
options.some(option => option.value === value);
|
|
45
|
+
|
|
46
|
+
const Option: React.FC<{ children: string; value: string }> = ({
|
|
47
|
+
children,
|
|
48
|
+
value,
|
|
49
|
+
}) => {
|
|
50
|
+
return (
|
|
51
|
+
<SelectItem value={value}>
|
|
52
|
+
<Select.SelectItemText>
|
|
53
|
+
<Text>{children}</Text>
|
|
54
|
+
</Select.SelectItemText>
|
|
55
|
+
<SelectItemIndicator>
|
|
56
|
+
<CheckIcon label="selected item" width="10px" />
|
|
57
|
+
</SelectItemIndicator>
|
|
58
|
+
</SelectItem>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const Dropdown: React.FC<DropdownProps> = ({
|
|
63
|
+
ariaLabel,
|
|
64
|
+
error,
|
|
65
|
+
cannotError,
|
|
66
|
+
disabled,
|
|
67
|
+
height,
|
|
68
|
+
inputRef,
|
|
69
|
+
label,
|
|
70
|
+
labelTooltip,
|
|
71
|
+
lockedValue,
|
|
72
|
+
maxWidth,
|
|
73
|
+
onValueChange,
|
|
74
|
+
options,
|
|
75
|
+
placeholder,
|
|
76
|
+
required,
|
|
77
|
+
value,
|
|
78
|
+
}) => {
|
|
79
|
+
const defaultValue =
|
|
80
|
+
lockedValue || (value && isValidValue(value, options) ? value : undefined);
|
|
81
|
+
const canError = !lockedValue && !cannotError;
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<DropdownWrapper $maxWidth={maxWidth}>
|
|
85
|
+
{label && (
|
|
86
|
+
<Label bold htmlFor={ariaLabel} tooltipText={labelTooltip}>
|
|
87
|
+
{label}
|
|
88
|
+
</Label>
|
|
89
|
+
)}
|
|
90
|
+
<Select.Root
|
|
91
|
+
disabled={disabled || !!lockedValue}
|
|
92
|
+
onValueChange={onValueChange}
|
|
93
|
+
required={required}
|
|
94
|
+
defaultValue={defaultValue}
|
|
95
|
+
>
|
|
96
|
+
<SelectTrigger
|
|
97
|
+
aria-label={ariaLabel || label}
|
|
98
|
+
ref={inputRef}
|
|
99
|
+
$hasError={Boolean(error)}
|
|
100
|
+
$height={height}
|
|
101
|
+
>
|
|
102
|
+
<SelectValue placeholder={placeholder} />
|
|
103
|
+
{!lockedValue && (
|
|
104
|
+
<SelectIcon>
|
|
105
|
+
<ChevronDownIcon
|
|
106
|
+
width={ARROW_DOWN_WIDTH}
|
|
107
|
+
height={ARROW_DOWN_HEIGHT}
|
|
108
|
+
label="dropdown icon"
|
|
109
|
+
/>
|
|
110
|
+
</SelectIcon>
|
|
111
|
+
)}
|
|
112
|
+
</SelectTrigger>
|
|
113
|
+
<SelectContent position="popper">
|
|
114
|
+
<SelectViewport>
|
|
115
|
+
{options.map(option => (
|
|
116
|
+
<Option key={option.label} value={option.value}>
|
|
117
|
+
{option.label}
|
|
118
|
+
</Option>
|
|
119
|
+
))}
|
|
120
|
+
</SelectViewport>
|
|
121
|
+
</SelectContent>
|
|
122
|
+
</Select.Root>
|
|
123
|
+
{canError && <InputError visible={Boolean(error)}>{error}</InputError>}
|
|
124
|
+
</DropdownWrapper>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export default Dropdown;
|