@bspk/ui 1.3.11 → 1.3.17
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 +22 -20
- package/dist/components/Accordion/Accordion.js +22 -20
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Accordion/AccordionExample.js +5 -4
- package/dist/components/Accordion/AccordionExample.js.map +1 -1
- package/dist/components/Avatar/Avatar.d.ts +1 -2
- package/dist/components/Avatar/Avatar.js +2 -3
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Avatar/avatar.css +13 -8
- package/dist/components/Avatar/avatar.css.js +13 -8
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.js +1 -1
- package/dist/components/Badge/Badge.d.ts +1 -1
- package/dist/components/Badge/Badge.js +1 -1
- package/dist/components/Badge/BadgeExample.js +0 -1
- package/dist/components/Badge/BadgeExample.js.map +1 -1
- package/dist/components/BadgeDot/BadgeDot.d.ts +1 -1
- package/dist/components/BadgeDot/BadgeDot.js +1 -1
- package/dist/components/BadgeDot/BadgeDotExample.js +0 -1
- package/dist/components/BadgeDot/BadgeDotExample.js.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.d.ts +14 -12
- package/dist/components/BannerAlert/BannerAlert.js +14 -12
- package/dist/components/BannerAlert/BannerAlert.js.map +1 -1
- package/dist/components/BannerAlert/BannerAlertExample.js +0 -1
- package/dist/components/BannerAlert/BannerAlertExample.js.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +20 -18
- package/dist/components/Breadcrumb/Breadcrumb.js +20 -18
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/Button/Button.d.ts +29 -4
- package/dist/components/Button/Button.js +33 -8
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/button.css +4 -3
- package/dist/components/Button/button.css.js +4 -3
- package/dist/components/Calendar/Calendar.d.ts +5 -41
- package/dist/components/Calendar/Calendar.js +61 -185
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/Calendar/CalendarExample.js +0 -1
- package/dist/components/Calendar/CalendarExample.js.map +1 -1
- package/dist/components/Calendar/calendar.css +35 -28
- package/dist/components/Calendar/calendar.css.js +35 -28
- package/dist/components/Calendar/index.d.ts +1 -0
- package/dist/components/Calendar/index.js +1 -0
- package/dist/components/Calendar/index.js.map +1 -1
- package/dist/components/Calendar/utils.d.ts +11 -0
- package/dist/components/Calendar/utils.js +76 -0
- package/dist/components/Calendar/utils.js.map +1 -0
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/Card.js +1 -1
- package/dist/components/Carousel/Carousel.d.ts +8 -8
- package/dist/components/Carousel/Carousel.js +8 -8
- package/dist/components/Carousel/carousel.css +0 -1
- package/dist/components/Carousel/carousel.css.js +0 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/Checkbox/checkbox.css +3 -1
- package/dist/components/Checkbox/checkbox.css.js +3 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/dist/components/CheckboxGroup/checkbox-group.css +1 -1
- package/dist/components/CheckboxGroup/checkbox-group.css.js +1 -1
- package/dist/components/CheckboxGroupField/CheckboxGroupField.d.ts +1 -1
- package/dist/components/CheckboxGroupField/CheckboxGroupField.js +1 -1
- package/dist/components/CheckboxOption/CheckboxOption.d.ts +1 -1
- package/dist/components/CheckboxOption/CheckboxOption.js +1 -1
- package/dist/components/Chip/Chip.d.ts +1 -1
- package/dist/components/Chip/Chip.js +1 -1
- package/dist/components/ChipGroup/ChipGroup.d.ts +1 -1
- package/dist/components/ChipGroup/ChipGroup.js +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +23 -11
- package/dist/components/DatePicker/DatePicker.js +20 -83
- package/dist/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/DatePicker/DatePickerExample.d.ts +1 -0
- package/dist/components/DatePicker/DatePickerExample.js +10 -2
- package/dist/components/DatePicker/DatePickerExample.js.map +1 -1
- package/dist/components/DatePicker/date-picker.css +9 -0
- package/dist/components/DatePicker/date-picker.css.js +9 -0
- package/dist/components/DatePickerField/DatePickerField.d.ts +1 -1
- package/dist/components/DatePickerField/DatePickerField.js +1 -1
- package/dist/components/Divider/Divider.d.ts +4 -4
- package/dist/components/Divider/Divider.js +4 -4
- package/dist/components/Divider/DividerExample.js +17 -20
- package/dist/components/Divider/DividerExample.js.map +1 -1
- package/dist/components/Drawer/Drawer.d.ts +8 -10
- package/dist/components/Drawer/Drawer.js +9 -12
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/Drawer/DrawerExample.d.ts +1 -0
- package/dist/components/Drawer/DrawerExample.js +10 -4
- package/dist/components/Drawer/DrawerExample.js.map +1 -1
- package/dist/components/Drawer/drawer.css +6 -0
- package/dist/components/Drawer/drawer.css.js +6 -0
- package/dist/components/EmptyState/EmptyState.d.ts +2 -2
- package/dist/components/EmptyState/EmptyState.js +4 -7
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/EmptyState/EmptyStateExample.js +5 -6
- package/dist/components/EmptyState/EmptyStateExample.js.map +1 -1
- package/dist/components/ExamplePlaceholder/ExamplePlaceholder.d.ts +6 -13
- package/dist/components/ExamplePlaceholder/ExamplePlaceholder.js +12 -7
- package/dist/components/ExamplePlaceholder/ExamplePlaceholder.js.map +1 -1
- package/dist/components/Fab/Fab.d.ts +5 -3
- package/dist/components/Fab/Fab.js +8 -6
- package/dist/components/Fab/Fab.js.map +1 -1
- package/dist/components/Fab/FabExample.d.ts +1 -0
- package/dist/components/Fab/FabExample.js +6 -0
- package/dist/components/Fab/FabExample.js.map +1 -1
- package/dist/components/Fab/fab.css +5 -3
- package/dist/components/Fab/fab.css.js +5 -3
- package/dist/components/FileUpload/FileUpload.d.ts +1 -1
- package/dist/components/FileUpload/FileUpload.js +1 -1
- package/dist/components/FileUploadItem/FileUploadItem.d.ts +1 -1
- package/dist/components/FileUploadItem/FileUploadItem.js +1 -1
- package/dist/components/Flex/Flex.d.ts +55 -0
- package/dist/components/Flex/Flex.js +38 -0
- package/dist/components/Flex/Flex.js.map +1 -0
- package/dist/components/Flex/FlexExample.d.ts +5 -0
- package/dist/components/Flex/FlexExample.js +13 -0
- package/dist/components/Flex/FlexExample.js.map +1 -0
- package/dist/components/Flex/index.d.ts +1 -0
- package/dist/components/Flex/index.js +2 -0
- package/dist/components/Flex/index.js.map +1 -0
- package/dist/components/FormField/FormFieldExample.js +0 -1
- package/dist/components/FormField/FormFieldExample.js.map +1 -1
- package/dist/components/Grid/Grid.d.ts +48 -0
- package/dist/components/Grid/Grid.js +36 -0
- package/dist/components/Grid/Grid.js.map +1 -0
- package/dist/components/Grid/GridExample.d.ts +3 -0
- package/dist/components/Grid/GridExample.js +28 -0
- package/dist/components/Grid/GridExample.js.map +1 -0
- package/dist/components/Grid/index.d.ts +1 -0
- package/dist/components/Grid/index.js +2 -0
- package/dist/components/Grid/index.js.map +1 -0
- package/dist/components/InlineAlert/InlineAlert.d.ts +1 -1
- package/dist/components/InlineAlert/InlineAlert.js +1 -1
- package/dist/components/Input/Input.d.ts +5 -9
- package/dist/components/Input/Input.js +5 -9
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/InputElement.js +3 -6
- package/dist/components/Input/InputElement.js.map +1 -1
- package/dist/components/Input/InputExample.d.ts +1 -0
- package/dist/components/Input/InputExample.js +10 -1
- package/dist/components/Input/InputExample.js.map +1 -1
- package/dist/components/Input/input.css +6 -1
- package/dist/components/Input/input.css.js +6 -1
- package/dist/components/InputField/InputField.d.ts +1 -1
- package/dist/components/InputField/InputField.js +1 -1
- package/dist/components/InputNumber/InputNumber.d.ts +6 -15
- package/dist/components/InputNumber/InputNumber.js +6 -15
- package/dist/components/InputNumber/InputNumber.js.map +1 -1
- package/dist/components/InputNumber/InputNumberExample.d.ts +1 -0
- package/dist/components/InputNumber/InputNumberExample.js +10 -1
- package/dist/components/InputNumber/InputNumberExample.js.map +1 -1
- package/dist/components/InputNumber/input-number.css +6 -4
- package/dist/components/InputNumber/input-number.css.js +6 -4
- package/dist/components/InputNumberField/InputNumberField.d.ts +1 -1
- package/dist/components/InputNumberField/InputNumberField.js +1 -1
- package/dist/components/InputPhone/InputPhone.d.ts +7 -9
- package/dist/components/InputPhone/InputPhone.js +19 -19
- package/dist/components/InputPhone/InputPhone.js.map +1 -1
- package/dist/components/InputPhone/InputPhoneExample.d.ts +2 -1
- package/dist/components/InputPhone/InputPhoneExample.js +9 -1
- package/dist/components/InputPhone/InputPhoneExample.js.map +1 -1
- package/dist/components/InputPhoneField/InputPhoneField.d.ts +1 -1
- package/dist/components/InputPhoneField/InputPhoneField.js +1 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/Link/Link.js +1 -1
- package/dist/components/ListItem/ListItem.d.ts +1 -1
- package/dist/components/ListItem/ListItem.js +1 -1
- package/dist/components/Menu/Menu.d.ts +1 -3
- package/dist/components/Menu/Menu.js +1 -3
- package/dist/components/Menu/Menu.js.map +1 -1
- package/dist/components/Modal/Modal.d.ts +1 -3
- package/dist/components/Modal/Modal.js +2 -4
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/OTPInput/OTPInput.d.ts +1 -1
- package/dist/components/OTPInput/OTPInput.js +1 -1
- package/dist/components/OTPInput/OTPInputExample.js +0 -1
- package/dist/components/OTPInput/OTPInputExample.js.map +1 -1
- package/dist/components/PageControl/PageControl.d.ts +1 -1
- package/dist/components/PageControl/PageControl.js +1 -1
- package/dist/components/PageControl/PageControlExample.js +0 -1
- package/dist/components/PageControl/PageControlExample.js.map +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts +57 -0
- package/dist/components/PageHeader/PageHeader.js +28 -0
- package/dist/components/PageHeader/PageHeader.js.map +1 -0
- package/dist/components/PageHeader/PageHeaderExample.d.ts +4 -0
- package/dist/components/PageHeader/PageHeaderExample.js +56 -0
- package/dist/components/PageHeader/PageHeaderExample.js.map +1 -0
- package/dist/components/PageHeader/index.d.ts +1 -0
- package/dist/components/PageHeader/index.js +2 -0
- package/dist/components/PageHeader/index.js.map +1 -0
- package/dist/components/PageHeader/page-header.css +35 -0
- package/dist/components/PageHeader/page-header.css.js +40 -0
- package/dist/components/Pagination/Pagination.d.ts +2 -2
- package/dist/components/Pagination/Pagination.js +8 -3
- package/dist/components/Pagination/Pagination.js.map +1 -1
- package/dist/components/Pagination/pagination.css +8 -2
- package/dist/components/Pagination/pagination.css.js +8 -2
- package/dist/components/Password/Password.d.ts +11 -16
- package/dist/components/Password/Password.js +11 -16
- package/dist/components/Password/Password.js.map +1 -1
- package/dist/components/Password/PasswordExample.d.ts +1 -0
- package/dist/components/Password/PasswordExample.js +9 -0
- package/dist/components/Password/PasswordExample.js.map +1 -1
- package/dist/components/PasswordField/PasswordField.d.ts +1 -1
- package/dist/components/PasswordField/PasswordField.js +1 -1
- package/dist/components/Popover/Popover.d.ts +1 -1
- package/dist/components/Popover/Popover.js +1 -1
- package/dist/components/Popover/PopoverExample.js +0 -1
- package/dist/components/Popover/PopoverExample.js.map +1 -1
- package/dist/components/Popover/popover.css +7 -5
- package/dist/components/Popover/popover.css.js +7 -5
- package/dist/components/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/components/ProgressBar/ProgressBar.js +1 -1
- package/dist/components/ProgressCircle/ProgressCircle.d.ts +1 -1
- package/dist/components/ProgressCircle/ProgressCircle.js +1 -1
- package/dist/components/ProgressionStepper/ProgressionStepper.d.ts +1 -1
- package/dist/components/ProgressionStepper/ProgressionStepper.js +1 -1
- package/dist/components/ProgressionStepper/ProgressionStepperExample.js +0 -1
- package/dist/components/ProgressionStepper/ProgressionStepperExample.js.map +1 -1
- package/dist/components/ProgressionStepper/progression-stepper.css +5 -3
- package/dist/components/ProgressionStepper/progression-stepper.css.js +5 -3
- package/dist/components/ProgressionStepperBar/ProgressionStepperBar.d.ts +1 -1
- package/dist/components/ProgressionStepperBar/ProgressionStepperBar.js +1 -1
- package/dist/components/ProgressionStepperBar/progression-stepper-bar.css +6 -6
- package/dist/components/ProgressionStepperBar/progression-stepper-bar.css.js +7 -7
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/RadioGroup/radio-group.css +1 -1
- package/dist/components/RadioGroup/radio-group.css.js +1 -1
- package/dist/components/RadioGroupField/RadioGroupField.d.ts +1 -1
- package/dist/components/RadioGroupField/RadioGroupField.js +1 -1
- package/dist/components/Rating/Rating.d.ts +3 -2
- package/dist/components/Rating/Rating.js +5 -3
- package/dist/components/Rating/Rating.js.map +1 -1
- package/dist/components/SearchBar/SearchBar.d.ts +1 -1
- package/dist/components/SearchBar/SearchBar.js +3 -4
- package/dist/components/SearchBar/SearchBar.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/components/SegmentedControl/segmented-control.css +3 -1
- package/dist/components/SegmentedControl/segmented-control.css.js +3 -1
- package/dist/components/Select/Select.d.ts +11 -24
- package/dist/components/Select/Select.js +11 -24
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/SelectExample.d.ts +1 -0
- package/dist/components/Select/SelectExample.js +18 -1
- package/dist/components/Select/SelectExample.js.map +1 -1
- package/dist/components/SelectField/SelectField.d.ts +1 -1
- package/dist/components/SelectField/SelectField.js +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/SkeletonText/SkeletonText.d.ts +1 -1
- package/dist/components/SkeletonText/SkeletonText.js +1 -1
- package/dist/components/Slider/Slider.d.ts +18 -3
- package/dist/components/Slider/Slider.js +20 -4
- package/dist/components/Slider/Slider.js.map +1 -1
- package/dist/components/Slider/SliderExample.d.ts +1 -0
- package/dist/components/Slider/SliderExample.js +7 -2
- package/dist/components/Slider/SliderExample.js.map +1 -1
- package/dist/components/Snackbar/Manager.d.ts +1 -1
- package/dist/components/Snackbar/Manager.js +1 -1
- package/dist/components/Snackbar/Snackbar.d.ts +1 -1
- package/dist/components/Snackbar/Snackbar.js +1 -1
- package/dist/components/Snackbar/SnackbarExample.js +0 -1
- package/dist/components/Snackbar/SnackbarExample.js.map +1 -1
- package/dist/components/Switch/Switch.d.ts +1 -1
- package/dist/components/Switch/Switch.js +1 -1
- package/dist/components/Switch/switch.css +11 -9
- package/dist/components/Switch/switch.css.js +11 -9
- package/dist/components/SwitchOption/SwitchOption.d.ts +1 -1
- package/dist/components/SwitchOption/SwitchOption.js +1 -1
- package/dist/components/TabGroup/TabGroup.d.ts +1 -1
- package/dist/components/TabGroup/TabGroup.js +1 -1
- package/dist/components/TabGroup/TabGroupExample.js +0 -1
- package/dist/components/TabGroup/TabGroupExample.js.map +1 -1
- package/dist/components/TabList/TabListExample.js +0 -1
- package/dist/components/TabList/TabListExample.js.map +1 -1
- package/dist/components/TabList/tab-list.css +5 -3
- package/dist/components/TabList/tab-list.css.js +5 -3
- package/dist/components/Table/Table.d.ts +2 -2
- package/dist/components/Table/Table.js +8 -8
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/TableExample.js +56 -54
- package/dist/components/Table/TableExample.js.map +1 -1
- package/dist/components/Table/utils.d.ts +2 -2
- package/dist/components/Table/utils.js +27 -22
- package/dist/components/Table/utils.js.map +1 -1
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/components/Tag/Tag.js +1 -1
- package/dist/components/Textarea/Textarea.d.ts +5 -8
- package/dist/components/Textarea/Textarea.js +5 -8
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/Textarea/TextareaExample.d.ts +1 -0
- package/dist/components/Textarea/TextareaExample.js +12 -1
- package/dist/components/Textarea/TextareaExample.js.map +1 -1
- package/dist/components/Textarea/textarea.css +5 -3
- package/dist/components/Textarea/textarea.css.js +5 -3
- package/dist/components/TextareaField/TextareaField.d.ts +1 -1
- package/dist/components/TextareaField/TextareaField.js +1 -1
- package/dist/components/TimePicker/TimePicker.d.ts +5 -9
- package/dist/components/TimePicker/TimePicker.js +5 -9
- package/dist/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/components/TimePicker/TimePickerExample.d.ts +1 -0
- package/dist/components/TimePicker/TimePickerExample.js +9 -1
- package/dist/components/TimePicker/TimePickerExample.js.map +1 -1
- package/dist/components/TimePickerField/TimePickerField.d.ts +1 -1
- package/dist/components/TimePickerField/TimePickerField.js +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +2 -2
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Tooltip/tooltip.css +7 -3
- package/dist/components/Tooltip/tooltip.css.js +7 -3
- package/dist/components/Txt/Txt.d.ts +1 -1
- package/dist/components/Txt/Txt.js +1 -1
- package/dist/components/UIProvider/UIProvider.js +4 -6
- package/dist/components/UIProvider/UIProvider.js.map +1 -1
- package/dist/components/UIProvider/UIProviderExample.d.ts +0 -1
- package/dist/components/UIProvider/UIProviderExample.js +1 -46
- package/dist/components/UIProvider/UIProviderExample.js.map +1 -1
- package/dist/hooks/useControlledState.d.ts +7 -0
- package/dist/hooks/useControlledState.js +21 -0
- package/dist/hooks/useControlledState.js.map +1 -0
- package/dist/hooks/{useAddEventListener.js → useEventListener.js} +1 -1
- package/dist/hooks/useEventListener.js.map +1 -0
- package/dist/types/meta.d.ts +0 -1
- package/dist/types/meta.js +0 -7
- package/dist/types/meta.js.map +1 -1
- package/dist/utils/createCustomEvent.js +1 -1
- package/dist/utils/createCustomEvent.js.map +1 -1
- package/dist/utils/demo.d.ts +19 -2
- package/dist/utils/demo.js.map +1 -1
- package/dist/utils/dom.d.ts +1 -0
- package/dist/utils/dom.js +5 -0
- package/dist/utils/dom.js.map +1 -1
- package/dist/utils/handleKeyDown.d.ts +1 -0
- package/dist/utils/handleKeyDown.js +9 -3
- package/dist/utils/handleKeyDown.js.map +1 -1
- package/dist/utils/keyboard.d.ts +3 -1
- package/dist/utils/keyboard.js.map +1 -1
- package/dist/utils/sendAriaLiveMessage.d.ts +8 -0
- package/dist/utils/sendAriaLiveMessage.js +14 -0
- package/dist/utils/sendAriaLiveMessage.js.map +1 -0
- package/dist/utils/sizing.d.ts +3 -0
- package/dist/utils/sizing.js +28 -0
- package/dist/utils/sizing.js.map +1 -0
- package/dist/utils/uiContext.d.ts +0 -1
- package/dist/utils/uiContext.js.map +1 -1
- package/meta.ts +9 -8
- package/package.json +31 -25
- package/src/components/Accordion/Accordion.tsx +22 -20
- package/src/components/Accordion/AccordionExample.tsx +5 -4
- package/src/components/Avatar/Avatar.tsx +2 -3
- package/src/components/Avatar/avatar.scss +9 -6
- package/src/components/AvatarGroup/AvatarGroup.tsx +1 -1
- package/src/components/Badge/Badge.tsx +1 -1
- package/src/components/Badge/BadgeExample.tsx +0 -1
- package/src/components/BadgeDot/BadgeDot.tsx +1 -1
- package/src/components/BadgeDot/BadgeDotExample.tsx +0 -1
- package/src/components/BannerAlert/BannerAlert.tsx +14 -12
- package/src/components/BannerAlert/BannerAlertExample.tsx +0 -1
- package/src/components/Breadcrumb/Breadcrumb.tsx +20 -18
- package/src/components/Button/Button.tsx +36 -10
- package/src/components/Button/button.scss +13 -6
- package/src/components/Calendar/Calendar.rtl.test.tsx +1 -1
- package/src/components/Calendar/Calendar.tsx +156 -371
- package/src/components/Calendar/CalendarExample.tsx +0 -1
- package/src/components/Calendar/calendar.scss +46 -40
- package/src/components/Calendar/index.tsx +1 -0
- package/src/components/Calendar/utils.tsx +98 -0
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Carousel/Carousel.tsx +8 -8
- package/src/components/Carousel/carousel.scss +0 -1
- package/src/components/Checkbox/Checkbox.tsx +1 -1
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +1 -1
- package/src/components/CheckboxGroupField/CheckboxGroupField.tsx +1 -1
- package/src/components/CheckboxOption/CheckboxOption.tsx +1 -1
- package/src/components/Chip/Chip.tsx +1 -1
- package/src/components/ChipGroup/ChipGroup.tsx +1 -1
- package/src/components/DatePicker/DatePicker.rtl.test.tsx +1 -1
- package/src/components/DatePicker/DatePicker.tsx +51 -106
- package/src/components/DatePicker/DatePickerExample.tsx +20 -3
- package/src/components/DatePicker/date-picker.scss +11 -0
- package/src/components/DatePickerField/DatePickerField.tsx +1 -1
- package/src/components/Divider/Divider.tsx +4 -4
- package/src/components/Divider/DividerExample.tsx +22 -23
- package/src/components/Drawer/Drawer.tsx +9 -16
- package/src/components/Drawer/DrawerExample.tsx +28 -4
- package/src/components/Drawer/drawer.scss +7 -0
- package/src/components/EmptyState/EmptyState.rtl.test.tsx +1 -1
- package/src/components/EmptyState/EmptyState.tsx +14 -21
- package/src/components/EmptyState/EmptyStateExample.tsx +5 -5
- package/src/components/ExamplePlaceholder/ExamplePlaceholder.tsx +17 -22
- package/src/components/Fab/Fab.tsx +10 -7
- package/src/components/Fab/FabExample.tsx +10 -1
- package/src/components/FileUpload/FileUpload.tsx +1 -1
- package/src/components/FileUploadItem/FileUploadItem.tsx +1 -1
- package/src/components/{Layout/Layout.rtl.test.tsx → Flex/Flex.rtl.test.tsx} +3 -3
- package/src/components/Flex/Flex.tsx +100 -0
- package/src/components/Flex/FlexExample.tsx +27 -0
- package/src/components/Flex/index.tsx +1 -0
- package/src/components/FormField/FormFieldExample.tsx +1 -2
- package/src/components/Grid/Grid.rtl.test.tsx +19 -0
- package/src/components/Grid/Grid.tsx +75 -0
- package/src/components/Grid/GridExample.tsx +42 -0
- package/src/components/Grid/index.tsx +1 -0
- package/src/components/InlineAlert/InlineAlert.tsx +1 -1
- package/src/components/Input/Input.tsx +5 -9
- package/src/components/Input/InputElement.tsx +4 -7
- package/src/components/Input/InputExample.tsx +19 -1
- package/src/components/Input/input.scss +9 -1
- package/src/components/InputField/InputField.tsx +1 -1
- package/src/components/InputNumber/InputNumber.tsx +6 -15
- package/src/components/InputNumber/InputNumberExample.tsx +24 -1
- package/src/components/InputNumberField/InputNumberField.tsx +1 -1
- package/src/components/InputPhone/InputPhone.tsx +18 -17
- package/src/components/InputPhone/InputPhoneExample.tsx +27 -2
- package/src/components/InputPhoneField/InputPhoneField.tsx +1 -1
- package/src/components/Link/Link.tsx +1 -1
- package/src/components/ListItem/ListItem.tsx +1 -1
- package/src/components/Menu/Menu.tsx +1 -3
- package/src/components/Modal/Modal.tsx +2 -4
- package/src/components/OTPInput/OTPInput.tsx +1 -1
- package/src/components/OTPInput/OTPInputExample.tsx +0 -1
- package/src/components/PageControl/PageControl.tsx +1 -1
- package/src/components/PageControl/PageControlExample.tsx +0 -1
- package/src/components/PageHeader/PageHeader.rtl.test.tsx +18 -0
- package/src/components/PageHeader/PageHeader.tsx +78 -0
- package/src/components/PageHeader/PageHeaderExample.tsx +58 -0
- package/src/components/PageHeader/index.tsx +1 -0
- package/src/components/PageHeader/page-header.scss +41 -0
- package/src/components/Pagination/Pagination.tsx +14 -3
- package/src/components/Pagination/pagination.scss +12 -5
- package/src/components/Password/Password.tsx +11 -16
- package/src/components/Password/PasswordExample.tsx +18 -1
- package/src/components/PasswordField/PasswordField.tsx +1 -1
- package/src/components/Popover/Popover.tsx +1 -1
- package/src/components/Popover/PopoverExample.tsx +0 -1
- package/src/components/ProgressBar/ProgressBar.tsx +1 -1
- package/src/components/ProgressCircle/ProgressCircle.tsx +1 -1
- package/src/components/ProgressionStepper/ProgressionStepper.tsx +1 -1
- package/src/components/ProgressionStepper/ProgressionStepperExample.tsx +0 -1
- package/src/components/ProgressionStepperBar/ProgressionStepperBar.tsx +1 -1
- package/src/components/RadioGroup/RadioGroup.tsx +1 -1
- package/src/components/RadioGroupField/RadioGroupField.tsx +1 -1
- package/src/components/Rating/Rating.tsx +7 -3
- package/src/components/SearchBar/SearchBar.tsx +3 -5
- package/src/components/SegmentedControl/SegmentedControl.tsx +1 -1
- package/src/components/Select/Select.tsx +11 -24
- package/src/components/Select/SelectExample.tsx +36 -1
- package/src/components/SelectField/SelectField.tsx +1 -1
- package/src/components/Skeleton/Skeleton.tsx +1 -1
- package/src/components/SkeletonText/SkeletonText.tsx +1 -1
- package/src/components/Slider/Slider.tsx +21 -4
- package/src/components/Slider/SliderExample.tsx +16 -2
- package/src/components/Snackbar/Manager.tsx +1 -1
- package/src/components/Snackbar/Snackbar.tsx +1 -1
- package/src/components/Snackbar/SnackbarExample.tsx +0 -1
- package/src/components/Switch/Switch.tsx +1 -1
- package/src/components/SwitchOption/SwitchOption.tsx +1 -1
- package/src/components/TabGroup/TabGroup.tsx +1 -1
- package/src/components/TabGroup/TabGroupExample.tsx +0 -1
- package/src/components/TabList/TabListExample.tsx +0 -1
- package/src/components/Table/Table.tsx +11 -16
- package/src/components/Table/TableExample.tsx +56 -54
- package/src/components/Table/utils.ts +31 -20
- package/src/components/Tag/Tag.tsx +1 -1
- package/src/components/Textarea/Textarea.tsx +5 -8
- package/src/components/Textarea/TextareaExample.tsx +21 -1
- package/src/components/TextareaField/TextareaField.tsx +1 -1
- package/src/components/TimePicker/TimePicker.tsx +5 -9
- package/src/components/TimePicker/TimePickerExample.tsx +18 -1
- package/src/components/TimePickerField/TimePickerField.tsx +1 -1
- package/src/components/Tooltip/Tooltip.tsx +2 -2
- package/src/components/Tooltip/tooltip.scss +2 -0
- package/src/components/Txt/Txt.tsx +1 -1
- package/src/components/UIProvider/UIProvider.tsx +1 -4
- package/src/components/UIProvider/UIProviderExample.tsx +0 -83
- package/src/hooks/useControlledState.ts +31 -0
- package/src/types/meta.ts +0 -8
- package/src/utils/createCustomEvent.ts +1 -1
- package/src/utils/demo.ts +19 -2
- package/src/utils/dom.ts +8 -0
- package/src/utils/handleKeyDown.ts +9 -3
- package/src/utils/keyboard.ts +5 -2
- package/src/utils/sendAriaLiveMessage.ts +17 -0
- package/src/utils/sizing.ts +30 -0
- package/src/utils/uiContext.ts +0 -1
- package/.scripts/index.ts +0 -110
- package/dist/components/Layout/Layout.d.ts +0 -50
- package/dist/components/Layout/Layout.js +0 -28
- package/dist/components/Layout/Layout.js.map +0 -1
- package/dist/components/Layout/LayoutExample.d.ts +0 -4
- package/dist/components/Layout/LayoutExample.js +0 -9
- package/dist/components/Layout/LayoutExample.js.map +0 -1
- package/dist/components/Layout/index.d.ts +0 -1
- package/dist/components/Layout/index.js +0 -2
- package/dist/components/Layout/index.js.map +0 -1
- package/dist/components/UIProvider/AriaLiveMessageHandler.d.ts +0 -13
- package/dist/components/UIProvider/AriaLiveMessageHandler.js +0 -31
- package/dist/components/UIProvider/AriaLiveMessageHandler.js.map +0 -1
- package/dist/hooks/useAddEventListener.js.map +0 -1
- package/src/components/Layout/Layout.tsx +0 -85
- package/src/components/Layout/LayoutExample.tsx +0 -17
- package/src/components/Layout/index.tsx +0 -1
- package/src/components/UIProvider/AriaLiveMessageHandler.tsx +0 -46
- /package/dist/hooks/{useAddEventListener.d.ts → useEventListener.d.ts} +0 -0
- /package/src/hooks/{useAddEventListener.ts → useEventListener.ts} +0 -0
|
@@ -3,6 +3,7 @@ import { useEffect, useRef } from 'react';
|
|
|
3
3
|
import { SliderIntervalDots } from './SliderIntervalDots';
|
|
4
4
|
import { useNormalizeSliderValue } from './useNormalizeSliderValue';
|
|
5
5
|
import { Txt } from '-/components/Txt';
|
|
6
|
+
import { useControlledState } from '-/hooks/useControlledState';
|
|
6
7
|
import { CommonPropsLibrary } from '-/types/common';
|
|
7
8
|
|
|
8
9
|
export type SliderValue = number | [number, number];
|
|
@@ -77,15 +78,30 @@ export type SliderProps<Value> = Pick<CommonPropsLibrary, 'disabled' | 'readOnly
|
|
|
77
78
|
* () => {
|
|
78
79
|
* const [value, setValue] = useState(50);
|
|
79
80
|
*
|
|
80
|
-
* return
|
|
81
|
+
* return (
|
|
82
|
+
* <div style={{ width: '100%' }}>
|
|
83
|
+
* <Slider
|
|
84
|
+
* label="Slider Example"
|
|
85
|
+
* max={100}
|
|
86
|
+
* min={0}
|
|
87
|
+
* name="slider-example"
|
|
88
|
+
* onChange={setValue}
|
|
89
|
+
* value={value}
|
|
90
|
+
* />
|
|
91
|
+
* <p>
|
|
92
|
+
* <br />
|
|
93
|
+
* Current Value: {value}
|
|
94
|
+
* </p>
|
|
95
|
+
* </div>
|
|
96
|
+
* );
|
|
81
97
|
* };
|
|
82
98
|
*
|
|
83
99
|
* @name Slider
|
|
84
|
-
* @phase
|
|
100
|
+
* @phase Stable
|
|
85
101
|
*/
|
|
86
102
|
export function Slider<V = SliderValue>({
|
|
87
103
|
value: valueProp,
|
|
88
|
-
onChange,
|
|
104
|
+
onChange: onChangeProp,
|
|
89
105
|
min,
|
|
90
106
|
max,
|
|
91
107
|
label,
|
|
@@ -96,7 +112,8 @@ export function Slider<V = SliderValue>({
|
|
|
96
112
|
name,
|
|
97
113
|
formatNumber: formatNumberProp,
|
|
98
114
|
}: SliderProps<V>) {
|
|
99
|
-
const value = (valueProp as V)
|
|
115
|
+
const [value, onChange] = useControlledState<V>((valueProp || min) as V, onChangeProp);
|
|
116
|
+
|
|
100
117
|
const formatNumber: SliderProps<V>['formatNumber'] = (rawValue, context) =>
|
|
101
118
|
formatNumberProp?.(rawValue, context) || rawValue.toString();
|
|
102
119
|
const sliderRef = useRef<HTMLDivElement>(null);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
/* eslint-disable react/no-multi-comp */
|
|
1
2
|
import { useState } from 'react';
|
|
2
3
|
|
|
3
|
-
import { SliderProps } from './Slider';
|
|
4
|
+
import { Slider, SliderProps } from './Slider';
|
|
4
5
|
import { ComponentExample } from '-/utils/demo';
|
|
5
6
|
|
|
6
7
|
export const SliderExample: ComponentExample<SliderProps<number | [number, number]>> = {
|
|
7
|
-
// containerStyle: { width: '100%' },
|
|
8
8
|
render: ({ props, Component }) => {
|
|
9
9
|
const SliderDemo = (sliderProps: SliderProps<number | [number, number]>) => {
|
|
10
10
|
const initialValue = Array.isArray(sliderProps.value)
|
|
@@ -89,3 +89,17 @@ export const SliderExample: ComponentExample<SliderProps<number | [number, numbe
|
|
|
89
89
|
name: 'basic-slider',
|
|
90
90
|
},
|
|
91
91
|
};
|
|
92
|
+
|
|
93
|
+
export const Usage = () => {
|
|
94
|
+
const [value, setValue] = useState(50);
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<div style={{ width: '100%' }}>
|
|
98
|
+
<Slider label="Slider Example" max={100} min={0} name="slider-example" onChange={setValue} value={value} />
|
|
99
|
+
<p>
|
|
100
|
+
<br />
|
|
101
|
+
Current Value: {value}
|
|
102
|
+
</p>
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
@@ -33,7 +33,7 @@ const SnackbarEvent = createCustomEvent<SendSnackbarProps | string | typeof CLEA
|
|
|
33
33
|
* context. :)
|
|
34
34
|
*
|
|
35
35
|
* @name SnackbarManager
|
|
36
|
-
* @phase
|
|
36
|
+
* @phase Stable
|
|
37
37
|
*/
|
|
38
38
|
export function SnackbarManager({ defaultTimeout = 5000 }: SnackbarManagerProps) {
|
|
39
39
|
const [snackbarProps, setSnackbarProps] = useState<SendSnackbarProps | undefined>();
|
|
@@ -45,7 +45,7 @@ export type SwitchProps = CommonProps<'aria-label' | 'disabled' | 'name'> & {
|
|
|
45
45
|
* @element
|
|
46
46
|
*
|
|
47
47
|
* @name Switch
|
|
48
|
-
* @phase
|
|
48
|
+
* @phase Stable
|
|
49
49
|
*/
|
|
50
50
|
export function Switch({ checked = false, disabled = false, ...props }: SwitchProps) {
|
|
51
51
|
return (
|
|
@@ -9,7 +9,7 @@ export type SwitchOptionProps = ToggleOptionControlProps<SwitchProps>;
|
|
|
9
9
|
* If only a switch is needed, consider using the Switch component directly.
|
|
10
10
|
*
|
|
11
11
|
* @name SwitchOption
|
|
12
|
-
* @phase
|
|
12
|
+
* @phase Stable
|
|
13
13
|
*/
|
|
14
14
|
export function SwitchOption({ label: labelProp, description, ...checkboxProps }: SwitchOptionProps) {
|
|
15
15
|
const label = labelProp || description;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './table.scss';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { AriaAttributes, useEffect, useState } from 'react';
|
|
2
|
+
import { SvgArrowDownward } from '@bspk/icons/ArrowDownward';
|
|
3
|
+
import { SvgArrowUpward } from '@bspk/icons/ArrowUpward';
|
|
4
|
+
import { AriaAttributes, ReactNode, useEffect, useState } from 'react';
|
|
5
5
|
import { TableFooter } from './Footer';
|
|
6
6
|
import { formatCell, SortOrder, TableColumn, TableRow, TableSize, useTable } from './utils';
|
|
7
7
|
import { useId } from '-/hooks/useId';
|
|
@@ -11,23 +11,23 @@ import { cssWithVars } from '-/utils/cwv';
|
|
|
11
11
|
const SORT_META: Record<
|
|
12
12
|
SortOrder | 'none',
|
|
13
13
|
{
|
|
14
|
-
icon:
|
|
14
|
+
icon: ReactNode;
|
|
15
15
|
label: string;
|
|
16
16
|
aria: AriaAttributes['aria-sort'];
|
|
17
17
|
}
|
|
18
18
|
> = {
|
|
19
19
|
asc: {
|
|
20
|
-
icon: <
|
|
20
|
+
icon: <SvgArrowUpward />,
|
|
21
21
|
label: 'sorted ascending',
|
|
22
22
|
aria: 'ascending',
|
|
23
23
|
},
|
|
24
24
|
desc: {
|
|
25
|
-
icon: <
|
|
25
|
+
icon: <SvgArrowDownward />,
|
|
26
26
|
label: 'sorted descending',
|
|
27
27
|
aria: 'descending',
|
|
28
28
|
},
|
|
29
29
|
none: {
|
|
30
|
-
icon:
|
|
30
|
+
icon: false,
|
|
31
31
|
label: 'not sorted',
|
|
32
32
|
aria: 'none',
|
|
33
33
|
},
|
|
@@ -74,7 +74,7 @@ export type TableProps<R extends TableRow> = {
|
|
|
74
74
|
*
|
|
75
75
|
* <Table
|
|
76
76
|
* columns={[
|
|
77
|
-
* { key: 'state', label: 'State', width: '160px' },
|
|
77
|
+
* { key: 'state', label: 'State', width: '160px', sort: 'string' },
|
|
78
78
|
* { key: 'capital', label: 'Capital', width: '140px' },
|
|
79
79
|
* { key: 'population', label: 'Population', width: '140px' },
|
|
80
80
|
* { key: 'nickname', label: 'Nickname', width: '1fr' },
|
|
@@ -127,7 +127,7 @@ export type TableProps<R extends TableRow> = {
|
|
|
127
127
|
* />;
|
|
128
128
|
*
|
|
129
129
|
* @name Table
|
|
130
|
-
* @phase
|
|
130
|
+
* @phase Stable
|
|
131
131
|
*/
|
|
132
132
|
export function Table<R extends TableRow>({
|
|
133
133
|
data = [],
|
|
@@ -194,16 +194,11 @@ export function Table<R extends TableRow>({
|
|
|
194
194
|
{sortMeta ? (
|
|
195
195
|
<button onClick={() => toggleSorting(column.key)} type="button">
|
|
196
196
|
{column.label}
|
|
197
|
-
{sortMeta
|
|
197
|
+
{sortMeta.icon && (
|
|
198
198
|
<span aria-hidden data-sort-icon>
|
|
199
|
-
{sortMeta
|
|
199
|
+
{sortMeta.icon}
|
|
200
200
|
</span>
|
|
201
201
|
)}
|
|
202
|
-
<span data-sr-only>
|
|
203
|
-
<span aria-live="polite" role="status">
|
|
204
|
-
{sortMeta.label}
|
|
205
|
-
</span>
|
|
206
|
-
</span>
|
|
207
202
|
</button>
|
|
208
203
|
) : (
|
|
209
204
|
column.label
|
|
@@ -17,68 +17,70 @@ export const TableExample: ComponentExampleFn<TableProps<TableRow>> = ({
|
|
|
17
17
|
componentsMeta,
|
|
18
18
|
}): ComponentExample<TableProps<TableRow>> => {
|
|
19
19
|
return {
|
|
20
|
-
containerStyle: { width: '100%' },
|
|
21
20
|
defaultState: {
|
|
22
21
|
data: [
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
22
|
+
{ id: '1', state: 'Alabama', capital: 'Montgomery', abbreviation: 'AL', population: 198525 },
|
|
23
|
+
{ id: '2', state: 'Alaska', capital: 'Juneau', abbreviation: 'AK', population: 32756 },
|
|
24
|
+
{ id: '3', state: 'Arizona', capital: 'Phoenix', abbreviation: 'AZ', population: 1680992 },
|
|
25
|
+
{ id: '4', state: 'Arkansas', capital: 'Little Rock', abbreviation: 'AR', population: 197312 },
|
|
26
|
+
{ id: '5', state: 'California', capital: 'Sacramento', abbreviation: 'CA', population: 524943 },
|
|
27
|
+
{ id: '6', state: 'Colorado', capital: 'Denver', abbreviation: 'CO', population: 715522 },
|
|
28
|
+
{ id: '7', state: 'Connecticut', capital: 'Hartford', abbreviation: 'CT', population: 121054 },
|
|
29
|
+
{ id: '8', state: 'Delaware', capital: 'Dover', abbreviation: 'DE', population: 38158 },
|
|
30
|
+
{ id: '9', state: 'Florida', capital: 'Tallahassee', abbreviation: 'FL', population: 196169 },
|
|
31
|
+
{ id: '10', state: 'Georgia', capital: 'Atlanta', abbreviation: 'GA', population: 506811 },
|
|
32
|
+
{ id: '11', state: 'Hawaii', capital: 'Honolulu', abbreviation: 'HI', population: 345064 },
|
|
33
|
+
{ id: '12', state: 'Idaho', capital: 'Boise', abbreviation: 'ID', population: 235829 },
|
|
34
|
+
{ id: '13', state: 'Illinois', capital: 'Springfield', abbreviation: 'IL', population: 114694 },
|
|
35
|
+
{ id: '14', state: 'Indiana', capital: 'Indianapolis', abbreviation: 'IN', population: 876384 },
|
|
36
|
+
{ id: '15', state: 'Iowa', capital: 'Des Moines', abbreviation: 'IA', population: 214133 },
|
|
37
|
+
{ id: '16', state: 'Kansas', capital: 'Topeka', abbreviation: 'KS', population: 125310 },
|
|
38
|
+
{ id: '17', state: 'Kentucky', capital: 'Frankfort', abbreviation: 'KY', population: 27749 },
|
|
39
|
+
{ id: '18', state: 'Louisiana', capital: 'Baton Rouge', abbreviation: 'LA', population: 221599 },
|
|
40
|
+
{ id: '19', state: 'Maine', capital: 'Augusta', abbreviation: 'ME', population: 18807 },
|
|
41
|
+
{ id: '20', state: 'Maryland', capital: 'Annapolis', abbreviation: 'MD', population: 39774 },
|
|
42
|
+
{ id: '21', state: 'Massachusetts', capital: 'Boston', abbreviation: 'MA', population: 675647 },
|
|
43
|
+
{ id: '22', state: 'Michigan', capital: 'Lansing', abbreviation: 'MI', population: 112644 },
|
|
44
|
+
{ id: '23', state: 'Minnesota', capital: 'Saint Paul', abbreviation: 'MN', population: 311527 },
|
|
45
|
+
{ id: '24', state: 'Mississippi', capital: 'Jackson', abbreviation: 'MS', population: 153701 },
|
|
46
|
+
{ id: '25', state: 'Missouri', capital: 'Jefferson City', abbreviation: 'MO', population: 43079 },
|
|
47
|
+
{ id: '26', state: 'Montana', capital: 'Helena', abbreviation: 'MT', population: 32815 },
|
|
48
|
+
{ id: '27', state: 'Nebraska', capital: 'Lincoln', abbreviation: 'NE', population: 289102 },
|
|
49
|
+
{ id: '28', state: 'Nevada', capital: 'Carson City', abbreviation: 'NV', population: 57826 },
|
|
50
|
+
{ id: '29', state: 'New Hampshire', capital: 'Concord', abbreviation: 'NH', population: 43627 },
|
|
51
|
+
{ id: '30', state: 'New Jersey', capital: 'Trenton', abbreviation: 'NJ', population: 87937 },
|
|
52
|
+
{ id: '31', state: 'New Mexico', capital: 'Santa Fe', abbreviation: 'NM', population: 84683 },
|
|
53
|
+
{ id: '32', state: 'New York', capital: 'Albany', abbreviation: 'NY', population: 96460 },
|
|
54
|
+
{ id: '33', state: 'North Carolina', capital: 'Raleigh', abbreviation: 'NC', population: 474069 },
|
|
55
|
+
{ id: '34', state: 'North Dakota', capital: 'Bismarck', abbreviation: 'ND', population: 73335 },
|
|
56
|
+
{ id: '35', state: 'Ohio', capital: 'Columbus', abbreviation: 'OH', population: 903852 },
|
|
57
|
+
{ id: '36', state: 'Oklahoma', capital: 'Oklahoma City', abbreviation: 'OK', population: 655057 },
|
|
58
|
+
{ id: '37', state: 'Oregon', capital: 'Salem', abbreviation: 'OR', population: 175535 },
|
|
59
|
+
{ id: '38', state: 'Pennsylvania', capital: 'Harrisburg', abbreviation: 'PA', population: 49528 },
|
|
60
|
+
{ id: '39', state: 'Rhode Island', capital: 'Providence', abbreviation: 'RI', population: 190934 },
|
|
61
|
+
{ id: '40', state: 'South Carolina', capital: 'Columbia', abbreviation: 'SC', population: 137541 },
|
|
62
|
+
{ id: '41', state: 'South Dakota', capital: 'Pierre', abbreviation: 'SD', population: 13946 },
|
|
63
|
+
{ id: '42', state: 'Tennessee', capital: 'Nashville', abbreviation: 'TN', population: 670820 },
|
|
64
|
+
{ id: '43', state: 'Texas', capital: 'Austin', abbreviation: 'TX', population: 964254 },
|
|
65
|
+
{ id: '44', state: 'Utah', capital: 'Salt Lake City', abbreviation: 'UT', population: 200567 },
|
|
66
|
+
{ id: '45', state: 'Vermont', capital: 'Montpelier', abbreviation: 'VT', population: 7919 },
|
|
67
|
+
{ id: '46', state: 'Virginia', capital: 'Richmond', abbreviation: 'VA', population: 226610 },
|
|
68
|
+
{ id: '47', state: 'Washington', capital: 'Olympia', abbreviation: 'WA', population: 52434 },
|
|
69
|
+
{ id: '48', state: 'West Virginia', capital: 'Charleston', abbreviation: 'WV', population: 45756 },
|
|
70
|
+
{ id: '49', state: 'Wisconsin', capital: 'Madison', abbreviation: 'WI', population: 269840 },
|
|
71
|
+
{ id: '50', state: 'Wyoming', capital: 'Cheyenne', abbreviation: 'WY', population: 64235 },
|
|
51
72
|
],
|
|
52
73
|
columns: [
|
|
53
|
-
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
sort: 'string',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
key: 'lastName',
|
|
61
|
-
label: 'Last Name',
|
|
62
|
-
width: '1fr',
|
|
63
|
-
sort: 'string',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
key: 'email',
|
|
67
|
-
label: 'Email',
|
|
68
|
-
width: '1fr',
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
key: 'serviceYears',
|
|
72
|
-
label: 'Service Years',
|
|
73
|
-
align: 'right',
|
|
74
|
-
width: '1fr',
|
|
75
|
-
sort: 'number',
|
|
76
|
-
},
|
|
74
|
+
{ key: 'state', label: 'State', width: '1fr', sort: 'string' },
|
|
75
|
+
{ key: 'capital', label: 'Capital', width: '1fr', sort: 'string' },
|
|
76
|
+
{ key: 'abbreviation', label: 'Abbrev', width: '1fr', align: 'center' },
|
|
77
|
+
{ key: 'population', label: 'Population', align: 'right', width: '1fr', sort: 'number' },
|
|
77
78
|
],
|
|
79
|
+
pageSize: 5,
|
|
78
80
|
},
|
|
79
81
|
presets: [
|
|
80
82
|
{
|
|
81
|
-
label: 'Large
|
|
83
|
+
label: 'Large dataset',
|
|
82
84
|
propState: {
|
|
83
85
|
title: 'Components',
|
|
84
86
|
columns: [
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import { isValid } from 'date-fns';
|
|
1
2
|
import { isValidElement, ReactNode, useMemo, useState } from 'react';
|
|
3
|
+
import { sendAriaLiveMessage } from '-/utils/sendAriaLiveMessage';
|
|
2
4
|
|
|
3
5
|
const parseDateTime = (val: TableCellValue) => {
|
|
4
|
-
|
|
5
|
-
if (typeof val === 'string' || typeof val === 'number')
|
|
6
|
-
|
|
6
|
+
let dateValue = val;
|
|
7
|
+
if (typeof val === 'string' || typeof val === 'number') dateValue = new Date(val).getTime();
|
|
8
|
+
|
|
9
|
+
return dateValue instanceof Date && isValid(dateValue) ? dateValue.getTime() : 0;
|
|
7
10
|
};
|
|
8
11
|
|
|
9
12
|
export type BuiltInColumnSorters = 'boolean' | 'date' | 'number' | 'string';
|
|
10
13
|
|
|
11
|
-
const BUILT_IN_COLUMN_SORTERS: Record<BuiltInColumnSorters, TableColumnSortingFn> = {
|
|
14
|
+
export const BUILT_IN_COLUMN_SORTERS: Record<BuiltInColumnSorters, TableColumnSortingFn> = {
|
|
12
15
|
string: (a: TableCellValue, b: TableCellValue) => `${a}`.localeCompare(`${b}`),
|
|
13
16
|
number: (a: TableCellValue, b: TableCellValue) => {
|
|
14
17
|
const aNum = typeof a === 'number' ? a : Number(a) || 0;
|
|
@@ -23,7 +26,7 @@ const BUILT_IN_COLUMN_SORTERS: Record<BuiltInColumnSorters, TableColumnSortingFn
|
|
|
23
26
|
|
|
24
27
|
export type TableSize = 'large' | 'medium' | 'small' | 'x-large';
|
|
25
28
|
|
|
26
|
-
export type TableCellValue =
|
|
29
|
+
export type TableCellValue = unknown;
|
|
27
30
|
|
|
28
31
|
export type TableRow = {
|
|
29
32
|
[key: string]: TableCellValue | TableCellValue[];
|
|
@@ -91,12 +94,6 @@ export type SortOrder = 'asc' | 'desc';
|
|
|
91
94
|
|
|
92
95
|
export type SortState = { key: string; order: SortOrder }[];
|
|
93
96
|
|
|
94
|
-
export const SORT_PREV_NEXT_STATE: Record<SortOrder | 'none', SortOrder | undefined> = {
|
|
95
|
-
asc: 'desc',
|
|
96
|
-
desc: undefined,
|
|
97
|
-
none: 'asc',
|
|
98
|
-
};
|
|
99
|
-
|
|
100
97
|
export function formatCell(value: TableCellValue): ReactNode {
|
|
101
98
|
if (isValidElement(value)) return value;
|
|
102
99
|
|
|
@@ -161,15 +158,23 @@ export function useTable<R extends TableRow>({
|
|
|
161
158
|
sorting,
|
|
162
159
|
toggleSorting: (key: string) => {
|
|
163
160
|
setSorting((prev) => {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
161
|
+
let nextArr: SortState = [];
|
|
162
|
+
|
|
163
|
+
const exists = prev.find((sort) => sort.key === key);
|
|
164
|
+
const order: SortOrder | undefined = getNextOrder(exists?.order);
|
|
165
|
+
|
|
166
|
+
// update to nextOrder
|
|
167
|
+
if (order && exists) nextArr = prev.map((sort) => (sort.key === key ? { ...sort, order } : sort));
|
|
168
|
+
|
|
169
|
+
// add nextOrder
|
|
170
|
+
if (order && !exists) nextArr = [...prev, { key, order }];
|
|
171
|
+
|
|
172
|
+
// remove sorting
|
|
173
|
+
if (!order && exists) nextArr = prev.filter((sort) => sort.key !== key);
|
|
174
|
+
|
|
175
|
+
const columnLabel = columns?.find((col) => col.key === key)?.label || key;
|
|
176
|
+
sendAriaLiveMessage(`${order ? `Sorted ${order}ending` : 'Removed sorting'} by ${columnLabel}`);
|
|
177
|
+
|
|
173
178
|
return nextArr;
|
|
174
179
|
});
|
|
175
180
|
},
|
|
@@ -177,3 +182,9 @@ export function useTable<R extends TableRow>({
|
|
|
177
182
|
totalPages: Math.ceil(data.length / pageSize),
|
|
178
183
|
};
|
|
179
184
|
}
|
|
185
|
+
|
|
186
|
+
function getNextOrder(currentOrder: SortOrder | undefined): SortOrder | undefined {
|
|
187
|
+
if (!currentOrder) return 'asc';
|
|
188
|
+
if (currentOrder === 'asc') return 'desc';
|
|
189
|
+
return undefined;
|
|
190
|
+
}
|
|
@@ -38,7 +38,7 @@ export type TagProps = {
|
|
|
38
38
|
* <Tag label="Example Tag" variant="flat" color="primary" />;
|
|
39
39
|
*
|
|
40
40
|
* @name Tag
|
|
41
|
-
* @phase
|
|
41
|
+
* @phase Stable
|
|
42
42
|
*/
|
|
43
43
|
export function Tag({ label, color = 'white', size = 'small', variant = 'flat' }: TagProps) {
|
|
44
44
|
return (
|
|
@@ -50,26 +50,23 @@ export type TextareaProps = CommonProps<'size'> &
|
|
|
50
50
|
* import { Textarea } from '@bspk/ui/Textarea';
|
|
51
51
|
*
|
|
52
52
|
* () => {
|
|
53
|
-
* const [value, setValue] = useState('');
|
|
53
|
+
* const [value, setValue] = useState<string | undefined>('');
|
|
54
|
+
*
|
|
54
55
|
* return (
|
|
55
|
-
*
|
|
56
|
-
* // standalone textarea example
|
|
57
|
-
* <Textarea aria-label="Enter text" name="example-name" onChange={setValue} value={value} />
|
|
58
|
-
* <br />
|
|
59
|
-
* // textarea used within a field
|
|
56
|
+
* <div style={{ width: 320 }}>
|
|
60
57
|
* <Field>
|
|
61
58
|
* <FieldLabel>Example Textarea</FieldLabel>
|
|
62
59
|
* <Textarea name="example-name" onChange={setValue} value={value} />
|
|
63
60
|
* <FieldDescription>This is an example textarea field.</FieldDescription>
|
|
64
61
|
* </Field>
|
|
65
|
-
*
|
|
62
|
+
* </div>
|
|
66
63
|
* );
|
|
67
64
|
* };
|
|
68
65
|
*
|
|
69
66
|
* @element
|
|
70
67
|
*
|
|
71
68
|
* @name Textarea
|
|
72
|
-
* @phase
|
|
69
|
+
* @phase Stable
|
|
73
70
|
*/
|
|
74
71
|
export function Textarea({
|
|
75
72
|
invalid: invalidProp,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { Textarea, TextareaProps } from '.';
|
|
3
|
+
import { Field, FieldDescription, FieldLabel } from '-/components/Field';
|
|
2
4
|
import { ComponentExample } from '-/utils/demo';
|
|
3
5
|
|
|
4
6
|
export const TextareaExample: ComponentExample<TextareaProps> = {
|
|
@@ -6,4 +8,22 @@ export const TextareaExample: ComponentExample<TextareaProps> = {
|
|
|
6
8
|
'aria-label': 'textarea aria-label',
|
|
7
9
|
},
|
|
8
10
|
render: ({ props, Component }) => <Component {...props} />,
|
|
11
|
+
containerStyle: {
|
|
12
|
+
width: 320,
|
|
13
|
+
padding: 0,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Usage = () => {
|
|
18
|
+
const [value, setValue] = useState<string | undefined>('');
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div style={{ width: 320 }}>
|
|
22
|
+
<Field>
|
|
23
|
+
<FieldLabel>Example Textarea</FieldLabel>
|
|
24
|
+
<Textarea name="example-name" onChange={setValue} value={value} />
|
|
25
|
+
<FieldDescription>This is an example textarea field.</FieldDescription>
|
|
26
|
+
</Field>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
9
29
|
};
|
|
@@ -34,25 +34,21 @@ export type TimePickerProps = FieldControlProps & Pick<InputProps, 'size'>;
|
|
|
34
34
|
* import { TimePicker } from '@bspk/ui/TimePicker';
|
|
35
35
|
*
|
|
36
36
|
* () => {
|
|
37
|
-
* const [value, onChange] = useState('');
|
|
37
|
+
* const [value, onChange] = useState<string | undefined>('');
|
|
38
38
|
*
|
|
39
39
|
* return (
|
|
40
|
-
*
|
|
41
|
-
* // standalone time picker example
|
|
42
|
-
* <TimePicker aria-label="Time" name="time" value={value} onChange={onChange} />
|
|
43
|
-
* <br />
|
|
44
|
-
* // time picker used within a field
|
|
40
|
+
* <div style={{ width: 320 }}>
|
|
45
41
|
* <Field>
|
|
46
42
|
* <FieldLabel>Time</FieldLabel>
|
|
47
|
-
* <TimePicker
|
|
43
|
+
* <TimePicker name="time" onChange={onChange} value={value} />
|
|
48
44
|
* <FieldDescription>The time picker allows you to select a time.</FieldDescription>
|
|
49
45
|
* </Field>
|
|
50
|
-
*
|
|
46
|
+
* </div>
|
|
51
47
|
* );
|
|
52
48
|
* };
|
|
53
49
|
*
|
|
54
50
|
* @name TimePicker
|
|
55
|
-
* @phase
|
|
51
|
+
* @phase Stable
|
|
56
52
|
*/
|
|
57
53
|
export function TimePicker({
|
|
58
54
|
value,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { TimePicker, TimePickerProps } from './TimePicker';
|
|
3
|
+
import { Field, FieldLabel, FieldDescription } from '-/components/Field';
|
|
2
4
|
import { ComponentExample } from '-/utils/demo';
|
|
3
5
|
|
|
4
6
|
export const TimePickerExample: ComponentExample<TimePickerProps> = {
|
|
@@ -7,4 +9,19 @@ export const TimePickerExample: ComponentExample<TimePickerProps> = {
|
|
|
7
9
|
'aria-label': 'time picker aria-label',
|
|
8
10
|
},
|
|
9
11
|
render: ({ props, Component }) => <Component {...props} />,
|
|
12
|
+
containerStyle: { width: 320, padding: 0 },
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const Usage = () => {
|
|
16
|
+
const [value, onChange] = useState<string | undefined>('');
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div style={{ width: 320 }}>
|
|
20
|
+
<Field>
|
|
21
|
+
<FieldLabel>Time</FieldLabel>
|
|
22
|
+
<TimePicker name="time" onChange={onChange} value={value} />
|
|
23
|
+
<FieldDescription>The time picker allows you to select a time.</FieldDescription>
|
|
24
|
+
</Field>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
10
27
|
};
|
|
@@ -49,7 +49,7 @@ export type TooltipProps = {
|
|
|
49
49
|
* </Tooltip>;
|
|
50
50
|
*
|
|
51
51
|
* @name Tooltip
|
|
52
|
-
* @phase
|
|
52
|
+
* @phase Stable
|
|
53
53
|
*/
|
|
54
54
|
export function Tooltip({ placement = 'top', label, children, disabled = false, showTail = true }: TooltipProps) {
|
|
55
55
|
const id = useId();
|
|
@@ -66,7 +66,7 @@ export function Tooltip({ placement = 'top', label, children, disabled = false,
|
|
|
66
66
|
refWidth: false,
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
if (disabled) return children({});
|
|
69
|
+
if (!label || disabled) return children({});
|
|
70
70
|
|
|
71
71
|
return (
|
|
72
72
|
<>
|