@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,80 @@
|
|
|
1
|
+
import { PopoverArrow, PopoverClose, PopoverContent, Root, } from '@radix-ui/react-popover';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { slideDownAndFade, slideLeftAndFade, slideRightAndFade, slideUpAndFade, } from '../../utils/animations';
|
|
4
|
+
export const PopoverRoot = styled(Root) ``;
|
|
5
|
+
export const POPOVER_CONTENT_CSS = css `
|
|
6
|
+
border-radius: ${({ theme }) => theme.radius.small};
|
|
7
|
+
padding: ${({ theme }) => theme.spacing.small};
|
|
8
|
+
font-size: 16px;
|
|
9
|
+
line-height: 1.5;
|
|
10
|
+
box-shadow:
|
|
11
|
+
hsl(206 22% 7% / 35%) 0px 10px 38px -10px,
|
|
12
|
+
hsl(206 22% 7% / 20%) 0px 10px 20px -15px;
|
|
13
|
+
user-select: none;
|
|
14
|
+
animation-duration: 400ms;
|
|
15
|
+
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
|
|
16
|
+
will-change: transform, opacity;
|
|
17
|
+
width: max-content;
|
|
18
|
+
max-width: 360px;
|
|
19
|
+
|
|
20
|
+
&[data-state='delayed-open'][data-side='top'] {
|
|
21
|
+
animation-name: ${slideDownAndFade};
|
|
22
|
+
}
|
|
23
|
+
&[data-state='delayed-open'][data-side='right'] {
|
|
24
|
+
animation-name: ${slideLeftAndFade};
|
|
25
|
+
}
|
|
26
|
+
&[data-state='delayed-open'][data-side='bottom'] {
|
|
27
|
+
animation-name: ${slideUpAndFade};
|
|
28
|
+
}
|
|
29
|
+
&[data-state='delayed-open'][data-side='left'] {
|
|
30
|
+
animation-name: ${slideRightAndFade};
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
export const StyledPopoverContent = styled(PopoverContent) `
|
|
34
|
+
${POPOVER_CONTENT_CSS}
|
|
35
|
+
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
z-index: 1000;
|
|
39
|
+
|
|
40
|
+
${({ $width }) => $width &&
|
|
41
|
+
`
|
|
42
|
+
width: ${$width};
|
|
43
|
+
`}
|
|
44
|
+
|
|
45
|
+
${({ $extraPaddingTop, theme }) => $extraPaddingTop &&
|
|
46
|
+
`
|
|
47
|
+
padding-top: ${theme.spacing.medium};
|
|
48
|
+
`}
|
|
49
|
+
|
|
50
|
+
${({ $asTooltip, theme }) => css `
|
|
51
|
+
background-color: ${$asTooltip
|
|
52
|
+
? theme.color.surface.bold
|
|
53
|
+
: theme.color.surface.elevated};
|
|
54
|
+
color: ${$asTooltip ? theme.color.text.reversed : theme.color.text.primary};
|
|
55
|
+
padding-right: ${$asTooltip ? theme.spacing.medium : theme.spacing.small};
|
|
56
|
+
`}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
&[data-state='open'][data-side='top'] {
|
|
60
|
+
animation-name: ${slideDownAndFade};
|
|
61
|
+
}
|
|
62
|
+
&[data-state='open'][data-side='right'] {
|
|
63
|
+
animation-name: ${slideLeftAndFade};
|
|
64
|
+
}
|
|
65
|
+
&[data-state='open'][data-side='bottom'] {
|
|
66
|
+
animation-name: ${slideUpAndFade};
|
|
67
|
+
}
|
|
68
|
+
&[data-state='open'][data-side='left'] {
|
|
69
|
+
animation-name: ${slideRightAndFade};
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
export const StyledPopoverClose = styled(PopoverClose) `
|
|
73
|
+
position: absolute;
|
|
74
|
+
top: ${({ theme }) => theme.spacing.xsmall};
|
|
75
|
+
right: ${({ theme }) => theme.spacing.xsmall};
|
|
76
|
+
color: ${({ $asTooltip, theme }) => $asTooltip ? theme.color.text.reversed : theme.color.text.primary};
|
|
77
|
+
`;
|
|
78
|
+
export const StyledPopoverArrow = styled(PopoverArrow) `
|
|
79
|
+
fill: ${({ $asTooltip, theme }) => $asTooltip ? theme.color.surface.bold : theme.color.surface.elevated};
|
|
80
|
+
`;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as Progress from '@radix-ui/react-progress';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import Text from '../Text/Text';
|
|
5
|
+
import { TextTypes } from '@a-little-world/little-world-design-system-core';
|
|
6
|
+
const ProgressRoot = styled(Progress.Root) `
|
|
7
|
+
position: relative;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
border-radius: 99999px;
|
|
10
|
+
background: ${({ theme }) => theme.color.surface.secondary};
|
|
11
|
+
width: 300px;
|
|
12
|
+
height: 8px;
|
|
13
|
+
|
|
14
|
+
/* Fix overflow clipping in Safari */
|
|
15
|
+
/* https://gist.github.com/domske/b66047671c780a238b51c51ffde8d3a0 */
|
|
16
|
+
transform: translateZ(0);
|
|
17
|
+
`;
|
|
18
|
+
const ProgressIndicator = styled(Progress.Indicator) `
|
|
19
|
+
background-color: ${({ theme }) => theme.color.surface.indicator};
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
transition: transform 660ms cubic-bezier(0.65, 0, 0.35, 1);
|
|
23
|
+
`;
|
|
24
|
+
const ProgressBarWrapper = styled.div `
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
gap: ${({ theme }) => theme.spacing.small};
|
|
29
|
+
font-family: 'Work Sans';
|
|
30
|
+
`;
|
|
31
|
+
const calculateProgress = (max, value) => {
|
|
32
|
+
return (value / max) * 100;
|
|
33
|
+
};
|
|
34
|
+
const ProgressBar = ({ className, max, value = 0, }) => {
|
|
35
|
+
const [progress, setProgress] = useState(calculateProgress(max, value));
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
setProgress(calculateProgress(max, value));
|
|
38
|
+
}, [max, value]);
|
|
39
|
+
return (React.createElement(ProgressBarWrapper, { className: className },
|
|
40
|
+
React.createElement(Text, { id: "progressBarIndicator", tag: "span", type: TextTypes.Body6 },
|
|
41
|
+
value,
|
|
42
|
+
"/",
|
|
43
|
+
max),
|
|
44
|
+
React.createElement(ProgressRoot, { "aria-labelledby": "progressBarIndicator", value: value, max: max },
|
|
45
|
+
React.createElement(ProgressIndicator, { className: "ProgressIndicator", style: { transform: `translateX(-${100 - progress}%)` } }))));
|
|
46
|
+
};
|
|
47
|
+
export default ProgressBar;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as RadixRadioGroup from '@radix-ui/react-radio-group';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { RadioGroupBaseProps } from '@a-little-world/little-world-design-system-core';
|
|
4
|
+
type Props = {
|
|
5
|
+
error?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
labelTooltip?: string;
|
|
8
|
+
items: Array<{
|
|
9
|
+
id: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}>;
|
|
13
|
+
inputRef: React.RefObject<HTMLInputElement>;
|
|
14
|
+
} & RadixRadioGroup.RadioGroupProps & RadioGroupBaseProps;
|
|
15
|
+
declare const RadioGroup: React.FC<Props>;
|
|
16
|
+
export default RadioGroup;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RadioGroupVariations, } from '@a-little-world/little-world-design-system-core';
|
|
3
|
+
import InputError from '../InputError/InputError';
|
|
4
|
+
import Label from '../Label/Label';
|
|
5
|
+
import { ItemContainer, PillItem, PillRoot, RadioGroupIndicator, RadioGroupItem, RadioGroupRoot, RadioGroupWrapper, } from './styles';
|
|
6
|
+
const RadioGroup = ({ error, items, label, labelTooltip, inputRef, type = RadioGroupVariations.Classic, value, ...rest }) => {
|
|
7
|
+
const isPill = type === RadioGroupVariations.Pill;
|
|
8
|
+
return (React.createElement(RadioGroupWrapper, null,
|
|
9
|
+
label && (React.createElement(Label, { bold: true, htmlFor: label, tooltipText: labelTooltip }, label)),
|
|
10
|
+
isPill ? (React.createElement(React.Fragment, null,
|
|
11
|
+
React.createElement(PillRoot, { ref: inputRef, value: value, name: label, ...rest }, items?.map(item => (React.createElement(PillItem, { key: item.id, value: item.value, id: item.id, "$hasError": Boolean(error) }, item.label)))),
|
|
12
|
+
React.createElement(InputError, { visible: Boolean(error), textAlign: "left" }, error))) : (React.createElement(RadioGroupRoot, { ref: inputRef, value: value, name: label, ...rest },
|
|
13
|
+
items?.map(item => (React.createElement(ItemContainer, { key: item.id },
|
|
14
|
+
React.createElement(RadioGroupItem, { value: item.value, id: item.id, "$hasError": Boolean(error) },
|
|
15
|
+
React.createElement(RadioGroupIndicator, null)),
|
|
16
|
+
item.label && (React.createElement(Label, { htmlFor: item.id, inline: true }, item.label))))),
|
|
17
|
+
React.createElement(InputError, { visible: Boolean(error) }, error)))));
|
|
18
|
+
};
|
|
19
|
+
export default RadioGroup;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as RadioGroup from '@radix-ui/react-radio-group';
|
|
2
|
+
export declare const RadioGroupWrapper: 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 RadioGroupRoot: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<RadioGroup.RadioGroupProps & import("react").RefAttributes<HTMLDivElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<RadioGroup.RadioGroupProps & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
|
|
4
|
+
export declare const PillRoot: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<RadioGroup.RadioGroupProps & import("react").RefAttributes<HTMLDivElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<RadioGroup.RadioGroupProps & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
|
|
5
|
+
export declare const PillItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<RadioGroup.RadioGroupItemProps & import("react").RefAttributes<HTMLButtonElement>, {
|
|
6
|
+
$hasError: boolean;
|
|
7
|
+
}>> & string & Omit<import("react").ForwardRefExoticComponent<RadioGroup.RadioGroupItemProps & import("react").RefAttributes<HTMLButtonElement>>, keyof import("react").Component<any, {}, any>>;
|
|
8
|
+
export declare const RadioGroupItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<RadioGroup.RadioGroupItemProps & import("react").RefAttributes<HTMLButtonElement>, {
|
|
9
|
+
$hasError: boolean;
|
|
10
|
+
}>> & string & Omit<import("react").ForwardRefExoticComponent<RadioGroup.RadioGroupItemProps & import("react").RefAttributes<HTMLButtonElement>>, keyof import("react").Component<any, {}, any>>;
|
|
11
|
+
export declare const ItemContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
12
|
+
export declare const RadioGroupIndicator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<RadioGroup.RadioGroupIndicatorProps & import("react").RefAttributes<HTMLSpanElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<RadioGroup.RadioGroupIndicatorProps & import("react").RefAttributes<HTMLSpanElement>>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as RadioGroup from '@radix-ui/react-radio-group';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
const ITEM_WIDTH = '13px';
|
|
4
|
+
export const RadioGroupWrapper = styled.div ``;
|
|
5
|
+
export const RadioGroupRoot = styled(RadioGroup.Root) `
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: ${({ theme }) => theme.spacing.xxsmall};
|
|
9
|
+
align-items: flex-start;
|
|
10
|
+
width: 100%;
|
|
11
|
+
`;
|
|
12
|
+
export const PillRoot = styled(RadioGroup.Root) `
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: row;
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
gap: ${({ theme }) => theme.spacing.xxsmall};
|
|
17
|
+
align-items: center;
|
|
18
|
+
width: 100%;
|
|
19
|
+
margin-bottom: ${({ theme }) => theme.spacing.xxxsmall};
|
|
20
|
+
`;
|
|
21
|
+
export const PillItem = styled(RadioGroup.Item) `
|
|
22
|
+
all: unset;
|
|
23
|
+
font-family: 'Signika Negative';
|
|
24
|
+
font-weight: 600;
|
|
25
|
+
background: ${({ theme }) => theme.color.surface.primary};
|
|
26
|
+
border-radius: ${({ theme }) => theme.radius.small};
|
|
27
|
+
box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.03);
|
|
28
|
+
border: 2px solid ${({ theme }) => theme.color.border.subtle};
|
|
29
|
+
padding: ${({ theme }) => `${theme.spacing.xxsmall} ${theme.spacing.xsmall}`};
|
|
30
|
+
min-width: 60px;
|
|
31
|
+
width: 100%;
|
|
32
|
+
display: flex;
|
|
33
|
+
flex: 1;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
transition: filter 0.2s ease-in-out;
|
|
38
|
+
|
|
39
|
+
${({ theme }) => css `
|
|
40
|
+
@media (min-width: ${theme.breakpoints.small}) {
|
|
41
|
+
padding: ${theme.spacing.xsmall} ${theme.spacing.small};
|
|
42
|
+
min-width: 80px;
|
|
43
|
+
}
|
|
44
|
+
`}
|
|
45
|
+
|
|
46
|
+
&[data-state='checked'] {
|
|
47
|
+
border-color: ${({ $hasError, theme }) => $hasError ? theme.color.border.error : theme.color.border.selected};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&:hover {
|
|
51
|
+
filter: brightness(0.97);
|
|
52
|
+
transition: filter 0.2s ease-in-out;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
export const RadioGroupItem = styled(RadioGroup.Item) `
|
|
56
|
+
all: unset;
|
|
57
|
+
background: ${({ theme }) => theme.color.surface.primary};
|
|
58
|
+
box-sizing: border-box;
|
|
59
|
+
border: 1px solid ${({ theme }) => theme.color.surface.contrast};
|
|
60
|
+
width: ${ITEM_WIDTH};
|
|
61
|
+
height: ${ITEM_WIDTH};
|
|
62
|
+
border-radius: 100%;
|
|
63
|
+
margin-right: ${({ theme }) => theme.spacing.xxsmall};
|
|
64
|
+
|
|
65
|
+
&:focus {
|
|
66
|
+
box-shadow: 0 0 0 2px
|
|
67
|
+
${({ $hasError, theme }) => $hasError ? theme.color.border.error : '#eeb612'};
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
export const ItemContainer = styled.div `
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
`;
|
|
74
|
+
export const RadioGroupIndicator = styled(RadioGroup.Indicator) `
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
width: 100%;
|
|
79
|
+
height: 100%;
|
|
80
|
+
position: relative;
|
|
81
|
+
|
|
82
|
+
&::after {
|
|
83
|
+
content: '';
|
|
84
|
+
display: block;
|
|
85
|
+
width: 9px;
|
|
86
|
+
height: 9px;
|
|
87
|
+
border-radius: 50%;
|
|
88
|
+
background-color: ${({ theme }) => theme.color.text.primary};
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SeparatorProps {
|
|
3
|
+
background?: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
color?: string;
|
|
6
|
+
orientation?: 'horizontal' | 'vertical';
|
|
7
|
+
size?: 'small' | 'medium' | 'large';
|
|
8
|
+
spacing?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Separator: ({ background, className, orientation, spacing, }: SeparatorProps) => React.JSX.Element;
|
|
11
|
+
export default Separator;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as RadixSeparator from '@radix-ui/react-separator';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
const StyledSeparator = styled(RadixSeparator.Root) `
|
|
5
|
+
margin: ${({ theme, $spacing }) => $spacing || theme.spacing.small} 0;
|
|
6
|
+
background: ${({ theme, $background }) => $background || theme.color.border.contrast};
|
|
7
|
+
|
|
8
|
+
&[data-orientation='vertical'] {
|
|
9
|
+
height: 100%;
|
|
10
|
+
width: 1px;
|
|
11
|
+
margin: 0 ${({ theme, $spacing }) => $spacing || theme.spacing.medium};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&[data-orientation='horizontal'] {
|
|
15
|
+
height: 1px;
|
|
16
|
+
width: 100%;
|
|
17
|
+
margin: ${({ theme, $spacing }) => $spacing || theme.spacing.medium} 0;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
const Separator = ({ background, className, orientation = 'horizontal', spacing, }) => {
|
|
21
|
+
return (React.createElement(StyledSeparator, { className: className, orientation: orientation, decorative: true, "$background": background, "$spacing": spacing }));
|
|
22
|
+
};
|
|
23
|
+
export default Separator;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const SliderWrapper: 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 SliderRoot: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("@radix-ui/react-slider").SliderProps & import("react").RefAttributes<HTMLSpanElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("@radix-ui/react-slider").SliderProps & import("react").RefAttributes<HTMLSpanElement>>, keyof import("react").Component<any, {}, any>>;
|
|
3
|
+
export declare const SliderTrack: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("@radix-ui/react-slider").SliderTrackProps & import("react").RefAttributes<HTMLSpanElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("@radix-ui/react-slider").SliderTrackProps & import("react").RefAttributes<HTMLSpanElement>>, keyof import("react").Component<any, {}, any>>;
|
|
4
|
+
export declare const SliderRange: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("@radix-ui/react-slider").SliderRangeProps & import("react").RefAttributes<HTMLSpanElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("@radix-ui/react-slider").SliderRangeProps & import("react").RefAttributes<HTMLSpanElement>>, keyof import("react").Component<any, {}, any>>;
|
|
5
|
+
export declare const SliderThumb: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("@radix-ui/react-slider").SliderThumbProps & import("react").RefAttributes<HTMLSpanElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("@radix-ui/react-slider").SliderThumbProps & import("react").RefAttributes<HTMLSpanElement>>, keyof import("react").Component<any, {}, any>>;
|
|
6
|
+
export declare const Steps: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Range, Root, Thumb, Track } from '@radix-ui/react-slider';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
export const SliderWrapper = styled.div ``;
|
|
4
|
+
export const SliderRoot = styled(Root) `
|
|
5
|
+
position: relative;
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
user-select: none;
|
|
9
|
+
touch-action: none;
|
|
10
|
+
width: 100%:
|
|
11
|
+
max-width: 400px;
|
|
12
|
+
height: 20px;
|
|
13
|
+
`;
|
|
14
|
+
export const SliderTrack = styled(Track) `
|
|
15
|
+
position: relative;
|
|
16
|
+
background-color: ${props => props.theme.color.surface.secondary};
|
|
17
|
+
flex-grow: 1;
|
|
18
|
+
border-radius: 9999px;
|
|
19
|
+
height: 3px;
|
|
20
|
+
`;
|
|
21
|
+
export const SliderRange = styled(Range) `
|
|
22
|
+
position: absolute;
|
|
23
|
+
background-color: ${props => props.theme.color.surface.bold};
|
|
24
|
+
border-radius: 9999px;
|
|
25
|
+
height: 100%;
|
|
26
|
+
`;
|
|
27
|
+
export const SliderThumb = styled(Thumb) `
|
|
28
|
+
display: block;
|
|
29
|
+
width: ${({ theme }) => theme.spacing.small};
|
|
30
|
+
height: ${({ theme }) => theme.spacing.small};
|
|
31
|
+
background-color: ${({ theme }) => theme.color.surface.primary};
|
|
32
|
+
border-radius: 10px;
|
|
33
|
+
border: 1px solid ${props => props.theme.color.border.moderate};
|
|
34
|
+
|
|
35
|
+
&:hover {
|
|
36
|
+
background-color: ${props => props.theme.color.surface.primary};
|
|
37
|
+
cursor: grab;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:focus {
|
|
41
|
+
outline: none;
|
|
42
|
+
box-shadow: 0 0px 4px ${props => props.theme.color.surface.contrast};
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
export const Steps = styled.div `
|
|
46
|
+
width: 100%;
|
|
47
|
+
display: flex;
|
|
48
|
+
flex: 1;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: space-between;
|
|
51
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as RadixSlider from '@radix-ui/react-slider';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type SliderProps = {
|
|
4
|
+
ariaLabel: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
labelTooltip?: string;
|
|
8
|
+
inputRef: React.RefObject<HTMLInputElement>;
|
|
9
|
+
steps: string[];
|
|
10
|
+
} & RadixSlider.SliderProps;
|
|
11
|
+
declare const Slider: ({ ariaLabel, defaultValue, inputRef, label, labelTooltip, onValueChange, value, steps, }: SliderProps) => React.JSX.Element;
|
|
12
|
+
export default Slider;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Label from '../Label/Label';
|
|
3
|
+
import Text from '../Text/Text';
|
|
4
|
+
import { SliderRange, SliderRoot, SliderThumb, SliderTrack, SliderWrapper, Steps, } from './styles';
|
|
5
|
+
const Slider = ({ ariaLabel, defaultValue, inputRef, label, labelTooltip, onValueChange, value, steps, }) => (React.createElement(SliderWrapper, null,
|
|
6
|
+
label && (React.createElement(Label, { bold: true, htmlFor: label, tooltipText: labelTooltip }, label)),
|
|
7
|
+
React.createElement(SliderRoot, { "aria-label": ariaLabel, ref: inputRef, defaultValue: defaultValue, max: steps.length - 1, onValueChange: onValueChange, value: value || defaultValue },
|
|
8
|
+
React.createElement(SliderTrack, null,
|
|
9
|
+
React.createElement(SliderRange, null)),
|
|
10
|
+
React.createElement(SliderThumb, { "aria-label": ariaLabel })),
|
|
11
|
+
React.createElement(Steps, null, steps.map(step => (React.createElement(Text, { key: step }, step))))));
|
|
12
|
+
export default Slider;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const SliderWrapper: 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 SliderRoot: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("@radix-ui/react-slider").SliderProps & import("react").RefAttributes<HTMLSpanElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("@radix-ui/react-slider").SliderProps & import("react").RefAttributes<HTMLSpanElement>>, keyof import("react").Component<any, {}, any>>;
|
|
3
|
+
export declare const SliderTrack: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("@radix-ui/react-slider").SliderTrackProps & import("react").RefAttributes<HTMLSpanElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("@radix-ui/react-slider").SliderTrackProps & import("react").RefAttributes<HTMLSpanElement>>, keyof import("react").Component<any, {}, any>>;
|
|
4
|
+
export declare const SliderRange: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("@radix-ui/react-slider").SliderRangeProps & import("react").RefAttributes<HTMLSpanElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("@radix-ui/react-slider").SliderRangeProps & import("react").RefAttributes<HTMLSpanElement>>, keyof import("react").Component<any, {}, any>>;
|
|
5
|
+
export declare const SliderThumb: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("@radix-ui/react-slider").SliderThumbProps & import("react").RefAttributes<HTMLSpanElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("@radix-ui/react-slider").SliderThumbProps & import("react").RefAttributes<HTMLSpanElement>>, keyof import("react").Component<any, {}, any>>;
|
|
6
|
+
export declare const Steps: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Range, Root, Thumb, Track } from '@radix-ui/react-slider';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
export const SliderWrapper = styled.div ``;
|
|
4
|
+
export const SliderRoot = styled(Root) `
|
|
5
|
+
position: relative;
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
user-select: none;
|
|
9
|
+
touch-action: none;
|
|
10
|
+
width: 100%:
|
|
11
|
+
max-width: 400px;
|
|
12
|
+
height: 20px;
|
|
13
|
+
`;
|
|
14
|
+
export const SliderTrack = styled(Track) `
|
|
15
|
+
position: relative;
|
|
16
|
+
background-color: ${props => props.theme.color.surface.secondary};
|
|
17
|
+
flex-grow: 1;
|
|
18
|
+
border-radius: 9999px;
|
|
19
|
+
height: 3px;
|
|
20
|
+
`;
|
|
21
|
+
export const SliderRange = styled(Range) `
|
|
22
|
+
position: absolute;
|
|
23
|
+
background-color: ${props => props.theme.color.surface.bold};
|
|
24
|
+
border-radius: 9999px;
|
|
25
|
+
height: 100%;
|
|
26
|
+
`;
|
|
27
|
+
export const SliderThumb = styled(Thumb) `
|
|
28
|
+
display: block;
|
|
29
|
+
width: ${({ theme }) => theme.spacing.small};
|
|
30
|
+
height: ${({ theme }) => theme.spacing.small};
|
|
31
|
+
background-color: ${({ theme }) => theme.color.surface.primary};
|
|
32
|
+
border-radius: 10px;
|
|
33
|
+
border: 1px solid ${props => props.theme.color.border.moderate};
|
|
34
|
+
|
|
35
|
+
&:hover {
|
|
36
|
+
background-color: ${props => props.theme.color.surface.primary};
|
|
37
|
+
cursor: grab;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:focus {
|
|
41
|
+
outline: none;
|
|
42
|
+
box-shadow: 0 0px 4px ${props => props.theme.color.surface.contrast};
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
export const Steps = styled.div `
|
|
46
|
+
width: 100%;
|
|
47
|
+
display: flex;
|
|
48
|
+
flex: 1;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: space-between;
|
|
51
|
+
`;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare enum StarRatingSizes {
|
|
3
|
+
Small = 24,// px
|
|
4
|
+
Medium = 32,
|
|
5
|
+
Large = 48
|
|
6
|
+
}
|
|
7
|
+
export interface StarRatingProps {
|
|
8
|
+
className?: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
displayNumber?: boolean;
|
|
11
|
+
displayTextRatings?: boolean;
|
|
12
|
+
enableHalfRatings?: boolean;
|
|
13
|
+
id?: string;
|
|
14
|
+
initialRating?: number;
|
|
15
|
+
ratings?: string[];
|
|
16
|
+
maxRating?: number;
|
|
17
|
+
name?: string;
|
|
18
|
+
onChange?: (rating: number) => void;
|
|
19
|
+
size?: StarRatingSizes;
|
|
20
|
+
}
|
|
21
|
+
declare const StarRating: ({ className, color, displayNumber, displayTextRatings, enableHalfRatings, id, initialRating, name, maxRating, onChange, ratings, size, }: StarRatingProps) => React.JSX.Element;
|
|
22
|
+
export default StarRating;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import { useTheme } from 'styled-components';
|
|
3
|
+
import { StarIcon } from '../Icon';
|
|
4
|
+
import { Rating, RatingContainer, StarContainer, StarOverlay, Stars, TextRating, VisuallyHidden, } from './styles';
|
|
5
|
+
const roundToHalf = (value) => {
|
|
6
|
+
const rounded = Math.round(value * 2) / 2;
|
|
7
|
+
return Math.max(0, Math.min(rounded, 5));
|
|
8
|
+
};
|
|
9
|
+
const DEFAULT_RATINGS = ['Poor', 'Fair', 'Average', 'Good', 'Excellent'];
|
|
10
|
+
export var StarRatingSizes;
|
|
11
|
+
(function (StarRatingSizes) {
|
|
12
|
+
StarRatingSizes[StarRatingSizes["Small"] = 24] = "Small";
|
|
13
|
+
StarRatingSizes[StarRatingSizes["Medium"] = 32] = "Medium";
|
|
14
|
+
StarRatingSizes[StarRatingSizes["Large"] = 48] = "Large";
|
|
15
|
+
})(StarRatingSizes || (StarRatingSizes = {}));
|
|
16
|
+
const StarRating = ({ className, color, displayNumber = false, displayTextRatings = false, enableHalfRatings = false, id = 'star-rating', initialRating = 0, name = 'rating', maxRating = 5, onChange, ratings = DEFAULT_RATINGS, size = StarRatingSizes.Small, }) => {
|
|
17
|
+
const [rating, setRating] = useState(initialRating);
|
|
18
|
+
const [hoverRating, setHoverRating] = useState(0);
|
|
19
|
+
const [focusedStar, setFocusedStar] = useState(null);
|
|
20
|
+
const theme = useTheme();
|
|
21
|
+
const ratingIncrement = enableHalfRatings ? 0.5 : 1;
|
|
22
|
+
const handleMouseMove = (e, starIndex) => {
|
|
23
|
+
const { left, width } = e.currentTarget.getBoundingClientRect();
|
|
24
|
+
const percent = (e.clientX - left) / width;
|
|
25
|
+
const newRating = enableHalfRatings && percent <= 0.5 ? starIndex + 0.5 : starIndex + 1;
|
|
26
|
+
setHoverRating(roundToHalf(newRating));
|
|
27
|
+
};
|
|
28
|
+
const handleMouseLeave = () => {
|
|
29
|
+
setHoverRating(0);
|
|
30
|
+
};
|
|
31
|
+
const updateRating = useCallback((newRating) => {
|
|
32
|
+
const roundedRating = enableHalfRatings
|
|
33
|
+
? roundToHalf(newRating)
|
|
34
|
+
: newRating;
|
|
35
|
+
setRating(roundedRating);
|
|
36
|
+
onChange?.(roundedRating);
|
|
37
|
+
}, [onChange]);
|
|
38
|
+
const calculateRating = (starNumber) => {
|
|
39
|
+
// Toggle between whole, half, and unrated for clicked star
|
|
40
|
+
let newRating;
|
|
41
|
+
if (rating === starNumber) {
|
|
42
|
+
newRating = starNumber - ratingIncrement;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
newRating = starNumber;
|
|
46
|
+
}
|
|
47
|
+
updateRating(newRating);
|
|
48
|
+
};
|
|
49
|
+
const handleKeyDown = (e, starIndex) => {
|
|
50
|
+
let newRating = rating;
|
|
51
|
+
setHoverRating(0);
|
|
52
|
+
switch (e.key) {
|
|
53
|
+
case 'ArrowLeft':
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
// If we're at a whole number, go down by 0.5, otherwise go down by 1
|
|
56
|
+
newRating =
|
|
57
|
+
Math.floor(rating) === rating
|
|
58
|
+
? Math.max(0, rating - ratingIncrement)
|
|
59
|
+
: Math.max(0, Math.floor(rating));
|
|
60
|
+
updateRating(newRating);
|
|
61
|
+
setFocusedStar(Math.max(0, newRating - 1));
|
|
62
|
+
break;
|
|
63
|
+
case 'ArrowRight':
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
// If we're at a whole number, go up by 0.5, otherwise go up by 1
|
|
66
|
+
newRating =
|
|
67
|
+
Math.floor(rating) === rating
|
|
68
|
+
? Math.min(maxRating, rating + ratingIncrement)
|
|
69
|
+
: Math.min(maxRating, Math.ceil(rating));
|
|
70
|
+
updateRating(newRating);
|
|
71
|
+
setFocusedStar(Math.min(maxRating - 1, newRating - 1));
|
|
72
|
+
break;
|
|
73
|
+
case ' ':
|
|
74
|
+
case 'Enter':
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
calculateRating((focusedStar ?? starIndex) + 1);
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const currentRating = hoverRating || rating;
|
|
83
|
+
return (React.createElement(RatingContainer, { className: className, role: "group", "aria-label": "Star rating" },
|
|
84
|
+
React.createElement(VisuallyHidden, { id: `${id}-label` },
|
|
85
|
+
"Rating: ",
|
|
86
|
+
currentRating,
|
|
87
|
+
" out of ",
|
|
88
|
+
maxRating,
|
|
89
|
+
" stars"),
|
|
90
|
+
React.createElement(Stars, null,
|
|
91
|
+
[...Array(maxRating)].map((_, index) => {
|
|
92
|
+
const fillAmount = Math.max(0, Math.min(1, currentRating - index));
|
|
93
|
+
const starNumber = index + 1;
|
|
94
|
+
const handleClick = () => {
|
|
95
|
+
// tap devices cannot use hover rating
|
|
96
|
+
const crossDeviceFillAmount = hoverRating ? fillAmount : 1;
|
|
97
|
+
calculateRating(index + crossDeviceFillAmount);
|
|
98
|
+
};
|
|
99
|
+
return (React.createElement(StarContainer, { key: index, onClick: handleClick, onMouseMove: e => handleMouseMove(e, index), onMouseLeave: handleMouseLeave, onKeyDown: e => handleKeyDown(e, index), onFocus: () => setFocusedStar(index), onBlur: () => setFocusedStar(null), tabIndex: 0, role: "radio", "aria-checked": rating >= starNumber, "aria-label": `${starNumber} star${starNumber === 1 ? '' : 's'}`, "aria-describedby": `${id}-label`, name: name, type: "button" },
|
|
100
|
+
React.createElement(StarIcon, { label: "background star", width: size, height: size, color: theme.color.surface.disabled, "aria-hidden": "true" }),
|
|
101
|
+
React.createElement(StarOverlay, { "$fillAmount": fillAmount },
|
|
102
|
+
React.createElement(StarIcon, { label: "filled star", width: size, height: size, color: color || theme.color.surface.selected, "aria-hidden": "true" }))));
|
|
103
|
+
}),
|
|
104
|
+
displayNumber && (React.createElement(Rating, { "aria-hidden": "true", tag: "span" }, currentRating || 0))),
|
|
105
|
+
displayTextRatings && (React.createElement(TextRating, null, ratings[Math.ceil(currentRating - 1)]))));
|
|
106
|
+
};
|
|
107
|
+
export default StarRating;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const RatingContainer: 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 Stars: 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 StarContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
4
|
+
isFocused?: boolean;
|
|
5
|
+
}>> & string;
|
|
6
|
+
export declare const StarOverlay: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
7
|
+
$fillAmount: number;
|
|
8
|
+
}>> & string;
|
|
9
|
+
export declare const Rating: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("@a-little-world/little-world-design-system-core").TextBaseProps & {
|
|
10
|
+
className?: string;
|
|
11
|
+
disableParser?: boolean;
|
|
12
|
+
id?: string;
|
|
13
|
+
style?: import("react").CSSProperties;
|
|
14
|
+
tag?: "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "li" | "label" | "span" | "strong" | "div";
|
|
15
|
+
}, never>> & string & Omit<({ bold, center, children, color, className, disableParser, id, style, tag, type, }: import("@a-little-world/little-world-design-system-core").TextBaseProps & {
|
|
16
|
+
className?: string;
|
|
17
|
+
disableParser?: boolean;
|
|
18
|
+
id?: string;
|
|
19
|
+
style?: import("react").CSSProperties;
|
|
20
|
+
tag?: "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "li" | "label" | "span" | "strong" | "div";
|
|
21
|
+
}) => import("react").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
22
|
+
export declare const TextRating: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("@a-little-world/little-world-design-system-core").TextBaseProps & {
|
|
23
|
+
className?: string;
|
|
24
|
+
disableParser?: boolean;
|
|
25
|
+
id?: string;
|
|
26
|
+
style?: import("react").CSSProperties;
|
|
27
|
+
tag?: "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "li" | "label" | "span" | "strong" | "div";
|
|
28
|
+
}, never>> & string & Omit<({ bold, center, children, color, className, disableParser, id, style, tag, type, }: import("@a-little-world/little-world-design-system-core").TextBaseProps & {
|
|
29
|
+
className?: string;
|
|
30
|
+
disableParser?: boolean;
|
|
31
|
+
id?: string;
|
|
32
|
+
style?: import("react").CSSProperties;
|
|
33
|
+
tag?: "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "li" | "label" | "span" | "strong" | "div";
|
|
34
|
+
}) => import("react").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
35
|
+
export declare const VisuallyHidden: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|