@bspk/ui 1.3.8 → 1.3.9
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/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/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/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/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/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/InputNumber.d.ts +20 -20
- package/dist/components/InputNumber/InputNumber.js +20 -20
- 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 +1 -3
- package/dist/components/OTPInput/OTPInput.js +1 -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/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/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 +24 -25
- package/dist/components/Select/Select.js +24 -25
- package/dist/components/Select/Select.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/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/Snackbar/Manager.d.ts +29 -0
- package/dist/components/Snackbar/Manager.js +35 -0
- package/dist/components/Snackbar/Manager.js.map +1 -0
- package/dist/components/Snackbar/Snackbar.d.ts +23 -5
- package/dist/components/Snackbar/Snackbar.js +23 -4
- 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 +2 -2
- package/dist/components/TabList/tab-list.css +0 -1
- package/dist/components/TabList/tab-list.css.js +0 -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/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/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/hooks/useAddEventListener.d.ts +1 -2
- package/dist/hooks/useAddEventListener.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/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/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/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 -3
- 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/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/Input/Input.tsx +13 -13
- package/src/components/Input/InputElement.tsx +11 -5
- package/src/components/InputNumber/InputNumber.tsx +20 -20
- 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 +1 -3
- package/src/components/PageControl/PageControl.tsx +1 -3
- 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/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 +24 -25
- package/src/components/Skeleton/Skeleton.tsx +10 -14
- package/src/components/Skeleton/SkeletonExample.tsx +5 -3
- 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/Snackbar/Manager.tsx +64 -0
- package/src/components/Snackbar/Snackbar.tsx +23 -6
- 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 +2 -2
- package/src/components/TabList/tab-list.scss +0 -1
- 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/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/Txt/Txt.tsx +1 -3
- package/src/components/UIProvider/AriaLiveMessageHandler.tsx +4 -2
- package/src/hooks/useAddEventListener.ts +1 -3
- package/src/hooks/useTimeout.ts +1 -5
- 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/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/hooks/usePaginationState.tsx +0 -24
|
@@ -44,13 +44,9 @@ export type TooltipProps = {
|
|
|
44
44
|
* import { Tooltip } from '@bspk/ui/Tooltip';
|
|
45
45
|
* import { Button } from '@bspk/ui/Button';
|
|
46
46
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* {(triggerProps) => <Button {...triggerProps}>Click me</Button>}
|
|
51
|
-
* </Tooltip>
|
|
52
|
-
* );
|
|
53
|
-
* }
|
|
47
|
+
* <Tooltip label="I explain what this button does" placement="top">
|
|
48
|
+
* {(triggerProps) => <Button {...triggerProps}>Click me</Button>}
|
|
49
|
+
* </Tooltip>;
|
|
54
50
|
*
|
|
55
51
|
* @name Tooltip
|
|
56
52
|
* @phase UXReview
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import { TooltipProps } from './Tooltip';
|
|
2
|
-
import { Button } from '-/components/Button';
|
|
3
2
|
import { ComponentExample } from '-/utils/demo';
|
|
4
3
|
|
|
5
4
|
export const TooltipExample: ComponentExample<TooltipProps> = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
defaultState: {
|
|
6
|
+
children: (triggerProps) => <span {...triggerProps}>Hover me</span>,
|
|
7
|
+
},
|
|
8
|
+
presets: [
|
|
9
|
+
{
|
|
10
|
+
label: 'Long Label Tooltip',
|
|
11
|
+
propState: {
|
|
12
|
+
label: 'This is a longer tooltip label to demonstrate how the tooltip handles more content.',
|
|
13
|
+
placement: 'top',
|
|
14
|
+
children: (triggerProps) => <span {...triggerProps}>Long Tooltip Label</span>,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: 'No Label',
|
|
19
|
+
propState: {
|
|
20
|
+
label: '',
|
|
21
|
+
placement: 'top',
|
|
22
|
+
children: (triggerProps) => <span {...triggerProps}>No Label</span>,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
render: ({ props, Component }) => {
|
|
27
|
+
return <Component {...props}>{props.children || (() => <span>No Hover</span>)}</Component>;
|
|
16
28
|
},
|
|
17
29
|
};
|
|
@@ -49,9 +49,7 @@ export type TxtProps<As extends ElementType = ElementType> = {
|
|
|
49
49
|
* @example
|
|
50
50
|
* import { Txt } from '@bspk/ui/Txt';
|
|
51
51
|
*
|
|
52
|
-
*
|
|
53
|
-
* return <Txt>Example Txt</Txt>;
|
|
54
|
-
* }
|
|
52
|
+
* <Txt>Example Txt</Txt>;
|
|
55
53
|
*
|
|
56
54
|
* @name Txt
|
|
57
55
|
* @phase UXReview
|
|
@@ -3,8 +3,10 @@ import { useEventListener } from '-/hooks/useAddEventListener';
|
|
|
3
3
|
import { useTimeout } from '-/hooks/useTimeout';
|
|
4
4
|
import { AriaLiveMessage } from '-/utils/uiContext';
|
|
5
5
|
|
|
6
|
+
const CUSTOM_EVENT_NAME = 'bspk-aria-live';
|
|
7
|
+
|
|
6
8
|
export function sendAriaLiveMessage(message: string, live: 'assertive' | 'polite' = 'polite') {
|
|
7
|
-
document.dispatchEvent(new CustomEvent(
|
|
9
|
+
document.dispatchEvent(new CustomEvent(CUSTOM_EVENT_NAME, { detail: { message, live } }));
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
/**
|
|
@@ -24,7 +26,7 @@ export function AriaLiveMessageHandler() {
|
|
|
24
26
|
const timeout = useTimeout();
|
|
25
27
|
|
|
26
28
|
useEventListener(
|
|
27
|
-
|
|
29
|
+
CUSTOM_EVENT_NAME,
|
|
28
30
|
(event: CustomEvent) => {
|
|
29
31
|
const { message, live } = event.detail;
|
|
30
32
|
// Clear any existing message to ensure that screen readers read the new message
|
|
@@ -2,15 +2,13 @@ import { useRef } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { useIsomorphicEffect } from './useIsomorphicEffect';
|
|
4
4
|
|
|
5
|
-
export type CustomEventName = 'aria-live';
|
|
6
|
-
|
|
7
5
|
export function useEventListener<
|
|
8
6
|
KW extends keyof WindowEventMap,
|
|
9
7
|
KH extends keyof HTMLElementEventMap & keyof SVGElementEventMap,
|
|
10
8
|
KM extends keyof MediaQueryListEventMap,
|
|
11
9
|
T extends Document | HTMLElement | MediaQueryList | SVGAElement | Window = HTMLElement,
|
|
12
10
|
>(
|
|
13
|
-
eventName:
|
|
11
|
+
eventName: KH | KM | KW | string,
|
|
14
12
|
handler: (
|
|
15
13
|
event:
|
|
16
14
|
| Event
|
package/src/hooks/useTimeout.ts
CHANGED
|
@@ -25,15 +25,11 @@ export type TimeoutHook = {
|
|
|
25
25
|
*
|
|
26
26
|
* @returns A ref object that can be used to store a timeout id.
|
|
27
27
|
*/
|
|
28
|
-
export function useTimeout(): TimeoutHook
|
|
29
|
-
export function useTimeout(initialCallback: () => void, durationMs: number): TimeoutHook;
|
|
30
|
-
export function useTimeout(initialCallback?: () => void, durationMs = 1000): TimeoutHook {
|
|
28
|
+
export function useTimeout(durationMs = 1000): TimeoutHook {
|
|
31
29
|
const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
32
30
|
|
|
33
31
|
useEffect(() => {
|
|
34
32
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
35
|
-
if (initialCallback) timeoutRef.current = setTimeout(initialCallback, durationMs);
|
|
36
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- only run at mount
|
|
37
33
|
}, []);
|
|
38
34
|
|
|
39
35
|
return useMemo(
|
package/src/types/common.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @bspk/ui/Txt".
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { IconName } from '@bspk/icons';
|
|
9
10
|
import {
|
|
10
11
|
JSXElementConstructor,
|
|
11
12
|
ReactNode,
|
|
@@ -40,6 +41,9 @@ export type DataProps = Record<`data-${string}`, string>;
|
|
|
40
41
|
|
|
41
42
|
export type ButtonSize = 'large' | 'medium' | 'small' | 'x-small';
|
|
42
43
|
|
|
44
|
+
/** The name of an icon in the Bspk icon library. */
|
|
45
|
+
export type BspkIcon = IconName;
|
|
46
|
+
|
|
43
47
|
export type CallToActionButton = {
|
|
44
48
|
/**
|
|
45
49
|
* The label of the call to action button.
|
package/src/types/meta.ts
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useEventListener } from '-/hooks/useAddEventListener';
|
|
2
|
+
|
|
3
|
+
export type CustomEventDetail =
|
|
4
|
+
| Array<CustomEventDetail>
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
6
|
+
| Function
|
|
7
|
+
| boolean
|
|
8
|
+
| number
|
|
9
|
+
| string
|
|
10
|
+
| { [key: string]: CustomEventDetail }
|
|
11
|
+
| null
|
|
12
|
+
| undefined;
|
|
13
|
+
|
|
14
|
+
export type CustomEventHandler<TDetail extends CustomEventDetail> = (detail: TDetail) => void;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Like React.createContext but for custom events using the DOM's CustomEvent system.
|
|
18
|
+
*
|
|
19
|
+
* This allows for communication between components without using React.Context, which can cause unnecessary re-renders.
|
|
20
|
+
*
|
|
21
|
+
* This generator ensures only safe detail types are used. !important;
|
|
22
|
+
*/
|
|
23
|
+
export function createCustomEvent<TDetail extends CustomEventDetail>(
|
|
24
|
+
/** The name of the custom event to create. Prefix with 'bspk-' to avoid conflicts. */
|
|
25
|
+
eventName: string,
|
|
26
|
+
) {
|
|
27
|
+
return {
|
|
28
|
+
send(detail: TDetail) {
|
|
29
|
+
document.dispatchEvent(new CustomEvent<TDetail>(eventName, { detail }));
|
|
30
|
+
},
|
|
31
|
+
useEventListener(listener: CustomEventHandler<TDetail>) {
|
|
32
|
+
useEventListener(eventName, (event) => listener((event as CustomEvent<TDetail>).detail), document);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */ import { SvgContentCopy } from '@bspk/icons/ContentCopy';
|
|
2
2
|
import { SvgDiamond } from '@bspk/icons/Diamond';
|
|
3
3
|
import { DemoAction, DemoSetState } from './demo';
|
|
4
|
-
|
|
5
4
|
import { Avatar } from '-/components/Avatar';
|
|
5
|
+
import { Button } from '-/components/Button';
|
|
6
6
|
import { Checkbox } from '-/components/Checkbox';
|
|
7
7
|
import { Img } from '-/components/Img';
|
|
8
|
-
import { ListItem } from '-/components/ListItem';
|
|
9
8
|
import { Radio } from '-/components/Radio';
|
|
10
9
|
import { Switch } from '-/components/Switch';
|
|
11
10
|
import { Tag } from '-/components/Tag';
|
|
@@ -55,14 +54,10 @@ export function createExampleChildElement({ exampleState, name, setState, action
|
|
|
55
54
|
};
|
|
56
55
|
}
|
|
57
56
|
|
|
58
|
-
if (componentName === '
|
|
57
|
+
if (componentName === 'Button')
|
|
59
58
|
return {
|
|
60
59
|
element: (
|
|
61
|
-
<ListItem
|
|
62
|
-
icon={<SvgContentCopy />}
|
|
63
|
-
label="LI Button"
|
|
64
|
-
onClick={() => action('ListItem button clicked')}
|
|
65
|
-
/>
|
|
60
|
+
<Button icon={<SvgContentCopy />} label="LI Button" onClick={() => action('ListItem button clicked')} />
|
|
66
61
|
),
|
|
67
62
|
componentName,
|
|
68
63
|
};
|
package/src/utils/demo.ts
CHANGED
|
@@ -2,22 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { CSSProperties, ReactNode } from 'react';
|
|
4
4
|
import { AlertVariant, DataProps } from '-/types/common';
|
|
5
|
-
import { ComponentMeta } from '-/types/meta';
|
|
6
|
-
|
|
7
|
-
export type TypeProperty = {
|
|
8
|
-
name: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
type?: string[] | string;
|
|
11
|
-
default?: unknown;
|
|
12
|
-
required?: boolean;
|
|
13
|
-
options?: number[] | string[];
|
|
14
|
-
variants?: string[];
|
|
15
|
-
references?: string[];
|
|
16
|
-
minimum?: number;
|
|
17
|
-
maximum?: number;
|
|
18
|
-
example?: string;
|
|
19
|
-
exampleType?: string;
|
|
20
|
-
};
|
|
5
|
+
import { ComponentMeta, TypeProperty } from '-/types/meta';
|
|
21
6
|
|
|
22
7
|
export type DemoAction = (message: string, variant?: AlertVariant) => void;
|
|
23
8
|
|
|
@@ -59,8 +44,24 @@ export type ComponentVariantOverride<Props> = {
|
|
|
59
44
|
[K in keyof Props]?: Props[K] | { options: Props[K][] };
|
|
60
45
|
};
|
|
61
46
|
|
|
47
|
+
export type ComponentPageSection<Props = Record<string, unknown>> = {
|
|
48
|
+
title: string;
|
|
49
|
+
content: (params: {
|
|
50
|
+
Component?: React.ComponentType<Props>;
|
|
51
|
+
props: Props;
|
|
52
|
+
CodeExample: CodeExample;
|
|
53
|
+
Syntax: Syntax;
|
|
54
|
+
}) => React.ReactNode;
|
|
55
|
+
location?: 'afterDemo' | 'beforeDemo';
|
|
56
|
+
};
|
|
57
|
+
|
|
62
58
|
export type ComponentVariantOverrides<Props = Record<string, unknown>, PropName extends keyof Props = keyof Props> = {
|
|
63
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Hide the variant entirely by setting to false.
|
|
61
|
+
*
|
|
62
|
+
* Set specific prop overrides for the variant. e.g. when demoing iconOnly, we want to set the icon prop.
|
|
63
|
+
*/
|
|
64
|
+
[Key in PropName]?: ComponentVariantOverride<Props> | false;
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
export type ComponentExample<Props = Record<string, unknown>, PropName extends keyof Props = keyof Props> = {
|
|
@@ -106,16 +107,7 @@ export type ComponentExample<Props = Record<string, unknown>, PropName extends k
|
|
|
106
107
|
*/
|
|
107
108
|
disableProps?: PropName[] | true;
|
|
108
109
|
/** The sections of the example. */
|
|
109
|
-
sections?:
|
|
110
|
-
title: string;
|
|
111
|
-
content: (params: {
|
|
112
|
-
Component: React.ComponentType<Props>;
|
|
113
|
-
props: Props;
|
|
114
|
-
CodeExample: CodeExample;
|
|
115
|
-
Syntax: Syntax;
|
|
116
|
-
}) => React.ReactNode;
|
|
117
|
-
location?: 'afterDemo' | 'beforeDemo';
|
|
118
|
-
}[];
|
|
110
|
+
sections?: ComponentPageSection<Props>[];
|
|
119
111
|
};
|
|
120
112
|
|
|
121
113
|
export type Syntax = (params: {
|
|
@@ -148,6 +140,11 @@ export type ComponentExampleFn<Props = Record<string, unknown>> = (params: {
|
|
|
148
140
|
export type OnHandlers = `on${string}`;
|
|
149
141
|
|
|
150
142
|
export type Preset<Props> = {
|
|
143
|
+
/**
|
|
144
|
+
* A description of the design pattern this preset demonstrates. When applied, it showcases the specific use case or
|
|
145
|
+
* behavior of the component.
|
|
146
|
+
*/
|
|
147
|
+
designPattern?: string;
|
|
151
148
|
/** The name of the preset. This is used to display the preset in the UI. */
|
|
152
149
|
label: string;
|
|
153
150
|
/** The props of the component. This is used to set props of the component. These values can't be changed in the UI. */
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button } from '../Button';
|
|
3
|
-
// A button that can be used as a trailing element in a ListItem.
|
|
4
|
-
export function ListItemButton({ label, icon, ...buttonProps }) {
|
|
5
|
-
return _jsx(Button, { icon: icon, iconOnly: true, label: label, ...buttonProps, size: "large", variant: "tertiary" });
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=ListItemButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemButton.js","sourceRoot":"","sources":["../../../src/components/ListItem/ListItemButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAe,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D,iEAAiE;AACjE,MAAM,UAAU,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,WAAW,EAAmD;IAC3G,OAAO,KAAC,MAAM,IAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,QAAC,KAAK,EAAE,KAAK,KAAM,WAAW,EAAE,IAAI,EAAC,OAAO,EAAC,OAAO,EAAC,UAAU,GAAG,CAAC;AAC1G,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import { Input } from '../Input';
|
|
4
|
-
import { Txt } from '../Txt';
|
|
5
|
-
export const PageInput = ({ numPages, onChange, value }) => {
|
|
6
|
-
const [page, setPage] = useState(String(value));
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
const stringValue = String(value);
|
|
9
|
-
if (stringValue !== page) {
|
|
10
|
-
setPage(stringValue);
|
|
11
|
-
}
|
|
12
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13
|
-
}, [value]);
|
|
14
|
-
const handleChange = (val) => {
|
|
15
|
-
const pageNumber = parseInt(val, 10);
|
|
16
|
-
const isValidPageNumber = !isNaN(pageNumber) && pageNumber >= 1 && pageNumber <= numPages;
|
|
17
|
-
if (isValidPageNumber || val === '') {
|
|
18
|
-
setPage(val);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const handleSubmit = () => {
|
|
22
|
-
const pageNumber = parseInt(page, 10);
|
|
23
|
-
if (!isNaN(pageNumber) && pageNumber >= 1 && pageNumber <= numPages) {
|
|
24
|
-
onChange(pageNumber);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
setPage(String(value));
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const pageCountMessage = `of ${numPages}`;
|
|
31
|
-
return (_jsx("form", { onSubmit: (e) => {
|
|
32
|
-
e.preventDefault();
|
|
33
|
-
handleSubmit();
|
|
34
|
-
}, style: { display: 'contents' }, children: _jsxs("div", { "data-bspk": "page-input", children: [_jsx(Input, { "aria-label": "Page input", name: "page-input", onBlur: handleSubmit, onChange: handleChange, showClearButton: false, size: "small", value: page }), _jsx(Txt, { variant: "body-small", children: pageCountMessage })] }) }));
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=PageInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PageInput.js","sourceRoot":"","sources":["../../../src/components/Pagination/PageInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAIvC,MAAM,CAAC,MAAM,SAAS,GAAuB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3E,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAS,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAExD,SAAS,CAAC,GAAG,EAAE;QACX,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAElC,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;YACvB,OAAO,CAAC,WAAW,CAAC,CAAC;QACzB,CAAC;QACD,uDAAuD;IAC3D,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,EAAE;QACjC,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACrC,MAAM,iBAAiB,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,UAAU,IAAI,CAAC,IAAI,UAAU,IAAI,QAAQ,CAAC;QAE1F,IAAI,iBAAiB,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjB,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,GAAG,EAAE;QACtB,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAEtC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,UAAU,IAAI,CAAC,IAAI,UAAU,IAAI,QAAQ,EAAE,CAAC;YAClE,QAAQ,CAAC,UAAU,CAAC,CAAC;QACzB,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC3B,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,gBAAgB,GAAG,MAAM,QAAQ,EAAE,CAAC;IAE1C,OAAO,CACH,eACI,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACZ,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,YAAY,EAAE,CAAC;QACnB,CAAC,EACD,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,YAE9B,4BAAe,YAAY,aACvB,KAAC,KAAK,kBACS,YAAY,EACvB,IAAI,EAAC,YAAY,EACjB,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,YAAY,EACtB,eAAe,EAAE,KAAK,EACtB,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,IAAI,GACb,EAEF,KAAC,GAAG,IAAC,OAAO,EAAC,YAAY,YAAE,gBAAgB,GAAO,IAChD,GACH,CACV,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
/*
|
|
3
|
-
* A hook to manage the state of pagination.
|
|
4
|
-
|
|
5
|
-
* @param numPages - The total number of pages.
|
|
6
|
-
* @param initialPage - The initial page to start on (default is 1).
|
|
7
|
-
* @returns An object containing the current page and a function to set the current page.
|
|
8
|
-
*/
|
|
9
|
-
export const usePaginationState = (numPages, initialPage) => {
|
|
10
|
-
const [currentPage, setCurrentPage] = useState(initialPage || 1);
|
|
11
|
-
const setPage = (page) => {
|
|
12
|
-
if (page < 1 || page > numPages) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
setCurrentPage(page);
|
|
16
|
-
};
|
|
17
|
-
return {
|
|
18
|
-
currentPage,
|
|
19
|
-
setCurrentPage: setPage,
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=usePaginationState.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePaginationState.js","sourceRoot":"","sources":["../../src/hooks/usePaginationState.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC;;;;;;MAMM;AACN,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAE,WAAoB,EAAE,EAAE;IACzE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC;IAEjE,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE;QAC7B,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,QAAQ,EAAE,CAAC;YAC9B,OAAO;QACX,CAAC;QACD,cAAc,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC,CAAC;IAEF,OAAO;QACH,WAAW;QACX,cAAc,EAAE,OAAO;KAC1B,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ButtonProps, Button } from '-/components/Button';
|
|
2
|
-
|
|
3
|
-
// A button that can be used as a trailing element in a ListItem.
|
|
4
|
-
export function ListItemButton({ label, icon, ...buttonProps }: Pick<ButtonProps, 'icon' | 'label' | 'onClick'>) {
|
|
5
|
-
return <Button icon={icon} iconOnly label={label} {...buttonProps} size="large" variant="tertiary" />;
|
|
6
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { FC, useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { PaginationProps } from './Pagination';
|
|
4
|
-
import { Input } from '-/components/Input';
|
|
5
|
-
import { Txt } from '-/components/Txt';
|
|
6
|
-
|
|
7
|
-
export type PageInputProps = Pick<PaginationProps, 'numPages' | 'onChange' | 'value'>;
|
|
8
|
-
|
|
9
|
-
export const PageInput: FC<PageInputProps> = ({ numPages, onChange, value }) => {
|
|
10
|
-
const [page, setPage] = useState<string>(String(value));
|
|
11
|
-
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
const stringValue = String(value);
|
|
14
|
-
|
|
15
|
-
if (stringValue !== page) {
|
|
16
|
-
setPage(stringValue);
|
|
17
|
-
}
|
|
18
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19
|
-
}, [value]);
|
|
20
|
-
|
|
21
|
-
const handleChange = (val: string) => {
|
|
22
|
-
const pageNumber = parseInt(val, 10);
|
|
23
|
-
const isValidPageNumber = !isNaN(pageNumber) && pageNumber >= 1 && pageNumber <= numPages;
|
|
24
|
-
|
|
25
|
-
if (isValidPageNumber || val === '') {
|
|
26
|
-
setPage(val);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const handleSubmit = () => {
|
|
31
|
-
const pageNumber = parseInt(page, 10);
|
|
32
|
-
|
|
33
|
-
if (!isNaN(pageNumber) && pageNumber >= 1 && pageNumber <= numPages) {
|
|
34
|
-
onChange(pageNumber);
|
|
35
|
-
} else {
|
|
36
|
-
setPage(String(value));
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const pageCountMessage = `of ${numPages}`;
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<form
|
|
44
|
-
onSubmit={(e) => {
|
|
45
|
-
e.preventDefault();
|
|
46
|
-
handleSubmit();
|
|
47
|
-
}}
|
|
48
|
-
style={{ display: 'contents' }}
|
|
49
|
-
>
|
|
50
|
-
<div data-bspk="page-input">
|
|
51
|
-
<Input
|
|
52
|
-
aria-label="Page input"
|
|
53
|
-
name="page-input"
|
|
54
|
-
onBlur={handleSubmit}
|
|
55
|
-
onChange={handleChange}
|
|
56
|
-
showClearButton={false}
|
|
57
|
-
size="small"
|
|
58
|
-
value={page}
|
|
59
|
-
/>
|
|
60
|
-
|
|
61
|
-
<Txt variant="body-small">{pageCountMessage}</Txt>
|
|
62
|
-
</div>
|
|
63
|
-
</form>
|
|
64
|
-
);
|
|
65
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* A hook to manage the state of pagination.
|
|
5
|
-
|
|
6
|
-
* @param numPages - The total number of pages.
|
|
7
|
-
* @param initialPage - The initial page to start on (default is 1).
|
|
8
|
-
* @returns An object containing the current page and a function to set the current page.
|
|
9
|
-
*/
|
|
10
|
-
export const usePaginationState = (numPages: number, initialPage?: number) => {
|
|
11
|
-
const [currentPage, setCurrentPage] = useState(initialPage || 1);
|
|
12
|
-
|
|
13
|
-
const setPage = (page: number) => {
|
|
14
|
-
if (page < 1 || page > numPages) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
setCurrentPage(page);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
currentPage,
|
|
22
|
-
setCurrentPage: setPage,
|
|
23
|
-
};
|
|
24
|
-
};
|