@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,53 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { createElement as _createElement } from "react";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
|
+
import { checkNodeExist } from '@laser-ui/utils';
|
|
5
|
+
import { Fragment } from 'react';
|
|
6
|
+
import { CLASSES } from './vars';
|
|
7
|
+
import { useComponentProps, useStyled } from '../hooks';
|
|
8
|
+
import { mergeCS } from '../utils';
|
|
9
|
+
export function Timeline(props) {
|
|
10
|
+
const _a = useComponentProps('Timeline', props), { styleOverrides, styleProvider, list, vertical = false, lineSize = 36 } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "list", "vertical", "lineSize"]);
|
|
11
|
+
const styled = useStyled(CLASSES, { timeline: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.timeline }, styleOverrides);
|
|
12
|
+
const nodeExist = (() => {
|
|
13
|
+
const hasNode = [false, false];
|
|
14
|
+
for (const item of list) {
|
|
15
|
+
if (checkNodeExist(item.content[0])) {
|
|
16
|
+
hasNode[0] = true;
|
|
17
|
+
}
|
|
18
|
+
if (checkNodeExist(item.content[1])) {
|
|
19
|
+
hasNode[1] = true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return hasNode;
|
|
23
|
+
})();
|
|
24
|
+
return (_jsx("div", Object.assign({}, restProps, mergeCS(styled('timeline', {
|
|
25
|
+
'timeline--vertical': vertical,
|
|
26
|
+
}), {
|
|
27
|
+
className: restProps.className,
|
|
28
|
+
style: restProps.style,
|
|
29
|
+
}), { children: vertical ? (_jsx(_Fragment, { children: list.map((item, index) => {
|
|
30
|
+
const { state: itemState = 'wait', content: itemContent, color: itemColor, dot: itemDot } = item;
|
|
31
|
+
return (_jsxs(Fragment, { children: [_jsxs("div", Object.assign({}, styled('timeline__content'), { children: [nodeExist[0] && _jsx("div", Object.assign({}, styled('timeline__text', 'timeline__text--left'), { children: itemContent[0] })), _jsxs("div", Object.assign({}, mergeCS(styled('timeline__track', `timeline__track.is-${itemState}`), {
|
|
32
|
+
style: Object.assign({ '--color': itemColor }, { width: lineSize }),
|
|
33
|
+
}), { children: [_jsx("div", Object.assign({}, styled('timeline__separator', {
|
|
34
|
+
'timeline__separator--hidden': index === 0,
|
|
35
|
+
}))), checkNodeExist(itemDot) ? itemDot : _jsx("div", Object.assign({}, styled('timeline__dot'))), _jsx("div", Object.assign({}, styled('timeline__separator', {
|
|
36
|
+
'timeline__separator--hidden': index === list.length - 1,
|
|
37
|
+
})))] })), nodeExist[1] && _jsx("div", Object.assign({}, styled('timeline__text'), { children: itemContent[1] }))] })), index !== list.length - 1 && (_jsxs("div", Object.assign({}, styled('timeline__content', 'timeline__content--gap'), { children: [nodeExist[0] && _jsx("div", Object.assign({}, styled('timeline__text', 'timeline__text--left'))), _jsx("div", Object.assign({}, mergeCS(styled('timeline__track'), { style: { width: lineSize } }), { children: _jsx("div", Object.assign({}, styled('timeline__separator'))) })), nodeExist[1] && _jsx("div", Object.assign({}, styled('timeline__text')))] })))] }, index));
|
|
38
|
+
}) })) : (_jsxs(_Fragment, { children: [nodeExist[0] && (_jsx("div", Object.assign({}, styled('timeline__text-container'), { children: list.map((item, index) => (_createElement("div", Object.assign({}, styled('timeline__text'), { key: index }), item.content[0]))) }))), _jsx("div", Object.assign({}, mergeCS(styled('timeline__track-container'), {
|
|
39
|
+
style: { height: lineSize },
|
|
40
|
+
}), { children: list.map((item, index) => {
|
|
41
|
+
const { state: itemState = 'wait', color: itemColor, dot: itemDot } = item;
|
|
42
|
+
return (_createElement("div", Object.assign({}, mergeCS(styled('timeline__track', `timeline__track.is-${itemState}`), {
|
|
43
|
+
style: Object.assign({}, { '--color': itemColor }),
|
|
44
|
+
}), { key: index }),
|
|
45
|
+
_jsx("div", Object.assign({}, styled('timeline__separator', {
|
|
46
|
+
'timeline__separator--hidden': index === 0,
|
|
47
|
+
}))),
|
|
48
|
+
checkNodeExist(itemDot) ? itemDot : _jsx("div", Object.assign({}, styled('timeline__dot'))),
|
|
49
|
+
_jsx("div", Object.assign({}, styled('timeline__separator', {
|
|
50
|
+
'timeline__separator--hidden': index === list.length - 1,
|
|
51
|
+
})))));
|
|
52
|
+
}) })), nodeExist[1] && (_jsx("div", Object.assign({}, styled('timeline__text-container'), { children: list.map((item, index) => (_createElement("div", Object.assign({}, styled('timeline__text'), { key: index }), item.content[1]))) })))] })) })));
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Timeline } from './Timeline';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { BaseProps } from '../types';
|
|
4
|
+
export {};
|
|
5
|
+
export interface TimelineItem {
|
|
6
|
+
content: [React.ReactNode, React.ReactNode];
|
|
7
|
+
state?: 'wait' | 'active' | 'completed' | 'warning' | 'error';
|
|
8
|
+
color?: string;
|
|
9
|
+
dot?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface TimelineProps<T extends TimelineItem> extends BaseProps<'timeline', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
12
|
+
list: T[];
|
|
13
|
+
vertical?: boolean;
|
|
14
|
+
lineSize?: number;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
timeline: string;
|
|
3
|
+
'timeline--vertical': string;
|
|
4
|
+
timeline__content: string;
|
|
5
|
+
'timeline__content--gap': string;
|
|
6
|
+
'timeline__text-container': string;
|
|
7
|
+
timeline__text: string;
|
|
8
|
+
'timeline__text--left': string;
|
|
9
|
+
'timeline__track-container': string;
|
|
10
|
+
timeline__track: string;
|
|
11
|
+
'timeline__track.is-wait': string;
|
|
12
|
+
'timeline__track.is-active': string;
|
|
13
|
+
'timeline__track.is-completed': string;
|
|
14
|
+
'timeline__track.is-warning': string;
|
|
15
|
+
'timeline__track.is-error': string;
|
|
16
|
+
timeline__dot: string;
|
|
17
|
+
timeline__separator: string;
|
|
18
|
+
'timeline__separator--hidden': string;
|
|
19
|
+
};
|
package/timeline/vars.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
timeline: '^timeline',
|
|
3
|
+
'timeline--vertical': '^timeline--vertical',
|
|
4
|
+
timeline__content: '^timeline__content',
|
|
5
|
+
'timeline__content--gap': '^timeline__content--gap',
|
|
6
|
+
'timeline__text-container': '^timeline__text-container',
|
|
7
|
+
timeline__text: '^timeline__text',
|
|
8
|
+
'timeline__text--left': '^timeline__text--left',
|
|
9
|
+
'timeline__track-container': '^timeline__track-container',
|
|
10
|
+
timeline__track: '^timeline__track',
|
|
11
|
+
'timeline__track.is-wait': 'is-wait',
|
|
12
|
+
'timeline__track.is-active': 'is-active',
|
|
13
|
+
'timeline__track.is-completed': 'is-completed',
|
|
14
|
+
'timeline__track.is-warning': 'is-warning',
|
|
15
|
+
'timeline__track.is-error': 'is-error',
|
|
16
|
+
timeline__dot: '^timeline__dot',
|
|
17
|
+
timeline__separator: '^timeline__separator',
|
|
18
|
+
'timeline__separator--hidden': '^timeline__separator--hidden',
|
|
19
|
+
};
|
package/toast/Toast.d.ts
ADDED
package/toast/Toast.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useAsync, useMount } from '@laser-ui/hooks';
|
|
4
|
+
import { checkNodeExist } from '@laser-ui/utils';
|
|
5
|
+
import { ReactComponent as CheckCircleOutlined } from '@material-design-icons/svg/outlined/check_circle.svg';
|
|
6
|
+
import { ReactComponent as CloseOutlined } from '@material-design-icons/svg/outlined/close.svg';
|
|
7
|
+
import { ReactComponent as HighlightOffOutlined } from '@material-design-icons/svg/outlined/highlight_off.svg';
|
|
8
|
+
import { ReactComponent as InfoOutlined } from '@material-design-icons/svg/outlined/info.svg';
|
|
9
|
+
import { ReactComponent as WarningAmberOutlined } from '@material-design-icons/svg/outlined/warning_amber.svg';
|
|
10
|
+
import { isUndefined } from 'lodash';
|
|
11
|
+
import { useId, useRef } from 'react';
|
|
12
|
+
import { CLASSES, TTANSITION_DURING } from './vars';
|
|
13
|
+
import { useComponentProps, useNamespace, useStyled, useTranslation } from '../hooks';
|
|
14
|
+
import { Icon } from '../icon';
|
|
15
|
+
import { Portal } from '../internal/portal';
|
|
16
|
+
import { Transition } from '../internal/transition';
|
|
17
|
+
import { mergeCS } from '../utils';
|
|
18
|
+
export function Toast(props) {
|
|
19
|
+
const _a = useComponentProps('Toast', props), { children, styleOverrides, styleProvider, visible, type, placement = 'top', duration = 2, icon, closable = false, escClosable = true, skipFirstTransition = true, destroyAfterClose = true, onClose, afterVisibleChange } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "visible", "type", "placement", "duration", "icon", "closable", "escClosable", "skipFirstTransition", "destroyAfterClose", "onClose", "afterVisibleChange"]);
|
|
20
|
+
const namespace = useNamespace();
|
|
21
|
+
const styled = useStyled(CLASSES, { toast: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.toast }, styleOverrides);
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
const async = useAsync();
|
|
24
|
+
const toastRef = useRef(null);
|
|
25
|
+
const dataRef = useRef({});
|
|
26
|
+
const uniqueId = useId();
|
|
27
|
+
const messageId = `${namespace}-toast-content-${uniqueId}`;
|
|
28
|
+
useMount(() => {
|
|
29
|
+
if (duration > 0) {
|
|
30
|
+
dataRef.current.clearTid = async.setTimeout(() => {
|
|
31
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
32
|
+
}, duration * 1000);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return (_jsx(Portal, { selector: () => {
|
|
36
|
+
const id = placement === 'top' ? `${namespace}-toast-t-root` : `${namespace}-toast-b-root`;
|
|
37
|
+
let root = document.getElementById(`${namespace}-toast-root`);
|
|
38
|
+
if (!root) {
|
|
39
|
+
root = document.createElement('div');
|
|
40
|
+
root.id = `${namespace}-toast-root`;
|
|
41
|
+
document.body.appendChild(root);
|
|
42
|
+
}
|
|
43
|
+
let el = document.getElementById(id);
|
|
44
|
+
if (!el) {
|
|
45
|
+
el = document.createElement('div');
|
|
46
|
+
el.id = id;
|
|
47
|
+
root.appendChild(el);
|
|
48
|
+
}
|
|
49
|
+
return el;
|
|
50
|
+
}, children: _jsx(Transition, { enter: visible, during: TTANSITION_DURING, skipFirstTransition: skipFirstTransition, destroyWhenLeaved: destroyAfterClose, afterEnter: () => {
|
|
51
|
+
afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(true);
|
|
52
|
+
}, afterLeave: () => {
|
|
53
|
+
afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(false);
|
|
54
|
+
}, children: (state) => {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
let transitionStyle = {};
|
|
57
|
+
switch (state) {
|
|
58
|
+
case 'enter':
|
|
59
|
+
transitionStyle = {
|
|
60
|
+
transform: placement === 'top' ? 'translate(0, -70%)' : 'translate(0, 70%)',
|
|
61
|
+
opacity: 0,
|
|
62
|
+
};
|
|
63
|
+
break;
|
|
64
|
+
case 'entering':
|
|
65
|
+
transitionStyle = {
|
|
66
|
+
transition: ['transform', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING.enter}ms ease-out`).join(', '),
|
|
67
|
+
};
|
|
68
|
+
break;
|
|
69
|
+
case 'leave':
|
|
70
|
+
if (toastRef.current) {
|
|
71
|
+
const height = toastRef.current.offsetHeight;
|
|
72
|
+
transitionStyle = { height, overflow: 'hidden' };
|
|
73
|
+
}
|
|
74
|
+
break;
|
|
75
|
+
case 'leaving':
|
|
76
|
+
transitionStyle = {
|
|
77
|
+
height: 0,
|
|
78
|
+
overflow: 'hidden',
|
|
79
|
+
paddingTop: 0,
|
|
80
|
+
paddingBottom: 0,
|
|
81
|
+
marginTop: 0,
|
|
82
|
+
marginBottom: 0,
|
|
83
|
+
opacity: 0,
|
|
84
|
+
transition: ['height', 'padding', 'margin', 'opacity']
|
|
85
|
+
.map((attr) => `${attr} ${TTANSITION_DURING.leave}ms ease-in`)
|
|
86
|
+
.join(', '),
|
|
87
|
+
};
|
|
88
|
+
break;
|
|
89
|
+
case 'leaved':
|
|
90
|
+
transitionStyle = { display: 'none' };
|
|
91
|
+
break;
|
|
92
|
+
default:
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
return (_jsxs("div", Object.assign({}, restProps, mergeCS(styled('toast', {
|
|
96
|
+
[`toast--${type}`]: type,
|
|
97
|
+
}), {
|
|
98
|
+
className: restProps.className,
|
|
99
|
+
style: Object.assign(Object.assign({}, restProps.style), transitionStyle),
|
|
100
|
+
}), { ref: toastRef, tabIndex: (_a = restProps.tabIndex) !== null && _a !== void 0 ? _a : -1, role: (_b = restProps.role) !== null && _b !== void 0 ? _b : 'alert', "aria-describedby": messageId, onMouseEnter: (e) => {
|
|
101
|
+
var _a, _b, _c;
|
|
102
|
+
(_a = restProps.onMouseEnter) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
103
|
+
(_c = (_b = dataRef.current).clearTid) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
104
|
+
}, onMouseLeave: (e) => {
|
|
105
|
+
var _a;
|
|
106
|
+
(_a = restProps.onMouseLeave) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
107
|
+
if (duration > 0) {
|
|
108
|
+
dataRef.current.clearTid = async.setTimeout(() => {
|
|
109
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
110
|
+
}, duration * 1000);
|
|
111
|
+
}
|
|
112
|
+
}, onKeyDown: (e) => {
|
|
113
|
+
var _a, _b, _c;
|
|
114
|
+
(_a = restProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
115
|
+
if (visible && escClosable && e.code === 'Escape') {
|
|
116
|
+
e.stopPropagation();
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
(_c = (_b = dataRef.current).clearTid) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
119
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
120
|
+
}
|
|
121
|
+
}, children: [icon !== false && (!isUndefined(type) || checkNodeExist(icon)) && (_jsx("div", Object.assign({}, styled('toast__icon'), { children: checkNodeExist(icon) ? (icon) : (_jsx(Icon, { children: type === 'success' ? (_jsx(CheckCircleOutlined, {})) : type === 'warning' ? (_jsx(WarningAmberOutlined, {})) : type === 'error' ? (_jsx(HighlightOffOutlined, {})) : (_jsx(InfoOutlined, {})) })) }))), _jsx("div", Object.assign({}, styled('toast__message'), { id: messageId, children: children })), closable && (_jsx("button", Object.assign({}, styled('toast__close'), { "aria-label": t('Close'), onClick: onClose, children: _jsx(Icon, { children: _jsx(CloseOutlined, {}) }) })))] })));
|
|
122
|
+
} }) }));
|
|
123
|
+
}
|
package/toast/index.d.ts
ADDED
package/toast/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Toast } from './Toast';
|
package/toast/types.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { BaseProps } from '../types';
|
|
4
|
+
export {};
|
|
5
|
+
export interface ToastProps extends BaseProps<'toast', typeof CLASSES>, React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
visible: boolean;
|
|
7
|
+
type?: 'success' | 'warning' | 'error' | 'info';
|
|
8
|
+
placement?: 'top' | 'bottom';
|
|
9
|
+
duration?: number;
|
|
10
|
+
icon?: React.ReactNode;
|
|
11
|
+
closable?: boolean;
|
|
12
|
+
escClosable?: boolean;
|
|
13
|
+
skipFirstTransition?: boolean;
|
|
14
|
+
destroyAfterClose?: boolean;
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
afterVisibleChange?: (visible: boolean) => void;
|
|
17
|
+
}
|
package/toast/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/toast/vars.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
toast: string;
|
|
3
|
+
'toast--success': string;
|
|
4
|
+
'toast--warning': string;
|
|
5
|
+
'toast--error': string;
|
|
6
|
+
'toast--info': string;
|
|
7
|
+
toast__icon: string;
|
|
8
|
+
toast__message: string;
|
|
9
|
+
toast__close: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const TTANSITION_DURING: {
|
|
12
|
+
enter: number;
|
|
13
|
+
leave: number;
|
|
14
|
+
};
|
package/toast/vars.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
toast: '^toast',
|
|
3
|
+
'toast--success': '^toast--success',
|
|
4
|
+
'toast--warning': '^toast--warning',
|
|
5
|
+
'toast--error': '^toast--error',
|
|
6
|
+
'toast--info': '^toast--info',
|
|
7
|
+
toast__icon: '^toast__icon',
|
|
8
|
+
toast__message: '^toast__message',
|
|
9
|
+
toast__close: '^toast__close',
|
|
10
|
+
};
|
|
11
|
+
export const TTANSITION_DURING = { enter: 133, leave: 166 };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useEventCallback, useRefExtra } from '@laser-ui/hooks';
|
|
4
|
+
import { isFunction, isUndefined } from 'lodash';
|
|
5
|
+
import { cloneElement, forwardRef, useId, useImperativeHandle, useRef, useState } from 'react';
|
|
6
|
+
import { CLASSES, TTANSITION_DURING } from './vars';
|
|
7
|
+
import { useComponentProps, useControlled, useMaxIndex, useNamespace, useStyled } from '../hooks';
|
|
8
|
+
import { Popup } from '../internal/popup';
|
|
9
|
+
import { Portal } from '../internal/portal';
|
|
10
|
+
import { Transition } from '../internal/transition';
|
|
11
|
+
import { getPopupPosition, mergeCS } from '../utils';
|
|
12
|
+
export const Tooltip = forwardRef((props, ref) => {
|
|
13
|
+
var _a;
|
|
14
|
+
const _b = useComponentProps('Tooltip', props), { children, styleOverrides, styleProvider, title, visible: visibleProp, defaultVisible, trigger = 'hover', placement: placementProp = 'top', placementFixed = false, arrow = true, escClosable = true, gap = 10, inWindow = false, mouseEnterDelay = 150, mouseLeaveDelay = 200, skipFirstTransition = true, destroyAfterClose = true, zIndex: zIndexProp, scrolling, onVisibleChange, afterVisibleChange } = _b, restProps = __rest(_b, ["children", "styleOverrides", "styleProvider", "title", "visible", "defaultVisible", "trigger", "placement", "placementFixed", "arrow", "escClosable", "gap", "inWindow", "mouseEnterDelay", "mouseLeaveDelay", "skipFirstTransition", "destroyAfterClose", "zIndex", "scrolling", "onVisibleChange", "afterVisibleChange"]);
|
|
15
|
+
const namespace = useNamespace();
|
|
16
|
+
const styled = useStyled(CLASSES, { tooltip: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.tooltip }, styleOverrides);
|
|
17
|
+
const uniqueId = useId();
|
|
18
|
+
const id = (_a = restProps.id) !== null && _a !== void 0 ? _a : `${namespace}-tooltip-${uniqueId}`;
|
|
19
|
+
const triggerRef = useRefExtra(() => document.querySelector(`[aria-describedby="${id}"]`));
|
|
20
|
+
const popupRef = useRef(null);
|
|
21
|
+
const scrollingRef = useRefExtra(scrolling);
|
|
22
|
+
const [visible, changeVisible] = useControlled(defaultVisible !== null && defaultVisible !== void 0 ? defaultVisible : false, visibleProp, onVisibleChange);
|
|
23
|
+
const maxZIndex = useMaxIndex(visible);
|
|
24
|
+
const zIndex = !isUndefined(zIndexProp) ? zIndexProp : `calc(var(--${namespace}-zindex-fixed) + ${maxZIndex})`;
|
|
25
|
+
const [popupPositionStyle, setPopupPositionStyle] = useState({
|
|
26
|
+
top: '-200vh',
|
|
27
|
+
left: '-200vw',
|
|
28
|
+
});
|
|
29
|
+
const [transformOrigin, setTransformOrigin] = useState();
|
|
30
|
+
const [placement, setPlacement] = useState(placementProp);
|
|
31
|
+
const updatePosition = useEventCallback(() => {
|
|
32
|
+
if (visible && triggerRef.current && popupRef.current) {
|
|
33
|
+
const position = getPopupPosition(triggerRef.current, { width: popupRef.current.offsetWidth, height: popupRef.current.offsetHeight }, {
|
|
34
|
+
placement: placementProp,
|
|
35
|
+
placementFallback: placement,
|
|
36
|
+
placementFixed,
|
|
37
|
+
gap,
|
|
38
|
+
inWindow,
|
|
39
|
+
});
|
|
40
|
+
setPopupPositionStyle({
|
|
41
|
+
top: position.top,
|
|
42
|
+
left: position.left,
|
|
43
|
+
});
|
|
44
|
+
setTransformOrigin(position.transformOrigin);
|
|
45
|
+
setPlacement(position.placement);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
useImperativeHandle(ref, () => ({
|
|
49
|
+
updatePosition,
|
|
50
|
+
}), [updatePosition]);
|
|
51
|
+
return (_jsx(Popup, { visible: visible, trigger: trigger, mouseEnterDelay: mouseEnterDelay, mouseLeaveDelay: mouseLeaveDelay, updatePosition: {
|
|
52
|
+
fn: updatePosition,
|
|
53
|
+
triggerRef,
|
|
54
|
+
popupRef,
|
|
55
|
+
containerRefs: [scrollingRef],
|
|
56
|
+
}, onVisibleChange: changeVisible, children: ({ renderTrigger, renderPopup }) => {
|
|
57
|
+
const render = (el) => renderTrigger(cloneElement(el, {
|
|
58
|
+
'aria-describedby': id,
|
|
59
|
+
onKeyDown: (e) => {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
(_b = (_a = el.props).onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
62
|
+
if (visible && escClosable && e.code === 'Escape') {
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
changeVisible(false);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
}));
|
|
69
|
+
return (_jsxs(_Fragment, { children: [isFunction(children) ? children(render) : render(children), _jsx(Portal, { selector: () => {
|
|
70
|
+
let el = document.getElementById(`${namespace}-tooltip-root`);
|
|
71
|
+
if (!el) {
|
|
72
|
+
el = document.createElement('div');
|
|
73
|
+
el.id = `${namespace}-tooltip-root`;
|
|
74
|
+
document.body.appendChild(el);
|
|
75
|
+
}
|
|
76
|
+
return el;
|
|
77
|
+
}, children: _jsx(Transition, { enter: visible, during: TTANSITION_DURING, skipFirstTransition: skipFirstTransition, destroyWhenLeaved: destroyAfterClose, afterRender: updatePosition, afterEnter: () => {
|
|
78
|
+
afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(true);
|
|
79
|
+
}, afterLeave: () => {
|
|
80
|
+
afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(false);
|
|
81
|
+
}, children: (state) => {
|
|
82
|
+
let transitionStyle = {};
|
|
83
|
+
switch (state) {
|
|
84
|
+
case 'enter':
|
|
85
|
+
transitionStyle = { transform: 'scale(0.3)', opacity: 0 };
|
|
86
|
+
break;
|
|
87
|
+
case 'entering':
|
|
88
|
+
transitionStyle = {
|
|
89
|
+
transition: ['transform', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING.enter}ms ease-out`).join(', '),
|
|
90
|
+
transformOrigin,
|
|
91
|
+
};
|
|
92
|
+
break;
|
|
93
|
+
case 'leaving':
|
|
94
|
+
transitionStyle = {
|
|
95
|
+
transform: 'scale(0.3)',
|
|
96
|
+
opacity: 0,
|
|
97
|
+
transition: ['transform', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING.leave}ms ease-in`).join(', '),
|
|
98
|
+
transformOrigin,
|
|
99
|
+
};
|
|
100
|
+
break;
|
|
101
|
+
case 'leaved':
|
|
102
|
+
transitionStyle = { display: 'none' };
|
|
103
|
+
break;
|
|
104
|
+
default:
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
return renderPopup(_jsxs("div", Object.assign({}, restProps, mergeCS(styled('tooltip', `tooltip--${placement}`), {
|
|
108
|
+
className: restProps.className,
|
|
109
|
+
style: Object.assign(Object.assign(Object.assign(Object.assign({}, restProps.style), { zIndex }), popupPositionStyle), transitionStyle),
|
|
110
|
+
}), { ref: popupRef, id: id, role: "tooltip", children: [arrow && _jsx("div", Object.assign({}, styled('tooltip__arrow'))), title] })));
|
|
111
|
+
} }) })] }));
|
|
112
|
+
} }));
|
|
113
|
+
});
|
package/tooltip/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tooltip } from './Tooltip';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { BaseProps, CloneHTMLElement, PopupPlacement } from '../types';
|
|
4
|
+
import type { RefExtra } from '@laser-ui/hooks/useRefExtra';
|
|
5
|
+
export {};
|
|
6
|
+
export interface TooltipRef {
|
|
7
|
+
updatePosition: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface TooltipProps extends BaseProps<'tooltip', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'title'> {
|
|
10
|
+
children: React.ReactElement | ((render: CloneHTMLElement) => JSX.Element | null);
|
|
11
|
+
title: React.ReactNode;
|
|
12
|
+
visible?: boolean;
|
|
13
|
+
defaultVisible?: boolean;
|
|
14
|
+
trigger?: 'hover' | 'click';
|
|
15
|
+
placement?: PopupPlacement;
|
|
16
|
+
placementFixed?: boolean;
|
|
17
|
+
arrow?: boolean;
|
|
18
|
+
escClosable?: boolean;
|
|
19
|
+
gap?: number;
|
|
20
|
+
inWindow?: number | false;
|
|
21
|
+
mouseEnterDelay?: number;
|
|
22
|
+
mouseLeaveDelay?: number;
|
|
23
|
+
skipFirstTransition?: boolean;
|
|
24
|
+
destroyAfterClose?: boolean;
|
|
25
|
+
zIndex?: number | string;
|
|
26
|
+
scrolling?: RefExtra;
|
|
27
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
28
|
+
afterVisibleChange?: (visible: boolean) => void;
|
|
29
|
+
}
|
package/tooltip/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
tooltip: string;
|
|
3
|
+
'tooltip--top': string;
|
|
4
|
+
'tooltip--top-left': string;
|
|
5
|
+
'tooltip--top-right': string;
|
|
6
|
+
'tooltip--right': string;
|
|
7
|
+
'tooltip--right-top': string;
|
|
8
|
+
'tooltip--right-bottom': string;
|
|
9
|
+
'tooltip--bottom': string;
|
|
10
|
+
'tooltip--bottom-left': string;
|
|
11
|
+
'tooltip--bottom-right': string;
|
|
12
|
+
'tooltip--left': string;
|
|
13
|
+
'tooltip--left-top': string;
|
|
14
|
+
'tooltip--left-bottom': string;
|
|
15
|
+
tooltip__arrow: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const TTANSITION_DURING: {
|
|
18
|
+
enter: number;
|
|
19
|
+
leave: number;
|
|
20
|
+
};
|
package/tooltip/vars.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
tooltip: '^tooltip',
|
|
3
|
+
'tooltip--top': '^tooltip--top',
|
|
4
|
+
'tooltip--top-left': '^tooltip--top-left',
|
|
5
|
+
'tooltip--top-right': '^tooltip--top-right',
|
|
6
|
+
'tooltip--right': '^tooltip--right',
|
|
7
|
+
'tooltip--right-top': '^tooltip--right-top',
|
|
8
|
+
'tooltip--right-bottom': '^tooltip--right-bottom',
|
|
9
|
+
'tooltip--bottom': '^tooltip--bottom',
|
|
10
|
+
'tooltip--bottom-left': '^tooltip--bottom-left',
|
|
11
|
+
'tooltip--bottom-right': '^tooltip--bottom-right',
|
|
12
|
+
'tooltip--left': '^tooltip--left',
|
|
13
|
+
'tooltip--left-top': '^tooltip--left-top',
|
|
14
|
+
'tooltip--left-bottom': '^tooltip--left-bottom',
|
|
15
|
+
tooltip__arrow: '^tooltip__arrow',
|
|
16
|
+
};
|
|
17
|
+
export const TTANSITION_DURING = { enter: 86, leave: 100 };
|