@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,57 @@
|
|
|
1
|
+
import { Dropdown, DropdownProps } from './Dropdown';
|
|
2
|
+
import { FormField, FormFieldProps } from './FormField';
|
|
3
|
+
|
|
4
|
+
export type DropdownFieldProps = Pick<
|
|
5
|
+
DropdownProps,
|
|
6
|
+
| 'disabled'
|
|
7
|
+
| 'itemCount'
|
|
8
|
+
| 'name'
|
|
9
|
+
| 'onChange'
|
|
10
|
+
| 'options'
|
|
11
|
+
| 'placeholder'
|
|
12
|
+
| 'placement'
|
|
13
|
+
| 'readOnly'
|
|
14
|
+
| 'size'
|
|
15
|
+
| 'value'
|
|
16
|
+
> &
|
|
17
|
+
Pick<FormFieldProps, 'controlId' | 'errorMessage' | 'helperText' | 'label' | 'labelTrailing' | 'required'>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A component that allows users to input large amounts of text that could span multiple lines.
|
|
21
|
+
*
|
|
22
|
+
* This component takes properties from the FormField and Dropdown components.
|
|
23
|
+
*
|
|
24
|
+
* @name DropdownField
|
|
25
|
+
*/
|
|
26
|
+
function DropdownField({
|
|
27
|
+
label,
|
|
28
|
+
errorMessage: errorMessageProp,
|
|
29
|
+
helperText,
|
|
30
|
+
controlId: id,
|
|
31
|
+
labelTrailing,
|
|
32
|
+
required,
|
|
33
|
+
...dropdownProps
|
|
34
|
+
}: DropdownFieldProps) {
|
|
35
|
+
const errorMessage = (!dropdownProps.readOnly && !dropdownProps.disabled && errorMessageProp) || undefined;
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<FormField
|
|
39
|
+
controlId={id}
|
|
40
|
+
errorMessage={errorMessage}
|
|
41
|
+
helperText={helperText}
|
|
42
|
+
label={label}
|
|
43
|
+
labelTrailing={labelTrailing}
|
|
44
|
+
required={required}
|
|
45
|
+
>
|
|
46
|
+
{(fieldProps) => (
|
|
47
|
+
<Dropdown {...dropdownProps} {...fieldProps} aria-label={label} id={id} invalid={!!errorMessage} />
|
|
48
|
+
)}
|
|
49
|
+
</FormField>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
DropdownField.bspkName = 'DropdownField';
|
|
54
|
+
|
|
55
|
+
export { DropdownField };
|
|
56
|
+
|
|
57
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Button } from './Button';
|
|
4
|
+
import { Layout } from './Layout';
|
|
5
|
+
import { Txt } from './Txt';
|
|
6
|
+
|
|
7
|
+
import { CallToActionButton } from './';
|
|
8
|
+
|
|
9
|
+
export type EmptyStateProps = {
|
|
10
|
+
/** The image or icon to display in the empty state. */
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* The header of the empty state.
|
|
14
|
+
*
|
|
15
|
+
* @required
|
|
16
|
+
*/
|
|
17
|
+
header: string;
|
|
18
|
+
/**
|
|
19
|
+
* The body of the empty state.
|
|
20
|
+
*
|
|
21
|
+
* @required
|
|
22
|
+
*/
|
|
23
|
+
body: string;
|
|
24
|
+
/**
|
|
25
|
+
* This property may be undefined or an object containing required CallToActionButton properties.
|
|
26
|
+
*
|
|
27
|
+
* @type CallToActionButton
|
|
28
|
+
*/
|
|
29
|
+
callToAction?: CallToActionButton;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A design pattern component that indicates to users that system has no content to display.
|
|
34
|
+
*
|
|
35
|
+
* @name EmptyState
|
|
36
|
+
*/
|
|
37
|
+
function EmptyState({ children, header, body, callToAction }: EmptyStateProps) {
|
|
38
|
+
return (
|
|
39
|
+
<Layout
|
|
40
|
+
align="center"
|
|
41
|
+
column
|
|
42
|
+
data-empty-state
|
|
43
|
+
style={{
|
|
44
|
+
margin: 'var(--spacing-sizing-04)',
|
|
45
|
+
maxWidth: '500px',
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
{children}
|
|
49
|
+
<Layout align="center" column gap="4">
|
|
50
|
+
<Txt as="div" variant="heading-h5">
|
|
51
|
+
{header}
|
|
52
|
+
</Txt>
|
|
53
|
+
<Txt as="div" variant="body-base">
|
|
54
|
+
{body}
|
|
55
|
+
</Txt>
|
|
56
|
+
</Layout>
|
|
57
|
+
{callToAction && (
|
|
58
|
+
<Button
|
|
59
|
+
label={callToAction.label}
|
|
60
|
+
onClick={callToAction.onClick}
|
|
61
|
+
size={callToAction.size || 'medium'}
|
|
62
|
+
variant="primary"
|
|
63
|
+
/>
|
|
64
|
+
)}
|
|
65
|
+
</Layout>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
EmptyState.bspkName = 'EmptyState';
|
|
70
|
+
|
|
71
|
+
export { EmptyState };
|
|
72
|
+
|
|
73
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
package/src/Fab.tsx
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import { ElementType } from 'react';
|
|
3
|
+
|
|
4
|
+
import { ButtonProps } from './Button';
|
|
5
|
+
import { Tooltip } from './Tooltip';
|
|
6
|
+
import { isValidIcon } from './utils/children';
|
|
7
|
+
import { useErrorLogger } from './utils/errors';
|
|
8
|
+
|
|
9
|
+
import { ElementProps } from './';
|
|
10
|
+
|
|
11
|
+
export type FabVariant = 'neutral' | 'primary' | 'secondary';
|
|
12
|
+
|
|
13
|
+
export type FabProps<As extends ElementType = 'button'> = Pick<
|
|
14
|
+
ButtonProps<As>,
|
|
15
|
+
'as' | 'icon' | 'onClick' | 'showLabel' | 'toolTip'
|
|
16
|
+
> &
|
|
17
|
+
Required<Pick<ButtonProps<As>, 'label'>> & {
|
|
18
|
+
/**
|
|
19
|
+
* The size of the button.
|
|
20
|
+
*
|
|
21
|
+
* @default small
|
|
22
|
+
*/
|
|
23
|
+
size?: 'medium' | 'small';
|
|
24
|
+
/**
|
|
25
|
+
* The style variant of the button.
|
|
26
|
+
*
|
|
27
|
+
* @default primary
|
|
28
|
+
*/
|
|
29
|
+
variant?: FabVariant;
|
|
30
|
+
/**
|
|
31
|
+
* The placement of the button on the container.
|
|
32
|
+
*
|
|
33
|
+
* @default bottom-right
|
|
34
|
+
*/
|
|
35
|
+
placement?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
|
|
36
|
+
/**
|
|
37
|
+
* The container to render the button in.
|
|
38
|
+
*
|
|
39
|
+
* @default local
|
|
40
|
+
*/
|
|
41
|
+
container?: 'local' | 'page';
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A button that highlights a primary action that is elevated above the body content of a page; normally fixed to the
|
|
46
|
+
* bottom right of a screen.
|
|
47
|
+
*
|
|
48
|
+
* @name Fab
|
|
49
|
+
*/
|
|
50
|
+
function Fab<As extends ElementType = 'button'>({
|
|
51
|
+
size = 'small',
|
|
52
|
+
variant = 'primary',
|
|
53
|
+
showLabel: showLabelProp = true,
|
|
54
|
+
as,
|
|
55
|
+
placement = 'bottom-right',
|
|
56
|
+
container = 'local',
|
|
57
|
+
label,
|
|
58
|
+
icon,
|
|
59
|
+
toolTip,
|
|
60
|
+
...otherProps
|
|
61
|
+
}: ElementProps<FabProps<As>, As>) {
|
|
62
|
+
// ignore showLabel=false if there is no icon
|
|
63
|
+
const hideLabel = showLabelProp === false && icon;
|
|
64
|
+
|
|
65
|
+
const { logError } = useErrorLogger();
|
|
66
|
+
logError(!!icon && !isValidIcon(icon), 'Button - The icon prop must be a valid icon element.');
|
|
67
|
+
|
|
68
|
+
const As: ElementType = as || 'button';
|
|
69
|
+
|
|
70
|
+
const button = (
|
|
71
|
+
<As
|
|
72
|
+
{...otherProps}
|
|
73
|
+
aria-label={label}
|
|
74
|
+
css={style}
|
|
75
|
+
data-container={container}
|
|
76
|
+
data-fab
|
|
77
|
+
data-placement={placement}
|
|
78
|
+
data-round={hideLabel || undefined}
|
|
79
|
+
data-size={size}
|
|
80
|
+
data-variant={variant}
|
|
81
|
+
>
|
|
82
|
+
{!!icon && <span data-fab-icon>{icon}</span>}
|
|
83
|
+
{!hideLabel && <span data-fab-label>{label}</span>}
|
|
84
|
+
</As>
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
return toolTip || hideLabel ? (
|
|
88
|
+
<Tooltip label={toolTip || label} placement="top">
|
|
89
|
+
{button}
|
|
90
|
+
</Tooltip>
|
|
91
|
+
) : (
|
|
92
|
+
button
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
Fab.bspkName = 'Fab';
|
|
97
|
+
|
|
98
|
+
export { Fab };
|
|
99
|
+
|
|
100
|
+
export const style = css`
|
|
101
|
+
--placement-offset: var(--spacing-sizing-04);
|
|
102
|
+
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: row;
|
|
105
|
+
align-items: center;
|
|
106
|
+
justify-content: center;
|
|
107
|
+
gap: var(--spacing-sizing-02);
|
|
108
|
+
border: none;
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
box-sizing: border-box;
|
|
111
|
+
background: transparent;
|
|
112
|
+
text-decoration: none;
|
|
113
|
+
z-index: var(--z-index-fab);
|
|
114
|
+
box-shadow: var(--drop-shadow-float);
|
|
115
|
+
border-radius: var(--radius-small);
|
|
116
|
+
|
|
117
|
+
&[data-container='page'] {
|
|
118
|
+
position: fixed;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&[data-container='local'] {
|
|
122
|
+
position: absolute;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&[data-placement='top-right'] {
|
|
126
|
+
top: var(--placement-offset);
|
|
127
|
+
right: var(--placement-offset);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&[data-placement='bottom-right'] {
|
|
131
|
+
bottom: var(--placement-offset);
|
|
132
|
+
right: var(--placement-offset);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&[data-placement='top-left'] {
|
|
136
|
+
top: var(--placement-offset);
|
|
137
|
+
left: var(--placement-offset);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&[data-placement='bottom-left'] {
|
|
141
|
+
bottom: var(--placement-offset);
|
|
142
|
+
left: var(--placement-offset);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
> [data-fab-icon] {
|
|
146
|
+
display: flex;
|
|
147
|
+
flex-direction: column;
|
|
148
|
+
align-items: center;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
> [data-fab-label] {
|
|
152
|
+
display: flex;
|
|
153
|
+
flex-direction: row;
|
|
154
|
+
align-items: center;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&[data-size='small'] {
|
|
158
|
+
font: var(--labels-base);
|
|
159
|
+
height: var(--spacing-sizing-10);
|
|
160
|
+
padding: 0 var(--spacing-sizing-04);
|
|
161
|
+
|
|
162
|
+
> [data-fab-icon] {
|
|
163
|
+
width: var(--spacing-sizing-05);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&[data-size='medium'] {
|
|
168
|
+
font: var(--labels-large);
|
|
169
|
+
height: var(--spacing-sizing-14);
|
|
170
|
+
padding: 0 var(--spacing-sizing-07);
|
|
171
|
+
|
|
172
|
+
> [data-fab-icon] {
|
|
173
|
+
width: var(--spacing-sizing-06);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&[data-variant='primary'] {
|
|
178
|
+
--variant-background: var(--surface-brand-primary);
|
|
179
|
+
--variant-foreground: var(--foreground-brand-on-primary);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&[data-variant='secondary'] {
|
|
183
|
+
--variant-background: var(--surface-brand-secondary);
|
|
184
|
+
--variant-foreground: var(--foreground-brand-on-secondary);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
&[data-variant='neutral'] {
|
|
188
|
+
--variant-background: var(--surface-neutral-t1-base);
|
|
189
|
+
--variant-foreground: var(--foreground-neutral-on-surface-variant-01);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
background: var(--variant-background);
|
|
193
|
+
color: var(--variant-foreground);
|
|
194
|
+
--variant-gradient: linear-gradient(var(--variant-background), var(--variant-background));
|
|
195
|
+
|
|
196
|
+
[data-pseudo='hover'] > &,
|
|
197
|
+
&:hover {
|
|
198
|
+
background:
|
|
199
|
+
linear-gradient(var(--interactions-brand-hover-opacity), var(--interactions-brand-hover-opacity)),
|
|
200
|
+
var(--variant-gradient);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
[data-pseudo='active'] > &,
|
|
204
|
+
&:active {
|
|
205
|
+
background:
|
|
206
|
+
linear-gradient(var(--interactions-brand-press-opacity), var(--interactions-brand-press-opacity)),
|
|
207
|
+
var(--variant-gradient);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
[data-pseudo='focus'] > &,
|
|
211
|
+
&:focus-visible {
|
|
212
|
+
outline: solid 2px var(--stroke-neutral-focus);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
&[data-round] {
|
|
216
|
+
border-radius: var(--radius-circular);
|
|
217
|
+
aspect-ratio: 1/1;
|
|
218
|
+
padding: 0;
|
|
219
|
+
}
|
|
220
|
+
`;
|
|
221
|
+
|
|
222
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
|
|
3
|
+
export type FileUploadProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The content of the fileupload.
|
|
6
|
+
*
|
|
7
|
+
* @required
|
|
8
|
+
*/
|
|
9
|
+
children: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Component description coming soon.
|
|
14
|
+
*
|
|
15
|
+
* @name FileUpload
|
|
16
|
+
*/
|
|
17
|
+
function FileUpload({ children }: FileUploadProps) {
|
|
18
|
+
return (
|
|
19
|
+
<div css={style} data-file-upload>
|
|
20
|
+
{children}
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
FileUpload.bspkName = 'FileUpload';
|
|
26
|
+
|
|
27
|
+
export { FileUpload };
|
|
28
|
+
|
|
29
|
+
export const style = css`
|
|
30
|
+
display: flex;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
|
|
3
|
+
import { InlineAlert } from './InlineAlert';
|
|
4
|
+
import { Layout } from './Layout';
|
|
5
|
+
import { Txt } from './Txt';
|
|
6
|
+
|
|
7
|
+
import { CommonProps } from './';
|
|
8
|
+
|
|
9
|
+
export type FieldControlProps = {
|
|
10
|
+
/**
|
|
11
|
+
* Marks the element as invalid and displays error message.
|
|
12
|
+
*
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
invalid?: boolean;
|
|
16
|
+
/** The id of the control description. */
|
|
17
|
+
'aria-describedby'?: string;
|
|
18
|
+
/** The id of the error message */
|
|
19
|
+
'aria-errormessage'?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type FormFieldProps = CommonProps<'errorMessage' | 'required'> & {
|
|
23
|
+
/**
|
|
24
|
+
* The label of the field.
|
|
25
|
+
*
|
|
26
|
+
* @required
|
|
27
|
+
*/
|
|
28
|
+
label: string;
|
|
29
|
+
/** The id of the control. */
|
|
30
|
+
controlId: string;
|
|
31
|
+
/**
|
|
32
|
+
* The children of the form field. This should be a control such as TextInput, Dropdown, DatePicker, or TimePicker.
|
|
33
|
+
*
|
|
34
|
+
* @type (childProps: FieldControlProps) => JSX.Element
|
|
35
|
+
* @required
|
|
36
|
+
*/
|
|
37
|
+
children: (childProps: FieldControlProps) => JSX.Element;
|
|
38
|
+
/** The helperText of the field. */
|
|
39
|
+
helperText?: string;
|
|
40
|
+
/** The trailing element of the label. */
|
|
41
|
+
labelTrailing?: React.ReactNode;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Wrapper component for form controls.
|
|
46
|
+
*
|
|
47
|
+
* Children may be one of the following: TextInput, Dropdown, DatePicker, or TimePicker.
|
|
48
|
+
*
|
|
49
|
+
* @name FormField
|
|
50
|
+
*/
|
|
51
|
+
function FormField({ label, errorMessage, helperText, children, labelTrailing, controlId, required }: FormFieldProps) {
|
|
52
|
+
const errorMessageId = errorMessage && `${controlId}-error-message`;
|
|
53
|
+
const helperTextId = helperText && `${controlId}-helper-text`;
|
|
54
|
+
|
|
55
|
+
if (typeof children !== 'function') return null;
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div css={style} data-form-field>
|
|
59
|
+
<Layout as="header">
|
|
60
|
+
<label htmlFor={controlId}>
|
|
61
|
+
<Txt as="span" variant="labels-small">
|
|
62
|
+
{label}
|
|
63
|
+
</Txt>
|
|
64
|
+
{required && (
|
|
65
|
+
<Txt as="span" variant="body-small">
|
|
66
|
+
{' (Required)'}
|
|
67
|
+
</Txt>
|
|
68
|
+
)}
|
|
69
|
+
</label>
|
|
70
|
+
{labelTrailing}
|
|
71
|
+
</Layout>
|
|
72
|
+
{children({
|
|
73
|
+
invalid: !!errorMessage,
|
|
74
|
+
'aria-describedby': helperTextId,
|
|
75
|
+
'aria-errormessage': errorMessageId,
|
|
76
|
+
})}
|
|
77
|
+
{errorMessage && (
|
|
78
|
+
<InlineAlert id={errorMessageId} variant="error">
|
|
79
|
+
{errorMessage}
|
|
80
|
+
</InlineAlert>
|
|
81
|
+
)}
|
|
82
|
+
{helperText && (
|
|
83
|
+
<Txt id={helperTextId} variant="body-small">
|
|
84
|
+
{helperText}
|
|
85
|
+
</Txt>
|
|
86
|
+
)}
|
|
87
|
+
</div>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
FormField.bspkName = 'FormField';
|
|
92
|
+
|
|
93
|
+
export { FormField };
|
|
94
|
+
|
|
95
|
+
export const style = css`
|
|
96
|
+
box-sizing: border-box;
|
|
97
|
+
width: 100%;
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
gap: var(--spacing-sizing-01);
|
|
101
|
+
|
|
102
|
+
header label {
|
|
103
|
+
flex-grow: 1;
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
|
|
107
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
package/src/Image.tsx
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
|
|
3
|
+
export type ImageProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The content of the image.
|
|
6
|
+
*
|
|
7
|
+
* @required
|
|
8
|
+
*/
|
|
9
|
+
children: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Component description coming soon.
|
|
14
|
+
*
|
|
15
|
+
* @name Image
|
|
16
|
+
*/
|
|
17
|
+
function Image({ children }: ImageProps) {
|
|
18
|
+
return (
|
|
19
|
+
<div css={style} data-image>
|
|
20
|
+
{children}
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Image.bspkName = 'Image';
|
|
26
|
+
|
|
27
|
+
export { Image };
|
|
28
|
+
|
|
29
|
+
export const style = css`
|
|
30
|
+
display: flex;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
package/src/Img.tsx
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
|
|
3
|
+
import { ElementProps } from './';
|
|
4
|
+
|
|
5
|
+
const style = {
|
|
6
|
+
container: css`
|
|
7
|
+
display: block;
|
|
8
|
+
`,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type ImgProps = {
|
|
12
|
+
/**
|
|
13
|
+
* The URL of the image.
|
|
14
|
+
*
|
|
15
|
+
* @required
|
|
16
|
+
*/
|
|
17
|
+
src: string;
|
|
18
|
+
/**
|
|
19
|
+
* The alternative text for the image.
|
|
20
|
+
*
|
|
21
|
+
* @required
|
|
22
|
+
*/
|
|
23
|
+
alt: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The Img component is used to display images on the page.
|
|
28
|
+
*
|
|
29
|
+
* @name Img
|
|
30
|
+
*/
|
|
31
|
+
function Img({ alt, ...props }: ElementProps<ImgProps, 'img'>) {
|
|
32
|
+
return <img {...props} alt={alt} css={style.container} data-img />;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Img.bspkName = 'Img';
|
|
36
|
+
|
|
37
|
+
export { Img };
|
|
38
|
+
|
|
39
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { SvgCheckCircleFill } from '@bspk/icons/CheckCircleFill';
|
|
2
|
+
import { SvgErrorFill } from '@bspk/icons/ErrorFill';
|
|
3
|
+
import { SvgInfoFill } from '@bspk/icons/InfoFill';
|
|
4
|
+
import { css } from '@emotion/react';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Txt } from './Txt';
|
|
8
|
+
|
|
9
|
+
import { AlertVariant } from './';
|
|
10
|
+
|
|
11
|
+
export type InlineAlertProps = {
|
|
12
|
+
/**
|
|
13
|
+
* The content of the inline alert.
|
|
14
|
+
*
|
|
15
|
+
* @type multiline
|
|
16
|
+
* @required
|
|
17
|
+
*/
|
|
18
|
+
children: string;
|
|
19
|
+
/**
|
|
20
|
+
* The color variant of the inline alert.
|
|
21
|
+
*
|
|
22
|
+
* @default informational
|
|
23
|
+
*/
|
|
24
|
+
variant?: AlertVariant;
|
|
25
|
+
/** The id of the inline alert. */
|
|
26
|
+
id?: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Inline alerts provide contextual feedback messages for typical user actions with a handful of available and flexible
|
|
31
|
+
* alert messages.
|
|
32
|
+
*
|
|
33
|
+
* @name InlineAlert
|
|
34
|
+
*/
|
|
35
|
+
function InlineAlert({ children, variant = 'informational', id }: InlineAlertProps) {
|
|
36
|
+
return (
|
|
37
|
+
<div css={style} data-inline-alert={id} data-variant={variant}>
|
|
38
|
+
{VARIANT_ICON[variant]}
|
|
39
|
+
<Txt variant="body-small">{children}</Txt>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
InlineAlert.bspkName = 'InlineAlert';
|
|
45
|
+
|
|
46
|
+
export { InlineAlert };
|
|
47
|
+
|
|
48
|
+
export const style = css`
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: start;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
flex-direction: row;
|
|
53
|
+
gap: var(--spacing-sizing-02);
|
|
54
|
+
|
|
55
|
+
[data-txt] {
|
|
56
|
+
flex: 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&[data-variant='error'] {
|
|
60
|
+
color: var(--status-error);
|
|
61
|
+
--first-tone: var(--status-error);
|
|
62
|
+
--second-tone: var(--status-on-information);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&[data-variant='success'] {
|
|
66
|
+
color: var(--status-success);
|
|
67
|
+
--first-tone: var(--status-success);
|
|
68
|
+
--second-tone: var(--status-on-success);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&[data-variant='warning'] {
|
|
72
|
+
color: var(--foreground-neutral-on-surface);
|
|
73
|
+
--first-tone: var(--status-warning);
|
|
74
|
+
--second-tone: var(--status-on-warning);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&[data-variant='informational'] {
|
|
78
|
+
color: var(--status-information);
|
|
79
|
+
--first-tone: var(--status-information);
|
|
80
|
+
--second-tone: var(--status-on-information);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
svg {
|
|
84
|
+
color: var(--first-tone);
|
|
85
|
+
width: var(--spacing-sizing-05);
|
|
86
|
+
height: var(--spacing-sizing-05);
|
|
87
|
+
|
|
88
|
+
[data-second-tone] {
|
|
89
|
+
fill: var(--second-tone);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
|
|
94
|
+
// eslint-disable-next-line react/no-multi-comp
|
|
95
|
+
const SvgWarningTwoTone = () => (
|
|
96
|
+
<svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
97
|
+
<path
|
|
98
|
+
d="M2.72503 21C2.5417 21 2.37503 20.9542 2.22503 20.8625C2.07503 20.7708 1.95837 20.65 1.87503 20.5C1.7917 20.35 1.74587 20.1875 1.73753 20.0125C1.7292 19.8375 1.77503 19.6667 1.87503 19.5L11.125 3.5C11.225 3.33333 11.3542 3.20833 11.5125 3.125C11.6709 3.04167 11.8334 3 12 3C12.1667 3 12.3292 3.04167 12.4875 3.125C12.6459 3.20833 12.775 3.33333 12.875 3.5L22.125 19.5C22.225 19.6667 22.2709 19.8375 22.2625 20.0125C22.2542 20.1875 22.2084 20.35 22.125 20.5C22.0417 20.65 21.925 20.7708 21.775 20.8625C21.625 20.9542 21.4584 21 21.275 21H2.72503ZM12 18C12.2834 18 12.5209 17.9042 12.7125 17.7125C12.9042 17.5208 13 17.2833 13 17C13 16.7167 12.9042 16.4792 12.7125 16.2875C12.5209 16.0958 12.2834 16 12 16C11.7167 16 11.4792 16.0958 11.2875 16.2875C11.0959 16.4792 11 16.7167 11 17C11 17.2833 11.0959 17.5208 11.2875 17.7125C11.4792 17.9042 11.7167 18 12 18ZM12 15C12.2834 15 12.5209 14.9042 12.7125 14.7125C12.9042 14.5208 13 14.2833 13 14V11C13 10.7167 12.9042 10.4792 12.7125 10.2875C12.5209 10.0958 12.2834 10 12 10C11.7167 10 11.4792 10.0958 11.2875 10.2875C11.0959 10.4792 11 10.7167 11 11V14C11 14.2833 11.0959 14.5208 11.2875 14.7125C11.4792 14.9042 11.7167 15 12 15Z"
|
|
99
|
+
fill="currentColor"
|
|
100
|
+
/>
|
|
101
|
+
<path
|
|
102
|
+
d="M12.7125 17.7125C12.5208 17.9042 12.2833 18 12 18C11.7167 18 11.4792 17.9042 11.2875 17.7125C11.0958 17.5208 11 17.2833 11 17C11 16.7167 11.0958 16.4792 11.2875 16.2875C11.4792 16.0958 11.7167 16 12 16C12.2833 16 12.5208 16.0958 12.7125 16.2875C12.9042 16.4792 13 16.7167 13 17C13 17.2833 12.9042 17.5208 12.7125 17.7125Z"
|
|
103
|
+
data-second-tone
|
|
104
|
+
/>
|
|
105
|
+
<path
|
|
106
|
+
d="M12.7125 14.7125C12.5208 14.9042 12.2833 15 12 15C11.7167 15 11.4792 14.9042 11.2875 14.7125C11.0958 14.5208 11 14.2833 11 14V11C11 10.7167 11.0958 10.4792 11.2875 10.2875C11.4792 10.0958 11.7167 10 12 10C12.2833 10 12.5208 10.0958 12.7125 10.2875C12.9042 10.4792 13 10.7167 13 11V14C13 14.2833 12.9042 14.5208 12.7125 14.7125Z"
|
|
107
|
+
data-second-tone
|
|
108
|
+
/>
|
|
109
|
+
</svg>
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const VARIANT_ICON: Record<AlertVariant, ReactNode> = {
|
|
113
|
+
error: <SvgErrorFill />,
|
|
114
|
+
informational: <SvgInfoFill />,
|
|
115
|
+
success: <SvgCheckCircleFill />,
|
|
116
|
+
warning: <SvgWarningTwoTone />,
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|