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,35 @@
|
|
1
|
+
"use client";
|
2
|
+
import React from "react";
|
3
|
+
import { classNames } from "../../utilities/helpers.js";
|
4
|
+
import HiddenInput from "../_private/HiddenInput/index.js";
|
5
|
+
import { useRadioGroup } from "../RadioGroup/index.js";
|
6
|
+
import { useFormControl } from "../FormControl/index.js";
|
7
|
+
import s from "./Radio.module.css";
|
8
|
+
const Radio = (props) => {
|
9
|
+
const { children, value, onChange, onFocus, onBlur, className, attributes, inputAttributes } = props;
|
10
|
+
const formControl = useFormControl();
|
11
|
+
const radioGroup = useRadioGroup();
|
12
|
+
const hasError = (formControl === null || formControl === void 0 ? void 0 : formControl.hasError) || props.hasError || (radioGroup === null || radioGroup === void 0 ? void 0 : radioGroup.hasError);
|
13
|
+
const disabled = (formControl === null || formControl === void 0 ? void 0 : formControl.disabled) || props.disabled || (radioGroup === null || radioGroup === void 0 ? void 0 : radioGroup.disabled);
|
14
|
+
const checked = radioGroup ? radioGroup.value === value : props.checked;
|
15
|
+
const defaultChecked = radioGroup ? undefined : props.defaultChecked;
|
16
|
+
const name = radioGroup ? radioGroup.name : props.name;
|
17
|
+
const TagName = children ? "label" : "span";
|
18
|
+
const rootClassName = classNames(s.root, className, hasError && s["--error"], disabled && s["--disabled"]);
|
19
|
+
const handleChange = (event) => {
|
20
|
+
if (!name)
|
21
|
+
return;
|
22
|
+
const { checked } = event.target;
|
23
|
+
const changeArgs = { name, value, checked, event };
|
24
|
+
if (onChange)
|
25
|
+
onChange(changeArgs);
|
26
|
+
if (radioGroup === null || radioGroup === void 0 ? void 0 : radioGroup.onChange)
|
27
|
+
radioGroup.onChange(changeArgs);
|
28
|
+
};
|
29
|
+
return (React.createElement(TagName, Object.assign({}, attributes, { className: rootClassName }),
|
30
|
+
React.createElement("span", { className: s.field },
|
31
|
+
React.createElement(HiddenInput, { className: s.input, type: "radio", checked: checked, defaultChecked: defaultChecked, name: name, disabled: disabled, value: value, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, attributes: inputAttributes }),
|
32
|
+
React.createElement("div", { className: s.decorator })),
|
33
|
+
children && React.createElement("span", { className: s.text }, children)));
|
34
|
+
};
|
35
|
+
export default Radio;
|
@@ -0,0 +1 @@
|
|
1
|
+
.root{align-items:center;cursor:pointer;display:inline-flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:top}.root:hover .input:not(:checked)+.decorator{background:var(--rs-color-background-neutral-faded)}.field{position:relative}.decorator{background:var(--rs-color-background-elevation-base);border:1px solid var(--rs-color-border-neutral);border-radius:50%;height:var(--rs-line-height-body-3);width:var(--rs-line-height-body-3)}.decorator:after{background:var(--rs-color-on-background-primary);border-radius:50%;content:"";height:var(--rs-unit-x2);left:50%;opacity:0;position:absolute;top:50%;transform:translate(-50%,-50%);width:var(--rs-unit-x2)}[data-rs-keyboard] .input:focus+.decorator{box-shadow:var(--rs-focus-shadow)}.input:checked+.decorator,.root.--error .input:checked+.decorator,.root.--error:hover .input:checked+.decorator{background:var(--rs-color-background-primary);border-color:var(--rs-color-background-primary);border-width:2px}.input:checked+.decorator:after,.root.--error .input:checked+.decorator:after,.root.--error:hover .input:checked+.decorator:after{opacity:1;transform:translate(-50%,-50%)}.text{-webkit-margin-start:var(--rs-unit-x2);margin-inline-start:var(--rs-unit-x2)}.root.--error .decorator,.root.--error:hover .input+.decorator{border-color:var(--rs-color-border-critical)}.root.--disabled{color:var(--rs-color-foreground-disabled);cursor:not-allowed}.root.--disabled .decorator,.root.--disabled .input:checked+.decorator,.root.--disabled:hover .input+.decorator{background:var(--rs-color-background-disabled-faded);border-color:var(--rs-color-border-disabled)}.root.--disabled .input:checked+.decorator{border-color:transparent}.root.--disabled .input:checked+.decorator:after{background:var(--rs-color-border-disabled)}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import type * as G from "../../types/global";
|
3
|
+
type BaseProps = {
|
4
|
+
children?: React.ReactNode;
|
5
|
+
name?: string;
|
6
|
+
disabled?: boolean;
|
7
|
+
hasError?: boolean;
|
8
|
+
value: string;
|
9
|
+
onChange?: G.ChangeHandler<boolean>;
|
10
|
+
onFocus?: (e: React.FocusEvent) => void;
|
11
|
+
onBlur?: (e: React.FocusEvent) => void;
|
12
|
+
className?: G.ClassName;
|
13
|
+
attributes?: G.Attributes<"label", Props>;
|
14
|
+
inputAttributes?: G.Attributes<"input">;
|
15
|
+
};
|
16
|
+
export type ControlledProps = BaseProps & {
|
17
|
+
checked: boolean;
|
18
|
+
defaultChecked?: never;
|
19
|
+
};
|
20
|
+
export type UncontrolledProps = BaseProps & {
|
21
|
+
checked?: never;
|
22
|
+
defaultChecked?: boolean;
|
23
|
+
};
|
24
|
+
export type Props = ControlledProps | UncontrolledProps;
|
25
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "./Radio.js";
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import React from "react";
|
2
|
+
declare const _default: {
|
3
|
+
title: string;
|
4
|
+
};
|
5
|
+
export default _default;
|
6
|
+
export declare const selection: () => React.JSX.Element;
|
7
|
+
export declare const error: () => React.JSX.Element;
|
8
|
+
export declare const disabled: () => React.JSX.Element;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Example } from "../../../utilities/storybook/index.js";
|
3
|
+
import Radio from "../index.js";
|
4
|
+
export default { title: "Components/Radio" };
|
5
|
+
export const selection = () => (<Example>
|
6
|
+
<Example.Item title="unselected">
|
7
|
+
<Radio name="unselected" value="dog">
|
8
|
+
Radio
|
9
|
+
</Radio>
|
10
|
+
</Example.Item>
|
11
|
+
|
12
|
+
<Example.Item title="checked, uncontrolled">
|
13
|
+
<Radio name="uncontrolled" value="dog" defaultChecked>
|
14
|
+
Radio
|
15
|
+
</Radio>
|
16
|
+
</Example.Item>
|
17
|
+
|
18
|
+
<Example.Item title="checked, controlled">
|
19
|
+
<Radio name="controlled" value="dog" checked>
|
20
|
+
Radio
|
21
|
+
</Radio>
|
22
|
+
</Example.Item>
|
23
|
+
</Example>);
|
24
|
+
export const error = () => (<Example>
|
25
|
+
<Example.Item title="error">
|
26
|
+
<Radio name="error" value="dog" hasError>
|
27
|
+
Radio
|
28
|
+
</Radio>
|
29
|
+
</Example.Item>
|
30
|
+
</Example>);
|
31
|
+
export const disabled = () => (<Example>
|
32
|
+
<Example.Item title="disabled">
|
33
|
+
<Radio name="disabled" value="dog" disabled>
|
34
|
+
Radio
|
35
|
+
</Radio>
|
36
|
+
</Example.Item>
|
37
|
+
<Example.Item title="disabled, checked">
|
38
|
+
<Radio name="disabled-checked" value="dog" disabled checked>
|
39
|
+
Radio
|
40
|
+
</Radio>
|
41
|
+
</Example.Item>
|
42
|
+
</Example>);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import RadioGroupControlled from "./RadioGroupControlled.js";
|
3
|
+
import RadioGroupUncontrolled from "./RadioGroupUncontrolled.js";
|
4
|
+
const RadioGroup = (props) => {
|
5
|
+
const { value } = props;
|
6
|
+
if (value !== undefined)
|
7
|
+
return React.createElement(RadioGroupControlled, Object.assign({}, props));
|
8
|
+
return React.createElement(RadioGroupUncontrolled, Object.assign({}, props));
|
9
|
+
};
|
10
|
+
export default RadioGroup;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import type * as G from "../../types/global";
|
3
|
+
import { RadioProps } from "../Radio";
|
4
|
+
type BaseProps = {
|
5
|
+
id?: string;
|
6
|
+
children?: React.ReactNode;
|
7
|
+
disabled?: boolean;
|
8
|
+
name: string;
|
9
|
+
hasError?: boolean;
|
10
|
+
onChange?: G.ChangeHandler<string>;
|
11
|
+
};
|
12
|
+
export type ControlledProps = BaseProps & {
|
13
|
+
value: string | null;
|
14
|
+
defaultValue?: never;
|
15
|
+
};
|
16
|
+
export type UncontrolledProps = BaseProps & {
|
17
|
+
value?: never;
|
18
|
+
defaultValue?: string;
|
19
|
+
};
|
20
|
+
export type Props = ControlledProps | UncontrolledProps;
|
21
|
+
export type Context = {
|
22
|
+
onChange: RadioProps["onChange"];
|
23
|
+
hasError?: boolean;
|
24
|
+
disabled?: boolean;
|
25
|
+
name: string;
|
26
|
+
value?: string | null;
|
27
|
+
};
|
28
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use client";
|
2
|
+
import React from "react";
|
3
|
+
import Context from "./RadioGroup.context.js";
|
4
|
+
const RadioGroupControlled = (props) => {
|
5
|
+
const { onChange, name, disabled, value, children, hasError } = props;
|
6
|
+
const handleChange = ({ event, value }) => {
|
7
|
+
if (!value)
|
8
|
+
return;
|
9
|
+
if (onChange)
|
10
|
+
onChange({ name, value, event });
|
11
|
+
};
|
12
|
+
return (React.createElement(Context.Provider, { value: { onChange: handleChange, disabled, value, name, hasError } }, children));
|
13
|
+
};
|
14
|
+
export default RadioGroupControlled;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use client";
|
2
|
+
import React from "react";
|
3
|
+
import RadioGroupControlled from "./RadioGroupControlled.js";
|
4
|
+
const RadioGroupUncontrolled = (props) => {
|
5
|
+
const { defaultValue, onChange } = props;
|
6
|
+
const [value, setValue] = React.useState(defaultValue || null);
|
7
|
+
const handleChange = (args) => {
|
8
|
+
if (!args.value)
|
9
|
+
return;
|
10
|
+
setValue(args.value);
|
11
|
+
if (onChange)
|
12
|
+
onChange(args);
|
13
|
+
};
|
14
|
+
return (React.createElement(RadioGroupControlled, Object.assign({}, props, { value: value, defaultValue: undefined, onChange: handleChange })));
|
15
|
+
};
|
16
|
+
export default RadioGroupUncontrolled;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Example } from "../../../utilities/storybook/index.js";
|
3
|
+
import View from "../../View/index.js";
|
4
|
+
import RadioGroup from "../index.js";
|
5
|
+
import Radio from "../../Radio/index.js";
|
6
|
+
export default { title: "Components/RadioGroup" };
|
7
|
+
export const selection = () => (<Example>
|
8
|
+
<Example.Item title="unselected">
|
9
|
+
<RadioGroup name="unselected">
|
10
|
+
<View gap={3}>
|
11
|
+
<Radio value="dog">Radio 1</Radio>
|
12
|
+
<Radio value="cat">Radio 2</Radio>
|
13
|
+
</View>
|
14
|
+
</RadioGroup>
|
15
|
+
</Example.Item>
|
16
|
+
|
17
|
+
<Example.Item title="checked, uncontrolled">
|
18
|
+
<RadioGroup name="uncontrolled" defaultValue={"dog"}>
|
19
|
+
<View gap={3}>
|
20
|
+
<Radio value="dog">Radio 1</Radio>
|
21
|
+
<Radio value="cat">Radio 2</Radio>
|
22
|
+
</View>
|
23
|
+
</RadioGroup>
|
24
|
+
</Example.Item>
|
25
|
+
|
26
|
+
<Example.Item title="checked, controlled">
|
27
|
+
<RadioGroup name="controlled" value={"dog"}>
|
28
|
+
<View gap={3}>
|
29
|
+
<Radio value="dog">Radio 1</Radio>
|
30
|
+
<Radio value="cat">Radio 2</Radio>
|
31
|
+
</View>
|
32
|
+
</RadioGroup>
|
33
|
+
</Example.Item>
|
34
|
+
</Example>);
|
35
|
+
export const disabled = () => (<Example>
|
36
|
+
<Example.Item title="disabled">
|
37
|
+
<RadioGroup name="disabled" disabled>
|
38
|
+
<View gap={3}>
|
39
|
+
<Radio value="dog">Dog</Radio>
|
40
|
+
<Radio value="cat">Cat</Radio>
|
41
|
+
</View>
|
42
|
+
</RadioGroup>
|
43
|
+
</Example.Item>
|
44
|
+
</Example>);
|
@@ -0,0 +1 @@
|
|
1
|
+
:root{--rs-z-index-raised:5;--rs-z-index-flyout:80;--rs-z-index-fixed:90;--rs-z-index-overlay:100;--rs-z-index-notification:110}[data-rs-color-mode=light]{color-scheme:light}[data-rs-color-mode=dark]{color-scheme:dark}*{box-sizing:border-box}blockquote,body,dd,dl,figcaption,figure,h1,h2,h3,h4,h5,h6,li,ol,p,ul{margin:0;padding:0}ol[class],ul[class]{list-style:none}a:not([class]){-webkit-text-decoration-skip:ink;text-decoration-skip-ink:auto}img{display:block;max-width:100%}button,input,select,textarea{font:inherit}option{background:var(--rs-color-background-elevation-base)}label{cursor:pointer}@media (prefers-reduced-motion:reduce){*{animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important;transition-duration:.01ms!important}}[data-rs-no-transition] *,[data-rs-no-transition] :after,[data-rs-no-transition] :before{transition:none!important}input::-moz-placeholder{color:var(--rs-color-neutral-faded);opacity:.5}input::placeholder{color:var(--rs-color-neutral-faded);opacity:.5}html{-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;text-rendering:optimizelegibility;touch-action:manipulation}body,html{height:100%}body{background:var(--rs-color-background-page);color:var(--rs-color-foreground-neutral);scroll-behavior:smooth;text-rendering:optimizespeed}[data-rs-theme],body{font-family:var(--rs-font-family-body);font-size:var(--rs-font-size-body-3);font-weight:var(--rs-font-weight-regular);line-height:var(--rs-line-height-body-3)}textarea{resize:vertical}table{border-collapse:collapse;border-spacing:0}fieldset{border:0;margin:0;padding:0}a{color:var(--rs-color-foreground-primary);text-decoration:underline}a:hover{text-decoration:none}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use client";
|
2
|
+
import React from "react";
|
3
|
+
import { classNames } from "../../utilities/helpers.js";
|
4
|
+
import Theme, { GlobalColorMode } from "../Theme/index.js";
|
5
|
+
import { ToastProvider } from "../Toast/index.js";
|
6
|
+
import useSingletonKeyboardMode from "../../hooks/_private/useSingletonKeyboardMode.js";
|
7
|
+
import { SingletonEnvironmentContext, useSingletonRTL, } from "../../hooks/_private/useSingletonEnvironment.js";
|
8
|
+
import { SingletonHotkeysProvider } from "../../hooks/_private/useSingletonHotkeys.js";
|
9
|
+
import "./Reshaped.css";
|
10
|
+
import s from "./Reshaped.module.css";
|
11
|
+
const ReshapedInner = (props) => {
|
12
|
+
const { children, defaultRTL, defaultViewport = "s", toastOptions } = props;
|
13
|
+
const rtlState = useSingletonRTL(defaultRTL);
|
14
|
+
useSingletonKeyboardMode();
|
15
|
+
return (React.createElement(SingletonEnvironmentContext.Provider, { value: { rtl: rtlState, defaultViewport } },
|
16
|
+
React.createElement(SingletonHotkeysProvider, null,
|
17
|
+
React.createElement(ToastProvider, { options: toastOptions }, children))));
|
18
|
+
};
|
19
|
+
const Reshaped = (props) => {
|
20
|
+
const { theme, defaultTheme = "reshaped", defaultColorMode, className } = props;
|
21
|
+
const rootClassNames = classNames(s.root, className);
|
22
|
+
return (React.createElement(GlobalColorMode, { defaultMode: defaultColorMode },
|
23
|
+
React.createElement(Theme, { name: theme, defaultName: defaultTheme, className: rootClassNames },
|
24
|
+
React.createElement(ReshapedInner, Object.assign({}, props), props.children))));
|
25
|
+
};
|
26
|
+
export default Reshaped;
|
@@ -0,0 +1 @@
|
|
1
|
+
.root{color:inherit;height:inherit}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import type React from "react";
|
2
|
+
import type { GlobalColorModeProps, ThemeProps } from "../Theme";
|
3
|
+
import type { ToastProviderProps } from "../Toast";
|
4
|
+
import type * as G from "../../types/global";
|
5
|
+
export type Props = {
|
6
|
+
children?: React.ReactNode;
|
7
|
+
defaultRTL?: boolean;
|
8
|
+
defaultColorMode?: GlobalColorModeProps["defaultMode"];
|
9
|
+
defaultViewport?: G.Viewport;
|
10
|
+
className?: G.ClassName;
|
11
|
+
theme?: NonNullable<ThemeProps["name"]>;
|
12
|
+
defaultTheme?: NonNullable<ThemeProps["defaultName"]>;
|
13
|
+
toastOptions?: ToastProviderProps["options"];
|
14
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "./Reshaped.js";
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { classNames } from "../../utilities/helpers.js";
|
3
|
+
import s from "./Scrim.module.css";
|
4
|
+
const Scrim = (props) => {
|
5
|
+
const { children, backgroundSlot, position = "cover", attributes, className, scrimClassName, } = props;
|
6
|
+
const rootClassNames = classNames(s.root, !!backgroundSlot && s["--with-background"], position && s[`--position-${position}`], className);
|
7
|
+
const scrimClassNames = classNames(s.scrim, scrimClassName);
|
8
|
+
return (React.createElement("div", Object.assign({}, attributes, { className: rootClassNames }),
|
9
|
+
backgroundSlot,
|
10
|
+
React.createElement("div", { className: scrimClassNames },
|
11
|
+
React.createElement("div", { className: s.content }, children))));
|
12
|
+
};
|
13
|
+
export default Scrim;
|
@@ -0,0 +1 @@
|
|
1
|
+
.root,.scrim{inset:0;position:absolute}.root{--rs-overlay-gradient:rgba(var(--rs-color-rgb-black),0%),rgba(var(--rs-color-rgb-black),0.52%),rgba(var(--rs-color-rgb-black),2.13%),rgba(var(--rs-color-rgb-black),4.9%),rgba(var(--rs-color-rgb-black),8.84%),rgba(var(--rs-color-rgb-black),13.91%),rgba(var(--rs-color-rgb-black),19.91%),rgba(var(--rs-color-rgb-black),26.56%),rgba(var(--rs-color-rgb-black),33.44%),rgba(var(--rs-color-rgb-black),40.09%),rgba(var(--rs-color-rgb-black),46.09%),rgba(var(--rs-color-rgb-black),51.16%),rgba(var(--rs-color-rgb-black),55.1%),rgba(var(--rs-color-rgb-black),57.87%),rgba(var(--rs-color-rgb-black),59.48%),rgba(var(--rs-color-rgb-black),60%);pointer-events:none}.scrim{color:var(--rs-color-white);padding:var(--rs-unit-x3) var(--rs-unit-x4);transform:translateZ(0)}.content{pointer-events:all;position:relative;z-index:5}.--position-cover .scrim{align-items:center;display:flex;justify-content:center}.--position-cover .scrim:after{background-color:var(--rs-color-black);content:"";inset:0;opacity:.5;position:absolute}.--position-cover .content{text-align:center}.--position-bottom .content,.--position-cover .content,.--position-top .content{width:100%}.--position-end .content,.--position-start .content{height:100%}.--position-top .scrim{-webkit-padding-after:calc(var(--rs-unit-x10) * 2);background:linear-gradient(to top,var(--rs-overlay-gradient));inset-block-end:auto;padding-block-end:calc(var(--rs-unit-x10) * 2)}.--position-bottom .scrim{-webkit-padding-before:calc(var(--rs-unit-x10) * 2);background:linear-gradient(to bottom,var(--rs-overlay-gradient));inset-block-start:auto;padding-block-start:calc(var(--rs-unit-x10) * 2)}.--position-start .scrim{-webkit-padding-end:calc(var(--rs-unit-x10) * 2);background:linear-gradient(to left,var(--rs-overlay-gradient));inset-inline-end:auto;padding-inline-end:calc(var(--rs-unit-x10) * 2);width:auto}.--position-end .scrim,[dir=rtl] .--position-start .scrim{background:linear-gradient(to right,var(--rs-overlay-gradient))}.--position-end .scrim{-webkit-padding-start:calc(var(--rs-unit-x10) * 2);inset-inline-start:auto;padding-inline-start:calc(var(--rs-unit-x10) * 2);width:auto}[dir=rtl] .--position-end .scrim{background:linear-gradient(to left,var(--rs-overlay-gradient))}.--with-background{position:relative}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import type * as G from "../../types/global";
|
3
|
+
export type Props = {
|
4
|
+
children?: React.ReactNode;
|
5
|
+
backgroundSlot?: React.ReactNode;
|
6
|
+
position?: "full" | "top" | "bottom" | "start" | "end";
|
7
|
+
fill?: boolean;
|
8
|
+
scrimClassName?: G.ClassName;
|
9
|
+
className?: G.ClassName;
|
10
|
+
attributes?: G.Attributes<"div", Props>;
|
11
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "./Scrim.js";
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Example, Placeholder } from "../../../utilities/storybook/index.js";
|
3
|
+
import Scrim from "../index.js";
|
4
|
+
export default { title: "Components/Scrim" };
|
5
|
+
export const position = () => (<Example>
|
6
|
+
<Example.Item title="position: center">
|
7
|
+
<Scrim backgroundSlot={<Placeholder h={200}/>}>Scrim</Scrim>
|
8
|
+
</Example.Item>
|
9
|
+
|
10
|
+
<Example.Item title="position: bottom">
|
11
|
+
<Scrim position="bottom" backgroundSlot={<Placeholder h={200}/>}>
|
12
|
+
Scrim
|
13
|
+
</Scrim>
|
14
|
+
</Example.Item>
|
15
|
+
|
16
|
+
<Example.Item title="position: top">
|
17
|
+
<Scrim position="top" backgroundSlot={<Placeholder h={200}/>}>
|
18
|
+
Scrim
|
19
|
+
</Scrim>
|
20
|
+
</Example.Item>
|
21
|
+
|
22
|
+
<Example.Item title="position: start">
|
23
|
+
<Scrim position="start" backgroundSlot={<Placeholder h={200}/>}>
|
24
|
+
Scrim
|
25
|
+
</Scrim>
|
26
|
+
</Example.Item>
|
27
|
+
|
28
|
+
<Example.Item title="position: end">
|
29
|
+
<Scrim position="end" backgroundSlot={<Placeholder h={200}/>}>
|
30
|
+
Scrim
|
31
|
+
</Scrim>
|
32
|
+
</Example.Item>
|
33
|
+
</Example>);
|
34
|
+
export const composition = () => (<Example>
|
35
|
+
<Example.Item title="without backgroundSlot, size is based on the parent component">
|
36
|
+
<div style={{ height: 300, position: "relative" }}>
|
37
|
+
<Scrim>Text</Scrim>
|
38
|
+
</div>
|
39
|
+
</Example.Item>
|
40
|
+
</Example>);
|
@@ -0,0 +1,59 @@
|
|
1
|
+
"use client";
|
2
|
+
import React from "react";
|
3
|
+
import Icon from "../Icon/index.js";
|
4
|
+
import { useFormControl } from "../FormControl/index.js";
|
5
|
+
import Actionable from "../Actionable/index.js";
|
6
|
+
import Text from "../Text/index.js";
|
7
|
+
import IconArrow from "../../icons/ChevronVertical.js";
|
8
|
+
import { classNames, responsiveClassNames, responsivePropDependency } from "../../utilities/helpers.js";
|
9
|
+
import useElementId from "../../hooks/useElementId.js";
|
10
|
+
import s from "./Select.module.css";
|
11
|
+
const Select = (props) => {
|
12
|
+
var _a, _b;
|
13
|
+
const { onChange, onClick, onFocus, onBlur, name, value, defaultValue, placeholder, options, children, icon, startSlot, size = "medium", variant = "outline", className, attributes, } = props;
|
14
|
+
const [empty, setEmpty] = React.useState(value === undefined ? !defaultValue : !value);
|
15
|
+
const formControl = useFormControl();
|
16
|
+
const id = useElementId(props.id);
|
17
|
+
const inputId = ((_a = formControl === null || formControl === void 0 ? void 0 : formControl.attributes) === null || _a === void 0 ? void 0 : _a.id) || ((_b = props.inputAttributes) === null || _b === void 0 ? void 0 : _b.id) || id;
|
18
|
+
const disabled = (formControl === null || formControl === void 0 ? void 0 : formControl.disabled) || props.disabled;
|
19
|
+
const hasError = (formControl === null || formControl === void 0 ? void 0 : formControl.hasError) || props.hasError;
|
20
|
+
const inputAttributes = Object.assign(Object.assign({}, props.inputAttributes), formControl === null || formControl === void 0 ? void 0 : formControl.attributes);
|
21
|
+
const rootClassName = classNames(s.root, className, size && responsiveClassNames(s, "--size", size), hasError && s["--status-error"], disabled && s["--disabled"], empty && options && s["--placeholder"], variant && s[`--variant-${variant}`]);
|
22
|
+
const handleChange = (event) => {
|
23
|
+
const nextValue = event.target.value;
|
24
|
+
// Uncontrolled placeholder
|
25
|
+
if (value === undefined)
|
26
|
+
setEmpty(!nextValue);
|
27
|
+
if (!onChange)
|
28
|
+
return;
|
29
|
+
onChange({ name, value: nextValue, event });
|
30
|
+
};
|
31
|
+
// Controlled placeholder
|
32
|
+
React.useEffect(() => {
|
33
|
+
if (value === undefined)
|
34
|
+
return;
|
35
|
+
setEmpty(!value);
|
36
|
+
}, [value]);
|
37
|
+
const startContent = (startSlot || icon) && (React.createElement("div", { className: s.slot }, icon ? (React.createElement(Icon, { size: responsivePropDependency(size, (size) => {
|
38
|
+
if (size === "large")
|
39
|
+
return 5;
|
40
|
+
if (size === "xlarge")
|
41
|
+
return 6;
|
42
|
+
return 4;
|
43
|
+
}), svg: icon, className: s.icon })) : (startSlot)));
|
44
|
+
return (React.createElement("div", Object.assign({}, attributes, { className: rootClassName }),
|
45
|
+
options ? (React.createElement(React.Fragment, null,
|
46
|
+
startContent,
|
47
|
+
React.createElement("select", Object.assign({}, inputAttributes, { className: s.input, disabled: disabled, name: name, value: value, defaultValue: defaultValue, onChange: handleChange, onFocus: onFocus || (inputAttributes === null || inputAttributes === void 0 ? void 0 : inputAttributes.onFocus), onBlur: onBlur || (inputAttributes === null || inputAttributes === void 0 ? void 0 : inputAttributes.onBlur), id: inputId }),
|
48
|
+
placeholder && React.createElement("option", { value: "" }, placeholder),
|
49
|
+
options.map((option) => (React.createElement("option", { key: option.value, value: option.value, disabled: option.disabled }, option.label)))))) : (React.createElement(React.Fragment, null,
|
50
|
+
React.createElement(Actionable, { className: s.input, disabled: disabled, onClick: onClick, attributes: Object.assign(Object.assign({}, inputAttributes), { onFocus: onFocus || (inputAttributes === null || inputAttributes === void 0 ? void 0 : inputAttributes.onFocus), onBlur: onBlur || (inputAttributes === null || inputAttributes === void 0 ? void 0 : inputAttributes.onBlur) }) },
|
51
|
+
startContent,
|
52
|
+
children || (placeholder ? React.createElement(Text, { color: "neutral-faded" }, placeholder) : null)),
|
53
|
+
React.createElement("input", { type: "hidden", value: value, name: name }))),
|
54
|
+
React.createElement("div", { className: s.arrow },
|
55
|
+
React.createElement(Icon, { svg: IconArrow, color: "neutral-faded", size: responsivePropDependency(size, (size) => {
|
56
|
+
return size === "large" || size === "xlarge" ? 5 : 4;
|
57
|
+
}) }))));
|
58
|
+
};
|
59
|
+
export default Select;
|
@@ -0,0 +1 @@
|
|
1
|
+
.root{background:var(--rs-color-background-elevation-base);border:1px solid var(--rs-color-border-neutral);display:flex;overflow:hidden;padding:calc(var(--rs-unit-x1) - 1px);position:relative;z-index:0}.root:focus-within{border-color:var(--rs-color-border-primary);box-shadow:0 0 0 1px var(--rs-color-border-primary)}.input{-webkit-padding-end:calc(var(--rs-select-chevron-size) + var(--rs-select-gap) * 2 + var(--rs-unit-x1));align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:0;box-sizing:border-box;color:var(--rs-color-foreground-neutral);cursor:pointer;display:flex;flex-grow:1;font-family:var(--rs-font-family-body);font-weight:var(--rs-font-weight-regular);outline:none;padding-inline-end:calc(var(--rs-select-chevron-size) + var(--rs-select-gap) * 2 + var(--rs-unit-x1));position:relative;width:100%;z-index:1}.input::-ms-expand{display:none}select.input{-webkit-padding-start:var(--rs-select-gap);padding-inline-start:var(--rs-select-gap)}.slot{align-items:center;display:flex;flex-shrink:0;position:relative;z-index:5}.icon{-webkit-padding-start:var(--rs-select-gap);-webkit-padding-end:var(--rs-unit-x1);box-sizing:initial;padding-inline-end:var(--rs-unit-x1);padding-inline-start:var(--rs-select-gap)}.input .slot{-webkit-padding-start:0;-webkit-padding-end:var(--rs-select-gap);padding-inline-end:var(--rs-select-gap);padding-inline-start:0}.arrow{color:var(--rs-color-foreground-neutral-faded);display:flex;inset-block-start:50%;inset-inline-end:calc(var(--rs-select-gap) + var(--rs-unit-x1));pointer-events:none;position:absolute;transform:translateY(-50%);z-index:5}.--size-medium{--rs-select-gap:var(--rs-unit-x1);--rs-select-chevron-size:var(--rs-unit-x4);border-radius:var(--rs-unit-radius-small)}.--size-medium .input{font-size:var(--rs-font-size-body-3);line-height:var(--rs-line-height-body-3);padding-bottom:var(--rs-unit-x1);padding-top:var(--rs-unit-x1)}.--size-large{--rs-select-gap:var(--rs-unit-x2);--rs-select-chevron-size:var(--rs-unit-x5);border-radius:var(--rs-unit-radius-medium)}.--size-large .input{font-size:var(--rs-font-size-body-2);line-height:var(--rs-line-height-body-2);padding-bottom:var(--rs-unit-x2);padding-top:var(--rs-unit-x2)}.--size-xlarge{--rs-select-gap:var(--rs-unit-x3);--rs-select-chevron-size:var(--rs-unit-x5);border-radius:var(--rs-unit-radius-medium)}.--size-xlarge .input{font-size:var(--rs-font-size-body-2);line-height:var(--rs-line-height-body-2);padding-bottom:var(--rs-unit-x3);padding-top:var(--rs-unit-x3)}.root.--variant-faded{background:var(--rs-color-background-neutral-faded);border-color:transparent}.root.--variant-faded:focus-within{border-color:var(--rs-color-border-primary)}.root.--variant-headless{background:transparent;border-color:transparent}.root.--variant-headless.--status-error,.root.--variant-headless.--status-error:focus-within,.root.--variant-headless:focus-within{border-color:transparent;box-shadow:none}.root.--status-error{border-color:var(--rs-color-border-critical)}.root.--status-error:focus-within{border-color:var(--rs-color-border-primary)}.root.--placeholder .input{color:var(--rs-color-foreground-neutral-faded)}.root.--disabled{background:var(--rs-color-background-disabled-faded);border-color:var(--rs-color-border-disabled)}.root.--disabled .arrow,.root.--disabled .input{color:var(--rs-color-foreground-disabled);cursor:not-allowed}@media (max-width:659px) and (hover:none){.input{font-size:var(--rs-font-size-body-2)!important}}@media (min-width:660px){.--size-medium--m{--rs-select-gap:var(--rs-unit-x1);--rs-select-chevron-size:var(--rs-unit-x4);border-radius:var(--rs-unit-radius-small)}.--size-medium--m .input{font-size:var(--rs-font-size-body-3);line-height:var(--rs-line-height-body-3);padding-bottom:var(--rs-unit-x1);padding-top:var(--rs-unit-x1)}.--size-large--m{--rs-select-gap:var(--rs-unit-x2);--rs-select-chevron-size:var(--rs-unit-x5);border-radius:var(--rs-unit-radius-medium)}.--size-large--m .input{font-size:var(--rs-font-size-body-2);line-height:var(--rs-line-height-body-2);padding-bottom:var(--rs-unit-x2);padding-top:var(--rs-unit-x2)}.--size-xlarge--m{--rs-select-gap:var(--rs-unit-x3);--rs-select-chevron-size:var(--rs-unit-x5);border-radius:var(--rs-unit-radius-medium)}.--size-xlarge--m .input{font-size:var(--rs-font-size-body-2);line-height:var(--rs-line-height-body-2);padding-bottom:var(--rs-unit-x3);padding-top:var(--rs-unit-x3)}}@media (min-width:900px){.--size-medium--l{--rs-select-gap:var(--rs-unit-x1);--rs-select-chevron-size:var(--rs-unit-x4);border-radius:var(--rs-unit-radius-small)}.--size-medium--l .input{font-size:var(--rs-font-size-body-3);line-height:var(--rs-line-height-body-3);padding-bottom:var(--rs-unit-x1);padding-top:var(--rs-unit-x1)}.--size-large--l{--rs-select-gap:var(--rs-unit-x2);--rs-select-chevron-size:var(--rs-unit-x5);border-radius:var(--rs-unit-radius-medium)}.--size-large--l .input{font-size:var(--rs-font-size-body-2);line-height:var(--rs-line-height-body-2);padding-bottom:var(--rs-unit-x2);padding-top:var(--rs-unit-x2)}.--size-xlarge--l{--rs-select-gap:var(--rs-unit-x3);--rs-select-chevron-size:var(--rs-unit-x5);border-radius:var(--rs-unit-radius-medium)}.--size-xlarge--l .input{font-size:var(--rs-font-size-body-2);line-height:var(--rs-line-height-body-2);padding-bottom:var(--rs-unit-x3);padding-top:var(--rs-unit-x3)}}@media (min-width:1280px){.--size-medium--xl{--rs-select-gap:var(--rs-unit-x1);--rs-select-chevron-size:var(--rs-unit-x4);border-radius:var(--rs-unit-radius-small)}.--size-medium--xl .input{font-size:var(--rs-font-size-body-3);line-height:var(--rs-line-height-body-3);padding-bottom:var(--rs-unit-x1);padding-top:var(--rs-unit-x1)}.--size-large--xl{--rs-select-gap:var(--rs-unit-x2);--rs-select-chevron-size:var(--rs-unit-x5);border-radius:var(--rs-unit-radius-medium)}.--size-large--xl .input{font-size:var(--rs-font-size-body-2);line-height:var(--rs-line-height-body-2);padding-bottom:var(--rs-unit-x2);padding-top:var(--rs-unit-x2)}.--size-xlarge--xl{--rs-select-gap:var(--rs-unit-x3);--rs-select-chevron-size:var(--rs-unit-x5);border-radius:var(--rs-unit-radius-medium)}.--size-xlarge--xl .input{font-size:var(--rs-font-size-body-2);line-height:var(--rs-line-height-body-2);padding-bottom:var(--rs-unit-x3);padding-top:var(--rs-unit-x3)}}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import type * as G from "../../types/global";
|
3
|
+
import { FormControlProps } from "../FormControl";
|
4
|
+
import { ActionableProps } from "../Actionable";
|
5
|
+
import { IconProps } from "../Icon";
|
6
|
+
type Size = G.Responsive<"medium" | "large" | "xlarge">;
|
7
|
+
type Option = {
|
8
|
+
label: string;
|
9
|
+
value: string;
|
10
|
+
disabled?: boolean;
|
11
|
+
};
|
12
|
+
export type ButtonTriggerProps = {
|
13
|
+
onClick?: () => void;
|
14
|
+
children?: React.ReactNode;
|
15
|
+
inputAttributes?: ActionableProps["attributes"];
|
16
|
+
options?: never;
|
17
|
+
onChange?: never;
|
18
|
+
};
|
19
|
+
export type SelectTriggerProps = {
|
20
|
+
options: Option[];
|
21
|
+
onChange?: G.ChangeHandler<string, React.ChangeEvent<HTMLSelectElement>>;
|
22
|
+
inputAttributes?: G.Attributes<"select", Omit<Props, "id">>;
|
23
|
+
onClick?: never;
|
24
|
+
children?: never;
|
25
|
+
};
|
26
|
+
type BaseProps = ((ButtonTriggerProps | SelectTriggerProps) & Pick<FormControlProps, "hasError">) & {
|
27
|
+
id?: string;
|
28
|
+
name: string;
|
29
|
+
size?: Size;
|
30
|
+
variant?: "outline" | "faded" | "headless";
|
31
|
+
disabled?: boolean;
|
32
|
+
placeholder?: string;
|
33
|
+
icon?: IconProps["svg"];
|
34
|
+
startSlot?: React.ReactNode;
|
35
|
+
onFocus?: (e: React.FocusEvent) => void;
|
36
|
+
onBlur?: (e: React.FocusEvent) => void;
|
37
|
+
className?: G.ClassName;
|
38
|
+
attributes?: G.Attributes<"div", Props>;
|
39
|
+
};
|
40
|
+
export type ControlledProps = BaseProps & {
|
41
|
+
value: string;
|
42
|
+
defaultValue?: never;
|
43
|
+
};
|
44
|
+
export type UncontrolledProps = BaseProps & {
|
45
|
+
value?: never;
|
46
|
+
defaultValue?: string;
|
47
|
+
};
|
48
|
+
export type Props = ControlledProps | UncontrolledProps;
|
49
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "./Select.js";
|