@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,14 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
notification: '^notification',
|
|
3
|
+
'notification--success': '^notification--success',
|
|
4
|
+
'notification--warning': '^notification--warning',
|
|
5
|
+
'notification--error': '^notification--error',
|
|
6
|
+
'notification--info': '^notification--info',
|
|
7
|
+
notification__icon: '^notification__icon',
|
|
8
|
+
notification__content: '^notification__content',
|
|
9
|
+
notification__header: '^notification__header',
|
|
10
|
+
notification__title: '^notification__title',
|
|
11
|
+
notification__close: '^notification__close',
|
|
12
|
+
notification__description: '^notification__description',
|
|
13
|
+
};
|
|
14
|
+
export const TTANSITION_DURING = { enter: 133, leave: 166 };
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@laser-ui/components",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "React components.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ui",
|
|
7
|
+
"laser-ui",
|
|
8
|
+
"component",
|
|
9
|
+
"components",
|
|
10
|
+
"react",
|
|
11
|
+
"react-component"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/laser-ui/laser-ui",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/laser-ui/laser-ui/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/laser-ui/laser-ui.git"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "Xie Jay <xiejay97@gmail.com>",
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"main": "./index.js",
|
|
25
|
+
"types": "./index.d.ts",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@laser-ui/hooks": "0.0.1",
|
|
28
|
+
"@laser-ui/utils": "0.0.1",
|
|
29
|
+
"@material-design-icons/svg": "^0.14.9",
|
|
30
|
+
"lodash": "^4.17.21",
|
|
31
|
+
"rcl-store": "^2.1.0",
|
|
32
|
+
"rxjs": "^7.8.1"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"dayjs": "^1.11.0",
|
|
36
|
+
"immer": ">=2.0.0",
|
|
37
|
+
"react": "^18.0.0",
|
|
38
|
+
"react-dom": "^18.0.0"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public",
|
|
42
|
+
"directory": "../../dist/libs/components"
|
|
43
|
+
},
|
|
44
|
+
"gitHead": "d08f89d34ac56ff632db700f52c06931337c9ce8",
|
|
45
|
+
"module": "./src/index.js",
|
|
46
|
+
"type": "module"
|
|
47
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
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 { ReactComponent as MoreHorizOutlined } from '@material-design-icons/svg/outlined/more_horiz.svg';
|
|
8
|
+
import { isNull, isNumber } from 'lodash';
|
|
9
|
+
import { Fragment, cloneElement, useRef, useState } from 'react';
|
|
10
|
+
import { buttonProps } from './utils';
|
|
11
|
+
import { CLASSES } from './vars';
|
|
12
|
+
import { useComponentProps, useControlled, useStyled, useTranslation } from '../hooks';
|
|
13
|
+
import { Icon } from '../icon';
|
|
14
|
+
import { Input } from '../input';
|
|
15
|
+
import { Select } from '../select';
|
|
16
|
+
import { mergeCS } from '../utils';
|
|
17
|
+
export function Pagination(props) {
|
|
18
|
+
var _a;
|
|
19
|
+
const _b = useComponentProps('Pagination', props), { styleOverrides, styleProvider, total, active: activeProp, defaultActive, pageSize: pageSizeProp, defaultPageSize, pageSizeList = [10, 20, 50, 100], compose = ['pages'], customRender, mini = false, onChange } = _b, restProps = __rest(_b, ["styleOverrides", "styleProvider", "total", "active", "defaultActive", "pageSize", "defaultPageSize", "pageSizeList", "compose", "customRender", "mini", "onChange"]);
|
|
20
|
+
const styled = useStyled(CLASSES, { pagination: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.pagination }, styleOverrides);
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
const navRef = useRef(null);
|
|
23
|
+
const [active, _changeActive] = useControlled(defaultActive !== null && defaultActive !== void 0 ? defaultActive : 1, activeProp);
|
|
24
|
+
const changeActive = (val) => {
|
|
25
|
+
const newActive = Math.max(Math.min(val, lastPage), 1);
|
|
26
|
+
_changeActive(newActive);
|
|
27
|
+
if (!Object.is(newActive, active)) {
|
|
28
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newActive, pageSize);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const [pageSize, _changePageSize] = useControlled(defaultPageSize !== null && defaultPageSize !== void 0 ? defaultPageSize : pageSizeList[0], pageSizeProp);
|
|
32
|
+
const changePageSize = (val) => {
|
|
33
|
+
_changePageSize(val);
|
|
34
|
+
const lastPage = Math.max(Math.ceil(total / val), 1);
|
|
35
|
+
const newActive = Math.max(Math.min(active, lastPage), 1);
|
|
36
|
+
if (!Object.is(newActive, active) || !Object.is(val, pageSize)) {
|
|
37
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newActive, val);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const [jumpValue, setJumpValue] = useState(null);
|
|
41
|
+
const lastPage = Math.max(Math.ceil(total / pageSize), 1);
|
|
42
|
+
return (_jsx("nav", Object.assign({}, restProps, mergeCS(styled('pagination', {
|
|
43
|
+
'pagination--mini': mini,
|
|
44
|
+
}), {
|
|
45
|
+
className: restProps.className,
|
|
46
|
+
style: restProps.style,
|
|
47
|
+
}), { ref: navRef, role: "navigation", "aria-label": (_a = restProps['aria-label']) !== null && _a !== void 0 ? _a : 'Pagination Navigation', children: _jsx("div", Object.assign({}, styled('pagination__row'), { children: compose.map((item, index) => {
|
|
48
|
+
const gap = index === compose.length - 1 ? undefined : mini ? 2 : 6;
|
|
49
|
+
if (item === 'total') {
|
|
50
|
+
const totalNode = (() => {
|
|
51
|
+
const range = [Math.min((active - 1) * pageSize + 1, total), Math.min(active * pageSize, total)];
|
|
52
|
+
if (customRender && customRender.total) {
|
|
53
|
+
return customRender.total(range);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
return `${t('Pagination', 'Total')} ${total} ${t('Pagination', 'items')}`;
|
|
57
|
+
}
|
|
58
|
+
})();
|
|
59
|
+
return (_jsx("div", { children: _jsx("div", { style: { paddingRight: gap }, children: totalNode }) }, "total"));
|
|
60
|
+
}
|
|
61
|
+
if (item === 'pages') {
|
|
62
|
+
const [prevNode, pageNode, nextNode] = [
|
|
63
|
+
_jsx("li", Object.assign({}, styled('pagination__button', {
|
|
64
|
+
'pagination__button.is-disabled': active === 1,
|
|
65
|
+
'pagination__button--border': !(customRender && customRender.prev),
|
|
66
|
+
}), buttonProps(() => {
|
|
67
|
+
changeActive(active - 1);
|
|
68
|
+
}, active === 1), { title: t('Pagination', 'Previous page'), children: customRender && customRender.prev ? (customRender.prev) : (_jsx(Icon, { children: _jsx(KeyboardArrowLeftOutlined, {}) })) })),
|
|
69
|
+
(page) => {
|
|
70
|
+
if (customRender && customRender.page) {
|
|
71
|
+
return customRender.page(page);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return _jsx("div", { children: page });
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
_jsx("li", Object.assign({}, styled('pagination__button', {
|
|
78
|
+
'pagination__button.is-disabled': active === lastPage,
|
|
79
|
+
'pagination__button--border': !(customRender && customRender.next),
|
|
80
|
+
}), buttonProps(() => {
|
|
81
|
+
changeActive(active + 1);
|
|
82
|
+
}, active === lastPage), { title: t('Pagination', 'Next page'), children: customRender && customRender.next ? (customRender.next) : (_jsx(Icon, { children: _jsx(KeyboardArrowRightOutlined, {}) })) })),
|
|
83
|
+
];
|
|
84
|
+
let pages = [];
|
|
85
|
+
if (lastPage <= 7) {
|
|
86
|
+
pages = Array.from({ length: lastPage }).map((_, index) => index + 1);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
for (let n = -3; n <= 3; n++) {
|
|
90
|
+
pages.push(active + n);
|
|
91
|
+
}
|
|
92
|
+
if (pages[0] < 1) {
|
|
93
|
+
pages = pages.map((n) => n + (1 - pages[0]));
|
|
94
|
+
}
|
|
95
|
+
if (pages[6] > lastPage) {
|
|
96
|
+
pages = pages.map((n) => n - (pages[6] - lastPage));
|
|
97
|
+
}
|
|
98
|
+
if (pages[0] > 1) {
|
|
99
|
+
pages[0] = 1;
|
|
100
|
+
pages[1] = 'prev5';
|
|
101
|
+
}
|
|
102
|
+
if (pages[6] < lastPage) {
|
|
103
|
+
pages[6] = lastPage;
|
|
104
|
+
pages[5] = 'next5';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return (_jsxs(Fragment, { children: [_jsx("div", { children: prevNode }), pages.map((n) => {
|
|
108
|
+
if (n === 'prev5') {
|
|
109
|
+
return (_jsx("div", { children: _jsxs("li", Object.assign({}, styled('pagination__button', 'pagination__button--jump5'), buttonProps(() => {
|
|
110
|
+
changeActive(active - 5);
|
|
111
|
+
}), { title: t('Pagination', '5 pages forward'), children: [_jsx(Icon, Object.assign({}, styled('pagination__jump5-icon'), { children: _jsx(KeyboardDoubleArrowLeftOutlined, {}) })), _jsx("div", Object.assign({}, styled('pagination__ellipsis'), { children: _jsx(Icon, { children: _jsx(MoreHorizOutlined, {}) }) }))] })) }, "prev5"));
|
|
112
|
+
}
|
|
113
|
+
else if (n === 'next5') {
|
|
114
|
+
return (_jsx("div", { children: _jsxs("li", Object.assign({}, styled('pagination__button', 'pagination__button--jump5'), buttonProps(() => {
|
|
115
|
+
changeActive(active + 5);
|
|
116
|
+
}), { title: t('Pagination', '5 pages backward'), children: [_jsx(Icon, Object.assign({}, styled('pagination__jump5-icon'), { children: _jsx(KeyboardDoubleArrowRightOutlined, {}) })), _jsx("div", Object.assign({}, styled('pagination__ellipsis'), { children: _jsx(Icon, { children: _jsx(MoreHorizOutlined, {}) }) }))] })) }, "next5"));
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
return (_jsx("div", { children: _jsx("li", Object.assign({}, styled('pagination__button', 'pagination__button--border', 'pagination__button--number', {
|
|
120
|
+
'pagination__button.is-active': active === n,
|
|
121
|
+
}), { tabIndex: 0, "data-number": n, onClick: () => {
|
|
122
|
+
changeActive(n);
|
|
123
|
+
}, onKeyDown: (e) => {
|
|
124
|
+
const focusN = (num) => {
|
|
125
|
+
if (navRef.current) {
|
|
126
|
+
const activeEl = navRef.current.querySelector(`li[data-number="${num}"]`);
|
|
127
|
+
activeEl === null || activeEl === void 0 ? void 0 : activeEl.focus({ preventScroll: true });
|
|
128
|
+
}
|
|
129
|
+
changeActive(num);
|
|
130
|
+
};
|
|
131
|
+
switch (e.code) {
|
|
132
|
+
case 'ArrowLeft':
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
focusN(n - 1);
|
|
135
|
+
break;
|
|
136
|
+
case 'ArrowRight':
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
focusN(n + 1);
|
|
139
|
+
break;
|
|
140
|
+
case 'Home':
|
|
141
|
+
e.preventDefault();
|
|
142
|
+
focusN(1);
|
|
143
|
+
break;
|
|
144
|
+
case 'End':
|
|
145
|
+
e.preventDefault();
|
|
146
|
+
focusN(lastPage);
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}, children: pageNode(n) })) }, n));
|
|
152
|
+
}
|
|
153
|
+
}), _jsx("div", { children: _jsx("div", { style: { paddingRight: gap }, children: nextNode }) })] }, "pages"));
|
|
154
|
+
}
|
|
155
|
+
if (item === 'page-size') {
|
|
156
|
+
const list = pageSizeList.map((size) => ({
|
|
157
|
+
label: size.toString(),
|
|
158
|
+
value: size,
|
|
159
|
+
}));
|
|
160
|
+
return (_jsx("div", { children: _jsx("div", { style: { paddingRight: gap }, children: _jsx(Select, { list: list, model: pageSize, size: mini ? 'small' : undefined, customItem: (item) => (customRender && customRender.pageSize ? customRender.pageSize(item.value) : item.label), customSelected: (select) => `${select.label}${t('Pagination', ' / Page')}`, onModelChange: (value) => {
|
|
161
|
+
if (!isNull(value)) {
|
|
162
|
+
changePageSize(value);
|
|
163
|
+
}
|
|
164
|
+
} }) }) }, "page-size"));
|
|
165
|
+
}
|
|
166
|
+
if (item === 'jump') {
|
|
167
|
+
const jumpNode = (() => {
|
|
168
|
+
const jumpInput = (_jsx(Input.Number, { style: { width: mini ? 48 : 72 }, model: jumpValue, max: lastPage, min: 1, step: 1, size: mini ? 'small' : undefined, numberButton: !mini, inputRender: (el) => cloneElement(el, {
|
|
169
|
+
onKeyDown: (e) => {
|
|
170
|
+
var _a, _b;
|
|
171
|
+
(_b = (_a = el.props).onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
172
|
+
if (e.code === 'Enter') {
|
|
173
|
+
e.preventDefault();
|
|
174
|
+
if (isNumber(jumpValue)) {
|
|
175
|
+
changeActive(jumpValue);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
}), onModelChange: setJumpValue }));
|
|
180
|
+
if (customRender && customRender.jump) {
|
|
181
|
+
return customRender.jump(jumpInput);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
return (_jsxs("div", Object.assign({}, styled('pagination__jump'), { children: [_jsx("span", { children: t('Pagination', 'Go') }), jumpInput, _jsx("span", { children: t('Pagination', 'Page') })] })));
|
|
185
|
+
}
|
|
186
|
+
})();
|
|
187
|
+
return (_jsx("div", { children: _jsx("div", { style: { paddingRight: gap }, children: jumpNode }) }, "jump"));
|
|
188
|
+
}
|
|
189
|
+
return null;
|
|
190
|
+
}) })) })));
|
|
191
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Pagination } from './Pagination';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { BaseProps } from '../types';
|
|
4
|
+
export {};
|
|
5
|
+
export interface PaginationProps extends BaseProps<'pagination', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLElement>, 'children' | 'onChange'> {
|
|
6
|
+
total: number;
|
|
7
|
+
active?: number;
|
|
8
|
+
defaultActive?: number;
|
|
9
|
+
pageSize?: number;
|
|
10
|
+
defaultPageSize?: number;
|
|
11
|
+
pageSizeList?: number[];
|
|
12
|
+
compose?: ('total' | 'pages' | 'page-size' | 'jump')[];
|
|
13
|
+
customRender?: {
|
|
14
|
+
total?: (range: [number, number]) => React.ReactNode;
|
|
15
|
+
prev?: React.ReactNode;
|
|
16
|
+
page?: (page: number) => React.ReactNode;
|
|
17
|
+
next?: React.ReactNode;
|
|
18
|
+
pageSize?: (pageSize: number) => React.ReactNode;
|
|
19
|
+
jump?: (input: React.ReactNode) => React.ReactNode;
|
|
20
|
+
};
|
|
21
|
+
mini?: boolean;
|
|
22
|
+
onChange?: (page: number, pageSize: number) => void;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function buttonProps(handleClick, disabled = false) {
|
|
2
|
+
return {
|
|
3
|
+
tabIndex: disabled ? -1 : 0,
|
|
4
|
+
role: 'button',
|
|
5
|
+
'aria-disabled': disabled,
|
|
6
|
+
onKeyDown: (e) => {
|
|
7
|
+
if (e.code === 'Enter' || e.code === 'Space') {
|
|
8
|
+
e.preventDefault();
|
|
9
|
+
handleClick();
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
onClick: handleClick,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
pagination: string;
|
|
3
|
+
'pagination--mini': string;
|
|
4
|
+
pagination__row: string;
|
|
5
|
+
pagination__jump: string;
|
|
6
|
+
pagination__button: string;
|
|
7
|
+
'pagination__button.is-active': string;
|
|
8
|
+
'pagination__button.is-disabled': string;
|
|
9
|
+
'pagination__button--border': string;
|
|
10
|
+
'pagination__button--number': string;
|
|
11
|
+
'pagination__button--jump5': string;
|
|
12
|
+
'pagination__jump5-icon': string;
|
|
13
|
+
pagination__ellipsis: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
pagination: '^pagination',
|
|
3
|
+
'pagination--mini': '^pagination--mini',
|
|
4
|
+
pagination__row: '^pagination__row',
|
|
5
|
+
pagination__jump: '^pagination__jump',
|
|
6
|
+
pagination__button: '^pagination__button',
|
|
7
|
+
'pagination__button.is-active': 'is-active',
|
|
8
|
+
'pagination__button.is-disabled': 'is-disabled',
|
|
9
|
+
'pagination__button--border': '^pagination__button--border',
|
|
10
|
+
'pagination__button--number': '^pagination__button--number',
|
|
11
|
+
'pagination__button--jump5': '^pagination__button--jump5',
|
|
12
|
+
'pagination__jump5-icon': '^pagination__jump5-icon',
|
|
13
|
+
pagination__ellipsis: '^pagination__ellipsis',
|
|
14
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PopoverProps, PopoverRef } from './types';
|
|
3
|
+
import { PopoverFooter } from './PopoverFooter';
|
|
4
|
+
import { PopoverHeader } from './PopoverHeader';
|
|
5
|
+
export declare const Popover: {
|
|
6
|
+
(props: PopoverProps & React.RefAttributes<PopoverRef>): JSX.Element | null;
|
|
7
|
+
Header: typeof PopoverHeader;
|
|
8
|
+
Footer: typeof PopoverFooter;
|
|
9
|
+
};
|
|
@@ -0,0 +1,173 @@
|
|
|
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, isString, isUndefined } from 'lodash';
|
|
5
|
+
import { cloneElement, forwardRef, useId, useImperativeHandle, useRef, useState } from 'react';
|
|
6
|
+
import { PopoverFooter } from './PopoverFooter';
|
|
7
|
+
import { PopoverHeader } from './PopoverHeader';
|
|
8
|
+
import { CLASSES, TTANSITION_DURING } from './vars';
|
|
9
|
+
import { useComponentProps, useControlled, useLockScroll, useMaxIndex, useNamespace, useStyled } from '../hooks';
|
|
10
|
+
import { Popup } from '../internal/popup';
|
|
11
|
+
import { Portal } from '../internal/portal';
|
|
12
|
+
import { Transition } from '../internal/transition';
|
|
13
|
+
import { getPopupPosition, handleModalKeyDown, mergeCS } from '../utils';
|
|
14
|
+
function PopoverFC(props, ref) {
|
|
15
|
+
const _a = useComponentProps('Popover', props), { children, styleOverrides, styleProvider, content, header: headerProp, footer, visible: visibleProp, defaultVisible, trigger: triggerProp = 'hover', placement: placementProp = 'top', placementFixed = false, arrow = true, escClosable = true, gap = 10, inWindow = false, mouseEnterDelay = 150, mouseLeaveDelay = 200, modal = false, skipFirstTransition = true, destroyAfterClose = true, zIndex: zIndexProp, scrolling, onVisibleChange, afterVisibleChange } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "content", "header", "footer", "visible", "defaultVisible", "trigger", "placement", "placementFixed", "arrow", "escClosable", "gap", "inWindow", "mouseEnterDelay", "mouseLeaveDelay", "modal", "skipFirstTransition", "destroyAfterClose", "zIndex", "scrolling", "onVisibleChange", "afterVisibleChange"]);
|
|
16
|
+
const trigger = modal ? 'click' : triggerProp;
|
|
17
|
+
const namespace = useNamespace();
|
|
18
|
+
const styled = useStyled(CLASSES, { popover: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.popover }, styleOverrides);
|
|
19
|
+
const uniqueId = useId();
|
|
20
|
+
let triggerId;
|
|
21
|
+
const titleId = `${namespace}-popover-title-${uniqueId}`;
|
|
22
|
+
const bodyId = `${namespace}-popover-content-${uniqueId}`;
|
|
23
|
+
const triggerRef = useRefExtra(() => document.getElementById(triggerId));
|
|
24
|
+
const popoverRef = useRef(null);
|
|
25
|
+
const popupRef = useRef(null);
|
|
26
|
+
const scrollingRef = useRefExtra(scrolling);
|
|
27
|
+
const dataRef = useRef({
|
|
28
|
+
prevActiveEl: null,
|
|
29
|
+
});
|
|
30
|
+
const [visible, changeVisible] = useControlled(defaultVisible !== null && defaultVisible !== void 0 ? defaultVisible : false, visibleProp, onVisibleChange);
|
|
31
|
+
const maxZIndex = useMaxIndex(visible);
|
|
32
|
+
const zIndex = !isUndefined(zIndexProp) ? zIndexProp : `calc(var(--${namespace}-zindex-fixed) + ${maxZIndex})`;
|
|
33
|
+
const [popupPositionStyle, setPopupPositionStyle] = useState({
|
|
34
|
+
top: '-200vh',
|
|
35
|
+
left: '-200vw',
|
|
36
|
+
});
|
|
37
|
+
const [transformOrigin, setTransformOrigin] = useState();
|
|
38
|
+
const [placement, setPlacement] = useState(placementProp);
|
|
39
|
+
const updatePosition = useEventCallback(() => {
|
|
40
|
+
if (visible && triggerRef.current && popupRef.current) {
|
|
41
|
+
const position = getPopupPosition(triggerRef.current, { width: popupRef.current.offsetWidth, height: popupRef.current.offsetHeight }, {
|
|
42
|
+
placement: placementProp,
|
|
43
|
+
placementFallback: placement,
|
|
44
|
+
placementFixed,
|
|
45
|
+
gap,
|
|
46
|
+
inWindow,
|
|
47
|
+
});
|
|
48
|
+
setPopupPositionStyle({
|
|
49
|
+
top: position.top,
|
|
50
|
+
left: position.left,
|
|
51
|
+
});
|
|
52
|
+
setTransformOrigin(position.transformOrigin);
|
|
53
|
+
setPlacement(position.placement);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
useLockScroll(modal && visible);
|
|
57
|
+
useImperativeHandle(ref, () => ({
|
|
58
|
+
updatePosition,
|
|
59
|
+
}), [updatePosition]);
|
|
60
|
+
const headerNode = (() => {
|
|
61
|
+
if (headerProp) {
|
|
62
|
+
const node = isString(headerProp) ? _jsx(PopoverHeader, { children: headerProp }) : headerProp;
|
|
63
|
+
return cloneElement(node, {
|
|
64
|
+
_id: titleId,
|
|
65
|
+
_onClose: () => {
|
|
66
|
+
changeVisible(false);
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
})();
|
|
71
|
+
return (_jsx(Popup, { visible: visible, trigger: trigger, mouseEnterDelay: mouseEnterDelay, mouseLeaveDelay: mouseLeaveDelay, updatePosition: {
|
|
72
|
+
fn: updatePosition,
|
|
73
|
+
triggerRef,
|
|
74
|
+
popupRef,
|
|
75
|
+
containerRefs: [scrollingRef],
|
|
76
|
+
}, onVisibleChange: changeVisible, children: ({ renderTrigger, renderPopup }) => {
|
|
77
|
+
const render = (el) => {
|
|
78
|
+
var _a;
|
|
79
|
+
triggerId = (_a = el.props.id) !== null && _a !== void 0 ? _a : `${namespace}-popover-trigger-${uniqueId}`;
|
|
80
|
+
return renderTrigger(cloneElement(el, {
|
|
81
|
+
id: triggerId,
|
|
82
|
+
onKeyDown: (e) => {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
(_b = (_a = el.props).onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
85
|
+
if (visible) {
|
|
86
|
+
if (escClosable && e.code === 'Escape') {
|
|
87
|
+
e.stopPropagation();
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
changeVisible(false);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
}));
|
|
94
|
+
};
|
|
95
|
+
return (_jsxs(_Fragment, { children: [isFunction(children) ? children(render) : render(children), _jsx(Portal, { selector: () => {
|
|
96
|
+
let el = document.getElementById(`${namespace}-popover-root`);
|
|
97
|
+
if (!el) {
|
|
98
|
+
el = document.createElement('div');
|
|
99
|
+
el.id = `${namespace}-popover-root`;
|
|
100
|
+
document.body.appendChild(el);
|
|
101
|
+
}
|
|
102
|
+
return el;
|
|
103
|
+
}, children: _jsx(Transition, { enter: visible, during: TTANSITION_DURING, skipFirstTransition: skipFirstTransition, destroyWhenLeaved: destroyAfterClose, afterRender: updatePosition, afterEnter: () => {
|
|
104
|
+
afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(true);
|
|
105
|
+
if (modal) {
|
|
106
|
+
dataRef.current.prevActiveEl = document.activeElement;
|
|
107
|
+
if (popoverRef.current) {
|
|
108
|
+
popoverRef.current.focus({ preventScroll: true });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, afterLeave: () => {
|
|
112
|
+
afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(false);
|
|
113
|
+
if (modal) {
|
|
114
|
+
if (dataRef.current.prevActiveEl) {
|
|
115
|
+
dataRef.current.prevActiveEl.focus({ preventScroll: true });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, children: (state) => {
|
|
119
|
+
var _a;
|
|
120
|
+
let transitionStyle = {};
|
|
121
|
+
switch (state) {
|
|
122
|
+
case 'enter':
|
|
123
|
+
transitionStyle = { transform: 'scale(0.3)', opacity: 0 };
|
|
124
|
+
break;
|
|
125
|
+
case 'entering':
|
|
126
|
+
transitionStyle = {
|
|
127
|
+
transition: ['transform', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING.enter}ms ease-out`).join(', '),
|
|
128
|
+
transformOrigin,
|
|
129
|
+
};
|
|
130
|
+
break;
|
|
131
|
+
case 'leaving':
|
|
132
|
+
transitionStyle = {
|
|
133
|
+
transform: 'scale(0.3)',
|
|
134
|
+
opacity: 0,
|
|
135
|
+
transition: ['transform', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING.leave}ms ease-in`).join(', '),
|
|
136
|
+
transformOrigin,
|
|
137
|
+
};
|
|
138
|
+
break;
|
|
139
|
+
default:
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
return (_jsxs("div", Object.assign({}, restProps, mergeCS(styled('popover', `popover--${placement}`), {
|
|
143
|
+
className: restProps.className,
|
|
144
|
+
style: Object.assign(Object.assign({}, restProps.style), { zIndex, display: state === 'leaved' ? 'none' : undefined }),
|
|
145
|
+
}), { ref: popoverRef, tabIndex: -1, role: ((_a = restProps.role) !== null && _a !== void 0 ? _a : modal) ? 'alertdialog' : 'dialog', "aria-modal": modal, "aria-labelledby": headerNode ? titleId : undefined, "aria-describedby": bodyId, onKeyDown: (e) => {
|
|
146
|
+
var _a;
|
|
147
|
+
(_a = restProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
148
|
+
if (visible) {
|
|
149
|
+
if (escClosable && e.code === 'Escape') {
|
|
150
|
+
e.stopPropagation();
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
changeVisible(false);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (modal) {
|
|
156
|
+
handleModalKeyDown(e);
|
|
157
|
+
}
|
|
158
|
+
}, children: [modal && (_jsx("div", Object.assign({}, styled('popover__mask'), { onClick: () => {
|
|
159
|
+
changeVisible(false);
|
|
160
|
+
} }))), renderPopup(_jsxs("div", Object.assign({ ref: popupRef }, mergeCS(styled('popover__content'), {
|
|
161
|
+
style: Object.assign(Object.assign({}, popupPositionStyle), transitionStyle),
|
|
162
|
+
}), { children: [arrow && _jsx("div", Object.assign({}, styled('popover__arrow'))), headerNode, _jsx("div", Object.assign({}, styled('popover__body'), { id: bodyId, children: content })), footer &&
|
|
163
|
+
cloneElement(footer, {
|
|
164
|
+
_onClose: () => {
|
|
165
|
+
changeVisible(false);
|
|
166
|
+
},
|
|
167
|
+
})] })))] })));
|
|
168
|
+
} }) })] }));
|
|
169
|
+
} }));
|
|
170
|
+
}
|
|
171
|
+
export const Popover = forwardRef(PopoverFC);
|
|
172
|
+
Popover.Header = PopoverHeader;
|
|
173
|
+
Popover.Footer = PopoverFooter;
|
|
@@ -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 PopoverFooter(props) {
|
|
9
|
+
const _a = useComponentProps('PopoverFooter', 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, { popover: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.popover }, 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('popover__footer', `popover__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 PopoverHeader(props) {
|
|
11
|
+
const _a = useComponentProps('PopoverHeader', props), { styleOverrides, styleProvider, children, actions = [], closeProps: closePropsProp, onCloseClick, _id, _onClose } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "children", "actions", "closeProps", "onCloseClick", "_id", "_onClose"]);
|
|
12
|
+
const styled = useStyled(CLASSES, { popover: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.popover }, 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('popover__header'), {
|
|
31
|
+
className: restProps.className,
|
|
32
|
+
style: restProps.style,
|
|
33
|
+
}), { children: [_jsx("div", Object.assign({}, styled('popover__header-title'), { id: _id, children: children })), _jsx("div", Object.assign({}, styled('popover__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/popover/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Popover } from './Popover';
|