reshaped 1.0.1 → 2.2.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/CHANGELOG.md +12 -0
- package/LICENSE.md +37 -0
- package/bin/clean.sh +2 -0
- package/bin/cli.js +78 -0
- package/bin/copy-release.sh +8 -0
- package/bundle.css +1 -0
- package/bundle.d.ts +120 -0
- package/bundle.js +27 -0
- package/cli/theming/definitions/base.d.ts +3 -0
- package/cli/theming/definitions/base.js +11 -0
- package/cli/theming/definitions/figma.d.ts +3 -0
- package/cli/theming/definitions/figma.js +180 -0
- package/cli/theming/definitions/minimal.d.ts +3 -0
- package/cli/theming/definitions/minimal.js +80 -0
- package/cli/theming/definitions/reshaped.d.ts +3 -0
- package/cli/theming/definitions/reshaped.js +188 -0
- package/cli/theming/definitions/slate.d.ts +3 -0
- package/cli/theming/definitions/slate.js +80 -0
- package/cli/theming/index.d.ts +4 -0
- package/cli/theming/index.js +140 -0
- package/cli/theming/reshaped.config.d.ts +3 -0
- package/cli/theming/reshaped.config.js +25 -0
- package/cli/theming/tokens/color/color.transforms.d.ts +4 -0
- package/cli/theming/tokens/color/color.transforms.js +20 -0
- package/cli/theming/tokens/color/color.types.d.ts +7 -0
- package/cli/theming/tokens/color/color.types.js +2 -0
- package/cli/theming/tokens/duration/duration.transforms.d.ts +4 -0
- package/cli/theming/tokens/duration/duration.transforms.js +11 -0
- package/cli/theming/tokens/duration/duration.types.d.ts +4 -0
- package/cli/theming/tokens/duration/duration.types.js +2 -0
- package/cli/theming/tokens/easing/easing.transforms.d.ts +4 -0
- package/cli/theming/tokens/easing/easing.transforms.js +11 -0
- package/cli/theming/tokens/easing/easing.types.d.ts +7 -0
- package/cli/theming/tokens/easing/easing.types.js +2 -0
- package/cli/theming/tokens/font/font.transforms.d.ts +4 -0
- package/cli/theming/tokens/font/font.transforms.js +36 -0
- package/cli/theming/tokens/font/font.types.d.ts +10 -0
- package/cli/theming/tokens/font/font.types.js +2 -0
- package/cli/theming/tokens/fontFamily/fontFamily.transforms.d.ts +4 -0
- package/cli/theming/tokens/fontFamily/fontFamily.transforms.js +11 -0
- package/cli/theming/tokens/fontFamily/fontFamily.types.d.ts +4 -0
- package/cli/theming/tokens/fontFamily/fontFamily.types.js +2 -0
- package/cli/theming/tokens/fontWeight/fontWeight.transforms.d.ts +4 -0
- package/cli/theming/tokens/fontWeight/fontWeight.transforms.js +11 -0
- package/cli/theming/tokens/fontWeight/fontWeight.types.d.ts +4 -0
- package/cli/theming/tokens/fontWeight/fontWeight.types.js +2 -0
- package/cli/theming/tokens/shadow/shadow.transforms.d.ts +4 -0
- package/cli/theming/tokens/shadow/shadow.transforms.js +20 -0
- package/cli/theming/tokens/shadow/shadow.types.d.ts +13 -0
- package/cli/theming/tokens/shadow/shadow.types.js +2 -0
- package/cli/theming/tokens/transforms.d.ts +11 -0
- package/cli/theming/tokens/transforms.js +26 -0
- package/cli/theming/tokens/types.d.ts +52 -0
- package/cli/theming/tokens/types.js +2 -0
- package/cli/theming/tokens/unit/unit.transforms.d.ts +4 -0
- package/cli/theming/tokens/unit/unit.transforms.js +11 -0
- package/cli/theming/tokens/unit/unit.types.d.ts +7 -0
- package/cli/theming/tokens/unit/unit.types.js +2 -0
- package/cli/theming/tokens/viewport/viewport.transforms.d.ts +4 -0
- package/cli/theming/tokens/viewport/viewport.transforms.js +18 -0
- package/cli/theming/tokens/viewport/viewport.types.d.ts +5 -0
- package/cli/theming/tokens/viewport/viewport.types.js +2 -0
- package/cli/theming/types.d.ts +14 -0
- package/cli/theming/types.js +2 -0
- package/cli/theming/utilities/css.d.ts +6 -0
- package/cli/theming/utilities/css.js +50 -0
- package/cli/theming/utilities/mergeDeep.d.ts +5 -0
- package/cli/theming/utilities/mergeDeep.js +24 -0
- package/cli/theming/utilities/mergeDefinitions.d.ts +5 -0
- package/cli/theming/utilities/mergeDefinitions.js +17 -0
- package/cli/theming/utilities/resolveTokenReference.d.ts +3 -0
- package/cli/theming/utilities/resolveTokenReference.js +16 -0
- package/cli/utilities/color.d.ts +15 -0
- package/cli/utilities/color.js +39 -0
- package/cli/utilities/string.d.ts +2 -0
- package/cli/utilities/string.js +11 -0
- package/cli/utilities/tests/color.test.d.ts +1 -0
- package/cli/utilities/tests/color.test.js +63 -0
- package/components/Accordion/Accordion.context.d.ts +4 -0
- package/components/Accordion/Accordion.context.js +9 -0
- package/components/Accordion/Accordion.d.ts +8 -0
- package/components/Accordion/Accordion.js +14 -0
- package/components/Accordion/Accordion.module.css +1 -0
- package/components/Accordion/Accordion.types.d.ts +39 -0
- package/components/Accordion/Accordion.types.js +1 -0
- package/components/Accordion/AccordionContent.d.ts +4 -0
- package/components/Accordion/AccordionContent.js +43 -0
- package/components/Accordion/AccordionControlled.d.ts +4 -0
- package/components/Accordion/AccordionControlled.js +23 -0
- package/components/Accordion/AccordionTrigger.d.ts +4 -0
- package/components/Accordion/AccordionTrigger.js +26 -0
- package/components/Accordion/AccordionUncontrolled.d.ts +4 -0
- package/components/Accordion/AccordionUncontrolled.js +24 -0
- package/components/Accordion/index.d.ts +2 -0
- package/components/Accordion/index.js +1 -0
- package/components/Accordion/tests/Accordion.stories.d.ts +9 -0
- package/components/Accordion/tests/Accordion.stories.js +119 -0
- package/components/ActionBar/ActionBar.d.ts +4 -0
- package/components/ActionBar/ActionBar.js +10 -0
- package/components/ActionBar/ActionBar.module.css +1 -0
- package/components/ActionBar/ActionBar.types.d.ts +10 -0
- package/components/ActionBar/ActionBar.types.js +1 -0
- package/components/ActionBar/index.d.ts +2 -0
- package/components/ActionBar/index.js +1 -0
- package/components/ActionBar/tests/ActionBar.stories.d.ts +8 -0
- package/components/ActionBar/tests/ActionBar.stories.js +43 -0
- package/components/Actionable/Actionable.d.ts +4 -0
- package/components/Actionable/Actionable.js +54 -0
- package/components/Actionable/Actionable.module.css +1 -0
- package/components/Actionable/Actionable.types.d.ts +18 -0
- package/components/Actionable/Actionable.types.js +1 -0
- package/components/Actionable/index.d.ts +2 -0
- package/components/Actionable/index.js +1 -0
- package/components/Actionable/tests/Actionable.stories.d.ts +9 -0
- package/components/Actionable/tests/Actionable.stories.js +56 -0
- package/components/Alert/Alert.d.ts +4 -0
- package/components/Alert/Alert.js +31 -0
- package/components/Alert/Alert.types.d.ts +14 -0
- package/components/Alert/Alert.types.js +1 -0
- package/components/Alert/index.d.ts +2 -0
- package/components/Alert/index.js +1 -0
- package/components/Alert/tests/Alert.stories.d.ts +8 -0
- package/components/Alert/tests/Alert.stories.js +78 -0
- package/components/Autocomplete/Autocomplete.d.ts +7 -0
- package/components/Autocomplete/Autocomplete.js +69 -0
- package/components/Autocomplete/Autocomplete.types.d.ts +17 -0
- package/components/Autocomplete/Autocomplete.types.js +1 -0
- package/components/Autocomplete/index.d.ts +2 -0
- package/components/Autocomplete/index.js +1 -0
- package/components/Autocomplete/tests/Autocomplete.stories.d.ts +6 -0
- package/components/Autocomplete/tests/Autocomplete.stories.js +21 -0
- package/components/Avatar/Avatar.d.ts +4 -0
- package/components/Avatar/Avatar.js +29 -0
- package/components/Avatar/Avatar.module.css +1 -0
- package/components/Avatar/Avatar.types.d.ts +30 -0
- package/components/Avatar/Avatar.types.js +1 -0
- package/components/Avatar/index.d.ts +2 -0
- package/components/Avatar/index.js +1 -0
- package/components/Avatar/tests/Avatar.stories.d.ts +9 -0
- package/components/Avatar/tests/Avatar.stories.js +83 -0
- package/components/Badge/Badge.d.ts +7 -0
- package/components/Badge/Badge.js +24 -0
- package/components/Badge/Badge.module.css +1 -0
- package/components/Badge/Badge.types.d.ts +39 -0
- package/components/Badge/Badge.types.js +1 -0
- package/components/Badge/BadgeContainer.d.ts +4 -0
- package/components/Badge/BadgeContainer.js +9 -0
- package/components/Badge/index.d.ts +2 -0
- package/components/Badge/index.js +1 -0
- package/components/Badge/tests/Badge.stories.d.ts +13 -0
- package/components/Badge/tests/Badge.stories.js +222 -0
- package/components/Breadcrumbs/Breadcrumbs.d.ts +7 -0
- package/components/Breadcrumbs/Breadcrumbs.js +54 -0
- package/components/Breadcrumbs/Breadcrumbs.types.d.ts +13 -0
- package/components/Breadcrumbs/Breadcrumbs.types.js +1 -0
- package/components/Breadcrumbs/index.d.ts +2 -0
- package/components/Breadcrumbs/index.js +1 -0
- package/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +10 -0
- package/components/Breadcrumbs/tests/Breadcrumbs.stories.js +95 -0
- package/components/Button/Button.d.ts +3 -0
- package/components/Button/Button.js +37 -0
- package/components/Button/Button.module.css +1 -0
- package/components/Button/Button.types.d.ts +31 -0
- package/components/Button/Button.types.js +1 -0
- package/components/Button/ButtonAligner.d.ts +4 -0
- package/components/Button/ButtonAligner.js +13 -0
- package/components/Button/index.d.ts +2 -0
- package/components/Button/index.js +1 -0
- package/components/Button/tests/Button.stories.d.ts +15 -0
- package/components/Button/tests/Button.stories.js +565 -0
- package/components/Card/Card.d.ts +17 -0
- package/components/Card/Card.js +31 -0
- package/components/Card/Card.module.css +1 -0
- package/components/Card/Card.types.d.ts +16 -0
- package/components/Card/Card.types.js +1 -0
- package/components/Card/index.d.ts +2 -0
- package/components/Card/index.js +1 -0
- package/components/Card/tests/Card.stories.d.ts +12 -0
- package/components/Card/tests/Card.stories.js +83 -0
- package/components/Carousel/Carousel.d.ts +4 -0
- package/components/Carousel/Carousel.js +67 -0
- package/components/Carousel/Carousel.module.css +1 -0
- package/components/Carousel/Carousel.types.d.ts +28 -0
- package/components/Carousel/Carousel.types.js +5 -0
- package/components/Carousel/CarouselControl.d.ts +4 -0
- package/components/Carousel/CarouselControl.js +42 -0
- package/components/Carousel/index.d.ts +2 -0
- package/components/Carousel/index.js +1 -0
- package/components/Carousel/tests/Carousel.stories.d.ts +9 -0
- package/components/Carousel/tests/Carousel.stories.js +119 -0
- package/components/Checkbox/Checkbox.d.ts +4 -0
- package/components/Checkbox/Checkbox.js +44 -0
- package/components/Checkbox/Checkbox.module.css +1 -0
- package/components/Checkbox/Checkbox.types.d.ts +26 -0
- package/components/Checkbox/Checkbox.types.js +1 -0
- package/components/Checkbox/index.d.ts +2 -0
- package/components/Checkbox/index.js +1 -0
- package/components/Checkbox/tests/Checkbox.stories.d.ts +8 -0
- package/components/Checkbox/tests/Checkbox.stories.js +53 -0
- package/components/CheckboxGroup/CheckboxGroup.context.d.ts +5 -0
- package/components/CheckboxGroup/CheckboxGroup.context.js +5 -0
- package/components/CheckboxGroup/CheckboxGroup.d.ts +4 -0
- package/components/CheckboxGroup/CheckboxGroup.js +10 -0
- package/components/CheckboxGroup/CheckboxGroup.types.d.ts +28 -0
- package/components/CheckboxGroup/CheckboxGroup.types.js +1 -0
- package/components/CheckboxGroup/CheckboxGroupControlled.d.ts +4 -0
- package/components/CheckboxGroup/CheckboxGroupControlled.js +22 -0
- package/components/CheckboxGroup/CheckboxGroupUncontrolled.d.ts +4 -0
- package/components/CheckboxGroup/CheckboxGroupUncontrolled.js +16 -0
- package/components/CheckboxGroup/index.d.ts +3 -0
- package/components/CheckboxGroup/index.js +2 -0
- package/components/CheckboxGroup/tests/CheckboxGroup.stories.d.ts +7 -0
- package/components/CheckboxGroup/tests/CheckboxGroup.stories.js +44 -0
- package/components/Container/Container.d.ts +4 -0
- package/components/Container/Container.js +10 -0
- package/components/Container/Container.module.css +1 -0
- package/components/Container/Container.types.d.ts +9 -0
- package/components/Container/Container.types.js +1 -0
- package/components/Container/index.d.ts +2 -0
- package/components/Container/index.js +1 -0
- package/components/Container/tests/Container.stories.d.ts +7 -0
- package/components/Container/tests/Container.stories.js +28 -0
- package/components/Dismissible/Dismissible.d.ts +4 -0
- package/components/Dismissible/Dismissible.js +15 -0
- package/components/Dismissible/Dismissible.module.css +1 -0
- package/components/Dismissible/Dismissible.types.d.ts +20 -0
- package/components/Dismissible/Dismissible.types.js +1 -0
- package/components/Dismissible/index.d.ts +2 -0
- package/components/Dismissible/index.js +1 -0
- package/components/Dismissible/tests/Dismissible.stories.d.ts +8 -0
- package/components/Dismissible/tests/Dismissible.stories.js +44 -0
- package/components/Divider/Divider.d.ts +4 -0
- package/components/Divider/Divider.js +14 -0
- package/components/Divider/Divider.module.css +1 -0
- package/components/Divider/Divider.types.d.ts +7 -0
- package/components/Divider/Divider.types.js +1 -0
- package/components/Divider/index.d.ts +2 -0
- package/components/Divider/index.js +1 -0
- package/components/Divider/tests/Divider.stories.d.ts +7 -0
- package/components/Divider/tests/Divider.stories.js +36 -0
- package/components/DropdownMenu/DropdownMenu.d.ts +13 -0
- package/components/DropdownMenu/DropdownMenu.js +90 -0
- package/components/DropdownMenu/DropdownMenu.module.css +1 -0
- package/components/DropdownMenu/DropdownMenu.types.d.ts +16 -0
- package/components/DropdownMenu/DropdownMenu.types.js +1 -0
- package/components/DropdownMenu/index.d.ts +2 -0
- package/components/DropdownMenu/index.js +1 -0
- package/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +11 -0
- package/components/DropdownMenu/tests/DropdownMenu.stories.js +138 -0
- package/components/FormControl/FormControl.context.d.ts +281 -0
- package/components/FormControl/FormControl.context.js +18 -0
- package/components/FormControl/FormControl.d.ts +9 -0
- package/components/FormControl/FormControl.js +68 -0
- package/components/FormControl/FormControl.module.css +1 -0
- package/components/FormControl/FormControl.types.d.ts +33 -0
- package/components/FormControl/FormControl.types.js +1 -0
- package/components/FormControl/index.d.ts +3 -0
- package/components/FormControl/index.js +2 -0
- package/components/FormControl/tests/FormControl.stories.d.ts +10 -0
- package/components/FormControl/tests/FormControl.stories.js +78 -0
- package/components/Hidden/Hidden.d.ts +4 -0
- package/components/Hidden/Hidden.js +11 -0
- package/components/Hidden/Hidden.module.css +1 -0
- package/components/Hidden/Hidden.types.d.ts +9 -0
- package/components/Hidden/Hidden.types.js +1 -0
- package/components/Hidden/index.d.ts +2 -0
- package/components/Hidden/index.js +1 -0
- package/components/Hidden/tests/Hidden.stories.d.ts +7 -0
- package/components/Hidden/tests/Hidden.stories.js +39 -0
- package/components/HiddenVisually/HiddenVisually.d.ts +4 -0
- package/components/HiddenVisually/HiddenVisually.js +7 -0
- package/components/HiddenVisually/HiddenVisually.module.css +1 -0
- package/components/HiddenVisually/HiddenVisually.types.d.ts +4 -0
- package/components/HiddenVisually/HiddenVisually.types.js +1 -0
- package/components/HiddenVisually/index.d.ts +2 -0
- package/components/HiddenVisually/index.js +1 -0
- package/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +6 -0
- package/components/HiddenVisually/tests/HiddenVisually.stories.js +9 -0
- package/components/Hotkey/Hotkey.d.ts +4 -0
- package/components/Hotkey/Hotkey.js +10 -0
- package/components/Hotkey/Hotkey.module.css +1 -0
- package/components/Hotkey/Hotkey.types.d.ts +8 -0
- package/components/Hotkey/Hotkey.types.js +1 -0
- package/components/Hotkey/index.d.ts +2 -0
- package/components/Hotkey/index.js +1 -0
- package/components/Hotkey/tests/Hotkey.stories.d.ts +6 -0
- package/components/Hotkey/tests/Hotkey.stories.js +26 -0
- package/components/Icon/Icon.d.ts +4 -0
- package/components/Icon/Icon.js +15 -0
- package/components/Icon/Icon.module.css +1 -0
- package/components/Icon/Icon.types.d.ts +10 -0
- package/components/Icon/Icon.types.js +1 -0
- package/components/Icon/index.d.ts +2 -0
- package/components/Icon/index.js +1 -0
- package/components/Icon/tests/Icon.stories.d.ts +8 -0
- package/components/Icon/tests/Icon.stories.js +69 -0
- package/components/Image/Image.d.ts +4 -0
- package/components/Image/Image.js +37 -0
- package/components/Image/Image.module.css +1 -0
- package/components/Image/Image.types.d.ts +19 -0
- package/components/Image/Image.types.js +1 -0
- package/components/Image/index.d.ts +2 -0
- package/components/Image/index.js +1 -0
- package/components/Image/tests/Image.stories.d.ts +10 -0
- package/components/Image/tests/Image.stories.js +90 -0
- package/components/Link/Link.d.ts +7 -0
- package/components/Link/Link.js +13 -0
- package/components/Link/Link.module.css +1 -0
- package/components/Link/Link.types.d.ts +7 -0
- package/components/Link/Link.types.js +1 -0
- package/components/Link/index.d.ts +2 -0
- package/components/Link/index.js +1 -0
- package/components/Link/tests/Link.stories.d.ts +10 -0
- package/components/Link/tests/Link.stories.js +62 -0
- package/components/Loader/Loader.d.ts +4 -0
- package/components/Loader/Loader.js +11 -0
- package/components/Loader/Loader.module.css +1 -0
- package/components/Loader/Loader.types.d.ts +7 -0
- package/components/Loader/Loader.types.js +1 -0
- package/components/Loader/index.d.ts +2 -0
- package/components/Loader/index.js +1 -0
- package/components/Loader/tests/Loader.stories.d.ts +7 -0
- package/components/Loader/tests/Loader.stories.js +29 -0
- package/components/MenuItem/MenuItem.d.ts +3 -0
- package/components/MenuItem/MenuItem.js +22 -0
- package/components/MenuItem/MenuItem.module.css +1 -0
- package/components/MenuItem/MenuItem.types.d.ts +23 -0
- package/components/MenuItem/MenuItem.types.js +1 -0
- package/components/MenuItem/MenuItemAligner.d.ts +4 -0
- package/components/MenuItem/MenuItemAligner.js +9 -0
- package/components/MenuItem/index.d.ts +2 -0
- package/components/MenuItem/index.js +1 -0
- package/components/MenuItem/tests/MenuItem.stories.d.ts +12 -0
- package/components/MenuItem/tests/MenuItem.stories.js +122 -0
- package/components/Modal/Modal.d.ts +8 -0
- package/components/Modal/Modal.js +56 -0
- package/components/Modal/Modal.module.css +1 -0
- package/components/Modal/Modal.types.d.ts +26 -0
- package/components/Modal/Modal.types.js +1 -0
- package/components/Modal/index.d.ts +2 -0
- package/components/Modal/index.js +1 -0
- package/components/Modal/tests/Modal.stories.d.ts +11 -0
- package/components/Modal/tests/Modal.stories.js +145 -0
- package/components/Overlay/Overlay.d.ts +4 -0
- package/components/Overlay/Overlay.js +110 -0
- package/components/Overlay/Overlay.module.css +1 -0
- package/components/Overlay/Overlay.types.d.ts +12 -0
- package/components/Overlay/Overlay.types.js +1 -0
- package/components/Overlay/index.d.ts +2 -0
- package/components/Overlay/index.js +1 -0
- package/components/Overlay/tests/Overlay.stories.d.ts +6 -0
- package/components/Overlay/tests/Overlay.stories.js +27 -0
- package/components/Popover/Popover.d.ts +8 -0
- package/components/Popover/Popover.js +19 -0
- package/components/Popover/Popover.module.css +1 -0
- package/components/Popover/Popover.types.d.ts +7 -0
- package/components/Popover/Popover.types.js +1 -0
- package/components/Popover/index.d.ts +2 -0
- package/components/Popover/index.js +1 -0
- package/components/Popover/tests/Popover.stories.d.ts +10 -0
- package/components/Popover/tests/Popover.stories.js +99 -0
- package/components/Progress/Progress.d.ts +4 -0
- package/components/Progress/Progress.js +18 -0
- package/components/Progress/Progress.module.css +1 -0
- package/components/Progress/Progress.types.d.ts +11 -0
- package/components/Progress/Progress.types.js +1 -0
- package/components/Progress/index.d.ts +2 -0
- package/components/Progress/index.js +1 -0
- package/components/Progress/tests/Progress.stories.d.ts +9 -0
- package/components/Progress/tests/Progress.stories.js +55 -0
- package/components/Radio/Radio.d.ts +4 -0
- package/components/Radio/Radio.js +35 -0
- package/components/Radio/Radio.module.css +1 -0
- package/components/Radio/Radio.types.d.ts +25 -0
- package/components/Radio/Radio.types.js +1 -0
- package/components/Radio/index.d.ts +2 -0
- package/components/Radio/index.js +1 -0
- package/components/Radio/tests/Radio.stories.d.ts +8 -0
- package/components/Radio/tests/Radio.stories.js +42 -0
- package/components/RadioGroup/RadioGroup.context.d.ts +5 -0
- package/components/RadioGroup/RadioGroup.context.js +5 -0
- package/components/RadioGroup/RadioGroup.d.ts +4 -0
- package/components/RadioGroup/RadioGroup.js +10 -0
- package/components/RadioGroup/RadioGroup.types.d.ts +28 -0
- package/components/RadioGroup/RadioGroup.types.js +1 -0
- package/components/RadioGroup/RadioGroupControlled.d.ts +4 -0
- package/components/RadioGroup/RadioGroupControlled.js +14 -0
- package/components/RadioGroup/RadioGroupUncontrolled.d.ts +4 -0
- package/components/RadioGroup/RadioGroupUncontrolled.js +16 -0
- package/components/RadioGroup/index.d.ts +3 -0
- package/components/RadioGroup/index.js +2 -0
- package/components/RadioGroup/tests/RadioGroup.stories.d.ts +7 -0
- package/components/RadioGroup/tests/RadioGroup.stories.js +44 -0
- package/components/Reshaped/Reshaped.css +1 -0
- package/components/Reshaped/Reshaped.d.ts +5 -0
- package/components/Reshaped/Reshaped.js +26 -0
- package/components/Reshaped/Reshaped.module.css +1 -0
- package/components/Reshaped/Reshaped.types.d.ts +14 -0
- package/components/Reshaped/Reshaped.types.js +1 -0
- package/components/Reshaped/index.d.ts +2 -0
- package/components/Reshaped/index.js +1 -0
- package/components/Scrim/Scrim.d.ts +4 -0
- package/components/Scrim/Scrim.js +13 -0
- package/components/Scrim/Scrim.module.css +1 -0
- package/components/Scrim/Scrim.types.d.ts +11 -0
- package/components/Scrim/Scrim.types.js +1 -0
- package/components/Scrim/index.d.ts +2 -0
- package/components/Scrim/index.js +1 -0
- package/components/Scrim/tests/Scrim.stories.d.ts +7 -0
- package/components/Scrim/tests/Scrim.stories.js +40 -0
- package/components/Select/Select.d.ts +4 -0
- package/components/Select/Select.js +59 -0
- package/components/Select/Select.module.css +1 -0
- package/components/Select/Select.types.d.ts +49 -0
- package/components/Select/Select.types.js +1 -0
- package/components/Select/index.d.ts +2 -0
- package/components/Select/index.js +1 -0
- package/components/Select/tests/Select.stories.d.ts +14 -0
- package/components/Select/tests/Select.stories.js +165 -0
- package/components/Skeleton/Skeleton.d.ts +4 -0
- package/components/Skeleton/Skeleton.js +10 -0
- package/components/Skeleton/Skeleton.module.css +1 -0
- package/components/Skeleton/Skeleton.types.d.ts +6 -0
- package/components/Skeleton/Skeleton.types.js +1 -0
- package/components/Skeleton/index.d.ts +2 -0
- package/components/Skeleton/index.js +1 -0
- package/components/Skeleton/tests/Skeleton.stories.d.ts +7 -0
- package/components/Skeleton/tests/Skeleton.stories.js +38 -0
- package/components/Slider/Slider.d.ts +4 -0
- package/components/Slider/Slider.js +26 -0
- package/components/Slider/Slider.module.css +1 -0
- package/components/Slider/Slider.types.d.ts +78 -0
- package/components/Slider/Slider.types.js +1 -0
- package/components/Slider/SliderControlled.d.ts +4 -0
- package/components/Slider/SliderControlled.js +172 -0
- package/components/Slider/SliderThumb.d.ts +4 -0
- package/components/Slider/SliderThumb.js +21 -0
- package/components/Slider/SliderUncontrolled.d.ts +4 -0
- package/components/Slider/SliderUncontrolled.js +32 -0
- package/components/Slider/index.d.ts +2 -0
- package/components/Slider/index.js +1 -0
- package/components/Slider/tests/Slider.stories.d.ts +10 -0
- package/components/Slider/tests/Slider.stories.js +42 -0
- package/components/Switch/Switch.d.ts +4 -0
- package/components/Switch/Switch.js +31 -0
- package/components/Switch/Switch.module.css +1 -0
- package/components/Switch/Switch.types.d.ts +26 -0
- package/components/Switch/Switch.types.js +1 -0
- package/components/Switch/index.d.ts +2 -0
- package/components/Switch/index.js +1 -0
- package/components/Switch/tests/Switch.stories.d.ts +9 -0
- package/components/Switch/tests/Switch.stories.js +53 -0
- package/components/Tabs/Tabs.d.ts +16 -0
- package/components/Tabs/Tabs.js +16 -0
- package/components/Tabs/Tabs.module.css +1 -0
- package/components/Tabs/Tabs.types.d.ts +61 -0
- package/components/Tabs/Tabs.types.js +1 -0
- package/components/Tabs/TabsContext.d.ts +18 -0
- package/components/Tabs/TabsContext.js +19 -0
- package/components/Tabs/TabsControlled.d.ts +4 -0
- package/components/Tabs/TabsControlled.js +16 -0
- package/components/Tabs/TabsItem.d.ts +11 -0
- package/components/Tabs/TabsItem.js +31 -0
- package/components/Tabs/TabsList.d.ts +4 -0
- package/components/Tabs/TabsList.js +163 -0
- package/components/Tabs/TabsPanel.d.ts +4 -0
- package/components/Tabs/TabsPanel.js +13 -0
- package/components/Tabs/TabsUncontrolled.d.ts +4 -0
- package/components/Tabs/TabsUncontrolled.js +18 -0
- package/components/Tabs/index.d.ts +2 -0
- package/components/Tabs/index.js +1 -0
- package/components/Tabs/tests/Tabs.stories.d.ts +13 -0
- package/components/Tabs/tests/Tabs.stories.js +251 -0
- package/components/Text/Text.d.ts +4 -0
- package/components/Text/Text.js +24 -0
- package/components/Text/Text.module.css +1 -0
- package/components/Text/Text.types.d.ts +15 -0
- package/components/Text/Text.types.js +1 -0
- package/components/Text/index.d.ts +2 -0
- package/components/Text/index.js +1 -0
- package/components/Text/tests/Text.stories.d.ts +11 -0
- package/components/Text/tests/Text.stories.js +117 -0
- package/components/TextArea/TextArea.d.ts +4 -0
- package/components/TextArea/TextArea.js +25 -0
- package/components/TextArea/TextArea.module.css +1 -0
- package/components/TextArea/TextArea.types.d.ts +28 -0
- package/components/TextArea/TextArea.types.js +1 -0
- package/components/TextArea/index.d.ts +2 -0
- package/components/TextArea/index.js +1 -0
- package/components/TextArea/tests/TextArea.stories.d.ts +11 -0
- package/components/TextArea/tests/TextArea.stories.js +72 -0
- package/components/TextField/TextField.d.ts +4 -0
- package/components/TextField/TextField.js +47 -0
- package/components/TextField/TextField.module.css +1 -0
- package/components/TextField/TextField.types.d.ts +42 -0
- package/components/TextField/TextField.types.js +1 -0
- package/components/TextField/index.d.ts +2 -0
- package/components/TextField/index.js +1 -0
- package/components/TextField/tests/TextField.stories.d.ts +14 -0
- package/components/TextField/tests/TextField.stories.js +100 -0
- package/components/Theme/GlobalColorMode.d.ts +4 -0
- package/components/Theme/GlobalColorMode.js +31 -0
- package/components/Theme/Theme.context.d.ts +4 -0
- package/components/Theme/Theme.context.js +14 -0
- package/components/Theme/Theme.d.ts +4 -0
- package/components/Theme/Theme.js +39 -0
- package/components/Theme/Theme.module.css +1 -0
- package/components/Theme/Theme.types.d.ts +24 -0
- package/components/Theme/Theme.types.js +1 -0
- package/components/Theme/index.d.ts +4 -0
- package/components/Theme/index.js +3 -0
- package/components/Theme/tests/Theme.stories.d.ts +7 -0
- package/components/Theme/tests/Theme.stories.js +40 -0
- package/components/Theme/useTheme.d.ts +8 -0
- package/components/Theme/useTheme.js +18 -0
- package/components/Timeline/Timeline.d.ts +7 -0
- package/components/Timeline/Timeline.js +21 -0
- package/components/Timeline/Timeline.module.css +1 -0
- package/components/Timeline/Timeline.types.d.ts +13 -0
- package/components/Timeline/Timeline.types.js +1 -0
- package/components/Timeline/index.d.ts +2 -0
- package/components/Timeline/index.js +1 -0
- package/components/Timeline/tests/Timeline.stories.d.ts +7 -0
- package/components/Timeline/tests/Timeline.stories.js +55 -0
- package/components/Toast/Toast.constants.d.ts +10 -0
- package/components/Toast/Toast.constants.js +20 -0
- package/components/Toast/Toast.context.d.ts +4 -0
- package/components/Toast/Toast.context.js +5 -0
- package/components/Toast/Toast.d.ts +6 -0
- package/components/Toast/Toast.js +55 -0
- package/components/Toast/Toast.module.css +1 -0
- package/components/Toast/Toast.types.d.ts +77 -0
- package/components/Toast/Toast.types.js +1 -0
- package/components/Toast/ToastContainer.d.ts +4 -0
- package/components/Toast/ToastContainer.js +97 -0
- package/components/Toast/ToastProvider.d.ts +4 -0
- package/components/Toast/ToastProvider.js +80 -0
- package/components/Toast/ToastRegion.d.ts +4 -0
- package/components/Toast/ToastRegion.js +63 -0
- package/components/Toast/index.d.ts +3 -0
- package/components/Toast/index.js +2 -0
- package/components/Toast/tests/Toast.stories.d.ts +13 -0
- package/components/Toast/tests/Toast.stories.js +304 -0
- package/components/Toast/useToast.d.ts +5 -0
- package/components/Toast/useToast.js +8 -0
- package/components/Tooltip/Tooltip.d.ts +4 -0
- package/components/Tooltip/Tooltip.js +15 -0
- package/components/Tooltip/Tooltip.module.css +1 -0
- package/components/Tooltip/Tooltip.types.d.ts +5 -0
- package/components/Tooltip/Tooltip.types.js +1 -0
- package/components/Tooltip/index.d.ts +2 -0
- package/components/Tooltip/index.js +1 -0
- package/components/Tooltip/tests/Tooltip.stories.d.ts +7 -0
- package/components/Tooltip/tests/Tooltip.stories.js +58 -0
- package/components/View/View.d.ts +7 -0
- package/components/View/View.js +135 -0
- package/components/View/View.module.css +1 -0
- package/components/View/View.types.d.ts +64 -0
- package/components/View/View.types.js +1 -0
- package/components/View/index.d.ts +2 -0
- package/components/View/index.js +1 -0
- package/components/View/tests/View.stories.d.ts +32 -0
- package/components/View/tests/View.stories.js +1015 -0
- package/components/_private/Flyout/Flyout.context.d.ts +6 -0
- package/components/_private/Flyout/Flyout.context.js +6 -0
- package/components/_private/Flyout/Flyout.d.ts +8 -0
- package/components/_private/Flyout/Flyout.js +14 -0
- package/components/_private/Flyout/Flyout.module.css +1 -0
- package/components/_private/Flyout/Flyout.types.d.ts +77 -0
- package/components/_private/Flyout/Flyout.types.js +1 -0
- package/components/_private/Flyout/FlyoutContent.d.ts +4 -0
- package/components/_private/Flyout/FlyoutContent.js +40 -0
- package/components/_private/Flyout/FlyoutControlled.d.ts +4 -0
- package/components/_private/Flyout/FlyoutControlled.js +214 -0
- package/components/_private/Flyout/FlyoutTrigger.d.ts +4 -0
- package/components/_private/Flyout/FlyoutTrigger.js +47 -0
- package/components/_private/Flyout/FlyoutUncontrolled.d.ts +4 -0
- package/components/_private/Flyout/FlyoutUncontrolled.js +19 -0
- package/components/_private/Flyout/index.d.ts +3 -0
- package/components/_private/Flyout/index.js +2 -0
- package/components/_private/Flyout/tests/Flyout.stories.d.ts +16 -0
- package/components/_private/Flyout/tests/Flyout.stories.js +133 -0
- package/components/_private/HiddenInput/HiddenInput.d.ts +4 -0
- package/components/_private/HiddenInput/HiddenInput.js +9 -0
- package/components/_private/HiddenInput/HiddenInput.module.css +1 -0
- package/components/_private/HiddenInput/HiddenInput.types.d.ts +15 -0
- package/components/_private/HiddenInput/HiddenInput.types.js +1 -0
- package/components/_private/HiddenInput/index.d.ts +2 -0
- package/components/_private/HiddenInput/index.js +1 -0
- package/components/_private/Portal/Portal.d.ts +9 -0
- package/components/_private/Portal/Portal.js +21 -0
- package/components/_private/Portal/Portal.types.d.ts +6 -0
- package/components/_private/Portal/Portal.types.js +1 -0
- package/components/_private/Portal/index.d.ts +2 -0
- package/components/_private/Portal/index.js +1 -0
- package/components/_private/Portal/tests/Portal.stories.d.ts +6 -0
- package/components/_private/Portal/tests/Portal.stories.js +18 -0
- package/config/next.d.ts +5 -0
- package/config/next.js +8 -0
- package/config/postcss.d.ts +13 -0
- package/config/postcss.js +19 -0
- package/config/tailwind.d.ts +2 -0
- package/config/tailwind.js +91 -0
- package/constants/attributes.d.ts +2 -0
- package/constants/attributes.js +2 -0
- package/constants/keys.d.ts +10 -0
- package/constants/keys.js +10 -0
- package/constants/timeouts.d.ts +2 -0
- package/constants/timeouts.js +2 -0
- package/hooks/_private/useFlyout.d.ts +27 -0
- package/hooks/_private/useFlyout.js +269 -0
- package/hooks/_private/useIsDismissible.d.ts +8 -0
- package/hooks/_private/useIsDismissible.js +45 -0
- package/hooks/_private/useOnClickOutside.d.ts +3 -0
- package/hooks/_private/useOnClickOutside.js +29 -0
- package/hooks/_private/useSingletonEnvironment.d.ts +9 -0
- package/hooks/_private/useSingletonEnvironment.js +33 -0
- package/hooks/_private/useSingletonHotkeys.d.ts +34 -0
- package/hooks/_private/useSingletonHotkeys.js +191 -0
- package/hooks/_private/useSingletonKeyboardMode.d.ts +2 -0
- package/hooks/_private/useSingletonKeyboardMode.js +21 -0
- package/hooks/tests/useHotkeys.stories.d.ts +6 -0
- package/hooks/tests/useHotkeys.stories.js +25 -0
- package/hooks/tests/useResponsiveClientValue.stories.d.ts +6 -0
- package/hooks/tests/useResponsiveClientValue.stories.js +13 -0
- package/hooks/useElementId.d.ts +2 -0
- package/hooks/useElementId.js +8 -0
- package/hooks/useHotkeys.d.ts +8 -0
- package/hooks/useHotkeys.js +15 -0
- package/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
- package/hooks/useIsomorphicLayoutEffect.js +4 -0
- package/hooks/useRTL.d.ts +2 -0
- package/hooks/useRTL.js +7 -0
- package/hooks/useResponsiveClientValue.d.ts +3 -0
- package/hooks/useResponsiveClientValue.js +43 -0
- package/hooks/useScrollLock.d.ts +6 -0
- package/hooks/useScrollLock.js +44 -0
- package/hooks/useToggle.d.ts +7 -0
- package/hooks/useToggle.js +16 -0
- package/icons/ArrowUpRight.d.ts +3 -0
- package/icons/ArrowUpRight.js +7 -0
- package/icons/Checkmark.d.ts +3 -0
- package/icons/Checkmark.js +6 -0
- package/icons/ChevronDown.d.ts +3 -0
- package/icons/ChevronDown.js +6 -0
- package/icons/ChevronLeft.d.ts +3 -0
- package/icons/ChevronLeft.js +6 -0
- package/icons/ChevronRight.d.ts +3 -0
- package/icons/ChevronRight.js +6 -0
- package/icons/ChevronVertical.d.ts +3 -0
- package/icons/ChevronVertical.js +5 -0
- package/icons/Close.d.ts +3 -0
- package/icons/Close.js +7 -0
- package/icons/DotsHorizontal.d.ts +3 -0
- package/icons/DotsHorizontal.js +6 -0
- package/icons/Mic.d.ts +3 -0
- package/icons/Mic.js +9 -0
- package/icons/Zap.d.ts +3 -0
- package/icons/Zap.js +6 -0
- package/index.d.ts +120 -0
- package/index.js +68 -0
- package/package.json +155 -4
- package/styles/aspectRatio/aspectRatio.module.css +1 -0
- package/styles/aspectRatio/index.d.ts +3 -0
- package/styles/aspectRatio/index.js +9 -0
- package/styles/aspectRatio/index.test.d.ts +1 -0
- package/styles/aspectRatio/index.test.js +24 -0
- package/styles/bleed/bleed.module.css +1 -0
- package/styles/bleed/index.d.ts +3 -0
- package/styles/bleed/index.js +13 -0
- package/styles/bleed/index.test.d.ts +1 -0
- package/styles/bleed/index.test.js +24 -0
- package/styles/height/height.module.css +1 -0
- package/styles/height/index.d.ts +3 -0
- package/styles/height/index.js +10 -0
- package/styles/height/index.test.d.ts +1 -0
- package/styles/height/index.test.js +27 -0
- package/styles/inset/index.d.ts +4 -0
- package/styles/inset/index.js +14 -0
- package/styles/inset/index.test.d.ts +1 -0
- package/styles/inset/index.test.js +27 -0
- package/styles/inset/inset.module.css +1 -0
- package/styles/maxHeight/index.d.ts +3 -0
- package/styles/maxHeight/index.js +10 -0
- package/styles/maxHeight/index.test.d.ts +1 -0
- package/styles/maxHeight/index.test.js +27 -0
- package/styles/maxHeight/maxHeight.module.css +1 -0
- package/styles/maxWidth/index.d.ts +3 -0
- package/styles/maxWidth/index.js +10 -0
- package/styles/maxWidth/index.test.d.ts +1 -0
- package/styles/maxWidth/index.test.js +27 -0
- package/styles/maxWidth/maxWidth.module.css +1 -0
- package/styles/padding/index.d.ts +3 -0
- package/styles/padding/index.js +9 -0
- package/styles/padding/index.test.d.ts +1 -0
- package/styles/padding/index.test.js +24 -0
- package/styles/padding/padding.module.css +1 -0
- package/styles/position/index.d.ts +3 -0
- package/styles/position/index.js +9 -0
- package/styles/position/index.test.d.ts +1 -0
- package/styles/position/index.test.js +21 -0
- package/styles/position/position.module.css +1 -0
- package/styles/radius/index.d.ts +3 -0
- package/styles/radius/index.js +10 -0
- package/styles/radius/index.test.d.ts +1 -0
- package/styles/radius/index.test.js +24 -0
- package/styles/radius/radius.module.css +1 -0
- package/styles/types.d.ts +19 -0
- package/styles/types.js +1 -0
- package/styles/width/index.d.ts +3 -0
- package/styles/width/index.js +10 -0
- package/styles/width/index.test.d.ts +1 -0
- package/styles/width/index.test.js +27 -0
- package/styles/width/width.module.css +1 -0
- package/themes/figma/theme.css +1 -0
- package/themes/fragments/twitter/theme.css +1 -0
- package/themes/media.css +5 -0
- package/themes/minimal/theme.css +1 -0
- package/themes/reshaped/theme.css +1 -0
- package/themes/slate/theme.css +1 -0
- package/types/config.d.ts +8 -0
- package/types/config.js +2 -0
- package/types/global.d.ts +29 -0
- package/types/global.js +1 -0
- package/utilities/Chain.d.ts +20 -0
- package/utilities/Chain.js +63 -0
- package/utilities/a11y.d.ts +36 -0
- package/utilities/a11y.js +175 -0
- package/utilities/animation.d.ts +4 -0
- package/utilities/animation.js +15 -0
- package/utilities/helpers.d.ts +16 -0
- package/utilities/helpers.js +130 -0
- package/utilities/storybook/Example.d.ts +13 -0
- package/utilities/storybook/Example.js +19 -0
- package/utilities/storybook/Example.module.css +1 -0
- package/utilities/storybook/Placeholder.d.ts +9 -0
- package/utilities/storybook/Placeholder.js +17 -0
- package/utilities/storybook/index.d.ts +2 -0
- package/utilities/storybook/index.js +2 -0
- package/utilities/testPresets.d.ts +25 -0
- package/utilities/testPresets.js +76 -0
- package/utilities/tests/Chain.test.d.ts +1 -0
- package/utilities/tests/Chain.test.js +45 -0
- package/README.md +0 -1
@@ -0,0 +1,55 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Example, Placeholder } from "../../../utilities/storybook/index.js";
|
3
|
+
import Timeline from "../index.js";
|
4
|
+
export default { title: "Components/Timeline" };
|
5
|
+
export const base = () => (<Example>
|
6
|
+
<Example.Item title="children passed directly">
|
7
|
+
<Timeline>
|
8
|
+
<Placeholder />
|
9
|
+
<Placeholder />
|
10
|
+
<Placeholder />
|
11
|
+
</Timeline>
|
12
|
+
</Example.Item>
|
13
|
+
<Example.Item title="children wrapped with Timeline.Item">
|
14
|
+
<Timeline>
|
15
|
+
<Timeline.Item>
|
16
|
+
<Placeholder />
|
17
|
+
</Timeline.Item>
|
18
|
+
<Timeline.Item>
|
19
|
+
<Placeholder />
|
20
|
+
</Timeline.Item>
|
21
|
+
<Timeline.Item>
|
22
|
+
<Placeholder />
|
23
|
+
</Timeline.Item>
|
24
|
+
</Timeline>
|
25
|
+
</Example.Item>
|
26
|
+
</Example>);
|
27
|
+
export const marker = () => (<Example>
|
28
|
+
<Example.Item title="slot">
|
29
|
+
<Timeline>
|
30
|
+
<Timeline.Item markerSlot={<Placeholder h="20px" w="20px"/>}>
|
31
|
+
<Placeholder />
|
32
|
+
</Timeline.Item>
|
33
|
+
<Timeline.Item markerSlot={<Placeholder h="20px" w="20px"/>}>
|
34
|
+
<Placeholder />
|
35
|
+
</Timeline.Item>
|
36
|
+
<Timeline.Item markerSlot={<Placeholder h="20px" w="20px"/>}>
|
37
|
+
<Placeholder />
|
38
|
+
</Timeline.Item>
|
39
|
+
</Timeline>
|
40
|
+
</Example.Item>
|
41
|
+
|
42
|
+
<Example.Item title="null marker">
|
43
|
+
<Timeline>
|
44
|
+
<Timeline.Item markerSlot={null}>
|
45
|
+
<Placeholder />
|
46
|
+
</Timeline.Item>
|
47
|
+
<Timeline.Item markerSlot={null}>
|
48
|
+
<Placeholder />
|
49
|
+
</Timeline.Item>
|
50
|
+
<Timeline.Item>
|
51
|
+
<Placeholder />
|
52
|
+
</Timeline.Item>
|
53
|
+
</Timeline>
|
54
|
+
</Example.Item>
|
55
|
+
</Example>);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type * as T from "./Toast.types";
|
2
|
+
export declare const timeouts: Record<T.Timeout, number>;
|
3
|
+
export declare const positions: T.Position[];
|
4
|
+
export declare const defaultContextData: {
|
5
|
+
queues: Record<T.Position, T.ContainerProps[]>;
|
6
|
+
show: () => void;
|
7
|
+
hide: () => void;
|
8
|
+
remove: () => void;
|
9
|
+
add: () => string;
|
10
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
export const timeouts = {
|
2
|
+
short: 4000,
|
3
|
+
long: 8000,
|
4
|
+
};
|
5
|
+
export const positions = [
|
6
|
+
"top-start",
|
7
|
+
"top",
|
8
|
+
"top-end",
|
9
|
+
"bottom-start",
|
10
|
+
"bottom",
|
11
|
+
"bottom-end",
|
12
|
+
];
|
13
|
+
const defaultPositionData = positions.reduce((acc, cur) => (Object.assign({ [cur]: [] }, acc)), {});
|
14
|
+
export const defaultContextData = {
|
15
|
+
queues: defaultPositionData,
|
16
|
+
show: () => { },
|
17
|
+
hide: () => { },
|
18
|
+
remove: () => { },
|
19
|
+
add: () => "",
|
20
|
+
};
|
@@ -0,0 +1,55 @@
|
|
1
|
+
"use client";
|
2
|
+
import React from "react";
|
3
|
+
import View from "../View/index.js";
|
4
|
+
import Button from "../Button/index.js";
|
5
|
+
import Icon from "../Icon/index.js";
|
6
|
+
import Theme from "../Theme/index.js";
|
7
|
+
import Text from "../Text/index.js";
|
8
|
+
import s from "./Toast.module.css";
|
9
|
+
const Toast = (props) => {
|
10
|
+
const { size = "small", text, children, color = "inverted", icon, title, actionsSlot, startSlot, collapsed, attributes, } = props;
|
11
|
+
let backgroundColor = color === "inverted" || color === "neutral" ? "elevation-overlay" : color;
|
12
|
+
if (color === "neutral")
|
13
|
+
backgroundColor = collapsed ? "neutral" : "elevation-overlay";
|
14
|
+
const borderColor = color === "neutral" ? "neutral-faded" : "transparent";
|
15
|
+
const textTagName = size === "small" ? "span" : "div";
|
16
|
+
const isLarge = size === "large";
|
17
|
+
let actions = [];
|
18
|
+
if (actionsSlot) {
|
19
|
+
actions = Array.isArray(actionsSlot) ? actionsSlot : [actionsSlot];
|
20
|
+
}
|
21
|
+
const textContent = (title || text) && (React.createElement(React.Fragment, null,
|
22
|
+
title && (React.createElement(Text, { variant: "body-3", weight: "bold", as: textTagName },
|
23
|
+
title,
|
24
|
+
" ")),
|
25
|
+
React.createElement(Text, { variant: "body-3", as: textTagName }, text)));
|
26
|
+
const toastNode = (React.createElement(View, { backgroundColor: backgroundColor, borderColor: borderColor, padding: 4, borderRadius: "medium", animated: true, direction: "row", gap: 3, align: isLarge ? "start" : "center", className: s.toast, attributes: attributes },
|
27
|
+
icon && React.createElement(Icon, { size: 5, svg: icon, className: s.icon }),
|
28
|
+
startSlot && !icon && React.createElement(View.Item, null, startSlot),
|
29
|
+
React.createElement(View.Item, { grow: true },
|
30
|
+
React.createElement(View, { direction: isLarge ? "column" : "row", align: isLarge ? "start" : "center", gap: 3 },
|
31
|
+
React.createElement(View.Item, { grow: true }, (textContent && children) || size !== "small" ? (React.createElement(View, { gap: 0.5 },
|
32
|
+
textContent,
|
33
|
+
children && React.createElement(View, { gap: 3 }, children))) : (textContent || children)),
|
34
|
+
actions.length && (React.createElement(View, { direction: "row", align: "center", gap: 2 }, actions.map((slot, index) => {
|
35
|
+
const isPrimary = size === "large" ? index === 0 : index === actions.length - 1;
|
36
|
+
const primaryColor = color === "neutral" || color === "inverted" ? "neutral" : "white";
|
37
|
+
const defaultProps = {
|
38
|
+
variant: isPrimary ? "solid" : "ghost",
|
39
|
+
size: "small",
|
40
|
+
color: isPrimary ? primaryColor : "inherit",
|
41
|
+
elevated: color !== "neutral",
|
42
|
+
};
|
43
|
+
if (slot.type === Button) {
|
44
|
+
return React.createElement(Button, Object.assign({}, defaultProps, slot.props, { key: index }));
|
45
|
+
}
|
46
|
+
else {
|
47
|
+
return slot;
|
48
|
+
}
|
49
|
+
})))))));
|
50
|
+
if (color === "inverted") {
|
51
|
+
return React.createElement(Theme, { colorMode: "inverted" }, toastNode);
|
52
|
+
}
|
53
|
+
return toastNode;
|
54
|
+
};
|
55
|
+
export default Toast;
|
@@ -0,0 +1 @@
|
|
1
|
+
.container{display:block;opacity:0;position:relative;transition:var(--rs-duration-medium) ease-out;transition-property:transform,height,opacity;width:100%}.container--visible{opacity:1}.container--visible .wrapper{height:calc(100% - var(--rs-unit-x2))}.container--index-0{z-index:var(--rs-z-index-raised)}.container--index-1{height:var(--rs-unit-x2)!important}.container--index-1 .wrapper{height:100%;transform:translateY(calc(var(--rs-unit-x1) * -1)) translateZ(0) scaleX(.9)}.container--index-2{height:var(--rs-unit-x2)!important}.container--index-2 .wrapper{height:100%;transform:translateY(calc(var(--rs-unit-x2) * -1)) translateZ(0) scaleX(.8)}.container--index-overflow{height:0!important}.container--index-overflow .wrapper{height:100%;opacity:0;transform:translateY(calc(var(--rs-unit-x3) * -1)) translateZ(0) scaleX(.8)}.wrapper{border-radius:var(--rs-unit-radius-medium);box-shadow:var(--rs-shadow-overlay);height:100%;margin-top:var(--rs-unit-x2);overflow:hidden;transform-origin:50% 0;transition:var(--rs-duration-medium) ease-out;transition-property:height,transform,opacity}.region,.wrapper{display:flex;flex-direction:column}.region{max-width:100%;padding:var(--rs-unit-x4);position:fixed;width:100%;z-index:var(--rs-z-index-notification)}.region--position-top{align-items:center;left:50%;top:0;transform:translateX(-50%)}.region--position-top-start{align-items:start;inset-inline-start:0;top:0}.region--position-top-end{inset-inline-end:0;top:0}.region--position-top,.region--position-top-end,.region--position-top-start{flex-direction:column-reverse}.region--position-top .wrapper,.region--position-top-end .wrapper,.region--position-top-start .wrapper{justify-content:flex-end;margin-bottom:var(--rs-unit-x2);margin-top:0;transform-origin:bottom}.region--position-top .container--index-2 .wrapper,.region--position-top-end .container--index-2 .wrapper,.region--position-top-start .container--index-2 .wrapper{transform:translateY(0) translateZ(0) scaleX(.8)}.region--position-top .container--index-overflow .wrapper,.region--position-top-end .container--index-overflow .wrapper,.region--position-top-start .container--index-overflow .wrapper{transform:translateY(var(--rs-unit-x1)) translateZ(0) scaleX(.8)}.region--position-bottom{align-items:center;bottom:0;left:50%;transform:translateX(-50%)}.region--position-bottom-start{align-items:start;bottom:0;inset-inline-start:0}.region--position-bottom-end{align-items:end;bottom:0;inset-inline-end:0}@media (min-width:660px){.region{width:360px}}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import type { IconProps } from "../Icon";
|
3
|
+
import type * as G from "../../types/global";
|
4
|
+
export type Status = "entering" | "entered" | "exited";
|
5
|
+
export type TimeoutAlias = "short" | "long";
|
6
|
+
export type Timeout = TimeoutAlias | number;
|
7
|
+
export type Position = "top" | "top-end" | "top-start" | "bottom" | "bottom-start" | "bottom-end";
|
8
|
+
export type Props = {
|
9
|
+
size?: "small" | "medium" | "large";
|
10
|
+
icon?: IconProps["svg"];
|
11
|
+
startSlot?: React.ReactNode;
|
12
|
+
title?: React.ReactNode;
|
13
|
+
text?: React.ReactNode;
|
14
|
+
children?: React.ReactNode;
|
15
|
+
actionsSlot?: React.ReactNode;
|
16
|
+
color?: "neutral" | "primary" | "critical" | "positive" | "inverted";
|
17
|
+
attributes?: G.Attributes<"div", Props>;
|
18
|
+
};
|
19
|
+
export type ProviderProps = {
|
20
|
+
children?: React.ReactNode;
|
21
|
+
options?: Partial<Record<RegionProps["position"], {
|
22
|
+
width?: string;
|
23
|
+
expanded?: boolean;
|
24
|
+
}>>;
|
25
|
+
};
|
26
|
+
export type RegionProps = {
|
27
|
+
position: Position;
|
28
|
+
};
|
29
|
+
export type ContainerProps = {
|
30
|
+
id: string;
|
31
|
+
toastProps: Props & {
|
32
|
+
timeout?: Timeout;
|
33
|
+
};
|
34
|
+
index: number;
|
35
|
+
status?: "entering" | "entered" | "exiting";
|
36
|
+
inspected: boolean;
|
37
|
+
};
|
38
|
+
export type Context = {
|
39
|
+
options?: ProviderProps["options"];
|
40
|
+
queues: Record<RegionProps["position"], Array<ContainerProps>>;
|
41
|
+
add: (toast: Props & ShowOptions) => string;
|
42
|
+
show: (id: string) => void;
|
43
|
+
hide: (id: string) => void;
|
44
|
+
remove: (id: string) => void;
|
45
|
+
};
|
46
|
+
export type ShowOptions = {
|
47
|
+
timeout?: Timeout;
|
48
|
+
position?: Position;
|
49
|
+
};
|
50
|
+
type AddAction = {
|
51
|
+
type: "add";
|
52
|
+
payload: {
|
53
|
+
toastProps: Props & ShowOptions;
|
54
|
+
id: string;
|
55
|
+
};
|
56
|
+
};
|
57
|
+
type ShowAction = {
|
58
|
+
type: "show";
|
59
|
+
payload: {
|
60
|
+
id: string;
|
61
|
+
};
|
62
|
+
};
|
63
|
+
type HideAction = {
|
64
|
+
type: "hide";
|
65
|
+
payload: {
|
66
|
+
id: string;
|
67
|
+
};
|
68
|
+
};
|
69
|
+
type RemoveAction = {
|
70
|
+
type: "remove";
|
71
|
+
payload: {
|
72
|
+
id: string;
|
73
|
+
};
|
74
|
+
};
|
75
|
+
type Action = AddAction | ShowAction | HideAction | RemoveAction;
|
76
|
+
export type Reducer = (state: Context["queues"], action: Action) => Context["queues"];
|
77
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,97 @@
|
|
1
|
+
"use client";
|
2
|
+
import React from "react";
|
3
|
+
import { classNames } from "../../utilities/helpers.js";
|
4
|
+
import { onNextFrame } from "../../utilities/animation.js";
|
5
|
+
import { trapFocus, isKeyboardMode } from "../../utilities/a11y.js";
|
6
|
+
import Toast from "./Toast.js";
|
7
|
+
import ToastContext from "./Toast.context.js";
|
8
|
+
import { timeouts } from "./Toast.constants.js";
|
9
|
+
import s from "./Toast.module.css";
|
10
|
+
const ToastContainer = (props) => {
|
11
|
+
const { toastProps, id, status, inspected, index } = props;
|
12
|
+
const { timeout = "short" } = toastProps;
|
13
|
+
const { show, hide, remove } = React.useContext(ToastContext);
|
14
|
+
const [toastHeight, setToastHeight] = React.useState();
|
15
|
+
const timeoutRef = React.useRef();
|
16
|
+
const resizingRef = React.useRef(false);
|
17
|
+
const trapFocusRef = React.useRef(null);
|
18
|
+
const wrapperRef = React.useRef(null);
|
19
|
+
const visible = status === "entered";
|
20
|
+
const containerClassNames = classNames(s.container, visible && s[`container--visible`], index === 0 && s[`container--index-${index}`], !inspected && (index === 1 || index === 2) && s[`container--index-${index}`], !inspected && index >= 3 && s["container--index-overflow"]);
|
21
|
+
const stopTimer = React.useCallback(() => {
|
22
|
+
if (!timeoutRef.current)
|
23
|
+
return;
|
24
|
+
clearTimeout(timeoutRef.current);
|
25
|
+
}, []);
|
26
|
+
const startTimer = React.useCallback(() => {
|
27
|
+
stopTimer();
|
28
|
+
const timeoutValue = typeof timeout === "string" ? timeouts[timeout] : timeout;
|
29
|
+
if (timeout === 0)
|
30
|
+
return;
|
31
|
+
timeoutRef.current = setTimeout(() => {
|
32
|
+
hide(id);
|
33
|
+
}, timeoutValue !== null && timeoutValue !== void 0 ? timeoutValue : timeouts.short);
|
34
|
+
}, [hide, id, timeout, stopTimer]);
|
35
|
+
const handleTransitionEnd = (e) => {
|
36
|
+
if (e.propertyName !== "height")
|
37
|
+
return;
|
38
|
+
if (visible)
|
39
|
+
return;
|
40
|
+
remove(id);
|
41
|
+
};
|
42
|
+
React.useEffect(() => {
|
43
|
+
if (!visible)
|
44
|
+
return;
|
45
|
+
if (inspected) {
|
46
|
+
stopTimer();
|
47
|
+
}
|
48
|
+
else {
|
49
|
+
startTimer();
|
50
|
+
}
|
51
|
+
}, [inspected, startTimer, stopTimer, visible]);
|
52
|
+
React.useEffect(() => {
|
53
|
+
if (wrapperRef.current) {
|
54
|
+
setToastHeight(wrapperRef.current.clientHeight);
|
55
|
+
}
|
56
|
+
show(id);
|
57
|
+
startTimer();
|
58
|
+
}, [show, id, startTimer]);
|
59
|
+
React.useEffect(() => {
|
60
|
+
if (!wrapperRef.current)
|
61
|
+
return;
|
62
|
+
if (visible) {
|
63
|
+
trapFocusRef.current = trapFocus(wrapperRef.current, {
|
64
|
+
includeTrigger: true,
|
65
|
+
mode: "content-menu",
|
66
|
+
});
|
67
|
+
}
|
68
|
+
else if (trapFocusRef.current && isKeyboardMode()) {
|
69
|
+
trapFocusRef.current();
|
70
|
+
trapFocusRef.current = null;
|
71
|
+
}
|
72
|
+
}, [visible]);
|
73
|
+
React.useEffect(() => {
|
74
|
+
if (!visible || index > 0)
|
75
|
+
return;
|
76
|
+
const handleResize = () => {
|
77
|
+
resizingRef.current = true;
|
78
|
+
onNextFrame(() => {
|
79
|
+
resizingRef.current = false;
|
80
|
+
});
|
81
|
+
if (wrapperRef.current) {
|
82
|
+
setToastHeight(wrapperRef.current.clientHeight);
|
83
|
+
}
|
84
|
+
};
|
85
|
+
window.addEventListener("resize", handleResize);
|
86
|
+
return () => window.removeEventListener("resize", handleResize);
|
87
|
+
}, [visible, index]);
|
88
|
+
return (React.createElement("li", { className: containerClassNames, style: {
|
89
|
+
// Height + padding + borders
|
90
|
+
height: status === "entered" ? `calc(${toastHeight}px + var(--rs-unit-x2) + 2px)` : 0,
|
91
|
+
// Disable transition when height of the toast can change
|
92
|
+
transitionDuration: resizingRef.current ? "0s" : undefined,
|
93
|
+
}, onTransitionEnd: handleTransitionEnd, onFocus: stopTimer, onBlur: startTimer },
|
94
|
+
React.createElement("span", { className: s.wrapper },
|
95
|
+
React.createElement(Toast, Object.assign({}, toastProps, { collapsed: index > 0 && !inspected, attributes: { ref: wrapperRef } })))));
|
96
|
+
};
|
97
|
+
export default ToastContainer;
|
@@ -0,0 +1,80 @@
|
|
1
|
+
"use client";
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
3
|
+
var t = {};
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
5
|
+
t[p] = s[p];
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
9
|
+
t[p[i]] = s[p[i]];
|
10
|
+
}
|
11
|
+
return t;
|
12
|
+
};
|
13
|
+
import React from "react";
|
14
|
+
import ToastContext from "./Toast.context.js";
|
15
|
+
import ToastRegion from "./ToastRegion.js";
|
16
|
+
import { positions, defaultContextData } from "./Toast.constants.js";
|
17
|
+
let counter = 0;
|
18
|
+
const generateId = () => `__rs-toast-${counter++}`;
|
19
|
+
const toastReducer = (state, action) => {
|
20
|
+
let nextState;
|
21
|
+
switch (action.type) {
|
22
|
+
case "add":
|
23
|
+
const _a = action.payload.toastProps || {}, { position = "bottom-end" } = _a, toastProps = __rest(_a, ["position"]);
|
24
|
+
return Object.assign(Object.assign({}, state), { [position]: [...state[position], { id: action.payload.id, toastProps, status: "entering" }] });
|
25
|
+
case "show":
|
26
|
+
const { id: showId } = action.payload;
|
27
|
+
nextState = Object.assign({}, state);
|
28
|
+
positions.forEach((position) => {
|
29
|
+
nextState[position] = nextState[position].map((item) => {
|
30
|
+
return item.id === showId ? Object.assign(Object.assign({}, item), { status: "entered" }) : item;
|
31
|
+
});
|
32
|
+
});
|
33
|
+
return nextState;
|
34
|
+
case "hide":
|
35
|
+
const { id: hideId } = action.payload;
|
36
|
+
nextState = Object.assign({}, state);
|
37
|
+
positions.forEach((position) => {
|
38
|
+
nextState[position] = nextState[position].map((item) => item.id === hideId ? Object.assign(Object.assign({}, item), { status: "exiting" }) : item);
|
39
|
+
});
|
40
|
+
return nextState;
|
41
|
+
case "remove":
|
42
|
+
const { id: removeId } = action.payload;
|
43
|
+
nextState = Object.assign({}, state);
|
44
|
+
positions.forEach((position) => {
|
45
|
+
nextState[position] = nextState[position].filter((item) => item.id !== removeId);
|
46
|
+
});
|
47
|
+
return nextState;
|
48
|
+
}
|
49
|
+
};
|
50
|
+
const ToastProvider = (props) => {
|
51
|
+
const { children, options } = props;
|
52
|
+
const [data, dispatch] = React.useReducer(toastReducer, defaultContextData.queues);
|
53
|
+
const add = React.useCallback((toastProps) => {
|
54
|
+
const id = generateId();
|
55
|
+
dispatch({ type: "add", payload: { toastProps, id } });
|
56
|
+
return id;
|
57
|
+
}, []);
|
58
|
+
const show = React.useCallback((id) => {
|
59
|
+
dispatch({ type: "show", payload: { id } });
|
60
|
+
}, []);
|
61
|
+
const hide = React.useCallback((id) => {
|
62
|
+
dispatch({ type: "hide", payload: { id } });
|
63
|
+
}, []);
|
64
|
+
const remove = React.useCallback((id) => {
|
65
|
+
dispatch({ type: "remove", payload: { id } });
|
66
|
+
}, []);
|
67
|
+
const value = React.useMemo(() => ({
|
68
|
+
queues: data,
|
69
|
+
add,
|
70
|
+
show,
|
71
|
+
hide,
|
72
|
+
remove,
|
73
|
+
inspecting: false,
|
74
|
+
options,
|
75
|
+
}), [data, show, hide, add, remove, options]);
|
76
|
+
return (React.createElement(ToastContext.Provider, { value: value },
|
77
|
+
children,
|
78
|
+
positions.map((position) => (React.createElement(ToastRegion, { position: position, key: position })))));
|
79
|
+
};
|
80
|
+
export default ToastProvider;
|
@@ -0,0 +1,63 @@
|
|
1
|
+
"use client";
|
2
|
+
import React from "react";
|
3
|
+
import { classNames } from "../../utilities/helpers.js";
|
4
|
+
import { focusableSelector } from "../../utilities/a11y.js";
|
5
|
+
import ToastContainer from "./ToastContainer.js";
|
6
|
+
import ToastContext from "./Toast.context.js";
|
7
|
+
import s from "./Toast.module.css";
|
8
|
+
const ToastRegion = (props) => {
|
9
|
+
const { position } = props;
|
10
|
+
const { queues, options } = React.useContext(ToastContext);
|
11
|
+
const [inspecting, setInspecting] = React.useState(false);
|
12
|
+
const ignoreHoverRef = React.useRef(false);
|
13
|
+
const rootRef = React.useRef(null);
|
14
|
+
const queue = queues[position];
|
15
|
+
const { width, expanded } = (options === null || options === void 0 ? void 0 : options[position]) || {};
|
16
|
+
const regionClassNames = classNames(s.region, s[`region--position-${position}`]);
|
17
|
+
const filteredLength = queue.filter((item) => item.status === "entered").length;
|
18
|
+
let hiddenCount = 0;
|
19
|
+
// If touch event was triggered – ignore hover events
|
20
|
+
const handleTouchStart = () => {
|
21
|
+
ignoreHoverRef.current = true;
|
22
|
+
};
|
23
|
+
const handleClick = (e) => {
|
24
|
+
let currentEl = e.target;
|
25
|
+
let isFocusable = false;
|
26
|
+
while (currentEl && currentEl !== rootRef.current && !isFocusable) {
|
27
|
+
isFocusable = currentEl.matches(focusableSelector);
|
28
|
+
currentEl = currentEl.parentElement;
|
29
|
+
}
|
30
|
+
// Change inspecting mode when clicking on static content
|
31
|
+
if (!isFocusable) {
|
32
|
+
setInspecting((prevInspecting) => !prevInspecting);
|
33
|
+
}
|
34
|
+
// Click is called last so we reset our hover events ignore
|
35
|
+
ignoreHoverRef.current = false;
|
36
|
+
};
|
37
|
+
const handleMouseEnter = () => {
|
38
|
+
if (ignoreHoverRef.current)
|
39
|
+
return;
|
40
|
+
setInspecting(true);
|
41
|
+
};
|
42
|
+
const handleMouseLeave = () => {
|
43
|
+
if (ignoreHoverRef.current)
|
44
|
+
return;
|
45
|
+
setInspecting(false);
|
46
|
+
};
|
47
|
+
React.useEffect(() => {
|
48
|
+
if (queue.length === 0)
|
49
|
+
setInspecting(false);
|
50
|
+
}, [queue.length]);
|
51
|
+
if (!queue.length)
|
52
|
+
return null;
|
53
|
+
return (
|
54
|
+
// We only use onClick for touch devices since touchend is not supported
|
55
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
56
|
+
React.createElement("ul", { role: "region", "aria-live": "polite", className: regionClassNames, ref: rootRef, onTouchStart: handleTouchStart, onClick: handleClick, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: { width } }, queue.map((data, index) => {
|
57
|
+
const visibleIndex = filteredLength - index + hiddenCount - 1;
|
58
|
+
if (data.status !== "entered")
|
59
|
+
hiddenCount += 1;
|
60
|
+
return (React.createElement(ToastContainer, Object.assign({ key: data.id }, data, { index: visibleIndex, inspected: inspecting || !!expanded })));
|
61
|
+
})));
|
62
|
+
};
|
63
|
+
export default ToastRegion;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from "react";
|
2
|
+
declare const _default: {
|
3
|
+
title: string;
|
4
|
+
};
|
5
|
+
export default _default;
|
6
|
+
export declare const base: () => React.JSX.Element;
|
7
|
+
export declare const size: () => React.JSX.Element;
|
8
|
+
export declare const position: () => React.JSX.Element;
|
9
|
+
export declare const color: () => React.JSX.Element;
|
10
|
+
export declare const timeout: () => React.JSX.Element;
|
11
|
+
export declare const regionOptions: () => React.JSX.Element;
|
12
|
+
export declare const slots: () => React.JSX.Element;
|
13
|
+
export declare const edgeCases: () => React.JSX.Element;
|