@laser-ui/components 0.0.1
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/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +71 -0
- package/accordion/Accordion.d.ts +3 -0
- package/accordion/Accordion.js +162 -0
- package/accordion/index.d.ts +2 -0
- package/accordion/index.js +1 -0
- package/accordion/types.d.ts +20 -0
- package/accordion/types.js +1 -0
- package/accordion/vars.d.ts +10 -0
- package/accordion/vars.js +10 -0
- package/affix/Affix.d.ts +3 -0
- package/affix/Affix.js +56 -0
- package/affix/index.d.ts +2 -0
- package/affix/index.js +1 -0
- package/affix/types.d.ts +14 -0
- package/affix/types.js +1 -0
- package/alert/Alert.d.ts +3 -0
- package/alert/Alert.js +53 -0
- package/alert/index.d.ts +2 -0
- package/alert/index.js +1 -0
- package/alert/types.d.ts +13 -0
- package/alert/types.js +1 -0
- package/alert/vars.d.ts +14 -0
- package/alert/vars.js +14 -0
- package/anchor/Anchor.d.ts +10 -0
- package/anchor/Anchor.js +112 -0
- package/anchor/index.d.ts +2 -0
- package/anchor/index.js +1 -0
- package/anchor/types.d.ts +23 -0
- package/anchor/types.js +1 -0
- package/anchor/vars.d.ts +11 -0
- package/anchor/vars.js +11 -0
- package/avatar/Avatar.d.ts +3 -0
- package/avatar/Avatar.js +43 -0
- package/avatar/index.d.ts +2 -0
- package/avatar/index.js +1 -0
- package/avatar/types.d.ts +11 -0
- package/avatar/types.js +1 -0
- package/avatar/vars.d.ts +9 -0
- package/avatar/vars.js +9 -0
- package/badge/Badge.d.ts +7 -0
- package/badge/Badge.js +61 -0
- package/badge/BadgeText.d.ts +2 -0
- package/badge/BadgeText.js +40 -0
- package/badge/index.d.ts +2 -0
- package/badge/index.js +1 -0
- package/badge/internal/BadgeNumber.d.ts +10 -0
- package/badge/internal/BadgeNumber.js +37 -0
- package/badge/types.d.ts +19 -0
- package/badge/types.js +1 -0
- package/badge/vars.d.ts +12 -0
- package/badge/vars.js +12 -0
- package/breadcrumb/Breadcrumb.d.ts +3 -0
- package/breadcrumb/Breadcrumb.js +22 -0
- package/breadcrumb/index.d.ts +2 -0
- package/breadcrumb/index.js +1 -0
- package/breadcrumb/types.d.ts +15 -0
- package/breadcrumb/types.js +1 -0
- package/breadcrumb/vars.d.ts +8 -0
- package/breadcrumb/vars.js +8 -0
- package/button/Button.d.ts +3 -0
- package/button/Button.js +50 -0
- package/button/index.d.ts +2 -0
- package/button/index.js +1 -0
- package/button/types.d.ts +14 -0
- package/button/types.js +1 -0
- package/button/vars.d.ts +23 -0
- package/button/vars.js +23 -0
- package/card/Card.d.ts +11 -0
- package/card/Card.js +30 -0
- package/card/CardAction.d.ts +3 -0
- package/card/CardAction.js +17 -0
- package/card/CardContent.d.ts +3 -0
- package/card/CardContent.js +13 -0
- package/card/CardHeader.d.ts +3 -0
- package/card/CardHeader.js +13 -0
- package/card/index.d.ts +2 -0
- package/card/index.js +1 -0
- package/card/types.d.ts +17 -0
- package/card/types.js +1 -0
- package/card/vars.d.ts +12 -0
- package/card/vars.js +12 -0
- package/cascader/Cascader.d.ts +5 -0
- package/cascader/Cascader.js +487 -0
- package/cascader/index.d.ts +2 -0
- package/cascader/index.js +1 -0
- package/cascader/internal/CascaderPanel.d.ts +23 -0
- package/cascader/internal/CascaderPanel.js +135 -0
- package/cascader/internal/CascaderSearchPanel.d.ts +22 -0
- package/cascader/internal/CascaderSearchPanel.js +73 -0
- package/cascader/internal/types.d.ts +8 -0
- package/cascader/internal/types.js +1 -0
- package/cascader/types.d.ts +49 -0
- package/cascader/types.js +1 -0
- package/cascader/vars.d.ts +32 -0
- package/cascader/vars.js +32 -0
- package/checkbox/Checkbox.d.ts +7 -0
- package/checkbox/Checkbox.js +25 -0
- package/checkbox/CheckboxGroup.d.ts +3 -0
- package/checkbox/CheckboxGroup.js +25 -0
- package/checkbox/index.d.ts +2 -0
- package/checkbox/index.js +1 -0
- package/checkbox/types.d.ts +29 -0
- package/checkbox/types.js +1 -0
- package/checkbox/vars.d.ts +11 -0
- package/checkbox/vars.js +11 -0
- package/compose/Compose.d.ts +7 -0
- package/compose/Compose.js +24 -0
- package/compose/ComposeItem.d.ts +3 -0
- package/compose/ComposeItem.js +18 -0
- package/compose/index.d.ts +2 -0
- package/compose/index.js +1 -0
- package/compose/types.d.ts +12 -0
- package/compose/types.js +1 -0
- package/compose/vars.d.ts +10 -0
- package/compose/vars.js +10 -0
- package/config-provider/ConfigProvider.d.ts +3 -0
- package/config-provider/ConfigProvider.js +14 -0
- package/config-provider/index.d.ts +2 -0
- package/config-provider/index.js +1 -0
- package/config-provider/types.d.ts +7 -0
- package/config-provider/types.js +1 -0
- package/context/index.d.ts +33 -0
- package/context/index.js +106 -0
- package/context/props.d.ts +134 -0
- package/context/props.js +1 -0
- package/date-picker/DatePicker.d.ts +3 -0
- package/date-picker/DatePicker.js +376 -0
- package/date-picker/index.d.ts +2 -0
- package/date-picker/index.js +1 -0
- package/date-picker/internal/DatePickerPanel.d.ts +15 -0
- package/date-picker/internal/DatePickerPanel.js +104 -0
- package/date-picker/types.d.ts +37 -0
- package/date-picker/types.js +1 -0
- package/date-picker/vars.d.ts +36 -0
- package/date-picker/vars.js +36 -0
- package/dayjs.d.ts +3 -0
- package/dayjs.js +11 -0
- package/drawer/Drawer.d.ts +9 -0
- package/drawer/Drawer.js +141 -0
- package/drawer/DrawerFooter.d.ts +3 -0
- package/drawer/DrawerFooter.js +51 -0
- package/drawer/DrawerHeader.d.ts +3 -0
- package/drawer/DrawerHeader.js +37 -0
- package/drawer/index.d.ts +2 -0
- package/drawer/index.js +1 -0
- package/drawer/types.d.ts +36 -0
- package/drawer/types.js +1 -0
- package/drawer/vars.d.ts +21 -0
- package/drawer/vars.js +18 -0
- package/dropdown/Dropdown.d.ts +5 -0
- package/dropdown/Dropdown.js +376 -0
- package/dropdown/index.d.ts +2 -0
- package/dropdown/index.js +1 -0
- package/dropdown/internal/DropdownGroup.d.ts +13 -0
- package/dropdown/internal/DropdownGroup.js +8 -0
- package/dropdown/internal/DropdownItem.d.ts +16 -0
- package/dropdown/internal/DropdownItem.js +9 -0
- package/dropdown/internal/DropdownSub.d.ts +22 -0
- package/dropdown/internal/DropdownSub.js +78 -0
- package/dropdown/types.d.ts +31 -0
- package/dropdown/types.js +1 -0
- package/dropdown/utils.d.ts +4 -0
- package/dropdown/utils.js +18 -0
- package/dropdown/vars.d.ts +23 -0
- package/dropdown/vars.js +23 -0
- package/empty/Empty.d.ts +7 -0
- package/empty/Empty.js +18 -0
- package/empty/index.d.ts +2 -0
- package/empty/index.js +1 -0
- package/empty/types.d.ts +8 -0
- package/empty/types.js +1 -0
- package/empty/vars.d.ts +7 -0
- package/empty/vars.js +7 -0
- package/fab/Fab.d.ts +9 -0
- package/fab/Fab.js +31 -0
- package/fab/FabBacktop.d.ts +3 -0
- package/fab/FabBacktop.js +58 -0
- package/fab/FabButton.d.ts +3 -0
- package/fab/FabButton.js +23 -0
- package/fab/index.d.ts +2 -0
- package/fab/index.js +1 -0
- package/fab/types.d.ts +26 -0
- package/fab/types.js +1 -0
- package/fab/vars.d.ts +28 -0
- package/fab/vars.js +28 -0
- package/form/Form.d.ts +7 -0
- package/form/Form.js +34 -0
- package/form/FormItem.d.ts +5 -0
- package/form/FormItem.js +201 -0
- package/form/hooks.d.ts +5 -0
- package/form/hooks.js +18 -0
- package/form/index.d.ts +8 -0
- package/form/index.js +7 -0
- package/form/internal/FormError.d.ts +12 -0
- package/form/internal/FormError.js +24 -0
- package/form/model/abstract-control.d.ts +67 -0
- package/form/model/abstract-control.js +335 -0
- package/form/model/form-control.d.ts +23 -0
- package/form/model/form-control.js +72 -0
- package/form/model/form-group.d.ts +62 -0
- package/form/model/form-group.js +165 -0
- package/form/model/types.d.ts +8 -0
- package/form/model/types.js +1 -0
- package/form/model/validators.d.ts +11 -0
- package/form/model/validators.js +83 -0
- package/form/model/vars.d.ts +1 -0
- package/form/model/vars.js +1 -0
- package/form/types.d.ts +63 -0
- package/form/types.js +1 -0
- package/form/vars.d.ts +27 -0
- package/form/vars.js +25 -0
- package/hooks/index.d.ts +14 -0
- package/hooks/index.js +14 -0
- package/hooks/useComponentProps.d.ts +2 -0
- package/hooks/useComponentProps.js +15 -0
- package/hooks/useControlled.d.ts +3 -0
- package/hooks/useControlled.js +26 -0
- package/hooks/useDesign.d.ts +12 -0
- package/hooks/useDesign.js +8 -0
- package/hooks/useFocusVisible.d.ts +2 -0
- package/hooks/useFocusVisible.js +38 -0
- package/hooks/useLayout.d.ts +5 -0
- package/hooks/useLayout.js +10 -0
- package/hooks/useListenGlobalScrolling.d.ts +1 -0
- package/hooks/useListenGlobalScrolling.js +9 -0
- package/hooks/useLockScroll.d.ts +1 -0
- package/hooks/useLockScroll.js +24 -0
- package/hooks/useMaxIndex.d.ts +1 -0
- package/hooks/useMaxIndex.js +32 -0
- package/hooks/useNamespace.d.ts +1 -0
- package/hooks/useNamespace.js +6 -0
- package/hooks/useNestedPopup.d.ts +13 -0
- package/hooks/useNestedPopup.js +37 -0
- package/hooks/useNextTick.d.ts +2 -0
- package/hooks/useNextTick.js +9 -0
- package/hooks/useScopedProps.d.ts +8 -0
- package/hooks/useScopedProps.js +7 -0
- package/hooks/useStyled.d.ts +20 -0
- package/hooks/useStyled.js +82 -0
- package/hooks/useTranslation.d.ts +4 -0
- package/hooks/useTranslation.js +17 -0
- package/icon/Icon.d.ts +3 -0
- package/icon/Icon.js +18 -0
- package/icon/index.d.ts +2 -0
- package/icon/index.js +1 -0
- package/icon/types.d.ts +12 -0
- package/icon/types.js +1 -0
- package/icon/vars.d.ts +7 -0
- package/icon/vars.js +7 -0
- package/image/Image.d.ts +9 -0
- package/image/Image.js +50 -0
- package/image/ImageAction.d.ts +3 -0
- package/image/ImageAction.js +15 -0
- package/image/ImagePreview.d.ts +3 -0
- package/image/ImagePreview.js +261 -0
- package/image/index.d.ts +2 -0
- package/image/index.js +1 -0
- package/image/types.d.ts +24 -0
- package/image/types.js +1 -0
- package/image/vars.d.ts +26 -0
- package/image/vars.js +26 -0
- package/index.d.ts +52 -0
- package/index.js +52 -0
- package/input/Input.d.ts +7 -0
- package/input/Input.js +56 -0
- package/input/InputNumber.d.ts +2 -0
- package/input/InputNumber.js +142 -0
- package/input/index.d.ts +2 -0
- package/input/index.js +1 -0
- package/input/types.d.ts +44 -0
- package/input/types.js +1 -0
- package/input/vars.d.ts +14 -0
- package/input/vars.js +14 -0
- package/internal/circular-progress/CircularProgress.d.ts +2 -0
- package/internal/circular-progress/CircularProgress.js +11 -0
- package/internal/circular-progress/index.d.ts +1 -0
- package/internal/circular-progress/index.js +1 -0
- package/internal/circular-progress/vars.d.ts +4 -0
- package/internal/circular-progress/vars.js +4 -0
- package/internal/mask/Mask.d.ts +3 -0
- package/internal/mask/Mask.js +36 -0
- package/internal/mask/index.d.ts +2 -0
- package/internal/mask/index.js +1 -0
- package/internal/mask/types.d.ts +7 -0
- package/internal/mask/types.js +1 -0
- package/internal/mask/vars.d.ts +3 -0
- package/internal/mask/vars.js +3 -0
- package/internal/popup/Popup.d.ts +3 -0
- package/internal/popup/Popup.js +132 -0
- package/internal/popup/index.d.ts +2 -0
- package/internal/popup/index.js +1 -0
- package/internal/popup/types.d.ts +21 -0
- package/internal/popup/types.js +1 -0
- package/internal/portal/Portal.d.ts +3 -0
- package/internal/portal/Portal.js +14 -0
- package/internal/portal/index.d.ts +2 -0
- package/internal/portal/index.js +1 -0
- package/internal/portal/types.d.ts +6 -0
- package/internal/portal/types.js +1 -0
- package/internal/transition/CollapseTransition.d.ts +3 -0
- package/internal/transition/CollapseTransition.js +101 -0
- package/internal/transition/Transition.d.ts +3 -0
- package/internal/transition/Transition.js +87 -0
- package/internal/transition/index.d.ts +3 -0
- package/internal/transition/index.js +2 -0
- package/internal/transition/types.d.ts +33 -0
- package/internal/transition/types.js +1 -0
- package/internal/wave/Wave.d.ts +3 -0
- package/internal/wave/Wave.js +25 -0
- package/internal/wave/index.d.ts +2 -0
- package/internal/wave/index.js +1 -0
- package/internal/wave/types.d.ts +6 -0
- package/internal/wave/types.js +1 -0
- package/internal/wave/vars.d.ts +3 -0
- package/internal/wave/vars.js +3 -0
- package/menu/Menu.d.ts +5 -0
- package/menu/Menu.js +386 -0
- package/menu/index.d.ts +2 -0
- package/menu/index.js +1 -0
- package/menu/internal/MenuGroup.d.ts +15 -0
- package/menu/internal/MenuGroup.js +8 -0
- package/menu/internal/MenuItem.d.ts +23 -0
- package/menu/internal/MenuItem.js +18 -0
- package/menu/internal/MenuSub.d.ts +31 -0
- package/menu/internal/MenuSub.js +129 -0
- package/menu/types.d.ts +30 -0
- package/menu/types.js +1 -0
- package/menu/utils.d.ts +4 -0
- package/menu/utils.js +18 -0
- package/menu/vars.d.ts +28 -0
- package/menu/vars.js +28 -0
- package/modal/Modal.d.ts +11 -0
- package/modal/Modal.js +127 -0
- package/modal/ModalAlert.d.ts +3 -0
- package/modal/ModalAlert.js +19 -0
- package/modal/ModalFooter.d.ts +3 -0
- package/modal/ModalFooter.js +51 -0
- package/modal/ModalHeader.d.ts +3 -0
- package/modal/ModalHeader.js +37 -0
- package/modal/index.d.ts +2 -0
- package/modal/index.js +1 -0
- package/modal/types.d.ts +39 -0
- package/modal/types.js +1 -0
- package/modal/vars.d.ts +23 -0
- package/modal/vars.js +23 -0
- package/notification/Notification.d.ts +3 -0
- package/notification/Notification.js +129 -0
- package/notification/index.d.ts +2 -0
- package/notification/index.js +1 -0
- package/notification/types.d.ts +18 -0
- package/notification/types.js +1 -0
- package/notification/vars.d.ts +17 -0
- package/notification/vars.js +14 -0
- package/package.json +47 -0
- package/pagination/Pagination.d.ts +3 -0
- package/pagination/Pagination.js +191 -0
- package/pagination/index.d.ts +2 -0
- package/pagination/index.js +1 -0
- package/pagination/types.d.ts +23 -0
- package/pagination/types.js +1 -0
- package/pagination/utils.d.ts +2 -0
- package/pagination/utils.js +14 -0
- package/pagination/vars.d.ts +14 -0
- package/pagination/vars.js +14 -0
- package/popover/Popover.d.ts +9 -0
- package/popover/Popover.js +173 -0
- package/popover/PopoverFooter.d.ts +3 -0
- package/popover/PopoverFooter.js +51 -0
- package/popover/PopoverHeader.d.ts +3 -0
- package/popover/PopoverHeader.js +37 -0
- package/popover/index.d.ts +2 -0
- package/popover/index.js +1 -0
- package/popover/types.d.ts +46 -0
- package/popover/types.js +1 -0
- package/popover/vars.d.ts +30 -0
- package/popover/vars.js +27 -0
- package/progress/Progress.d.ts +3 -0
- package/progress/Progress.js +45 -0
- package/progress/index.d.ts +2 -0
- package/progress/index.js +1 -0
- package/progress/types.d.ts +19 -0
- package/progress/types.js +1 -0
- package/progress/vars.d.ts +15 -0
- package/progress/vars.js +15 -0
- package/radio/Radio.d.ts +7 -0
- package/radio/Radio.js +38 -0
- package/radio/RadioGroup.d.ts +3 -0
- package/radio/RadioGroup.js +21 -0
- package/radio/index.d.ts +2 -0
- package/radio/index.js +1 -0
- package/radio/types.d.ts +31 -0
- package/radio/types.js +1 -0
- package/radio/vars.d.ts +14 -0
- package/radio/vars.js +14 -0
- package/rating/Rating.d.ts +3 -0
- package/rating/Rating.js +34 -0
- package/rating/index.d.ts +2 -0
- package/rating/index.js +1 -0
- package/rating/internal/RatingStar.d.ts +19 -0
- package/rating/internal/RatingStar.js +37 -0
- package/rating/types.d.ts +18 -0
- package/rating/types.js +1 -0
- package/rating/vars.d.ts +11 -0
- package/rating/vars.js +11 -0
- package/resources.json +128 -0
- package/root/Root.d.ts +3 -0
- package/root/Root.js +85 -0
- package/root/dialog-service.d.ts +12 -0
- package/root/dialog-service.js +62 -0
- package/root/index.d.ts +3 -0
- package/root/index.js +2 -0
- package/root/types.d.ts +16 -0
- package/root/types.js +1 -0
- package/root/vars.d.ts +25 -0
- package/root/vars.js +13 -0
- package/select/Select.d.ts +5 -0
- package/select/Select.js +528 -0
- package/select/index.d.ts +2 -0
- package/select/index.js +1 -0
- package/select/types.d.ts +50 -0
- package/select/types.js +1 -0
- package/select/vars.d.ts +31 -0
- package/select/vars.js +31 -0
- package/separator/Separator.d.ts +3 -0
- package/separator/Separator.js +19 -0
- package/separator/index.d.ts +2 -0
- package/separator/index.js +1 -0
- package/separator/types.d.ts +8 -0
- package/separator/types.js +1 -0
- package/separator/vars.d.ts +9 -0
- package/separator/vars.js +9 -0
- package/skeleton/Skeleton.d.ts +3 -0
- package/skeleton/Skeleton.js +13 -0
- package/skeleton/index.d.ts +2 -0
- package/skeleton/index.js +1 -0
- package/skeleton/types.d.ts +7 -0
- package/skeleton/types.js +1 -0
- package/skeleton/vars.d.ts +6 -0
- package/skeleton/vars.js +6 -0
- package/slider/Slider.d.ts +3 -0
- package/slider/Slider.js +324 -0
- package/slider/index.d.ts +2 -0
- package/slider/index.js +1 -0
- package/slider/types.d.ts +28 -0
- package/slider/types.js +1 -0
- package/slider/vars.d.ts +17 -0
- package/slider/vars.js +17 -0
- package/slides/Slides.d.ts +3 -0
- package/slides/Slides.js +277 -0
- package/slides/index.d.ts +2 -0
- package/slides/index.js +1 -0
- package/slides/types.d.ts +29 -0
- package/slides/types.js +1 -0
- package/slides/vars.d.ts +20 -0
- package/slides/vars.js +20 -0
- package/spinner/Spinner.d.ts +3 -0
- package/spinner/Spinner.js +66 -0
- package/spinner/index.d.ts +2 -0
- package/spinner/index.js +1 -0
- package/spinner/types.d.ts +12 -0
- package/spinner/types.js +1 -0
- package/spinner/vars.d.ts +7 -0
- package/spinner/vars.js +7 -0
- package/stepper/Stepper.d.ts +3 -0
- package/stepper/Stepper.js +87 -0
- package/stepper/index.d.ts +2 -0
- package/stepper/index.js +1 -0
- package/stepper/types.d.ts +22 -0
- package/stepper/types.js +1 -0
- package/stepper/vars.d.ts +19 -0
- package/stepper/vars.js +19 -0
- package/switch/Switch.d.ts +2 -0
- package/switch/Switch.js +48 -0
- package/switch/index.d.ts +2 -0
- package/switch/index.js +1 -0
- package/switch/types.d.ts +18 -0
- package/switch/types.js +1 -0
- package/switch/vars.d.ts +17 -0
- package/switch/vars.js +17 -0
- package/table/Table.d.ts +17 -0
- package/table/Table.js +72 -0
- package/table/TableEmpty.d.ts +3 -0
- package/table/TableEmpty.js +37 -0
- package/table/TableExpand.d.ts +3 -0
- package/table/TableExpand.js +20 -0
- package/table/TableFilter.d.ts +3 -0
- package/table/TableFilter.js +22 -0
- package/table/TableTd.d.ts +3 -0
- package/table/TableTd.js +11 -0
- package/table/TableTh.d.ts +3 -0
- package/table/TableTh.js +33 -0
- package/table/TableThAction.d.ts +3 -0
- package/table/TableThAction.js +18 -0
- package/table/index.d.ts +2 -0
- package/table/index.js +1 -0
- package/table/internal/TableCell.d.ts +19 -0
- package/table/internal/TableCell.js +61 -0
- package/table/types.d.ts +73 -0
- package/table/types.js +1 -0
- package/table/vars.d.ts +29 -0
- package/table/vars.js +28 -0
- package/tabs/Tabs.d.ts +5 -0
- package/tabs/Tabs.js +248 -0
- package/tabs/index.d.ts +2 -0
- package/tabs/index.js +1 -0
- package/tabs/types.d.ts +28 -0
- package/tabs/types.js +1 -0
- package/tabs/vars.d.ts +30 -0
- package/tabs/vars.js +30 -0
- package/tag/Tag.d.ts +3 -0
- package/tag/Tag.js +16 -0
- package/tag/index.d.ts +2 -0
- package/tag/index.js +1 -0
- package/tag/types.d.ts +9 -0
- package/tag/types.js +1 -0
- package/tag/vars.d.ts +13 -0
- package/tag/vars.js +13 -0
- package/textarea/Textarea.d.ts +3 -0
- package/textarea/Textarea.js +72 -0
- package/textarea/index.d.ts +2 -0
- package/textarea/index.js +1 -0
- package/textarea/types.d.ts +18 -0
- package/textarea/types.js +1 -0
- package/textarea/vars.d.ts +7 -0
- package/textarea/vars.js +7 -0
- package/time-picker/TimePicker.d.ts +3 -0
- package/time-picker/TimePicker.js +338 -0
- package/time-picker/index.d.ts +2 -0
- package/time-picker/index.js +1 -0
- package/time-picker/internal/TimePickerPanel.d.ts +16 -0
- package/time-picker/internal/TimePickerPanel.js +138 -0
- package/time-picker/types.d.ts +33 -0
- package/time-picker/types.js +1 -0
- package/time-picker/utils.d.ts +4 -0
- package/time-picker/utils.js +26 -0
- package/time-picker/vars.d.ts +20 -0
- package/time-picker/vars.js +20 -0
- package/timeline/Timeline.d.ts +3 -0
- package/timeline/Timeline.js +53 -0
- package/timeline/index.d.ts +2 -0
- package/timeline/index.js +1 -0
- package/timeline/types.d.ts +15 -0
- package/timeline/types.js +1 -0
- package/timeline/vars.d.ts +19 -0
- package/timeline/vars.js +19 -0
- package/toast/Toast.d.ts +3 -0
- package/toast/Toast.js +123 -0
- package/toast/index.d.ts +2 -0
- package/toast/index.js +1 -0
- package/toast/types.d.ts +17 -0
- package/toast/types.js +1 -0
- package/toast/vars.d.ts +14 -0
- package/toast/vars.js +11 -0
- package/tooltip/Tooltip.d.ts +3 -0
- package/tooltip/Tooltip.js +113 -0
- package/tooltip/index.d.ts +2 -0
- package/tooltip/index.js +1 -0
- package/tooltip/types.d.ts +29 -0
- package/tooltip/types.js +1 -0
- package/tooltip/vars.d.ts +20 -0
- package/tooltip/vars.js +17 -0
- package/transfer/Transfer.d.ts +3 -0
- package/transfer/Transfer.js +156 -0
- package/transfer/index.d.ts +2 -0
- package/transfer/index.js +1 -0
- package/transfer/internal/TransferPanel.d.ts +21 -0
- package/transfer/internal/TransferPanel.js +42 -0
- package/transfer/types.d.ts +34 -0
- package/transfer/types.js +1 -0
- package/transfer/vars.d.ts +17 -0
- package/transfer/vars.js +17 -0
- package/tree/Tree.d.ts +3 -0
- package/tree/Tree.js +165 -0
- package/tree/index.d.ts +2 -0
- package/tree/index.js +1 -0
- package/tree/internal/TreePanel.d.ts +32 -0
- package/tree/internal/TreePanel.js +167 -0
- package/tree/node/abstract-node.d.ts +25 -0
- package/tree/node/abstract-node.js +68 -0
- package/tree/node/multiple-node.d.ts +18 -0
- package/tree/node/multiple-node.js +109 -0
- package/tree/node/single-node.d.ts +16 -0
- package/tree/node/single-node.js +60 -0
- package/tree/node/types.d.ts +6 -0
- package/tree/node/types.js +1 -0
- package/tree/node/vars.d.ts +2 -0
- package/tree/node/vars.js +1 -0
- package/tree/types.d.ts +34 -0
- package/tree/types.js +1 -0
- package/tree/utils.d.ts +6 -0
- package/tree/utils.js +9 -0
- package/tree/vars.d.ts +20 -0
- package/tree/vars.js +20 -0
- package/tree-select/TreeSelect.d.ts +6 -0
- package/tree-select/TreeSelect.js +509 -0
- package/tree-select/index.d.ts +2 -0
- package/tree-select/index.js +1 -0
- package/tree-select/internal/TreeSelectSearchPanel.d.ts +22 -0
- package/tree-select/internal/TreeSelectSearchPanel.js +73 -0
- package/tree-select/internal/types.d.ts +8 -0
- package/tree-select/internal/types.js +1 -0
- package/tree-select/types.d.ts +48 -0
- package/tree-select/types.js +1 -0
- package/tree-select/vars.d.ts +37 -0
- package/tree-select/vars.js +37 -0
- package/types.d.ts +21 -0
- package/types.js +1 -0
- package/upload/Upload.d.ts +19 -0
- package/upload/Upload.js +203 -0
- package/upload/UploadAction.d.ts +3 -0
- package/upload/UploadAction.js +44 -0
- package/upload/UploadButton.d.ts +3 -0
- package/upload/UploadButton.js +31 -0
- package/upload/UploadList.d.ts +3 -0
- package/upload/UploadList.js +62 -0
- package/upload/UploadPicture.d.ts +3 -0
- package/upload/UploadPicture.js +72 -0
- package/upload/UploadPictureList.d.ts +3 -0
- package/upload/UploadPictureList.js +62 -0
- package/upload/UploadPreviewAction.d.ts +3 -0
- package/upload/UploadPreviewAction.js +32 -0
- package/upload/index.d.ts +2 -0
- package/upload/index.js +1 -0
- package/upload/types.d.ts +78 -0
- package/upload/types.js +1 -0
- package/upload/vars.d.ts +65 -0
- package/upload/vars.js +65 -0
- package/utils/handleModalKeyDown.d.ts +2 -0
- package/utils/handleModalKeyDown.js +17 -0
- package/utils/index.d.ts +6 -0
- package/utils/index.js +6 -0
- package/utils/isPrintableCharacter.d.ts +1 -0
- package/utils/isPrintableCharacter.js +3 -0
- package/utils/mergeCS.d.ts +11 -0
- package/utils/mergeCS.js +6 -0
- package/utils/position/getHorizontalSidePosition.d.ts +14 -0
- package/utils/position/getHorizontalSidePosition.js +22 -0
- package/utils/position/getPopupPosition.d.ts +18 -0
- package/utils/position/getPopupPosition.js +170 -0
- package/utils/position/getVerticalSidePosition.d.ts +17 -0
- package/utils/position/getVerticalSidePosition.js +43 -0
- package/vars.d.ts +5 -0
- package/vars.js +5 -0
- package/virtual-scroll/VirtualScroll.d.ts +5 -0
- package/virtual-scroll/VirtualScroll.js +430 -0
- package/virtual-scroll/index.d.ts +2 -0
- package/virtual-scroll/index.js +1 -0
- package/virtual-scroll/types.d.ts +34 -0
- package/virtual-scroll/types.js +1 -0
- package/virtual-scroll/vars.d.ts +1 -0
- package/virtual-scroll/vars.js +1 -0
package/tabs/Tabs.js
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createElement as _createElement } from "react";
|
|
4
|
+
import { useEventCallback, useIsomorphicLayoutEffect, useResize } from '@laser-ui/hooks';
|
|
5
|
+
import { checkScrollEnd, findNested } from '@laser-ui/utils';
|
|
6
|
+
import { ReactComponent as AddOutlined } from '@material-design-icons/svg/outlined/add.svg';
|
|
7
|
+
import { ReactComponent as CloseOutlined } from '@material-design-icons/svg/outlined/close.svg';
|
|
8
|
+
import { ReactComponent as MoreHorizOutlined } from '@material-design-icons/svg/outlined/more_horiz.svg';
|
|
9
|
+
import { isUndefined, nth } from 'lodash';
|
|
10
|
+
import { forwardRef, useEffect, useId, useImperativeHandle, useRef, useState } from 'react';
|
|
11
|
+
import { CLASSES } from './vars';
|
|
12
|
+
import { Dropdown } from '../dropdown';
|
|
13
|
+
import { useComponentProps, useControlled, useNamespace, useStyled, useTranslation } from '../hooks';
|
|
14
|
+
import { Icon } from '../icon';
|
|
15
|
+
import { mergeCS } from '../utils';
|
|
16
|
+
function TabsFC(props, ref) {
|
|
17
|
+
const _a = useComponentProps('Tabs', props), { styleOverrides, styleProvider, list, active: activeProp, defaultActive, pattern, placement = 'top', center = false, size = 'medium', addible = false, onActiveChange, onAddClick, onClose } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "list", "active", "defaultActive", "pattern", "placement", "center", "size", "addible", "onActiveChange", "onAddClick", "onClose"]);
|
|
18
|
+
const namespace = useNamespace();
|
|
19
|
+
const styled = useStyled(CLASSES, { tabs: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.tabs }, styleOverrides);
|
|
20
|
+
const { t } = useTranslation();
|
|
21
|
+
const uniqueId = useId();
|
|
22
|
+
const getTabId = (id) => `${namespace}-tabs-tab-${id}-${uniqueId}`;
|
|
23
|
+
const getPanelId = (id) => `${namespace}-tabs-panel-${id}-${uniqueId}`;
|
|
24
|
+
const tabsRef = useRef(null);
|
|
25
|
+
const tablistWrapperRef = useRef(null);
|
|
26
|
+
const tablistRef = useRef(null);
|
|
27
|
+
const buttonContainerRef = useRef(null);
|
|
28
|
+
const indicatorRef = useRef(null);
|
|
29
|
+
const [listOverflow, setListOverflow] = useState(false);
|
|
30
|
+
const [dropdownList, setDropdownList] = useState([]);
|
|
31
|
+
const [scrollEnd, setScrollEnd] = useState(false);
|
|
32
|
+
const iconSize = size === 'small' ? 16 : size === 'large' ? 20 : 18;
|
|
33
|
+
const isHorizontal = placement === 'top' || placement === 'bottom';
|
|
34
|
+
const [active, changeActive] = useControlled(defaultActive !== null && defaultActive !== void 0 ? defaultActive : (() => {
|
|
35
|
+
for (const tab of list) {
|
|
36
|
+
if (!tab.disabled) {
|
|
37
|
+
return tab.id;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}), activeProp, (id) => {
|
|
42
|
+
if (onActiveChange) {
|
|
43
|
+
onActiveChange(id, findNested(list, (item) => item.id === id));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const refreshTabs = () => {
|
|
47
|
+
const tablistWrapperEl = tablistWrapperRef.current;
|
|
48
|
+
if (tablistWrapperEl) {
|
|
49
|
+
const isOverflow = isHorizontal
|
|
50
|
+
? tablistWrapperEl.scrollWidth > tablistWrapperEl.clientWidth
|
|
51
|
+
: tablistWrapperEl.scrollHeight > tablistWrapperEl.clientHeight;
|
|
52
|
+
setListOverflow(isOverflow);
|
|
53
|
+
setScrollEnd(checkScrollEnd(tablistWrapperEl)[isHorizontal ? 'x' : 'y']);
|
|
54
|
+
if (isOverflow) {
|
|
55
|
+
const tablistWrapperRect = tablistWrapperEl.getBoundingClientRect();
|
|
56
|
+
const dropdownList = [];
|
|
57
|
+
list.forEach((tab) => {
|
|
58
|
+
var _a, _b, _c, _d;
|
|
59
|
+
const el = document.getElementById(getTabId(tab.id));
|
|
60
|
+
if (el) {
|
|
61
|
+
const rect = el.getBoundingClientRect();
|
|
62
|
+
if (isHorizontal) {
|
|
63
|
+
if (rect.right + ((_b = (_a = buttonContainerRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) !== null && _b !== void 0 ? _b : 0) > tablistWrapperRect.right ||
|
|
64
|
+
rect.left < tablistWrapperRect.left) {
|
|
65
|
+
dropdownList.push(tab);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
if (rect.bottom + ((_d = (_c = buttonContainerRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) !== null && _d !== void 0 ? _d : 0) > tablistWrapperRect.bottom ||
|
|
70
|
+
rect.top < tablistWrapperRect.top) {
|
|
71
|
+
dropdownList.push(tab);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
setDropdownList(dropdownList);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
useIsomorphicLayoutEffect(() => {
|
|
81
|
+
refreshTabs();
|
|
82
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
83
|
+
}, []);
|
|
84
|
+
useResize(tablistWrapperRef, refreshTabs);
|
|
85
|
+
useResize(tablistRef, refreshTabs);
|
|
86
|
+
const updateIndicator = useEventCallback(() => {
|
|
87
|
+
if (tablistRef.current && indicatorRef.current) {
|
|
88
|
+
const tablistRect = tablistRef.current.getBoundingClientRect();
|
|
89
|
+
for (const tab of list) {
|
|
90
|
+
if (tab.id === active) {
|
|
91
|
+
const el = document.getElementById(getTabId(tab.id));
|
|
92
|
+
if (el) {
|
|
93
|
+
const rect = el.getBoundingClientRect();
|
|
94
|
+
if (isHorizontal) {
|
|
95
|
+
indicatorRef.current.style.cssText = `left:${rect.left - tablistRect.left}px;width:${rect.width}px;opacity:1;`;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
indicatorRef.current.style.cssText = `top:${rect.top - tablistRect.top}px;opacity:1;`;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
updateIndicator();
|
|
107
|
+
});
|
|
108
|
+
useImperativeHandle(ref, () => ({
|
|
109
|
+
updateIndicator,
|
|
110
|
+
}), [updateIndicator]);
|
|
111
|
+
return (_jsxs("div", Object.assign({}, restProps, mergeCS(styled('tabs', `tabs--${placement}`, `tabs--${size}`, {
|
|
112
|
+
[`tabs--${pattern}`]: pattern,
|
|
113
|
+
'tabs--center': center,
|
|
114
|
+
}), {
|
|
115
|
+
className: restProps.className,
|
|
116
|
+
style: restProps.style,
|
|
117
|
+
}), { ref: tabsRef, children: [_jsx("div", Object.assign({}, styled('tabs__tablist-wrapper'), { ref: tablistWrapperRef, onScroll: () => {
|
|
118
|
+
refreshTabs();
|
|
119
|
+
}, children: _jsxs("div", Object.assign({}, styled('tabs__tablist'), { ref: tablistRef, role: "tablist", "aria-orientation": isHorizontal ? 'horizontal' : 'vertical', children: [list.map((item, index) => {
|
|
120
|
+
const { id: itemId, title: itemTitle, disabled: itemDisabled, closable: itemClosable } = item;
|
|
121
|
+
const isActive = itemId === active;
|
|
122
|
+
const getTab = (next, _index = index) => {
|
|
123
|
+
for (let focusIndex = next ? _index + 1 : _index - 1, n = 0; n < list.length; next ? focusIndex++ : focusIndex--, n++) {
|
|
124
|
+
const t = nth(list, focusIndex % list.length);
|
|
125
|
+
if (t && !t.disabled) {
|
|
126
|
+
return t;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const focusTab = (t) => {
|
|
131
|
+
if (t) {
|
|
132
|
+
changeActive(t.id);
|
|
133
|
+
const el = document.getElementById(getTabId(t.id));
|
|
134
|
+
if (el) {
|
|
135
|
+
el.focus();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const closeTab = () => {
|
|
140
|
+
if (isActive) {
|
|
141
|
+
let hasTab = false;
|
|
142
|
+
for (let focusIndex = index + 1; focusIndex < list.length; focusIndex++) {
|
|
143
|
+
const t = nth(list, focusIndex);
|
|
144
|
+
if (t && !t.disabled) {
|
|
145
|
+
hasTab = true;
|
|
146
|
+
focusTab(t);
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (!hasTab) {
|
|
151
|
+
for (let focusIndex = index - 1; focusIndex >= 0; focusIndex--) {
|
|
152
|
+
const t = nth(list, focusIndex);
|
|
153
|
+
if (t && !t.disabled) {
|
|
154
|
+
focusTab(t);
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(itemId, item);
|
|
161
|
+
};
|
|
162
|
+
return (_createElement("div", Object.assign({}, styled('tabs__tab', {
|
|
163
|
+
'tabs__tab.is-active': isActive,
|
|
164
|
+
'tabs__tab.is-disabled': itemDisabled,
|
|
165
|
+
'tabs__tab--first': index === 0,
|
|
166
|
+
'tabs__tab--last': index === list.length - 1,
|
|
167
|
+
}), { key: itemId, id: getTabId(itemId), tabIndex: isActive && !itemDisabled ? 0 : -1, role: "tab", "aria-controls": getPanelId(itemId), "aria-selected": isActive, "aria-disabled": itemDisabled, onClick: () => {
|
|
168
|
+
changeActive(itemId);
|
|
169
|
+
}, onKeyDown: (e) => {
|
|
170
|
+
switch (e.code) {
|
|
171
|
+
case 'Delete':
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
if (itemClosable) {
|
|
174
|
+
closeTab();
|
|
175
|
+
}
|
|
176
|
+
break;
|
|
177
|
+
case 'ArrowLeft':
|
|
178
|
+
e.preventDefault();
|
|
179
|
+
if (placement === 'top' || placement === 'bottom') {
|
|
180
|
+
focusTab(getTab(false));
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
183
|
+
case 'ArrowRight':
|
|
184
|
+
e.preventDefault();
|
|
185
|
+
if (placement === 'top' || placement === 'bottom') {
|
|
186
|
+
focusTab(getTab(true));
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
case 'ArrowUp':
|
|
190
|
+
e.preventDefault();
|
|
191
|
+
if (placement === 'left' || placement === 'right') {
|
|
192
|
+
focusTab(getTab(false));
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
case 'ArrowDown':
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
if (placement === 'left' || placement === 'right') {
|
|
198
|
+
focusTab(getTab(true));
|
|
199
|
+
}
|
|
200
|
+
break;
|
|
201
|
+
case 'Home':
|
|
202
|
+
e.preventDefault();
|
|
203
|
+
for (const t of list) {
|
|
204
|
+
if (!t.disabled) {
|
|
205
|
+
focusTab(t);
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
break;
|
|
210
|
+
case 'End':
|
|
211
|
+
e.preventDefault();
|
|
212
|
+
for (let index = list.length - 1; index >= 0; index--) {
|
|
213
|
+
if (!list[index].disabled) {
|
|
214
|
+
focusTab(list[index]);
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
break;
|
|
219
|
+
default:
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
} }),
|
|
223
|
+
itemTitle,
|
|
224
|
+
!itemDisabled && itemClosable && (_jsx("div", Object.assign({}, styled('tabs__close'), { role: "button", "aria-label": t('Close'), onClick: (e) => {
|
|
225
|
+
e.stopPropagation();
|
|
226
|
+
closeTab();
|
|
227
|
+
}, children: _jsx(Icon, { children: _jsx(CloseOutlined, {}) }) })))));
|
|
228
|
+
}), (listOverflow || addible) && (_jsxs("div", Object.assign({}, styled('tabs__button-container'), { ref: buttonContainerRef, children: [listOverflow && (_jsx(Dropdown, { list: dropdownList.map((tab) => {
|
|
229
|
+
const { id: itemId, title: itemTitle, dropdownRender: itemDropdownRender, disabled: itemDisabled } = tab;
|
|
230
|
+
return {
|
|
231
|
+
id: itemId,
|
|
232
|
+
title: isUndefined(itemDropdownRender) ? itemTitle : itemDropdownRender,
|
|
233
|
+
type: 'item',
|
|
234
|
+
disabled: itemDisabled,
|
|
235
|
+
style: itemId === active ? { color: `var(--${namespace}-color-primary)` } : undefined,
|
|
236
|
+
};
|
|
237
|
+
}), placement: placement === 'left' ? 'bottom-left' : 'bottom-right', onClick: (id) => {
|
|
238
|
+
changeActive(id);
|
|
239
|
+
}, children: _jsx("div", Object.assign({}, styled('tabs__button', 'tabs__button--more', {
|
|
240
|
+
'tabs__button.is-end': scrollEnd,
|
|
241
|
+
}), { "aria-label": t('More'), children: _jsx(Icon, { size: iconSize, children: _jsx(MoreHorizOutlined, {}) }) })) })), addible && (_jsx("div", Object.assign({}, styled('tabs__button', 'tabs__button--add'), { role: "button", "aria-label": t('Add'), onClick: () => {
|
|
242
|
+
onAddClick === null || onAddClick === void 0 ? void 0 : onAddClick();
|
|
243
|
+
}, children: _jsx(Icon, { size: iconSize, children: _jsx(AddOutlined, {}) }) })))] }))), _jsx("div", Object.assign({}, styled(pattern === 'wrap' ? 'tabs__wrap-indicator' : pattern === 'slider' ? 'tabs__slider-indicator' : 'tabs__indicator'), { ref: indicatorRef }))] })) })), list.map((item) => {
|
|
244
|
+
const { id: itemId, panel: itemPanel } = item;
|
|
245
|
+
return (_createElement("div", Object.assign({}, styled('tabs__tabpanel'), { key: itemId, id: getPanelId(itemId), tabIndex: 0, hidden: itemId !== active, role: "tabpanel", "aria-labelledby": getTabId(itemId) }), itemPanel));
|
|
246
|
+
})] })));
|
|
247
|
+
}
|
|
248
|
+
export const Tabs = forwardRef(TabsFC);
|
package/tabs/index.d.ts
ADDED
package/tabs/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tabs } from './Tabs';
|
package/tabs/types.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { BaseProps, Size } from '../types';
|
|
4
|
+
export {};
|
|
5
|
+
export interface TabsRef {
|
|
6
|
+
updateIndicator: () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface TabsItem<ID extends React.Key> {
|
|
9
|
+
id: ID;
|
|
10
|
+
title: React.ReactNode;
|
|
11
|
+
panel: React.ReactNode;
|
|
12
|
+
dropdownRender?: React.ReactNode;
|
|
13
|
+
closable?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface TabsProps<ID extends React.Key, T extends TabsItem<ID>> extends BaseProps<'tabs', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
17
|
+
list: T[];
|
|
18
|
+
active?: ID;
|
|
19
|
+
defaultActive?: ID;
|
|
20
|
+
pattern?: 'wrap' | 'slider';
|
|
21
|
+
placement?: 'top' | 'right' | 'bottom' | 'left';
|
|
22
|
+
center?: boolean;
|
|
23
|
+
size?: Size;
|
|
24
|
+
addible?: boolean;
|
|
25
|
+
onActiveChange?: (id: ID, origin: T) => void;
|
|
26
|
+
onAddClick?: () => void;
|
|
27
|
+
onClose?: (id: ID, origin: T) => void;
|
|
28
|
+
}
|
package/tabs/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/tabs/vars.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
tabs: string;
|
|
3
|
+
'tabs--wrap': string;
|
|
4
|
+
'tabs--slider': string;
|
|
5
|
+
'tabs--top': string;
|
|
6
|
+
'tabs--right': string;
|
|
7
|
+
'tabs--bottom': string;
|
|
8
|
+
'tabs--left': string;
|
|
9
|
+
'tabs--small': string;
|
|
10
|
+
'tabs--medium': string;
|
|
11
|
+
'tabs--large': string;
|
|
12
|
+
'tabs--center': string;
|
|
13
|
+
'tabs__tablist-wrapper': string;
|
|
14
|
+
tabs__tablist: string;
|
|
15
|
+
tabs__tab: string;
|
|
16
|
+
'tabs__tab.is-active': string;
|
|
17
|
+
'tabs__tab.is-disabled': string;
|
|
18
|
+
'tabs__tab--first': string;
|
|
19
|
+
'tabs__tab--last': string;
|
|
20
|
+
tabs__close: string;
|
|
21
|
+
'tabs__button-container': string;
|
|
22
|
+
tabs__button: string;
|
|
23
|
+
'tabs__button.is-end': string;
|
|
24
|
+
'tabs__button--more': string;
|
|
25
|
+
'tabs__button--add': string;
|
|
26
|
+
tabs__indicator: string;
|
|
27
|
+
'tabs__wrap-indicator': string;
|
|
28
|
+
'tabs__slider-indicator': string;
|
|
29
|
+
tabs__tabpanel: string;
|
|
30
|
+
};
|
package/tabs/vars.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
tabs: '^tabs',
|
|
3
|
+
'tabs--wrap': '^tabs--wrap',
|
|
4
|
+
'tabs--slider': '^tabs--slider',
|
|
5
|
+
'tabs--top': '^tabs--top',
|
|
6
|
+
'tabs--right': '^tabs--right',
|
|
7
|
+
'tabs--bottom': '^tabs--bottom',
|
|
8
|
+
'tabs--left': '^tabs--left',
|
|
9
|
+
'tabs--small': '^tabs--small',
|
|
10
|
+
'tabs--medium': '^tabs--medium',
|
|
11
|
+
'tabs--large': '^tabs--large',
|
|
12
|
+
'tabs--center': '^tabs--center',
|
|
13
|
+
'tabs__tablist-wrapper': '^tabs__tablist-wrapper',
|
|
14
|
+
tabs__tablist: '^tabs__tablist',
|
|
15
|
+
tabs__tab: '^tabs__tab',
|
|
16
|
+
'tabs__tab.is-active': 'is-active',
|
|
17
|
+
'tabs__tab.is-disabled': 'is-disabled',
|
|
18
|
+
'tabs__tab--first': '^tabs__tab--first',
|
|
19
|
+
'tabs__tab--last': '^tabs__tab--last',
|
|
20
|
+
tabs__close: '^tabs__close',
|
|
21
|
+
'tabs__button-container': '^tabs__button-container',
|
|
22
|
+
tabs__button: '^tabs__button',
|
|
23
|
+
'tabs__button.is-end': 'is-end',
|
|
24
|
+
'tabs__button--more': '^tabs__button--more',
|
|
25
|
+
'tabs__button--add': '^tabs__button--add',
|
|
26
|
+
tabs__indicator: '^tabs__indicator',
|
|
27
|
+
'tabs__wrap-indicator': '^tabs__wrap-indicator',
|
|
28
|
+
'tabs__slider-indicator': '^tabs__slider-indicator',
|
|
29
|
+
tabs__tabpanel: '^tabs__tabpanel',
|
|
30
|
+
};
|
package/tag/Tag.d.ts
ADDED
package/tag/Tag.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { CLASSES } from './vars';
|
|
4
|
+
import { useComponentProps, useScopedProps, useStyled } from '../hooks';
|
|
5
|
+
import { mergeCS } from '../utils';
|
|
6
|
+
export function Tag(props) {
|
|
7
|
+
const _a = useComponentProps('Tag', props), { children, styleOverrides, styleProvider, pattern = 'primary', theme, size: sizeProp } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "pattern", "theme", "size"]);
|
|
8
|
+
const styled = useStyled(CLASSES, { tag: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.tag }, styleOverrides);
|
|
9
|
+
const { size } = useScopedProps({ size: sizeProp });
|
|
10
|
+
return (_jsx("div", Object.assign({}, restProps, mergeCS(styled('tag', `tag--${pattern}`, `tag--${size}`, {
|
|
11
|
+
[`tag.t-${theme}`]: theme,
|
|
12
|
+
}), {
|
|
13
|
+
className: restProps.className,
|
|
14
|
+
style: restProps.style,
|
|
15
|
+
}), { children: children })));
|
|
16
|
+
}
|
package/tag/index.d.ts
ADDED
package/tag/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tag } from './Tag';
|
package/tag/types.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { BaseProps, Size } from '../types';
|
|
4
|
+
export {};
|
|
5
|
+
export interface TagProps extends BaseProps<'tag', typeof CLASSES>, React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
pattern?: 'primary' | 'fill' | 'outline';
|
|
7
|
+
theme?: 'primary' | 'success' | 'warning' | 'danger';
|
|
8
|
+
size?: Size;
|
|
9
|
+
}
|
package/tag/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/tag/vars.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
tag: string;
|
|
3
|
+
'tag.t-primary': string;
|
|
4
|
+
'tag.t-success': string;
|
|
5
|
+
'tag.t-warning': string;
|
|
6
|
+
'tag.t-danger': string;
|
|
7
|
+
'tag--primary': string;
|
|
8
|
+
'tag--fill': string;
|
|
9
|
+
'tag--outline': string;
|
|
10
|
+
'tag--small': string;
|
|
11
|
+
'tag--medium': string;
|
|
12
|
+
'tag--large': string;
|
|
13
|
+
};
|
package/tag/vars.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
tag: '^tag',
|
|
3
|
+
'tag.t-primary': 't-primary',
|
|
4
|
+
'tag.t-success': 't-success',
|
|
5
|
+
'tag.t-warning': 't-warning',
|
|
6
|
+
'tag.t-danger': 't-danger',
|
|
7
|
+
'tag--primary': '^tag--primary',
|
|
8
|
+
'tag--fill': '^tag--fill',
|
|
9
|
+
'tag--outline': '^tag--outline',
|
|
10
|
+
'tag--small': '^tag--small',
|
|
11
|
+
'tag--medium': '^tag--medium',
|
|
12
|
+
'tag--large': '^tag--large',
|
|
13
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useForkRef } from '@laser-ui/hooks';
|
|
4
|
+
import { isFunction, isNumber, isUndefined } from 'lodash';
|
|
5
|
+
import { forwardRef, useEffect, useRef } from 'react';
|
|
6
|
+
import { CLASSES } from './vars';
|
|
7
|
+
import { useComponentProps, useControlled, useDesign, useScopedProps, useStyled } from '../hooks';
|
|
8
|
+
import { mergeCS } from '../utils';
|
|
9
|
+
export const Textarea = forwardRef((props, ref) => {
|
|
10
|
+
const _a = useComponentProps('Textarea', props), { styleOverrides, styleProvider, formControl, model, defaultModel, autoRows = false, resizable = true, showCount = false, size: sizeProp, onModelChange } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "formControl", "model", "defaultModel", "autoRows", "resizable", "showCount", "size", "onModelChange"]);
|
|
11
|
+
const styled = useStyled(CLASSES, { textarea: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.textarea }, styleOverrides);
|
|
12
|
+
const textareaRef = useRef(null);
|
|
13
|
+
const combineTextareaRef = useForkRef(textareaRef, ref);
|
|
14
|
+
const [value, changeValue] = useControlled(defaultModel !== null && defaultModel !== void 0 ? defaultModel : '', model, onModelChange, undefined, formControl === null || formControl === void 0 ? void 0 : formControl.control);
|
|
15
|
+
const { size, disabled } = useScopedProps({ size: sizeProp, disabled: restProps.disabled || (formControl === null || formControl === void 0 ? void 0 : formControl.control.disabled) });
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (textareaRef.current) {
|
|
18
|
+
const cssText = textareaRef.current.style.cssText;
|
|
19
|
+
textareaRef.current.value = '';
|
|
20
|
+
textareaRef.current.rows = 1;
|
|
21
|
+
textareaRef.current.style.cssText = cssText + 'box-sizing:content-box;overflow:hidden;height:0px;min-height:unset;';
|
|
22
|
+
const outerSize = textareaRef.current.offsetHeight;
|
|
23
|
+
textareaRef.current.style.cssText = cssText + 'overflow:hidden;height:0px;min-height:unset;padding:0px;';
|
|
24
|
+
const lineHeight = textareaRef.current.scrollHeight;
|
|
25
|
+
textareaRef.current.value = value;
|
|
26
|
+
const n = Math.round(textareaRef.current.scrollHeight / lineHeight);
|
|
27
|
+
if (isNumber(restProps.rows)) {
|
|
28
|
+
textareaRef.current.rows = restProps.rows;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
textareaRef.current.removeAttribute('rows');
|
|
32
|
+
}
|
|
33
|
+
textareaRef.current.style.cssText = cssText;
|
|
34
|
+
let height;
|
|
35
|
+
let overflow;
|
|
36
|
+
let minHeight;
|
|
37
|
+
let maxHeight;
|
|
38
|
+
if (autoRows !== false) {
|
|
39
|
+
height = n * lineHeight;
|
|
40
|
+
overflow = 'hidden';
|
|
41
|
+
if (autoRows !== true) {
|
|
42
|
+
if (isNumber(autoRows.minRows)) {
|
|
43
|
+
minHeight = autoRows.minRows * lineHeight;
|
|
44
|
+
}
|
|
45
|
+
if (isNumber(autoRows.maxRows)) {
|
|
46
|
+
maxHeight = autoRows.maxRows * lineHeight;
|
|
47
|
+
if (autoRows.maxRows < n) {
|
|
48
|
+
overflow = undefined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
textareaRef.current.style.height = isUndefined(height) ? '' : height + outerSize + 'px';
|
|
54
|
+
textareaRef.current.style.overflow = isUndefined(overflow) ? '' : 'hidden';
|
|
55
|
+
textareaRef.current.style.minHeight = isUndefined(minHeight) ? '' : minHeight + outerSize + 'px';
|
|
56
|
+
textareaRef.current.style.maxHeight = isUndefined(maxHeight) ? '' : maxHeight + outerSize + 'px';
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const designProps = useDesign({ form: formControl });
|
|
60
|
+
return (_jsxs(_Fragment, { children: [_jsx("textarea", Object.assign({}, restProps, mergeCS(styled('textarea', `textarea--${size}`), {
|
|
61
|
+
className: restProps.className,
|
|
62
|
+
style: Object.assign(Object.assign({}, restProps.style), { resize: resizable && autoRows === false ? undefined : 'none' }),
|
|
63
|
+
}), designProps, { ref: combineTextareaRef, value: value, disabled: disabled, onChange: (e) => {
|
|
64
|
+
var _a;
|
|
65
|
+
(_a = restProps.onChange) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
66
|
+
changeValue(e.currentTarget.value);
|
|
67
|
+
} })), showCount !== false && (_jsx("div", Object.assign({}, styled('textarea__count'), { children: isFunction(showCount)
|
|
68
|
+
? showCount(value.length)
|
|
69
|
+
: isUndefined(restProps.maxLength)
|
|
70
|
+
? value.length
|
|
71
|
+
: `${value.length} / ${restProps.maxLength}` })))] }));
|
|
72
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Textarea } from './Textarea';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { FormControlProvider } from '../form/types';
|
|
4
|
+
import type { BaseProps, Size } from '../types';
|
|
5
|
+
export {};
|
|
6
|
+
export interface TextareaProps extends BaseProps<'textarea', typeof CLASSES>, React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
7
|
+
formControl?: FormControlProvider;
|
|
8
|
+
model?: string;
|
|
9
|
+
defaultModel?: string;
|
|
10
|
+
autoRows?: boolean | {
|
|
11
|
+
minRows?: number;
|
|
12
|
+
maxRows?: number;
|
|
13
|
+
};
|
|
14
|
+
resizable?: boolean;
|
|
15
|
+
showCount?: boolean | ((count: number) => React.ReactNode);
|
|
16
|
+
size?: Size;
|
|
17
|
+
onModelChange?: (value: string) => void;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/textarea/vars.js
ADDED