reshaped 1.0.1 → 2.1.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 +5 -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 +118 -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 +561 -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/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 +8 -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/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 +118 -0
- package/index.js +67 -0
- package/package.json +141 -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 +15 -0
- package/utilities/helpers.js +121 -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,15 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import type * as G from "../../../types/global";
|
3
|
+
export type Props = {
|
4
|
+
name?: string;
|
5
|
+
value?: string;
|
6
|
+
checked?: boolean;
|
7
|
+
defaultChecked?: boolean;
|
8
|
+
disabled?: boolean;
|
9
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
10
|
+
onFocus?: (e: React.FocusEvent) => void;
|
11
|
+
onBlur?: (e: React.FocusEvent) => void;
|
12
|
+
type: "checkbox" | "radio";
|
13
|
+
className?: G.ClassName;
|
14
|
+
attributes?: G.Attributes<"input">;
|
15
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "./HiddenInput.js";
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type * as T from "./Portal.types";
|
2
|
+
export declare const usePortal: () => T.Context;
|
3
|
+
/**
|
4
|
+
* Disclaimer: Works only for components that don't show the portal immediately
|
5
|
+
* That gives Portal time to receive scope on first render
|
6
|
+
*/
|
7
|
+
declare const PortalProvider: (props: T.Props) => JSX.Element;
|
8
|
+
export default PortalProvider;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use client";
|
2
|
+
import React from "react";
|
3
|
+
import ReactDOM from "react-dom";
|
4
|
+
import Theme from "../../Theme/index.js";
|
5
|
+
const PortalContext = React.createContext({ scopeRef: undefined });
|
6
|
+
export const usePortal = () => {
|
7
|
+
return React.useContext(PortalContext);
|
8
|
+
};
|
9
|
+
/**
|
10
|
+
* Disclaimer: Works only for components that don't show the portal immediately
|
11
|
+
* That gives Portal time to receive scope on first render
|
12
|
+
*/
|
13
|
+
const PortalProvider = (props) => {
|
14
|
+
var _a;
|
15
|
+
const { children, scopeRef } = props;
|
16
|
+
const portal = usePortal();
|
17
|
+
const nextScopeRef = scopeRef || portal.scopeRef;
|
18
|
+
return ReactDOM.createPortal(React.createElement(PortalContext.Provider, { value: { scopeRef: nextScopeRef } },
|
19
|
+
React.createElement(Theme, null, children)), ((_a = portal.scopeRef) === null || _a === void 0 ? void 0 : _a.current) || document.body);
|
20
|
+
};
|
21
|
+
export default PortalProvider;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default, usePortal } from "./Portal.js";
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import Portal from "../index.js";
|
3
|
+
export default { title: "Utilities/Internal/Portal" };
|
4
|
+
export const base = () => {
|
5
|
+
const ref = React.useRef(null);
|
6
|
+
return (<div style={{ border: "2px solid #333", padding: 16 }}>
|
7
|
+
App
|
8
|
+
<Portal scopeRef={ref}>
|
9
|
+
<div ref={ref} style={{ border: "2px solid green", padding: 16 }}>
|
10
|
+
Portal scope
|
11
|
+
<div style={{ border: "2px solid red", padding: 16 }}>
|
12
|
+
Stays in red
|
13
|
+
<Portal>Ported to green</Portal>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</Portal>
|
17
|
+
</div>);
|
18
|
+
};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.config = void 0;
|
7
|
+
const path_1 = __importDefault(require("path"));
|
8
|
+
// Using [plugin]: { ...options } format here because it's supported by the most frameworks
|
9
|
+
// - require('plugin') is not supported by Next
|
10
|
+
// - ['plugin', options] is not supported by Vite
|
11
|
+
exports.config = {
|
12
|
+
plugins: {
|
13
|
+
"postcss-custom-media": {
|
14
|
+
importFrom: path_1.default.resolve(__dirname, "../themes/media.css"),
|
15
|
+
},
|
16
|
+
autoprefixer: {},
|
17
|
+
cssnano: { preset: ["default", { calc: false }] },
|
18
|
+
},
|
19
|
+
};
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import { UserThemeDefinition } from "../cli/theming/tokens/types";
|
2
|
+
export declare const getTheme: (theme?: UserThemeDefinition) => Record<"backgroundColor" | "textColor" | "borderColor" | "colors" | "borderRadius" | "spacing" | "boxShadow" | "screens", Record<string, string>>;
|
@@ -0,0 +1,91 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.getTheme = void 0;
|
7
|
+
const reshaped_1 = __importDefault(require("../cli/theming/definitions/reshaped"));
|
8
|
+
const base_1 = __importDefault(require("../cli/theming/definitions/base"));
|
9
|
+
const string_1 = require("../cli/utilities/string");
|
10
|
+
const color_1 = require("../cli/utilities/color");
|
11
|
+
const mergeDefinitions_1 = __importDefault(require("../cli/theming/utilities/mergeDefinitions"));
|
12
|
+
const getTheme = (theme) => {
|
13
|
+
const config = {
|
14
|
+
backgroundColor: {},
|
15
|
+
textColor: {},
|
16
|
+
borderColor: {},
|
17
|
+
colors: {},
|
18
|
+
borderRadius: {},
|
19
|
+
spacing: {},
|
20
|
+
boxShadow: {},
|
21
|
+
screens: {},
|
22
|
+
};
|
23
|
+
const definition = theme
|
24
|
+
? (0, mergeDefinitions_1.default)(reshaped_1.default, theme)
|
25
|
+
: reshaped_1.default;
|
26
|
+
Object.keys(definition.color).forEach((tokenName) => {
|
27
|
+
const cssTokenName = (0, string_1.camelToKebab)(tokenName);
|
28
|
+
const cssVariable = ["rs", "color", cssTokenName].join("-");
|
29
|
+
const configValue = `var(--${cssVariable})`;
|
30
|
+
if (tokenName.startsWith("background")) {
|
31
|
+
const name = cssTokenName.replace("background-", "");
|
32
|
+
config.backgroundColor[name] = configValue;
|
33
|
+
if (color_1.bgWithDynamicForeground.includes(tokenName)) {
|
34
|
+
const cssVariable = ["rs", "color", "on", cssTokenName].join("-");
|
35
|
+
const configValue = `var(--${cssVariable})`;
|
36
|
+
config.textColor[`on-${name}`] = configValue;
|
37
|
+
}
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
if (tokenName.startsWith("foreground")) {
|
41
|
+
const name = cssTokenName.replace("foreground-", "");
|
42
|
+
config.textColor[name] = configValue;
|
43
|
+
return;
|
44
|
+
}
|
45
|
+
if (tokenName.startsWith("border")) {
|
46
|
+
const name = cssTokenName.replace("border-", "");
|
47
|
+
config.borderColor[name] = configValue;
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
config.backgroundColor[cssTokenName] = configValue;
|
51
|
+
config.borderColor[cssTokenName] = configValue;
|
52
|
+
config.textColor[cssTokenName] = configValue;
|
53
|
+
config.colors[cssTokenName] = configValue;
|
54
|
+
});
|
55
|
+
Object.keys(definition.unit).forEach((tokenName) => {
|
56
|
+
const cssTokenName = (0, string_1.camelToKebab)(tokenName);
|
57
|
+
const cssVariable = ["rs", "unit", cssTokenName].join("-");
|
58
|
+
const configValue = `var(--${cssVariable})`;
|
59
|
+
if (tokenName.startsWith("radius")) {
|
60
|
+
const name = cssTokenName.replace("radius-", "");
|
61
|
+
config.borderRadius[name] = configValue;
|
62
|
+
return;
|
63
|
+
}
|
64
|
+
if (tokenName.startsWith("base")) {
|
65
|
+
[...Array(11).keys()].forEach((i) => {
|
66
|
+
if (i === 0) {
|
67
|
+
config.spacing["0"] = "0px";
|
68
|
+
}
|
69
|
+
else {
|
70
|
+
config.spacing[`x${i}`] = `var(--rs-unit-x${i})`;
|
71
|
+
}
|
72
|
+
});
|
73
|
+
return;
|
74
|
+
}
|
75
|
+
});
|
76
|
+
Object.keys(definition.shadow).forEach((tokenName) => {
|
77
|
+
const cssTokenName = (0, string_1.camelToKebab)(tokenName);
|
78
|
+
const cssVariable = ["rs", "shadow", cssTokenName].join("-");
|
79
|
+
const configValue = `var(--${cssVariable})`;
|
80
|
+
const name = cssTokenName.replace("shadow-", "");
|
81
|
+
config.boxShadow[name] = configValue;
|
82
|
+
return;
|
83
|
+
});
|
84
|
+
Object.entries(base_1.default.viewport).forEach(([tokenName, tokenValue]) => {
|
85
|
+
if (!tokenValue.minPx)
|
86
|
+
return;
|
87
|
+
config.screens[tokenName] = `${tokenValue.minPx}px`;
|
88
|
+
});
|
89
|
+
return config;
|
90
|
+
};
|
91
|
+
exports.getTheme = getTheme;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export declare const ESC = "Escape";
|
2
|
+
export declare const SPACE = " ";
|
3
|
+
export declare const ENTER = "Enter";
|
4
|
+
export declare const TAB = "Tab";
|
5
|
+
export declare const UP = "ArrowUp";
|
6
|
+
export declare const DOWN = "ArrowDown";
|
7
|
+
export declare const RIGHT = "ArrowRight";
|
8
|
+
export declare const LEFT = "ArrowLeft";
|
9
|
+
export declare const HOME = "Home";
|
10
|
+
export declare const END = "End";
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export const ESC = "Escape";
|
2
|
+
export const SPACE = " ";
|
3
|
+
export const ENTER = "Enter";
|
4
|
+
export const TAB = "Tab";
|
5
|
+
export const UP = "ArrowUp";
|
6
|
+
export const DOWN = "ArrowDown";
|
7
|
+
export const RIGHT = "ArrowRight";
|
8
|
+
export const LEFT = "ArrowLeft";
|
9
|
+
export const HOME = "Home";
|
10
|
+
export const END = "End";
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import React from "react";
|
2
|
+
/**
|
3
|
+
* Typings
|
4
|
+
*/
|
5
|
+
export type FlyoutPosition = "bottom" | "bottom-start" | "bottom-end" | "top" | "top-start" | "top-end" | "start" | "start-top" | "start-bottom" | "end" | "end-top" | "end-bottom";
|
6
|
+
export type FlyoutWidth = "trigger" | string;
|
7
|
+
type ElementRef = React.RefObject<HTMLElement>;
|
8
|
+
type PassedFlyoutOptions = {
|
9
|
+
width?: FlyoutWidth;
|
10
|
+
position?: FlyoutPosition;
|
11
|
+
defaultActive?: boolean;
|
12
|
+
forcePosition?: boolean;
|
13
|
+
};
|
14
|
+
type FlyoutStyles = React.CSSProperties;
|
15
|
+
type FlyoutState = {
|
16
|
+
styles: FlyoutStyles;
|
17
|
+
position?: FlyoutPosition;
|
18
|
+
status: "idle" | "rendered" | "positioned" | "visible" | "hidden";
|
19
|
+
};
|
20
|
+
type UseFlyout = (originRef: ElementRef, targetRef: ElementRef, options: PassedFlyoutOptions) => Pick<FlyoutState, "styles" | "position" | "status"> & {
|
21
|
+
updatePosition: () => void;
|
22
|
+
render: () => void;
|
23
|
+
hide: () => void;
|
24
|
+
remove: () => void;
|
25
|
+
};
|
26
|
+
declare const useFlyout: UseFlyout;
|
27
|
+
export default useFlyout;
|
@@ -0,0 +1,269 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import useRTL from "../useRTL.js";
|
3
|
+
import { usePortal } from "../../components/_private/Portal/index.js";
|
4
|
+
import { onNextFrame } from "../../utilities/animation.js";
|
5
|
+
const SCREEN_OFFSET = 16;
|
6
|
+
const topPos = ["top-start", "top", "top-end"];
|
7
|
+
const bottomPos = ["bottom-start", "bottom", "bottom-end"];
|
8
|
+
const startPos = ["start", "start-bottom", "start-top"];
|
9
|
+
const endPos = ["end", "end-bottom", "end-top"];
|
10
|
+
const order = {
|
11
|
+
top: [...topPos, ...bottomPos, ...endPos, ...startPos],
|
12
|
+
bottom: [...bottomPos, ...topPos, ...endPos, ...startPos],
|
13
|
+
start: [...startPos, ...endPos, ...topPos, ...bottomPos],
|
14
|
+
end: [...endPos, ...startPos, ...topPos, ...bottomPos],
|
15
|
+
};
|
16
|
+
const getRTLPosition = (position) => {
|
17
|
+
if (position.includes("start"))
|
18
|
+
return position.replace("start", "end");
|
19
|
+
if (position.includes("end"))
|
20
|
+
return position.replace("end", "start");
|
21
|
+
return position;
|
22
|
+
};
|
23
|
+
/**
|
24
|
+
* Get a position value which centers 2 elements vertically or horizontally
|
25
|
+
*/
|
26
|
+
const centerBySize = (originSize, targetSize) => {
|
27
|
+
return Math.floor(originSize / 2 - targetSize / 2);
|
28
|
+
};
|
29
|
+
/**
|
30
|
+
* Get an order of positions to try to fit popover on the screen based on its starting position
|
31
|
+
*/
|
32
|
+
const getPositionOrder = (position) => {
|
33
|
+
const types = ["top", "bottom", "start", "end"];
|
34
|
+
const type = types.find((type) => position.startsWith(type)) || "bottom";
|
35
|
+
return order[type];
|
36
|
+
};
|
37
|
+
/**
|
38
|
+
* Check if element visually fits on the screen
|
39
|
+
*/
|
40
|
+
const fullyVisible = (bounds) => {
|
41
|
+
const htmlEl = document.documentElement;
|
42
|
+
const pageLeft = htmlEl.scrollLeft;
|
43
|
+
const pageRight = pageLeft + htmlEl.clientWidth;
|
44
|
+
const pageTop = htmlEl.scrollTop;
|
45
|
+
const pageBottom = pageTop + htmlEl.clientHeight;
|
46
|
+
return (bounds.left >= pageLeft &&
|
47
|
+
bounds.left + bounds.width <= pageRight &&
|
48
|
+
bounds.top >= pageTop &&
|
49
|
+
bounds.top + bounds.height <= pageBottom);
|
50
|
+
};
|
51
|
+
/**
|
52
|
+
* Calculate styles for the current position
|
53
|
+
*/
|
54
|
+
const calculatePosition = (originBounds, targetBounds, options) => {
|
55
|
+
const { position: passedPosition, rtl, width, isInsidePortal } = options;
|
56
|
+
let left = 0;
|
57
|
+
let top = 0;
|
58
|
+
let position = passedPosition;
|
59
|
+
if (rtl)
|
60
|
+
position = getRTLPosition(position);
|
61
|
+
if (width === "full" || width === "trigger") {
|
62
|
+
position = position.includes("top") ? "top" : "bottom";
|
63
|
+
}
|
64
|
+
switch (position) {
|
65
|
+
case "bottom":
|
66
|
+
case "top":
|
67
|
+
left = centerBySize(originBounds.width, targetBounds.width) + originBounds.left;
|
68
|
+
break;
|
69
|
+
case "start":
|
70
|
+
case "start-top":
|
71
|
+
case "start-bottom":
|
72
|
+
left = originBounds.left - targetBounds.width;
|
73
|
+
break;
|
74
|
+
case "end":
|
75
|
+
case "end-top":
|
76
|
+
case "end-bottom":
|
77
|
+
left = originBounds.right;
|
78
|
+
break;
|
79
|
+
case "top-start":
|
80
|
+
case "bottom-start":
|
81
|
+
left = originBounds.left;
|
82
|
+
break;
|
83
|
+
case "top-end":
|
84
|
+
case "bottom-end":
|
85
|
+
left = originBounds.right - targetBounds.width;
|
86
|
+
break;
|
87
|
+
default:
|
88
|
+
break;
|
89
|
+
}
|
90
|
+
switch (position) {
|
91
|
+
case "top":
|
92
|
+
case "top-start":
|
93
|
+
case "top-end":
|
94
|
+
top = originBounds.top - targetBounds.height;
|
95
|
+
break;
|
96
|
+
case "bottom":
|
97
|
+
case "bottom-start":
|
98
|
+
case "bottom-end":
|
99
|
+
top = originBounds.bottom;
|
100
|
+
break;
|
101
|
+
case "start":
|
102
|
+
case "end":
|
103
|
+
top = centerBySize(originBounds.height, targetBounds.height) + originBounds.top;
|
104
|
+
break;
|
105
|
+
case "start-top":
|
106
|
+
case "end-top":
|
107
|
+
top = originBounds.top;
|
108
|
+
break;
|
109
|
+
case "start-bottom":
|
110
|
+
case "end-bottom":
|
111
|
+
top = originBounds.bottom - targetBounds.height;
|
112
|
+
break;
|
113
|
+
default:
|
114
|
+
break;
|
115
|
+
}
|
116
|
+
if (top === undefined || left === undefined) {
|
117
|
+
throw Error(`[Reshaped, flyout]: ${position} position is not valid`);
|
118
|
+
}
|
119
|
+
// When rendered inside portal, we don't need to accommodate for the page scroll
|
120
|
+
top = Math.round(top + (isInsidePortal ? 0 : window.pageYOffset || 0));
|
121
|
+
left = Math.round(left + (isInsidePortal ? 0 : window.pageXOffset || 0));
|
122
|
+
let widthStyle = Math.ceil(targetBounds.width);
|
123
|
+
const height = Math.ceil(targetBounds.height);
|
124
|
+
if (width === "full") {
|
125
|
+
left = SCREEN_OFFSET;
|
126
|
+
widthStyle = window.innerWidth - SCREEN_OFFSET * 2;
|
127
|
+
}
|
128
|
+
else if (width === "trigger") {
|
129
|
+
widthStyle = originBounds.width;
|
130
|
+
}
|
131
|
+
const styles = { left, top, width: widthStyle, height };
|
132
|
+
return { styles, position };
|
133
|
+
};
|
134
|
+
/**
|
135
|
+
* Order of keys here is responsible for the order of styles applied
|
136
|
+
*/
|
137
|
+
const defaultStyles = {
|
138
|
+
left: 0,
|
139
|
+
top: 0,
|
140
|
+
width: "auto",
|
141
|
+
height: "auto",
|
142
|
+
position: "absolute",
|
143
|
+
// z-index doesn't accept strings
|
144
|
+
zIndex: "var(--rs-z-index-flyout)",
|
145
|
+
};
|
146
|
+
const resetStyles = {
|
147
|
+
left: 0,
|
148
|
+
top: 0,
|
149
|
+
position: "fixed",
|
150
|
+
opacity: 0,
|
151
|
+
animation: "none",
|
152
|
+
transition: "none",
|
153
|
+
zIndex: "var(--rs-z-index-tooltip)",
|
154
|
+
};
|
155
|
+
/**
|
156
|
+
* Set position of the target element to fit on the screen
|
157
|
+
*/
|
158
|
+
const flyout = (origin, target, options) => {
|
159
|
+
const { position, forcePosition, width } = options;
|
160
|
+
const targetClone = target.cloneNode(true);
|
161
|
+
const originBounds = origin.getBoundingClientRect();
|
162
|
+
// Reset all styles applied on the previous hook execution
|
163
|
+
targetClone.style = "";
|
164
|
+
Object.keys(resetStyles).forEach((key) => {
|
165
|
+
const value = resetStyles[key];
|
166
|
+
targetClone.style[key] = value.toString();
|
167
|
+
});
|
168
|
+
if (width) {
|
169
|
+
if (width === "trigger") {
|
170
|
+
targetClone.style.width = `${originBounds.width}px`;
|
171
|
+
}
|
172
|
+
else if (width !== "full") {
|
173
|
+
targetClone.style.width = width;
|
174
|
+
}
|
175
|
+
}
|
176
|
+
document.body.appendChild(targetClone);
|
177
|
+
const targetBounds = targetClone.getBoundingClientRect();
|
178
|
+
let calculated = calculatePosition(originBounds, targetBounds, options);
|
179
|
+
if (!fullyVisible(calculated.styles) && !forcePosition) {
|
180
|
+
const order = getPositionOrder(position);
|
181
|
+
const mobileOrder = order.filter((position) => position === "top" || position === "bottom");
|
182
|
+
const test = (testOrder, extraOptions = {}) => {
|
183
|
+
const { fullWidth } = extraOptions;
|
184
|
+
testOrder.some((currentPosition) => {
|
185
|
+
const calculateOptions = Object.assign(Object.assign({}, options), { width: fullWidth ? "full" : options.width, position: currentPosition });
|
186
|
+
const tested = calculatePosition(originBounds, targetBounds, calculateOptions);
|
187
|
+
if (fullyVisible(tested.styles)) {
|
188
|
+
calculated = tested;
|
189
|
+
return true;
|
190
|
+
}
|
191
|
+
return false;
|
192
|
+
});
|
193
|
+
};
|
194
|
+
test(order);
|
195
|
+
if (!fullyVisible(calculated.styles)) {
|
196
|
+
test(mobileOrder, { fullWidth: true });
|
197
|
+
}
|
198
|
+
}
|
199
|
+
targetClone.parentNode.removeChild(targetClone);
|
200
|
+
return calculated;
|
201
|
+
};
|
202
|
+
const flyoutReducer = (state, action) => {
|
203
|
+
switch (action.type) {
|
204
|
+
case "render":
|
205
|
+
return Object.assign(Object.assign({}, state), { status: "rendered" });
|
206
|
+
case "position":
|
207
|
+
return Object.assign(Object.assign({}, state), { status: state.status === "visible" ? "visible" : "positioned", position: action.payload.position, styles: Object.assign(Object.assign({}, defaultStyles), action.payload.styles) });
|
208
|
+
case "show":
|
209
|
+
return Object.assign(Object.assign({}, state), { status: "visible" });
|
210
|
+
case "hide":
|
211
|
+
return Object.assign(Object.assign({}, state), { status: state.status === "idle" ? "idle" : "hidden" });
|
212
|
+
case "remove":
|
213
|
+
return Object.assign(Object.assign({}, state), { status: "idle", styles: resetStyles });
|
214
|
+
default:
|
215
|
+
throw new Error("Invalid reducer type");
|
216
|
+
}
|
217
|
+
};
|
218
|
+
const useFlyout = (originRef, targetRef, options) => {
|
219
|
+
const { position: defaultPosition = "bottom", forcePosition, width } = options;
|
220
|
+
const { scopeRef } = usePortal();
|
221
|
+
const isInsidePortal = !!(scopeRef === null || scopeRef === void 0 ? void 0 : scopeRef.current);
|
222
|
+
const [isRTL] = useRTL();
|
223
|
+
const [state, dispatch] = React.useReducer(flyoutReducer, {
|
224
|
+
position: defaultPosition,
|
225
|
+
styles: defaultStyles,
|
226
|
+
status: "idle",
|
227
|
+
});
|
228
|
+
const render = React.useCallback(() => {
|
229
|
+
dispatch({ type: "render" });
|
230
|
+
}, []);
|
231
|
+
const show = React.useCallback(() => {
|
232
|
+
dispatch({ type: "show" });
|
233
|
+
}, []);
|
234
|
+
const hide = React.useCallback(() => {
|
235
|
+
dispatch({ type: "hide" });
|
236
|
+
}, []);
|
237
|
+
const remove = React.useCallback(() => {
|
238
|
+
dispatch({ type: "remove" });
|
239
|
+
}, []);
|
240
|
+
const updatePosition = React.useCallback(() => {
|
241
|
+
if (!originRef.current || !targetRef.current)
|
242
|
+
return;
|
243
|
+
const nextFlyoutData = flyout(originRef.current, targetRef.current, {
|
244
|
+
width,
|
245
|
+
position: defaultPosition,
|
246
|
+
forcePosition,
|
247
|
+
rtl: isRTL,
|
248
|
+
isInsidePortal,
|
249
|
+
});
|
250
|
+
dispatch({ type: "position", payload: nextFlyoutData });
|
251
|
+
}, [originRef, targetRef, defaultPosition, isRTL, forcePosition, width, isInsidePortal]);
|
252
|
+
React.useEffect(() => {
|
253
|
+
if (state.status === "rendered")
|
254
|
+
updatePosition();
|
255
|
+
// Wait after positioning before show is triggered to animate flyout from the right side
|
256
|
+
if (state.status === "positioned")
|
257
|
+
onNextFrame(() => show());
|
258
|
+
}, [state.status, updatePosition, show]);
|
259
|
+
return React.useMemo(() => ({
|
260
|
+
position: state.position,
|
261
|
+
styles: state.styles,
|
262
|
+
status: state.status,
|
263
|
+
updatePosition,
|
264
|
+
render,
|
265
|
+
hide,
|
266
|
+
remove,
|
267
|
+
}), [render, updatePosition, hide, remove, state.position, state.styles, state.status]);
|
268
|
+
};
|
269
|
+
export default useFlyout;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* Singleton hook to check if multiple elements can be dismissed and returns flag only for the latest one
|
3
|
+
* Example: Use to only close the latest opened Flyout/Modal
|
4
|
+
*/
|
5
|
+
import React from "react";
|
6
|
+
type Ref = React.RefObject<HTMLElement>;
|
7
|
+
declare const useIsDismissible: (active: boolean | undefined, contentRef: Ref, triggerRef?: Ref) => () => boolean;
|
8
|
+
export default useIsDismissible;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/**
|
2
|
+
* Singleton hook to check if multiple elements can be dismissed and returns flag only for the latest one
|
3
|
+
* Example: Use to only close the latest opened Flyout/Modal
|
4
|
+
*/
|
5
|
+
import React from "react";
|
6
|
+
import useElementId from "../useElementId.js";
|
7
|
+
let queue = {};
|
8
|
+
let latestId = null;
|
9
|
+
const removeFromQueue = (id) => {
|
10
|
+
// Ignore removal of non-existing ids when called on component mount with active: false
|
11
|
+
if (!queue[id])
|
12
|
+
return;
|
13
|
+
if (id === latestId)
|
14
|
+
latestId = queue[id].parentId;
|
15
|
+
delete queue[id];
|
16
|
+
// Clear up all unused ids after the queue is resolved
|
17
|
+
if (latestId === null)
|
18
|
+
queue = {};
|
19
|
+
};
|
20
|
+
const addToQueue = (id, contentRef, triggerRef) => {
|
21
|
+
var _a;
|
22
|
+
const parentItem = latestId ? queue[latestId] : undefined;
|
23
|
+
const insideParent = (triggerRef === null || triggerRef === void 0 ? void 0 : triggerRef.current) &&
|
24
|
+
parentItem &&
|
25
|
+
((_a = parentItem.contentRef.current) === null || _a === void 0 ? void 0 : _a.contains(triggerRef.current));
|
26
|
+
if (!insideParent && triggerRef && latestId) {
|
27
|
+
removeFromQueue(latestId);
|
28
|
+
}
|
29
|
+
queue[id] = { parentId: latestId, triggerRef, contentRef };
|
30
|
+
latestId = id;
|
31
|
+
};
|
32
|
+
const useIsDismissible = (active = false, contentRef, triggerRef) => {
|
33
|
+
const id = useElementId();
|
34
|
+
const isDismissible = React.useCallback(() => latestId === id, [id]);
|
35
|
+
React.useEffect(() => {
|
36
|
+
if (active) {
|
37
|
+
addToQueue(id, contentRef, triggerRef);
|
38
|
+
}
|
39
|
+
else {
|
40
|
+
removeFromQueue(id);
|
41
|
+
}
|
42
|
+
}, [active, id, contentRef, triggerRef]);
|
43
|
+
return isDismissible;
|
44
|
+
};
|
45
|
+
export default useIsDismissible;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import React from "react";
|
2
|
+
const useOnClickOutside = (refs, handler) => {
|
3
|
+
React.useEffect(() => {
|
4
|
+
if (!handler)
|
5
|
+
return;
|
6
|
+
const handleClick = (event) => {
|
7
|
+
let isInside = false;
|
8
|
+
refs.forEach((elRef) => {
|
9
|
+
if (!elRef.current ||
|
10
|
+
elRef.current === event.target ||
|
11
|
+
elRef.current.contains(event.target)) {
|
12
|
+
isInside = true;
|
13
|
+
}
|
14
|
+
});
|
15
|
+
if (isInside)
|
16
|
+
return;
|
17
|
+
handler(event);
|
18
|
+
};
|
19
|
+
// Using events that happen before click to handle cases when element is hidden on click
|
20
|
+
document.addEventListener("mousedown", handleClick);
|
21
|
+
document.addEventListener("touchstart", handleClick);
|
22
|
+
return () => {
|
23
|
+
document.removeEventListener("mousedown", handleClick);
|
24
|
+
document.removeEventListener("touchstart", handleClick);
|
25
|
+
};
|
26
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
27
|
+
}, [handler, ...refs]);
|
28
|
+
};
|
29
|
+
export default useOnClickOutside;
|