@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,282 @@
|
|
|
1
|
+
import { SvgAdd } from '@bspk/icons/Add';
|
|
2
|
+
import { SvgRemove } from '@bspk/icons/Remove';
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
|
|
5
|
+
import { useId } from './hooks/useId';
|
|
6
|
+
import { useLongPress } from './hooks/useLongPress';
|
|
7
|
+
|
|
8
|
+
import { CommonProps } from '.';
|
|
9
|
+
|
|
10
|
+
function isNumber(value: unknown): number | undefined {
|
|
11
|
+
if (typeof value === 'number') return value;
|
|
12
|
+
if (typeof value !== 'string') return undefined;
|
|
13
|
+
const num = Number(value);
|
|
14
|
+
return isNaN(num) ? undefined : num;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type NumberInputProps = CommonProps<
|
|
18
|
+
'aria-label' | 'disabled' | 'id' | 'invalid' | 'name' | 'readOnly' | 'size'
|
|
19
|
+
> & {
|
|
20
|
+
/**
|
|
21
|
+
* The value of the control.
|
|
22
|
+
*
|
|
23
|
+
* @required
|
|
24
|
+
*/
|
|
25
|
+
value?: number;
|
|
26
|
+
/** Callback when the value changes. */
|
|
27
|
+
onChange: (value: number) => void;
|
|
28
|
+
/**
|
|
29
|
+
* If the value should be centered between the up & down buttons.
|
|
30
|
+
*
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
centered?: boolean;
|
|
34
|
+
/** Defines the [maximum](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/max) value that is accepted. */
|
|
35
|
+
max?: number;
|
|
36
|
+
/** Defines the [minimum](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/min) value that is accepted. */
|
|
37
|
+
min?: number;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A input element that allows users to either input a numerical value or singularly increase or decrease the values by
|
|
42
|
+
* pressing the (+) or (-).
|
|
43
|
+
*
|
|
44
|
+
* @name NumberInput
|
|
45
|
+
*/
|
|
46
|
+
function NumberInput({
|
|
47
|
+
//
|
|
48
|
+
value = 1,
|
|
49
|
+
onChange,
|
|
50
|
+
centered = false,
|
|
51
|
+
size = 'medium',
|
|
52
|
+
disabled = false,
|
|
53
|
+
readOnly = false,
|
|
54
|
+
name,
|
|
55
|
+
id: inputIdProp,
|
|
56
|
+
invalid,
|
|
57
|
+
'aria-label': ariaLabel,
|
|
58
|
+
max: maxProp,
|
|
59
|
+
min: minProp,
|
|
60
|
+
}: NumberInputProps) {
|
|
61
|
+
const inputId = useId(inputIdProp);
|
|
62
|
+
const max = isNumber(maxProp);
|
|
63
|
+
const min = isNumber(minProp);
|
|
64
|
+
|
|
65
|
+
const fix = (next: number = value) => {
|
|
66
|
+
let fixValue = next;
|
|
67
|
+
if (typeof min !== 'undefined' && next < min) fixValue = min;
|
|
68
|
+
if (typeof max !== 'undefined' && next > max) fixValue = max;
|
|
69
|
+
if (fixValue !== value) onChange(fixValue);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const buttonProps = {
|
|
73
|
+
min,
|
|
74
|
+
max,
|
|
75
|
+
disabled,
|
|
76
|
+
readOnly,
|
|
77
|
+
onChange: fix,
|
|
78
|
+
value,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<div
|
|
83
|
+
aria-valuemax={max || undefined}
|
|
84
|
+
aria-valuemin={min || undefined}
|
|
85
|
+
css={style}
|
|
86
|
+
data-centered={centered || undefined}
|
|
87
|
+
data-disabled={disabled || undefined}
|
|
88
|
+
data-invalid={invalid || undefined}
|
|
89
|
+
data-readonly={readOnly || undefined}
|
|
90
|
+
data-size={size}
|
|
91
|
+
data-stepper-input
|
|
92
|
+
>
|
|
93
|
+
{!!centered && <IncrementButton {...buttonProps} increment={-1} />}
|
|
94
|
+
<input
|
|
95
|
+
aria-label={ariaLabel}
|
|
96
|
+
disabled={disabled}
|
|
97
|
+
id={inputId}
|
|
98
|
+
name={name}
|
|
99
|
+
onBlur={() => {
|
|
100
|
+
fix();
|
|
101
|
+
}}
|
|
102
|
+
onChange={(event) => {
|
|
103
|
+
onChange(event.target.value as unknown as number);
|
|
104
|
+
}}
|
|
105
|
+
readOnly={readOnly}
|
|
106
|
+
type="number"
|
|
107
|
+
value={value}
|
|
108
|
+
/>
|
|
109
|
+
{!centered && (
|
|
110
|
+
<>
|
|
111
|
+
<div aria-hidden data-divider />
|
|
112
|
+
<IncrementButton {...buttonProps} increment={-1} />
|
|
113
|
+
</>
|
|
114
|
+
)}
|
|
115
|
+
<IncrementButton {...buttonProps} increment={1} />
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// eslint-disable-next-line react/no-multi-comp
|
|
121
|
+
function IncrementButton({
|
|
122
|
+
increment,
|
|
123
|
+
min,
|
|
124
|
+
max,
|
|
125
|
+
readOnly,
|
|
126
|
+
disabled,
|
|
127
|
+
onChange,
|
|
128
|
+
value,
|
|
129
|
+
}: Pick<NumberInputProps, 'disabled' | 'max' | 'min' | 'onChange' | 'readOnly' | 'value'> & { increment: -1 | 1 }) {
|
|
130
|
+
const add = increment === 1;
|
|
131
|
+
const prevValue = isNumber(value) || 0;
|
|
132
|
+
|
|
133
|
+
const isDisabled =
|
|
134
|
+
readOnly ||
|
|
135
|
+
disabled ||
|
|
136
|
+
(typeof min !== 'undefined' && prevValue + increment < min) ||
|
|
137
|
+
(typeof max !== 'undefined' && prevValue + increment > max);
|
|
138
|
+
|
|
139
|
+
const longPress = useLongPress((pressCounter) => onChange(prevValue + increment * pressCounter), 2000, isDisabled);
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<button
|
|
143
|
+
aria-label={`${add ? 'Increase' : 'Decrease'} value`}
|
|
144
|
+
data-increment={increment}
|
|
145
|
+
disabled={isDisabled}
|
|
146
|
+
type="button"
|
|
147
|
+
{...longPress.buttonProps}
|
|
148
|
+
>
|
|
149
|
+
{add ? <SvgAdd /> : <SvgRemove />}
|
|
150
|
+
</button>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
NumberInput.bspkName = 'NumberInput';
|
|
155
|
+
|
|
156
|
+
export { NumberInput };
|
|
157
|
+
|
|
158
|
+
export const style = css`
|
|
159
|
+
// medium
|
|
160
|
+
--font: var(--body-base);
|
|
161
|
+
--height: var(--spacing-sizing-10);
|
|
162
|
+
--svg-width: var(--spacing-sizing-05);
|
|
163
|
+
--color: var(--foreground-neutral-on-surface);
|
|
164
|
+
width: 100%;
|
|
165
|
+
|
|
166
|
+
display: flex;
|
|
167
|
+
flex-flow: row nowrap;
|
|
168
|
+
font: var(--font);
|
|
169
|
+
height: var(--height);
|
|
170
|
+
border: 1px solid var(--stroke-neutral-base);
|
|
171
|
+
border-radius: var(--radius-small);
|
|
172
|
+
background: var(--surface-neutral-t1-base);
|
|
173
|
+
|
|
174
|
+
&:focus-within {
|
|
175
|
+
border-color: var(--stroke-brand-primary);
|
|
176
|
+
outline: 1px solid var(--stroke-brand-primary);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
[data-divider] {
|
|
180
|
+
width: 4px;
|
|
181
|
+
border-right: 1px solid var(--stroke-neutral-base);
|
|
182
|
+
// account for border - 3(margin) * 2 + 2(border)
|
|
183
|
+
height: calc(var(--height) - 8px);
|
|
184
|
+
margin: 3px 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
button {
|
|
188
|
+
min-width: var(--height);
|
|
189
|
+
background: none;
|
|
190
|
+
border: none;
|
|
191
|
+
cursor: pointer;
|
|
192
|
+
font: var(--font);
|
|
193
|
+
svg {
|
|
194
|
+
width: var(--svg-width);
|
|
195
|
+
}
|
|
196
|
+
display: flex;
|
|
197
|
+
justify-content: center;
|
|
198
|
+
align-items: center;
|
|
199
|
+
color: var(--color);
|
|
200
|
+
|
|
201
|
+
&:disabled {
|
|
202
|
+
cursor: not-allowed;
|
|
203
|
+
color: var(--foreground-neutral-disabled-on-surface);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
input {
|
|
208
|
+
color: var(--color);
|
|
209
|
+
min-width: 0;
|
|
210
|
+
display: block;
|
|
211
|
+
font: var(--font);
|
|
212
|
+
text-align: center;
|
|
213
|
+
padding: 0 var(--spacing-sizing-03);
|
|
214
|
+
background: transparent;
|
|
215
|
+
border: none;
|
|
216
|
+
|
|
217
|
+
&:focus {
|
|
218
|
+
outline: none;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
&::-webkit-outer-spin-button,
|
|
222
|
+
&::-webkit-inner-spin-button {
|
|
223
|
+
-webkit-appearance: none;
|
|
224
|
+
margin: 0;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
&[type='number'] {
|
|
228
|
+
appearance: textfield;
|
|
229
|
+
-moz-appearance: textfield;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
&:not([data-disabled], [data-readonly]) {
|
|
234
|
+
input,
|
|
235
|
+
button:not(:disabled) {
|
|
236
|
+
&:hover {
|
|
237
|
+
background-color: var(--interactions-hover-opacity);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
&:active {
|
|
241
|
+
background-color: var(--interactions-press-opacity);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
&[data-invalid] {
|
|
246
|
+
border-color: var(--status-error);
|
|
247
|
+
outline-color: var(--status-error);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
&[data-disabled],
|
|
252
|
+
&[data-readonly] {
|
|
253
|
+
--color: var(--foreground-neutral-disabled-on-surface);
|
|
254
|
+
border-color: var(--stroke-neutral-disabled-light);
|
|
255
|
+
background:
|
|
256
|
+
linear-gradient(var(--interactions-disabled-opacity), var(--interactions-disabled-opacity)),
|
|
257
|
+
linear-gradient(var(--surface-neutral-t1-base), var(--surface-neutral-t1-base));
|
|
258
|
+
|
|
259
|
+
[data-divider] {
|
|
260
|
+
border-color: var(--stroke-neutral-disabled-light);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
&[data-readonly] {
|
|
265
|
+
input {
|
|
266
|
+
color: var(--foreground-neutral-on-surface) !important;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
&[data-size='small'] {
|
|
271
|
+
--font: var(--body-small);
|
|
272
|
+
--height: var(--spacing-sizing-08);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
&[data-size='large'] {
|
|
276
|
+
--font: var(--body-large);
|
|
277
|
+
--height: var(--spacing-sizing-12);
|
|
278
|
+
--svg-width: var(--spacing-sizing-06);
|
|
279
|
+
}
|
|
280
|
+
`;
|
|
281
|
+
|
|
282
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
package/src/OTPInput.tsx
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
|
|
3
|
+
export type OTPInputProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The content of the otp input.
|
|
6
|
+
*
|
|
7
|
+
* @required
|
|
8
|
+
*/
|
|
9
|
+
children: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Component description coming soon.
|
|
14
|
+
*
|
|
15
|
+
* @name OTPInput
|
|
16
|
+
*/
|
|
17
|
+
function OTPInput({ children }: OTPInputProps) {
|
|
18
|
+
return (
|
|
19
|
+
<div css={style} data-otp-input>
|
|
20
|
+
{children}
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
OTPInput.bspkName = 'OTPInput';
|
|
26
|
+
|
|
27
|
+
export { OTPInput };
|
|
28
|
+
|
|
29
|
+
export const style = css`
|
|
30
|
+
display: flex;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
|
|
3
|
+
export type PageControlProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The content of the page control.
|
|
6
|
+
*
|
|
7
|
+
* @required
|
|
8
|
+
*/
|
|
9
|
+
children: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Component description coming soon.
|
|
14
|
+
*
|
|
15
|
+
* @name PageControl
|
|
16
|
+
*/
|
|
17
|
+
function PageControl({ children }: PageControlProps) {
|
|
18
|
+
return (
|
|
19
|
+
<div css={style} data-page-control>
|
|
20
|
+
{children}
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
PageControl.bspkName = 'PageControl';
|
|
26
|
+
|
|
27
|
+
export { PageControl };
|
|
28
|
+
|
|
29
|
+
export const style = css`
|
|
30
|
+
display: flex;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
|
|
3
|
+
export type PasswordInputProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The content of the password input.
|
|
6
|
+
*
|
|
7
|
+
* @required
|
|
8
|
+
*/
|
|
9
|
+
children: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Component description coming soon.
|
|
14
|
+
*
|
|
15
|
+
* @name PasswordInput
|
|
16
|
+
*/
|
|
17
|
+
function PasswordInput({ children }: PasswordInputProps) {
|
|
18
|
+
return (
|
|
19
|
+
<div css={style} data-password-input>
|
|
20
|
+
{children}
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
PasswordInput.bspkName = 'PasswordInput';
|
|
26
|
+
|
|
27
|
+
export { PasswordInput };
|
|
28
|
+
|
|
29
|
+
export const style = css`
|
|
30
|
+
display: flex;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
|
|
3
|
+
export type PhoneNumberInputProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The content of the phone number input.
|
|
6
|
+
*
|
|
7
|
+
* @required
|
|
8
|
+
*/
|
|
9
|
+
children: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Component description coming soon.
|
|
14
|
+
*
|
|
15
|
+
* @name PhoneNumberInput
|
|
16
|
+
*/
|
|
17
|
+
function PhoneNumberInput({ children }: PhoneNumberInputProps) {
|
|
18
|
+
return (
|
|
19
|
+
<div css={style} data-phone-number-input>
|
|
20
|
+
{children}
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
PhoneNumberInput.bspkName = 'PhoneNumberInput';
|
|
26
|
+
|
|
27
|
+
export { PhoneNumberInput };
|
|
28
|
+
|
|
29
|
+
export const style = css`
|
|
30
|
+
display: flex;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
package/src/Popover.tsx
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { SvgClose } from '@bspk/icons/Close';
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
import { cloneElement, ReactElement, useId, useMemo, useRef, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import { Button } from './Button';
|
|
6
|
+
import { Portal } from './Portal';
|
|
7
|
+
import { Txt } from './Txt';
|
|
8
|
+
import { Placement, useFloating } from './hooks/useFloating';
|
|
9
|
+
import { useOutsideClick } from './hooks/useOutsideClick';
|
|
10
|
+
|
|
11
|
+
import { CallToActionButton, CommonProps } from './';
|
|
12
|
+
|
|
13
|
+
export type PopoverProps = CommonProps<'disabled'> & {
|
|
14
|
+
/**
|
|
15
|
+
* The placement of the popover.
|
|
16
|
+
*
|
|
17
|
+
* @default top
|
|
18
|
+
*/
|
|
19
|
+
placement?: Placement;
|
|
20
|
+
/** The popover header. */
|
|
21
|
+
header: string;
|
|
22
|
+
/**
|
|
23
|
+
* The content of the popover.
|
|
24
|
+
*
|
|
25
|
+
* @type multiline
|
|
26
|
+
*/
|
|
27
|
+
content: string;
|
|
28
|
+
/**
|
|
29
|
+
* The call to action button properties.
|
|
30
|
+
*
|
|
31
|
+
* @type CallToActionButton
|
|
32
|
+
*/
|
|
33
|
+
callToAction?: CallToActionButton;
|
|
34
|
+
/**
|
|
35
|
+
* A single element that will trigger the popover when clicked.
|
|
36
|
+
*
|
|
37
|
+
* @type ReactElement
|
|
38
|
+
* @required
|
|
39
|
+
*/
|
|
40
|
+
children: ReactElement;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Brief message that provide additional guidance and helps users perform an action if needed.
|
|
45
|
+
*
|
|
46
|
+
* @name Popover
|
|
47
|
+
*/
|
|
48
|
+
function Popover({ placement = 'top', header, content, callToAction, children, disabled = false }: PopoverProps) {
|
|
49
|
+
const id = useId();
|
|
50
|
+
const [show, setShow] = useState(false);
|
|
51
|
+
const arrowRef = useRef<HTMLElement | null>(null);
|
|
52
|
+
|
|
53
|
+
const { elements, floatingStyles, middlewareData } = useFloating({
|
|
54
|
+
placement: placement,
|
|
55
|
+
strategy: 'absolute',
|
|
56
|
+
offsetOptions: 22,
|
|
57
|
+
arrowRef,
|
|
58
|
+
hide: !show,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
useOutsideClick([elements.floating], () => setShow(false));
|
|
62
|
+
|
|
63
|
+
const child = useMemo(
|
|
64
|
+
() =>
|
|
65
|
+
!disabled &&
|
|
66
|
+
children &&
|
|
67
|
+
cloneElement(children, {
|
|
68
|
+
onClick: () => setShow((prev) => !prev),
|
|
69
|
+
'aria-describedby': id,
|
|
70
|
+
}),
|
|
71
|
+
[children, disabled, id],
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
return disabled ? (
|
|
75
|
+
children
|
|
76
|
+
) : (
|
|
77
|
+
<>
|
|
78
|
+
{child}
|
|
79
|
+
<Portal>
|
|
80
|
+
<div
|
|
81
|
+
css={style}
|
|
82
|
+
data-placement={middlewareData?.offset?.placement}
|
|
83
|
+
data-popover=""
|
|
84
|
+
id={id}
|
|
85
|
+
ref={(node) => {
|
|
86
|
+
elements.setFloating(node);
|
|
87
|
+
elements.setTrigger(document.querySelector<HTMLElement>(`[aria-describedby="${id}"]`));
|
|
88
|
+
}}
|
|
89
|
+
style={floatingStyles}
|
|
90
|
+
>
|
|
91
|
+
<header>
|
|
92
|
+
<Txt variant="heading-h6">{header}</Txt>
|
|
93
|
+
<button aria-label="Close" onClick={() => setShow(false)}>
|
|
94
|
+
<SvgClose />
|
|
95
|
+
</button>
|
|
96
|
+
</header>
|
|
97
|
+
<div data-content>
|
|
98
|
+
<Txt as="div" variant="body-small">
|
|
99
|
+
{content}
|
|
100
|
+
</Txt>
|
|
101
|
+
{callToAction?.label && callToAction?.onClick && (
|
|
102
|
+
<Button
|
|
103
|
+
data-call-to-action
|
|
104
|
+
label={callToAction.label}
|
|
105
|
+
onClick={callToAction.onClick}
|
|
106
|
+
size="small"
|
|
107
|
+
variant="secondary"
|
|
108
|
+
/>
|
|
109
|
+
)}
|
|
110
|
+
</div>
|
|
111
|
+
<div
|
|
112
|
+
data-arrow
|
|
113
|
+
ref={(node) => {
|
|
114
|
+
arrowRef.current = node;
|
|
115
|
+
}}
|
|
116
|
+
style={{
|
|
117
|
+
left: `${middlewareData?.arrow?.x}px`,
|
|
118
|
+
top: `${middlewareData?.arrow?.y}px`,
|
|
119
|
+
}}
|
|
120
|
+
/>
|
|
121
|
+
</div>
|
|
122
|
+
</Portal>
|
|
123
|
+
</>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
Popover.bspkName = 'Popover';
|
|
128
|
+
|
|
129
|
+
export { Popover };
|
|
130
|
+
|
|
131
|
+
export const style = css`
|
|
132
|
+
position: absolute;
|
|
133
|
+
z-index: var(--z-index-tooltip-popover);
|
|
134
|
+
background: var(--surface-neutral-t1-base);
|
|
135
|
+
box-shadow: var(--drop-shadow-float);
|
|
136
|
+
padding: var(--spacing-sizing-04);
|
|
137
|
+
width: 300px;
|
|
138
|
+
border-radius: var(--radius-large);
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
|
|
142
|
+
header {
|
|
143
|
+
display: flex;
|
|
144
|
+
justify-content: space-between;
|
|
145
|
+
align-items: center;
|
|
146
|
+
margin-bottom: var(--spacing-sizing-02);
|
|
147
|
+
gap: var(--spacing-sizing-04);
|
|
148
|
+
|
|
149
|
+
button {
|
|
150
|
+
background: none;
|
|
151
|
+
border: none;
|
|
152
|
+
cursor: pointer;
|
|
153
|
+
padding: 0;
|
|
154
|
+
margin: 0 0 0 auto;
|
|
155
|
+
color: var(--foreground-neutral-on-surface-variant-01);
|
|
156
|
+
height: var(--spacing-sizing-06);
|
|
157
|
+
width: var(--spacing-sizing-06);
|
|
158
|
+
|
|
159
|
+
svg {
|
|
160
|
+
width: var(--spacing-sizing-06);
|
|
161
|
+
height: var(--spacing-sizing-06);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
--arrow-size: var(--spacing-sizing-02);
|
|
167
|
+
--arrow-offset: calc(var(--arrow-size) * -2);
|
|
168
|
+
--arrow-background-color: var(--surface-neutral-t1-base);
|
|
169
|
+
|
|
170
|
+
[data-arrow] {
|
|
171
|
+
z-index: 1;
|
|
172
|
+
position: absolute;
|
|
173
|
+
width: 0;
|
|
174
|
+
height: 0;
|
|
175
|
+
border-style: solid;
|
|
176
|
+
border-width: var(--arrow-size) var(--arrow-size) var(--arrow-size) var(--arrow-size);
|
|
177
|
+
border-color: transparent transparent transparent transparent;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&[data-placement^='top'] {
|
|
181
|
+
[data-arrow] {
|
|
182
|
+
bottom: var(--arrow-offset);
|
|
183
|
+
border-top-color: var(--arrow-background-color);
|
|
184
|
+
filter: drop-shadow(0 2px 1px var(--shadow-10));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
&[data-placement^='right'] {
|
|
188
|
+
[data-arrow] {
|
|
189
|
+
margin-left: calc(var(--arrow-offset) * 2);
|
|
190
|
+
border-right-color: var(--arrow-background-color);
|
|
191
|
+
filter: drop-shadow(-2px 0 1px var(--shadow-10));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
&[data-placement^='bottom'] {
|
|
195
|
+
[data-arrow] {
|
|
196
|
+
top: var(--arrow-offset);
|
|
197
|
+
border-bottom-color: var(--arrow-background-color);
|
|
198
|
+
filter: drop-shadow(0 -2px 1px var(--shadow-10));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
&[data-placement='bottom-start'] {
|
|
202
|
+
[data-arrow] {
|
|
203
|
+
margin-left: var(--arrow-offset);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
&[data-placement='bottom-end'] {
|
|
207
|
+
[data-arrow] {
|
|
208
|
+
margin-left: calc(var(--arrow-offset) * -1);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
&[data-placement^='left'] {
|
|
212
|
+
[data-arrow] {
|
|
213
|
+
right: var(--arrow-offset);
|
|
214
|
+
border-left-color: var(--arrow-background-color);
|
|
215
|
+
filter: drop-shadow(2px 0 1px var(--shadow-10));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
[data-content] {
|
|
220
|
+
gap: var(--spacing-sizing-04);
|
|
221
|
+
display: flex;
|
|
222
|
+
flex-direction: column;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
[data-call-to-action] {
|
|
226
|
+
margin: 0 0 0 auto;
|
|
227
|
+
/* background: none;
|
|
228
|
+
border: none;
|
|
229
|
+
cursor: pointer;
|
|
230
|
+
padding: 0 var(--spacing-sizing-03);
|
|
231
|
+
height: var(--spacing-sizing-12);
|
|
232
|
+
font: var(--labels-small);
|
|
233
|
+
color: var(--foreground-brand-primary); */
|
|
234
|
+
}
|
|
235
|
+
`;
|
|
236
|
+
|
|
237
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
package/src/Portal.tsx
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ReactNode, useEffect, useState } from 'react';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
|
|
4
|
+
export type PortalProps = {
|
|
5
|
+
/**
|
|
6
|
+
* The content to render in the portal.
|
|
7
|
+
*
|
|
8
|
+
* @required
|
|
9
|
+
*/
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/** The container to render the portal in. */
|
|
12
|
+
container?: HTMLElement;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Utility component to render children in the portals container provided by the BaseProvider.
|
|
17
|
+
*
|
|
18
|
+
* Initial SRR is supported.
|
|
19
|
+
*
|
|
20
|
+
* @name Portal
|
|
21
|
+
*/
|
|
22
|
+
function Portal({ children, container }: PortalProps) {
|
|
23
|
+
const [portalContainer, setPortalContainer] = useState<HTMLElement | null>(container || null);
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!portalContainer && typeof window !== 'undefined') setPortalContainer(document.body);
|
|
27
|
+
}, [portalContainer]);
|
|
28
|
+
|
|
29
|
+
return portalContainer && createPortal(children, portalContainer);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
Portal.bspkName = 'Portal';
|
|
33
|
+
|
|
34
|
+
export { Portal };
|
|
35
|
+
|
|
36
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|