@laser-ui/components 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +71 -0
- package/accordion/Accordion.d.ts +3 -0
- package/accordion/Accordion.js +162 -0
- package/accordion/index.d.ts +2 -0
- package/accordion/index.js +1 -0
- package/accordion/types.d.ts +20 -0
- package/accordion/types.js +1 -0
- package/accordion/vars.d.ts +10 -0
- package/accordion/vars.js +10 -0
- package/affix/Affix.d.ts +3 -0
- package/affix/Affix.js +56 -0
- package/affix/index.d.ts +2 -0
- package/affix/index.js +1 -0
- package/affix/types.d.ts +14 -0
- package/affix/types.js +1 -0
- package/alert/Alert.d.ts +3 -0
- package/alert/Alert.js +53 -0
- package/alert/index.d.ts +2 -0
- package/alert/index.js +1 -0
- package/alert/types.d.ts +13 -0
- package/alert/types.js +1 -0
- package/alert/vars.d.ts +14 -0
- package/alert/vars.js +14 -0
- package/anchor/Anchor.d.ts +10 -0
- package/anchor/Anchor.js +112 -0
- package/anchor/index.d.ts +2 -0
- package/anchor/index.js +1 -0
- package/anchor/types.d.ts +23 -0
- package/anchor/types.js +1 -0
- package/anchor/vars.d.ts +11 -0
- package/anchor/vars.js +11 -0
- package/avatar/Avatar.d.ts +3 -0
- package/avatar/Avatar.js +43 -0
- package/avatar/index.d.ts +2 -0
- package/avatar/index.js +1 -0
- package/avatar/types.d.ts +11 -0
- package/avatar/types.js +1 -0
- package/avatar/vars.d.ts +9 -0
- package/avatar/vars.js +9 -0
- package/badge/Badge.d.ts +7 -0
- package/badge/Badge.js +61 -0
- package/badge/BadgeText.d.ts +2 -0
- package/badge/BadgeText.js +40 -0
- package/badge/index.d.ts +2 -0
- package/badge/index.js +1 -0
- package/badge/internal/BadgeNumber.d.ts +10 -0
- package/badge/internal/BadgeNumber.js +37 -0
- package/badge/types.d.ts +19 -0
- package/badge/types.js +1 -0
- package/badge/vars.d.ts +12 -0
- package/badge/vars.js +12 -0
- package/breadcrumb/Breadcrumb.d.ts +3 -0
- package/breadcrumb/Breadcrumb.js +22 -0
- package/breadcrumb/index.d.ts +2 -0
- package/breadcrumb/index.js +1 -0
- package/breadcrumb/types.d.ts +15 -0
- package/breadcrumb/types.js +1 -0
- package/breadcrumb/vars.d.ts +8 -0
- package/breadcrumb/vars.js +8 -0
- package/button/Button.d.ts +3 -0
- package/button/Button.js +50 -0
- package/button/index.d.ts +2 -0
- package/button/index.js +1 -0
- package/button/types.d.ts +14 -0
- package/button/types.js +1 -0
- package/button/vars.d.ts +23 -0
- package/button/vars.js +23 -0
- package/card/Card.d.ts +11 -0
- package/card/Card.js +30 -0
- package/card/CardAction.d.ts +3 -0
- package/card/CardAction.js +17 -0
- package/card/CardContent.d.ts +3 -0
- package/card/CardContent.js +13 -0
- package/card/CardHeader.d.ts +3 -0
- package/card/CardHeader.js +13 -0
- package/card/index.d.ts +2 -0
- package/card/index.js +1 -0
- package/card/types.d.ts +17 -0
- package/card/types.js +1 -0
- package/card/vars.d.ts +12 -0
- package/card/vars.js +12 -0
- package/cascader/Cascader.d.ts +5 -0
- package/cascader/Cascader.js +487 -0
- package/cascader/index.d.ts +2 -0
- package/cascader/index.js +1 -0
- package/cascader/internal/CascaderPanel.d.ts +23 -0
- package/cascader/internal/CascaderPanel.js +135 -0
- package/cascader/internal/CascaderSearchPanel.d.ts +22 -0
- package/cascader/internal/CascaderSearchPanel.js +73 -0
- package/cascader/internal/types.d.ts +8 -0
- package/cascader/internal/types.js +1 -0
- package/cascader/types.d.ts +49 -0
- package/cascader/types.js +1 -0
- package/cascader/vars.d.ts +32 -0
- package/cascader/vars.js +32 -0
- package/checkbox/Checkbox.d.ts +7 -0
- package/checkbox/Checkbox.js +25 -0
- package/checkbox/CheckboxGroup.d.ts +3 -0
- package/checkbox/CheckboxGroup.js +25 -0
- package/checkbox/index.d.ts +2 -0
- package/checkbox/index.js +1 -0
- package/checkbox/types.d.ts +29 -0
- package/checkbox/types.js +1 -0
- package/checkbox/vars.d.ts +11 -0
- package/checkbox/vars.js +11 -0
- package/compose/Compose.d.ts +7 -0
- package/compose/Compose.js +24 -0
- package/compose/ComposeItem.d.ts +3 -0
- package/compose/ComposeItem.js +18 -0
- package/compose/index.d.ts +2 -0
- package/compose/index.js +1 -0
- package/compose/types.d.ts +12 -0
- package/compose/types.js +1 -0
- package/compose/vars.d.ts +10 -0
- package/compose/vars.js +10 -0
- package/config-provider/ConfigProvider.d.ts +3 -0
- package/config-provider/ConfigProvider.js +14 -0
- package/config-provider/index.d.ts +2 -0
- package/config-provider/index.js +1 -0
- package/config-provider/types.d.ts +7 -0
- package/config-provider/types.js +1 -0
- package/context/index.d.ts +33 -0
- package/context/index.js +106 -0
- package/context/props.d.ts +134 -0
- package/context/props.js +1 -0
- package/date-picker/DatePicker.d.ts +3 -0
- package/date-picker/DatePicker.js +376 -0
- package/date-picker/index.d.ts +2 -0
- package/date-picker/index.js +1 -0
- package/date-picker/internal/DatePickerPanel.d.ts +15 -0
- package/date-picker/internal/DatePickerPanel.js +104 -0
- package/date-picker/types.d.ts +37 -0
- package/date-picker/types.js +1 -0
- package/date-picker/vars.d.ts +36 -0
- package/date-picker/vars.js +36 -0
- package/dayjs.d.ts +3 -0
- package/dayjs.js +11 -0
- package/drawer/Drawer.d.ts +9 -0
- package/drawer/Drawer.js +141 -0
- package/drawer/DrawerFooter.d.ts +3 -0
- package/drawer/DrawerFooter.js +51 -0
- package/drawer/DrawerHeader.d.ts +3 -0
- package/drawer/DrawerHeader.js +37 -0
- package/drawer/index.d.ts +2 -0
- package/drawer/index.js +1 -0
- package/drawer/types.d.ts +36 -0
- package/drawer/types.js +1 -0
- package/drawer/vars.d.ts +21 -0
- package/drawer/vars.js +18 -0
- package/dropdown/Dropdown.d.ts +5 -0
- package/dropdown/Dropdown.js +376 -0
- package/dropdown/index.d.ts +2 -0
- package/dropdown/index.js +1 -0
- package/dropdown/internal/DropdownGroup.d.ts +13 -0
- package/dropdown/internal/DropdownGroup.js +8 -0
- package/dropdown/internal/DropdownItem.d.ts +16 -0
- package/dropdown/internal/DropdownItem.js +9 -0
- package/dropdown/internal/DropdownSub.d.ts +22 -0
- package/dropdown/internal/DropdownSub.js +78 -0
- package/dropdown/types.d.ts +31 -0
- package/dropdown/types.js +1 -0
- package/dropdown/utils.d.ts +4 -0
- package/dropdown/utils.js +18 -0
- package/dropdown/vars.d.ts +23 -0
- package/dropdown/vars.js +23 -0
- package/empty/Empty.d.ts +7 -0
- package/empty/Empty.js +18 -0
- package/empty/index.d.ts +2 -0
- package/empty/index.js +1 -0
- package/empty/types.d.ts +8 -0
- package/empty/types.js +1 -0
- package/empty/vars.d.ts +7 -0
- package/empty/vars.js +7 -0
- package/fab/Fab.d.ts +9 -0
- package/fab/Fab.js +31 -0
- package/fab/FabBacktop.d.ts +3 -0
- package/fab/FabBacktop.js +58 -0
- package/fab/FabButton.d.ts +3 -0
- package/fab/FabButton.js +23 -0
- package/fab/index.d.ts +2 -0
- package/fab/index.js +1 -0
- package/fab/types.d.ts +26 -0
- package/fab/types.js +1 -0
- package/fab/vars.d.ts +28 -0
- package/fab/vars.js +28 -0
- package/form/Form.d.ts +7 -0
- package/form/Form.js +34 -0
- package/form/FormItem.d.ts +5 -0
- package/form/FormItem.js +201 -0
- package/form/hooks.d.ts +5 -0
- package/form/hooks.js +18 -0
- package/form/index.d.ts +8 -0
- package/form/index.js +7 -0
- package/form/internal/FormError.d.ts +12 -0
- package/form/internal/FormError.js +24 -0
- package/form/model/abstract-control.d.ts +67 -0
- package/form/model/abstract-control.js +335 -0
- package/form/model/form-control.d.ts +23 -0
- package/form/model/form-control.js +72 -0
- package/form/model/form-group.d.ts +62 -0
- package/form/model/form-group.js +165 -0
- package/form/model/types.d.ts +8 -0
- package/form/model/types.js +1 -0
- package/form/model/validators.d.ts +11 -0
- package/form/model/validators.js +83 -0
- package/form/model/vars.d.ts +1 -0
- package/form/model/vars.js +1 -0
- package/form/types.d.ts +63 -0
- package/form/types.js +1 -0
- package/form/vars.d.ts +27 -0
- package/form/vars.js +25 -0
- package/hooks/index.d.ts +14 -0
- package/hooks/index.js +14 -0
- package/hooks/useComponentProps.d.ts +2 -0
- package/hooks/useComponentProps.js +15 -0
- package/hooks/useControlled.d.ts +3 -0
- package/hooks/useControlled.js +26 -0
- package/hooks/useDesign.d.ts +12 -0
- package/hooks/useDesign.js +8 -0
- package/hooks/useFocusVisible.d.ts +2 -0
- package/hooks/useFocusVisible.js +38 -0
- package/hooks/useLayout.d.ts +5 -0
- package/hooks/useLayout.js +10 -0
- package/hooks/useListenGlobalScrolling.d.ts +1 -0
- package/hooks/useListenGlobalScrolling.js +9 -0
- package/hooks/useLockScroll.d.ts +1 -0
- package/hooks/useLockScroll.js +24 -0
- package/hooks/useMaxIndex.d.ts +1 -0
- package/hooks/useMaxIndex.js +32 -0
- package/hooks/useNamespace.d.ts +1 -0
- package/hooks/useNamespace.js +6 -0
- package/hooks/useNestedPopup.d.ts +13 -0
- package/hooks/useNestedPopup.js +37 -0
- package/hooks/useNextTick.d.ts +2 -0
- package/hooks/useNextTick.js +9 -0
- package/hooks/useScopedProps.d.ts +8 -0
- package/hooks/useScopedProps.js +7 -0
- package/hooks/useStyled.d.ts +20 -0
- package/hooks/useStyled.js +82 -0
- package/hooks/useTranslation.d.ts +4 -0
- package/hooks/useTranslation.js +17 -0
- package/icon/Icon.d.ts +3 -0
- package/icon/Icon.js +18 -0
- package/icon/index.d.ts +2 -0
- package/icon/index.js +1 -0
- package/icon/types.d.ts +12 -0
- package/icon/types.js +1 -0
- package/icon/vars.d.ts +7 -0
- package/icon/vars.js +7 -0
- package/image/Image.d.ts +9 -0
- package/image/Image.js +50 -0
- package/image/ImageAction.d.ts +3 -0
- package/image/ImageAction.js +15 -0
- package/image/ImagePreview.d.ts +3 -0
- package/image/ImagePreview.js +261 -0
- package/image/index.d.ts +2 -0
- package/image/index.js +1 -0
- package/image/types.d.ts +24 -0
- package/image/types.js +1 -0
- package/image/vars.d.ts +26 -0
- package/image/vars.js +26 -0
- package/index.d.ts +52 -0
- package/index.js +52 -0
- package/input/Input.d.ts +7 -0
- package/input/Input.js +56 -0
- package/input/InputNumber.d.ts +2 -0
- package/input/InputNumber.js +142 -0
- package/input/index.d.ts +2 -0
- package/input/index.js +1 -0
- package/input/types.d.ts +44 -0
- package/input/types.js +1 -0
- package/input/vars.d.ts +14 -0
- package/input/vars.js +14 -0
- package/internal/circular-progress/CircularProgress.d.ts +2 -0
- package/internal/circular-progress/CircularProgress.js +11 -0
- package/internal/circular-progress/index.d.ts +1 -0
- package/internal/circular-progress/index.js +1 -0
- package/internal/circular-progress/vars.d.ts +4 -0
- package/internal/circular-progress/vars.js +4 -0
- package/internal/mask/Mask.d.ts +3 -0
- package/internal/mask/Mask.js +36 -0
- package/internal/mask/index.d.ts +2 -0
- package/internal/mask/index.js +1 -0
- package/internal/mask/types.d.ts +7 -0
- package/internal/mask/types.js +1 -0
- package/internal/mask/vars.d.ts +3 -0
- package/internal/mask/vars.js +3 -0
- package/internal/popup/Popup.d.ts +3 -0
- package/internal/popup/Popup.js +132 -0
- package/internal/popup/index.d.ts +2 -0
- package/internal/popup/index.js +1 -0
- package/internal/popup/types.d.ts +21 -0
- package/internal/popup/types.js +1 -0
- package/internal/portal/Portal.d.ts +3 -0
- package/internal/portal/Portal.js +14 -0
- package/internal/portal/index.d.ts +2 -0
- package/internal/portal/index.js +1 -0
- package/internal/portal/types.d.ts +6 -0
- package/internal/portal/types.js +1 -0
- package/internal/transition/CollapseTransition.d.ts +3 -0
- package/internal/transition/CollapseTransition.js +101 -0
- package/internal/transition/Transition.d.ts +3 -0
- package/internal/transition/Transition.js +87 -0
- package/internal/transition/index.d.ts +3 -0
- package/internal/transition/index.js +2 -0
- package/internal/transition/types.d.ts +33 -0
- package/internal/transition/types.js +1 -0
- package/internal/wave/Wave.d.ts +3 -0
- package/internal/wave/Wave.js +25 -0
- package/internal/wave/index.d.ts +2 -0
- package/internal/wave/index.js +1 -0
- package/internal/wave/types.d.ts +6 -0
- package/internal/wave/types.js +1 -0
- package/internal/wave/vars.d.ts +3 -0
- package/internal/wave/vars.js +3 -0
- package/menu/Menu.d.ts +5 -0
- package/menu/Menu.js +386 -0
- package/menu/index.d.ts +2 -0
- package/menu/index.js +1 -0
- package/menu/internal/MenuGroup.d.ts +15 -0
- package/menu/internal/MenuGroup.js +8 -0
- package/menu/internal/MenuItem.d.ts +23 -0
- package/menu/internal/MenuItem.js +18 -0
- package/menu/internal/MenuSub.d.ts +31 -0
- package/menu/internal/MenuSub.js +129 -0
- package/menu/types.d.ts +30 -0
- package/menu/types.js +1 -0
- package/menu/utils.d.ts +4 -0
- package/menu/utils.js +18 -0
- package/menu/vars.d.ts +28 -0
- package/menu/vars.js +28 -0
- package/modal/Modal.d.ts +11 -0
- package/modal/Modal.js +127 -0
- package/modal/ModalAlert.d.ts +3 -0
- package/modal/ModalAlert.js +19 -0
- package/modal/ModalFooter.d.ts +3 -0
- package/modal/ModalFooter.js +51 -0
- package/modal/ModalHeader.d.ts +3 -0
- package/modal/ModalHeader.js +37 -0
- package/modal/index.d.ts +2 -0
- package/modal/index.js +1 -0
- package/modal/types.d.ts +39 -0
- package/modal/types.js +1 -0
- package/modal/vars.d.ts +23 -0
- package/modal/vars.js +23 -0
- package/notification/Notification.d.ts +3 -0
- package/notification/Notification.js +129 -0
- package/notification/index.d.ts +2 -0
- package/notification/index.js +1 -0
- package/notification/types.d.ts +18 -0
- package/notification/types.js +1 -0
- package/notification/vars.d.ts +17 -0
- package/notification/vars.js +14 -0
- package/package.json +47 -0
- package/pagination/Pagination.d.ts +3 -0
- package/pagination/Pagination.js +191 -0
- package/pagination/index.d.ts +2 -0
- package/pagination/index.js +1 -0
- package/pagination/types.d.ts +23 -0
- package/pagination/types.js +1 -0
- package/pagination/utils.d.ts +2 -0
- package/pagination/utils.js +14 -0
- package/pagination/vars.d.ts +14 -0
- package/pagination/vars.js +14 -0
- package/popover/Popover.d.ts +9 -0
- package/popover/Popover.js +173 -0
- package/popover/PopoverFooter.d.ts +3 -0
- package/popover/PopoverFooter.js +51 -0
- package/popover/PopoverHeader.d.ts +3 -0
- package/popover/PopoverHeader.js +37 -0
- package/popover/index.d.ts +2 -0
- package/popover/index.js +1 -0
- package/popover/types.d.ts +46 -0
- package/popover/types.js +1 -0
- package/popover/vars.d.ts +30 -0
- package/popover/vars.js +27 -0
- package/progress/Progress.d.ts +3 -0
- package/progress/Progress.js +45 -0
- package/progress/index.d.ts +2 -0
- package/progress/index.js +1 -0
- package/progress/types.d.ts +19 -0
- package/progress/types.js +1 -0
- package/progress/vars.d.ts +15 -0
- package/progress/vars.js +15 -0
- package/radio/Radio.d.ts +7 -0
- package/radio/Radio.js +38 -0
- package/radio/RadioGroup.d.ts +3 -0
- package/radio/RadioGroup.js +21 -0
- package/radio/index.d.ts +2 -0
- package/radio/index.js +1 -0
- package/radio/types.d.ts +31 -0
- package/radio/types.js +1 -0
- package/radio/vars.d.ts +14 -0
- package/radio/vars.js +14 -0
- package/rating/Rating.d.ts +3 -0
- package/rating/Rating.js +34 -0
- package/rating/index.d.ts +2 -0
- package/rating/index.js +1 -0
- package/rating/internal/RatingStar.d.ts +19 -0
- package/rating/internal/RatingStar.js +37 -0
- package/rating/types.d.ts +18 -0
- package/rating/types.js +1 -0
- package/rating/vars.d.ts +11 -0
- package/rating/vars.js +11 -0
- package/resources.json +128 -0
- package/root/Root.d.ts +3 -0
- package/root/Root.js +85 -0
- package/root/dialog-service.d.ts +12 -0
- package/root/dialog-service.js +62 -0
- package/root/index.d.ts +3 -0
- package/root/index.js +2 -0
- package/root/types.d.ts +16 -0
- package/root/types.js +1 -0
- package/root/vars.d.ts +25 -0
- package/root/vars.js +13 -0
- package/select/Select.d.ts +5 -0
- package/select/Select.js +528 -0
- package/select/index.d.ts +2 -0
- package/select/index.js +1 -0
- package/select/types.d.ts +50 -0
- package/select/types.js +1 -0
- package/select/vars.d.ts +31 -0
- package/select/vars.js +31 -0
- package/separator/Separator.d.ts +3 -0
- package/separator/Separator.js +19 -0
- package/separator/index.d.ts +2 -0
- package/separator/index.js +1 -0
- package/separator/types.d.ts +8 -0
- package/separator/types.js +1 -0
- package/separator/vars.d.ts +9 -0
- package/separator/vars.js +9 -0
- package/skeleton/Skeleton.d.ts +3 -0
- package/skeleton/Skeleton.js +13 -0
- package/skeleton/index.d.ts +2 -0
- package/skeleton/index.js +1 -0
- package/skeleton/types.d.ts +7 -0
- package/skeleton/types.js +1 -0
- package/skeleton/vars.d.ts +6 -0
- package/skeleton/vars.js +6 -0
- package/slider/Slider.d.ts +3 -0
- package/slider/Slider.js +324 -0
- package/slider/index.d.ts +2 -0
- package/slider/index.js +1 -0
- package/slider/types.d.ts +28 -0
- package/slider/types.js +1 -0
- package/slider/vars.d.ts +17 -0
- package/slider/vars.js +17 -0
- package/slides/Slides.d.ts +3 -0
- package/slides/Slides.js +277 -0
- package/slides/index.d.ts +2 -0
- package/slides/index.js +1 -0
- package/slides/types.d.ts +29 -0
- package/slides/types.js +1 -0
- package/slides/vars.d.ts +20 -0
- package/slides/vars.js +20 -0
- package/spinner/Spinner.d.ts +3 -0
- package/spinner/Spinner.js +66 -0
- package/spinner/index.d.ts +2 -0
- package/spinner/index.js +1 -0
- package/spinner/types.d.ts +12 -0
- package/spinner/types.js +1 -0
- package/spinner/vars.d.ts +7 -0
- package/spinner/vars.js +7 -0
- package/stepper/Stepper.d.ts +3 -0
- package/stepper/Stepper.js +87 -0
- package/stepper/index.d.ts +2 -0
- package/stepper/index.js +1 -0
- package/stepper/types.d.ts +22 -0
- package/stepper/types.js +1 -0
- package/stepper/vars.d.ts +19 -0
- package/stepper/vars.js +19 -0
- package/switch/Switch.d.ts +2 -0
- package/switch/Switch.js +48 -0
- package/switch/index.d.ts +2 -0
- package/switch/index.js +1 -0
- package/switch/types.d.ts +18 -0
- package/switch/types.js +1 -0
- package/switch/vars.d.ts +17 -0
- package/switch/vars.js +17 -0
- package/table/Table.d.ts +17 -0
- package/table/Table.js +72 -0
- package/table/TableEmpty.d.ts +3 -0
- package/table/TableEmpty.js +37 -0
- package/table/TableExpand.d.ts +3 -0
- package/table/TableExpand.js +20 -0
- package/table/TableFilter.d.ts +3 -0
- package/table/TableFilter.js +22 -0
- package/table/TableTd.d.ts +3 -0
- package/table/TableTd.js +11 -0
- package/table/TableTh.d.ts +3 -0
- package/table/TableTh.js +33 -0
- package/table/TableThAction.d.ts +3 -0
- package/table/TableThAction.js +18 -0
- package/table/index.d.ts +2 -0
- package/table/index.js +1 -0
- package/table/internal/TableCell.d.ts +19 -0
- package/table/internal/TableCell.js +61 -0
- package/table/types.d.ts +73 -0
- package/table/types.js +1 -0
- package/table/vars.d.ts +29 -0
- package/table/vars.js +28 -0
- package/tabs/Tabs.d.ts +5 -0
- package/tabs/Tabs.js +248 -0
- package/tabs/index.d.ts +2 -0
- package/tabs/index.js +1 -0
- package/tabs/types.d.ts +28 -0
- package/tabs/types.js +1 -0
- package/tabs/vars.d.ts +30 -0
- package/tabs/vars.js +30 -0
- package/tag/Tag.d.ts +3 -0
- package/tag/Tag.js +16 -0
- package/tag/index.d.ts +2 -0
- package/tag/index.js +1 -0
- package/tag/types.d.ts +9 -0
- package/tag/types.js +1 -0
- package/tag/vars.d.ts +13 -0
- package/tag/vars.js +13 -0
- package/textarea/Textarea.d.ts +3 -0
- package/textarea/Textarea.js +72 -0
- package/textarea/index.d.ts +2 -0
- package/textarea/index.js +1 -0
- package/textarea/types.d.ts +18 -0
- package/textarea/types.js +1 -0
- package/textarea/vars.d.ts +7 -0
- package/textarea/vars.js +7 -0
- package/time-picker/TimePicker.d.ts +3 -0
- package/time-picker/TimePicker.js +338 -0
- package/time-picker/index.d.ts +2 -0
- package/time-picker/index.js +1 -0
- package/time-picker/internal/TimePickerPanel.d.ts +16 -0
- package/time-picker/internal/TimePickerPanel.js +138 -0
- package/time-picker/types.d.ts +33 -0
- package/time-picker/types.js +1 -0
- package/time-picker/utils.d.ts +4 -0
- package/time-picker/utils.js +26 -0
- package/time-picker/vars.d.ts +20 -0
- package/time-picker/vars.js +20 -0
- package/timeline/Timeline.d.ts +3 -0
- package/timeline/Timeline.js +53 -0
- package/timeline/index.d.ts +2 -0
- package/timeline/index.js +1 -0
- package/timeline/types.d.ts +15 -0
- package/timeline/types.js +1 -0
- package/timeline/vars.d.ts +19 -0
- package/timeline/vars.js +19 -0
- package/toast/Toast.d.ts +3 -0
- package/toast/Toast.js +123 -0
- package/toast/index.d.ts +2 -0
- package/toast/index.js +1 -0
- package/toast/types.d.ts +17 -0
- package/toast/types.js +1 -0
- package/toast/vars.d.ts +14 -0
- package/toast/vars.js +11 -0
- package/tooltip/Tooltip.d.ts +3 -0
- package/tooltip/Tooltip.js +113 -0
- package/tooltip/index.d.ts +2 -0
- package/tooltip/index.js +1 -0
- package/tooltip/types.d.ts +29 -0
- package/tooltip/types.js +1 -0
- package/tooltip/vars.d.ts +20 -0
- package/tooltip/vars.js +17 -0
- package/transfer/Transfer.d.ts +3 -0
- package/transfer/Transfer.js +156 -0
- package/transfer/index.d.ts +2 -0
- package/transfer/index.js +1 -0
- package/transfer/internal/TransferPanel.d.ts +21 -0
- package/transfer/internal/TransferPanel.js +42 -0
- package/transfer/types.d.ts +34 -0
- package/transfer/types.js +1 -0
- package/transfer/vars.d.ts +17 -0
- package/transfer/vars.js +17 -0
- package/tree/Tree.d.ts +3 -0
- package/tree/Tree.js +165 -0
- package/tree/index.d.ts +2 -0
- package/tree/index.js +1 -0
- package/tree/internal/TreePanel.d.ts +32 -0
- package/tree/internal/TreePanel.js +167 -0
- package/tree/node/abstract-node.d.ts +25 -0
- package/tree/node/abstract-node.js +68 -0
- package/tree/node/multiple-node.d.ts +18 -0
- package/tree/node/multiple-node.js +109 -0
- package/tree/node/single-node.d.ts +16 -0
- package/tree/node/single-node.js +60 -0
- package/tree/node/types.d.ts +6 -0
- package/tree/node/types.js +1 -0
- package/tree/node/vars.d.ts +2 -0
- package/tree/node/vars.js +1 -0
- package/tree/types.d.ts +34 -0
- package/tree/types.js +1 -0
- package/tree/utils.d.ts +6 -0
- package/tree/utils.js +9 -0
- package/tree/vars.d.ts +20 -0
- package/tree/vars.js +20 -0
- package/tree-select/TreeSelect.d.ts +6 -0
- package/tree-select/TreeSelect.js +509 -0
- package/tree-select/index.d.ts +2 -0
- package/tree-select/index.js +1 -0
- package/tree-select/internal/TreeSelectSearchPanel.d.ts +22 -0
- package/tree-select/internal/TreeSelectSearchPanel.js +73 -0
- package/tree-select/internal/types.d.ts +8 -0
- package/tree-select/internal/types.js +1 -0
- package/tree-select/types.d.ts +48 -0
- package/tree-select/types.js +1 -0
- package/tree-select/vars.d.ts +37 -0
- package/tree-select/vars.js +37 -0
- package/types.d.ts +21 -0
- package/types.js +1 -0
- package/upload/Upload.d.ts +19 -0
- package/upload/Upload.js +203 -0
- package/upload/UploadAction.d.ts +3 -0
- package/upload/UploadAction.js +44 -0
- package/upload/UploadButton.d.ts +3 -0
- package/upload/UploadButton.js +31 -0
- package/upload/UploadList.d.ts +3 -0
- package/upload/UploadList.js +62 -0
- package/upload/UploadPicture.d.ts +3 -0
- package/upload/UploadPicture.js +72 -0
- package/upload/UploadPictureList.d.ts +3 -0
- package/upload/UploadPictureList.js +62 -0
- package/upload/UploadPreviewAction.d.ts +3 -0
- package/upload/UploadPreviewAction.js +32 -0
- package/upload/index.d.ts +2 -0
- package/upload/index.js +1 -0
- package/upload/types.d.ts +78 -0
- package/upload/types.js +1 -0
- package/upload/vars.d.ts +65 -0
- package/upload/vars.js +65 -0
- package/utils/handleModalKeyDown.d.ts +2 -0
- package/utils/handleModalKeyDown.js +17 -0
- package/utils/index.d.ts +6 -0
- package/utils/index.js +6 -0
- package/utils/isPrintableCharacter.d.ts +1 -0
- package/utils/isPrintableCharacter.js +3 -0
- package/utils/mergeCS.d.ts +11 -0
- package/utils/mergeCS.js +6 -0
- package/utils/position/getHorizontalSidePosition.d.ts +14 -0
- package/utils/position/getHorizontalSidePosition.js +22 -0
- package/utils/position/getPopupPosition.d.ts +18 -0
- package/utils/position/getPopupPosition.js +170 -0
- package/utils/position/getVerticalSidePosition.d.ts +17 -0
- package/utils/position/getVerticalSidePosition.js +43 -0
- package/vars.d.ts +5 -0
- package/vars.js +5 -0
- package/virtual-scroll/VirtualScroll.d.ts +5 -0
- package/virtual-scroll/VirtualScroll.js +430 -0
- package/virtual-scroll/index.d.ts +2 -0
- package/virtual-scroll/index.js +1 -0
- package/virtual-scroll/types.d.ts +34 -0
- package/virtual-scroll/types.js +1 -0
- package/virtual-scroll/vars.d.ts +1 -0
- package/virtual-scroll/vars.js +1 -0
package/anchor/Anchor.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEvent, useEventCallback, useIsomorphicLayoutEffect, useRefExtra, useResize } from '@laser-ui/hooks';
|
|
4
|
+
import { getOffsetToRoot, scrollTo, toPx } from '@laser-ui/utils';
|
|
5
|
+
import { isArray, isString, isUndefined } from 'lodash';
|
|
6
|
+
import { Fragment, forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
7
|
+
import { CLASSES, DOT_INDICATOR, LINE_INDICATOR } from './vars';
|
|
8
|
+
import { useComponentProps, useLayout, useListenGlobalScrolling, useStyled } from '../hooks';
|
|
9
|
+
import { mergeCS } from '../utils';
|
|
10
|
+
function AnchorFC(props, ref) {
|
|
11
|
+
const _a = useComponentProps('Anchor', props), { styleOverrides, styleProvider, list, page, distance: distanceProp = 0, scrollBehavior = 'instant', indicator = DOT_INDICATOR, onClick } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "list", "page", "distance", "scrollBehavior", "indicator", "onClick"]);
|
|
12
|
+
const styled = useStyled(CLASSES, { anchor: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.anchor }, styleOverrides);
|
|
13
|
+
const { pageScrollRef, contentResizeRef } = useLayout();
|
|
14
|
+
const anchorRef = useRef(null);
|
|
15
|
+
const indicatorRef = useRef(null);
|
|
16
|
+
const activeLinkRef = useRef(null);
|
|
17
|
+
const pageRef = useRefExtra(page !== null && page !== void 0 ? page : (() => pageScrollRef.current));
|
|
18
|
+
const dataRef = useRef({});
|
|
19
|
+
const [active, setActive] = useState(null);
|
|
20
|
+
const updateAnchor = useEventCallback(() => {
|
|
21
|
+
if (pageRef.current) {
|
|
22
|
+
const pageTop = getOffsetToRoot(pageRef.current);
|
|
23
|
+
let nearestEl;
|
|
24
|
+
const reduceLinks = (arr) => {
|
|
25
|
+
arr.forEach(({ href, children }) => {
|
|
26
|
+
const el = document.getElementById(href);
|
|
27
|
+
if (el && pageRef.current) {
|
|
28
|
+
const top = getOffsetToRoot(el);
|
|
29
|
+
const distance = isString(distanceProp) ? toPx(distanceProp, true) : distanceProp;
|
|
30
|
+
if (Math.ceil(pageRef.current.scrollTop) + distance >= top - pageTop) {
|
|
31
|
+
if (isUndefined(nearestEl)) {
|
|
32
|
+
nearestEl = [href, top];
|
|
33
|
+
}
|
|
34
|
+
else if (top > nearestEl[1]) {
|
|
35
|
+
nearestEl = [href, top];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (isArray(children)) {
|
|
40
|
+
reduceLinks(children);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
reduceLinks(list);
|
|
45
|
+
const href = nearestEl ? nearestEl[0] : null;
|
|
46
|
+
setActive(href);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
useIsomorphicLayoutEffect(() => {
|
|
50
|
+
updateAnchor();
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
}, []);
|
|
53
|
+
const listenGlobalScrolling = useListenGlobalScrolling(updateAnchor);
|
|
54
|
+
useEvent(pageRef, 'scroll', updateAnchor, { passive: true }, listenGlobalScrolling);
|
|
55
|
+
useResize(contentResizeRef, updateAnchor);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (anchorRef.current && indicatorRef.current) {
|
|
58
|
+
if (activeLinkRef.current) {
|
|
59
|
+
const rect = activeLinkRef.current.getBoundingClientRect();
|
|
60
|
+
const top = rect.top - anchorRef.current.getBoundingClientRect().top + rect.height / 2;
|
|
61
|
+
indicatorRef.current.style.cssText = `opacity:1;top:${top}px;`;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
indicatorRef.current.style.cssText += 'opacity:0;';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
useImperativeHandle(ref, () => ({
|
|
69
|
+
active,
|
|
70
|
+
updateAnchor,
|
|
71
|
+
}), [active, updateAnchor]);
|
|
72
|
+
const handleLinkClick = (href) => {
|
|
73
|
+
var _a, _b;
|
|
74
|
+
if (pageRef.current) {
|
|
75
|
+
const pageTop = getOffsetToRoot(pageRef.current);
|
|
76
|
+
const scrollTop = pageRef.current.scrollTop;
|
|
77
|
+
window.location.hash = `#${href}`;
|
|
78
|
+
pageRef.current.scrollTop = scrollTop;
|
|
79
|
+
const el = document.getElementById(href);
|
|
80
|
+
if (el) {
|
|
81
|
+
const top = getOffsetToRoot(el);
|
|
82
|
+
const distance = isString(distanceProp) ? toPx(distanceProp, true) : distanceProp;
|
|
83
|
+
(_b = (_a = dataRef.current).clearTid) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
84
|
+
dataRef.current.clearTid = scrollTo(pageRef.current, {
|
|
85
|
+
top: top - pageTop - distance,
|
|
86
|
+
behavior: scrollBehavior,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const linkNodes = (() => {
|
|
92
|
+
const getNodes = (arr, level = 0) => arr.map((link) => {
|
|
93
|
+
const { title: linkTitle, href: linkHref, target: linkTarget, children } = link;
|
|
94
|
+
const isActive = linkHref === active;
|
|
95
|
+
return (_jsxs(Fragment, { children: [_jsx("li", Object.assign({}, styled('anchor__link', {
|
|
96
|
+
'anchor__link.is-active': isActive,
|
|
97
|
+
}), { ref: isActive ? activeLinkRef : undefined, children: _jsx("a", { style: { paddingLeft: 16 + level * 16 }, href: `#${linkHref}`, target: linkTarget, onClick: (e) => {
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
handleLinkClick(linkHref);
|
|
100
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(linkHref, link);
|
|
101
|
+
}, children: linkTitle !== null && linkTitle !== void 0 ? linkTitle : linkHref }) })), children && getNodes(children, level + 1)] }, `${linkHref}-${level}`));
|
|
102
|
+
});
|
|
103
|
+
return getNodes(list);
|
|
104
|
+
})();
|
|
105
|
+
return (_jsxs("ul", Object.assign({}, restProps, mergeCS(styled('anchor'), {
|
|
106
|
+
className: restProps.className,
|
|
107
|
+
style: restProps.style,
|
|
108
|
+
}), { ref: anchorRef, children: [_jsx("div", Object.assign({}, styled('anchor__indicator-track'), { children: _jsx("div", Object.assign({}, styled('anchor__indicator-wrapper'), { ref: indicatorRef, children: indicator === DOT_INDICATOR ? (_jsx("div", Object.assign({}, styled('anchor__dot-indicator')))) : indicator === LINE_INDICATOR ? (_jsx("div", Object.assign({}, styled('anchor__line-indicator')))) : (indicator) })) })), linkNodes] })));
|
|
109
|
+
}
|
|
110
|
+
export const Anchor = forwardRef(AnchorFC);
|
|
111
|
+
Anchor.DOT_INDICATOR = DOT_INDICATOR;
|
|
112
|
+
Anchor.LINE_INDICATOR = LINE_INDICATOR;
|
package/anchor/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Anchor } from './Anchor';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES, DOT_INDICATOR, LINE_INDICATOR } from './vars';
|
|
3
|
+
import type { BaseProps } from '../types';
|
|
4
|
+
import type { RefExtra } from '@laser-ui/hooks/useRefExtra';
|
|
5
|
+
export {};
|
|
6
|
+
export interface AnchorRef {
|
|
7
|
+
active: string | null;
|
|
8
|
+
updateAnchor: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface AnchorItem {
|
|
11
|
+
href: string;
|
|
12
|
+
title?: React.ReactNode;
|
|
13
|
+
target?: string;
|
|
14
|
+
children?: AnchorItem[];
|
|
15
|
+
}
|
|
16
|
+
export interface AnchorProps<T extends AnchorItem> extends BaseProps<'anchor', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLUListElement>, 'children' | 'onClick'> {
|
|
17
|
+
list: T[];
|
|
18
|
+
page?: RefExtra;
|
|
19
|
+
distance?: number | string;
|
|
20
|
+
scrollBehavior?: 'instant' | 'smooth';
|
|
21
|
+
indicator?: React.ReactNode | typeof DOT_INDICATOR | typeof LINE_INDICATOR;
|
|
22
|
+
onClick?: (href: string, origin: T) => void;
|
|
23
|
+
}
|
package/anchor/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/anchor/vars.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
anchor: string;
|
|
3
|
+
anchor__link: string;
|
|
4
|
+
'anchor__link.is-active': string;
|
|
5
|
+
'anchor__indicator-track': string;
|
|
6
|
+
'anchor__indicator-wrapper': string;
|
|
7
|
+
'anchor__dot-indicator': string;
|
|
8
|
+
'anchor__line-indicator': string;
|
|
9
|
+
};
|
|
10
|
+
export declare const DOT_INDICATOR: unique symbol;
|
|
11
|
+
export declare const LINE_INDICATOR: unique symbol;
|
package/anchor/vars.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
anchor: '^anchor',
|
|
3
|
+
anchor__link: '^anchor__link',
|
|
4
|
+
'anchor__link.is-active': 'is-active',
|
|
5
|
+
'anchor__indicator-track': '^anchor__indicator-track',
|
|
6
|
+
'anchor__indicator-wrapper': '^anchor__indicator-wrapper',
|
|
7
|
+
'anchor__dot-indicator': '^anchor__dot-indicator',
|
|
8
|
+
'anchor__line-indicator': '^anchor__line-indicator',
|
|
9
|
+
};
|
|
10
|
+
export const DOT_INDICATOR = Symbol();
|
|
11
|
+
export const LINE_INDICATOR = Symbol();
|
package/avatar/Avatar.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { toPx } from '@laser-ui/utils';
|
|
4
|
+
import { isNumber } from 'lodash';
|
|
5
|
+
import { useEffect, useRef, useState } from 'react';
|
|
6
|
+
import { CLASSES } from './vars';
|
|
7
|
+
import { useComponentProps, useStyled } from '../hooks';
|
|
8
|
+
import { mergeCS } from '../utils';
|
|
9
|
+
export function Avatar(props) {
|
|
10
|
+
const _a = useComponentProps('Avatar', props), { styleOverrides, styleProvider, shape = 'circle', img, icon, text, size = 40 } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "shape", "img", "icon", "text", "size"]);
|
|
11
|
+
const styled = useStyled(CLASSES, { avatar: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.avatar }, styleOverrides);
|
|
12
|
+
const textRef = useRef(null);
|
|
13
|
+
const [imgError, setImgError] = useState(false);
|
|
14
|
+
const type = img && !imgError ? 'img' : icon ? 'icon' : text ? 'text' : 'img';
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (textRef.current) {
|
|
17
|
+
const maxWidth = Math.sqrt(Math.pow((isNumber(size) ? size : toPx(size, true)) / 2, 2) - Math.pow(textRef.current.scrollHeight / 2, 2)) * 2;
|
|
18
|
+
if (textRef.current.scrollWidth > maxWidth) {
|
|
19
|
+
textRef.current.style.transform = `scale(${maxWidth / textRef.current.scrollWidth})`;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
textRef.current.style.transform = '';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return (_jsx("div", Object.assign({}, restProps, mergeCS(styled('avatar', `avatar--${type}`, `avatar--${shape}`), {
|
|
27
|
+
className: restProps.className,
|
|
28
|
+
style: Object.assign(Object.assign({}, restProps.style), { width: size, height: size, fontSize: type === 'icon'
|
|
29
|
+
? `calc((${size}${isNumber(size) ? 'px' : ''} / 2) * 1.25)`
|
|
30
|
+
: type === 'text'
|
|
31
|
+
? `calc(${size}${isNumber(size) ? 'px' : ''} / 2)`
|
|
32
|
+
: undefined }),
|
|
33
|
+
}), { children: type === 'img' ? (
|
|
34
|
+
// eslint-disable-next-line jsx-a11y/alt-text
|
|
35
|
+
_jsx("img", Object.assign({}, img, mergeCS(styled('avatar__img'), {
|
|
36
|
+
className: img === null || img === void 0 ? void 0 : img.className,
|
|
37
|
+
style: img === null || img === void 0 ? void 0 : img.style,
|
|
38
|
+
}), { onError: (e) => {
|
|
39
|
+
var _a;
|
|
40
|
+
(_a = img === null || img === void 0 ? void 0 : img.onError) === null || _a === void 0 ? void 0 : _a.call(img, e);
|
|
41
|
+
setImgError(true);
|
|
42
|
+
} }))) : type === 'icon' ? (icon) : (_jsx("div", { ref: textRef, children: text })) })));
|
|
43
|
+
}
|
package/avatar/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Avatar } from './Avatar';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { BaseProps } from '../types';
|
|
4
|
+
export {};
|
|
5
|
+
export interface AvatarProps extends BaseProps<'avatar', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
6
|
+
shape?: 'circle' | 'square';
|
|
7
|
+
img?: React.ImgHTMLAttributes<HTMLImageElement>;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
text?: React.ReactNode;
|
|
10
|
+
size?: number | string;
|
|
11
|
+
}
|
package/avatar/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/avatar/vars.d.ts
ADDED
package/avatar/vars.js
ADDED
package/badge/Badge.d.ts
ADDED
package/badge/Badge.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { BadgeText } from './BadgeText';
|
|
5
|
+
import { BadgeNumber } from './internal/BadgeNumber';
|
|
6
|
+
import { CLASSES } from './vars';
|
|
7
|
+
import { useComponentProps, useStyled } from '../hooks';
|
|
8
|
+
import { Transition } from '../internal/transition';
|
|
9
|
+
import { mergeCS } from '../utils';
|
|
10
|
+
import { TTANSITION_DURING_BASE } from '../vars';
|
|
11
|
+
export const Badge = (props) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const _b = useComponentProps('Badge', props), { styleOverrides, styleProvider, value: valueProp, theme = 'danger', max = Infinity, dot = false, showZero = false, offset = [0, '100%'], alone = false } = _b, restProps = __rest(_b, ["styleOverrides", "styleProvider", "value", "theme", "max", "dot", "showZero", "offset", "alone"]);
|
|
14
|
+
const styled = useStyled(CLASSES, { badge: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.badge }, styleOverrides);
|
|
15
|
+
const dataRef = useRef({
|
|
16
|
+
prevValue: valueProp,
|
|
17
|
+
valueDown: false,
|
|
18
|
+
});
|
|
19
|
+
const show = showZero || valueProp > 0;
|
|
20
|
+
const value = show ? valueProp : (_a = dataRef.current.saveValue) !== null && _a !== void 0 ? _a : 0;
|
|
21
|
+
dataRef.current.saveValue = value;
|
|
22
|
+
const nums = (value > max ? max : value)
|
|
23
|
+
.toString()
|
|
24
|
+
.split('')
|
|
25
|
+
.map((n) => Number(n));
|
|
26
|
+
if (value !== dataRef.current.prevValue) {
|
|
27
|
+
dataRef.current.valueDown = value < dataRef.current.prevValue;
|
|
28
|
+
dataRef.current.prevValue = value;
|
|
29
|
+
}
|
|
30
|
+
return (_jsx(Transition, { enter: show, during: TTANSITION_DURING_BASE, children: (state) => {
|
|
31
|
+
var _a;
|
|
32
|
+
let transitionStyle = {};
|
|
33
|
+
switch (state) {
|
|
34
|
+
case 'enter':
|
|
35
|
+
transitionStyle = { transform: 'scale(0)', opacity: 0 };
|
|
36
|
+
break;
|
|
37
|
+
case 'entering':
|
|
38
|
+
transitionStyle = {
|
|
39
|
+
transition: ['transform', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-out`).join(', '),
|
|
40
|
+
};
|
|
41
|
+
break;
|
|
42
|
+
case 'leaving':
|
|
43
|
+
transitionStyle = {
|
|
44
|
+
transform: 'scale(0)',
|
|
45
|
+
opacity: 0,
|
|
46
|
+
transition: ['transform', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-in`).join(', '),
|
|
47
|
+
};
|
|
48
|
+
break;
|
|
49
|
+
default:
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
return state === 'leaved' ? null : (_jsx("div", Object.assign({}, restProps, mergeCS(styled('badge', `badge.t-${theme}`, {
|
|
53
|
+
'badge--dot': dot,
|
|
54
|
+
'badge--alone': alone,
|
|
55
|
+
}), {
|
|
56
|
+
className: restProps.className,
|
|
57
|
+
style: Object.assign(Object.assign({}, restProps.style), (alone ? undefined : { top: offset[0], left: offset[1] })),
|
|
58
|
+
}), { title: (_a = restProps.title) !== null && _a !== void 0 ? _a : (dot ? undefined : valueProp.toString()), children: _jsx("div", Object.assign({}, mergeCS(styled('badge__wrapper'), { style: transitionStyle }), { children: dot ? null : (_jsxs(_Fragment, { children: [nums.map((n, i) => (_jsx(BadgeNumber, { styled: styled, value: n, valueDown: dataRef.current.valueDown }, nums.length - i))), value > max ? '+' : ''] })) })) })));
|
|
59
|
+
} }));
|
|
60
|
+
};
|
|
61
|
+
Badge.Text = BadgeText;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { CLASSES } from './vars';
|
|
4
|
+
import { useComponentProps, useStyled } from '../hooks';
|
|
5
|
+
import { Transition } from '../internal/transition';
|
|
6
|
+
import { mergeCS } from '../utils';
|
|
7
|
+
import { TTANSITION_DURING_BASE } from '../vars';
|
|
8
|
+
export function BadgeText(props) {
|
|
9
|
+
const _a = useComponentProps('BadgeText', props), { styleOverrides, styleProvider, text, theme = 'danger', offset = [0, '100%'], alone = false } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "text", "theme", "offset", "alone"]);
|
|
10
|
+
const styled = useStyled(CLASSES, { badge: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.badge }, styleOverrides);
|
|
11
|
+
return (_jsx(Transition, { enter: text.length > 0, during: TTANSITION_DURING_BASE, children: (state) => {
|
|
12
|
+
var _a;
|
|
13
|
+
let transitionStyle = {};
|
|
14
|
+
switch (state) {
|
|
15
|
+
case 'enter':
|
|
16
|
+
transitionStyle = { transform: 'scale(0)', opacity: 0 };
|
|
17
|
+
break;
|
|
18
|
+
case 'entering':
|
|
19
|
+
transitionStyle = {
|
|
20
|
+
transition: ['transform', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-out`).join(', '),
|
|
21
|
+
};
|
|
22
|
+
break;
|
|
23
|
+
case 'leaving':
|
|
24
|
+
transitionStyle = {
|
|
25
|
+
transform: 'scale(0)',
|
|
26
|
+
opacity: 0,
|
|
27
|
+
transition: ['transform', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-in`).join(', '),
|
|
28
|
+
};
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
return state === 'leaved' ? null : (_jsx("div", Object.assign({}, restProps, mergeCS(styled('badge', `badge.t-${theme}`, {
|
|
34
|
+
'badge--alone': alone,
|
|
35
|
+
}), {
|
|
36
|
+
className: restProps.className,
|
|
37
|
+
style: Object.assign(Object.assign({}, restProps.style), (alone ? undefined : { top: offset[0], left: offset[1] })),
|
|
38
|
+
}), { title: (_a = restProps.title) !== null && _a !== void 0 ? _a : text, children: _jsx("div", Object.assign({}, mergeCS(styled('badge__wrapper'), { style: transitionStyle }), { children: text })) })));
|
|
39
|
+
} }));
|
|
40
|
+
}
|
package/badge/index.d.ts
ADDED
package/badge/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Badge } from './Badge';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Styled } from '../../hooks/useStyled';
|
|
3
|
+
import type { CLASSES } from '../vars';
|
|
4
|
+
interface BadgeNumberProps {
|
|
5
|
+
styled: Styled<typeof CLASSES>;
|
|
6
|
+
value: number;
|
|
7
|
+
valueDown: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function BadgeNumber(props: BadgeNumberProps): JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createElement as _createElement } from "react";
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
export function BadgeNumber(props) {
|
|
5
|
+
const { styled, value, valueDown } = props;
|
|
6
|
+
const containerRef = useRef(null);
|
|
7
|
+
const dataRef = useRef({
|
|
8
|
+
prevValue: value,
|
|
9
|
+
});
|
|
10
|
+
const [nums, setNums] = useState([value]);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (containerRef.current && dataRef.current.prevValue !== value) {
|
|
13
|
+
let newNums = Array.from({ length: 10 }).map((_, i) => i);
|
|
14
|
+
if (valueDown) {
|
|
15
|
+
newNums = newNums.concat(Array.from({ length: dataRef.current.prevValue + 1 }).map((_, i) => i));
|
|
16
|
+
newNums = newNums.slice(newNums.length - 10, newNums.length);
|
|
17
|
+
containerRef.current.style.cssText = 'transform:translateY(-900%);transition:none;';
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
newNums = Array.from({ length: 10 - dataRef.current.prevValue })
|
|
21
|
+
.map((_, i) => dataRef.current.prevValue + i)
|
|
22
|
+
.concat(newNums);
|
|
23
|
+
newNums = newNums.slice(0, 10);
|
|
24
|
+
containerRef.current.style.cssText = 'transform:translateY(0);transition:none;';
|
|
25
|
+
}
|
|
26
|
+
dataRef.current.prevValue = value;
|
|
27
|
+
setNums(newNums);
|
|
28
|
+
}
|
|
29
|
+
}, [value, valueDown]);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (containerRef.current) {
|
|
32
|
+
containerRef.current.style.cssText = `transform:translateY(-${nums.findIndex((n) => n === value) * 100}%); `;
|
|
33
|
+
}
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}, [nums]);
|
|
36
|
+
return (_jsx("div", Object.assign({}, styled('badge__number-container'), { ref: containerRef, children: nums.map((n, i) => (_createElement("span", Object.assign({}, styled('badge__number'), { key: i }), n))) })));
|
|
37
|
+
}
|
package/badge/types.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { BaseProps } from '../types';
|
|
4
|
+
export {};
|
|
5
|
+
export interface BadgeProps extends BaseProps<'badge', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
6
|
+
value: number;
|
|
7
|
+
theme?: 'primary' | 'success' | 'warning' | 'danger';
|
|
8
|
+
max?: number;
|
|
9
|
+
dot?: boolean;
|
|
10
|
+
showZero?: boolean;
|
|
11
|
+
offset?: [number | string, number | string];
|
|
12
|
+
alone?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface BadgeTextProps extends BaseProps<'badge', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
15
|
+
text: string;
|
|
16
|
+
theme?: 'primary' | 'success' | 'warning' | 'danger';
|
|
17
|
+
offset?: [number | string, number | string];
|
|
18
|
+
alone?: boolean;
|
|
19
|
+
}
|
package/badge/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/badge/vars.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
badge: string;
|
|
3
|
+
'badge.t-primary': string;
|
|
4
|
+
'badge.t-success': string;
|
|
5
|
+
'badge.t-warning': string;
|
|
6
|
+
'badge.t-danger': string;
|
|
7
|
+
'badge--dot': string;
|
|
8
|
+
'badge--alone': string;
|
|
9
|
+
badge__wrapper: string;
|
|
10
|
+
'badge__number-container': string;
|
|
11
|
+
badge__number: string;
|
|
12
|
+
};
|
package/badge/vars.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
badge: '^badge',
|
|
3
|
+
'badge.t-primary': 't-primary',
|
|
4
|
+
'badge.t-success': 't-success',
|
|
5
|
+
'badge.t-warning': 't-warning',
|
|
6
|
+
'badge.t-danger': 't-danger',
|
|
7
|
+
'badge--dot': '^badge--dot',
|
|
8
|
+
'badge--alone': '^badge--alone',
|
|
9
|
+
badge__wrapper: '^badge__wrapper',
|
|
10
|
+
'badge__number-container': '^badge__number-container',
|
|
11
|
+
badge__number: '^badge__number',
|
|
12
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment } from 'react';
|
|
4
|
+
import { CLASSES } from './vars';
|
|
5
|
+
import { useComponentProps, useStyled } from '../hooks';
|
|
6
|
+
import { mergeCS } from '../utils';
|
|
7
|
+
export function Breadcrumb(props) {
|
|
8
|
+
const _a = useComponentProps('Breadcrumb', props), { styleOverrides, styleProvider, list, separator, onClick } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "list", "separator", "onClick"]);
|
|
9
|
+
const styled = useStyled(CLASSES, { breadcrumb: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.breadcrumb }, styleOverrides);
|
|
10
|
+
return (_jsx("nav", Object.assign({}, restProps, mergeCS(styled('breadcrumb'), {
|
|
11
|
+
className: restProps.className,
|
|
12
|
+
style: restProps.style,
|
|
13
|
+
}), { children: _jsx("ol", Object.assign({}, styled('breadcrumb__list'), { children: list.map((item, index) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
return (_jsxs(Fragment, { children: [_jsx("li", Object.assign({}, styled('breadcrumb__item', {
|
|
16
|
+
'breadcrumb__item--link': item.link,
|
|
17
|
+
'breadcrumb__item--last': index === list.length - 1,
|
|
18
|
+
}), { onClick: () => {
|
|
19
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(item.id, item);
|
|
20
|
+
}, children: item.title })), index !== list.length - 1 && (_jsx("li", Object.assign({}, styled('breadcrumb__separator'), { "aria-hidden": true, children: (_b = (_a = item.separator) !== null && _a !== void 0 ? _a : separator) !== null && _b !== void 0 ? _b : '/' })))] }, item.id));
|
|
21
|
+
}) })) })));
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Breadcrumb } from './Breadcrumb';
|
|
@@ -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 BreadcrumbItem<ID extends React.Key> {
|
|
6
|
+
id: ID;
|
|
7
|
+
title: React.ReactNode;
|
|
8
|
+
link?: boolean;
|
|
9
|
+
separator?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface BreadcrumbProps<ID extends React.Key, T extends BreadcrumbItem<ID>> extends BaseProps<'breadcrumb', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLElement>, 'children' | 'onClick'> {
|
|
12
|
+
list: T[];
|
|
13
|
+
separator?: React.ReactNode;
|
|
14
|
+
onClick?: (id: ID, origin: T) => void;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
breadcrumb: '^breadcrumb',
|
|
3
|
+
breadcrumb__list: '^breadcrumb__list',
|
|
4
|
+
breadcrumb__item: '^breadcrumb__item',
|
|
5
|
+
'breadcrumb__item--link': '^breadcrumb__item--link',
|
|
6
|
+
'breadcrumb__item--last': '^breadcrumb__item--last',
|
|
7
|
+
breadcrumb__separator: '^breadcrumb__separator',
|
|
8
|
+
};
|
package/button/Button.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { checkNodeExist } from '@laser-ui/utils';
|
|
4
|
+
import { forwardRef, useRef } from 'react';
|
|
5
|
+
import { CLASSES } from './vars';
|
|
6
|
+
import { useComponentProps, useDesign, useScopedProps, useStyled } from '../hooks';
|
|
7
|
+
import { Icon } from '../icon';
|
|
8
|
+
import { CircularProgress } from '../internal/circular-progress';
|
|
9
|
+
import { CollapseTransition } from '../internal/transition';
|
|
10
|
+
import { Wave } from '../internal/wave';
|
|
11
|
+
import { mergeCS } from '../utils';
|
|
12
|
+
import { TTANSITION_DURING_SLOW } from '../vars';
|
|
13
|
+
export const Button = forwardRef((props, ref) => {
|
|
14
|
+
var _a;
|
|
15
|
+
const _b = useComponentProps('Button', props), { children, styleOverrides, styleProvider, pattern = 'primary', theme = 'primary', loading = false, shape, block = false, size: sizeProp, icon, iconRight = false } = _b, restProps = __rest(_b, ["children", "styleOverrides", "styleProvider", "pattern", "theme", "loading", "shape", "block", "size", "icon", "iconRight"]);
|
|
16
|
+
const styled = useStyled(CLASSES, { button: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.button }, styleOverrides);
|
|
17
|
+
const waveRef = useRef(null);
|
|
18
|
+
const { size, disabled } = useScopedProps({ size: sizeProp, disabled: restProps.disabled || loading });
|
|
19
|
+
const designProps = useDesign({ compose: { disabled } });
|
|
20
|
+
return (_jsxs("button", Object.assign({}, restProps, mergeCS(styled('button', `button.t-${theme}`, `button--${pattern}`, `button--${size}`, {
|
|
21
|
+
'button.is-loading': loading,
|
|
22
|
+
[`button--${shape}`]: shape,
|
|
23
|
+
'button--block': block,
|
|
24
|
+
'button--icon': !children,
|
|
25
|
+
'button--icon-right': iconRight,
|
|
26
|
+
}), {
|
|
27
|
+
className: restProps.className,
|
|
28
|
+
style: restProps.style,
|
|
29
|
+
}), designProps, { ref: ref, type: (_a = restProps.type) !== null && _a !== void 0 ? _a : 'button', disabled: disabled, onClick: (e) => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
(_a = restProps.onClick) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
32
|
+
if (['primary', 'secondary', 'outline', 'dashed'].includes(pattern)) {
|
|
33
|
+
(_b = waveRef.current) === null || _b === void 0 ? void 0 : _b.call(waveRef);
|
|
34
|
+
}
|
|
35
|
+
}, children: [_jsx(Wave, { ref: waveRef, color: "var(--color)" }), checkNodeExist(icon) ? (_jsx("div", Object.assign({}, styled('button__icon'), { children: loading ? (_jsx(Icon, { children: _jsx(CircularProgress, {}) })) : (icon) }))) : (_jsx(CollapseTransition, { originalSize: {
|
|
36
|
+
width: '',
|
|
37
|
+
}, collapsedSize: {
|
|
38
|
+
width: 0,
|
|
39
|
+
}, enter: loading, during: TTANSITION_DURING_SLOW, styles: {
|
|
40
|
+
entering: {
|
|
41
|
+
transition: ['width', 'padding', 'margin'].map((attr) => `${attr} ${TTANSITION_DURING_SLOW}ms linear`).join(', '),
|
|
42
|
+
},
|
|
43
|
+
leaving: {
|
|
44
|
+
transition: ['width', 'padding', 'margin'].map((attr) => `${attr} ${TTANSITION_DURING_SLOW}ms linear`).join(', '),
|
|
45
|
+
},
|
|
46
|
+
leaved: { display: 'none' },
|
|
47
|
+
}, destroyWhenLeaved: true, children: (loadingRef, collapseStyle) => (_jsx("div", Object.assign({}, mergeCS(styled('button__icon'), {
|
|
48
|
+
style: collapseStyle,
|
|
49
|
+
}), { ref: loadingRef, children: _jsx(Icon, { children: _jsx(CircularProgress, {}) }) }))) })), _jsx("div", { children: children })] })));
|
|
50
|
+
});
|
package/button/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Button } from './Button';
|