@bspk/ui 1.0.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/Accordion.d.ts +20 -0
- package/Accordion.js +18 -0
- package/Accordion.js.map +1 -0
- package/Badge.d.ts +33 -0
- package/Badge.js +43 -0
- package/Badge.js.map +1 -0
- package/BannerAlert.d.ts +53 -0
- package/BannerAlert.js +133 -0
- package/BannerAlert.js.map +1 -0
- package/BottomNavigation.d.ts +20 -0
- package/BottomNavigation.js +18 -0
- package/BottomNavigation.js.map +1 -0
- package/BottomSheet.d.ts +20 -0
- package/BottomSheet.js +18 -0
- package/BottomSheet.js.map +1 -0
- package/Breadcrumb.d.ts +20 -0
- package/Breadcrumb.js +18 -0
- package/Breadcrumb.js.map +1 -0
- package/Button.d.ts +66 -0
- package/Button.js +254 -0
- package/Button.js.map +1 -0
- package/ButtonDock.d.ts +20 -0
- package/ButtonDock.js +18 -0
- package/ButtonDock.js.map +1 -0
- package/CODE_OF_CONDUCT.md +137 -0
- package/CONTRIBUTING.md +42 -0
- package/Card.d.ts +37 -0
- package/Card.js +38 -0
- package/Card.js.map +1 -0
- package/Chart.d.ts +20 -0
- package/Chart.js +18 -0
- package/Chart.js.map +1 -0
- package/Checkbox.d.ts +26 -0
- package/Checkbox.js +123 -0
- package/Checkbox.js.map +1 -0
- package/CheckboxGroup.d.ts +49 -0
- package/CheckboxGroup.js +18 -0
- package/CheckboxGroup.js.map +1 -0
- package/CheckboxOption.d.ts +14 -0
- package/CheckboxOption.js +16 -0
- package/CheckboxOption.js.map +1 -0
- package/Chip.d.ts +50 -0
- package/Chip.js +87 -0
- package/Chip.js.map +1 -0
- package/DatePicker.d.ts +20 -0
- package/DatePicker.js +18 -0
- package/DatePicker.js.map +1 -0
- package/Dialog.d.ts +46 -0
- package/Dialog.js +221 -0
- package/Dialog.js.map +1 -0
- package/Divider.d.ts +44 -0
- package/Divider.js +76 -0
- package/Divider.js.map +1 -0
- package/Drawer.d.ts +20 -0
- package/Drawer.js +18 -0
- package/Drawer.js.map +1 -0
- package/Dropdown.d.ts +50 -0
- package/Dropdown.js +153 -0
- package/Dropdown.js.map +1 -0
- package/DropdownField.d.ts +16 -0
- package/DropdownField.js +19 -0
- package/DropdownField.js.map +1 -0
- package/EmptyState.d.ts +35 -0
- package/EmptyState.js +20 -0
- package/EmptyState.js.map +1 -0
- package/Fab.d.ts +43 -0
- package/Fab.js +146 -0
- package/Fab.js.map +1 -0
- package/FileUpload.d.ts +20 -0
- package/FileUpload.js +18 -0
- package/FileUpload.js.map +1 -0
- package/FormField.d.ts +48 -0
- package/FormField.js +39 -0
- package/FormField.js.map +1 -0
- package/GUIDELINES.md +41 -0
- package/Image.d.ts +20 -0
- package/Image.js +18 -0
- package/Image.js.map +1 -0
- package/Img.d.ts +26 -0
- package/Img.js +20 -0
- package/Img.js.map +1 -0
- package/InlineAlert.d.ts +31 -0
- package/InlineAlert.js +73 -0
- package/InlineAlert.js.map +1 -0
- package/LICENSE +395 -0
- package/Layout.d.ts +48 -0
- package/Layout.js +24 -0
- package/Layout.js.map +1 -0
- package/Link.d.ts +38 -0
- package/Link.js +37 -0
- package/Link.js.map +1 -0
- package/ListItem.d.ts +68 -0
- package/ListItem.js +207 -0
- package/ListItem.js.map +1 -0
- package/Menu.d.ts +86 -0
- package/Menu.js +98 -0
- package/Menu.js.map +1 -0
- package/MenuButton.d.ts +16 -0
- package/MenuButton.js +30 -0
- package/MenuButton.js.map +1 -0
- package/Modal.d.ts +31 -0
- package/Modal.js +53 -0
- package/Modal.js.map +1 -0
- package/MultiSelection.d.ts +20 -0
- package/MultiSelection.js +18 -0
- package/MultiSelection.js.map +1 -0
- package/NavigationRail.d.ts +20 -0
- package/NavigationRail.js +18 -0
- package/NavigationRail.js.map +1 -0
- package/NumberField.d.ts +17 -0
- package/NumberField.js +20 -0
- package/NumberField.js.map +1 -0
- package/NumberInput.d.ts +34 -0
- package/NumberInput.js +188 -0
- package/NumberInput.js.map +1 -0
- package/OTPInput.d.ts +20 -0
- package/OTPInput.js +18 -0
- package/OTPInput.js.map +1 -0
- package/PageControl.d.ts +20 -0
- package/PageControl.js +18 -0
- package/PageControl.js.map +1 -0
- package/PasswordInput.d.ts +20 -0
- package/PasswordInput.js +18 -0
- package/PasswordInput.js.map +1 -0
- package/PhoneNumberInput.d.ts +20 -0
- package/PhoneNumberInput.js +18 -0
- package/PhoneNumberInput.js.map +1 -0
- package/Popover.d.ts +44 -0
- package/Popover.js +152 -0
- package/Popover.js.map +1 -0
- package/Portal.d.ts +24 -0
- package/Portal.js +23 -0
- package/Portal.js.map +1 -0
- package/Profile.d.ts +41 -0
- package/Profile.js +83 -0
- package/Profile.js.map +1 -0
- package/ProgressBar.d.ts +38 -0
- package/ProgressBar.js +64 -0
- package/ProgressBar.js.map +1 -0
- package/ProgressCircle.d.ts +31 -0
- package/ProgressCircle.js +82 -0
- package/ProgressCircle.js.map +1 -0
- package/ProgressionStepper.d.ts +66 -0
- package/ProgressionStepper.js +197 -0
- package/ProgressionStepper.js.map +1 -0
- package/ProgressionStepperBar.d.ts +31 -0
- package/ProgressionStepperBar.js +51 -0
- package/ProgressionStepperBar.js.map +1 -0
- package/README.md +13 -0
- package/Radio.d.ts +17 -0
- package/Radio.js +97 -0
- package/Radio.js.map +1 -0
- package/RadioGroup.d.ts +31 -0
- package/RadioGroup.js +18 -0
- package/RadioGroup.js.map +1 -0
- package/RadioOption.d.ts +14 -0
- package/RadioOption.js +16 -0
- package/RadioOption.js.map +1 -0
- package/Rating.d.ts +16 -0
- package/Rating.js +18 -0
- package/Rating.js.map +1 -0
- package/SearchBar.d.ts +26 -0
- package/SearchBar.js +49 -0
- package/SearchBar.js.map +1 -0
- package/SegmentedControl.d.ts +69 -0
- package/SegmentedControl.js +136 -0
- package/SegmentedControl.js.map +1 -0
- package/Skeleton.d.ts +28 -0
- package/Skeleton.js +57 -0
- package/Skeleton.js.map +1 -0
- package/SliderInput.d.ts +16 -0
- package/SliderInput.js +18 -0
- package/SliderInput.js.map +1 -0
- package/Snackbar.d.ts +16 -0
- package/Snackbar.js +18 -0
- package/Snackbar.js.map +1 -0
- package/StylesProviderAnywhere.d.ts +10 -0
- package/StylesProviderAnywhere.js +29 -0
- package/StylesProviderAnywhere.js.map +1 -0
- package/StylesProviderBetterHomesGardens.d.ts +10 -0
- package/StylesProviderBetterHomesGardens.js +29 -0
- package/StylesProviderBetterHomesGardens.js.map +1 -0
- package/StylesProviderCartus.d.ts +10 -0
- package/StylesProviderCartus.js +29 -0
- package/StylesProviderCartus.js.map +1 -0
- package/StylesProviderCentury21.d.ts +10 -0
- package/StylesProviderCentury21.js +29 -0
- package/StylesProviderCentury21.js.map +1 -0
- package/StylesProviderColdwellBanker.d.ts +10 -0
- package/StylesProviderColdwellBanker.js +29 -0
- package/StylesProviderColdwellBanker.js.map +1 -0
- package/StylesProviderCorcoran.d.ts +10 -0
- package/StylesProviderCorcoran.js +29 -0
- package/StylesProviderCorcoran.js.map +1 -0
- package/StylesProviderDenaliBoss.d.ts +10 -0
- package/StylesProviderDenaliBoss.js +29 -0
- package/StylesProviderDenaliBoss.js.map +1 -0
- package/StylesProviderEra.d.ts +10 -0
- package/StylesProviderEra.js +29 -0
- package/StylesProviderEra.js.map +1 -0
- package/StylesProviderSothebys.d.ts +10 -0
- package/StylesProviderSothebys.js +29 -0
- package/StylesProviderSothebys.js.map +1 -0
- package/Switch.d.ts +33 -0
- package/Switch.js +85 -0
- package/Switch.js.map +1 -0
- package/SwitchGroup.d.ts +35 -0
- package/SwitchGroup.js +18 -0
- package/SwitchGroup.js.map +1 -0
- package/SwitchOption.d.ts +14 -0
- package/SwitchOption.js +16 -0
- package/SwitchOption.js.map +1 -0
- package/TabGroup.d.ts +73 -0
- package/TabGroup.js +119 -0
- package/TabGroup.js.map +1 -0
- package/Table.d.ts +45 -0
- package/Table.js +66 -0
- package/Table.js.map +1 -0
- package/Tag.d.ts +56 -0
- package/Tag.js +77 -0
- package/Tag.js.map +1 -0
- package/TextField.d.ts +16 -0
- package/TextField.js +19 -0
- package/TextField.js.map +1 -0
- package/TextInput.d.ts +45 -0
- package/TextInput.js +172 -0
- package/TextInput.js.map +1 -0
- package/Textarea.d.ts +63 -0
- package/Textarea.js +113 -0
- package/Textarea.js.map +1 -0
- package/TextareaField.d.ts +16 -0
- package/TextareaField.js +26 -0
- package/TextareaField.js.map +1 -0
- package/TimePicker.d.ts +16 -0
- package/TimePicker.js +18 -0
- package/TimePicker.js.map +1 -0
- package/ToggleOption.d.ts +27 -0
- package/ToggleOption.js +91 -0
- package/ToggleOption.js.map +1 -0
- package/Tooltip.d.ts +39 -0
- package/Tooltip.js +104 -0
- package/Tooltip.js.map +1 -0
- package/TopNavigation.d.ts +16 -0
- package/TopNavigation.js +18 -0
- package/TopNavigation.js.map +1 -0
- package/Txt.d.ts +38 -0
- package/Txt.js +21 -0
- package/Txt.js.map +1 -0
- package/hooks/useCheckboxGroupState.d.ts +37 -0
- package/hooks/useCheckboxGroupState.js +61 -0
- package/hooks/useCheckboxGroupState.js.map +1 -0
- package/hooks/useCheckboxState.d.ts +23 -0
- package/hooks/useCheckboxState.js +40 -0
- package/hooks/useCheckboxState.js.map +1 -0
- package/hooks/useFloating.d.ts +38 -0
- package/hooks/useFloating.js +156 -0
- package/hooks/useFloating.js.map +1 -0
- package/hooks/useFloatingMenu.d.ts +35 -0
- package/hooks/useFloatingMenu.js +71 -0
- package/hooks/useFloatingMenu.js.map +1 -0
- package/hooks/useId.d.ts +8 -0
- package/hooks/useId.js +16 -0
- package/hooks/useId.js.map +1 -0
- package/hooks/useKeyboardNavigation.d.ts +35 -0
- package/hooks/useKeyboardNavigation.js +79 -0
- package/hooks/useKeyboardNavigation.js.map +1 -0
- package/hooks/useLongPress.d.ts +11 -0
- package/hooks/useLongPress.js +49 -0
- package/hooks/useLongPress.js.map +1 -0
- package/hooks/useModalState.d.ts +22 -0
- package/hooks/useModalState.js +37 -0
- package/hooks/useModalState.js.map +1 -0
- package/hooks/useNavOptions.d.ts +28 -0
- package/hooks/useNavOptions.js +46 -0
- package/hooks/useNavOptions.js.map +1 -0
- package/hooks/useOutsideClick.d.ts +31 -0
- package/hooks/useOutsideClick.js +50 -0
- package/hooks/useOutsideClick.js.map +1 -0
- package/hooks/useRadioState.d.ts +23 -0
- package/hooks/useRadioState.js +38 -0
- package/hooks/useRadioState.js.map +1 -0
- package/hooks/useSwitchGroupState.d.ts +37 -0
- package/hooks/useSwitchGroupState.js +60 -0
- package/hooks/useSwitchGroupState.js.map +1 -0
- package/hooks/useTimeout.d.ts +26 -0
- package/hooks/useTimeout.js +45 -0
- package/hooks/useTimeout.js.map +1 -0
- package/hooks/useValidChildren.d.ts +6 -0
- package/hooks/useValidChildren.js +33 -0
- package/hooks/useValidChildren.js.map +1 -0
- package/index.d.ts +125 -0
- package/index.js +20 -0
- package/index.js.map +1 -0
- package/meta.d.ts +44 -0
- package/meta.js +5789 -0
- package/meta.js.map +1 -0
- package/package.json +73 -0
- package/src/Accordion.tsx +33 -0
- package/src/Badge.tsx +75 -0
- package/src/BannerAlert.tsx +211 -0
- package/src/BottomNavigation.tsx +33 -0
- package/src/BottomSheet.tsx +33 -0
- package/src/Breadcrumb.tsx +33 -0
- package/src/Button.tsx +358 -0
- package/src/ButtonDock.tsx +33 -0
- package/src/Card.tsx +66 -0
- package/src/Chart.tsx +33 -0
- package/src/Checkbox.tsx +174 -0
- package/src/CheckboxGroup.tsx +95 -0
- package/src/CheckboxOption.tsx +27 -0
- package/src/Chip.tsx +155 -0
- package/src/DatePicker.tsx +33 -0
- package/src/Dialog.tsx +304 -0
- package/src/Divider.tsx +129 -0
- package/src/Drawer.tsx +33 -0
- package/src/Dropdown.tsx +251 -0
- package/src/DropdownField.tsx +57 -0
- package/src/EmptyState.tsx +73 -0
- package/src/Fab.tsx +222 -0
- package/src/FileUpload.tsx +33 -0
- package/src/FormField.tsx +107 -0
- package/src/Image.tsx +33 -0
- package/src/Img.tsx +39 -0
- package/src/InlineAlert.tsx +119 -0
- package/src/Layout.tsx +82 -0
- package/src/Link.tsx +82 -0
- package/src/ListItem.tsx +316 -0
- package/src/Menu.tsx +263 -0
- package/src/MenuButton.tsx +45 -0
- package/src/Modal.tsx +104 -0
- package/src/MultiSelection.tsx +33 -0
- package/src/NavigationRail.tsx +33 -0
- package/src/NumberField.tsx +47 -0
- package/src/NumberInput.tsx +282 -0
- package/src/OTPInput.tsx +33 -0
- package/src/PageControl.tsx +33 -0
- package/src/PasswordInput.tsx +33 -0
- package/src/PhoneNumberInput.tsx +33 -0
- package/src/Popover.tsx +237 -0
- package/src/Portal.tsx +36 -0
- package/src/Profile.tsx +140 -0
- package/src/ProgressBar.tsx +110 -0
- package/src/ProgressCircle.tsx +153 -0
- package/src/ProgressionStepper.tsx +294 -0
- package/src/ProgressionStepperBar.tsx +95 -0
- package/src/Radio.tsx +119 -0
- package/src/RadioGroup.tsx +62 -0
- package/src/RadioOption.tsx +24 -0
- package/src/Rating.tsx +29 -0
- package/src/SearchBar.tsx +121 -0
- package/src/SegmentedControl.tsx +233 -0
- package/src/Skeleton.tsx +90 -0
- package/src/SliderInput.tsx +29 -0
- package/src/Snackbar.tsx +29 -0
- package/src/StylesProviderAnywhere.tsx +31 -0
- package/src/StylesProviderBetterHomesGardens.tsx +31 -0
- package/src/StylesProviderCartus.tsx +31 -0
- package/src/StylesProviderCentury21.tsx +31 -0
- package/src/StylesProviderColdwellBanker.tsx +31 -0
- package/src/StylesProviderCorcoran.tsx +31 -0
- package/src/StylesProviderDenaliBoss.tsx +31 -0
- package/src/StylesProviderEra.tsx +31 -0
- package/src/StylesProviderSothebys.tsx +31 -0
- package/src/Switch.tsx +122 -0
- package/src/SwitchGroup.tsx +60 -0
- package/src/SwitchOption.tsx +24 -0
- package/src/TabGroup.tsx +219 -0
- package/src/Table.tsx +126 -0
- package/src/Tag.tsx +149 -0
- package/src/TextField.tsx +61 -0
- package/src/TextInput.tsx +265 -0
- package/src/Textarea.tsx +205 -0
- package/src/TextareaField.tsx +67 -0
- package/src/TimePicker.tsx +29 -0
- package/src/ToggleOption.tsx +117 -0
- package/src/Tooltip.tsx +170 -0
- package/src/TopNavigation.tsx +29 -0
- package/src/Txt.tsx +69 -0
- package/src/hooks/useCheckboxGroupState.ts +79 -0
- package/src/hooks/useCheckboxState.ts +48 -0
- package/src/hooks/useFloating.ts +202 -0
- package/src/hooks/useFloatingMenu.ts +110 -0
- package/src/hooks/useId.ts +14 -0
- package/src/hooks/useKeyboardNavigation.ts +98 -0
- package/src/hooks/useLongPress.ts +53 -0
- package/src/hooks/useModalState.ts +37 -0
- package/src/hooks/useNavOptions.ts +76 -0
- package/src/hooks/useOutsideClick.ts +51 -0
- package/src/hooks/useRadioState.ts +42 -0
- package/src/hooks/useSwitchGroupState.ts +75 -0
- package/src/hooks/useTimeout.ts +45 -0
- package/src/hooks/useValidChildren.ts +54 -0
- package/src/index.ts +160 -0
- package/src/meta.ts +6238 -0
- package/src/package.json +3 -0
- package/src/styles/anywhere.css +1693 -0
- package/src/styles/anywhere.ts +1694 -0
- package/src/styles/base.css +160 -0
- package/src/styles/base.ts +161 -0
- package/src/styles/better-homes-gardens.css +1693 -0
- package/src/styles/better-homes-gardens.ts +1694 -0
- package/src/styles/cartus.css +1691 -0
- package/src/styles/cartus.ts +1692 -0
- package/src/styles/century-21.css +1689 -0
- package/src/styles/century-21.ts +1690 -0
- package/src/styles/coldwell-banker.css +1691 -0
- package/src/styles/coldwell-banker.ts +1692 -0
- package/src/styles/corcoran.css +1685 -0
- package/src/styles/corcoran.ts +1686 -0
- package/src/styles/denali-boss.css +1681 -0
- package/src/styles/denali-boss.ts +1682 -0
- package/src/styles/era.css +1685 -0
- package/src/styles/era.ts +1686 -0
- package/src/styles/sothebys.css +1677 -0
- package/src/styles/sothebys.ts +1678 -0
- package/src/utils/children.ts +80 -0
- package/src/utils/colorVariants.ts +74 -0
- package/src/utils/errors.tsx +104 -0
- package/src/utils/getValidNode.ts +7 -0
- package/src/utils/keyboard.ts +382 -0
- package/src/utils/placeholder.test.ts +7 -0
- package/src/utils/ref.ts +11 -0
- package/src/utils/scrollElementIntoView.ts +29 -0
- package/src/utils/srOnly.ts +14 -0
- package/src/utils/tryIntPsrse.ts +7 -0
- package/src/utils/txtVariants.ts +53 -0
- package/styles/anywhere.css +1693 -0
- package/styles/anywhere.d.ts +2 -0
- package/styles/anywhere.js +1697 -0
- package/styles/anywhere.js.map +1 -0
- package/styles/anywhere.ts +1694 -0
- package/styles/base.css +160 -0
- package/styles/base.d.ts +2 -0
- package/styles/base.js +164 -0
- package/styles/base.js.map +1 -0
- package/styles/base.ts +161 -0
- package/styles/better-homes-gardens.css +1693 -0
- package/styles/better-homes-gardens.d.ts +2 -0
- package/styles/better-homes-gardens.js +1697 -0
- package/styles/better-homes-gardens.js.map +1 -0
- package/styles/better-homes-gardens.ts +1694 -0
- package/styles/cartus.css +1691 -0
- package/styles/cartus.d.ts +2 -0
- package/styles/cartus.js +1695 -0
- package/styles/cartus.js.map +1 -0
- package/styles/cartus.ts +1692 -0
- package/styles/century-21.css +1689 -0
- package/styles/century-21.d.ts +2 -0
- package/styles/century-21.js +1693 -0
- package/styles/century-21.js.map +1 -0
- package/styles/century-21.ts +1690 -0
- package/styles/coldwell-banker.css +1691 -0
- package/styles/coldwell-banker.d.ts +2 -0
- package/styles/coldwell-banker.js +1695 -0
- package/styles/coldwell-banker.js.map +1 -0
- package/styles/coldwell-banker.ts +1692 -0
- package/styles/corcoran.css +1685 -0
- package/styles/corcoran.d.ts +2 -0
- package/styles/corcoran.js +1689 -0
- package/styles/corcoran.js.map +1 -0
- package/styles/corcoran.ts +1686 -0
- package/styles/denali-boss.css +1681 -0
- package/styles/denali-boss.d.ts +2 -0
- package/styles/denali-boss.js +1685 -0
- package/styles/denali-boss.js.map +1 -0
- package/styles/denali-boss.ts +1682 -0
- package/styles/era.css +1685 -0
- package/styles/era.d.ts +2 -0
- package/styles/era.js +1689 -0
- package/styles/era.js.map +1 -0
- package/styles/era.ts +1686 -0
- package/styles/sothebys.css +1677 -0
- package/styles/sothebys.d.ts +2 -0
- package/styles/sothebys.js +1681 -0
- package/styles/sothebys.js.map +1 -0
- package/styles/sothebys.ts +1678 -0
- package/utils/children.d.ts +29 -0
- package/utils/children.js +70 -0
- package/utils/children.js.map +1 -0
- package/utils/colorVariants.d.ts +5 -0
- package/utils/colorVariants.js +61 -0
- package/utils/colorVariants.js.map +1 -0
- package/utils/errors.d.ts +36 -0
- package/utils/errors.js +65 -0
- package/utils/errors.js.map +1 -0
- package/utils/getValidNode.d.ts +2 -0
- package/utils/getValidNode.js +9 -0
- package/utils/getValidNode.js.map +1 -0
- package/utils/keyboard.d.ts +4 -0
- package/utils/keyboard.js +140 -0
- package/utils/keyboard.js.map +1 -0
- package/utils/ref.d.ts +5 -0
- package/utils/ref.js +10 -0
- package/utils/ref.js.map +1 -0
- package/utils/scrollElementIntoView.d.ts +8 -0
- package/utils/scrollElementIntoView.js +30 -0
- package/utils/scrollElementIntoView.js.map +1 -0
- package/utils/srOnly.d.ts +14 -0
- package/utils/srOnly.js +15 -0
- package/utils/srOnly.js.map +1 -0
- package/utils/tryIntPsrse.d.ts +2 -0
- package/utils/tryIntPsrse.js +10 -0
- package/utils/tryIntPsrse.js.map +1 -0
- package/utils/txtVariants.d.ts +2 -0
- package/utils/txtVariants.js +30 -0
- package/utils/txtVariants.js.map +1 -0
package/Switch.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A control element that allows users to toggle between two states, typically representing on/off and inherits
|
|
6
|
+
* immediate reaction in each state. This is the base element and if used directly you must wrap it with a label. This
|
|
7
|
+
* will more often be used in the SwitchOption or SwitchGroup component.
|
|
8
|
+
*
|
|
9
|
+
* @element
|
|
10
|
+
*
|
|
11
|
+
* @name Switch
|
|
12
|
+
*/
|
|
13
|
+
function Switch(props) {
|
|
14
|
+
const {
|
|
15
|
+
//
|
|
16
|
+
checked = false, disabled, ...otherProps } = props;
|
|
17
|
+
return (jsxs("span", { css: style, "data-switch": true, children: [jsx("input", { ...otherProps, "aria-disabled": disabled || undefined, checked: checked, disabled: disabled || undefined, onChange: (event) => props.onChange(!!event.target.checked, event), type: "checkbox" }), jsx("span", { "aria-hidden": true })] }));
|
|
18
|
+
}
|
|
19
|
+
Switch.bspkName = 'Switch';
|
|
20
|
+
const style = css `
|
|
21
|
+
--track-width: var(--spacing-sizing-09);
|
|
22
|
+
--toggle-width: var(--spacing-sizing-04);
|
|
23
|
+
--track-bg: var(--surface-neutral-t4-high);
|
|
24
|
+
--toggle-bg: var(--foreground-neutral-on-color);
|
|
25
|
+
|
|
26
|
+
display: block;
|
|
27
|
+
position: relative;
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
margin: 2px;
|
|
30
|
+
|
|
31
|
+
input[type='checkbox'] {
|
|
32
|
+
position: absolute;
|
|
33
|
+
opacity: 0;
|
|
34
|
+
width: 100%;
|
|
35
|
+
height: 100%;
|
|
36
|
+
top: 0;
|
|
37
|
+
left: 0;
|
|
38
|
+
z-index: 2;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
width: var(--track-width);
|
|
44
|
+
height: var(--spacing-sizing-05);
|
|
45
|
+
border-radius: var(--spacing-sizing-05);
|
|
46
|
+
background-color: var(--track-bg);
|
|
47
|
+
position: relative;
|
|
48
|
+
z-index: 1;
|
|
49
|
+
|
|
50
|
+
span {
|
|
51
|
+
display: block;
|
|
52
|
+
width: var(--toggle-width);
|
|
53
|
+
height: var(--toggle-width);
|
|
54
|
+
border-radius: var(--radius-circular);
|
|
55
|
+
background-color: var(--toggle-bg);
|
|
56
|
+
transition: left 0.2s;
|
|
57
|
+
box-shadow: var(--drop-shadow-raise);
|
|
58
|
+
left: 2px;
|
|
59
|
+
top: 2px;
|
|
60
|
+
position: absolute;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&:has(input[type='checkbox']:checked) {
|
|
64
|
+
--track-bg: var(--foreground-brand-primary);
|
|
65
|
+
|
|
66
|
+
span {
|
|
67
|
+
left: calc(var(--track-width) - var(--toggle-width) - 2px);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&:has(input[type='checkbox']:disabled) {
|
|
72
|
+
input[type='checkbox'] {
|
|
73
|
+
pointer-events: none;
|
|
74
|
+
}
|
|
75
|
+
--track-bg: var(--interactions-disabled-opacity);
|
|
76
|
+
--toggle-bg: var(--foreground-neutral-disabled-on-surface);
|
|
77
|
+
|
|
78
|
+
&:has(input[type='checkbox']:checked) span {
|
|
79
|
+
--toggle-bg: var(--foreground-neutral-disabled-on-color-surface);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
|
|
84
|
+
export { Switch, style };
|
|
85
|
+
//# sourceMappingURL=Switch.js.map
|
package/Switch.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":["src/Switch.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;AAqBA;;;;;;;;AAQG;AACH,SAAS,MAAM,CAAC,KAAkB,EAAA;IAC9B,MAAM;;IAEF,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,GAAG,UAAU,EAChB,GAAG,KAAK,CAAC;IAEV,QACIA,IAAM,CAAA,MAAA,EAAA,EAAA,GAAG,EAAE,KAAK,kCACZC,GACQ,CAAA,OAAA,EAAA,EAAA,GAAA,UAAU,EACC,eAAA,EAAA,QAAQ,IAAI,SAAS,EACpC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,IAAI,SAAS,EAC/B,QAAQ,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,EAClE,IAAI,EAAC,UAAU,EAAA,CACjB,EACFA,GAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAA,IAAA,EAAA,CAAoB,CACjB,EAAA,CAAA,EACT;AACN,CAAC;AAED,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAIpB,MAAM,KAAK,GAAG,GAAG,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/SwitchGroup.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ToggleOptionProps } from './ToggleOption';
|
|
2
|
+
import { ToggleControlProps, ElementProps, CommonProps } from './';
|
|
3
|
+
export type SwitchGroupOption = Pick<ToggleControlProps<HTMLInputElement>, 'value'> & Pick<ToggleOptionProps, 'description' | 'label'>;
|
|
4
|
+
export type SwitchGroupProps = CommonProps<'aria-label' | 'name'> & {
|
|
5
|
+
/**
|
|
6
|
+
* The function to call when the switches are changed.
|
|
7
|
+
*
|
|
8
|
+
* @required
|
|
9
|
+
*/
|
|
10
|
+
onChange: (value: string[]) => void;
|
|
11
|
+
/**
|
|
12
|
+
* The options for the switches.
|
|
13
|
+
*
|
|
14
|
+
* @type SwitchGroupOption[]
|
|
15
|
+
* @required
|
|
16
|
+
*/
|
|
17
|
+
options: SwitchGroupOption[];
|
|
18
|
+
/**
|
|
19
|
+
* The values of the switches in the on state.
|
|
20
|
+
*
|
|
21
|
+
* @type string[]
|
|
22
|
+
*/
|
|
23
|
+
values?: SwitchGroupProps['options'][number]['value'][];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A group of switches that allows users to choose one or more items from a list or turn an feature on or off.
|
|
27
|
+
*
|
|
28
|
+
* @name SwitchGroup
|
|
29
|
+
*/
|
|
30
|
+
declare function SwitchGroup({ onChange, options, name, values, ...props }: ElementProps<SwitchGroupProps, 'div'>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
31
|
+
declare namespace SwitchGroup {
|
|
32
|
+
var bspkName: string;
|
|
33
|
+
}
|
|
34
|
+
export { SwitchGroup };
|
|
35
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
package/SwitchGroup.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import { Switch } from './Switch.js';
|
|
3
|
+
import { ToggleOption } from './ToggleOption.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A group of switches that allows users to choose one or more items from a list or turn an feature on or off.
|
|
7
|
+
*
|
|
8
|
+
* @name SwitchGroup
|
|
9
|
+
*/
|
|
10
|
+
function SwitchGroup({ onChange, options = [], name, values = [], ...props }) {
|
|
11
|
+
return (jsx("div", { ...props, "data-control-group": true, "data-switch-group": true, role: "group", children: options.map(({ label, description, value }) => (jsx(ToggleOption, { description: description, label: label, children: jsx(Switch, { "aria-label": label, checked: values.includes(value), name: name, onChange: (checked) => {
|
|
12
|
+
onChange(checked ? [...values, value] : values.filter((v) => v !== value));
|
|
13
|
+
}, value: value }) }, value))) }));
|
|
14
|
+
}
|
|
15
|
+
SwitchGroup.bspkName = 'SwitchGroup';
|
|
16
|
+
|
|
17
|
+
export { SwitchGroup };
|
|
18
|
+
//# sourceMappingURL=SwitchGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchGroup.js","sources":["src/SwitchGroup.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;AA8BA;;;;AAIG;AACH,SAAS,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,KAAK,EAAyC,EAAA;IAC/G,QACIA,GAAS,CAAA,KAAA,EAAA,EAAA,GAAA,KAAK,EAAuC,oBAAA,EAAA,IAAA,EAAA,mBAAA,EAAA,IAAA,EAAA,IAAI,EAAC,OAAO,EAC5D,QAAA,EAAA,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MACvCA,GAAA,CAAC,YAAY,EAAA,EAAC,WAAW,EAAE,WAAW,EAAc,KAAK,EAAE,KAAK,EAC5D,QAAA,EAAAA,GAAA,CAAC,MAAM,EAAA,EAAA,YAAA,EACS,KAAK,EACjB,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC/B,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,CAAC,OAAO,KAAI;AAClB,oBAAA,QAAQ,CAAC,OAAO,GAAG,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC;AAC/E,iBAAC,EACD,KAAK,EAAE,KAAK,EACd,CAAA,EAAA,EATuC,KAAK,CAUnC,CAClB,CAAC,EACA,CAAA,EACR;AACN,CAAC;AAED,WAAW,CAAC,QAAQ,GAAG,aAAa;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SwitchProps } from './Switch';
|
|
2
|
+
import { ToggleOptionProps } from './ToggleOption';
|
|
3
|
+
export type SwitchOptionProps = Omit<SwitchProps, 'aria-label'> & Pick<ToggleOptionProps, 'description' | 'label' | 'size'>;
|
|
4
|
+
/**
|
|
5
|
+
* A control that allows users to choose one or more items from a list or turn an feature on or off.
|
|
6
|
+
*
|
|
7
|
+
* @name SwitchOption
|
|
8
|
+
*/
|
|
9
|
+
declare function SwitchOption({ label, description, size, ...checkboxProps }: SwitchOptionProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare namespace SwitchOption {
|
|
11
|
+
var bspkName: string;
|
|
12
|
+
}
|
|
13
|
+
export { SwitchOption };
|
|
14
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
package/SwitchOption.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import { Switch } from './Switch.js';
|
|
3
|
+
import { ToggleOption } from './ToggleOption.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A control that allows users to choose one or more items from a list or turn an feature on or off.
|
|
7
|
+
*
|
|
8
|
+
* @name SwitchOption
|
|
9
|
+
*/
|
|
10
|
+
function SwitchOption({ label, description, size, ...checkboxProps }) {
|
|
11
|
+
return (jsx(ToggleOption, { "data-checkbox-field": true, description: description, label: label, size: size, children: jsx(Switch, { ...checkboxProps, "aria-label": label }) }));
|
|
12
|
+
}
|
|
13
|
+
SwitchOption.bspkName = 'SwitchOption';
|
|
14
|
+
|
|
15
|
+
export { SwitchOption };
|
|
16
|
+
//# sourceMappingURL=SwitchOption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchOption.js","sources":["src/SwitchOption.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;AAMA;;;;AAIG;AACH,SAAS,YAAY,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,aAAa,EAAqB,EAAA;IACnF,QACIA,GAAC,CAAA,YAAY,EAAqB,EAAA,qBAAA,EAAA,IAAA,EAAA,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAChF,QAAA,EAAAA,GAAA,CAAC,MAAM,EAAA,EAAA,GAAK,aAAa,EAAA,YAAA,EAAc,KAAK,EAAA,CAAI,EACrC,CAAA,EACjB;AACN,CAAC;AAED,YAAY,CAAC,QAAQ,GAAG,cAAc;;;;"}
|
package/TabGroup.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ElementProps } from './';
|
|
3
|
+
export type TabGroupOption = {
|
|
4
|
+
/**
|
|
5
|
+
* The label of the tab. This is the text that will be displayed on the tab.
|
|
6
|
+
*
|
|
7
|
+
* @required
|
|
8
|
+
*/
|
|
9
|
+
label: string;
|
|
10
|
+
/**
|
|
11
|
+
* Determines if the element is [disabled](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled).
|
|
12
|
+
*
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** The value of the tab. If not provided, the label will be used as the value. */
|
|
17
|
+
value?: string;
|
|
18
|
+
/** The icon to display on the left side of the tab. */
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
/** The icon to display on the left side of the tab when the tab is active. */
|
|
21
|
+
iconActive?: ReactNode;
|
|
22
|
+
/** The badge count to display on the tab. */
|
|
23
|
+
badge?: number;
|
|
24
|
+
};
|
|
25
|
+
export type TabGroupProps = {
|
|
26
|
+
/**
|
|
27
|
+
* The tabs to display. Each tab has a label and an optional leading icon.
|
|
28
|
+
*
|
|
29
|
+
* @type TabGroupOption[]
|
|
30
|
+
* @required
|
|
31
|
+
*/
|
|
32
|
+
options: TabGroupOption[];
|
|
33
|
+
/** The id of the selected tab. */
|
|
34
|
+
value?: TabGroupOption['value'];
|
|
35
|
+
/**
|
|
36
|
+
* The function to call when the tab is clicked.
|
|
37
|
+
*
|
|
38
|
+
* @required
|
|
39
|
+
*/
|
|
40
|
+
onChange: (tabId: TabGroupOption['value']) => void;
|
|
41
|
+
/**
|
|
42
|
+
* The size of the tabs.
|
|
43
|
+
*
|
|
44
|
+
* @default medium
|
|
45
|
+
*/
|
|
46
|
+
size?: 'large' | 'medium' | 'small';
|
|
47
|
+
/**
|
|
48
|
+
* When 'fill' the options will fill the width of the container. When 'hug', the options will be as wide as their
|
|
49
|
+
* content.
|
|
50
|
+
*
|
|
51
|
+
* @default hug
|
|
52
|
+
*/
|
|
53
|
+
width?: 'fill' | 'hug';
|
|
54
|
+
/**
|
|
55
|
+
* When width is 'hug' this determines if the trailing underline should be showing. When width is 'fill' this
|
|
56
|
+
* property isn't applicable.
|
|
57
|
+
*
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
showTrail?: boolean;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Navigation tool that organizes content across different screens and views.
|
|
64
|
+
*
|
|
65
|
+
* @name TabGroup
|
|
66
|
+
*/
|
|
67
|
+
declare function TabGroup({ onChange: onTabChange, value, size, options, width, showTrail, ...containerProps }: ElementProps<TabGroupProps, 'div'>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
68
|
+
declare namespace TabGroup {
|
|
69
|
+
var bspkName: string;
|
|
70
|
+
}
|
|
71
|
+
export { TabGroup };
|
|
72
|
+
export declare const style: import("@emotion/react").SerializedStyles;
|
|
73
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
package/TabGroup.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
import { Badge } from './Badge.js';
|
|
4
|
+
import { useNavOptions } from './hooks/useNavOptions.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Navigation tool that organizes content across different screens and views.
|
|
8
|
+
*
|
|
9
|
+
* @name TabGroup
|
|
10
|
+
*/
|
|
11
|
+
function TabGroup({
|
|
12
|
+
//
|
|
13
|
+
onChange: onTabChange, value, size = 'medium', options, width = 'hug', showTrail = false, ...containerProps }) {
|
|
14
|
+
const items = useNavOptions(options);
|
|
15
|
+
return (jsx("div", { ...containerProps, css: style, "data-hide-trail": (width === 'hug' && !showTrail) || undefined, "data-size": size, "data-tab-group": true, "data-width": width, children: items.map((item) => {
|
|
16
|
+
const isActive = item.value === value;
|
|
17
|
+
return (jsx("button", { "data-active": isActive || undefined, disabled: item.disabled || undefined, onClick: () => onTabChange(item.value), children: jsxs("span", { children: [(isActive && item.iconActive) || item.icon, item.label, item.badge && jsx(Badge, { count: item.badge, size: "x-small" })] }) }, item.value));
|
|
18
|
+
}) }));
|
|
19
|
+
}
|
|
20
|
+
TabGroup.bspkName = 'TabGroup';
|
|
21
|
+
const style = css `
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: row;
|
|
24
|
+
width: fit-content;
|
|
25
|
+
--btn-flex-grow: 0;
|
|
26
|
+
border-bottom: 1px solid var(--stroke-neutral-low);
|
|
27
|
+
width: 100%;
|
|
28
|
+
|
|
29
|
+
&[data-width='fill'] {
|
|
30
|
+
align-items: stretch;
|
|
31
|
+
width: 100%;
|
|
32
|
+
--btn-flex-grow: 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
--font: var(--labels-base);
|
|
36
|
+
--height: var(--spacing-sizing-10);
|
|
37
|
+
|
|
38
|
+
&[data-size='small'] {
|
|
39
|
+
--font: var(--labels-small);
|
|
40
|
+
--height: var(--spacing-sizing-08);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&[data-size='large'] {
|
|
44
|
+
--font: var(--labels-large);
|
|
45
|
+
--height: var(--spacing-sizing-12);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
button {
|
|
49
|
+
border: 0;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
color: var(--foreground-neutral-on-surface-variant-02);
|
|
52
|
+
background: none;
|
|
53
|
+
flex-grow: var(--btn-flex-grow);
|
|
54
|
+
font: var(--font);
|
|
55
|
+
|
|
56
|
+
&:hover {
|
|
57
|
+
background: var(--interactions-neutral-hover-opacity);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&:active {
|
|
61
|
+
background: var(--interactions-neutral-press-opacity);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&:disabled {
|
|
65
|
+
pointer-events: none;
|
|
66
|
+
color: var(--foreground-neutral-disabled-on-surface);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&:focus-visible {
|
|
70
|
+
outline: solid 2px var(--stroke-neutral-focus);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
span {
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: row;
|
|
76
|
+
align-items: center;
|
|
77
|
+
margin: 0 var(--spacing-sizing-04);
|
|
78
|
+
height: var(--height);
|
|
79
|
+
justify-content: center;
|
|
80
|
+
position: relative;
|
|
81
|
+
gap: var(--spacing-sizing-02);
|
|
82
|
+
|
|
83
|
+
svg {
|
|
84
|
+
width: var(--spacing-sizing-05);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&[data-active] {
|
|
89
|
+
color: var(--foreground-brand-primary);
|
|
90
|
+
span {
|
|
91
|
+
&:after {
|
|
92
|
+
content: '';
|
|
93
|
+
display: block;
|
|
94
|
+
width: 100%;
|
|
95
|
+
height: 2px;
|
|
96
|
+
background-color: var(--stroke-brand-primary);
|
|
97
|
+
bottom: -1px;
|
|
98
|
+
position: absolute;
|
|
99
|
+
border-top-right-radius: 2px;
|
|
100
|
+
border-top-left-radius: 2px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
svg {
|
|
104
|
+
color: var(--surface-brand-primary);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&[data-hide-trail] {
|
|
111
|
+
border-bottom: none;
|
|
112
|
+
button {
|
|
113
|
+
border-bottom: 1px solid var(--stroke-neutral-low);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
`;
|
|
117
|
+
|
|
118
|
+
export { TabGroup, style };
|
|
119
|
+
//# sourceMappingURL=TabGroup.js.map
|
package/TabGroup.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabGroup.js","sources":["src/TabGroup.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":";;;;;AAqEA;;;;AAIG;AACH,SAAS,QAAQ,CAAC;AACd;AACA,QAAQ,EAAE,WAAW,EACrB,KAAK,EACL,IAAI,GAAG,QAAQ,EACf,OAAO,EACP,KAAK,GAAG,KAAK,EACb,SAAS,GAAG,KAAK,EACjB,GAAG,cAAc,EACgB,EAAA;AACjC,IAAA,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;AAErC,IAAA,QACIA,GAAA,CAAA,KAAA,EAAA,EAAA,GACQ,cAAc,EAClB,GAAG,EAAE,KAAK,EAAA,iBAAA,EACO,CAAC,KAAK,KAAK,KAAK,IAAI,CAAC,SAAS,KAAK,SAAS,EAAA,WAAA,EAClD,IAAI,EAAA,gBAAA,EAAA,IAAA,EAAA,YAAA,EAEH,KAAK,EAAA,QAAA,EAEhB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,KAAI;AAChB,YAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC;AAEtC,YAAA,QACIA,GAAA,CAAA,QAAA,EAAA,EAAA,aAAA,EACiB,QAAQ,IAAI,SAAS,EAClC,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,SAAS,EAEpC,OAAO,EAAE,MAAM,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAA,QAAA,EAEtCC,IACK,CAAA,MAAA,EAAA,EAAA,QAAA,EAAA,CAAA,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,IAAI,EAC1C,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,KAAK,IAAID,GAAA,CAAC,KAAK,EAAC,EAAA,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAC,SAAS,EAAA,CAAG,CACvD,EAAA,CAAA,EAAA,EAPF,IAAI,CAAC,KAAK,CAQV,EACX;SACL,CAAC,EACA,CAAA,EACR;AACN,CAAC;AAED,QAAQ,CAAC,QAAQ,GAAG,UAAU,CAAC;AAIxB,MAAM,KAAK,GAAG,GAAG,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/Table.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ElementProps } from '.';
|
|
3
|
+
export type TableRow = Record<string, ReactNode>;
|
|
4
|
+
export type TableColumn<R extends TableRow = Record<string, ReactNode>> = {
|
|
5
|
+
/**
|
|
6
|
+
* The key of the column. This is used to access the data in the row.
|
|
7
|
+
*
|
|
8
|
+
* @type string
|
|
9
|
+
*/
|
|
10
|
+
key: keyof R;
|
|
11
|
+
/**
|
|
12
|
+
* The label of the column. This is used to display the column header.
|
|
13
|
+
*
|
|
14
|
+
* @type string
|
|
15
|
+
*/
|
|
16
|
+
label: string;
|
|
17
|
+
/**
|
|
18
|
+
* The width of the column. This is used to set the width of the column.
|
|
19
|
+
*
|
|
20
|
+
* Used to set the value of
|
|
21
|
+
* [grid-template-columns](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns)
|
|
22
|
+
*
|
|
23
|
+
* @default 1fr
|
|
24
|
+
* @type string
|
|
25
|
+
*/
|
|
26
|
+
width?: string;
|
|
27
|
+
};
|
|
28
|
+
export type TableProps<R extends TableRow> = {
|
|
29
|
+
/** The data of the table. */
|
|
30
|
+
rows: R[];
|
|
31
|
+
/** The columns of the table. */
|
|
32
|
+
columns: TableColumn<R>[];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Component description coming soon.
|
|
36
|
+
*
|
|
37
|
+
* @name Table
|
|
38
|
+
*/
|
|
39
|
+
declare function Table<R extends TableRow>({ rows, columns, ...props }: ElementProps<TableProps<R>, 'div'>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
40
|
+
declare namespace Table {
|
|
41
|
+
var bspkName: string;
|
|
42
|
+
}
|
|
43
|
+
export { Table };
|
|
44
|
+
export declare const style: import("@emotion/react").SerializedStyles;
|
|
45
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
package/Table.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Component description coming soon.
|
|
6
|
+
*
|
|
7
|
+
* @name Table
|
|
8
|
+
*/
|
|
9
|
+
function Table({ rows, columns, ...props }) {
|
|
10
|
+
return (jsxs("div", { ...props, css: style, "data-table": true, style: {
|
|
11
|
+
...props.style,
|
|
12
|
+
gridTemplateColumns: columns.map((c) => `minmax(0, ${c.width || '1fr'})`).join(' '),
|
|
13
|
+
}, children: [columns.map((column, index, arr) => (jsx("div", { "data-head": [index === 0 && 'first', index === arr.length - 1 && 'last'].filter(Boolean).join(' '), children: column.label }, column.key))), rows.map((row, index, arr) => {
|
|
14
|
+
const lastRow = index === arr.length - 1 || undefined;
|
|
15
|
+
return columns.map((column) => (jsx("div", { "data-cell": column.key, "data-row-last": lastRow, children: row[column.key] }, index + column.key)));
|
|
16
|
+
})] }));
|
|
17
|
+
}
|
|
18
|
+
Table.bspkName = 'Table';
|
|
19
|
+
const style = css `
|
|
20
|
+
width: 100%;
|
|
21
|
+
border-collapse: separate;
|
|
22
|
+
text-align: left;
|
|
23
|
+
border-spacing: 2rem 0.125rem;
|
|
24
|
+
display: grid;
|
|
25
|
+
color: var(--foreground-neutral-on-surface);
|
|
26
|
+
font: var(--labels-base);
|
|
27
|
+
border-radius: var(--radius-medium);
|
|
28
|
+
border: 1px solid var(--stroke-neutral-low);
|
|
29
|
+
|
|
30
|
+
[data-cell] {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
gap: var(--spacing-sizing-02);
|
|
34
|
+
padding: var(--spacing-sizing-04);
|
|
35
|
+
background-color: var(--surface-neutral-t1-base);
|
|
36
|
+
border-bottom: var(--stroke-neutral-low) solid 1px;
|
|
37
|
+
font: var(--labels-small);
|
|
38
|
+
p {
|
|
39
|
+
margin: 0;
|
|
40
|
+
padding: 0;
|
|
41
|
+
font: var(--body-small);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
[data-head] {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
flex-direction: row;
|
|
49
|
+
border-bottom: 1px solid var(--stroke-neutral-base);
|
|
50
|
+
background: var(--surface-neutral-t2-lowest);
|
|
51
|
+
height: var(--spacing-sizing-10);
|
|
52
|
+
padding: 0 var(--spacing-sizing-03);
|
|
53
|
+
font: var(--labels-base);
|
|
54
|
+
|
|
55
|
+
&[data-head='first'] {
|
|
56
|
+
border-top-left-radius: var(--radius-medium);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&[data-head='last'] {
|
|
60
|
+
border-top-right-radius: var(--radius-medium);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
export { Table, style };
|
|
66
|
+
//# sourceMappingURL=Table.js.map
|
package/Table.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.js","sources":["src/Table.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;AAuCA;;;;AAIG;AACH,SAAS,KAAK,CAAqB,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,EAAsC,EAAA;IAC9F,QACIA,iBACQ,KAAK,EACT,GAAG,EAAE,KAAK,EAEV,YAAA,EAAA,IAAA,EAAA,KAAK,EAAE;YACH,GAAG,KAAK,CAAC,KAAK;YACd,mBAAmB,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAA,UAAA,EAAa,CAAC,CAAC,KAAK,IAAI,KAAK,CAAA,CAAA,CAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AACtF,SAAA,EAAA,QAAA,EAAA,CAEA,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAC5BC,GAAA,CAAA,KAAA,EAAA,EAAA,WAAA,EACe,CAAC,KAAK,KAAK,CAAC,IAAI,OAAO,EAAE,KAAK,KAAK,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAGhG,QAAA,EAAA,MAAM,CAAC,KAAK,IAFR,MAAM,CAAC,GAAa,CAGvB,CACT,CAAC,EACD,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,KAAI;gBAC1B,MAAM,OAAO,GAAG,KAAK,KAAK,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC;AACtD,gBAAA,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,MACtBA,GAAA,CAAA,KAAA,EAAA,EAAA,WAAA,EAAgB,MAAM,CAAC,GAAG,EAAiB,eAAA,EAAA,OAAO,EAC7C,QAAA,EAAA,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EADqC,EAAA,KAAK,GAAI,MAAM,CAAC,GAAc,CAEjF,CACT,CAAC,CAAC;aACN,CAAC,CACA,EAAA,CAAA,EACR;AACN,CAAC;AAED,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC;AAIlB,MAAM,KAAK,GAAG,GAAG,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/Tag.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ElementType, ReactNode } from 'react';
|
|
2
|
+
import { ColorVariant } from './utils/colorVariants';
|
|
3
|
+
import { ElementProps } from './';
|
|
4
|
+
export type TagProps<As extends ElementType = 'span'> = {
|
|
5
|
+
/**
|
|
6
|
+
* The element type to render as.
|
|
7
|
+
*
|
|
8
|
+
* @default span
|
|
9
|
+
* @type ElementType
|
|
10
|
+
*/
|
|
11
|
+
as?: As;
|
|
12
|
+
/**
|
|
13
|
+
* The content of the tag.
|
|
14
|
+
*
|
|
15
|
+
* @required
|
|
16
|
+
*/
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* The size of the tag.
|
|
20
|
+
*
|
|
21
|
+
* @default small
|
|
22
|
+
*/
|
|
23
|
+
size?: 'small' | 'x-small';
|
|
24
|
+
/**
|
|
25
|
+
* The color of the tag.
|
|
26
|
+
*
|
|
27
|
+
* @default white
|
|
28
|
+
*/
|
|
29
|
+
color?: ColorVariant;
|
|
30
|
+
/**
|
|
31
|
+
* The display variant of the tag.
|
|
32
|
+
*
|
|
33
|
+
* @default flat
|
|
34
|
+
*/
|
|
35
|
+
variant?: 'corner-wrap' | 'flat' | 'pill';
|
|
36
|
+
/**
|
|
37
|
+
* Whether the tag should wrap its content.
|
|
38
|
+
*
|
|
39
|
+
* (Not recommended)
|
|
40
|
+
*
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
wrap?: boolean;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A non-interactive visual indicators to draw attention or categorization of a component.
|
|
47
|
+
*
|
|
48
|
+
* @name Tag
|
|
49
|
+
*/
|
|
50
|
+
declare function Tag<As extends ElementType = 'span'>({ children, as, color, size, variant, wrap, ...props }: ElementProps<TagProps<As>, As>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
51
|
+
declare namespace Tag {
|
|
52
|
+
var bspkName: string;
|
|
53
|
+
}
|
|
54
|
+
export { Tag };
|
|
55
|
+
export declare const style: import("@emotion/react").SerializedStyles;
|
|
56
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
package/Tag.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
import { COLOR_VARIABLES } from './utils/colorVariants.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A non-interactive visual indicators to draw attention or categorization of a component.
|
|
7
|
+
*
|
|
8
|
+
* @name Tag
|
|
9
|
+
*/
|
|
10
|
+
function Tag({ children, as, color = 'white', size = 'small', variant = 'flat', wrap, ...props }) {
|
|
11
|
+
const As = as || 'span';
|
|
12
|
+
return (jsxs(As, { ...props, css: style, "data-color": color, "data-size": size, "data-tag": true, "data-variant": variant, "data-wrap": wrap || undefined, children: [children, variant === 'corner-wrap' && jsx("div", { "data-triangle": true })] }));
|
|
13
|
+
}
|
|
14
|
+
Tag.bspkName = 'Tag';
|
|
15
|
+
const style = css `
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
width: fit-content;
|
|
20
|
+
position: relative;
|
|
21
|
+
padding: 0 var(--spacing-sizing-03);
|
|
22
|
+
border-radius: var(--radius-small);
|
|
23
|
+
color: var(--foreground) !important;
|
|
24
|
+
background: var(--background);
|
|
25
|
+
text-decoration: none;
|
|
26
|
+
font: unset;
|
|
27
|
+
text-decoration: unset;
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
|
|
30
|
+
&[data-wrap] {
|
|
31
|
+
height: auto;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&[data-variant='pill'] {
|
|
35
|
+
border-radius: var(--radius-circular);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&[data-variant='corner-wrap'] {
|
|
39
|
+
border-bottom-right-radius: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
${Object.entries(COLOR_VARIABLES).map(([variant, { foreground, surface }]) => css `
|
|
43
|
+
&[data-color='${variant}'] {
|
|
44
|
+
--foreground: var(${foreground});
|
|
45
|
+
--background: var(${surface});
|
|
46
|
+
}
|
|
47
|
+
`)}
|
|
48
|
+
|
|
49
|
+
&[data-size='small'] {
|
|
50
|
+
font: var(--labels-small);
|
|
51
|
+
height: var(--spacing-sizing-08);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&[data-size='x-small'] {
|
|
55
|
+
font: var(--labels-x-small);
|
|
56
|
+
height: var(--spacing-sizing-06);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&[data-color='white'] {
|
|
60
|
+
box-shadow: var(--drop-shadow-south);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[data-triangle] {
|
|
64
|
+
position: absolute;
|
|
65
|
+
bottom: -12px;
|
|
66
|
+
right: 0;
|
|
67
|
+
width: 0px;
|
|
68
|
+
height: 0px;
|
|
69
|
+
border-style: solid;
|
|
70
|
+
border-width: 12px 12px 0 0;
|
|
71
|
+
border-color: var(--foreground) transparent transparent transparent;
|
|
72
|
+
transform: rotate(0deg);
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
|
|
76
|
+
export { Tag, style };
|
|
77
|
+
//# sourceMappingURL=Tag.js.map
|
package/Tag.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tag.js","sources":["src/Tag.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;AAiDA;;;;AAIG;AACH,SAAS,GAAG,CAAkC,EAC1C,QAAQ,EACR,EAAE,EACF,KAAK,GAAG,OAAO,EACf,IAAI,GAAG,OAAO,EACd,OAAO,GAAG,MAAM,EAChB,IAAI,EACJ,GAAG,KAAK,EACqB,EAAA;AAC7B,IAAA,MAAM,EAAE,GAAgB,EAAE,IAAI,MAAM,CAAC;AAErC,IAAA,QACIA,IAAA,CAAC,EAAE,EAAA,EAAA,GACK,KAAK,EACT,GAAG,EAAE,KAAK,EAAA,YAAA,EACE,KAAK,EAAA,WAAA,EACN,IAAI,EAAA,UAAA,EAAA,IAAA,EAAA,cAAA,EAED,OAAO,EAAA,WAAA,EACV,IAAI,IAAI,SAAS,EAAA,QAAA,EAAA,CAE3B,QAAQ,EACR,OAAO,KAAK,aAAa,IAAIC,GAAqB,CAAA,KAAA,EAAA,EAAA,eAAA,EAAA,IAAA,EAAA,CAAA,CAAA,EAAA,CAClD,EACP;AACN,CAAC;AAED,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC;AAId,MAAM,KAAK,GAAG,GAAG,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2BlB,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,GAAG,CACjC,CAAC,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,KAAK,GAAG,CAAA,CAAA;4BACvB,OAAO,CAAA;oCACC,UAAU,CAAA;oCACV,OAAO,CAAA;;SAElC,CACJ,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/TextField.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FormFieldProps } from './FormField';
|
|
2
|
+
import { TextInputProps } from './TextInput';
|
|
3
|
+
export type TextFieldProps = Pick<TextInputProps, 'autoComplete' | 'disabled' | 'inputRef' | 'invalid' | 'leading' | 'name' | 'onChange' | 'placeholder' | 'readOnly' | 'required' | 'size' | 'trailing' | 'type' | 'value'> & Pick<FormFieldProps, 'controlId' | 'errorMessage' | 'helperText' | 'label' | 'labelTrailing'>;
|
|
4
|
+
/**
|
|
5
|
+
* A text input that allows users to enter text, numbers or symbols in a singular line.
|
|
6
|
+
*
|
|
7
|
+
* This component takes properties from the FormField and TextInput components.
|
|
8
|
+
*
|
|
9
|
+
* @name TextField
|
|
10
|
+
*/
|
|
11
|
+
declare function TextField({ label, errorMessage: errorMessageProp, helperText, controlId, labelTrailing, required, ...inputProps }: TextFieldProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare namespace TextField {
|
|
13
|
+
var bspkName: string;
|
|
14
|
+
}
|
|
15
|
+
export { TextField };
|
|
16
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|