@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/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Xie Jay
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="//react-devui.com" rel="noopener" target="_blank"><img width="150" src="/packages/site/src/assets/logo.svg" alt="DevUI logo"></a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">React DevUI</h1>
|
|
6
|
+
|
|
7
|
+
<div align="center">
|
|
8
|
+
|
|
9
|
+
<!-- prettier-ignore-start -->
|
|
10
|
+
[](https://www.npmjs.com/package/@react-devui/ui)
|
|
11
|
+
[](https://bundlephobia.com/package/@react-devui/ui)
|
|
12
|
+
[](https://github.com/DevCloudFE/react-devui/actions/workflows/main.yml)
|
|
13
|
+
<!-- prettier-ignore-end -->
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div align="center">
|
|
18
|
+
|
|
19
|
+
English | [简体中文](README.zh-CN.md)
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
yarn add @react-devui/ui @react-devui/icons @react-devui/hooks @react-devui/utils
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Getting Started
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import type { DRootProps } from '@react-devui/ui';
|
|
33
|
+
|
|
34
|
+
import { useMemo } from 'react';
|
|
35
|
+
|
|
36
|
+
import { DRoot } from '@react-devui/ui';
|
|
37
|
+
|
|
38
|
+
export default function App() {
|
|
39
|
+
const rootContext = useMemo<DRootProps['context']>(
|
|
40
|
+
() => ({
|
|
41
|
+
layout: { pageScrollEl: '#app-main', contentResizeEl: '#app-content' },
|
|
42
|
+
}),
|
|
43
|
+
[]
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<DRoot context={rootContext}>
|
|
48
|
+
<main id="app-main" style={{ overflow: 'auto' }}>
|
|
49
|
+
<section id="app-content" style={{ height: '200vh' }}>
|
|
50
|
+
Some content...
|
|
51
|
+
</section>
|
|
52
|
+
</main>
|
|
53
|
+
</DRoot>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Links
|
|
59
|
+
|
|
60
|
+
- [react-devui.com](//react-devui.com)
|
|
61
|
+
- [admin.react-devui.com](//admin.react-devui.com)
|
|
62
|
+
|
|
63
|
+
## Contributing
|
|
64
|
+
|
|
65
|
+
Please read our [contributing guide](/CONTRIBUTING.md) first.
|
|
66
|
+
|
|
67
|
+
Need unit test support (Jest) 🤝.
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
[](/LICENSE)
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createElement as _createElement } from "react";
|
|
4
|
+
import { ReactComponent as KeyboardArrowDownOutlined } from '@material-design-icons/svg/outlined/keyboard_arrow_down.svg';
|
|
5
|
+
import { isNull, isUndefined, nth } from 'lodash';
|
|
6
|
+
import { useId } from 'react';
|
|
7
|
+
import { CLASSES } from './vars';
|
|
8
|
+
import { useComponentProps, useControlled, useNamespace, useStyled } from '../hooks';
|
|
9
|
+
import { Icon } from '../icon';
|
|
10
|
+
import { CollapseTransition } from '../internal/transition';
|
|
11
|
+
import { mergeCS } from '../utils';
|
|
12
|
+
import { TTANSITION_DURING_BASE } from '../vars';
|
|
13
|
+
export function Accordion(props) {
|
|
14
|
+
const _a = useComponentProps('Accordion', props), { styleOverrides, styleProvider, list, active: activeProp, defaultActive, activeOne, arrow = 'right', onActiveChange, afterActiveChange } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "list", "active", "defaultActive", "activeOne", "arrow", "onActiveChange", "afterActiveChange"]);
|
|
15
|
+
const namespace = useNamespace();
|
|
16
|
+
const styled = useStyled(CLASSES, { accordion: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.accordion }, styleOverrides);
|
|
17
|
+
const uniqueId = useId();
|
|
18
|
+
const getButtonId = (id) => `${namespace}-accordion-button-${id}-${uniqueId}`;
|
|
19
|
+
const getRegionId = (id) => `${namespace}-accordion-region-${id}-${uniqueId}`;
|
|
20
|
+
const [activeId, changeActiveId] = useControlled(defaultActive !== null && defaultActive !== void 0 ? defaultActive : (activeOne ? null : []), activeProp, (id) => {
|
|
21
|
+
if (onActiveChange) {
|
|
22
|
+
if (activeOne) {
|
|
23
|
+
onActiveChange(id, isNull(id) ? null : list.find((item) => item.id === id));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
let length = id.length;
|
|
27
|
+
const items = [];
|
|
28
|
+
for (const item of list) {
|
|
29
|
+
if (length === 0) {
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
const index = id.findIndex((v) => v === item.id);
|
|
33
|
+
if (index !== -1) {
|
|
34
|
+
items[index] = item;
|
|
35
|
+
length -= 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
onActiveChange(id, items);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return (_jsx("div", Object.assign({}, restProps, mergeCS(styled('accordion'), {
|
|
43
|
+
className: restProps.className,
|
|
44
|
+
style: restProps.style,
|
|
45
|
+
}), { children: list.map((item, index) => {
|
|
46
|
+
const { id: itemId, title: itemTitle, region: itemRegion, arrow: itemArrow = arrow, disabled: itemDisabled = false } = item;
|
|
47
|
+
const getAccordion = (next, _index = index) => {
|
|
48
|
+
for (let focusIndex = next ? _index + 1 : _index - 1, n = 0; n < list.length; next ? focusIndex++ : focusIndex--, n++) {
|
|
49
|
+
const t = nth(list, focusIndex % list.length);
|
|
50
|
+
if (t && !t.disabled) {
|
|
51
|
+
return t;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const focusTab = (t) => {
|
|
56
|
+
if (t) {
|
|
57
|
+
const el = document.getElementById(getButtonId(t.id));
|
|
58
|
+
if (el) {
|
|
59
|
+
el.focus();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const buttonId = getButtonId(itemId);
|
|
64
|
+
const regionId = getRegionId(itemId);
|
|
65
|
+
const isActive = activeOne ? activeId === itemId : activeId.includes(itemId);
|
|
66
|
+
const iconRotate = (() => {
|
|
67
|
+
if (itemArrow === 'left' && !isActive) {
|
|
68
|
+
return -90;
|
|
69
|
+
}
|
|
70
|
+
if (itemArrow === 'right' && isActive) {
|
|
71
|
+
return 180;
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
})();
|
|
75
|
+
const handleClick = () => {
|
|
76
|
+
if (activeOne) {
|
|
77
|
+
changeActiveId(isActive ? null : itemId);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
changeActiveId((draft) => {
|
|
81
|
+
const index = draft.findIndex((v) => v === itemId);
|
|
82
|
+
if (index !== -1) {
|
|
83
|
+
draft.splice(index, 1);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
draft.push(itemId);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
return (_createElement("div", Object.assign({}, styled('accordion__item'), { key: itemId }),
|
|
92
|
+
_jsxs("div", Object.assign({}, styled('accordion__item-button', {
|
|
93
|
+
'accordion__item-button.is-disabled': itemDisabled,
|
|
94
|
+
'accordion__item-button--arrow-left': itemArrow === 'left',
|
|
95
|
+
}), { id: buttonId, tabIndex: itemDisabled ? -1 : 0, role: "button", "aria-controls": regionId, "aria-expanded": isActive, "aria-disabled": itemDisabled, onClick: handleClick, onKeyDown: (e) => {
|
|
96
|
+
switch (e.code) {
|
|
97
|
+
case 'Enter':
|
|
98
|
+
case 'Space':
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
handleClick();
|
|
101
|
+
break;
|
|
102
|
+
case 'ArrowUp':
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
focusTab(getAccordion(false));
|
|
105
|
+
break;
|
|
106
|
+
case 'ArrowDown':
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
focusTab(getAccordion(true));
|
|
109
|
+
break;
|
|
110
|
+
case 'Home':
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
for (const a of list) {
|
|
113
|
+
if (!a.disabled) {
|
|
114
|
+
focusTab(a);
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
break;
|
|
119
|
+
case 'End':
|
|
120
|
+
e.preventDefault();
|
|
121
|
+
for (let index = list.length - 1; index >= 0; index--) {
|
|
122
|
+
if (!list[index].disabled) {
|
|
123
|
+
focusTab(list[index]);
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
break;
|
|
128
|
+
default:
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
}, children: [_jsx("div", Object.assign({}, styled('accordion__item-title'), { children: itemTitle })), itemArrow && (_jsx("div", Object.assign({}, mergeCS(styled('accordion__item-arrow'), {
|
|
132
|
+
style: {
|
|
133
|
+
transform: isUndefined(iconRotate) ? undefined : `rotate(${iconRotate}deg)`,
|
|
134
|
+
},
|
|
135
|
+
}), { children: _jsx(Icon, { children: _jsx(KeyboardArrowDownOutlined, {}) }) })))] })),
|
|
136
|
+
_jsx(CollapseTransition, { originalSize: {
|
|
137
|
+
height: 'auto',
|
|
138
|
+
}, collapsedSize: {
|
|
139
|
+
height: 0,
|
|
140
|
+
}, enter: isActive, during: TTANSITION_DURING_BASE, styles: {
|
|
141
|
+
enter: { opacity: 0 },
|
|
142
|
+
entering: {
|
|
143
|
+
transition: ['height', 'padding', 'margin', 'opacity']
|
|
144
|
+
.map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-out`)
|
|
145
|
+
.join(', '),
|
|
146
|
+
},
|
|
147
|
+
leaving: {
|
|
148
|
+
opacity: 0,
|
|
149
|
+
transition: ['height', 'padding', 'margin', 'opacity']
|
|
150
|
+
.map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-in`)
|
|
151
|
+
.join(', '),
|
|
152
|
+
},
|
|
153
|
+
leaved: { display: 'none' },
|
|
154
|
+
}, afterEnter: () => {
|
|
155
|
+
afterActiveChange === null || afterActiveChange === void 0 ? void 0 : afterActiveChange(itemId, item, true);
|
|
156
|
+
}, afterLeave: () => {
|
|
157
|
+
afterActiveChange === null || afterActiveChange === void 0 ? void 0 : afterActiveChange(itemId, item, false);
|
|
158
|
+
}, children: (regionRef, collapseStyle) => (_jsx("div", Object.assign({}, mergeCS(styled('accordion__item-region'), {
|
|
159
|
+
style: collapseStyle,
|
|
160
|
+
}), { ref: regionRef, id: regionId, role: "region", "aria-labelledby": getButtonId(itemId), children: itemRegion }))) })));
|
|
161
|
+
}) })));
|
|
162
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Accordion } from './Accordion';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { BaseProps } from '../types';
|
|
4
|
+
export {};
|
|
5
|
+
export interface AccordionItem<ID extends React.Key> {
|
|
6
|
+
id: ID;
|
|
7
|
+
title: React.ReactNode;
|
|
8
|
+
region: React.ReactNode;
|
|
9
|
+
arrow?: boolean | 'left';
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface AccordionProps<ID extends React.Key, T extends AccordionItem<ID>> extends BaseProps<'accordion', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
13
|
+
list: T[];
|
|
14
|
+
active?: ID | null | ID[];
|
|
15
|
+
defaultActive?: ID | null | ID[];
|
|
16
|
+
activeOne?: boolean;
|
|
17
|
+
arrow?: 'left' | 'right' | false;
|
|
18
|
+
onActiveChange?: (id: any, origin: any) => void;
|
|
19
|
+
afterActiveChange?: (id: ID, origin: T, active: boolean) => void;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
accordion: string;
|
|
3
|
+
accordion__item: string;
|
|
4
|
+
'accordion__item-button': string;
|
|
5
|
+
'accordion__item-button.is-disabled': string;
|
|
6
|
+
'accordion__item-button--arrow-left': string;
|
|
7
|
+
'accordion__item-title': string;
|
|
8
|
+
'accordion__item-arrow': string;
|
|
9
|
+
'accordion__item-region': string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
accordion: '^accordion',
|
|
3
|
+
accordion__item: '^accordion__item',
|
|
4
|
+
'accordion__item-button': '^accordion__item-button',
|
|
5
|
+
'accordion__item-button.is-disabled': 'is-disabled',
|
|
6
|
+
'accordion__item-button--arrow-left': '^accordion__item-button--arrow-left',
|
|
7
|
+
'accordion__item-title': '^accordion__item-title',
|
|
8
|
+
'accordion__item-arrow': '^accordion__item-arrow',
|
|
9
|
+
'accordion__item-region': '^accordion__item-region',
|
|
10
|
+
};
|
package/affix/Affix.d.ts
ADDED
package/affix/Affix.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEvent, useEventCallback, useIsomorphicLayoutEffect, useRefExtra, useResize } from '@laser-ui/hooks';
|
|
3
|
+
import { getOffsetToRoot, toPx } from '@laser-ui/utils';
|
|
4
|
+
import { isFunction, isString, isUndefined } from 'lodash';
|
|
5
|
+
import { cloneElement, forwardRef, useId, useImperativeHandle, useState } from 'react';
|
|
6
|
+
import { useComponentProps, useLayout, useListenGlobalScrolling, useNamespace } from '../hooks';
|
|
7
|
+
export const Affix = forwardRef((props, ref) => {
|
|
8
|
+
const { children, top = 0, target, zIndex } = useComponentProps('Affix', props);
|
|
9
|
+
const namespace = useNamespace();
|
|
10
|
+
const { pageScrollRef, contentResizeRef } = useLayout();
|
|
11
|
+
const uniqueId = useId();
|
|
12
|
+
const affixRef = useRefExtra(() => document.querySelector(`[data-l-affix="${uniqueId}"]`));
|
|
13
|
+
const referenceRef = useRefExtra(() => document.querySelector(`[data-l-affix-reference="${uniqueId}"]`));
|
|
14
|
+
const targetRef = useRefExtra(isUndefined(target) ? () => pageScrollRef.current : target);
|
|
15
|
+
const [sticky, setSticky] = useState(false);
|
|
16
|
+
const [positionStyle, setPositionStyle] = useState();
|
|
17
|
+
const updatePosition = useEventCallback(() => {
|
|
18
|
+
const offsetEl = sticky ? referenceRef.current : affixRef.current;
|
|
19
|
+
if (targetRef.current && offsetEl) {
|
|
20
|
+
const offsetRect = offsetEl.getBoundingClientRect();
|
|
21
|
+
const targetTop = getOffsetToRoot(targetRef.current);
|
|
22
|
+
const distance = isString(top) ? toPx(top, true) : top;
|
|
23
|
+
setSticky(Math.ceil(targetRef.current.scrollTop) + distance >= getOffsetToRoot(offsetEl) - targetTop);
|
|
24
|
+
setPositionStyle({
|
|
25
|
+
width: offsetRect.width,
|
|
26
|
+
height: offsetRect.height,
|
|
27
|
+
top: (isUndefined(target) ? targetTop : targetRef.current.getBoundingClientRect().top) + distance,
|
|
28
|
+
left: offsetRect.left,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
useIsomorphicLayoutEffect(() => {
|
|
33
|
+
updatePosition();
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}, []);
|
|
36
|
+
const listenGlobalScrolling = useListenGlobalScrolling(updatePosition);
|
|
37
|
+
useEvent(pageScrollRef, 'scroll', updatePosition, { passive: true }, listenGlobalScrolling);
|
|
38
|
+
useEvent(targetRef, 'scroll', updatePosition, { passive: true }, listenGlobalScrolling || isUndefined(target));
|
|
39
|
+
useResize(sticky ? referenceRef : affixRef, updatePosition);
|
|
40
|
+
useResize(contentResizeRef, updatePosition);
|
|
41
|
+
useImperativeHandle(ref, () => ({
|
|
42
|
+
sticky,
|
|
43
|
+
updatePosition,
|
|
44
|
+
}), [sticky, updatePosition]);
|
|
45
|
+
const render = (el) => (_jsxs(_Fragment, { children: [sticky &&
|
|
46
|
+
cloneElement(el, {
|
|
47
|
+
style: Object.assign(Object.assign({}, el.props.style), { visibility: 'hidden' }),
|
|
48
|
+
'aria-hidden': true,
|
|
49
|
+
'data-l-affix-reference': uniqueId,
|
|
50
|
+
}), cloneElement(el, {
|
|
51
|
+
style: sticky
|
|
52
|
+
? Object.assign(Object.assign(Object.assign({}, el.props.style), positionStyle), { position: 'fixed', zIndex: zIndex !== null && zIndex !== void 0 ? zIndex : `var(--${namespace}-zindex-sticky)` }) : el.props.style,
|
|
53
|
+
'data-l-affix': uniqueId,
|
|
54
|
+
})] }));
|
|
55
|
+
return isFunction(children) ? children(render) : render(children);
|
|
56
|
+
});
|
package/affix/index.d.ts
ADDED
package/affix/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Affix } from './Affix';
|
package/affix/types.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CloneHTMLElement } from '../types';
|
|
3
|
+
import type { RefExtra } from '@laser-ui/hooks/useRefExtra';
|
|
4
|
+
export {};
|
|
5
|
+
export interface AffixRef {
|
|
6
|
+
sticky: boolean;
|
|
7
|
+
updatePosition: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface AffixProps {
|
|
10
|
+
children: React.ReactElement | ((render: CloneHTMLElement) => JSX.Element | null);
|
|
11
|
+
top?: number | string;
|
|
12
|
+
target?: RefExtra;
|
|
13
|
+
zIndex?: number | string;
|
|
14
|
+
}
|
package/affix/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/alert/Alert.d.ts
ADDED
package/alert/Alert.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
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 { ReactComponent as CheckCircleOutlined } from '@material-design-icons/svg/outlined/check_circle.svg';
|
|
5
|
+
import { ReactComponent as CloseOutlined } from '@material-design-icons/svg/outlined/close.svg';
|
|
6
|
+
import { ReactComponent as HighlightOffOutlined } from '@material-design-icons/svg/outlined/highlight_off.svg';
|
|
7
|
+
import { ReactComponent as InfoOutlined } from '@material-design-icons/svg/outlined/info.svg';
|
|
8
|
+
import { ReactComponent as WarningAmberOutlined } from '@material-design-icons/svg/outlined/warning_amber.svg';
|
|
9
|
+
import { isUndefined } from 'lodash';
|
|
10
|
+
import { CLASSES } from './vars';
|
|
11
|
+
import { useComponentProps, useControlled, useStyled, useTranslation } from '../hooks';
|
|
12
|
+
import { Icon } from '../icon';
|
|
13
|
+
import { CollapseTransition } from '../internal/transition';
|
|
14
|
+
import { mergeCS } from '../utils';
|
|
15
|
+
import { TTANSITION_DURING_BASE } from '../vars';
|
|
16
|
+
export function Alert(props) {
|
|
17
|
+
const _a = useComponentProps('Alert', props), { children, styleOverrides, styleProvider, visible: visibleProp, type, title, icon, closable = false, onClose, afterVisibleChange } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "visible", "type", "title", "icon", "closable", "onClose", "afterVisibleChange"]);
|
|
18
|
+
const styled = useStyled(CLASSES, { alert: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.alert }, styleOverrides);
|
|
19
|
+
const { t } = useTranslation();
|
|
20
|
+
const [visible, changeVisible] = useControlled(true, visibleProp, onClose);
|
|
21
|
+
const hasTitle = checkNodeExist(title);
|
|
22
|
+
const closeNode = closable && (_jsx("button", Object.assign({}, styled('alert__close'), { "aria-label": t('Close'), onClick: () => {
|
|
23
|
+
changeVisible(false);
|
|
24
|
+
}, children: _jsx(Icon, { children: _jsx(CloseOutlined, {}) }) })));
|
|
25
|
+
return (_jsx(CollapseTransition, { originalSize: {
|
|
26
|
+
height: 'auto',
|
|
27
|
+
}, collapsedSize: {
|
|
28
|
+
height: 0,
|
|
29
|
+
}, enter: visible, during: TTANSITION_DURING_BASE, styles: {
|
|
30
|
+
enter: { opacity: 0 },
|
|
31
|
+
entering: {
|
|
32
|
+
transition: ['height', 'padding', 'margin', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-out`).join(', '),
|
|
33
|
+
},
|
|
34
|
+
leaving: {
|
|
35
|
+
opacity: 0,
|
|
36
|
+
transition: ['height', 'padding', 'margin', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-in`).join(', '),
|
|
37
|
+
},
|
|
38
|
+
leaved: { display: 'none' },
|
|
39
|
+
}, destroyWhenLeaved: true, afterEnter: () => {
|
|
40
|
+
afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(true);
|
|
41
|
+
}, afterLeave: () => {
|
|
42
|
+
afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(false);
|
|
43
|
+
}, children: (alertRef, collapseStyle) => {
|
|
44
|
+
var _a;
|
|
45
|
+
return (_jsxs("div", Object.assign({}, restProps, mergeCS(styled('alert', {
|
|
46
|
+
'alert--with-title': hasTitle,
|
|
47
|
+
[`alert--${type}`]: type,
|
|
48
|
+
}), {
|
|
49
|
+
className: restProps.className,
|
|
50
|
+
style: Object.assign(Object.assign({}, restProps.style), collapseStyle),
|
|
51
|
+
}), { ref: alertRef, role: (_a = restProps.role) !== null && _a !== void 0 ? _a : 'alert', children: [icon !== false && (!isUndefined(type) || checkNodeExist(icon)) && (_jsx("div", Object.assign({}, styled('alert__icon'), { children: checkNodeExist(icon) ? (icon) : (_jsx(Icon, { children: type === 'success' ? (_jsx(CheckCircleOutlined, {})) : type === 'warning' ? (_jsx(WarningAmberOutlined, {})) : type === 'error' ? (_jsx(HighlightOffOutlined, {})) : (_jsx(InfoOutlined, {})) })) }))), _jsxs("div", Object.assign({}, styled('alert__content'), { children: [hasTitle && (_jsxs("div", Object.assign({}, styled('alert__header'), { children: [_jsx("div", Object.assign({}, styled('alert__title'), { children: title })), closeNode] }))), checkNodeExist(children) && _jsx("div", Object.assign({}, styled('alert__message'), { children: children })), !hasTitle && closeNode] }))] })));
|
|
52
|
+
} }));
|
|
53
|
+
}
|
package/alert/index.d.ts
ADDED
package/alert/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Alert } from './Alert';
|
package/alert/types.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { BaseProps } from '../types';
|
|
4
|
+
export {};
|
|
5
|
+
export interface AlertProps extends BaseProps<'alert', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
6
|
+
visible?: boolean;
|
|
7
|
+
type?: 'success' | 'warning' | 'error' | 'info';
|
|
8
|
+
title?: React.ReactNode;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
closable?: boolean;
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
afterVisibleChange?: (visible: boolean) => void;
|
|
13
|
+
}
|
package/alert/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/alert/vars.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
alert: string;
|
|
3
|
+
'alert--success': string;
|
|
4
|
+
'alert--warning': string;
|
|
5
|
+
'alert--error': string;
|
|
6
|
+
'alert--info': string;
|
|
7
|
+
'alert--with-title': string;
|
|
8
|
+
alert__icon: string;
|
|
9
|
+
alert__content: string;
|
|
10
|
+
alert__message: string;
|
|
11
|
+
alert__header: string;
|
|
12
|
+
alert__title: string;
|
|
13
|
+
alert__close: string;
|
|
14
|
+
};
|
package/alert/vars.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
alert: '^alert',
|
|
3
|
+
'alert--success': '^alert--success',
|
|
4
|
+
'alert--warning': '^alert--warning',
|
|
5
|
+
'alert--error': '^alert--error',
|
|
6
|
+
'alert--info': '^alert--info',
|
|
7
|
+
'alert--with-title': '^alert--with-title',
|
|
8
|
+
alert__icon: '^alert__icon',
|
|
9
|
+
alert__content: '^alert__content',
|
|
10
|
+
alert__message: '^alert__message',
|
|
11
|
+
alert__header: '^alert__header',
|
|
12
|
+
alert__title: '^alert__title',
|
|
13
|
+
alert__close: '^alert__close',
|
|
14
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { AnchorItem, AnchorProps, AnchorRef } from './types';
|
|
3
|
+
import { DOT_INDICATOR, LINE_INDICATOR } from './vars';
|
|
4
|
+
declare function AnchorFC<T extends AnchorItem>(props: AnchorProps<T>, ref: React.ForwardedRef<AnchorRef>): JSX.Element | null;
|
|
5
|
+
export declare const Anchor: {
|
|
6
|
+
<T extends AnchorItem>(props: AnchorProps<T> & React.RefAttributes<AnchorRef>): ReturnType<typeof AnchorFC>;
|
|
7
|
+
DOT_INDICATOR: typeof DOT_INDICATOR;
|
|
8
|
+
LINE_INDICATOR: typeof LINE_INDICATOR;
|
|
9
|
+
};
|
|
10
|
+
export {};
|