@bspk/ui 1.3.8 → 1.3.10
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/dist/components/Accordion/Accordion.d.ts +19 -3
- package/dist/components/Accordion/Accordion.js +20 -3
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Avatar/Avatar.d.ts +13 -14
- package/dist/components/Avatar/Avatar.js +13 -14
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +29 -12
- package/dist/components/AvatarGroup/AvatarGroup.js +29 -12
- package/dist/components/AvatarGroup/AvatarGroup.js.map +1 -1
- package/dist/components/Badge/Badge.d.ts +1 -3
- package/dist/components/Badge/Badge.js +1 -3
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/BadgeDot/BadgeDot.d.ts +4 -4
- package/dist/components/BadgeDot/BadgeDot.js +5 -4
- package/dist/components/BadgeDot/BadgeDot.js.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.d.ts +11 -12
- package/dist/components/BannerAlert/BannerAlert.js +11 -12
- package/dist/components/BannerAlert/BannerAlert.js.map +1 -1
- package/dist/components/BottomNavigation/BottomNavigation.d.ts +6 -3
- package/dist/components/BottomNavigation/BottomNavigation.js +6 -3
- package/dist/components/BottomNavigation/BottomNavigation.js.map +1 -1
- package/dist/components/BottomNavigation/BottomNavigationExample.js +31 -36
- package/dist/components/BottomNavigation/BottomNavigationExample.js.map +1 -1
- package/dist/components/BottomNavigation/bottom-navigation.css +8 -1
- package/dist/components/BottomNavigation/bottom-navigation.css.js +8 -1
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +17 -18
- package/dist/components/Breadcrumb/Breadcrumb.js +17 -18
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/Breadcrumb/BreadcrumbDropdown.d.ts +6 -0
- package/dist/components/Breadcrumb/BreadcrumbDropdown.js +6 -0
- package/dist/components/Breadcrumb/BreadcrumbDropdown.js.map +1 -1
- package/dist/components/Button/Button.d.ts +1 -11
- package/dist/components/Button/Button.js +1 -11
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/ButtonExample.js +1 -3
- package/dist/components/Button/ButtonExample.js.map +1 -1
- package/dist/components/ButtonDock/ButtonDock.d.ts +10 -14
- package/dist/components/ButtonDock/ButtonDock.js +10 -14
- package/dist/components/ButtonDock/ButtonDock.js.map +1 -1
- package/dist/components/Card/Card.d.ts +8 -10
- package/dist/components/Card/Card.js +6 -10
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Carousel/Carousel.d.ts +9 -13
- package/dist/components/Carousel/Carousel.js +9 -13
- package/dist/components/Carousel/Carousel.js.map +1 -1
- package/dist/components/Carousel/CarouselExample.js +14 -14
- package/dist/components/Carousel/CarouselExample.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +7 -4
- package/dist/components/Checkbox/Checkbox.js +7 -4
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +3 -3
- package/dist/components/CheckboxGroup/CheckboxGroup.js +3 -3
- package/dist/components/CheckboxGroup/CheckboxGroupExample.js +1 -0
- package/dist/components/CheckboxGroup/CheckboxGroupExample.js.map +1 -1
- package/dist/components/CheckboxOption/CheckboxOption.d.ts +4 -4
- package/dist/components/CheckboxOption/CheckboxOption.js +4 -4
- package/dist/components/Chip/Chip.d.ts +3 -7
- package/dist/components/Chip/Chip.js +3 -7
- package/dist/components/Chip/Chip.js.map +1 -1
- package/dist/components/Chip/ChipExample.js +50 -3
- package/dist/components/Chip/ChipExample.js.map +1 -1
- package/dist/components/ChipGroup/ChipGroup.d.ts +21 -10
- package/dist/components/ChipGroup/ChipGroup.js +21 -10
- package/dist/components/ChipGroup/ChipGroup.js.map +1 -1
- package/dist/components/ChipGroup/ChipGroupExample.js +1 -0
- package/dist/components/ChipGroup/ChipGroupExample.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +13 -12
- package/dist/components/DatePicker/DatePicker.js +13 -12
- package/dist/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/Dialog/Dialog.d.ts +11 -6
- package/dist/components/Dialog/Dialog.js +11 -6
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Divider/Divider.d.ts +5 -9
- package/dist/components/Divider/Divider.js +5 -9
- package/dist/components/Divider/Divider.js.map +1 -1
- package/dist/components/Divider/DividerExample.js +16 -1
- package/dist/components/Divider/DividerExample.js.map +1 -1
- package/dist/components/Drawer/Drawer.d.ts +3 -3
- package/dist/components/Drawer/Drawer.js +3 -3
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.d.ts +3 -7
- package/dist/components/EmptyState/EmptyState.js +3 -7
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/Fab/Fab.d.ts +4 -5
- package/dist/components/Fab/Fab.js +4 -6
- package/dist/components/Fab/Fab.js.map +1 -1
- package/dist/components/Fab/FabExample.d.ts +2 -1
- package/dist/components/Fab/FabExample.js +20 -2
- package/dist/components/Fab/FabExample.js.map +1 -1
- package/dist/components/Field/Field.d.ts +4 -5
- package/dist/components/Field/Field.js +4 -5
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/Field/FieldDescription.d.ts +7 -5
- package/dist/components/Field/FieldDescription.js +7 -3
- package/dist/components/Field/FieldDescription.js.map +1 -1
- package/dist/components/Field/FieldError.d.ts +6 -0
- package/dist/components/Field/FieldError.js +6 -0
- package/dist/components/Field/FieldError.js.map +1 -1
- package/dist/components/Field/FieldLabel.d.ts +6 -0
- package/dist/components/Field/FieldLabel.js +6 -0
- package/dist/components/Field/FieldLabel.js.map +1 -1
- package/dist/components/Field/utils.d.ts +5 -0
- package/dist/components/Field/utils.js +5 -0
- package/dist/components/Field/utils.js.map +1 -1
- package/dist/components/FileUpload/FileUpload.d.ts +3 -3
- package/dist/components/FileUpload/FileUpload.js +3 -3
- package/dist/components/FileUploadItem/FileUploadItem.d.ts +6 -10
- package/dist/components/FileUploadItem/FileUploadItem.js +6 -10
- package/dist/components/FileUploadItem/FileUploadItem.js.map +1 -1
- package/dist/components/FormField/FormField.d.ts +5 -16
- package/dist/components/FormField/FormField.js +5 -16
- package/dist/components/FormField/FormField.js.map +1 -1
- package/dist/components/Img/Img.d.ts +1 -3
- package/dist/components/Img/Img.js +1 -3
- package/dist/components/Img/Img.js.map +1 -1
- package/dist/components/InlineAlert/InlineAlert.d.ts +1 -3
- package/dist/components/InlineAlert/InlineAlert.js +1 -3
- package/dist/components/InlineAlert/InlineAlert.js.map +1 -1
- package/dist/components/InlineAlert/SvgWarningTwoTone.d.ts +6 -0
- package/dist/components/InlineAlert/SvgWarningTwoTone.js +6 -0
- package/dist/components/InlineAlert/SvgWarningTwoTone.js.map +1 -1
- package/dist/components/Input/Input.d.ts +13 -13
- package/dist/components/Input/Input.js +13 -13
- package/dist/components/Input/InputElement.d.ts +11 -5
- package/dist/components/Input/InputElement.js +11 -5
- package/dist/components/Input/InputElement.js.map +1 -1
- package/dist/components/InputNumber/IncrementButton.d.ts +13 -3
- package/dist/components/InputNumber/IncrementButton.js +11 -4
- package/dist/components/InputNumber/IncrementButton.js.map +1 -1
- package/dist/components/InputNumber/InputNumber.d.ts +20 -20
- package/dist/components/InputNumber/InputNumber.js +46 -30
- package/dist/components/InputNumber/InputNumber.js.map +1 -1
- package/dist/components/InputNumber/InputNumberExample.js +1 -0
- package/dist/components/InputNumber/InputNumberExample.js.map +1 -1
- package/dist/components/InputNumber/input-number.css +6 -0
- package/dist/components/InputNumber/input-number.css.js +6 -0
- package/dist/components/InputPhone/InputPhone.d.ts +21 -16
- package/dist/components/InputPhone/InputPhone.js +21 -16
- package/dist/components/InputPhone/InputPhone.js.map +1 -1
- package/dist/components/Layout/Layout.d.ts +1 -3
- package/dist/components/Layout/Layout.js +1 -3
- package/dist/components/Layout/Layout.js.map +1 -1
- package/dist/components/Link/Link.d.ts +1 -3
- package/dist/components/Link/Link.js +1 -3
- package/dist/components/Link/Link.js.map +1 -1
- package/dist/components/ListItem/ListItem.d.ts +22 -21
- package/dist/components/ListItem/ListItem.js +19 -16
- package/dist/components/ListItem/ListItem.js.map +1 -1
- package/dist/components/Menu/Menu.d.ts +5 -9
- package/dist/components/Menu/Menu.js +5 -9
- package/dist/components/Menu/Menu.js.map +1 -1
- package/dist/components/Modal/Modal.d.ts +4 -4
- package/dist/components/Modal/Modal.js +4 -4
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/modal.css +12 -1
- package/dist/components/Modal/modal.css.js +12 -1
- package/dist/components/OTPInput/OTPInput.d.ts +5 -3
- package/dist/components/OTPInput/OTPInput.js +5 -3
- package/dist/components/OTPInput/OTPInput.js.map +1 -1
- package/dist/components/PageControl/PageControl.d.ts +1 -3
- package/dist/components/PageControl/PageControl.js +1 -3
- package/dist/components/PageControl/PageControl.js.map +1 -1
- package/dist/components/Pagination/PageList.d.ts +6 -0
- package/dist/components/Pagination/PageList.js +6 -0
- package/dist/components/Pagination/PageList.js.map +1 -1
- package/dist/components/Pagination/Pagination.d.ts +6 -7
- package/dist/components/Pagination/Pagination.js +28 -15
- package/dist/components/Pagination/Pagination.js.map +1 -1
- package/dist/components/Pagination/pagination.css +5 -14
- package/dist/components/Pagination/pagination.css.js +5 -14
- package/dist/components/Password/Password.d.ts +19 -20
- package/dist/components/Password/Password.js +19 -20
- package/dist/components/Password/Password.js.map +1 -1
- package/dist/components/Popover/Popover.d.ts +11 -20
- package/dist/components/Popover/Popover.js +11 -20
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/Popover/PopoverExample.js +1 -1
- package/dist/components/Popover/PopoverExample.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +1 -3
- package/dist/components/ProgressBar/ProgressBar.js +1 -3
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/ProgressCircle/ProgressCircle.d.ts +1 -3
- package/dist/components/ProgressCircle/ProgressCircle.js +1 -3
- package/dist/components/ProgressCircle/ProgressCircle.js.map +1 -1
- package/dist/components/ProgressionStepper/ProgressionStepper.d.ts +1 -3
- package/dist/components/ProgressionStepper/ProgressionStepper.js +1 -3
- package/dist/components/ProgressionStepper/ProgressionStepper.js.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +2 -2
- package/dist/components/RadioGroup/RadioGroup.js +2 -2
- package/dist/components/Rating/Rating.d.ts +2 -4
- package/dist/components/Rating/Rating.js +8 -6
- package/dist/components/Rating/Rating.js.map +1 -1
- package/dist/components/Rating/RatingExample.js +17 -1
- package/dist/components/Rating/RatingExample.js.map +1 -1
- package/dist/components/Scrim/Scrim.d.ts +0 -1
- package/dist/components/Scrim/Scrim.js +0 -1
- package/dist/components/Scrim/Scrim.js.map +1 -1
- package/dist/components/SearchBar/SearchBar.d.ts +2 -2
- package/dist/components/SearchBar/SearchBar.js +2 -2
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +3 -3
- package/dist/components/SegmentedControl/SegmentedControl.js +3 -3
- package/dist/components/SegmentedControl/SegmentedControlExample.js +10 -12
- package/dist/components/SegmentedControl/SegmentedControlExample.js.map +1 -1
- package/dist/components/Select/Select.d.ts +33 -34
- package/dist/components/Select/Select.js +33 -34
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Skeleton/Circular.d.ts +6 -0
- package/dist/components/Skeleton/Circular.js +6 -0
- package/dist/components/Skeleton/Circular.js.map +1 -1
- package/dist/components/Skeleton/Photo.d.ts +6 -0
- package/dist/components/Skeleton/Photo.js +6 -0
- package/dist/components/Skeleton/Photo.js.map +1 -1
- package/dist/components/Skeleton/Profile.d.ts +6 -0
- package/dist/components/Skeleton/Profile.js +6 -0
- package/dist/components/Skeleton/Profile.js.map +1 -1
- package/dist/components/Skeleton/Rectangular.d.ts +6 -0
- package/dist/components/Skeleton/Rectangular.js +6 -0
- package/dist/components/Skeleton/Rectangular.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +10 -14
- package/dist/components/Skeleton/Skeleton.js +10 -14
- package/dist/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/Skeleton/SkeletonExample.js +4 -3
- package/dist/components/Skeleton/SkeletonExample.js.map +1 -1
- package/dist/components/Skeleton/Thumbnail.d.ts +6 -0
- package/dist/components/Skeleton/Thumbnail.js +6 -0
- package/dist/components/Skeleton/Thumbnail.js.map +1 -1
- package/dist/components/SkeletonText/SkeletonText.d.ts +5 -9
- package/dist/components/SkeletonText/SkeletonText.js +5 -9
- package/dist/components/SkeletonText/SkeletonText.js.map +1 -1
- package/dist/components/Slider/Slider.d.ts +2 -2
- package/dist/components/Slider/Slider.js +2 -2
- package/dist/components/Slider/SliderExample.js +40 -18
- package/dist/components/Slider/SliderExample.js.map +1 -1
- package/dist/components/Slider/SliderIntervalDots.d.ts +6 -0
- package/dist/components/Slider/SliderIntervalDots.js +6 -0
- package/dist/components/Slider/SliderIntervalDots.js.map +1 -1
- package/dist/components/Snackbar/Manager.d.ts +28 -0
- package/dist/components/Snackbar/Manager.js +34 -0
- package/dist/components/Snackbar/Manager.js.map +1 -0
- package/dist/components/Snackbar/Snackbar.d.ts +23 -6
- package/dist/components/Snackbar/Snackbar.js +23 -5
- package/dist/components/Snackbar/Snackbar.js.map +1 -1
- package/dist/components/Snackbar/SnackbarExample.js +8 -1
- package/dist/components/Snackbar/SnackbarExample.js.map +1 -1
- package/dist/components/Snackbar/index.d.ts +1 -0
- package/dist/components/Snackbar/index.js +1 -0
- package/dist/components/Snackbar/index.js.map +1 -1
- package/dist/components/StylesProviderDemo/StylesProviderDemo.d.ts +1 -3
- package/dist/components/StylesProviderDemo/StylesProviderDemo.js +1 -3
- package/dist/components/StylesProviderDemo/StylesProviderDemo.js.map +1 -1
- package/dist/components/Switch/Switch.d.ts +2 -2
- package/dist/components/Switch/Switch.js +2 -2
- package/dist/components/TabGroup/TabGroup.d.ts +2 -2
- package/dist/components/TabGroup/TabGroup.js +2 -2
- package/dist/components/TabGroup/TabGroupExample.js +5 -11
- package/dist/components/TabGroup/TabGroupExample.js.map +1 -1
- package/dist/components/TabGroup/tab-group.css +1 -0
- package/dist/components/TabGroup/tab-group.css.js +1 -0
- package/dist/components/TabList/TabList.d.ts +2 -2
- package/dist/components/TabList/TabList.js +3 -4
- package/dist/components/TabList/TabList.js.map +1 -1
- package/dist/components/TabList/tab-list.css +0 -1
- package/dist/components/TabList/tab-list.css.js +0 -1
- package/dist/components/Table/Footer.d.ts +6 -0
- package/dist/components/Table/Footer.js +6 -0
- package/dist/components/Table/Footer.js.map +1 -1
- package/dist/components/Table/Table.d.ts +53 -16
- package/dist/components/Table/Table.js +53 -16
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/table.css +0 -1
- package/dist/components/Table/table.css.js +0 -1
- package/dist/components/Tag/Tag.d.ts +1 -3
- package/dist/components/Tag/Tag.js +1 -3
- package/dist/components/Tag/Tag.js.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts +13 -13
- package/dist/components/Textarea/Textarea.js +13 -13
- package/dist/components/TimePicker/Listbox.d.ts +6 -0
- package/dist/components/TimePicker/Listbox.js +6 -0
- package/dist/components/TimePicker/Listbox.js.map +1 -1
- package/dist/components/TimePicker/Segment.d.ts +6 -0
- package/dist/components/TimePicker/Segment.js +6 -0
- package/dist/components/TimePicker/Segment.js.map +1 -1
- package/dist/components/TimePicker/TimePicker.d.ts +14 -14
- package/dist/components/TimePicker/TimePicker.js +14 -14
- package/dist/components/ToggleOption/ToggleOption.js +1 -1
- package/dist/components/ToggleOption/ToggleOption.js.map +1 -1
- package/dist/components/ToggleOption/toggle-option.css +2 -49
- package/dist/components/ToggleOption/toggle-option.css.js +2 -49
- package/dist/components/Tooltip/Tooltip.d.ts +3 -7
- package/dist/components/Tooltip/Tooltip.js +3 -7
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Tooltip/TooltipExample.js +23 -3
- package/dist/components/Tooltip/TooltipExample.js.map +1 -1
- package/dist/components/Truncated/Truncated.d.ts +0 -1
- package/dist/components/Truncated/Truncated.js +1 -2
- package/dist/components/Truncated/Truncated.js.map +1 -1
- package/dist/components/Txt/Txt.d.ts +1 -3
- package/dist/components/Txt/Txt.js +1 -3
- package/dist/components/Txt/Txt.js.map +1 -1
- package/dist/components/UIProvider/AriaLiveMessageHandler.js +3 -2
- package/dist/components/UIProvider/AriaLiveMessageHandler.js.map +1 -1
- package/dist/components/UIProvider/UIProvider.d.ts +0 -1
- package/dist/components/UIProvider/UIProvider.js +0 -1
- package/dist/components/UIProvider/UIProvider.js.map +1 -1
- package/dist/hooks/useAddEventListener.d.ts +1 -2
- package/dist/hooks/useAddEventListener.js.map +1 -1
- package/dist/hooks/useLongPress.d.ts +30 -15
- package/dist/hooks/useLongPress.js +26 -42
- package/dist/hooks/useLongPress.js.map +1 -1
- package/dist/hooks/useRadioState.d.ts +1 -1
- package/dist/hooks/useTimeout.d.ts +1 -2
- package/dist/hooks/useTimeout.js +20 -4
- package/dist/hooks/useTimeout.js.map +1 -1
- package/dist/styles/base.css +9 -0
- package/dist/styles/base.css.js +9 -0
- package/dist/types/common.d.ts +3 -0
- package/dist/types/common.js.map +1 -1
- package/dist/types/meta.d.ts +1 -0
- package/dist/types/meta.js.map +1 -1
- package/dist/utils/createCustomEvent.d.ts +17 -0
- package/dist/utils/createCustomEvent.js +21 -0
- package/dist/utils/createCustomEvent.js.map +1 -0
- package/dist/utils/createExampleChildElement.js +3 -3
- package/dist/utils/createExampleChildElement.js.map +1 -1
- package/dist/utils/demo.d.ts +18 -26
- package/dist/utils/demo.js.map +1 -1
- package/meta.ts +6 -1
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.tsx +20 -3
- package/src/components/Avatar/Avatar.tsx +13 -14
- package/src/components/AvatarGroup/AvatarGroup.tsx +30 -13
- package/src/components/Badge/Badge.tsx +1 -3
- package/src/components/BadgeDot/BadgeDot.tsx +6 -4
- package/src/components/BannerAlert/BannerAlert.tsx +11 -12
- package/src/components/BottomNavigation/BottomNavigation.tsx +6 -3
- package/src/components/BottomNavigation/BottomNavigationExample.tsx +31 -36
- package/src/components/BottomNavigation/bottom-navigation.scss +10 -1
- package/src/components/Breadcrumb/Breadcrumb.tsx +17 -18
- package/src/components/Breadcrumb/BreadcrumbDropdown.tsx +6 -0
- package/src/components/Button/Button.tsx +1 -11
- package/src/components/Button/ButtonExample.tsx +1 -2
- package/src/components/ButtonDock/ButtonDock.tsx +10 -14
- package/src/components/Card/Card.tsx +9 -11
- package/src/components/Carousel/Carousel.tsx +9 -13
- package/src/components/Carousel/CarouselExample.tsx +25 -25
- package/src/components/Checkbox/Checkbox.tsx +7 -4
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +3 -3
- package/src/components/CheckboxGroup/CheckboxGroupExample.tsx +1 -0
- package/src/components/CheckboxOption/CheckboxOption.tsx +4 -4
- package/src/components/Chip/Chip.tsx +3 -7
- package/src/components/Chip/ChipExample.tsx +52 -3
- package/src/components/ChipGroup/ChipGroup.tsx +21 -10
- package/src/components/ChipGroup/ChipGroupExample.tsx +1 -1
- package/src/components/DatePicker/DatePicker.tsx +13 -12
- package/src/components/Dialog/Dialog.tsx +11 -6
- package/src/components/Divider/Divider.tsx +5 -9
- package/src/components/Divider/DividerExample.tsx +18 -1
- package/src/components/Drawer/Drawer.tsx +3 -4
- package/src/components/EmptyState/EmptyState.tsx +3 -7
- package/src/components/Fab/Fab.tsx +8 -5
- package/src/components/Fab/FabExample.tsx +22 -3
- package/src/components/Field/Field.tsx +4 -5
- package/src/components/Field/FieldDescription.tsx +7 -5
- package/src/components/Field/FieldError.tsx +6 -0
- package/src/components/Field/FieldLabel.tsx +6 -0
- package/src/components/Field/utils.ts +5 -0
- package/src/components/FileUpload/FileUpload.tsx +3 -3
- package/src/components/FileUploadItem/FileUploadItem.tsx +6 -10
- package/src/components/FormField/FormField.tsx +5 -16
- package/src/components/Img/Img.tsx +1 -3
- package/src/components/InlineAlert/InlineAlert.tsx +1 -3
- package/src/components/InlineAlert/SvgWarningTwoTone.tsx +6 -0
- package/src/components/Input/Input.tsx +13 -13
- package/src/components/Input/InputElement.tsx +11 -5
- package/src/components/InputNumber/IncrementButton.tsx +21 -11
- package/src/components/InputNumber/InputNumber.tsx +53 -51
- package/src/components/InputNumber/InputNumberExample.tsx +1 -0
- package/src/components/InputNumber/input-number.scss +10 -0
- package/src/components/InputPhone/InputPhone.tsx +21 -16
- package/src/components/Layout/Layout.tsx +1 -3
- package/src/components/Link/Link.tsx +1 -3
- package/src/components/ListItem/ListItem.tsx +22 -20
- package/src/components/Menu/Menu.tsx +5 -9
- package/src/components/Modal/Modal.tsx +10 -5
- package/src/components/Modal/modal.scss +13 -1
- package/src/components/OTPInput/OTPInput.tsx +5 -3
- package/src/components/PageControl/PageControl.tsx +1 -3
- package/src/components/Pagination/PageList.tsx +6 -0
- package/src/components/Pagination/Pagination.tsx +50 -24
- package/src/components/Pagination/pagination.scss +7 -17
- package/src/components/Password/Password.tsx +19 -20
- package/src/components/Popover/Popover.tsx +11 -20
- package/src/components/Popover/PopoverExample.tsx +1 -1
- package/src/components/ProgressBar/ProgressBar.tsx +1 -3
- package/src/components/ProgressCircle/ProgressCircle.tsx +1 -3
- package/src/components/ProgressionStepper/ProgressionStepper.tsx +1 -3
- package/src/components/RadioGroup/RadioGroup.tsx +2 -2
- package/src/components/Rating/Rating.tsx +34 -14
- package/src/components/Rating/RatingExample.tsx +18 -1
- package/src/components/Scrim/Scrim.tsx +0 -1
- package/src/components/SearchBar/SearchBar.tsx +2 -2
- package/src/components/SegmentedControl/SegmentedControl.tsx +3 -3
- package/src/components/SegmentedControl/SegmentedControlExample.tsx +10 -12
- package/src/components/Select/Select.tsx +33 -34
- package/src/components/Skeleton/Circular.tsx +6 -0
- package/src/components/Skeleton/Photo.tsx +6 -0
- package/src/components/Skeleton/Profile.tsx +6 -0
- package/src/components/Skeleton/Rectangular.tsx +6 -0
- package/src/components/Skeleton/Skeleton.tsx +10 -14
- package/src/components/Skeleton/SkeletonExample.tsx +5 -3
- package/src/components/Skeleton/Thumbnail.tsx +6 -0
- package/src/components/SkeletonText/SkeletonText.tsx +5 -9
- package/src/components/Slider/Slider.tsx +2 -2
- package/src/components/Slider/SliderExample.tsx +42 -17
- package/src/components/Slider/SliderIntervalDots.tsx +6 -0
- package/src/components/Snackbar/Manager.tsx +63 -0
- package/src/components/Snackbar/Snackbar.tsx +23 -7
- package/src/components/Snackbar/SnackbarExample.tsx +28 -6
- package/src/components/Snackbar/index.tsx +1 -0
- package/src/components/StylesProviderDemo/StylesProviderDemo.tsx +1 -3
- package/src/components/Switch/Switch.tsx +2 -2
- package/src/components/TabGroup/TabGroup.tsx +2 -2
- package/src/components/TabGroup/TabGroupExample.tsx +5 -11
- package/src/components/TabGroup/tab-group.scss +1 -0
- package/src/components/TabList/TabList.tsx +3 -4
- package/src/components/TabList/tab-list.scss +0 -1
- package/src/components/Table/Footer.tsx +6 -0
- package/src/components/Table/Table.tsx +53 -16
- package/src/components/Table/table.scss +0 -1
- package/src/components/Tag/Tag.tsx +1 -3
- package/src/components/Textarea/Textarea.tsx +13 -13
- package/src/components/TimePicker/Listbox.tsx +6 -0
- package/src/components/TimePicker/Segment.tsx +6 -0
- package/src/components/TimePicker/TimePicker.tsx +14 -14
- package/src/components/ToggleOption/ToggleOption.tsx +1 -0
- package/src/components/ToggleOption/toggle-option.scss +2 -61
- package/src/components/Tooltip/Tooltip.tsx +3 -7
- package/src/components/Tooltip/TooltipExample.tsx +23 -11
- package/src/components/Truncated/Truncated.tsx +1 -2
- package/src/components/Txt/Txt.tsx +1 -3
- package/src/components/UIProvider/AriaLiveMessageHandler.tsx +4 -2
- package/src/components/UIProvider/UIProvider.tsx +0 -1
- package/src/hooks/useAddEventListener.ts +1 -3
- package/src/hooks/useLongPress.ts +58 -48
- package/src/hooks/useTimeout.ts +1 -5
- package/src/styles/base.scss +9 -0
- package/src/types/common.ts +4 -0
- package/src/types/meta.ts +1 -0
- package/src/utils/createCustomEvent.ts +35 -0
- package/src/utils/createExampleChildElement.tsx +3 -8
- package/src/utils/demo.ts +24 -27
- package/dist/components/ListItem/ListItemButton.d.ts +0 -2
- package/dist/components/ListItem/ListItemButton.js +0 -7
- package/dist/components/ListItem/ListItemButton.js.map +0 -1
- package/dist/components/Pagination/PageInput.d.ts +0 -4
- package/dist/components/Pagination/PageInput.js +0 -36
- package/dist/components/Pagination/PageInput.js.map +0 -1
- package/dist/components/Truncated/truncated.css +0 -8
- package/dist/components/Truncated/truncated.css.js +0 -13
- package/dist/hooks/usePaginationState.d.ts +0 -4
- package/dist/hooks/usePaginationState.js +0 -22
- package/dist/hooks/usePaginationState.js.map +0 -1
- package/src/components/ListItem/ListItemButton.tsx +0 -6
- package/src/components/Pagination/PageInput.tsx +0 -65
- package/src/components/Truncated/truncated.scss +0 -8
- package/src/hooks/usePaginationState.tsx +0 -24
|
@@ -4,11 +4,13 @@ import { ButtonProps } from '-/components/Button';
|
|
|
4
4
|
import { Tooltip, TooltipTriggerProps } from '-/components/Tooltip';
|
|
5
5
|
import { ElementProps } from '-/types/common';
|
|
6
6
|
|
|
7
|
+
export type FabSize = 'medium' | 'small';
|
|
8
|
+
|
|
7
9
|
export type FabVariant = 'neutral' | 'primary' | 'secondary';
|
|
8
10
|
|
|
9
11
|
export type FabProps<As extends ElementType = ElementType> = Pick<
|
|
10
12
|
ButtonProps<As>,
|
|
11
|
-
'as' | 'icon' | 'iconOnly' | 'onClick' | 'toolTip'
|
|
13
|
+
'as' | 'icon' | 'iconOnly' | 'innerRef' | 'onClick' | 'toolTip'
|
|
12
14
|
> &
|
|
13
15
|
Required<Pick<ButtonProps<As>, 'label'>> & {
|
|
14
16
|
/**
|
|
@@ -16,7 +18,7 @@ export type FabProps<As extends ElementType = ElementType> = Pick<
|
|
|
16
18
|
*
|
|
17
19
|
* @default small
|
|
18
20
|
*/
|
|
19
|
-
size?:
|
|
21
|
+
size?: FabSize;
|
|
20
22
|
/**
|
|
21
23
|
* The style variant of the button.
|
|
22
24
|
*
|
|
@@ -45,9 +47,7 @@ export type FabProps<As extends ElementType = ElementType> = Pick<
|
|
|
45
47
|
* import { SvgBolt } from '@bspk/icons/Bolt';
|
|
46
48
|
* import { Fab } from '@bspk/ui/Fab';
|
|
47
49
|
*
|
|
48
|
-
*
|
|
49
|
-
* return <Fab icon={<SvgBolt />} label="Example label" placement="bottom-right" variant="neutral" />;
|
|
50
|
-
* }
|
|
50
|
+
* <Fab icon={<SvgBolt />} label="Example label" placement="bottom-right" variant="neutral" />;
|
|
51
51
|
*
|
|
52
52
|
* @name Fab
|
|
53
53
|
* @phase UXReview
|
|
@@ -63,6 +63,7 @@ export function Fab<As extends ElementType = ElementType>(props: AriaAttributes
|
|
|
63
63
|
label,
|
|
64
64
|
icon,
|
|
65
65
|
toolTip,
|
|
66
|
+
innerRef,
|
|
66
67
|
...otherProps
|
|
67
68
|
} = props;
|
|
68
69
|
|
|
@@ -77,6 +78,7 @@ export function Fab<As extends ElementType = ElementType>(props: AriaAttributes
|
|
|
77
78
|
data-bspk="fab"
|
|
78
79
|
data-container={container}
|
|
79
80
|
data-placement={placement}
|
|
81
|
+
data-position={container === 'page' ? 'fixed' : 'absolute'}
|
|
80
82
|
data-round={iconOnly || undefined}
|
|
81
83
|
data-size={size}
|
|
82
84
|
data-variant={variant}
|
|
@@ -96,6 +98,7 @@ export function Fab<As extends ElementType = ElementType>(props: AriaAttributes
|
|
|
96
98
|
triggerProps.onMouseOver?.();
|
|
97
99
|
otherProps.onMouseOver?.(e);
|
|
98
100
|
}}
|
|
101
|
+
ref={innerRef}
|
|
99
102
|
>
|
|
100
103
|
{!!icon && isValidElement(icon) && (
|
|
101
104
|
<span aria-hidden={true} data-fab-icon>
|
|
@@ -1,10 +1,29 @@
|
|
|
1
|
+
import { FabProps } from './Fab';
|
|
1
2
|
import { ButtonExample } from '-/components/Button/ButtonExample';
|
|
2
3
|
import { ComponentExample } from '-/utils/demo';
|
|
3
4
|
|
|
4
5
|
export const presets = ButtonExample.presets || [];
|
|
5
6
|
|
|
6
|
-
export const FabExample: ComponentExample = {
|
|
7
|
+
export const FabExample: ComponentExample<FabProps> = {
|
|
7
8
|
containerStyle: { display: 'block', height: '152px', width: '100%' },
|
|
8
|
-
presets
|
|
9
|
-
|
|
9
|
+
presets: ButtonExample.presets?.map((preset) => ({
|
|
10
|
+
...preset,
|
|
11
|
+
propState: {
|
|
12
|
+
...preset.propState,
|
|
13
|
+
size: undefined,
|
|
14
|
+
variant: undefined,
|
|
15
|
+
},
|
|
16
|
+
})),
|
|
17
|
+
defaultState: {
|
|
18
|
+
container: 'local',
|
|
19
|
+
placement: 'bottom-right',
|
|
20
|
+
},
|
|
21
|
+
variants: {
|
|
22
|
+
container: false,
|
|
23
|
+
placement: false,
|
|
24
|
+
iconOnly: {
|
|
25
|
+
icon: 'MenuBook',
|
|
26
|
+
label: 'Menu Book',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
10
29
|
};
|
|
@@ -42,9 +42,9 @@ const isComponentName = (
|
|
|
42
42
|
* import { Input } from '@bspk/ui/Input';
|
|
43
43
|
* import { Field, FieldLabel, FieldDescription, FieldError } from '@bspk/ui/Field';
|
|
44
44
|
*
|
|
45
|
-
*
|
|
46
|
-
* const [state, setState] =
|
|
47
|
-
* const [error, setError] =
|
|
45
|
+
* () => {
|
|
46
|
+
* const [state, setState] = useState<string | undefined>(undefined);
|
|
47
|
+
* const [error, setError] = useState<string | undefined>(undefined);
|
|
48
48
|
*
|
|
49
49
|
* return (
|
|
50
50
|
* <Field label="Example label">
|
|
@@ -56,13 +56,12 @@ const isComponentName = (
|
|
|
56
56
|
* setState(next);
|
|
57
57
|
* }}
|
|
58
58
|
* value={state}
|
|
59
|
-
* {...fieldProps}
|
|
60
59
|
* />
|
|
61
60
|
* <FieldDescription>This is an example description.</FieldDescription>
|
|
62
61
|
* {error && <FieldError>{error}</FieldError>}
|
|
63
62
|
* </Field>
|
|
64
63
|
* );
|
|
65
|
-
* }
|
|
64
|
+
* };
|
|
66
65
|
*
|
|
67
66
|
* @name Field
|
|
68
67
|
* @phase Utility
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { useFieldContext, describedById } from './utils';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* FieldDescription component displays a description associated with a form field.
|
|
5
|
+
*
|
|
6
|
+
* @name FieldDescription
|
|
7
|
+
* @parent Field
|
|
8
|
+
*/
|
|
9
|
+
export function FieldDescription({ children }: { children?: string }) {
|
|
4
10
|
const { id } = useFieldContext();
|
|
5
11
|
|
|
6
12
|
return children ? (
|
|
@@ -9,7 +15,3 @@ function FieldDescription({ children }: { children?: string }) {
|
|
|
9
15
|
</p>
|
|
10
16
|
) : null;
|
|
11
17
|
}
|
|
12
|
-
|
|
13
|
-
FieldDescription.displayName = 'FieldDescription';
|
|
14
|
-
|
|
15
|
-
export { FieldDescription };
|
|
@@ -6,6 +6,12 @@ export type FieldErrorProps = {
|
|
|
6
6
|
children?: string;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* FieldError component displays an error message associated with a form field.
|
|
11
|
+
*
|
|
12
|
+
* @name FieldError
|
|
13
|
+
* @parent Field
|
|
14
|
+
*/
|
|
9
15
|
export function FieldError({ children }: FieldErrorProps) {
|
|
10
16
|
const { id } = useFieldContext();
|
|
11
17
|
|
|
@@ -14,6 +14,12 @@ export type FieldLabelProps<As extends ElementType = ElementType> = Pick<FieldCo
|
|
|
14
14
|
as?: As;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* FieldLabel component displays a label associated with a form field.
|
|
19
|
+
*
|
|
20
|
+
* @name FieldLabel
|
|
21
|
+
* @parent Field
|
|
22
|
+
*/
|
|
17
23
|
export function FieldLabel<As extends ElementType = ElementType>({
|
|
18
24
|
children,
|
|
19
25
|
labelTrailing,
|
|
@@ -28,6 +28,11 @@ export type FieldContext = FieldContextProps & {
|
|
|
28
28
|
|
|
29
29
|
export const fieldContext = createContext<FieldContext | null>(null);
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves the current Field context.
|
|
33
|
+
*
|
|
34
|
+
* Will return a default context if used outside of a Field component.
|
|
35
|
+
*/
|
|
31
36
|
export function useFieldContext(): FieldContext {
|
|
32
37
|
return (
|
|
33
38
|
useContext(fieldContext) || {
|
|
@@ -73,7 +73,7 @@ export type FileUploadProps = Pick<FileUploadItemProps, 'cancelButtonLabel' | 'o
|
|
|
73
73
|
* @example
|
|
74
74
|
* import { FileUpload } from '@bspk/ui/FileUpload';
|
|
75
75
|
*
|
|
76
|
-
*
|
|
76
|
+
* () => {
|
|
77
77
|
* const [files, setFiles] = useState([]);
|
|
78
78
|
* return (
|
|
79
79
|
* <FileUpload
|
|
@@ -82,12 +82,12 @@ export type FileUploadProps = Pick<FileUploadItemProps, 'cancelButtonLabel' | 'o
|
|
|
82
82
|
* acceptedFileTypes={['image/png', 'image/gif', 'image/svg+xml']}
|
|
83
83
|
* files={files}
|
|
84
84
|
* maxFileSize={5}
|
|
85
|
-
* onError={(errorFiles) =>
|
|
85
|
+
* onError={(errorFiles) => sendSnackbar('Upload error:', errorFiles)}
|
|
86
86
|
* onUpload={(uploadFiles) => setFiles(uploadFiles)}
|
|
87
87
|
* uploadSubtitle="SVG, PNG, JPG or GIF (max. 5MB)"
|
|
88
88
|
* />
|
|
89
89
|
* );
|
|
90
|
-
* }
|
|
90
|
+
* };
|
|
91
91
|
*
|
|
92
92
|
* @name FileUpload
|
|
93
93
|
* @phase UXReview
|
|
@@ -30,16 +30,12 @@ export type FileUploadItemProps = FileEntry & {
|
|
|
30
30
|
* @example
|
|
31
31
|
* import { FileUploadItem } from '@bspk/ui/FileUploadItem';
|
|
32
32
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* onCancel={() => console.log('Cancel item clicked!')}
|
|
40
|
-
* />
|
|
41
|
-
* );
|
|
42
|
-
* }
|
|
33
|
+
* <FileUploadItem
|
|
34
|
+
* fileName="dunder-mifflin-paper-co.jpg"
|
|
35
|
+
* fileSize="1.43 mb"
|
|
36
|
+
* status="Uploading"
|
|
37
|
+
* onCancel={() => sendSnackbar('Cancel item clicked!')}
|
|
38
|
+
* />;
|
|
43
39
|
*
|
|
44
40
|
* @name FileUploadItem
|
|
45
41
|
* @phase UXReview
|
|
@@ -54,26 +54,15 @@ export type FormFieldProps<As extends ElementType = ElementType> = CommonProps<'
|
|
|
54
54
|
* import { Input } from '@bspk/ui/Input';
|
|
55
55
|
* import { FormField } from '@bspk/ui/FormField';
|
|
56
56
|
*
|
|
57
|
-
*
|
|
58
|
-
* const [state, setState] =
|
|
57
|
+
* () => {
|
|
58
|
+
* const [state, setState] = useState<string | undefined>(undefined);
|
|
59
|
+
*
|
|
59
60
|
* return (
|
|
60
61
|
* <FormField controlId="Example controlId" label="Example label">
|
|
61
|
-
* {(
|
|
62
|
-
* return (
|
|
63
|
-
* <Input
|
|
64
|
-
* aria-label="example aria-label"
|
|
65
|
-
* name="example-text"
|
|
66
|
-
* onChange={(next) => {
|
|
67
|
-
* setState(next);
|
|
68
|
-
* }}
|
|
69
|
-
* value={state}
|
|
70
|
-
* {...fieldProps}
|
|
71
|
-
* />
|
|
72
|
-
* );
|
|
73
|
-
* }}
|
|
62
|
+
* <Input name="example-text" onChange={(next) => setState(next)} value={state} />
|
|
74
63
|
* </FormField>
|
|
75
64
|
* );
|
|
76
|
-
* }
|
|
65
|
+
* };
|
|
77
66
|
*
|
|
78
67
|
* @name FormField
|
|
79
68
|
* @phase Utility
|
|
@@ -21,9 +21,7 @@ export type ImgProps = {
|
|
|
21
21
|
* @example
|
|
22
22
|
* import { Img } from '@bspk/ui/Img';
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
* return <Img alt="Example alt" src="Example src" />;
|
|
26
|
-
* }
|
|
24
|
+
* <Img alt="Example alt" src="Example src" />;
|
|
27
25
|
*
|
|
28
26
|
* @name Img
|
|
29
27
|
* @phase Backlog
|
|
@@ -32,9 +32,7 @@ export type InlineAlertProps = CommonProps<'owner'> & {
|
|
|
32
32
|
* @example
|
|
33
33
|
* import { InlineAlert } from '@bspk/ui/InlineAlert';
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
* return <InlineAlert variant="informational">Example informational inline alert</InlineAlert>;
|
|
37
|
-
* }
|
|
35
|
+
* <InlineAlert variant="informational">Example informational inline alert</InlineAlert>;
|
|
38
36
|
*
|
|
39
37
|
* @name InlineAlert
|
|
40
38
|
* @phase UXReview
|
|
@@ -15,23 +15,23 @@ export type InputProps = Omit<InputElementProps, 'ariaDescribedBy' | 'ariaErrorM
|
|
|
15
15
|
* import { Input } from '@bspk/ui/Input';
|
|
16
16
|
* import { Field, FieldLabel } from '@bspk/ui/Field';
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* () => {
|
|
19
19
|
* const [value, setValue] = useState('');
|
|
20
20
|
*
|
|
21
21
|
* return (
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* <Input name="example-name" onChange={setValue} value={value} />
|
|
25
|
-
* <
|
|
26
|
-
*
|
|
22
|
+
* <>
|
|
23
|
+
* // standalone input example
|
|
24
|
+
* <Input aria-label="Example Input" name="example-name" onChange={setValue} value={value} />
|
|
25
|
+
* <br />
|
|
26
|
+
* // input used within a field
|
|
27
|
+
* <Field>
|
|
28
|
+
* <FieldLabel>Example Label</FieldLabel>
|
|
29
|
+
* <Input name="example-name" onChange={setValue} value={value} />
|
|
30
|
+
* <FieldDescription>This is an example input field.</FieldDescription>
|
|
31
|
+
* </Field>
|
|
32
|
+
* </>
|
|
27
33
|
* );
|
|
28
|
-
* }
|
|
29
|
-
*
|
|
30
|
-
* function ExampleWithAriaLabel() {
|
|
31
|
-
* const [value, setValue] = useState('');
|
|
32
|
-
*
|
|
33
|
-
* return <Input aria-label="Example Input" name="example-name" onChange={setValue} value={value} />;
|
|
34
|
-
* }
|
|
34
|
+
* };
|
|
35
35
|
*
|
|
36
36
|
* @name Input
|
|
37
37
|
* @phase UXReview
|
|
@@ -67,16 +67,22 @@ export type InputElementProps = InputElementBaseProps & {
|
|
|
67
67
|
* import { InputElement } from '@bspk/ui/InputElement';
|
|
68
68
|
* import { Field, FieldLabel } from '@bspk/ui/Field';
|
|
69
69
|
*
|
|
70
|
-
*
|
|
70
|
+
* () => {
|
|
71
71
|
* const [value, setValue] = useState('');
|
|
72
72
|
*
|
|
73
73
|
* return (
|
|
74
|
-
*
|
|
75
|
-
*
|
|
74
|
+
* <>
|
|
75
|
+
* // standalone input element example
|
|
76
76
|
* <InputElement name="example-name" onChange={setValue} value={value} />
|
|
77
|
-
*
|
|
77
|
+
* <br />
|
|
78
|
+
* // input element used within a field
|
|
79
|
+
* <Field>
|
|
80
|
+
* <FieldLabel>Example Label</FieldLabel>
|
|
81
|
+
* <InputElement name="example-name" onChange={setValue} value={value} />
|
|
82
|
+
* </Field>
|
|
83
|
+
* </>
|
|
78
84
|
* );
|
|
79
|
-
* }
|
|
85
|
+
* };
|
|
80
86
|
*
|
|
81
87
|
* @name InputElement
|
|
82
88
|
* @phase Utility
|
|
@@ -3,29 +3,39 @@ import { SvgRemove } from '@bspk/icons/Remove';
|
|
|
3
3
|
import { useLongPress } from '-/hooks/useLongPress';
|
|
4
4
|
|
|
5
5
|
export type IncrementButtonProps = {
|
|
6
|
+
/** Whether the button is disabled. */
|
|
6
7
|
disabled: boolean;
|
|
7
|
-
increment
|
|
8
|
-
|
|
8
|
+
/** The kind of increment button, either 'add' or 'remove'. */
|
|
9
|
+
kind: 'add' | 'remove';
|
|
10
|
+
/** The ID of the associated input element. */
|
|
9
11
|
inputId: string;
|
|
12
|
+
/** Function to trigger the increment action. */
|
|
13
|
+
triggerIncrement: (kind: 'add' | 'remove') => boolean;
|
|
10
14
|
};
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* A button component for incrementing or decrementing the InputNumber.
|
|
18
|
+
*
|
|
19
|
+
* @name IncrementButton
|
|
20
|
+
* @parent InputNumber
|
|
21
|
+
*/
|
|
22
|
+
export function IncrementButton({ inputId, kind, disabled, triggerIncrement }: IncrementButtonProps) {
|
|
23
|
+
const { ...pressHandlers } = useLongPress({
|
|
24
|
+
callback: () => triggerIncrement(kind),
|
|
25
|
+
});
|
|
16
26
|
|
|
17
27
|
return (
|
|
18
28
|
<button
|
|
19
|
-
{...
|
|
29
|
+
{...pressHandlers}
|
|
20
30
|
aria-controls={inputId}
|
|
21
|
-
aria-
|
|
22
|
-
data-
|
|
31
|
+
aria-label={kind === 'add' ? 'Increase value' : 'Decrease value'}
|
|
32
|
+
data-bspk="input-number--increment-button"
|
|
33
|
+
data-kind={kind}
|
|
23
34
|
disabled={disabled}
|
|
24
|
-
ref={setTriggerElement}
|
|
25
35
|
tabIndex={-1}
|
|
26
36
|
type="button"
|
|
27
37
|
>
|
|
28
|
-
{add ? <SvgAdd /> : <SvgRemove />}
|
|
38
|
+
{kind === 'add' ? <SvgAdd aria-hidden /> : <SvgRemove aria-hidden />}
|
|
29
39
|
</button>
|
|
30
40
|
);
|
|
31
41
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import './input-number.scss';
|
|
2
|
-
import {
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
3
|
import { IncrementButton } from './IncrementButton';
|
|
4
4
|
import { useFieldInit } from '-/components/Field';
|
|
5
5
|
import { useId } from '-/hooks/useId';
|
|
6
6
|
import { CommonProps, FieldControlProps } from '-/types/common';
|
|
7
7
|
|
|
8
|
-
function isNumber(value: unknown
|
|
8
|
+
function isNumber(value: unknown): number | undefined;
|
|
9
|
+
function isNumber(value: unknown, fallbackValue: number): number;
|
|
10
|
+
function isNumber(value: unknown, fallbackValue?: number): number | undefined {
|
|
9
11
|
if (typeof value === 'number') return value;
|
|
10
12
|
if (typeof value !== 'string') return fallbackValue;
|
|
11
|
-
const num =
|
|
13
|
+
const num = parseFloat(value);
|
|
12
14
|
return isNaN(num) ? fallbackValue : num;
|
|
13
15
|
}
|
|
14
16
|
|
|
@@ -51,35 +53,35 @@ export type InputNumberProps = CommonProps<'size'> &
|
|
|
51
53
|
* @example
|
|
52
54
|
* import { InputNumber } from '@bspk/ui/InputNumber';
|
|
53
55
|
*
|
|
54
|
-
*
|
|
55
|
-
* const [state, setState] =
|
|
56
|
+
* () => {
|
|
57
|
+
* const [state, setState] = useState<number | undefined>();
|
|
56
58
|
*
|
|
57
59
|
* return (
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* name="example-name"
|
|
61
|
-
* onChange={(nextValue) => setState(nextValue)}
|
|
62
|
-
* value={state}
|
|
63
|
-
* />
|
|
64
|
-
* );
|
|
65
|
-
* }
|
|
66
|
-
*
|
|
67
|
-
* function ExampleWithField() {
|
|
68
|
-
* const [state, setState] = React.useState<number | undefined>();
|
|
69
|
-
*
|
|
70
|
-
* return (
|
|
71
|
-
* <Field>
|
|
72
|
-
* <FieldLabel>Example Input Number</FieldLabel>
|
|
60
|
+
* <>
|
|
61
|
+
* // standalone input number example
|
|
73
62
|
* <InputNumber
|
|
74
63
|
* aria-label="Example aria-label"
|
|
75
64
|
* name="example-name"
|
|
76
65
|
* onChange={(nextValue) => setState(nextValue)}
|
|
77
66
|
* value={state}
|
|
78
67
|
* />
|
|
79
|
-
* <
|
|
80
|
-
*
|
|
68
|
+
* <br />
|
|
69
|
+
* // input number used within a field
|
|
70
|
+
* <Field>
|
|
71
|
+
* <FieldLabel>Example Input Number</FieldLabel>
|
|
72
|
+
* <InputNumber
|
|
73
|
+
* aria-label="Example aria-label"
|
|
74
|
+
* name="example-name"
|
|
75
|
+
* onChange={(nextValue) => setState(nextValue)}
|
|
76
|
+
* value={state}
|
|
77
|
+
* />
|
|
78
|
+
* <FieldDescription>
|
|
79
|
+
* The input number allows you to increment or decrement a value.
|
|
80
|
+
* </FieldDescription>
|
|
81
|
+
* </Field>
|
|
82
|
+
* </>
|
|
81
83
|
* );
|
|
82
|
-
* }
|
|
84
|
+
* };
|
|
83
85
|
*
|
|
84
86
|
* @name InputNumber
|
|
85
87
|
* @phase UXReview
|
|
@@ -108,14 +110,25 @@ export function InputNumber({
|
|
|
108
110
|
readOnly,
|
|
109
111
|
invalidProp,
|
|
110
112
|
});
|
|
111
|
-
|
|
112
113
|
const max = typeof maxProp === 'number' && maxProp >= min ? maxProp : Number.MAX_SAFE_INTEGER;
|
|
113
114
|
const centered = align !== 'left';
|
|
114
115
|
const inputId = useId(id);
|
|
115
|
-
const value =
|
|
116
|
+
const value = isNumber(valueProp, min);
|
|
117
|
+
const removeDisabled = disabled || value + step * -1 < min;
|
|
118
|
+
const addDisabled = disabled || value + step > max;
|
|
119
|
+
|
|
120
|
+
const valueRef = useRef(value);
|
|
116
121
|
|
|
117
|
-
|
|
118
|
-
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
valueRef.current = value;
|
|
124
|
+
}, [value]);
|
|
125
|
+
|
|
126
|
+
const incrementHandler = (kind: 'add' | 'remove') => {
|
|
127
|
+
const increment = kind === 'add' ? step : step * -1;
|
|
128
|
+
const next = valueRef.current + increment;
|
|
129
|
+
if (next < min || next > max) return false;
|
|
130
|
+
onChange(next);
|
|
131
|
+
return true;
|
|
119
132
|
};
|
|
120
133
|
|
|
121
134
|
return (
|
|
@@ -128,14 +141,6 @@ export function InputNumber({
|
|
|
128
141
|
data-size={size}
|
|
129
142
|
data-stepper-input
|
|
130
143
|
>
|
|
131
|
-
{!!centered && (
|
|
132
|
-
<IncrementButton
|
|
133
|
-
disabled={disabled ? true : value + -1 < min}
|
|
134
|
-
increment={-1}
|
|
135
|
-
inputId={inputId}
|
|
136
|
-
onIncrement={handleIncrement}
|
|
137
|
-
/>
|
|
138
|
-
)}
|
|
139
144
|
<input
|
|
140
145
|
{...inputElementProps}
|
|
141
146
|
aria-describedby={ariaDescribedBy || undefined}
|
|
@@ -151,32 +156,29 @@ export function InputNumber({
|
|
|
151
156
|
max={max}
|
|
152
157
|
min={min}
|
|
153
158
|
name={name}
|
|
159
|
+
onBlur={(e) => {
|
|
160
|
+
const next = isNumber(e.target.value, min);
|
|
161
|
+
e.target.value = next?.toString() || '';
|
|
162
|
+
onChange(next);
|
|
163
|
+
}}
|
|
154
164
|
onChange={(e) => {
|
|
155
|
-
|
|
165
|
+
const next = isNumber(e.target.value, min);
|
|
166
|
+
onChange(next);
|
|
156
167
|
}}
|
|
157
168
|
readOnly={readOnly}
|
|
158
169
|
required={required}
|
|
159
170
|
step={step}
|
|
160
171
|
type="number"
|
|
161
|
-
value={value}
|
|
172
|
+
value={value !== undefined ? value : ''}
|
|
162
173
|
/>
|
|
163
|
-
|
|
164
|
-
<>
|
|
165
|
-
<div aria-hidden data-divider />
|
|
166
|
-
<IncrementButton
|
|
167
|
-
disabled={!!disabled || value + -1 < min}
|
|
168
|
-
increment={-1}
|
|
169
|
-
inputId={inputId}
|
|
170
|
-
onIncrement={handleIncrement}
|
|
171
|
-
/>
|
|
172
|
-
</>
|
|
173
|
-
)}
|
|
174
|
+
<div aria-hidden data-divider />
|
|
174
175
|
<IncrementButton
|
|
175
|
-
disabled={
|
|
176
|
-
increment={1}
|
|
176
|
+
disabled={removeDisabled}
|
|
177
177
|
inputId={inputId}
|
|
178
|
-
|
|
178
|
+
kind="remove"
|
|
179
|
+
triggerIncrement={incrementHandler}
|
|
179
180
|
/>
|
|
181
|
+
<IncrementButton disabled={addDisabled} inputId={inputId} kind="add" triggerIncrement={incrementHandler} />
|
|
180
182
|
</div>
|
|
181
183
|
);
|
|
182
184
|
}
|
|
@@ -129,6 +129,16 @@
|
|
|
129
129
|
--height: var(--spacing-sizing-12);
|
|
130
130
|
--svg-width: var(--spacing-sizing-06);
|
|
131
131
|
}
|
|
132
|
+
|
|
133
|
+
&[data-centered] {
|
|
134
|
+
button:first-of-type {
|
|
135
|
+
order: -1;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
[data-divider] {
|
|
139
|
+
display: none;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
132
142
|
}
|
|
133
143
|
|
|
134
144
|
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
@@ -59,25 +59,30 @@ export type InputPhoneProps = FieldControlProps<string, SupportedCountryCode> &
|
|
|
59
59
|
* @example
|
|
60
60
|
* import { InputPhone } from '@bspk/ui/InputPhone';
|
|
61
61
|
*
|
|
62
|
-
*
|
|
63
|
-
* const [value, onChange] =
|
|
64
|
-
*
|
|
65
|
-
* return <InputPhone aria-label="Phone Number" initialCountryCode="US" value={value} onChange={onChange} />;
|
|
66
|
-
* }
|
|
67
|
-
*
|
|
68
|
-
* function ExampleWithField() {
|
|
69
|
-
* const [value, onChange] = React.useState<number | undefined>();
|
|
62
|
+
* () => {
|
|
63
|
+
* const [value, onChange] = useState<number | undefined>();
|
|
70
64
|
*
|
|
71
65
|
* return (
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* <InputPhone aria-label="Phone Number" initialCountryCode="US" value={value} onChange={onChange}
|
|
75
|
-
* <
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
66
|
+
* <>
|
|
67
|
+
* // standalone input phone example
|
|
68
|
+
* <InputPhone aria-label="Phone Number" initialCountryCode="US" value={value} onChange={onChange} />;
|
|
69
|
+
* <br />
|
|
70
|
+
* // input phone used within a field
|
|
71
|
+
* <Field>
|
|
72
|
+
* <FieldLabel>Example Input Phone</FieldLabel>
|
|
73
|
+
* <InputPhone
|
|
74
|
+
* aria-label="Phone Number"
|
|
75
|
+
* initialCountryCode="US"
|
|
76
|
+
* value={value}
|
|
77
|
+
* onChange={onChange}
|
|
78
|
+
* />
|
|
79
|
+
* <FieldDescription>
|
|
80
|
+
* The phone input allows you to enter a phone number with country code.
|
|
81
|
+
* </FieldDescription>
|
|
82
|
+
* </Field>
|
|
83
|
+
* </>
|
|
79
84
|
* );
|
|
80
|
-
* }
|
|
85
|
+
* };
|
|
81
86
|
*
|
|
82
87
|
* @name InputPhone
|
|
83
88
|
* @phase UXReview
|