@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
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useAsync, useEvent, useRefExtra } from '@laser-ui/hooks';
|
|
3
|
+
import { ReactComponent as KeyboardArrowLeftOutlined } from '@material-design-icons/svg/outlined/keyboard_arrow_left.svg';
|
|
4
|
+
import { ReactComponent as KeyboardArrowRightOutlined } from '@material-design-icons/svg/outlined/keyboard_arrow_right.svg';
|
|
5
|
+
import { ReactComponent as KeyboardDoubleArrowLeftOutlined } from '@material-design-icons/svg/outlined/keyboard_double_arrow_left.svg';
|
|
6
|
+
import { ReactComponent as KeyboardDoubleArrowRightOutlined } from '@material-design-icons/svg/outlined/keyboard_double_arrow_right.svg';
|
|
7
|
+
import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
8
|
+
import dayjs from '../../dayjs';
|
|
9
|
+
import { useTranslation } from '../../hooks';
|
|
10
|
+
import { Icon } from '../../icon';
|
|
11
|
+
export const DatePickerPanel = forwardRef((props, ref) => {
|
|
12
|
+
const { styled, currentSelected: currentSelectedProp, anotherSelected: anotherSelectedProp, config, range, onDateChange } = props;
|
|
13
|
+
const dataRef = useRef({});
|
|
14
|
+
const { t, lang } = useTranslation();
|
|
15
|
+
const async = useAsync();
|
|
16
|
+
const windowRef = useRefExtra(() => window);
|
|
17
|
+
const currentSelected = currentSelectedProp ? dayjs(currentSelectedProp) : dayjs().set('hour', 0).set('minute', 0).set('second', 0);
|
|
18
|
+
const anotherSelected = anotherSelectedProp ? dayjs(anotherSelectedProp) : null;
|
|
19
|
+
const [_active, setActive] = useState(currentSelected.toDate());
|
|
20
|
+
const active = dayjs(_active);
|
|
21
|
+
const [hover, setHover] = useState(null);
|
|
22
|
+
const handleMouseDown = (unit, value) => {
|
|
23
|
+
const fn = () => {
|
|
24
|
+
setActive((draft) => {
|
|
25
|
+
const d = dayjs(draft);
|
|
26
|
+
return d.set(unit, d.get(unit) + value).toDate();
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
fn();
|
|
30
|
+
const loop = () => {
|
|
31
|
+
fn();
|
|
32
|
+
dataRef.current.clearLoop = async.setTimeout(() => loop(), 50);
|
|
33
|
+
};
|
|
34
|
+
dataRef.current.clearTid = async.setTimeout(() => loop(), 400);
|
|
35
|
+
};
|
|
36
|
+
const handleMouseUp = () => {
|
|
37
|
+
var _a, _b, _c, _d;
|
|
38
|
+
(_b = (_a = dataRef.current).clearLoop) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
39
|
+
(_d = (_c = dataRef.current).clearTid) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
40
|
+
};
|
|
41
|
+
useEvent(windowRef, 'mouseup', handleMouseUp);
|
|
42
|
+
useImperativeHandle(ref, () => setActive, []);
|
|
43
|
+
const buttonProps = (unit, value) => ({
|
|
44
|
+
onMouseDown: (e) => {
|
|
45
|
+
if (e.button === 0) {
|
|
46
|
+
handleMouseDown(unit, value);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
onTouchStart: () => {
|
|
50
|
+
handleMouseDown(unit, value);
|
|
51
|
+
},
|
|
52
|
+
onTouchEnd: () => {
|
|
53
|
+
handleMouseUp();
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
const weekList = (() => {
|
|
57
|
+
const firstDay = active.set('date', 1);
|
|
58
|
+
const month = [];
|
|
59
|
+
let week = [];
|
|
60
|
+
for (let num = 0, addDay = -firstDay.day(); num < 7 * 6; num++, addDay++) {
|
|
61
|
+
week.push(firstDay.add(addDay, 'day').toDate());
|
|
62
|
+
if (week.length === 7) {
|
|
63
|
+
month.push(week);
|
|
64
|
+
week = [];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return month;
|
|
68
|
+
})();
|
|
69
|
+
return (_jsxs("div", Object.assign({}, styled('date-picker__panel'), { children: [_jsxs("div", Object.assign({}, styled('date-picker__header'), { children: [_jsx("button", Object.assign({}, styled('date-picker__header-button'), buttonProps('year', -1), { title: t('DatePicker', 'Previous year'), children: _jsx(Icon, { children: _jsx(KeyboardDoubleArrowLeftOutlined, {}) }) })), _jsx("button", Object.assign({}, styled('date-picker__header-button'), buttonProps('month', -1), { title: t('DatePicker', 'Previous month'), children: _jsx(Icon, { children: _jsx(KeyboardArrowLeftOutlined, {}) }) })), _jsx("span", Object.assign({}, styled('date-picker__header-date'), { children: active.format(lang === 'zh-CN' ? 'YYYY年 M月' : 'MMM YYYY') })), _jsx("button", Object.assign({}, styled('date-picker__header-button'), buttonProps('month', 1), { title: t('DatePicker', 'Next month'), children: _jsx(Icon, { children: _jsx(KeyboardArrowRightOutlined, {}) }) })), _jsx("button", Object.assign({}, styled('date-picker__header-button'), buttonProps('year', 1), { title: t('DatePicker', 'Next year'), children: _jsx(Icon, { children: _jsx(KeyboardDoubleArrowRightOutlined, {}) }) }))] })), _jsxs("table", Object.assign({}, styled('date-picker__table'), { children: [_jsx("thead", { children: _jsx("tr", { children: dayjs.weekdaysMin().map((day) => (_jsx("th", { children: day }, day))) }) }), _jsx("tbody", { children: weekList.map((week, index1) => (_jsx("tr", { children: week.map((date, index2) => {
|
|
70
|
+
var _a;
|
|
71
|
+
const day = dayjs(date);
|
|
72
|
+
const { disabled = false } = (_a = config === null || config === void 0 ? void 0 : config(date)) !== null && _a !== void 0 ? _a : {};
|
|
73
|
+
const isCurrentSelected = currentSelectedProp && day.isSame(currentSelected, 'date');
|
|
74
|
+
const isAnotherSelected = anotherSelected && day.isSame(anotherSelected, 'date');
|
|
75
|
+
const isHover = !isCurrentSelected && !isAnotherSelected && anotherSelected && day.isSame(hover, 'date');
|
|
76
|
+
const isBetween = !isCurrentSelected &&
|
|
77
|
+
!isCurrentSelected &&
|
|
78
|
+
!isHover &&
|
|
79
|
+
currentSelectedProp &&
|
|
80
|
+
anotherSelected &&
|
|
81
|
+
day.isBetween(currentSelected, anotherSelected, 'date');
|
|
82
|
+
const isBetweenHover = !isCurrentSelected && hover && anotherSelected && day.isBetween(hover, anotherSelected, 'date');
|
|
83
|
+
return (_jsx("td", { style: { pointerEvents: disabled ? 'none' : undefined }, onClick: () => {
|
|
84
|
+
setActive(date);
|
|
85
|
+
onDateChange(currentSelected.set('year', day.year()).set('month', day.month()).set('date', day.date()).toDate());
|
|
86
|
+
}, onMouseEnter: () => {
|
|
87
|
+
var _a, _b;
|
|
88
|
+
(_b = (_a = dataRef.current).clearHoverTid) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
89
|
+
setHover(date);
|
|
90
|
+
}, onMouseLeave: () => {
|
|
91
|
+
var _a, _b;
|
|
92
|
+
(_b = (_a = dataRef.current).clearHoverTid) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
93
|
+
dataRef.current.clearHoverTid = async.setTimeout(() => setHover(null), 50);
|
|
94
|
+
}, children: _jsx("div", Object.assign({}, styled('date-picker__cell', {
|
|
95
|
+
'date-picker__cell.is-active': range ? isAnotherSelected : isCurrentSelected,
|
|
96
|
+
'date-picker__cell.is-hover': isHover || (range && isCurrentSelected),
|
|
97
|
+
'date-picker__cell.is-between': isBetween,
|
|
98
|
+
'date-picker__cell.is-between-hover': isBetweenHover,
|
|
99
|
+
'date-picker__cell.is-disabled': disabled,
|
|
100
|
+
'date-picker__cell--out-month': day.get('month') !== active.get('month'),
|
|
101
|
+
'date-picker__cell--today': !isCurrentSelected && !isAnotherSelected && day.isSame(dayjs(), 'date'),
|
|
102
|
+
}), { children: day.get('date') })) }, index2));
|
|
103
|
+
}) }, index1))) })] }))] })));
|
|
104
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { FormControlProvider } from '../form/types';
|
|
4
|
+
import type { TimePickerProps } from '../time-picker';
|
|
5
|
+
import type { BaseProps, CloneHTMLElement, Size } from '../types';
|
|
6
|
+
export {};
|
|
7
|
+
export interface DatePickerRef {
|
|
8
|
+
updatePosition: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface DatePickerProps extends BaseProps<'date-picker' | 'time-picker' | 'date-picker-popup', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'placeholder'> {
|
|
11
|
+
formControl?: FormControlProvider;
|
|
12
|
+
model?: Date | [Date, Date] | null;
|
|
13
|
+
defaultModel?: Date | [Date, Date] | null;
|
|
14
|
+
visible?: boolean;
|
|
15
|
+
defaultVisible?: boolean;
|
|
16
|
+
placeholder?: string | [string?, string?];
|
|
17
|
+
range?: boolean;
|
|
18
|
+
format?: string;
|
|
19
|
+
order?: 'ascend' | 'descend' | false;
|
|
20
|
+
clearable?: boolean;
|
|
21
|
+
size?: Size;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
presetDate?: {
|
|
24
|
+
[index: string]: () => Date | [Date, Date];
|
|
25
|
+
};
|
|
26
|
+
config?: (date: Date, position: 'start' | 'end', current: [Date | null, Date | null]) => {
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
};
|
|
29
|
+
showTime?: boolean | Pick<TimePickerProps, 'config'>;
|
|
30
|
+
escClosable?: boolean;
|
|
31
|
+
inputRef?: [React.ForwardedRef<HTMLInputElement>?, React.ForwardedRef<HTMLInputElement>?];
|
|
32
|
+
inputRender?: [CloneHTMLElement?, CloneHTMLElement?];
|
|
33
|
+
onModelChange?: (date: any) => void;
|
|
34
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
35
|
+
onClear?: () => void;
|
|
36
|
+
afterVisibleChange?: (visible: boolean) => void;
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
'date-picker': string;
|
|
3
|
+
'date-picker.is-disabled': string;
|
|
4
|
+
'date-picker--small': string;
|
|
5
|
+
'date-picker--medium': string;
|
|
6
|
+
'date-picker--large': string;
|
|
7
|
+
'date-picker__input': string;
|
|
8
|
+
'date-picker__indicator': string;
|
|
9
|
+
'date-picker__separator': string;
|
|
10
|
+
'date-picker__clear': string;
|
|
11
|
+
'date-picker__icon': string;
|
|
12
|
+
'date-picker-popup': string;
|
|
13
|
+
'date-picker__preset': string;
|
|
14
|
+
'date-picker__preset-option': string;
|
|
15
|
+
'date-picker__panel-wrapper': string;
|
|
16
|
+
'date-picker__panel': string;
|
|
17
|
+
'date-picker__header': string;
|
|
18
|
+
'date-picker__header-button': string;
|
|
19
|
+
'date-picker__header-date': string;
|
|
20
|
+
'date-picker__table': string;
|
|
21
|
+
'date-picker__cell': string;
|
|
22
|
+
'date-picker__cell.is-active': string;
|
|
23
|
+
'date-picker__cell.is-hover': string;
|
|
24
|
+
'date-picker__cell.is-between': string;
|
|
25
|
+
'date-picker__cell.is-between-hover': string;
|
|
26
|
+
'date-picker__cell.is-disabled': string;
|
|
27
|
+
'date-picker__cell--out-month': string;
|
|
28
|
+
'date-picker__cell--today': string;
|
|
29
|
+
'date-picker__footer': string;
|
|
30
|
+
'time-picker__panel': string;
|
|
31
|
+
'time-picker__header': string;
|
|
32
|
+
'time-picker__column': string;
|
|
33
|
+
'time-picker__cell': string;
|
|
34
|
+
'time-picker__cell.is-active': string;
|
|
35
|
+
'time-picker__cell.is-disabled': string;
|
|
36
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
'date-picker': '^date-picker',
|
|
3
|
+
'date-picker.is-disabled': 'is-disabled',
|
|
4
|
+
'date-picker--small': '^date-picker--small',
|
|
5
|
+
'date-picker--medium': '^date-picker--medium',
|
|
6
|
+
'date-picker--large': '^date-picker--large',
|
|
7
|
+
'date-picker__input': '^date-picker__input',
|
|
8
|
+
'date-picker__indicator': '^date-picker__indicator',
|
|
9
|
+
'date-picker__separator': '^date-picker__separator',
|
|
10
|
+
'date-picker__clear': '^date-picker__clear',
|
|
11
|
+
'date-picker__icon': '^date-picker__icon',
|
|
12
|
+
'date-picker-popup': '^date-picker-popup',
|
|
13
|
+
'date-picker__preset': '^date-picker__preset',
|
|
14
|
+
'date-picker__preset-option': '^date-picker__preset-option',
|
|
15
|
+
'date-picker__panel-wrapper': '^date-picker__panel-wrapper',
|
|
16
|
+
'date-picker__panel': '^date-picker__panel',
|
|
17
|
+
'date-picker__header': '^date-picker__header',
|
|
18
|
+
'date-picker__header-button': '^date-picker__header-button',
|
|
19
|
+
'date-picker__header-date': '^date-picker__header-date',
|
|
20
|
+
'date-picker__table': '^date-picker__table',
|
|
21
|
+
'date-picker__cell': '^date-picker__cell',
|
|
22
|
+
'date-picker__cell.is-active': 'is-active',
|
|
23
|
+
'date-picker__cell.is-hover': 'is-hover',
|
|
24
|
+
'date-picker__cell.is-between': 'is-between',
|
|
25
|
+
'date-picker__cell.is-between-hover': 'is-between-hover',
|
|
26
|
+
'date-picker__cell.is-disabled': 'is-disabled',
|
|
27
|
+
'date-picker__cell--out-month': '^date-picker__cell--out-month',
|
|
28
|
+
'date-picker__cell--today': '^date-picker__cell--today',
|
|
29
|
+
'date-picker__footer': '^date-picker__footer',
|
|
30
|
+
'time-picker__panel': '^time-picker__panel',
|
|
31
|
+
'time-picker__header': '^time-picker__header',
|
|
32
|
+
'time-picker__column': '^time-picker__column',
|
|
33
|
+
'time-picker__cell': '^time-picker__cell',
|
|
34
|
+
'time-picker__cell.is-active': 'is-active',
|
|
35
|
+
'time-picker__cell.is-disabled': 'is-disabled',
|
|
36
|
+
};
|
package/dayjs.d.ts
ADDED
package/dayjs.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import 'dayjs/locale/zh-cn';
|
|
3
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
4
|
+
import isBetween from 'dayjs/plugin/isBetween';
|
|
5
|
+
import localeData from 'dayjs/plugin/localeData';
|
|
6
|
+
import updateLocale from 'dayjs/plugin/updateLocale';
|
|
7
|
+
dayjs.extend(customParseFormat);
|
|
8
|
+
dayjs.extend(isBetween);
|
|
9
|
+
dayjs.extend(localeData);
|
|
10
|
+
dayjs.extend(updateLocale);
|
|
11
|
+
export default dayjs;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { DrawerProps } from './types';
|
|
3
|
+
import { DrawerFooter } from './DrawerFooter';
|
|
4
|
+
import { DrawerHeader } from './DrawerHeader';
|
|
5
|
+
export declare const Drawer: {
|
|
6
|
+
(props: DrawerProps): JSX.Element | null;
|
|
7
|
+
Header: typeof DrawerHeader;
|
|
8
|
+
Footer: typeof DrawerFooter;
|
|
9
|
+
};
|
package/drawer/Drawer.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { isString, isUndefined } from 'lodash';
|
|
4
|
+
import { cloneElement, useContext, useEffect, useId, useMemo, useRef } from 'react';
|
|
5
|
+
import { DrawerFooter } from './DrawerFooter';
|
|
6
|
+
import { DrawerHeader } from './DrawerHeader';
|
|
7
|
+
import { CLASSES, DrawerContext } from './vars';
|
|
8
|
+
import { useComponentProps, useLockScroll, useMaxIndex, useNamespace, useStyled } from '../hooks';
|
|
9
|
+
import { Mask } from '../internal/mask';
|
|
10
|
+
import { Portal } from '../internal/portal';
|
|
11
|
+
import { Transition } from '../internal/transition';
|
|
12
|
+
import { handleModalKeyDown, mergeCS } from '../utils';
|
|
13
|
+
import { TTANSITION_DURING_BASE } from '../vars';
|
|
14
|
+
export const Drawer = (props) => {
|
|
15
|
+
const _a = useComponentProps('Drawer', props), { children, styleOverrides, styleProvider, visible, header: headerProp, footer, placement = 'right', width = 400, height = 280, mask = true, maskClosable = true, escClosable = true, container, skipFirstTransition = true, destroyAfterClose = true, zIndex: zIndexProp, onClose, afterVisibleChange } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "visible", "header", "footer", "placement", "width", "height", "mask", "maskClosable", "escClosable", "container", "skipFirstTransition", "destroyAfterClose", "zIndex", "onClose", "afterVisibleChange"]);
|
|
16
|
+
const isFixed = isUndefined(container);
|
|
17
|
+
const namespace = useNamespace();
|
|
18
|
+
const styled = useStyled(CLASSES, { drawer: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.drawer }, styleOverrides);
|
|
19
|
+
const drawerRef = useRef(null);
|
|
20
|
+
const dataRef = useRef({
|
|
21
|
+
prevActiveEl: null,
|
|
22
|
+
});
|
|
23
|
+
const uniqueId = useId();
|
|
24
|
+
const titleId = `${namespace}-drawer-title-${uniqueId}`;
|
|
25
|
+
const bodyId = `${namespace}-drawer-content-${uniqueId}`;
|
|
26
|
+
const drawerContext = useContext(DrawerContext);
|
|
27
|
+
const ancestryIds = [];
|
|
28
|
+
if (visible) {
|
|
29
|
+
drawerContext.forEach((ancestry) => {
|
|
30
|
+
if (ancestry.placement === placement) {
|
|
31
|
+
ancestryIds.push(ancestry.uniqueId);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const drawerContextValue = useMemo(() => drawerContext.concat({ uniqueId, placement }), [drawerContext, placement, uniqueId]);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
let offset = 0;
|
|
38
|
+
document.querySelectorAll(`[data-l-drawer-ancestry~="${uniqueId}"]`).forEach((el) => {
|
|
39
|
+
offset += placement === 'top' || placement === 'bottom' ? el.offsetHeight : el.offsetWidth;
|
|
40
|
+
});
|
|
41
|
+
offset = (offset / 3) * 2;
|
|
42
|
+
if (drawerRef.current) {
|
|
43
|
+
drawerRef.current.style.transform =
|
|
44
|
+
placement === 'top'
|
|
45
|
+
? `translateY(${offset}px)`
|
|
46
|
+
: placement === 'right'
|
|
47
|
+
? `translateX(-${offset}px)`
|
|
48
|
+
: placement === 'bottom'
|
|
49
|
+
? `translateY(-${offset}px)`
|
|
50
|
+
: `translateX(${offset}px)`;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const maxZIndex = useMaxIndex(visible);
|
|
54
|
+
const zIndex = !isUndefined(zIndexProp)
|
|
55
|
+
? zIndexProp
|
|
56
|
+
: !isFixed
|
|
57
|
+
? `var(--${namespace}-zindex-absolute)`
|
|
58
|
+
: `calc(var(--${namespace}-zindex-fixed) + ${maxZIndex})`;
|
|
59
|
+
useLockScroll(isFixed && visible);
|
|
60
|
+
const transitionStyles = (() => {
|
|
61
|
+
const transform = placement === 'top'
|
|
62
|
+
? 'translate(0, -100%)'
|
|
63
|
+
: placement === 'right'
|
|
64
|
+
? 'translate(100%, 0)'
|
|
65
|
+
: placement === 'bottom'
|
|
66
|
+
? 'translate(0, 100%)'
|
|
67
|
+
: 'translate(-100%, 0)';
|
|
68
|
+
return {
|
|
69
|
+
enter: { transform },
|
|
70
|
+
entering: {
|
|
71
|
+
transition: ['transform'].map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-out`).join(', '),
|
|
72
|
+
},
|
|
73
|
+
leaving: {
|
|
74
|
+
transform,
|
|
75
|
+
transition: ['transform'].map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-in`).join(', '),
|
|
76
|
+
},
|
|
77
|
+
leaved: { transform },
|
|
78
|
+
};
|
|
79
|
+
})();
|
|
80
|
+
const headerNode = (() => {
|
|
81
|
+
if (headerProp) {
|
|
82
|
+
const node = isString(headerProp) ? _jsx(DrawerHeader, { children: headerProp }) : headerProp;
|
|
83
|
+
return cloneElement(node, {
|
|
84
|
+
_id: titleId,
|
|
85
|
+
_onClose: () => {
|
|
86
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
})();
|
|
91
|
+
return (_jsx(Portal, { selector: isUndefined(container)
|
|
92
|
+
? () => {
|
|
93
|
+
let el = document.getElementById(`${namespace}-drawer-root`);
|
|
94
|
+
if (!el) {
|
|
95
|
+
el = document.createElement('div');
|
|
96
|
+
el.id = `${namespace}-drawer-root`;
|
|
97
|
+
document.body.appendChild(el);
|
|
98
|
+
}
|
|
99
|
+
return el;
|
|
100
|
+
}
|
|
101
|
+
: container, children: _jsx(Transition, { enter: visible, during: TTANSITION_DURING_BASE, skipFirstTransition: skipFirstTransition, destroyWhenLeaved: destroyAfterClose, afterEnter: () => {
|
|
102
|
+
afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(true);
|
|
103
|
+
dataRef.current.prevActiveEl = document.activeElement;
|
|
104
|
+
if (drawerRef.current) {
|
|
105
|
+
drawerRef.current.focus({ preventScroll: true });
|
|
106
|
+
}
|
|
107
|
+
}, afterLeave: () => {
|
|
108
|
+
afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(false);
|
|
109
|
+
if (dataRef.current.prevActiveEl) {
|
|
110
|
+
dataRef.current.prevActiveEl.focus({ preventScroll: true });
|
|
111
|
+
}
|
|
112
|
+
}, children: (state) => {
|
|
113
|
+
var _a;
|
|
114
|
+
return (_jsxs("div", Object.assign({}, restProps, mergeCS(styled('drawer', `drawer--${placement}`), {
|
|
115
|
+
className: restProps.className,
|
|
116
|
+
style: Object.assign(Object.assign({}, restProps.style), { display: state === 'leaved' ? 'none' : undefined, position: isFixed ? undefined : 'absolute', zIndex }),
|
|
117
|
+
}), { ref: drawerRef, tabIndex: (_a = restProps.tabIndex) !== null && _a !== void 0 ? _a : -1, role: "dialog", "aria-modal": true, "aria-labelledby": headerNode ? titleId : undefined, "aria-describedby": bodyId, onKeyDown: (e) => {
|
|
118
|
+
var _a;
|
|
119
|
+
(_a = restProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
120
|
+
if (visible && escClosable && e.code === 'Escape') {
|
|
121
|
+
e.stopPropagation();
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
124
|
+
}
|
|
125
|
+
handleModalKeyDown(e);
|
|
126
|
+
}, children: [mask && (_jsx(Mask, { visible: visible, onClose: () => {
|
|
127
|
+
if (maskClosable) {
|
|
128
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
129
|
+
}
|
|
130
|
+
} })), _jsxs("div", Object.assign({}, mergeCS(styled('drawer__content'), {
|
|
131
|
+
style: Object.assign({ width: placement === 'left' || placement === 'right' ? width : undefined, height: placement === 'bottom' || placement === 'top' ? height : undefined }, transitionStyles[state]),
|
|
132
|
+
}), { "data-l-drawer-ancestry": ancestryIds.join(' '), children: [headerNode, _jsx("div", Object.assign({}, styled('drawer__body'), { id: bodyId, children: _jsx(DrawerContext.Provider, { value: drawerContextValue, children: children }) })), footer &&
|
|
133
|
+
cloneElement(footer, {
|
|
134
|
+
_onClose: () => {
|
|
135
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
136
|
+
},
|
|
137
|
+
})] }))] })));
|
|
138
|
+
} }) }));
|
|
139
|
+
};
|
|
140
|
+
Drawer.Header = DrawerHeader;
|
|
141
|
+
Drawer.Footer = DrawerFooter;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Children } from 'react';
|
|
4
|
+
import { CLASSES } from './vars';
|
|
5
|
+
import { Button } from '../button';
|
|
6
|
+
import { useComponentProps, useControlled, useStyled, useTranslation } from '../hooks';
|
|
7
|
+
import { mergeCS } from '../utils';
|
|
8
|
+
export function DrawerFooter(props) {
|
|
9
|
+
const _a = useComponentProps('DrawerFooter', props), { styleOverrides, styleProvider, align = 'right', actions = ['cancel', 'ok'], cancelProps: cancelPropsProp, okProps: okPropsProp, onCancelClick, onOkClick, _onClose } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "align", "actions", "cancelProps", "okProps", "onCancelClick", "onOkClick", "_onClose"]);
|
|
10
|
+
const styled = useStyled(CLASSES, { drawer: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.drawer }, styleOverrides);
|
|
11
|
+
const { t } = useTranslation();
|
|
12
|
+
const [cancelLoading, changeCancelLoading] = useControlled(false, cancelPropsProp === null || cancelPropsProp === void 0 ? void 0 : cancelPropsProp.loading);
|
|
13
|
+
const [okLoading, changeOkLoading] = useControlled(false, okPropsProp === null || okPropsProp === void 0 ? void 0 : okPropsProp.loading);
|
|
14
|
+
const cancelProps = Object.assign(Object.assign({}, cancelPropsProp), { loading: cancelLoading, onClick: () => {
|
|
15
|
+
const shouldClose = onCancelClick === null || onCancelClick === void 0 ? void 0 : onCancelClick();
|
|
16
|
+
if (shouldClose instanceof Promise) {
|
|
17
|
+
changeCancelLoading(true);
|
|
18
|
+
shouldClose.then((val) => {
|
|
19
|
+
changeCancelLoading(false);
|
|
20
|
+
if (val !== false) {
|
|
21
|
+
_onClose === null || _onClose === void 0 ? void 0 : _onClose();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else if (shouldClose !== false) {
|
|
26
|
+
_onClose === null || _onClose === void 0 ? void 0 : _onClose();
|
|
27
|
+
}
|
|
28
|
+
} });
|
|
29
|
+
const okProps = Object.assign(Object.assign({}, okPropsProp), { loading: okLoading, onClick: () => {
|
|
30
|
+
const shouldClose = onOkClick === null || onOkClick === void 0 ? void 0 : onOkClick();
|
|
31
|
+
if (shouldClose instanceof Promise) {
|
|
32
|
+
changeOkLoading(true);
|
|
33
|
+
shouldClose.then((val) => {
|
|
34
|
+
changeOkLoading(false);
|
|
35
|
+
if (val !== false) {
|
|
36
|
+
_onClose === null || _onClose === void 0 ? void 0 : _onClose();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
else if (shouldClose !== false) {
|
|
41
|
+
_onClose === null || _onClose === void 0 ? void 0 : _onClose();
|
|
42
|
+
}
|
|
43
|
+
} });
|
|
44
|
+
return (_jsx("div", Object.assign({}, restProps, mergeCS(styled('drawer__footer', `drawer__footer--${align}`), {
|
|
45
|
+
className: restProps.className,
|
|
46
|
+
style: restProps.style,
|
|
47
|
+
}), { children: Children.map(actions, (action) => {
|
|
48
|
+
var _a, _b, _c;
|
|
49
|
+
return action === 'cancel' ? (_jsx(Button, Object.assign({}, cancelProps, { pattern: (_a = cancelProps.pattern) !== null && _a !== void 0 ? _a : 'secondary', children: (_b = cancelProps.children) !== null && _b !== void 0 ? _b : t('Footer', 'Cancel') }))) : action === 'ok' ? (_jsx(Button, Object.assign({}, okProps, { children: (_c = okProps.children) !== null && _c !== void 0 ? _c : t('Footer', 'OK') }))) : (action);
|
|
50
|
+
}) })));
|
|
51
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ReactComponent as CloseOutlined } from '@material-design-icons/svg/outlined/close.svg';
|
|
4
|
+
import { Children } from 'react';
|
|
5
|
+
import { CLASSES } from './vars';
|
|
6
|
+
import { Button } from '../button';
|
|
7
|
+
import { useComponentProps, useControlled, useStyled, useTranslation } from '../hooks';
|
|
8
|
+
import { Icon } from '../icon';
|
|
9
|
+
import { mergeCS } from '../utils';
|
|
10
|
+
export function DrawerHeader(props) {
|
|
11
|
+
const _a = useComponentProps('DrawerHeader', props), { styleOverrides, styleProvider, children, actions = ['close'], closeProps: closePropsProp, onCloseClick, _id, _onClose } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "children", "actions", "closeProps", "onCloseClick", "_id", "_onClose"]);
|
|
12
|
+
const styled = useStyled(CLASSES, { drawer: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.drawer }, styleOverrides);
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
const [closeLoading, changeCloseLoading] = useControlled(false, closePropsProp === null || closePropsProp === void 0 ? void 0 : closePropsProp.loading);
|
|
15
|
+
const closeProps = Object.assign(Object.assign({}, closePropsProp), { loading: closeLoading, onClick: () => {
|
|
16
|
+
const shouldClose = onCloseClick === null || onCloseClick === void 0 ? void 0 : onCloseClick();
|
|
17
|
+
if (shouldClose instanceof Promise) {
|
|
18
|
+
changeCloseLoading(true);
|
|
19
|
+
shouldClose.then((val) => {
|
|
20
|
+
changeCloseLoading(false);
|
|
21
|
+
if (val !== false) {
|
|
22
|
+
_onClose === null || _onClose === void 0 ? void 0 : _onClose();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
else if (shouldClose !== false) {
|
|
27
|
+
_onClose === null || _onClose === void 0 ? void 0 : _onClose();
|
|
28
|
+
}
|
|
29
|
+
} });
|
|
30
|
+
return (_jsxs("div", Object.assign({}, restProps, mergeCS(styled('drawer__header'), {
|
|
31
|
+
className: restProps.className,
|
|
32
|
+
style: restProps.style,
|
|
33
|
+
}), { children: [_jsx("div", Object.assign({}, styled('drawer__header-title'), { id: _id, children: children })), _jsx("div", Object.assign({}, styled('drawer__header-actions'), { children: Children.map(actions, (action) => {
|
|
34
|
+
var _a, _b, _c;
|
|
35
|
+
return action === 'close' ? (_jsx(Button, Object.assign({}, closeProps, { "aria-label": (_a = closeProps['aria-label']) !== null && _a !== void 0 ? _a : t('Close'), pattern: (_b = closeProps.pattern) !== null && _b !== void 0 ? _b : 'text', icon: (_c = closeProps.icon) !== null && _c !== void 0 ? _c : (_jsx(Icon, { children: _jsx(CloseOutlined, {}) })) }))) : (action);
|
|
36
|
+
}) }))] })));
|
|
37
|
+
}
|
package/drawer/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Drawer } from './Drawer';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { ButtonProps } from '../button';
|
|
4
|
+
import type { BaseProps } from '../types';
|
|
5
|
+
import type { RefExtra } from '@laser-ui/hooks/useRefExtra';
|
|
6
|
+
export {};
|
|
7
|
+
export interface DrawerProps extends BaseProps<'drawer', typeof CLASSES>, React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
visible: boolean;
|
|
9
|
+
header?: React.ReactElement | string;
|
|
10
|
+
footer?: React.ReactElement;
|
|
11
|
+
placement?: 'top' | 'right' | 'bottom' | 'left';
|
|
12
|
+
width?: number | string;
|
|
13
|
+
height?: number | string;
|
|
14
|
+
mask?: boolean;
|
|
15
|
+
maskClosable?: boolean;
|
|
16
|
+
escClosable?: boolean;
|
|
17
|
+
container?: RefExtra;
|
|
18
|
+
skipFirstTransition?: boolean;
|
|
19
|
+
destroyAfterClose?: boolean;
|
|
20
|
+
zIndex?: number | string;
|
|
21
|
+
onClose?: () => void;
|
|
22
|
+
afterVisibleChange?: (visible: boolean) => void;
|
|
23
|
+
}
|
|
24
|
+
export interface DrawerHeaderProps extends BaseProps<'drawer', typeof CLASSES>, React.HTMLAttributes<HTMLDivElement> {
|
|
25
|
+
actions?: React.ReactNode[];
|
|
26
|
+
closeProps?: ButtonProps;
|
|
27
|
+
onCloseClick?: () => any | Promise<any>;
|
|
28
|
+
}
|
|
29
|
+
export interface DrawerFooterProps extends BaseProps<'drawer', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
30
|
+
align?: 'left' | 'center' | 'right';
|
|
31
|
+
actions?: React.ReactNode[];
|
|
32
|
+
cancelProps?: ButtonProps;
|
|
33
|
+
okProps?: ButtonProps;
|
|
34
|
+
onCancelClick?: () => any | Promise<any>;
|
|
35
|
+
onOkClick?: () => any | Promise<any>;
|
|
36
|
+
}
|
package/drawer/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/drawer/vars.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const CLASSES: {
|
|
3
|
+
drawer: string;
|
|
4
|
+
'drawer--top': string;
|
|
5
|
+
'drawer--right': string;
|
|
6
|
+
'drawer--bottom': string;
|
|
7
|
+
'drawer--left': string;
|
|
8
|
+
drawer__content: string;
|
|
9
|
+
drawer__header: string;
|
|
10
|
+
'drawer__header-title': string;
|
|
11
|
+
'drawer__header-actions': string;
|
|
12
|
+
drawer__body: string;
|
|
13
|
+
drawer__footer: string;
|
|
14
|
+
'drawer__footer--left': string;
|
|
15
|
+
'drawer__footer--center': string;
|
|
16
|
+
'drawer__footer--right': string;
|
|
17
|
+
};
|
|
18
|
+
export declare const DrawerContext: import("react").Context<{
|
|
19
|
+
uniqueId: string;
|
|
20
|
+
placement: 'top' | 'right' | 'bottom' | 'left';
|
|
21
|
+
}[]>;
|
package/drawer/vars.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
export const CLASSES = {
|
|
3
|
+
drawer: '^drawer',
|
|
4
|
+
'drawer--top': '^drawer--top',
|
|
5
|
+
'drawer--right': '^drawer--right',
|
|
6
|
+
'drawer--bottom': '^drawer--bottom',
|
|
7
|
+
'drawer--left': '^drawer--left',
|
|
8
|
+
drawer__content: '^drawer__content',
|
|
9
|
+
drawer__header: '^drawer__header',
|
|
10
|
+
'drawer__header-title': '^drawer__header-title',
|
|
11
|
+
'drawer__header-actions': '^drawer__header-actions',
|
|
12
|
+
drawer__body: '^drawer__body',
|
|
13
|
+
drawer__footer: '^drawer__footer',
|
|
14
|
+
'drawer__footer--left': '^drawer__footer--left',
|
|
15
|
+
'drawer__footer--center': '^drawer__footer--center',
|
|
16
|
+
'drawer__footer--right': '^drawer__footer--right',
|
|
17
|
+
};
|
|
18
|
+
export const DrawerContext = createContext([]);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { DropdownItem, DropdownProps, DropdownRef } from './types';
|
|
3
|
+
declare function DropdownFC<ID extends React.Key, T extends DropdownItem<ID>>(props: DropdownProps<ID, T>, ref: React.ForwardedRef<DropdownRef>): JSX.Element | null;
|
|
4
|
+
export declare const Dropdown: <ID extends React.Key, T extends DropdownItem<ID>>(props: DropdownProps<ID, T> & React.RefAttributes<DropdownRef>) => ReturnType<typeof DropdownFC>;
|
|
5
|
+
export {};
|