@bspk/ui 1.3.11 → 1.3.16
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 +28 -22
- 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
|
@@ -7,13 +7,9 @@
|
|
|
7
7
|
color: var(--foreground-neutral-on-surface);
|
|
8
8
|
gap: var(--spacing-sizing-01);
|
|
9
9
|
background: var(--surface-neutral-t1-base);
|
|
10
|
+
border-radius: var(--radius-lg);
|
|
10
11
|
padding: var(--spacing-sizing-02);
|
|
11
12
|
|
|
12
|
-
&[data-variant='elevated'] {
|
|
13
|
-
border-radius: var(--radius-lg);
|
|
14
|
-
box-shadow: var(--drop-shadow-float);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
13
|
[data-header] {
|
|
18
14
|
display: flex;
|
|
19
15
|
justify-content: space-between;
|
|
@@ -30,58 +26,68 @@
|
|
|
30
26
|
[data-bspk='button'] {
|
|
31
27
|
font: inherit;
|
|
32
28
|
|
|
33
|
-
&[data-month]
|
|
34
|
-
padding-right: var(--spacing-sizing-01);
|
|
35
|
-
}
|
|
36
|
-
|
|
29
|
+
&[data-month],
|
|
37
30
|
&[data-year] {
|
|
38
|
-
padding
|
|
31
|
+
padding: 0;
|
|
32
|
+
min-width: var(--spacing-sizing-12);
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
35
|
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
[data-day-headers] {
|
|
45
|
-
display: grid;
|
|
46
|
-
grid-template-columns: repeat(7, 1fr);
|
|
47
|
-
text-align: center;
|
|
48
|
-
color: var(--foreground-neutral-on-surface-variant-01);
|
|
49
36
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
line-height: var(--spacing-sizing-12);
|
|
37
|
+
[data-bspk='button'] {
|
|
38
|
+
border-radius: var(--radius-sm);
|
|
53
39
|
}
|
|
54
40
|
}
|
|
55
41
|
|
|
56
|
-
|
|
57
|
-
display:
|
|
42
|
+
table {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
58
45
|
|
|
59
|
-
|
|
60
|
-
|
|
46
|
+
tr {
|
|
47
|
+
display: contents;
|
|
61
48
|
}
|
|
62
49
|
|
|
63
|
-
|
|
64
|
-
|
|
50
|
+
td,
|
|
51
|
+
th {
|
|
52
|
+
height: var(--spacing-sizing-12);
|
|
53
|
+
line-height: var(--spacing-sizing-12);
|
|
54
|
+
text-align: center;
|
|
55
|
+
border-radius: var(--radius-sm);
|
|
56
|
+
font-weight: inherit;
|
|
65
57
|
}
|
|
66
|
-
}
|
|
67
58
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
[data-body] {
|
|
59
|
+
thead {
|
|
60
|
+
display: grid;
|
|
72
61
|
grid-template-columns: repeat(7, calc(100% / 7));
|
|
73
|
-
|
|
74
|
-
}
|
|
62
|
+
text-align: center;
|
|
75
63
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
64
|
+
th {
|
|
65
|
+
color: var(--foreground-neutral-on-surface-variant-01);
|
|
66
|
+
}
|
|
79
67
|
}
|
|
80
|
-
}
|
|
81
68
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
grid-template-columns: repeat(
|
|
69
|
+
tbody {
|
|
70
|
+
display: grid;
|
|
71
|
+
grid-template-columns: repeat(7, calc(100% / 7));
|
|
72
|
+
|
|
73
|
+
[data-non-month-day] {
|
|
74
|
+
color: var(--foreground-neutral-on-surface-variant-02);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
td {
|
|
78
|
+
&:hover,
|
|
79
|
+
&:focus-visible {
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
outline: 2px solid var(--stroke-neutral-focus);
|
|
82
|
+
outline-offset: -2px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&[data-selected] {
|
|
86
|
+
background: var(--surface-brand-primary);
|
|
87
|
+
color: var(--foreground-brand-on-primary);
|
|
88
|
+
outline-offset: 2px;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
85
91
|
}
|
|
86
92
|
}
|
|
87
93
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { addDays, addMonths, format, isSameDay, parse, isValid } from 'date-fns';
|
|
2
|
+
import { handleKeyDown } from '-/utils/handleKeyDown';
|
|
3
|
+
|
|
4
|
+
export const COLUMNS_COUNT = 7;
|
|
5
|
+
|
|
6
|
+
export function parseDate(next: string | undefined) {
|
|
7
|
+
// don't allow parsing unless the format is approximately mm/dd/yyyy
|
|
8
|
+
if (!/^\d{1,2}\/\d{1,2}\/\d{2,4}$/.test(next || '')) return undefined;
|
|
9
|
+
|
|
10
|
+
const parsedDate = next ? parse(next, 'MM/dd/yyyy', new Date()) : undefined;
|
|
11
|
+
|
|
12
|
+
if (!isValid(parsedDate)) return undefined;
|
|
13
|
+
|
|
14
|
+
if (parsedDate && parsedDate.getFullYear() < 100) {
|
|
15
|
+
parsedDate.setFullYear(parsedDate.getFullYear() + 2000);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return parsedDate;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function optionIdGenerator(baseId: string) {
|
|
22
|
+
return (date: Date) => `${baseId}-option-${format(date, 'MM-dd-yyyy')}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type Direction = 'down' | 'left' | 'right' | 'up';
|
|
26
|
+
|
|
27
|
+
const DIRECTION_INCREMENT: Record<Direction, number> = {
|
|
28
|
+
// same day next week
|
|
29
|
+
down: 1 * COLUMNS_COUNT,
|
|
30
|
+
// next day
|
|
31
|
+
right: 1,
|
|
32
|
+
// same day previous week
|
|
33
|
+
up: -1 * COLUMNS_COUNT,
|
|
34
|
+
// previous day
|
|
35
|
+
left: -1,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const useKeyDownCaptures = ({
|
|
39
|
+
activeDate,
|
|
40
|
+
setActiveDate,
|
|
41
|
+
rows,
|
|
42
|
+
focusActiveDay,
|
|
43
|
+
}: {
|
|
44
|
+
activeDate: Date;
|
|
45
|
+
setActiveDate: (date: Date) => void;
|
|
46
|
+
rows: Date[][];
|
|
47
|
+
focusActiveDay: () => void;
|
|
48
|
+
}) => {
|
|
49
|
+
const handleItemArrows = (direction: Direction) => () => {
|
|
50
|
+
const next = addDays(activeDate, DIRECTION_INCREMENT[direction]);
|
|
51
|
+
setActiveDate(next);
|
|
52
|
+
focusActiveDay();
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const handleEnterOrSpace = (event: React.KeyboardEvent) => {
|
|
56
|
+
const target = event.target as HTMLElement;
|
|
57
|
+
if (target.nodeName === 'TD') target.click();
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
handleKeyDownCapture: handleKeyDown(
|
|
62
|
+
{
|
|
63
|
+
ArrowDown: handleItemArrows('down'),
|
|
64
|
+
ArrowUp: handleItemArrows('up'),
|
|
65
|
+
ArrowLeft: handleItemArrows('left'),
|
|
66
|
+
ArrowRight: handleItemArrows('right'),
|
|
67
|
+
End: () => {
|
|
68
|
+
const next = rows.find((r) => r.some((d) => isSameDay(d, activeDate)))?.[COLUMNS_COUNT - 1];
|
|
69
|
+
if (!next || isSameDay(next, activeDate)) return;
|
|
70
|
+
|
|
71
|
+
setActiveDate(next);
|
|
72
|
+
focusActiveDay();
|
|
73
|
+
},
|
|
74
|
+
Home: () => {
|
|
75
|
+
const next = rows.find((r) => r.some((d) => isSameDay(d, activeDate)))?.[0];
|
|
76
|
+
if (!next || isSameDay(next, activeDate)) return;
|
|
77
|
+
|
|
78
|
+
setActiveDate(next);
|
|
79
|
+
focusActiveDay();
|
|
80
|
+
},
|
|
81
|
+
PageDown: () => {
|
|
82
|
+
setActiveDate(addMonths(activeDate, 1));
|
|
83
|
+
focusActiveDay();
|
|
84
|
+
},
|
|
85
|
+
PageUp: () => {
|
|
86
|
+
setActiveDate(addMonths(activeDate, -1));
|
|
87
|
+
focusActiveDay();
|
|
88
|
+
},
|
|
89
|
+
Space: handleEnterOrSpace,
|
|
90
|
+
Enter: handleEnterOrSpace,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
preventDefault: true,
|
|
94
|
+
stopPropagation: true,
|
|
95
|
+
},
|
|
96
|
+
),
|
|
97
|
+
};
|
|
98
|
+
};
|
|
@@ -52,17 +52,17 @@ export type CarouselProps = {
|
|
|
52
52
|
* import { Carousel } from '@bspk/ui/Carousel';
|
|
53
53
|
*
|
|
54
54
|
* <Carousel label="Example Carousel" width="1/2">
|
|
55
|
-
* <
|
|
56
|
-
* <
|
|
57
|
-
* <
|
|
58
|
-
* <
|
|
59
|
-
* <
|
|
60
|
-
* <
|
|
61
|
-
* <
|
|
55
|
+
* <ExamplePlaceholder>Slide 1</ExamplePlaceholder>
|
|
56
|
+
* <ExamplePlaceholder>Slide 2</ExamplePlaceholder>
|
|
57
|
+
* <ExamplePlaceholder>Slide 3</ExamplePlaceholder>
|
|
58
|
+
* <ExamplePlaceholder>Slide 4</ExamplePlaceholder>
|
|
59
|
+
* <ExamplePlaceholder>Slide 5</ExamplePlaceholder>
|
|
60
|
+
* <ExamplePlaceholder>Slide 6</ExamplePlaceholder>
|
|
61
|
+
* <ExamplePlaceholder>Slide 7</ExamplePlaceholder>
|
|
62
62
|
* </Carousel>;
|
|
63
63
|
*
|
|
64
64
|
* @name Carousel
|
|
65
|
-
* @phase
|
|
65
|
+
* @phase Stable
|
|
66
66
|
*/
|
|
67
67
|
|
|
68
68
|
export function Carousel({
|
|
@@ -10,7 +10,7 @@ export type CheckboxGroupFieldProps = FormFieldControlProps<CheckboxGroupProps>;
|
|
|
10
10
|
* This component takes properties from the FormField and CheckboxGroup components.
|
|
11
11
|
*
|
|
12
12
|
* @name CheckboxGroupField
|
|
13
|
-
* @phase
|
|
13
|
+
* @phase Stable
|
|
14
14
|
*
|
|
15
15
|
* @generated
|
|
16
16
|
*/
|
|
@@ -3,7 +3,7 @@ import { hasNoBasicA11yIssues } from '-/rtl/hasNoBasicA11yIssues';
|
|
|
3
3
|
import { render } from '-/rtl/util';
|
|
4
4
|
|
|
5
5
|
const TestBed = () => (
|
|
6
|
-
<DatePicker name="calendar input" onChange={() => {}} placeholder="Select Date" value=
|
|
6
|
+
<DatePicker name="calendar input" onChange={() => {}} placeholder="Select Date" value="06/03/1985" />
|
|
7
7
|
);
|
|
8
8
|
|
|
9
9
|
describe('DatePicker', () => {
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import './date-picker.scss';
|
|
2
2
|
import { SvgEvent } from '@bspk/icons/Event';
|
|
3
|
-
import { format,
|
|
4
|
-
import {
|
|
3
|
+
import { format, startOfToday } from 'date-fns';
|
|
4
|
+
import { useMemo, useState } from 'react';
|
|
5
5
|
import { Button } from '-/components/Button';
|
|
6
|
-
import { Calendar } from '-/components/Calendar';
|
|
6
|
+
import { Calendar, parseDate } from '-/components/Calendar';
|
|
7
7
|
import { useFieldInit } from '-/components/Field';
|
|
8
8
|
import { InputElement, InputProps } from '-/components/Input';
|
|
9
|
-
import { Portal } from '-/components/Portal';
|
|
10
9
|
import { useFloating } from '-/hooks/useFloating';
|
|
11
10
|
import { useOutsideClick } from '-/hooks/useOutsideClick';
|
|
12
11
|
import { FieldControlProps } from '-/types/common';
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export type DatePickerProps = FieldControlProps<Date | undefined> &
|
|
13
|
+
export type DatePickerProps = Omit<FieldControlProps, 'aria-label' | 'onChange' | 'value'> &
|
|
17
14
|
Pick<InputProps, 'size'> & {
|
|
18
15
|
/**
|
|
19
16
|
* If the calendar should close when a date is selected.
|
|
@@ -27,6 +24,22 @@ export type DatePickerProps = FieldControlProps<Date | undefined> &
|
|
|
27
24
|
* @default mm/dd/yyyy
|
|
28
25
|
*/
|
|
29
26
|
placeholder?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The currently selected date
|
|
29
|
+
*
|
|
30
|
+
* String formatted as 'MM/dd/yyyy'.
|
|
31
|
+
*
|
|
32
|
+
* @type string
|
|
33
|
+
*/
|
|
34
|
+
value?: string;
|
|
35
|
+
/** Fires when the date changes with the new date */
|
|
36
|
+
onChange: (next: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* The aria-label attribute for the date input field.
|
|
39
|
+
*
|
|
40
|
+
* @default Enter or choose date
|
|
41
|
+
*/
|
|
42
|
+
'aria-label'?: string;
|
|
30
43
|
};
|
|
31
44
|
|
|
32
45
|
/**
|
|
@@ -41,28 +54,24 @@ export type DatePickerProps = FieldControlProps<Date | undefined> &
|
|
|
41
54
|
* import { useState } from 'react';
|
|
42
55
|
*
|
|
43
56
|
* () => {
|
|
44
|
-
* const [
|
|
57
|
+
* const [fieldDate, setFieldDate] = useState<string>();
|
|
45
58
|
*
|
|
46
59
|
* return (
|
|
47
|
-
*
|
|
48
|
-
* // standalone date picker example
|
|
49
|
-
* <DatePicker aria-label="Date" name="date2" value={date} onChange={setDate} />
|
|
50
|
-
* <br />
|
|
51
|
-
* // date picker used within a field
|
|
60
|
+
* <div style={{ width: 320 }}>
|
|
52
61
|
* <Field>
|
|
53
62
|
* <FieldLabel>Date</FieldLabel>
|
|
54
|
-
* <DatePicker name="date1"
|
|
63
|
+
* <DatePicker name="date1" onChange={setFieldDate} required value={fieldDate} />
|
|
55
64
|
* <FieldDescription>The date picker allows you to select a date.</FieldDescription>
|
|
56
65
|
* </Field>
|
|
57
|
-
*
|
|
66
|
+
* </div>
|
|
58
67
|
* );
|
|
59
68
|
* };
|
|
60
69
|
*
|
|
61
70
|
* @name DatePicker
|
|
62
|
-
* @phase
|
|
71
|
+
* @phase Stable
|
|
63
72
|
*/
|
|
64
73
|
export function DatePicker({
|
|
65
|
-
value
|
|
74
|
+
value,
|
|
66
75
|
onChange,
|
|
67
76
|
disabled,
|
|
68
77
|
readOnly,
|
|
@@ -73,7 +82,7 @@ export function DatePicker({
|
|
|
73
82
|
required = false,
|
|
74
83
|
size,
|
|
75
84
|
id: idProp,
|
|
76
|
-
'aria-label': ariaLabel = '
|
|
85
|
+
'aria-label': ariaLabel = 'Enter or choose date',
|
|
77
86
|
}: DatePickerProps) {
|
|
78
87
|
const { id, ariaDescribedBy, ariaErrorMessage, invalid } = useFieldInit({
|
|
79
88
|
idProp,
|
|
@@ -83,74 +92,29 @@ export function DatePicker({
|
|
|
83
92
|
invalidProp,
|
|
84
93
|
});
|
|
85
94
|
|
|
86
|
-
const value = useMemo(() => {
|
|
87
|
-
if (typeof valueProp === 'string') {
|
|
88
|
-
const parsedDate = new Date(valueProp);
|
|
89
|
-
return isValid(parsedDate) ? parsedDate : undefined;
|
|
90
|
-
}
|
|
91
|
-
return valueProp instanceof Date && isValid(valueProp) ? valueProp : undefined;
|
|
92
|
-
}, [valueProp]);
|
|
93
|
-
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
const formattedValue = value ? format(value, 'MM/dd/yyyy') : '';
|
|
96
|
-
setTextValue(formattedValue);
|
|
97
|
-
}, [value]);
|
|
98
|
-
const [textValue, setTextValue] = useState(() => (value ? format(value, 'MM/dd/yyyy') : ''));
|
|
99
|
-
|
|
100
95
|
const [calendarVisible, setCalendarVisible] = useState(false);
|
|
101
|
-
const containerRef = useRef<HTMLSpanElement | null>(null);
|
|
102
96
|
|
|
103
97
|
const { elements, floatingStyles } = useFloating({
|
|
104
|
-
placement: 'bottom',
|
|
98
|
+
placement: 'bottom-start',
|
|
105
99
|
strategy: 'absolute',
|
|
106
100
|
offsetOptions: 4,
|
|
107
|
-
refWidth:
|
|
101
|
+
refWidth: false,
|
|
108
102
|
});
|
|
109
103
|
|
|
110
104
|
useOutsideClick({
|
|
111
|
-
elements: [elements.floating
|
|
105
|
+
elements: [elements.floating],
|
|
112
106
|
callback: () => setCalendarVisible(false),
|
|
113
107
|
disabled: !calendarVisible,
|
|
114
108
|
});
|
|
115
109
|
|
|
116
|
-
const
|
|
117
|
-
const parsedDate = parse(next, 'MM/dd/yyyy', new Date());
|
|
118
|
-
return isValid(parsedDate) ? parsedDate : undefined;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const validate = () => {
|
|
122
|
-
let nextDate: Date | undefined;
|
|
123
|
-
let nextTextValue = '';
|
|
124
|
-
|
|
125
|
-
if (parsableDate(textValue)) {
|
|
126
|
-
nextDate = isValidDate(textValue);
|
|
127
|
-
if (nextDate) nextTextValue = format(nextDate, 'MM/dd/yyyy');
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
setTextValue(nextTextValue);
|
|
131
|
-
onChange(nextDate);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const handleTextChange = (nextValue: string) => {
|
|
135
|
-
// Add slashes as the user types
|
|
136
|
-
if (/^\d{2}$/.test(nextValue) || /^\d{1,2}\/\d{2}$/.test(nextValue)) nextValue = `${nextValue}/`;
|
|
137
|
-
|
|
138
|
-
// Remove extra slashes
|
|
139
|
-
if (nextValue.endsWith('//')) nextValue = nextValue.slice(0, -1);
|
|
110
|
+
const calendarId = `${id}-calendar`;
|
|
140
111
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (parsableDate(nextValue)) {
|
|
144
|
-
const next = isValidDate(nextValue);
|
|
145
|
-
if (next) onChange(next);
|
|
146
|
-
}
|
|
147
|
-
};
|
|
112
|
+
const activeDate = useMemo(() => parseDate(value) || startOfToday(), [value]);
|
|
148
113
|
|
|
149
114
|
return (
|
|
150
115
|
<div
|
|
151
116
|
data-bspk="date-picker"
|
|
152
117
|
ref={(node) => {
|
|
153
|
-
containerRef.current = node;
|
|
154
118
|
elements.setReference(node);
|
|
155
119
|
}}
|
|
156
120
|
>
|
|
@@ -162,25 +126,7 @@ export function DatePicker({
|
|
|
162
126
|
id={id}
|
|
163
127
|
invalid={invalid || undefined}
|
|
164
128
|
name={name}
|
|
165
|
-
|
|
166
|
-
onChange={handleTextChange}
|
|
167
|
-
onKeyDown={(event) => {
|
|
168
|
-
// allow select all and other keyboard shortcuts
|
|
169
|
-
if (event.ctrlKey || event.metaKey) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// handle backspace and delete to remove the slash and the number before it
|
|
174
|
-
if (event.key === 'Backspace' || (event.key === 'Delete' && textValue.endsWith('/'))) {
|
|
175
|
-
event.preventDefault();
|
|
176
|
-
setTextValue((prev) => prev.slice(0, -2));
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// if a single key and not a number or forward slash ignore
|
|
180
|
-
if (event.key.length === 1 && !/[0-9/]/.test(event.key)) {
|
|
181
|
-
event.preventDefault();
|
|
182
|
-
}
|
|
183
|
-
}}
|
|
129
|
+
onChange={onChange}
|
|
184
130
|
placeholder={placeholder || 'mm/dd/yyyy'}
|
|
185
131
|
readOnly={readOnly}
|
|
186
132
|
required={required}
|
|
@@ -198,28 +144,27 @@ export function DatePicker({
|
|
|
198
144
|
/>
|
|
199
145
|
)
|
|
200
146
|
}
|
|
201
|
-
value={
|
|
147
|
+
value={typeof value === 'string' ? value : ''}
|
|
202
148
|
/>
|
|
203
149
|
{calendarVisible && (
|
|
204
|
-
<
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
150
|
+
<div
|
|
151
|
+
aria-label="Choose Date"
|
|
152
|
+
aria-modal="true"
|
|
153
|
+
data-bspk="calendar-popup"
|
|
154
|
+
ref={(node) => elements.setFloating(node)}
|
|
155
|
+
role="dialog"
|
|
156
|
+
style={{ ...floatingStyles }}
|
|
157
|
+
>
|
|
158
|
+
<Calendar
|
|
159
|
+
focusTrap
|
|
160
|
+
id={calendarId}
|
|
161
|
+
onChange={(next) => {
|
|
162
|
+
if (closeCalendarOnChange) setCalendarVisible(false);
|
|
163
|
+
onChange(format(next, 'MM/dd/yyyy'));
|
|
209
164
|
}}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
focusTrap={true}
|
|
214
|
-
onChange={(next) => {
|
|
215
|
-
if (closeCalendarOnChange) setCalendarVisible(false);
|
|
216
|
-
onChange(next);
|
|
217
|
-
}}
|
|
218
|
-
value={value}
|
|
219
|
-
variant="elevated"
|
|
220
|
-
/>
|
|
221
|
-
</div>
|
|
222
|
-
</Portal>
|
|
165
|
+
value={activeDate}
|
|
166
|
+
/>
|
|
167
|
+
</div>
|
|
223
168
|
)}
|
|
224
169
|
</div>
|
|
225
170
|
);
|
|
@@ -1,12 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { DatePicker, DatePickerProps } from '.';
|
|
3
|
+
import { Field, FieldLabel, FieldDescription } from '-/components/Field';
|
|
2
4
|
import { ComponentExample } from '-/utils/demo';
|
|
3
5
|
|
|
4
6
|
export const DatePickerExample: ComponentExample<DatePickerProps> = {
|
|
7
|
+
containerStyle: { width: 320, padding: 0 },
|
|
5
8
|
defaultState: {
|
|
6
|
-
value:
|
|
9
|
+
value: '06/03/1985',
|
|
7
10
|
'aria-label': 'Select date',
|
|
8
11
|
},
|
|
9
12
|
disableProps: [],
|
|
10
|
-
|
|
13
|
+
|
|
11
14
|
variants: false,
|
|
12
15
|
};
|
|
16
|
+
|
|
17
|
+
export const Usage = () => {
|
|
18
|
+
const [fieldDate, setFieldDate] = useState<string>();
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div style={{ width: 320 }}>
|
|
22
|
+
<Field>
|
|
23
|
+
<FieldLabel>Date</FieldLabel>
|
|
24
|
+
<DatePicker name="date1" onChange={setFieldDate} required value={fieldDate} />
|
|
25
|
+
<FieldDescription>The date picker allows you to select a date.</FieldDescription>
|
|
26
|
+
</Field>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
@@ -7,6 +7,17 @@
|
|
|
7
7
|
[data-bspk='input'] {
|
|
8
8
|
padding-right: 0;
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
[data-bspk='calendar-popup'] {
|
|
12
|
+
border-radius: var(--radius-lg);
|
|
13
|
+
box-shadow: var(--drop-shadow-float);
|
|
14
|
+
z-index: var(--z-index-dropdown);
|
|
15
|
+
width: fit-content;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
[data-bspk='inline-alert'] {
|
|
19
|
+
margin-top: var(--spacing-sizing-01);
|
|
20
|
+
}
|
|
10
21
|
}
|
|
11
22
|
|
|
12
23
|
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
@@ -46,14 +46,14 @@ const insetToVariable = (insetProp: number | string) => {
|
|
|
46
46
|
* @example
|
|
47
47
|
* import { Divider } from '@bspk/ui/Divider';
|
|
48
48
|
*
|
|
49
|
-
* <div>
|
|
50
|
-
* <
|
|
49
|
+
* <div style={{ width: 320 }}>
|
|
50
|
+
* <ExamplePlaceholder>Content above the divider</ExamplePlaceholder>
|
|
51
51
|
* <Divider orientation="horizontal" />
|
|
52
|
-
* <
|
|
52
|
+
* <ExamplePlaceholder>Content below the divider</ExamplePlaceholder>
|
|
53
53
|
* </div>;
|
|
54
54
|
*
|
|
55
55
|
* @name Divider
|
|
56
|
-
* @phase
|
|
56
|
+
* @phase Stable
|
|
57
57
|
*/
|
|
58
58
|
export function Divider({
|
|
59
59
|
padding = true,
|