@bspk/ui 1.3.10 → 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 +16 -29
- package/dist/components/ChipGroup/ChipGroup.js +13 -23
- package/dist/components/ChipGroup/ChipGroup.js.map +1 -1
- package/dist/components/ChipGroup/ChipGroupExample.js +61 -6
- package/dist/components/ChipGroup/ChipGroupExample.js.map +1 -1
- package/dist/components/ChipGroup/chip-group.css +5 -3
- package/dist/components/ChipGroup/chip-group.css.js +5 -3
- 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 +10 -4
- package/dist/components/OTPInput/OTPInput.js +8 -40
- package/dist/components/OTPInput/OTPInput.js.map +1 -1
- package/dist/components/OTPInput/OTPInputExample.js +6 -2
- package/dist/components/OTPInput/OTPInputExample.js.map +1 -1
- package/dist/components/OTPInput/otp-input.css +18 -17
- package/dist/components/OTPInput/otp-input.css.js +18 -17
- 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.rtl.test.tsx +16 -11
- package/src/components/ChipGroup/ChipGroup.tsx +19 -37
- package/src/components/ChipGroup/ChipGroupExample.tsx +64 -36
- package/src/components/ChipGroup/chip-group.scss +5 -3
- 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.rtl.test.tsx +4 -2
- package/src/components/OTPInput/OTPInput.tsx +31 -64
- package/src/components/OTPInput/OTPInputExample.tsx +6 -2
- package/src/components/OTPInput/otp-input.scss +50 -45
- 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
|
@@ -54,37 +54,28 @@ export type InputNumberProps = CommonProps<'size'> &
|
|
|
54
54
|
* import { InputNumber } from '@bspk/ui/InputNumber';
|
|
55
55
|
*
|
|
56
56
|
* () => {
|
|
57
|
-
* const [
|
|
57
|
+
* const [value, setValue] = useState<number | undefined>();
|
|
58
58
|
*
|
|
59
59
|
* return (
|
|
60
|
-
*
|
|
61
|
-
* // standalone input number example
|
|
62
|
-
* <InputNumber
|
|
63
|
-
* aria-label="Example aria-label"
|
|
64
|
-
* name="example-name"
|
|
65
|
-
* onChange={(nextValue) => setState(nextValue)}
|
|
66
|
-
* value={state}
|
|
67
|
-
* />
|
|
68
|
-
* <br />
|
|
69
|
-
* // input number used within a field
|
|
60
|
+
* <div style={{ width: 320 }}>
|
|
70
61
|
* <Field>
|
|
71
62
|
* <FieldLabel>Example Input Number</FieldLabel>
|
|
72
63
|
* <InputNumber
|
|
73
64
|
* aria-label="Example aria-label"
|
|
74
65
|
* name="example-name"
|
|
75
|
-
* onChange={(nextValue) =>
|
|
76
|
-
* value={
|
|
66
|
+
* onChange={(nextValue) => setValue(nextValue)}
|
|
67
|
+
* value={value}
|
|
77
68
|
* />
|
|
78
69
|
* <FieldDescription>
|
|
79
70
|
* The input number allows you to increment or decrement a value.
|
|
80
71
|
* </FieldDescription>
|
|
81
72
|
* </Field>
|
|
82
|
-
*
|
|
73
|
+
* </div>
|
|
83
74
|
* );
|
|
84
75
|
* };
|
|
85
76
|
*
|
|
86
77
|
* @name InputNumber
|
|
87
|
-
* @phase
|
|
78
|
+
* @phase Stable
|
|
88
79
|
*/
|
|
89
80
|
export function InputNumber({
|
|
90
81
|
value: valueProp,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { InputNumber, InputNumberProps } from './InputNumber';
|
|
3
|
+
import { Field, FieldLabel, FieldDescription } from '-/components/Field';
|
|
2
4
|
import { ComponentExample } from '-/utils/demo';
|
|
3
5
|
|
|
4
6
|
export const InputNumberExample: ComponentExample<InputNumberProps> = {
|
|
@@ -7,4 +9,25 @@ export const InputNumberExample: ComponentExample<InputNumberProps> = {
|
|
|
7
9
|
},
|
|
8
10
|
render: ({ props, Component }) => <Component {...props} />,
|
|
9
11
|
variants: false,
|
|
12
|
+
sections: [],
|
|
13
|
+
containerStyle: { width: 320, padding: 0 },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const Usage = () => {
|
|
17
|
+
const [value, setValue] = useState<number | undefined>();
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div style={{ width: 320 }}>
|
|
21
|
+
<Field>
|
|
22
|
+
<FieldLabel>Example Input Number</FieldLabel>
|
|
23
|
+
<InputNumber
|
|
24
|
+
aria-label="Example aria-label"
|
|
25
|
+
name="example-name"
|
|
26
|
+
onChange={(nextValue) => setValue(nextValue)}
|
|
27
|
+
value={value}
|
|
28
|
+
/>
|
|
29
|
+
<FieldDescription>The input number allows you to increment or decrement a value.</FieldDescription>
|
|
30
|
+
</Field>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
10
33
|
};
|
|
@@ -10,13 +10,13 @@ import { Menu } from '-/components/Menu';
|
|
|
10
10
|
import { useArrowNavigation } from '-/hooks/useArrowNavigation';
|
|
11
11
|
import { useFloating } from '-/hooks/useFloating';
|
|
12
12
|
import { useOutsideClick } from '-/hooks/useOutsideClick';
|
|
13
|
-
import { useUIContext } from '-/hooks/useUIContext';
|
|
14
13
|
import { FieldControlProps } from '-/types/common';
|
|
15
14
|
import { countryCodeData, countryCodes, SupportedCountryCode } from '-/utils/countryCodes';
|
|
16
15
|
import { getElementById } from '-/utils/dom';
|
|
17
16
|
import { guessUserCountryCode } from '-/utils/guessUserCountryCode';
|
|
18
17
|
import { handleKeyDown } from '-/utils/handleKeyDown';
|
|
19
18
|
import { scrollListItemsStyle, ScrollListItemsStyleProps } from '-/utils/scrollListItemsStyle';
|
|
19
|
+
import { sendAriaLiveMessage } from '-/utils/sendAriaLiveMessage';
|
|
20
20
|
import { useIds } from '-/utils/useIds';
|
|
21
21
|
|
|
22
22
|
const SELECT_OPTIONS = countryCodes.map((code) => {
|
|
@@ -58,34 +58,32 @@ export type InputPhoneProps = FieldControlProps<string, SupportedCountryCode> &
|
|
|
58
58
|
*
|
|
59
59
|
* @example
|
|
60
60
|
* import { InputPhone } from '@bspk/ui/InputPhone';
|
|
61
|
+
* import { Field, FieldDescription, FieldLabel } from '@bspk/ui/Field';
|
|
61
62
|
*
|
|
62
63
|
* () => {
|
|
63
|
-
* const [value, onChange] = useState<
|
|
64
|
+
* const [value, onChange] = useState<string | undefined>();
|
|
64
65
|
*
|
|
65
66
|
* return (
|
|
66
|
-
*
|
|
67
|
-
* // standalone input phone example
|
|
68
|
-
* <InputPhone aria-label="Phone Number" initialCountryCode="US" value={value} onChange={onChange} />;
|
|
69
|
-
* <br />
|
|
70
|
-
* // input phone used within a field
|
|
67
|
+
* <div style={{ width: 320 }}>
|
|
71
68
|
* <Field>
|
|
72
69
|
* <FieldLabel>Example Input Phone</FieldLabel>
|
|
73
70
|
* <InputPhone
|
|
74
71
|
* aria-label="Phone Number"
|
|
75
72
|
* initialCountryCode="US"
|
|
76
|
-
*
|
|
73
|
+
* name="example-name"
|
|
77
74
|
* onChange={onChange}
|
|
75
|
+
* value={value}
|
|
78
76
|
* />
|
|
79
77
|
* <FieldDescription>
|
|
80
78
|
* The phone input allows you to enter a phone number with country code.
|
|
81
79
|
* </FieldDescription>
|
|
82
80
|
* </Field>
|
|
83
|
-
*
|
|
81
|
+
* </div>
|
|
84
82
|
* );
|
|
85
83
|
* };
|
|
86
84
|
*
|
|
87
85
|
* @name InputPhone
|
|
88
|
-
* @phase
|
|
86
|
+
* @phase Stable
|
|
89
87
|
*/
|
|
90
88
|
export function InputPhone({
|
|
91
89
|
value,
|
|
@@ -155,19 +153,17 @@ export function InputPhone({
|
|
|
155
153
|
}, [countryCode]);
|
|
156
154
|
|
|
157
155
|
const handleChange = (newValue: string) => {
|
|
158
|
-
|
|
159
|
-
if (rawNumber === value) return;
|
|
156
|
+
const numericChange = value?.replace(/\D/g, '') !== newValue?.replace(/\D/g, '');
|
|
160
157
|
|
|
161
|
-
if
|
|
158
|
+
// only format if the numeric value has changed
|
|
159
|
+
if (!disableFormatting && numericChange) {
|
|
162
160
|
const formatter = new AsYouType(countryCode);
|
|
163
|
-
|
|
161
|
+
newValue = formatter.input(`${newValue}`);
|
|
164
162
|
}
|
|
165
163
|
|
|
166
|
-
onChange(
|
|
164
|
+
onChange(newValue, countryCode);
|
|
167
165
|
};
|
|
168
166
|
|
|
169
|
-
const { sendAriaLiveMessage } = useUIContext();
|
|
170
|
-
|
|
171
167
|
return (
|
|
172
168
|
<>
|
|
173
169
|
<div
|
|
@@ -186,6 +182,7 @@ export function InputPhone({
|
|
|
186
182
|
containerRef={elements.setReference}
|
|
187
183
|
disabled={disabled}
|
|
188
184
|
id={id}
|
|
185
|
+
inputMode="tel"
|
|
189
186
|
inputRef={(node) => {
|
|
190
187
|
inputRef?.(node);
|
|
191
188
|
inputInternalRef.current = node;
|
|
@@ -239,6 +236,10 @@ export function InputPhone({
|
|
|
239
236
|
}
|
|
240
237
|
name={name}
|
|
241
238
|
onChange={handleChange}
|
|
239
|
+
onKeyDown={(event) => {
|
|
240
|
+
// ignore non numeric keys
|
|
241
|
+
if (event.key.length === 1 && !/[0-9]/.test(event.key)) event.preventDefault();
|
|
242
|
+
}}
|
|
242
243
|
owner="input-phone"
|
|
243
244
|
readOnly={readOnly}
|
|
244
245
|
required={required}
|
|
@@ -1,12 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { InputPhone, InputPhoneProps } from '.';
|
|
3
|
+
import { Field, FieldDescription, FieldLabel } from '-/components/Field';
|
|
4
|
+
import { Preset, ComponentExample } from '-/utils/demo';
|
|
3
5
|
|
|
4
6
|
export const presets: Preset<InputPhoneProps>[] = [];
|
|
5
7
|
|
|
6
8
|
export const InputPhoneExample: ComponentExample<InputPhoneProps> = {
|
|
9
|
+
containerStyle: { width: 320, padding: 0 },
|
|
7
10
|
defaultState: {
|
|
8
11
|
'aria-label': 'input phone aria-label',
|
|
9
12
|
},
|
|
10
13
|
render: ({ props, Component }) => <Component {...props} />,
|
|
11
14
|
variants: true,
|
|
12
15
|
};
|
|
16
|
+
|
|
17
|
+
export const Usage = () => {
|
|
18
|
+
const [value, onChange] = useState<string | undefined>();
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div style={{ width: 320 }}>
|
|
22
|
+
<Field>
|
|
23
|
+
<FieldLabel>Example Input Phone</FieldLabel>
|
|
24
|
+
<InputPhone
|
|
25
|
+
aria-label="Phone Number"
|
|
26
|
+
initialCountryCode="US"
|
|
27
|
+
name="example-name"
|
|
28
|
+
onChange={onChange}
|
|
29
|
+
value={value}
|
|
30
|
+
/>
|
|
31
|
+
<FieldDescription>
|
|
32
|
+
The phone input allows you to enter a phone number with country code.
|
|
33
|
+
</FieldDescription>
|
|
34
|
+
</Field>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -49,7 +49,7 @@ export type LinkProps = Pick<CommonPropsLibrary, 'disabled'> & {
|
|
|
49
49
|
* <Link href="https://anywhere.re" label="Example label" trailingIcon="external" />;
|
|
50
50
|
*
|
|
51
51
|
* @name Link
|
|
52
|
-
* @phase
|
|
52
|
+
* @phase Stable
|
|
53
53
|
*/
|
|
54
54
|
export function Link({ label, trailingIcon, size, variant, target = '_self', ...props }: ElementProps<LinkProps, 'a'>) {
|
|
55
55
|
let LazyIcon: LazyExoticComponent<ComponentType<unknown>> | undefined = undefined;
|
|
@@ -42,8 +42,6 @@ export type MenuProps<As extends ElementType = ElementType> = CommonProps<'id' |
|
|
|
42
42
|
* A container housing a simple list of options presented to the customer to select one option at a time.
|
|
43
43
|
*
|
|
44
44
|
* @example
|
|
45
|
-
* import React from 'react';
|
|
46
|
-
*
|
|
47
45
|
* import { Menu } from '@bspk/ui/Menu';
|
|
48
46
|
*
|
|
49
47
|
* <Menu>
|
|
@@ -53,7 +51,7 @@ export type MenuProps<As extends ElementType = ElementType> = CommonProps<'id' |
|
|
|
53
51
|
* </Menu>;
|
|
54
52
|
*
|
|
55
53
|
* @name Menu
|
|
56
|
-
* @phase
|
|
54
|
+
* @phase Stable
|
|
57
55
|
*/
|
|
58
56
|
export function Menu({ as, innerRef, id: idProp, children, owner, label, ...props }: ElementProps<MenuProps, 'div'>) {
|
|
59
57
|
const menuId = useId(idProp);
|
|
@@ -4,8 +4,8 @@ import { ReactNode, useMemo, useRef } from 'react';
|
|
|
4
4
|
import { Button, ButtonProps } from '-/components/Button';
|
|
5
5
|
import { DialogProps, Dialog } from '-/components/Dialog';
|
|
6
6
|
import { Txt } from '-/components/Txt';
|
|
7
|
-
import { useEventListener } from '-/hooks/useAddEventListener';
|
|
8
7
|
import { useDebounceCallback } from '-/hooks/useDebounceCallback';
|
|
8
|
+
import { useEventListener } from '-/hooks/useEventListener';
|
|
9
9
|
import { useUIContext } from '-/hooks/useUIContext';
|
|
10
10
|
import { CallToActionButton } from '-/types/common';
|
|
11
11
|
|
|
@@ -109,8 +109,6 @@ export type ModalProps = Pick<
|
|
|
109
109
|
* footer for the dialog.
|
|
110
110
|
*
|
|
111
111
|
* @example
|
|
112
|
-
* import React from 'react';
|
|
113
|
-
*
|
|
114
112
|
* import { Button } from '@bspk/ui/Button';
|
|
115
113
|
* import { Modal } from '@bspk/ui/Modal';
|
|
116
114
|
*
|
|
@@ -133,7 +131,7 @@ export type ModalProps = Pick<
|
|
|
133
131
|
* };
|
|
134
132
|
*
|
|
135
133
|
* @name Modal
|
|
136
|
-
* @phase
|
|
134
|
+
* @phase Stable
|
|
137
135
|
*/
|
|
138
136
|
export function Modal({
|
|
139
137
|
header,
|
|
@@ -12,8 +12,10 @@ describe('OTPInput (RTL)', () => {
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
it('renders', () => {
|
|
15
|
-
const { getByLabelText } = render(
|
|
15
|
+
const { getByLabelText } = render(
|
|
16
|
+
<OTPInput aria-label="OTP input" onChange={() => {}} {...presets[0].propState} />,
|
|
17
|
+
);
|
|
16
18
|
|
|
17
|
-
expect(getByLabelText('OTP
|
|
19
|
+
expect(getByLabelText('OTP input')).toBeInTheDocument();
|
|
18
20
|
});
|
|
19
21
|
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import './otp-input.scss';
|
|
2
|
-
import { useRef } from 'react';
|
|
3
2
|
import { useId } from '-/hooks/useId';
|
|
4
3
|
import { CommonProps } from '-/types/common';
|
|
5
4
|
|
|
6
|
-
export type OTPInputProps = CommonProps<'id' | 'invalid' | 'name' | 'size'> & {
|
|
5
|
+
export type OTPInputProps = CommonProps<'aria-label' | 'id' | 'invalid' | 'name' | 'size'> & {
|
|
7
6
|
/**
|
|
8
7
|
* The value of the otp-input.
|
|
9
8
|
*
|
|
@@ -26,6 +25,12 @@ export type OTPInputProps = CommonProps<'id' | 'invalid' | 'name' | 'size'> & {
|
|
|
26
25
|
* @maximum 10
|
|
27
26
|
*/
|
|
28
27
|
length?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The mode of the otp-input.
|
|
30
|
+
*
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
alphanumeric?: boolean;
|
|
29
34
|
};
|
|
30
35
|
|
|
31
36
|
/**
|
|
@@ -37,11 +42,11 @@ export type OTPInputProps = CommonProps<'id' | 'invalid' | 'name' | 'size'> & {
|
|
|
37
42
|
* () => {
|
|
38
43
|
* const [otpValue, setOtpValue] = useState('');
|
|
39
44
|
*
|
|
40
|
-
* <OTPInput name="2-auth" length={
|
|
45
|
+
* return <OTPInput name="2-auth" length={6} value={otpValue} onChange={setOtpValue} alphanumeric={false} />;
|
|
41
46
|
* };
|
|
42
47
|
*
|
|
43
48
|
* @name OTPInput
|
|
44
|
-
* @phase
|
|
49
|
+
* @phase Stable
|
|
45
50
|
*/
|
|
46
51
|
export function OTPInput({
|
|
47
52
|
value: valueProp,
|
|
@@ -51,70 +56,32 @@ export function OTPInput({
|
|
|
51
56
|
length = 6,
|
|
52
57
|
size = 'medium',
|
|
53
58
|
invalid = false,
|
|
59
|
+
alphanumeric = false,
|
|
60
|
+
'aria-label': ariaLabel = 'OTP input',
|
|
54
61
|
}: OTPInputProps) {
|
|
55
62
|
const id = useId(idProp);
|
|
56
|
-
const value = valueProp
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
const element = (index: number) => parentRef.current?.children[index + 1] as HTMLElement;
|
|
60
|
-
|
|
61
|
-
const setIndex = (index: number, character: string) => {
|
|
62
|
-
const charArray = value.split('');
|
|
63
|
-
charArray[index] = character;
|
|
64
|
-
return charArray.join('');
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const updateValue = (next: string) => onChange(next.slice(0, length).toUpperCase());
|
|
63
|
+
const value = valueProp || '';
|
|
64
|
+
const activeIndex = Math.min(value.length, length - 1);
|
|
68
65
|
|
|
69
66
|
return (
|
|
70
|
-
<div
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
element(value.length)?.focus();
|
|
89
|
-
}
|
|
90
|
-
}}
|
|
91
|
-
onKeyDown={(event) => {
|
|
92
|
-
if (event.key === 'Backspace') {
|
|
93
|
-
if (value) {
|
|
94
|
-
// delete the last value if there is one and focus the first empty input
|
|
95
|
-
const next = value.slice(0, -1);
|
|
96
|
-
updateValue(next);
|
|
97
|
-
element(next.length)?.focus();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// if a single character key is pressed at at the current index and focus the next input
|
|
102
|
-
if (event.key.length === 1) {
|
|
103
|
-
updateValue(setIndex(index, event.key));
|
|
104
|
-
element(index + 1)?.focus();
|
|
105
|
-
}
|
|
106
|
-
}}
|
|
107
|
-
onPaste={(event) => {
|
|
108
|
-
const pastedData = event.clipboardData.getData('text').trim();
|
|
109
|
-
updateValue(pastedData);
|
|
110
|
-
element(length - 1)?.focus();
|
|
111
|
-
}}
|
|
112
|
-
role="textbox"
|
|
113
|
-
tabIndex={0}
|
|
114
|
-
>
|
|
115
|
-
{value?.[index] || ''}
|
|
116
|
-
</span>
|
|
117
|
-
))}
|
|
67
|
+
<div data-bspk="otp-input" data-invalid={invalid || undefined} data-size={size || 'medium'} id={id}>
|
|
68
|
+
<input
|
|
69
|
+
aria-label={ariaLabel}
|
|
70
|
+
inputMode={alphanumeric ? 'text' : 'numeric'}
|
|
71
|
+
name={name}
|
|
72
|
+
onChange={(event) => {
|
|
73
|
+
onChange(event.target.value.trim().toUpperCase().slice(0, length));
|
|
74
|
+
}}
|
|
75
|
+
type={alphanumeric ? 'text' : 'number'}
|
|
76
|
+
value={value}
|
|
77
|
+
/>
|
|
78
|
+
<span data-digits>
|
|
79
|
+
{Array.from({ length }, (_, index) => (
|
|
80
|
+
<span data-active={index === activeIndex || undefined} data-digit key={index}>
|
|
81
|
+
{value[index]}
|
|
82
|
+
</span>
|
|
83
|
+
))}
|
|
84
|
+
</span>
|
|
118
85
|
</div>
|
|
119
86
|
);
|
|
120
87
|
}
|
|
@@ -21,8 +21,12 @@ export const presets: Preset<OTPInputProps>[] = [
|
|
|
21
21
|
];
|
|
22
22
|
|
|
23
23
|
export const OTPInputExample: ComponentExample<OTPInputProps> = {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
defaultState: {
|
|
25
|
+
value: '',
|
|
26
|
+
length: 6,
|
|
27
|
+
name: 'OTP Input',
|
|
28
|
+
alphanumeric: false,
|
|
29
|
+
},
|
|
26
30
|
disableProps: [],
|
|
27
31
|
presets,
|
|
28
32
|
render: ({ props, Component }) => <Component {...props} />,
|
|
@@ -1,64 +1,69 @@
|
|
|
1
1
|
[data-bspk='otp-input'] {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: row;
|
|
4
|
-
justify-content: center;
|
|
5
|
-
gap: var(--spacing-sizing-02);
|
|
6
|
-
font: var(--font);
|
|
7
2
|
width: fit-content;
|
|
3
|
+
position: relative;
|
|
8
4
|
|
|
9
|
-
[
|
|
5
|
+
input[inputMode] {
|
|
6
|
+
position: absolute;
|
|
7
|
+
inset: 0;
|
|
8
|
+
opacity: 0;
|
|
9
|
+
border: none;
|
|
10
|
+
caret-color: transparent;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[data-digits] {
|
|
10
14
|
display: flex;
|
|
11
|
-
|
|
15
|
+
flex-direction: row;
|
|
12
16
|
justify-content: center;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
aspect-ratio: 1;
|
|
17
|
-
width: var(--width);
|
|
17
|
+
gap: var(--spacing-sizing-02);
|
|
18
|
+
font: var(--font);
|
|
19
|
+
width: fit-content;
|
|
18
20
|
position: relative;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
&:hover:not(:focus)::after {
|
|
22
|
-
background: var(--interaction-hover-opacity);
|
|
23
|
-
content: '';
|
|
24
|
-
position: absolute;
|
|
25
|
-
inset: 0;
|
|
26
|
-
border-radius: var(--radius-sm);
|
|
27
|
-
}
|
|
21
|
+
pointer-events: none;
|
|
28
22
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
[data-digit] {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: row;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
34
28
|
border-radius: var(--radius-sm);
|
|
29
|
+
border: 1px solid var(--stroke-neutral-base);
|
|
30
|
+
flex-grow: 1;
|
|
31
|
+
aspect-ratio: 1;
|
|
32
|
+
width: var(--width);
|
|
33
|
+
position: relative;
|
|
34
|
+
outline: none;
|
|
35
|
+
text-align: center;
|
|
35
36
|
}
|
|
37
|
+
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// caret
|
|
42
|
-
content: '';
|
|
43
|
-
width: 2px;
|
|
44
|
-
height: calc(var(--caret-height) - 8px);
|
|
45
|
-
background: var(--stroke-neutral-high);
|
|
46
|
-
animation: blink-caret 1s step-end infinite;
|
|
47
|
-
|
|
48
|
-
@keyframes blink-caret {
|
|
49
|
-
0%,
|
|
50
|
-
100% {
|
|
51
|
-
opacity: 0;
|
|
52
|
-
}
|
|
39
|
+
input[inputMode]:focus + [data-digits] {
|
|
40
|
+
[data-digit] {
|
|
41
|
+
&[data-active] {
|
|
42
|
+
outline: solid 2px var(--stroke-neutral-focus);
|
|
53
43
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
&:empty::before {
|
|
45
|
+
// caret
|
|
46
|
+
content: '';
|
|
47
|
+
width: 2px;
|
|
48
|
+
height: calc(var(--caret-height) - 8px);
|
|
49
|
+
background: var(--stroke-neutral-high);
|
|
50
|
+
animation: blink-caret 1s step-end infinite;
|
|
57
51
|
}
|
|
58
52
|
}
|
|
59
53
|
}
|
|
60
54
|
}
|
|
61
55
|
|
|
56
|
+
@keyframes blink-caret {
|
|
57
|
+
0%,
|
|
58
|
+
100% {
|
|
59
|
+
opacity: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
50% {
|
|
63
|
+
opacity: 1;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
62
67
|
&[data-size='small'] {
|
|
63
68
|
--width: var(--spacing-sizing-08);
|
|
64
69
|
--font: var(--subheader-medium);
|
|
@@ -43,7 +43,7 @@ export type DotSize = 'medium' | 'small' | 'x-small';
|
|
|
43
43
|
* <PageControl value={1} numPages={3} />;
|
|
44
44
|
*
|
|
45
45
|
* @name PageControl
|
|
46
|
-
* @phase
|
|
46
|
+
* @phase Stable
|
|
47
47
|
*/
|
|
48
48
|
export function PageControl({ currentPage: currentProp, numPages: numPagesProp, variant = 'flat' }: PageControlProps) {
|
|
49
49
|
const numPages = Number(numPagesProp);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PageHeader } from './PageHeader';
|
|
2
|
+
import { presets } from './PageHeaderExample';
|
|
3
|
+
import { hasNoBasicA11yIssues } from '-/rtl/hasNoBasicA11yIssues';
|
|
4
|
+
import { render } from '-/rtl/util';
|
|
5
|
+
|
|
6
|
+
describe('PageHeader (RTL)', () => {
|
|
7
|
+
presets.forEach((preset) => {
|
|
8
|
+
it(`has no basic a11y issues - ${preset.label}`, hasNoBasicA11yIssues(<PageHeader {...preset.propState} />));
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('renders', () => {
|
|
12
|
+
const { getByText } = render(<PageHeader {...presets[0].propState} />);
|
|
13
|
+
|
|
14
|
+
expect(getByText('Page Title')).toBeInTheDocument();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|