@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
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SwitchProps } from '../Switch';
|
|
2
|
+
/**
|
|
3
|
+
* A hook to manage the state of a group of switches. Used alongside the SwitchGroup component.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* import { Switch } from '@bspk/ui/Switch';
|
|
7
|
+
* import { useSwitchGroupState } from '@bspk/ui/hooks/useSwitchGroupState';
|
|
8
|
+
*
|
|
9
|
+
* export function Example() {
|
|
10
|
+
* const allValues = ['Red', 'Orange', 'Yellow', 'Green'];
|
|
11
|
+
*
|
|
12
|
+
* const { allSwitchProps, switchProps, values } = useSwitchGroupState(allValues, 'fruits');
|
|
13
|
+
*
|
|
14
|
+
* return (
|
|
15
|
+
* <>
|
|
16
|
+
* <pre>Selected Values: {values.join(', ')}</pre>
|
|
17
|
+
* <Switch aria-label="All" {...allSwitchProps} />
|
|
18
|
+
* {allValues.map((value) => (
|
|
19
|
+
* <Switch key={value} aria-label={value} {...switchProps(value)} />
|
|
20
|
+
* ))}
|
|
21
|
+
* </>
|
|
22
|
+
* );
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* @param allValues - The values of the switches.
|
|
26
|
+
* @param name - The name of the switches.
|
|
27
|
+
* @param externalState - The externally managed state of the switches.
|
|
28
|
+
* @returns Properties to pass to the switch, other helper functions, and the state of the switch.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useSwitchGroupState(allValues: string[], name: string, externalState?: [values: string[], setValues: (next: string[]) => void]): {
|
|
31
|
+
toggleValue: (itemValue: string, checked: boolean) => void;
|
|
32
|
+
allSwitchProps: Pick<SwitchProps, "onChange" | "name" | "value" | "checked">;
|
|
33
|
+
switchProps: (value: string) => Pick<SwitchProps, "checked" | "name" | "onChange" | "value">;
|
|
34
|
+
values: string[];
|
|
35
|
+
setValues: import("react").Dispatch<import("react").SetStateAction<string[]>>;
|
|
36
|
+
};
|
|
37
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A hook to manage the state of a group of switches. Used alongside the SwitchGroup component.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import { Switch } from '@bspk/ui/Switch';
|
|
8
|
+
* import { useSwitchGroupState } from '@bspk/ui/hooks/useSwitchGroupState';
|
|
9
|
+
*
|
|
10
|
+
* export function Example() {
|
|
11
|
+
* const allValues = ['Red', 'Orange', 'Yellow', 'Green'];
|
|
12
|
+
*
|
|
13
|
+
* const { allSwitchProps, switchProps, values } = useSwitchGroupState(allValues, 'fruits');
|
|
14
|
+
*
|
|
15
|
+
* return (
|
|
16
|
+
* <>
|
|
17
|
+
* <pre>Selected Values: {values.join(', ')}</pre>
|
|
18
|
+
* <Switch aria-label="All" {...allSwitchProps} />
|
|
19
|
+
* {allValues.map((value) => (
|
|
20
|
+
* <Switch key={value} aria-label={value} {...switchProps(value)} />
|
|
21
|
+
* ))}
|
|
22
|
+
* </>
|
|
23
|
+
* );
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* @param allValues - The values of the switches.
|
|
27
|
+
* @param name - The name of the switches.
|
|
28
|
+
* @param externalState - The externally managed state of the switches.
|
|
29
|
+
* @returns Properties to pass to the switch, other helper functions, and the state of the switch.
|
|
30
|
+
*/
|
|
31
|
+
function useSwitchGroupState(allValues, name, externalState) {
|
|
32
|
+
const localState = useState([]);
|
|
33
|
+
const [values, setValues] = externalState || localState;
|
|
34
|
+
const toggleValue = useCallback((itemValue, checked) => {
|
|
35
|
+
setValues(allValues.flatMap((value) => {
|
|
36
|
+
if (value === itemValue)
|
|
37
|
+
return checked ? value : [];
|
|
38
|
+
return values.includes(value) ? value : [];
|
|
39
|
+
}));
|
|
40
|
+
}, [allValues, setValues, values]);
|
|
41
|
+
const switchProps = useCallback((value) => ({
|
|
42
|
+
checked: values.includes(value),
|
|
43
|
+
name,
|
|
44
|
+
onChange: (checked) => toggleValue(value, checked),
|
|
45
|
+
value,
|
|
46
|
+
}), [values, name, toggleValue]);
|
|
47
|
+
const allSwitchProps = useMemo(() => {
|
|
48
|
+
return {
|
|
49
|
+
checked: allValues.length === values.length,
|
|
50
|
+
name,
|
|
51
|
+
onChange: () => setValues(allValues.length === values.length ? [] : allValues),
|
|
52
|
+
value: 'all',
|
|
53
|
+
};
|
|
54
|
+
}, [allValues, values.length, name, setValues]);
|
|
55
|
+
return { toggleValue, allSwitchProps, switchProps, values, setValues };
|
|
56
|
+
}
|
|
57
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
58
|
+
|
|
59
|
+
export { useSwitchGroupState };
|
|
60
|
+
//# sourceMappingURL=useSwitchGroupState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSwitchGroupState.js","sources":["../src/hooks/useSwitchGroupState.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;SACa,mBAAmB,CAC/B,SAAmB,EACnB,IAAY,EACZ,aAAuE,EAAA;AAEvE,IAAA,MAAM,UAAU,GAAG,QAAQ,CAAW,EAAE,CAAC,CAAC;IAC1C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,aAAa,IAAI,UAAU,CAAC;IAExD,MAAM,WAAW,GAAG,WAAW,CAC3B,CAAC,SAAiB,EAAE,OAAgB,KAAI;QACpC,SAAS,CACL,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,KAAI;YACxB,IAAI,KAAK,KAAK,SAAS;gBAAE,OAAO,OAAO,GAAG,KAAK,GAAG,EAAE,CAAC;AACrD,YAAA,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;SAC9C,CAAC,CACL,CAAC;KACL,EACD,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CACjC,CAAC;IAEF,MAAM,WAAW,GAAG,WAAW,CAC3B,CAAC,KAAa,MAAoE;AAC9E,QAAA,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC/B,IAAI;QACJ,QAAQ,EAAE,CAAC,OAAO,KAAK,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC;QAClD,KAAK;KACR,CAAC,EACF,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,CAC9B,CAAC;AAEF,IAAA,MAAM,cAAc,GAAG,OAAO,CAAC,MAAmE;QAC9F,OAAO;AACH,YAAA,OAAO,EAAE,SAAS,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;YAC3C,IAAI;YACJ,QAAQ,EAAE,MAAM,SAAS,CAAC,SAAS,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,GAAG,EAAE,GAAG,SAAS,CAAC;AAC9E,YAAA,KAAK,EAAE,KAAK;SACf,CAAC;AACN,KAAC,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IAEhD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AAC3E,CAAC;AAED;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A hook that creates a timeout that is automatically cleared when the component is unmounted.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* import { useTimeout } from '@bspk/ui/hooks/useTimeout';
|
|
6
|
+
* import { useEffect } from 'react';
|
|
7
|
+
*
|
|
8
|
+
* function MyComponent() {
|
|
9
|
+
* const timeoutRef = useTimeout();
|
|
10
|
+
*
|
|
11
|
+
* useEffect(() => {
|
|
12
|
+
* timeoutRef.current = setTimeout(() => {
|
|
13
|
+
* console.log('Timeout triggered');
|
|
14
|
+
* }, 1000);
|
|
15
|
+
* }, []);
|
|
16
|
+
* return <div>Check the console after 1 second</div>;
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* @returns A ref object that can be used to store a timeout id.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useTimeout(): {
|
|
22
|
+
clear: () => void;
|
|
23
|
+
set: (callback: () => void, durationMs: number) => void;
|
|
24
|
+
ref: import("react").MutableRefObject<NodeJS.Timeout | null>;
|
|
25
|
+
};
|
|
26
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useRef, useEffect, useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A hook that creates a timeout that is automatically cleared when the component is unmounted.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import { useTimeout } from '@bspk/ui/hooks/useTimeout';
|
|
8
|
+
* import { useEffect } from 'react';
|
|
9
|
+
*
|
|
10
|
+
* function MyComponent() {
|
|
11
|
+
* const timeoutRef = useTimeout();
|
|
12
|
+
*
|
|
13
|
+
* useEffect(() => {
|
|
14
|
+
* timeoutRef.current = setTimeout(() => {
|
|
15
|
+
* console.log('Timeout triggered');
|
|
16
|
+
* }, 1000);
|
|
17
|
+
* }, []);
|
|
18
|
+
* return <div>Check the console after 1 second</div>;
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* @returns A ref object that can be used to store a timeout id.
|
|
22
|
+
*/
|
|
23
|
+
function useTimeout() {
|
|
24
|
+
const timeoutRef = useRef(null);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (timeoutRef.current)
|
|
27
|
+
clearTimeout(timeoutRef.current);
|
|
28
|
+
}, []);
|
|
29
|
+
return useMemo(() => ({
|
|
30
|
+
clear: () => {
|
|
31
|
+
if (timeoutRef.current)
|
|
32
|
+
clearTimeout(timeoutRef.current);
|
|
33
|
+
},
|
|
34
|
+
set: (callback, durationMs) => {
|
|
35
|
+
if (timeoutRef.current)
|
|
36
|
+
clearTimeout(timeoutRef.current);
|
|
37
|
+
timeoutRef.current = setTimeout(callback, durationMs);
|
|
38
|
+
},
|
|
39
|
+
ref: timeoutRef,
|
|
40
|
+
}), []);
|
|
41
|
+
}
|
|
42
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
43
|
+
|
|
44
|
+
export { useTimeout };
|
|
45
|
+
//# sourceMappingURL=useTimeout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTimeout.js","sources":["../src/hooks/useTimeout.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;AAmBG;SACa,UAAU,GAAA;AACtB,IAAA,MAAM,UAAU,GAAG,MAAM,CAAuC,IAAI,CAAC,CAAC;IAEtE,SAAS,CAAC,MAAK;QACX,IAAI,UAAU,CAAC,OAAO;AAAE,YAAA,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;KAC5D,EAAE,EAAE,CAAC,CAAC;AAEP,IAAA,OAAO,OAAO,CACV,OAAO;QACH,KAAK,EAAE,MAAK;YACR,IAAI,UAAU,CAAC,OAAO;AAAE,gBAAA,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;SAC5D;AACD,QAAA,GAAG,EAAE,CAAC,QAAoB,EAAE,UAAkB,KAAI;YAC9C,IAAI,UAAU,CAAC,OAAO;AAAE,gBAAA,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACzD,UAAU,CAAC,OAAO,GAAG,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;SACzD;AACD,QAAA,GAAG,EAAE,UAAU;KAClB,CAAC,EACF,EAAE,CACL,CAAC;AACN,CAAC;AAED;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare function useValidChildren(componentNme: string, children: ReactNode, ariaLabel: string | undefined, override?: boolean): {
|
|
3
|
+
icon?: ReactNode | undefined;
|
|
4
|
+
label?: ReactNode | undefined;
|
|
5
|
+
};
|
|
6
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { getChildrenElements } from '../utils/children.js';
|
|
3
|
+
import { useErrorLogger } from '../utils/errors.js';
|
|
4
|
+
|
|
5
|
+
const VALID_CHILDREN = ['Icon', 'string'];
|
|
6
|
+
function useValidChildren(componentNme, children, ariaLabel, override) {
|
|
7
|
+
const { logError } = useErrorLogger();
|
|
8
|
+
return useMemo(() => {
|
|
9
|
+
if (override)
|
|
10
|
+
return { icon: undefined, label: undefined };
|
|
11
|
+
let icon;
|
|
12
|
+
let label;
|
|
13
|
+
const childrenArray = getChildrenElements(children);
|
|
14
|
+
logError(childrenArray.length > 2, `${componentNme} - component only accepts two children, ${childrenArray.length} were provided`);
|
|
15
|
+
childrenArray.forEach(({ child, name }) => {
|
|
16
|
+
const valid = VALID_CHILDREN.includes(name);
|
|
17
|
+
logError(!valid, `${componentNme} - component only accepts two children, and Icon and string`);
|
|
18
|
+
if (valid) {
|
|
19
|
+
if (name === 'string')
|
|
20
|
+
label = child;
|
|
21
|
+
if (name === 'Icon')
|
|
22
|
+
icon = child;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
logError(!icon && !label, `${componentNme} - component requires at least one child, an icon or a label`);
|
|
26
|
+
logError(!!icon && !label && !ariaLabel, `${componentNme} - component requires the aria-label property when only an icon is provided`);
|
|
27
|
+
return { icon, label };
|
|
28
|
+
}, [override, children, logError, componentNme, ariaLabel]);
|
|
29
|
+
}
|
|
30
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
31
|
+
|
|
32
|
+
export { useValidChildren };
|
|
33
|
+
//# sourceMappingURL=useValidChildren.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useValidChildren.js","sources":["../src/hooks/useValidChildren.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAKA,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEpC,SAAU,gBAAgB,CAC5B,YAAoB,EACpB,QAAmB,EACnB,SAA6B,EAC7B,QAAkB,EAAA;AAKlB,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,cAAc,EAAE,CAAC;IAEtC,OAAO,OAAO,CAAC,MAAK;AAChB,QAAA,IAAI,QAAQ;YAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAE3D,QAAA,IAAI,IAA2B,CAAC;AAChC,QAAA,IAAI,KAAgB,CAAC;AAErB,QAAA,MAAM,aAAa,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAEpD,QAAA,QAAQ,CACJ,aAAa,CAAC,MAAM,GAAG,CAAC,EACxB,CAAG,EAAA,YAAY,2CAA2C,aAAa,CAAC,MAAM,CAAA,cAAA,CAAgB,CACjG,CAAC;QAEF,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAI;YACtC,MAAM,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAE5C,QAAQ,CAAC,CAAC,KAAK,EAAE,GAAG,YAAY,CAAA,4DAAA,CAA8D,CAAC,CAAC;YAEhG,IAAI,KAAK,EAAE;gBACP,IAAI,IAAI,KAAK,QAAQ;oBAAE,KAAK,GAAG,KAAK,CAAC;gBACrC,IAAI,IAAI,KAAK,MAAM;oBAAE,IAAI,GAAG,KAAK,CAAC;aACrC;AACL,SAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAG,EAAA,YAAY,CAA8D,4DAAA,CAAA,CAAC,CAAC;AAEzG,QAAA,QAAQ,CACJ,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,EAC9B,CAAA,EAAG,YAAY,CAAA,2EAAA,CAA6E,CAC/F,CAAC;AAEF,QAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAC3B,KAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* There are no barrel files for this repository.
|
|
3
|
+
*
|
|
4
|
+
* Components should be imported directly like "import { Txt } from @bspk/ui/Txt".
|
|
5
|
+
*/
|
|
6
|
+
import { ChangeEvent, MouseEvent as ReactMouseEvent, ComponentProps, JSXElementConstructor, ReactNode } from 'react';
|
|
7
|
+
export type AlertVariant = 'error' | 'informational' | 'success' | 'warning';
|
|
8
|
+
export type ElementProps<P extends Record<string, unknown>, E extends JSXElementConstructor<unknown> | keyof JSX.IntrinsicElements, O extends string = ''> = Omit<ComponentProps<E>, O | keyof P> & P;
|
|
9
|
+
export type ButtonSize = 'large' | 'medium' | 'small' | 'x-small';
|
|
10
|
+
export type CallToActionButton = {
|
|
11
|
+
/**
|
|
12
|
+
* The label of the call to action button.
|
|
13
|
+
*
|
|
14
|
+
* @required
|
|
15
|
+
*/
|
|
16
|
+
label: string;
|
|
17
|
+
/**
|
|
18
|
+
* The callback function for the call to action button.
|
|
19
|
+
*
|
|
20
|
+
* @type () => void
|
|
21
|
+
* @required
|
|
22
|
+
*/
|
|
23
|
+
onClick: () => void;
|
|
24
|
+
/** The size of the call to action button. */
|
|
25
|
+
size?: ButtonSize;
|
|
26
|
+
};
|
|
27
|
+
export type ToggleControlProps<T extends HTMLElement> = CommonProps<'aria-label' | 'disabled' | 'invalid' | 'name', T> & Required<CommonProps<'value'>> & {
|
|
28
|
+
/**
|
|
29
|
+
* Marks the control as checked.
|
|
30
|
+
*
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
checked?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The function to call when the control is checked or unchecked.
|
|
36
|
+
*
|
|
37
|
+
* @type (checked, Event) => void
|
|
38
|
+
* @required
|
|
39
|
+
*/
|
|
40
|
+
onChange: (checked: boolean, event: ChangeEvent<T>) => void;
|
|
41
|
+
};
|
|
42
|
+
export type CommonProps<K extends keyof CommonPropsLibrary, T extends HTMLElement = HTMLElement> = Pick<CommonPropsLibrary<T>, K>;
|
|
43
|
+
export type CommonPropsLibrary<T extends HTMLElement = HTMLElement> = {
|
|
44
|
+
/** The id of the element. If not provided one will be generated. */
|
|
45
|
+
id?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Marks the element as active and displays active state theme.
|
|
48
|
+
*
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
active?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* The content of the element.
|
|
54
|
+
*
|
|
55
|
+
* @required
|
|
56
|
+
*/
|
|
57
|
+
children: ReactNode;
|
|
58
|
+
/**
|
|
59
|
+
* The size of the element.
|
|
60
|
+
*
|
|
61
|
+
* @default medium
|
|
62
|
+
*/
|
|
63
|
+
size?: 'large' | 'medium' | 'small';
|
|
64
|
+
/**
|
|
65
|
+
* Determines if the element is [required](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required).
|
|
66
|
+
*
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
required?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Determines if the element is [disabled](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled).
|
|
72
|
+
*
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
disabled?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Marks the element as invalid and displays error state theme.
|
|
78
|
+
*
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
invalid?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Determines if the element is [readonly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly).
|
|
84
|
+
*
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
readOnly?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* The [name](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name) of the control.
|
|
90
|
+
*
|
|
91
|
+
* @required
|
|
92
|
+
*/
|
|
93
|
+
name: string;
|
|
94
|
+
/**
|
|
95
|
+
* Marks the element as invalid and displays error message.
|
|
96
|
+
*
|
|
97
|
+
* When an element is invalid it must display an error message explaining why it is invalid.
|
|
98
|
+
*/
|
|
99
|
+
errorMessage?: string;
|
|
100
|
+
/**
|
|
101
|
+
* The value of the control.
|
|
102
|
+
*
|
|
103
|
+
* @required
|
|
104
|
+
*/
|
|
105
|
+
value?: string;
|
|
106
|
+
/**
|
|
107
|
+
* The aria-label for the element.
|
|
108
|
+
*
|
|
109
|
+
* @required
|
|
110
|
+
*/
|
|
111
|
+
'aria-label': string;
|
|
112
|
+
/**
|
|
113
|
+
* The function to call when the element is clicked.
|
|
114
|
+
*
|
|
115
|
+
* @param event - The mouse event.
|
|
116
|
+
* @returns Void
|
|
117
|
+
*/
|
|
118
|
+
onClick?: (event: ReactMouseEvent<T, MouseEvent>) => void;
|
|
119
|
+
};
|
|
120
|
+
export type Brand = 'anywhere' | 'better-homes-gardens' | 'cartus' | 'century-21' | 'coldwell-banker' | 'corcoran' | 'denali-boss' | 'era' | 'sothebys';
|
|
121
|
+
export declare const BRANDS: {
|
|
122
|
+
title: string;
|
|
123
|
+
slug: Brand;
|
|
124
|
+
}[];
|
|
125
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
package/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* There are no barrel files for this repository.
|
|
3
|
+
*
|
|
4
|
+
* Components should be imported directly like "import { Txt } from @bspk/ui/Txt".
|
|
5
|
+
*/
|
|
6
|
+
const BRANDS = [
|
|
7
|
+
{ title: 'Anywhere', slug: 'anywhere' },
|
|
8
|
+
{ title: 'Better Homes & Gardens', slug: 'better-homes-gardens' },
|
|
9
|
+
{ title: 'Cartus', slug: 'cartus' },
|
|
10
|
+
{ title: 'Century 21', slug: 'century-21' },
|
|
11
|
+
{ title: 'Coldwell Banker', slug: 'coldwell-banker' },
|
|
12
|
+
{ title: 'Corcoran', slug: 'corcoran' },
|
|
13
|
+
{ title: 'Denali Boss', slug: 'denali-boss' },
|
|
14
|
+
{ title: 'ERA', slug: 'era' },
|
|
15
|
+
{ title: "Sotheby's", slug: 'sothebys' },
|
|
16
|
+
];
|
|
17
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
18
|
+
|
|
19
|
+
export { BRANDS };
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["src/index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;AAIG;AA+IU,MAAA,MAAM,GAAqC;AACpD,IAAA,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE;AACvC,IAAA,EAAE,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE,sBAAsB,EAAE;AACjE,IAAA,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;AACnC,IAAA,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE;AAC3C,IAAA,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,iBAAiB,EAAE;AACrD,IAAA,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE;AACvC,IAAA,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE;AAC7C,IAAA,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE;AAC7B,IAAA,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE;EACjC;AAEX;;;;"}
|
package/meta.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** This file is generated by the ./scripts/build-meta.ts script. This file contains data scraped from the library. */
|
|
2
|
+
export type BaseMeta = {
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
file?: string;
|
|
6
|
+
};
|
|
7
|
+
export type TypeMeta = BaseMeta & {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
example?: string;
|
|
11
|
+
references?: string[];
|
|
12
|
+
properties?: TypeProperty[];
|
|
13
|
+
};
|
|
14
|
+
export type TypeProperty = {
|
|
15
|
+
name: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
type?: string[] | string;
|
|
18
|
+
default?: unknown;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
options?: number[] | string[];
|
|
21
|
+
variants?: string[];
|
|
22
|
+
properties?: TypeProperty[];
|
|
23
|
+
references?: string[];
|
|
24
|
+
minimum?: number;
|
|
25
|
+
maximum?: number;
|
|
26
|
+
};
|
|
27
|
+
export type ComponentMeta = BaseMeta & {
|
|
28
|
+
slug: string;
|
|
29
|
+
css?: string;
|
|
30
|
+
dependencies: string[];
|
|
31
|
+
modified: string;
|
|
32
|
+
hasTouchTarget?: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type UtilityMeta = BaseMeta & {
|
|
35
|
+
param?: string;
|
|
36
|
+
returns?: string;
|
|
37
|
+
example?: string;
|
|
38
|
+
};
|
|
39
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
40
|
+
export declare const componentsMeta: ComponentMeta[];
|
|
41
|
+
export declare const utilitiesMeta: UtilityMeta[];
|
|
42
|
+
export declare const typesMeta: TypeMeta[];
|
|
43
|
+
export type MetaTypeName = 'AccordionProps' | 'BadgeProps' | 'BannerAlertProps' | 'BottomNavigationProps' | 'BottomSheetProps' | 'BreadcrumbProps' | 'ButtonDockProps' | 'ButtonProps' | 'CallToActionButton' | 'CardProps' | 'ChartProps' | 'CheckboxGroupOption' | 'CheckboxGroupProps' | 'CheckboxOptionProps' | 'CheckboxProps' | 'ChipProps' | 'CommonProps<"active"|"disabled"|"readOnly">' | 'CommonProps<"aria-label">' | 'CommonProps<"disabled">' | 'CommonProps<"disabled"|"onClick">' | 'CommonProps<"id">' | 'CommonProps<"id"|"disabled">' | 'CommonProps<"invalid"|"disabled"|"readOnly">' | 'CommonProps<"name"|"aria-label">' | 'CommonProps<"name"|"id"|"invalid"|"disabled"|"size"|"aria-label"|"readOnly">' | 'CommonProps<"name"|"invalid"|"disabled"|"aria-label",HTMLInputElement>' | 'CommonProps<"name"|"invalid"|"disabled"|"aria-label",T>' | 'CommonProps<"name"|"required"|"id"|"value"|"invalid"|"disabled"|"size"|"aria-label"|"readOnly">' | 'CommonProps<"name"|"value">' | 'CommonProps<"name"|"value"|"disabled"|"aria-label"|"onClick">' | 'CommonProps<"required"|"errorMessage">' | 'CommonProps<"required"|"id"|"invalid"|"disabled"|"aria-label"|"readOnly">' | 'CommonPropsLibrary' | 'DatePickerProps' | 'DialogProps' | 'DividerProps' | 'DrawerProps' | 'DropdownFieldProps' | 'DropdownOption' | 'DropdownProps' | 'ElementProps' | 'EmptyStateProps' | 'FabProps' | 'FieldControlProps' | 'FileUploadProps' | 'FormFieldProps' | 'ImageProps' | 'ImgProps' | 'InlineAlertProps' | 'LayoutProps' | 'LinkProps' | 'ListItemProps' | 'M' | 'MenuButtonProps' | 'MenuItem' | 'MenuProps' | 'ModalProps' | 'MultiSelectionProps' | 'NavigationRailProps' | 'NavOption' | 'NumberFieldProps' | 'NumberInputProps' | 'OTPInputProps' | 'PageControlProps' | 'PasswordInputProps' | 'PhoneNumberInputProps' | 'Pick<ButtonProps<As>,"icon"|"onClick"|"as"|"showLabel"|"toolTip">' | 'Pick<CheckboxProps,"name"|"value"|"invalid"|"disabled"|"onChange"|"checked"|"indeterminate">' | 'Pick<DropdownProps,"name"|"value"|"disabled"|"options"|"size"|"onChange"|"placeholder"|"readOnly"|"placement"|"itemCount">' | 'Pick<FormFieldProps,"label"|"errorMessage"|"helperText"|"controlId">' | 'Pick<FormFieldProps,"label"|"errorMessage"|"helperText"|"labelTrailing"|"controlId">' | 'Pick<FormFieldProps,"required"|"label"|"errorMessage"|"helperText"|"labelTrailing"|"controlId">' | 'Pick<MenuProps,"itemCount"|"items"|"noResultsMessage">' | 'Pick<MenuProps<M>,"activeIndex"|"isMulti"|"selectedValues">' | 'Pick<MenuProps<O>,"onChange"|"isMulti"|"itemCount"|"renderListItem">' | 'Pick<NumberInputProps,"name"|"id"|"value"|"invalid"|"disabled"|"size"|"onChange"|"readOnly"|"centered">' | 'Pick<RadioProps,"name"|"value"|"invalid"|"disabled"|"onChange"|"checked">' | 'Pick<TextInputProps,"name"|"id"|"size"|"aria-label"|"placeholder"|"inputRef">' | 'Pick<TextInputProps,"name"|"required"|"type"|"value"|"invalid"|"disabled"|"size"|"onChange"|"autoComplete"|"placeholder"|"readOnly"|"leading"|"trailing"|"inputRef">' | 'Pick<ToggleControlProps<HTMLInputElement>,"value">' | 'Pick<ToggleOptionProps,"label"|"description">' | 'Pick<ToggleOptionProps,"label"|"size"|"description">' | 'PopoverProps' | 'PortalProps' | 'ProfileProps' | 'ProgressBarProps' | 'ProgressCircleProps' | 'ProgressionStepperBarProps' | 'ProgressionStepperItem' | 'ProgressionStepperProps' | 'RadioGroupOption' | 'RadioGroupProps' | 'RadioOptionProps' | 'RadioProps' | 'RatingProps' | 'RenderListItemParams' | 'Required<CommonProps<"value",HTMLElement>>' | 'Required<CommonProps<"value">>' | 'Required<Pick<ButtonProps<As>,"label">>' | 'SearchBarProps' | 'SegmentedControlProps' | 'SegmentedToggleOption' | 'SkeletonProps' | 'SliderInputProps' | 'SnackbarProps' | 'SwitchGroupOption' | 'SwitchGroupProps' | 'SwitchOptionProps' | 'SwitchProps' | 'TabGroupOption' | 'TabGroupProps' | 'TableColumn' | 'TableProps' | 'TagProps' | 'TextareaFieldProps' | 'TextareaProps' | 'TextFieldProps' | 'TextInputProps' | 'TimePickerProps' | 'ToggleControlProps' | 'ToggleOptionProps' | 'TooltipProps' | 'TopNavigationProps' | 'TxtProps';
|
|
44
|
+
export type MetaComponentName = 'Accordion' | 'Badge' | 'BannerAlert' | 'BottomNavigation' | 'BottomSheet' | 'Breadcrumb' | 'Button' | 'ButtonDock' | 'Card' | 'Chart' | 'Checkbox' | 'CheckboxGroup' | 'CheckboxOption' | 'Chip' | 'DatePicker' | 'Dialog' | 'Divider' | 'Drawer' | 'Dropdown' | 'DropdownField' | 'EmptyState' | 'Fab' | 'FileUpload' | 'FormField' | 'Image' | 'Img' | 'InlineAlert' | 'Layout' | 'Link' | 'ListItem' | 'Menu' | 'MenuButton' | 'Modal' | 'MultiSelection' | 'NavigationRail' | 'NumberField' | 'NumberInput' | 'OTPInput' | 'PageControl' | 'PasswordInput' | 'PhoneNumberInput' | 'Popover' | 'Portal' | 'Profile' | 'ProgressBar' | 'ProgressCircle' | 'ProgressionStepper' | 'ProgressionStepperBar' | 'Radio' | 'RadioGroup' | 'RadioOption' | 'Rating' | 'SearchBar' | 'SegmentedControl' | 'Skeleton' | 'SliderInput' | 'Snackbar' | 'StylesProviderAnywhere' | 'StylesProviderBetterHomesGardens' | 'StylesProviderCartus' | 'StylesProviderCentury21' | 'StylesProviderColdwellBanker' | 'StylesProviderCorcoran' | 'StylesProviderDenaliBoss' | 'StylesProviderEra' | 'StylesProviderSothebys' | 'Switch' | 'SwitchGroup' | 'SwitchOption' | 'TabGroup' | 'Table' | 'Tag' | 'Textarea' | 'TextareaField' | 'TextField' | 'TextInput' | 'TimePicker' | 'ToggleOption' | 'Tooltip' | 'TopNavigation' | 'Txt';
|