@laser-ui/components 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +71 -0
- package/accordion/Accordion.d.ts +3 -0
- package/accordion/Accordion.js +162 -0
- package/accordion/index.d.ts +2 -0
- package/accordion/index.js +1 -0
- package/accordion/types.d.ts +20 -0
- package/accordion/types.js +1 -0
- package/accordion/vars.d.ts +10 -0
- package/accordion/vars.js +10 -0
- package/affix/Affix.d.ts +3 -0
- package/affix/Affix.js +56 -0
- package/affix/index.d.ts +2 -0
- package/affix/index.js +1 -0
- package/affix/types.d.ts +14 -0
- package/affix/types.js +1 -0
- package/alert/Alert.d.ts +3 -0
- package/alert/Alert.js +53 -0
- package/alert/index.d.ts +2 -0
- package/alert/index.js +1 -0
- package/alert/types.d.ts +13 -0
- package/alert/types.js +1 -0
- package/alert/vars.d.ts +14 -0
- package/alert/vars.js +14 -0
- package/anchor/Anchor.d.ts +10 -0
- package/anchor/Anchor.js +112 -0
- package/anchor/index.d.ts +2 -0
- package/anchor/index.js +1 -0
- package/anchor/types.d.ts +23 -0
- package/anchor/types.js +1 -0
- package/anchor/vars.d.ts +11 -0
- package/anchor/vars.js +11 -0
- package/avatar/Avatar.d.ts +3 -0
- package/avatar/Avatar.js +43 -0
- package/avatar/index.d.ts +2 -0
- package/avatar/index.js +1 -0
- package/avatar/types.d.ts +11 -0
- package/avatar/types.js +1 -0
- package/avatar/vars.d.ts +9 -0
- package/avatar/vars.js +9 -0
- package/badge/Badge.d.ts +7 -0
- package/badge/Badge.js +61 -0
- package/badge/BadgeText.d.ts +2 -0
- package/badge/BadgeText.js +40 -0
- package/badge/index.d.ts +2 -0
- package/badge/index.js +1 -0
- package/badge/internal/BadgeNumber.d.ts +10 -0
- package/badge/internal/BadgeNumber.js +37 -0
- package/badge/types.d.ts +19 -0
- package/badge/types.js +1 -0
- package/badge/vars.d.ts +12 -0
- package/badge/vars.js +12 -0
- package/breadcrumb/Breadcrumb.d.ts +3 -0
- package/breadcrumb/Breadcrumb.js +22 -0
- package/breadcrumb/index.d.ts +2 -0
- package/breadcrumb/index.js +1 -0
- package/breadcrumb/types.d.ts +15 -0
- package/breadcrumb/types.js +1 -0
- package/breadcrumb/vars.d.ts +8 -0
- package/breadcrumb/vars.js +8 -0
- package/button/Button.d.ts +3 -0
- package/button/Button.js +50 -0
- package/button/index.d.ts +2 -0
- package/button/index.js +1 -0
- package/button/types.d.ts +14 -0
- package/button/types.js +1 -0
- package/button/vars.d.ts +23 -0
- package/button/vars.js +23 -0
- package/card/Card.d.ts +11 -0
- package/card/Card.js +30 -0
- package/card/CardAction.d.ts +3 -0
- package/card/CardAction.js +17 -0
- package/card/CardContent.d.ts +3 -0
- package/card/CardContent.js +13 -0
- package/card/CardHeader.d.ts +3 -0
- package/card/CardHeader.js +13 -0
- package/card/index.d.ts +2 -0
- package/card/index.js +1 -0
- package/card/types.d.ts +17 -0
- package/card/types.js +1 -0
- package/card/vars.d.ts +12 -0
- package/card/vars.js +12 -0
- package/cascader/Cascader.d.ts +5 -0
- package/cascader/Cascader.js +487 -0
- package/cascader/index.d.ts +2 -0
- package/cascader/index.js +1 -0
- package/cascader/internal/CascaderPanel.d.ts +23 -0
- package/cascader/internal/CascaderPanel.js +135 -0
- package/cascader/internal/CascaderSearchPanel.d.ts +22 -0
- package/cascader/internal/CascaderSearchPanel.js +73 -0
- package/cascader/internal/types.d.ts +8 -0
- package/cascader/internal/types.js +1 -0
- package/cascader/types.d.ts +49 -0
- package/cascader/types.js +1 -0
- package/cascader/vars.d.ts +32 -0
- package/cascader/vars.js +32 -0
- package/checkbox/Checkbox.d.ts +7 -0
- package/checkbox/Checkbox.js +25 -0
- package/checkbox/CheckboxGroup.d.ts +3 -0
- package/checkbox/CheckboxGroup.js +25 -0
- package/checkbox/index.d.ts +2 -0
- package/checkbox/index.js +1 -0
- package/checkbox/types.d.ts +29 -0
- package/checkbox/types.js +1 -0
- package/checkbox/vars.d.ts +11 -0
- package/checkbox/vars.js +11 -0
- package/compose/Compose.d.ts +7 -0
- package/compose/Compose.js +24 -0
- package/compose/ComposeItem.d.ts +3 -0
- package/compose/ComposeItem.js +18 -0
- package/compose/index.d.ts +2 -0
- package/compose/index.js +1 -0
- package/compose/types.d.ts +12 -0
- package/compose/types.js +1 -0
- package/compose/vars.d.ts +10 -0
- package/compose/vars.js +10 -0
- package/config-provider/ConfigProvider.d.ts +3 -0
- package/config-provider/ConfigProvider.js +14 -0
- package/config-provider/index.d.ts +2 -0
- package/config-provider/index.js +1 -0
- package/config-provider/types.d.ts +7 -0
- package/config-provider/types.js +1 -0
- package/context/index.d.ts +33 -0
- package/context/index.js +106 -0
- package/context/props.d.ts +134 -0
- package/context/props.js +1 -0
- package/date-picker/DatePicker.d.ts +3 -0
- package/date-picker/DatePicker.js +376 -0
- package/date-picker/index.d.ts +2 -0
- package/date-picker/index.js +1 -0
- package/date-picker/internal/DatePickerPanel.d.ts +15 -0
- package/date-picker/internal/DatePickerPanel.js +104 -0
- package/date-picker/types.d.ts +37 -0
- package/date-picker/types.js +1 -0
- package/date-picker/vars.d.ts +36 -0
- package/date-picker/vars.js +36 -0
- package/dayjs.d.ts +3 -0
- package/dayjs.js +11 -0
- package/drawer/Drawer.d.ts +9 -0
- package/drawer/Drawer.js +141 -0
- package/drawer/DrawerFooter.d.ts +3 -0
- package/drawer/DrawerFooter.js +51 -0
- package/drawer/DrawerHeader.d.ts +3 -0
- package/drawer/DrawerHeader.js +37 -0
- package/drawer/index.d.ts +2 -0
- package/drawer/index.js +1 -0
- package/drawer/types.d.ts +36 -0
- package/drawer/types.js +1 -0
- package/drawer/vars.d.ts +21 -0
- package/drawer/vars.js +18 -0
- package/dropdown/Dropdown.d.ts +5 -0
- package/dropdown/Dropdown.js +376 -0
- package/dropdown/index.d.ts +2 -0
- package/dropdown/index.js +1 -0
- package/dropdown/internal/DropdownGroup.d.ts +13 -0
- package/dropdown/internal/DropdownGroup.js +8 -0
- package/dropdown/internal/DropdownItem.d.ts +16 -0
- package/dropdown/internal/DropdownItem.js +9 -0
- package/dropdown/internal/DropdownSub.d.ts +22 -0
- package/dropdown/internal/DropdownSub.js +78 -0
- package/dropdown/types.d.ts +31 -0
- package/dropdown/types.js +1 -0
- package/dropdown/utils.d.ts +4 -0
- package/dropdown/utils.js +18 -0
- package/dropdown/vars.d.ts +23 -0
- package/dropdown/vars.js +23 -0
- package/empty/Empty.d.ts +7 -0
- package/empty/Empty.js +18 -0
- package/empty/index.d.ts +2 -0
- package/empty/index.js +1 -0
- package/empty/types.d.ts +8 -0
- package/empty/types.js +1 -0
- package/empty/vars.d.ts +7 -0
- package/empty/vars.js +7 -0
- package/fab/Fab.d.ts +9 -0
- package/fab/Fab.js +31 -0
- package/fab/FabBacktop.d.ts +3 -0
- package/fab/FabBacktop.js +58 -0
- package/fab/FabButton.d.ts +3 -0
- package/fab/FabButton.js +23 -0
- package/fab/index.d.ts +2 -0
- package/fab/index.js +1 -0
- package/fab/types.d.ts +26 -0
- package/fab/types.js +1 -0
- package/fab/vars.d.ts +28 -0
- package/fab/vars.js +28 -0
- package/form/Form.d.ts +7 -0
- package/form/Form.js +34 -0
- package/form/FormItem.d.ts +5 -0
- package/form/FormItem.js +201 -0
- package/form/hooks.d.ts +5 -0
- package/form/hooks.js +18 -0
- package/form/index.d.ts +8 -0
- package/form/index.js +7 -0
- package/form/internal/FormError.d.ts +12 -0
- package/form/internal/FormError.js +24 -0
- package/form/model/abstract-control.d.ts +67 -0
- package/form/model/abstract-control.js +335 -0
- package/form/model/form-control.d.ts +23 -0
- package/form/model/form-control.js +72 -0
- package/form/model/form-group.d.ts +62 -0
- package/form/model/form-group.js +165 -0
- package/form/model/types.d.ts +8 -0
- package/form/model/types.js +1 -0
- package/form/model/validators.d.ts +11 -0
- package/form/model/validators.js +83 -0
- package/form/model/vars.d.ts +1 -0
- package/form/model/vars.js +1 -0
- package/form/types.d.ts +63 -0
- package/form/types.js +1 -0
- package/form/vars.d.ts +27 -0
- package/form/vars.js +25 -0
- package/hooks/index.d.ts +14 -0
- package/hooks/index.js +14 -0
- package/hooks/useComponentProps.d.ts +2 -0
- package/hooks/useComponentProps.js +15 -0
- package/hooks/useControlled.d.ts +3 -0
- package/hooks/useControlled.js +26 -0
- package/hooks/useDesign.d.ts +12 -0
- package/hooks/useDesign.js +8 -0
- package/hooks/useFocusVisible.d.ts +2 -0
- package/hooks/useFocusVisible.js +38 -0
- package/hooks/useLayout.d.ts +5 -0
- package/hooks/useLayout.js +10 -0
- package/hooks/useListenGlobalScrolling.d.ts +1 -0
- package/hooks/useListenGlobalScrolling.js +9 -0
- package/hooks/useLockScroll.d.ts +1 -0
- package/hooks/useLockScroll.js +24 -0
- package/hooks/useMaxIndex.d.ts +1 -0
- package/hooks/useMaxIndex.js +32 -0
- package/hooks/useNamespace.d.ts +1 -0
- package/hooks/useNamespace.js +6 -0
- package/hooks/useNestedPopup.d.ts +13 -0
- package/hooks/useNestedPopup.js +37 -0
- package/hooks/useNextTick.d.ts +2 -0
- package/hooks/useNextTick.js +9 -0
- package/hooks/useScopedProps.d.ts +8 -0
- package/hooks/useScopedProps.js +7 -0
- package/hooks/useStyled.d.ts +20 -0
- package/hooks/useStyled.js +82 -0
- package/hooks/useTranslation.d.ts +4 -0
- package/hooks/useTranslation.js +17 -0
- package/icon/Icon.d.ts +3 -0
- package/icon/Icon.js +18 -0
- package/icon/index.d.ts +2 -0
- package/icon/index.js +1 -0
- package/icon/types.d.ts +12 -0
- package/icon/types.js +1 -0
- package/icon/vars.d.ts +7 -0
- package/icon/vars.js +7 -0
- package/image/Image.d.ts +9 -0
- package/image/Image.js +50 -0
- package/image/ImageAction.d.ts +3 -0
- package/image/ImageAction.js +15 -0
- package/image/ImagePreview.d.ts +3 -0
- package/image/ImagePreview.js +261 -0
- package/image/index.d.ts +2 -0
- package/image/index.js +1 -0
- package/image/types.d.ts +24 -0
- package/image/types.js +1 -0
- package/image/vars.d.ts +26 -0
- package/image/vars.js +26 -0
- package/index.d.ts +52 -0
- package/index.js +52 -0
- package/input/Input.d.ts +7 -0
- package/input/Input.js +56 -0
- package/input/InputNumber.d.ts +2 -0
- package/input/InputNumber.js +142 -0
- package/input/index.d.ts +2 -0
- package/input/index.js +1 -0
- package/input/types.d.ts +44 -0
- package/input/types.js +1 -0
- package/input/vars.d.ts +14 -0
- package/input/vars.js +14 -0
- package/internal/circular-progress/CircularProgress.d.ts +2 -0
- package/internal/circular-progress/CircularProgress.js +11 -0
- package/internal/circular-progress/index.d.ts +1 -0
- package/internal/circular-progress/index.js +1 -0
- package/internal/circular-progress/vars.d.ts +4 -0
- package/internal/circular-progress/vars.js +4 -0
- package/internal/mask/Mask.d.ts +3 -0
- package/internal/mask/Mask.js +36 -0
- package/internal/mask/index.d.ts +2 -0
- package/internal/mask/index.js +1 -0
- package/internal/mask/types.d.ts +7 -0
- package/internal/mask/types.js +1 -0
- package/internal/mask/vars.d.ts +3 -0
- package/internal/mask/vars.js +3 -0
- package/internal/popup/Popup.d.ts +3 -0
- package/internal/popup/Popup.js +132 -0
- package/internal/popup/index.d.ts +2 -0
- package/internal/popup/index.js +1 -0
- package/internal/popup/types.d.ts +21 -0
- package/internal/popup/types.js +1 -0
- package/internal/portal/Portal.d.ts +3 -0
- package/internal/portal/Portal.js +14 -0
- package/internal/portal/index.d.ts +2 -0
- package/internal/portal/index.js +1 -0
- package/internal/portal/types.d.ts +6 -0
- package/internal/portal/types.js +1 -0
- package/internal/transition/CollapseTransition.d.ts +3 -0
- package/internal/transition/CollapseTransition.js +101 -0
- package/internal/transition/Transition.d.ts +3 -0
- package/internal/transition/Transition.js +87 -0
- package/internal/transition/index.d.ts +3 -0
- package/internal/transition/index.js +2 -0
- package/internal/transition/types.d.ts +33 -0
- package/internal/transition/types.js +1 -0
- package/internal/wave/Wave.d.ts +3 -0
- package/internal/wave/Wave.js +25 -0
- package/internal/wave/index.d.ts +2 -0
- package/internal/wave/index.js +1 -0
- package/internal/wave/types.d.ts +6 -0
- package/internal/wave/types.js +1 -0
- package/internal/wave/vars.d.ts +3 -0
- package/internal/wave/vars.js +3 -0
- package/menu/Menu.d.ts +5 -0
- package/menu/Menu.js +386 -0
- package/menu/index.d.ts +2 -0
- package/menu/index.js +1 -0
- package/menu/internal/MenuGroup.d.ts +15 -0
- package/menu/internal/MenuGroup.js +8 -0
- package/menu/internal/MenuItem.d.ts +23 -0
- package/menu/internal/MenuItem.js +18 -0
- package/menu/internal/MenuSub.d.ts +31 -0
- package/menu/internal/MenuSub.js +129 -0
- package/menu/types.d.ts +30 -0
- package/menu/types.js +1 -0
- package/menu/utils.d.ts +4 -0
- package/menu/utils.js +18 -0
- package/menu/vars.d.ts +28 -0
- package/menu/vars.js +28 -0
- package/modal/Modal.d.ts +11 -0
- package/modal/Modal.js +127 -0
- package/modal/ModalAlert.d.ts +3 -0
- package/modal/ModalAlert.js +19 -0
- package/modal/ModalFooter.d.ts +3 -0
- package/modal/ModalFooter.js +51 -0
- package/modal/ModalHeader.d.ts +3 -0
- package/modal/ModalHeader.js +37 -0
- package/modal/index.d.ts +2 -0
- package/modal/index.js +1 -0
- package/modal/types.d.ts +39 -0
- package/modal/types.js +1 -0
- package/modal/vars.d.ts +23 -0
- package/modal/vars.js +23 -0
- package/notification/Notification.d.ts +3 -0
- package/notification/Notification.js +129 -0
- package/notification/index.d.ts +2 -0
- package/notification/index.js +1 -0
- package/notification/types.d.ts +18 -0
- package/notification/types.js +1 -0
- package/notification/vars.d.ts +17 -0
- package/notification/vars.js +14 -0
- package/package.json +47 -0
- package/pagination/Pagination.d.ts +3 -0
- package/pagination/Pagination.js +191 -0
- package/pagination/index.d.ts +2 -0
- package/pagination/index.js +1 -0
- package/pagination/types.d.ts +23 -0
- package/pagination/types.js +1 -0
- package/pagination/utils.d.ts +2 -0
- package/pagination/utils.js +14 -0
- package/pagination/vars.d.ts +14 -0
- package/pagination/vars.js +14 -0
- package/popover/Popover.d.ts +9 -0
- package/popover/Popover.js +173 -0
- package/popover/PopoverFooter.d.ts +3 -0
- package/popover/PopoverFooter.js +51 -0
- package/popover/PopoverHeader.d.ts +3 -0
- package/popover/PopoverHeader.js +37 -0
- package/popover/index.d.ts +2 -0
- package/popover/index.js +1 -0
- package/popover/types.d.ts +46 -0
- package/popover/types.js +1 -0
- package/popover/vars.d.ts +30 -0
- package/popover/vars.js +27 -0
- package/progress/Progress.d.ts +3 -0
- package/progress/Progress.js +45 -0
- package/progress/index.d.ts +2 -0
- package/progress/index.js +1 -0
- package/progress/types.d.ts +19 -0
- package/progress/types.js +1 -0
- package/progress/vars.d.ts +15 -0
- package/progress/vars.js +15 -0
- package/radio/Radio.d.ts +7 -0
- package/radio/Radio.js +38 -0
- package/radio/RadioGroup.d.ts +3 -0
- package/radio/RadioGroup.js +21 -0
- package/radio/index.d.ts +2 -0
- package/radio/index.js +1 -0
- package/radio/types.d.ts +31 -0
- package/radio/types.js +1 -0
- package/radio/vars.d.ts +14 -0
- package/radio/vars.js +14 -0
- package/rating/Rating.d.ts +3 -0
- package/rating/Rating.js +34 -0
- package/rating/index.d.ts +2 -0
- package/rating/index.js +1 -0
- package/rating/internal/RatingStar.d.ts +19 -0
- package/rating/internal/RatingStar.js +37 -0
- package/rating/types.d.ts +18 -0
- package/rating/types.js +1 -0
- package/rating/vars.d.ts +11 -0
- package/rating/vars.js +11 -0
- package/resources.json +128 -0
- package/root/Root.d.ts +3 -0
- package/root/Root.js +85 -0
- package/root/dialog-service.d.ts +12 -0
- package/root/dialog-service.js +62 -0
- package/root/index.d.ts +3 -0
- package/root/index.js +2 -0
- package/root/types.d.ts +16 -0
- package/root/types.js +1 -0
- package/root/vars.d.ts +25 -0
- package/root/vars.js +13 -0
- package/select/Select.d.ts +5 -0
- package/select/Select.js +528 -0
- package/select/index.d.ts +2 -0
- package/select/index.js +1 -0
- package/select/types.d.ts +50 -0
- package/select/types.js +1 -0
- package/select/vars.d.ts +31 -0
- package/select/vars.js +31 -0
- package/separator/Separator.d.ts +3 -0
- package/separator/Separator.js +19 -0
- package/separator/index.d.ts +2 -0
- package/separator/index.js +1 -0
- package/separator/types.d.ts +8 -0
- package/separator/types.js +1 -0
- package/separator/vars.d.ts +9 -0
- package/separator/vars.js +9 -0
- package/skeleton/Skeleton.d.ts +3 -0
- package/skeleton/Skeleton.js +13 -0
- package/skeleton/index.d.ts +2 -0
- package/skeleton/index.js +1 -0
- package/skeleton/types.d.ts +7 -0
- package/skeleton/types.js +1 -0
- package/skeleton/vars.d.ts +6 -0
- package/skeleton/vars.js +6 -0
- package/slider/Slider.d.ts +3 -0
- package/slider/Slider.js +324 -0
- package/slider/index.d.ts +2 -0
- package/slider/index.js +1 -0
- package/slider/types.d.ts +28 -0
- package/slider/types.js +1 -0
- package/slider/vars.d.ts +17 -0
- package/slider/vars.js +17 -0
- package/slides/Slides.d.ts +3 -0
- package/slides/Slides.js +277 -0
- package/slides/index.d.ts +2 -0
- package/slides/index.js +1 -0
- package/slides/types.d.ts +29 -0
- package/slides/types.js +1 -0
- package/slides/vars.d.ts +20 -0
- package/slides/vars.js +20 -0
- package/spinner/Spinner.d.ts +3 -0
- package/spinner/Spinner.js +66 -0
- package/spinner/index.d.ts +2 -0
- package/spinner/index.js +1 -0
- package/spinner/types.d.ts +12 -0
- package/spinner/types.js +1 -0
- package/spinner/vars.d.ts +7 -0
- package/spinner/vars.js +7 -0
- package/stepper/Stepper.d.ts +3 -0
- package/stepper/Stepper.js +87 -0
- package/stepper/index.d.ts +2 -0
- package/stepper/index.js +1 -0
- package/stepper/types.d.ts +22 -0
- package/stepper/types.js +1 -0
- package/stepper/vars.d.ts +19 -0
- package/stepper/vars.js +19 -0
- package/switch/Switch.d.ts +2 -0
- package/switch/Switch.js +48 -0
- package/switch/index.d.ts +2 -0
- package/switch/index.js +1 -0
- package/switch/types.d.ts +18 -0
- package/switch/types.js +1 -0
- package/switch/vars.d.ts +17 -0
- package/switch/vars.js +17 -0
- package/table/Table.d.ts +17 -0
- package/table/Table.js +72 -0
- package/table/TableEmpty.d.ts +3 -0
- package/table/TableEmpty.js +37 -0
- package/table/TableExpand.d.ts +3 -0
- package/table/TableExpand.js +20 -0
- package/table/TableFilter.d.ts +3 -0
- package/table/TableFilter.js +22 -0
- package/table/TableTd.d.ts +3 -0
- package/table/TableTd.js +11 -0
- package/table/TableTh.d.ts +3 -0
- package/table/TableTh.js +33 -0
- package/table/TableThAction.d.ts +3 -0
- package/table/TableThAction.js +18 -0
- package/table/index.d.ts +2 -0
- package/table/index.js +1 -0
- package/table/internal/TableCell.d.ts +19 -0
- package/table/internal/TableCell.js +61 -0
- package/table/types.d.ts +73 -0
- package/table/types.js +1 -0
- package/table/vars.d.ts +29 -0
- package/table/vars.js +28 -0
- package/tabs/Tabs.d.ts +5 -0
- package/tabs/Tabs.js +248 -0
- package/tabs/index.d.ts +2 -0
- package/tabs/index.js +1 -0
- package/tabs/types.d.ts +28 -0
- package/tabs/types.js +1 -0
- package/tabs/vars.d.ts +30 -0
- package/tabs/vars.js +30 -0
- package/tag/Tag.d.ts +3 -0
- package/tag/Tag.js +16 -0
- package/tag/index.d.ts +2 -0
- package/tag/index.js +1 -0
- package/tag/types.d.ts +9 -0
- package/tag/types.js +1 -0
- package/tag/vars.d.ts +13 -0
- package/tag/vars.js +13 -0
- package/textarea/Textarea.d.ts +3 -0
- package/textarea/Textarea.js +72 -0
- package/textarea/index.d.ts +2 -0
- package/textarea/index.js +1 -0
- package/textarea/types.d.ts +18 -0
- package/textarea/types.js +1 -0
- package/textarea/vars.d.ts +7 -0
- package/textarea/vars.js +7 -0
- package/time-picker/TimePicker.d.ts +3 -0
- package/time-picker/TimePicker.js +338 -0
- package/time-picker/index.d.ts +2 -0
- package/time-picker/index.js +1 -0
- package/time-picker/internal/TimePickerPanel.d.ts +16 -0
- package/time-picker/internal/TimePickerPanel.js +138 -0
- package/time-picker/types.d.ts +33 -0
- package/time-picker/types.js +1 -0
- package/time-picker/utils.d.ts +4 -0
- package/time-picker/utils.js +26 -0
- package/time-picker/vars.d.ts +20 -0
- package/time-picker/vars.js +20 -0
- package/timeline/Timeline.d.ts +3 -0
- package/timeline/Timeline.js +53 -0
- package/timeline/index.d.ts +2 -0
- package/timeline/index.js +1 -0
- package/timeline/types.d.ts +15 -0
- package/timeline/types.js +1 -0
- package/timeline/vars.d.ts +19 -0
- package/timeline/vars.js +19 -0
- package/toast/Toast.d.ts +3 -0
- package/toast/Toast.js +123 -0
- package/toast/index.d.ts +2 -0
- package/toast/index.js +1 -0
- package/toast/types.d.ts +17 -0
- package/toast/types.js +1 -0
- package/toast/vars.d.ts +14 -0
- package/toast/vars.js +11 -0
- package/tooltip/Tooltip.d.ts +3 -0
- package/tooltip/Tooltip.js +113 -0
- package/tooltip/index.d.ts +2 -0
- package/tooltip/index.js +1 -0
- package/tooltip/types.d.ts +29 -0
- package/tooltip/types.js +1 -0
- package/tooltip/vars.d.ts +20 -0
- package/tooltip/vars.js +17 -0
- package/transfer/Transfer.d.ts +3 -0
- package/transfer/Transfer.js +156 -0
- package/transfer/index.d.ts +2 -0
- package/transfer/index.js +1 -0
- package/transfer/internal/TransferPanel.d.ts +21 -0
- package/transfer/internal/TransferPanel.js +42 -0
- package/transfer/types.d.ts +34 -0
- package/transfer/types.js +1 -0
- package/transfer/vars.d.ts +17 -0
- package/transfer/vars.js +17 -0
- package/tree/Tree.d.ts +3 -0
- package/tree/Tree.js +165 -0
- package/tree/index.d.ts +2 -0
- package/tree/index.js +1 -0
- package/tree/internal/TreePanel.d.ts +32 -0
- package/tree/internal/TreePanel.js +167 -0
- package/tree/node/abstract-node.d.ts +25 -0
- package/tree/node/abstract-node.js +68 -0
- package/tree/node/multiple-node.d.ts +18 -0
- package/tree/node/multiple-node.js +109 -0
- package/tree/node/single-node.d.ts +16 -0
- package/tree/node/single-node.js +60 -0
- package/tree/node/types.d.ts +6 -0
- package/tree/node/types.js +1 -0
- package/tree/node/vars.d.ts +2 -0
- package/tree/node/vars.js +1 -0
- package/tree/types.d.ts +34 -0
- package/tree/types.js +1 -0
- package/tree/utils.d.ts +6 -0
- package/tree/utils.js +9 -0
- package/tree/vars.d.ts +20 -0
- package/tree/vars.js +20 -0
- package/tree-select/TreeSelect.d.ts +6 -0
- package/tree-select/TreeSelect.js +509 -0
- package/tree-select/index.d.ts +2 -0
- package/tree-select/index.js +1 -0
- package/tree-select/internal/TreeSelectSearchPanel.d.ts +22 -0
- package/tree-select/internal/TreeSelectSearchPanel.js +73 -0
- package/tree-select/internal/types.d.ts +8 -0
- package/tree-select/internal/types.js +1 -0
- package/tree-select/types.d.ts +48 -0
- package/tree-select/types.js +1 -0
- package/tree-select/vars.d.ts +37 -0
- package/tree-select/vars.js +37 -0
- package/types.d.ts +21 -0
- package/types.js +1 -0
- package/upload/Upload.d.ts +19 -0
- package/upload/Upload.js +203 -0
- package/upload/UploadAction.d.ts +3 -0
- package/upload/UploadAction.js +44 -0
- package/upload/UploadButton.d.ts +3 -0
- package/upload/UploadButton.js +31 -0
- package/upload/UploadList.d.ts +3 -0
- package/upload/UploadList.js +62 -0
- package/upload/UploadPicture.d.ts +3 -0
- package/upload/UploadPicture.js +72 -0
- package/upload/UploadPictureList.d.ts +3 -0
- package/upload/UploadPictureList.js +62 -0
- package/upload/UploadPreviewAction.d.ts +3 -0
- package/upload/UploadPreviewAction.js +32 -0
- package/upload/index.d.ts +2 -0
- package/upload/index.js +1 -0
- package/upload/types.d.ts +78 -0
- package/upload/types.js +1 -0
- package/upload/vars.d.ts +65 -0
- package/upload/vars.js +65 -0
- package/utils/handleModalKeyDown.d.ts +2 -0
- package/utils/handleModalKeyDown.js +17 -0
- package/utils/index.d.ts +6 -0
- package/utils/index.js +6 -0
- package/utils/isPrintableCharacter.d.ts +1 -0
- package/utils/isPrintableCharacter.js +3 -0
- package/utils/mergeCS.d.ts +11 -0
- package/utils/mergeCS.js +6 -0
- package/utils/position/getHorizontalSidePosition.d.ts +14 -0
- package/utils/position/getHorizontalSidePosition.js +22 -0
- package/utils/position/getPopupPosition.d.ts +18 -0
- package/utils/position/getPopupPosition.js +170 -0
- package/utils/position/getVerticalSidePosition.d.ts +17 -0
- package/utils/position/getVerticalSidePosition.js +43 -0
- package/vars.d.ts +5 -0
- package/vars.js +5 -0
- package/virtual-scroll/VirtualScroll.d.ts +5 -0
- package/virtual-scroll/VirtualScroll.js +430 -0
- package/virtual-scroll/index.d.ts +2 -0
- package/virtual-scroll/index.js +1 -0
- package/virtual-scroll/types.d.ts +34 -0
- package/virtual-scroll/types.js +1 -0
- package/virtual-scroll/vars.d.ts +1 -0
- package/virtual-scroll/vars.js +1 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { checkNodeExist } from '@laser-ui/utils';
|
|
4
|
+
import { CLASSES } from './vars';
|
|
5
|
+
import { useComponentProps, useStyled } from '../hooks';
|
|
6
|
+
import { mergeCS } from '../utils';
|
|
7
|
+
export function Separator(props) {
|
|
8
|
+
const _a = useComponentProps('Separator', props), { children, styleOverrides, styleProvider, textAlign = 'left', vertical = false } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "textAlign", "vertical"]);
|
|
9
|
+
const styled = useStyled(CLASSES, { separator: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.separator }, styleOverrides);
|
|
10
|
+
const hasText = checkNodeExist(children);
|
|
11
|
+
return (_jsx("div", Object.assign({}, restProps, mergeCS(styled('separator', {
|
|
12
|
+
'separator--text': hasText,
|
|
13
|
+
[`separator--text-${textAlign}`]: hasText,
|
|
14
|
+
'separator--vertical': vertical,
|
|
15
|
+
}), {
|
|
16
|
+
className: restProps.className,
|
|
17
|
+
style: restProps.style,
|
|
18
|
+
}), { role: "separator", "aria-orientation": vertical ? 'vertical' : 'horizontal', children: hasText && _jsx("div", Object.assign({}, styled('separator__text'), { children: children })) })));
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Separator } from './Separator';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { BaseProps } from '../types';
|
|
4
|
+
export {};
|
|
5
|
+
export interface SeparatorProps extends BaseProps<'separator', typeof CLASSES>, React.HTMLAttributes<HTMLElement> {
|
|
6
|
+
textAlign?: 'left' | 'right' | 'center';
|
|
7
|
+
vertical?: boolean;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
separator: '^separator',
|
|
3
|
+
'separator--text': '^separator--text',
|
|
4
|
+
'separator--text-left': '^separator--text-left',
|
|
5
|
+
'separator--text-right': '^separator--text-right',
|
|
6
|
+
'separator--text-center': '^separator--text-center',
|
|
7
|
+
'separator--vertical': '^separator--vertical',
|
|
8
|
+
separator__text: '^separator__text',
|
|
9
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { mergeCS } from '../utils';
|
|
6
|
+
export function Skeleton(props) {
|
|
7
|
+
const _a = useComponentProps('Skeleton', props), { children, styleOverrides, styleProvider, pattern = 'text' } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "pattern"]);
|
|
8
|
+
const styled = useStyled(CLASSES, { skeleton: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.skeleton }, styleOverrides);
|
|
9
|
+
return (_jsx("div", Object.assign({}, restProps, mergeCS(styled('skeleton', `skeleton--${pattern}`), {
|
|
10
|
+
className: restProps.className,
|
|
11
|
+
style: restProps.style,
|
|
12
|
+
}), { children: children })));
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Skeleton } from './Skeleton';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { BaseProps } from '../types';
|
|
4
|
+
export {};
|
|
5
|
+
export interface SkeletonProps extends BaseProps<'skeleton', typeof CLASSES>, React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
pattern?: 'text' | 'circular' | 'rect';
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/skeleton/vars.js
ADDED
package/slider/Slider.js
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
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 { useEvent, useRefExtra } from '@laser-ui/hooks';
|
|
5
|
+
import { isArray, isNull, isNumber, toNumber } from 'lodash';
|
|
6
|
+
import { useEffect, useRef, useState } from 'react';
|
|
7
|
+
import { CLASSES } from './vars';
|
|
8
|
+
import { useComponentProps, useControlled, useDesign, useScopedProps, useStyled } from '../hooks';
|
|
9
|
+
import { Tooltip } from '../tooltip';
|
|
10
|
+
import { mergeCS } from '../utils';
|
|
11
|
+
export function Slider(props) {
|
|
12
|
+
const _a = useComponentProps('Slider', props), { styleOverrides, styleProvider, formControl, model, defaultModel, max = 100, min = 0, step = 1, range = false, rangeMinDistance, rangeThumbDraggable = false, tooltip, customTooltip, marks, vertical = false, reverse = false, disabled: disabledProp = false, inputRef, inputRender, onModelChange } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "formControl", "model", "defaultModel", "max", "min", "step", "range", "rangeMinDistance", "rangeThumbDraggable", "tooltip", "customTooltip", "marks", "vertical", "reverse", "disabled", "inputRef", "inputRender", "onModelChange"]);
|
|
13
|
+
const styled = useStyled(CLASSES, { slider: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.slider }, styleOverrides);
|
|
14
|
+
const sliderRef = useRef(null);
|
|
15
|
+
const dotLeftRef = useRef(null);
|
|
16
|
+
const dotRightRef = useRef(null);
|
|
17
|
+
const tooltipLeftRef = useRef(null);
|
|
18
|
+
const tooltipRightRef = useRef(null);
|
|
19
|
+
const windowRef = useRefExtra(() => window);
|
|
20
|
+
const [dotFocused, setDotFocused] = useState(null);
|
|
21
|
+
const [dotVisible, setDotVisible] = useState(null);
|
|
22
|
+
const [dotDraggable, setDotDraggable] = useState(null);
|
|
23
|
+
const [thumbDraggingPoint, setThumbDraggingPoint] = useState(null);
|
|
24
|
+
const [value, changeValue] = useControlled(defaultModel !== null && defaultModel !== void 0 ? defaultModel : (range ? [0, 0] : 0), model, onModelChange, (a, b) => {
|
|
25
|
+
if (isNumber(a) && isNumber(b)) {
|
|
26
|
+
return a === b;
|
|
27
|
+
}
|
|
28
|
+
else if (isArray(a) && isArray(b)) {
|
|
29
|
+
return a[0] === b[0] && a[1] === b[1];
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}, formControl === null || formControl === void 0 ? void 0 : formControl.control);
|
|
33
|
+
const [valueLeft, valueRight = 0] = (range ? value : [value]);
|
|
34
|
+
const [visibleLeft, visibleRight] = (() => {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
if (range) {
|
|
37
|
+
return [
|
|
38
|
+
(_a = tooltip === null || tooltip === void 0 ? void 0 : tooltip[0]) !== null && _a !== void 0 ? _a : (dotVisible === 'left' ? true : !!(dotFocused === 'left' || thumbDraggingPoint)),
|
|
39
|
+
(_b = tooltip === null || tooltip === void 0 ? void 0 : tooltip[1]) !== null && _b !== void 0 ? _b : (dotVisible === 'right' ? true : !!(dotFocused === 'right' || thumbDraggingPoint)),
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return [tooltip !== null && tooltip !== void 0 ? tooltip : (dotVisible === 'left' ? true : !!(dotFocused === 'left' || thumbDraggingPoint)), false];
|
|
44
|
+
}
|
|
45
|
+
})();
|
|
46
|
+
const { disabled } = useScopedProps({ disabled: disabledProp || (formControl === null || formControl === void 0 ? void 0 : formControl.control.disabled) });
|
|
47
|
+
const getValue = (value, func = 'round') => {
|
|
48
|
+
let newValue = null;
|
|
49
|
+
if (step) {
|
|
50
|
+
const n = Math[func](value / step);
|
|
51
|
+
newValue = Math.min(max, Math.max(min, n * step));
|
|
52
|
+
}
|
|
53
|
+
if (isArray(marks)) {
|
|
54
|
+
let min = newValue ? Math.abs(newValue - value) : Infinity;
|
|
55
|
+
if (min > 0) {
|
|
56
|
+
for (const mark of marks) {
|
|
57
|
+
const v = isNumber(mark) ? mark : mark.value;
|
|
58
|
+
if (func === 'round' || (func === 'ceil' && v - value >= 0) || (func === 'floor' && v - value <= 0)) {
|
|
59
|
+
const offset = Math.abs(v - value);
|
|
60
|
+
if (offset < min) {
|
|
61
|
+
min = offset;
|
|
62
|
+
newValue = v;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return newValue !== null && newValue !== void 0 ? newValue : min;
|
|
69
|
+
};
|
|
70
|
+
const handleMove = (e, isLeft) => {
|
|
71
|
+
isLeft = isLeft !== null && isLeft !== void 0 ? isLeft : dotFocused === 'left';
|
|
72
|
+
if (sliderRef.current) {
|
|
73
|
+
const rect = sliderRef.current.getBoundingClientRect();
|
|
74
|
+
const newValue = getValue((max - min) *
|
|
75
|
+
(vertical
|
|
76
|
+
? (reverse ? e.clientY - rect.top : rect.bottom - e.clientY) / rect.height
|
|
77
|
+
: (reverse ? rect.right - e.clientX : e.clientX - rect.left) / rect.width));
|
|
78
|
+
if (range) {
|
|
79
|
+
changeValue((draft) => {
|
|
80
|
+
const index = isLeft ? 0 : 1;
|
|
81
|
+
if (draft[index] !== newValue) {
|
|
82
|
+
const offset = newValue - draft[index];
|
|
83
|
+
const isAdd = offset > 0;
|
|
84
|
+
draft[index] = newValue;
|
|
85
|
+
if (isNumber(rangeMinDistance) && draft[1] - draft[0] < rangeMinDistance) {
|
|
86
|
+
const _index = isLeft ? 1 : 0;
|
|
87
|
+
draft[_index] = getValue(draft[_index] + offset, isAdd ? 'ceil' : 'floor');
|
|
88
|
+
if (draft[1] - draft[0] < rangeMinDistance) {
|
|
89
|
+
draft[index] = getValue(draft[_index] + (isAdd ? -rangeMinDistance : rangeMinDistance), isAdd ? 'floor' : 'ceil');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
changeValue(newValue);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const handleThumbMove = (e) => {
|
|
101
|
+
if (step && thumbDraggingPoint && sliderRef.current) {
|
|
102
|
+
const rect = sliderRef.current.getBoundingClientRect();
|
|
103
|
+
const offset = Math.round(((max - min) *
|
|
104
|
+
(vertical
|
|
105
|
+
? (reverse ? e.clientY - thumbDraggingPoint.clientY : thumbDraggingPoint.clientY - e.clientY) / rect.height
|
|
106
|
+
: (reverse ? thumbDraggingPoint.clientX - e.clientX : e.clientX - thumbDraggingPoint.clientX) / rect.width)) /
|
|
107
|
+
step) * step;
|
|
108
|
+
const value = [0, 0];
|
|
109
|
+
let index = -1;
|
|
110
|
+
for (const v of [thumbDraggingPoint.left + offset, thumbDraggingPoint.right + offset]) {
|
|
111
|
+
index += 1;
|
|
112
|
+
const _index = index === 0 ? 1 : 0;
|
|
113
|
+
if (v < min) {
|
|
114
|
+
value[index] = min;
|
|
115
|
+
value[_index] = min + Math.abs(thumbDraggingPoint.left - thumbDraggingPoint.right);
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
if (v > max) {
|
|
119
|
+
value[index] = max;
|
|
120
|
+
value[_index] = max - Math.abs(thumbDraggingPoint.left - thumbDraggingPoint.right);
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
value[index] = v;
|
|
124
|
+
}
|
|
125
|
+
changeValue(value);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const startDrag = (e) => {
|
|
129
|
+
const handle = (isLeft = true) => {
|
|
130
|
+
const el = isLeft ? dotLeftRef.current : dotRightRef.current;
|
|
131
|
+
if (el) {
|
|
132
|
+
handleMove(e, isLeft);
|
|
133
|
+
setDotDraggable(isLeft ? 'left' : 'right');
|
|
134
|
+
el.firstElementChild.focus({ preventScroll: true });
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
if (range) {
|
|
138
|
+
if (dotLeftRef.current && dotRightRef.current) {
|
|
139
|
+
const rectLeft = dotLeftRef.current.getBoundingClientRect();
|
|
140
|
+
const rectRight = dotRightRef.current.getBoundingClientRect();
|
|
141
|
+
const offsetLeft = vertical
|
|
142
|
+
? Math.abs(rectLeft.bottom - rectLeft.height / 2 - e.clientY)
|
|
143
|
+
: Math.abs(e.clientX - (rectLeft.left + rectLeft.width / 2));
|
|
144
|
+
const offsetRight = vertical
|
|
145
|
+
? Math.abs(rectRight.bottom - rectRight.height / 2 - e.clientY)
|
|
146
|
+
: Math.abs(e.clientX - (rectRight.left + rectRight.width / 2));
|
|
147
|
+
if (rangeThumbDraggable &&
|
|
148
|
+
(vertical ? e.clientY < Math.max(rectLeft.top, rectRight.top) : e.clientX > Math.min(rectLeft.right, rectRight.right)) &&
|
|
149
|
+
(vertical ? e.clientY > Math.min(rectLeft.bottom, rectRight.bottom) : e.clientX < Math.max(rectLeft.left, rectRight.left))) {
|
|
150
|
+
setThumbDraggingPoint({ left: valueLeft, right: valueRight, clientX: e.clientX, clientY: e.clientY });
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
if (offsetRight <= offsetLeft) {
|
|
154
|
+
handle(false);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
handle(true);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
handle(true);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
useEffect(() => {
|
|
167
|
+
var _a, _b, _c, _d;
|
|
168
|
+
if (thumbDraggingPoint) {
|
|
169
|
+
(_a = tooltipLeftRef.current) === null || _a === void 0 ? void 0 : _a.updatePosition();
|
|
170
|
+
(_b = tooltipRightRef.current) === null || _b === void 0 ? void 0 : _b.updatePosition();
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
if (dotFocused === 'left') {
|
|
174
|
+
(_c = tooltipLeftRef.current) === null || _c === void 0 ? void 0 : _c.updatePosition();
|
|
175
|
+
}
|
|
176
|
+
else if (dotFocused === 'right') {
|
|
177
|
+
(_d = tooltipRightRef.current) === null || _d === void 0 ? void 0 : _d.updatePosition();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}, [value, dotFocused, thumbDraggingPoint]);
|
|
181
|
+
const listenDragEvent = !isNull(dotDraggable) || !isNull(thumbDraggingPoint);
|
|
182
|
+
useEvent(windowRef, 'touchmove', (e) => {
|
|
183
|
+
if (!isNull(dotDraggable)) {
|
|
184
|
+
e.preventDefault();
|
|
185
|
+
handleMove({ clientX: e.touches[0].clientX, clientY: e.touches[0].clientY });
|
|
186
|
+
}
|
|
187
|
+
if (!isNull(thumbDraggingPoint)) {
|
|
188
|
+
e.preventDefault();
|
|
189
|
+
handleThumbMove({ clientX: e.touches[0].clientX, clientY: e.touches[0].clientY });
|
|
190
|
+
}
|
|
191
|
+
}, { passive: false }, !listenDragEvent);
|
|
192
|
+
useEvent(windowRef, 'mousemove', (e) => {
|
|
193
|
+
if (!isNull(dotDraggable)) {
|
|
194
|
+
e.preventDefault();
|
|
195
|
+
handleMove({ clientX: e.clientX, clientY: e.clientY });
|
|
196
|
+
}
|
|
197
|
+
if (!isNull(thumbDraggingPoint)) {
|
|
198
|
+
e.preventDefault();
|
|
199
|
+
handleThumbMove({ clientX: e.clientX, clientY: e.clientY });
|
|
200
|
+
}
|
|
201
|
+
}, {}, !listenDragEvent);
|
|
202
|
+
useEvent(windowRef, 'mouseup', () => {
|
|
203
|
+
setDotDraggable(null);
|
|
204
|
+
setThumbDraggingPoint(null);
|
|
205
|
+
}, {}, !listenDragEvent);
|
|
206
|
+
const markNodes = (() => {
|
|
207
|
+
const nodes = [];
|
|
208
|
+
const getNode = (value, label = null) => {
|
|
209
|
+
let percentage = (value / (max - min)) * 100;
|
|
210
|
+
if (reverse) {
|
|
211
|
+
percentage = 100 - percentage;
|
|
212
|
+
}
|
|
213
|
+
nodes.push(_createElement("div", Object.assign({}, mergeCS(styled('slider__mark', {
|
|
214
|
+
'slider__mark--hidden': value === min || value === max,
|
|
215
|
+
}), {
|
|
216
|
+
style: {
|
|
217
|
+
left: vertical ? undefined : `${percentage}%`,
|
|
218
|
+
bottom: vertical ? `${percentage}%` : undefined,
|
|
219
|
+
},
|
|
220
|
+
}), { key: value }), label && (_createElement("div", Object.assign({}, styled('slider__mark-label', {
|
|
221
|
+
'slider__mark-label.is-active': range
|
|
222
|
+
? value <= Math.max(valueLeft, valueRight) && value >= Math.min(valueLeft, valueRight)
|
|
223
|
+
: value <= valueLeft,
|
|
224
|
+
}), { key: value }), label))));
|
|
225
|
+
};
|
|
226
|
+
if (isArray(marks)) {
|
|
227
|
+
marks.forEach((mark) => {
|
|
228
|
+
const value = isNumber(mark) ? mark : mark.value;
|
|
229
|
+
getNode(value, isNumber(mark) ? null : mark.label);
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
else if (isNumber(marks)) {
|
|
233
|
+
for (let index = 0; index < (max - min) / marks; index++) {
|
|
234
|
+
const value = index * marks;
|
|
235
|
+
getNode(value);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return nodes;
|
|
239
|
+
})();
|
|
240
|
+
const getDotNode = (isLeft) => {
|
|
241
|
+
const value = isLeft ? valueLeft : valueRight;
|
|
242
|
+
const render = (inputRender !== null && inputRender !== void 0 ? inputRender : [])[isLeft ? 0 : 1];
|
|
243
|
+
const inputNode = (_jsx("input", Object.assign({}, styled('slider__input'), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria, { ref: isLeft ? inputRef === null || inputRef === void 0 ? void 0 : inputRef[0] : inputRef === null || inputRef === void 0 ? void 0 : inputRef[1], type: "range", value: value, max: max, min: min, step: step !== null && step !== void 0 ? step : undefined, disabled: disabled, "aria-orientation": vertical ? 'vertical' : 'horizontal', onChange: (e) => {
|
|
244
|
+
const val = toNumber(e.currentTarget.value);
|
|
245
|
+
if (range) {
|
|
246
|
+
const index = isLeft ? 0 : 1;
|
|
247
|
+
changeValue((draft) => {
|
|
248
|
+
const offset = val - draft[index];
|
|
249
|
+
const isAdd = offset > 0;
|
|
250
|
+
draft[index] = val;
|
|
251
|
+
if (isNumber(rangeMinDistance) && draft[1] - draft[0] < rangeMinDistance) {
|
|
252
|
+
const _index = isLeft ? 1 : 0;
|
|
253
|
+
draft[_index] = getValue(draft[_index] + offset, isAdd ? 'ceil' : 'floor');
|
|
254
|
+
if (draft[1] - draft[0] < rangeMinDistance) {
|
|
255
|
+
draft[index] = getValue(draft[_index] + (isAdd ? -rangeMinDistance : rangeMinDistance), isAdd ? 'floor' : 'ceil');
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
changeValue(val);
|
|
262
|
+
}
|
|
263
|
+
}, onFocus: () => {
|
|
264
|
+
setDotFocused(isLeft ? 'left' : 'right');
|
|
265
|
+
}, onBlur: () => {
|
|
266
|
+
setDotFocused(null);
|
|
267
|
+
} })));
|
|
268
|
+
return (_jsx(Tooltip, { ref: isLeft ? tooltipLeftRef : tooltipRightRef, visible: isLeft ? visibleLeft : visibleRight, title: customTooltip ? customTooltip(value) : value, placement: vertical ? 'right' : 'top', onVisibleChange: (visible) => {
|
|
269
|
+
setDotVisible(visible ? (isLeft ? 'left' : 'right') : null);
|
|
270
|
+
}, children: _jsx("div", Object.assign({}, mergeCS(styled('slider__input-wrapper'), {
|
|
271
|
+
style: {
|
|
272
|
+
left: vertical ? undefined : `calc(${value} / ${max - min} * 100% - 7px)`,
|
|
273
|
+
bottom: vertical ? `calc(${value} / ${max - min} * 100% - 7px)` : undefined,
|
|
274
|
+
},
|
|
275
|
+
}), { ref: isLeft ? dotLeftRef : dotRightRef, children: render ? render(inputNode) : inputNode })) }));
|
|
276
|
+
};
|
|
277
|
+
const preventBlur = (e) => {
|
|
278
|
+
if (e.button === 0) {
|
|
279
|
+
e.preventDefault();
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
const designProps = useDesign({ form: formControl });
|
|
283
|
+
return (_jsxs("div", Object.assign({}, restProps, mergeCS(styled('slider', `slider--${vertical ? 'vertical' : 'horizontal'}`, {
|
|
284
|
+
'slider.is-disabled': disabled,
|
|
285
|
+
}), {
|
|
286
|
+
className: restProps.className,
|
|
287
|
+
style: restProps.style,
|
|
288
|
+
}), designProps, { ref: sliderRef, onMouseDown: (e) => {
|
|
289
|
+
var _a;
|
|
290
|
+
(_a = restProps.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
291
|
+
preventBlur(e);
|
|
292
|
+
if (e.button === 0) {
|
|
293
|
+
startDrag(e);
|
|
294
|
+
}
|
|
295
|
+
}, onMouseUp: (e) => {
|
|
296
|
+
var _a;
|
|
297
|
+
(_a = restProps.onMouseUp) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
298
|
+
preventBlur(e);
|
|
299
|
+
}, onTouchStart: (e) => {
|
|
300
|
+
var _a;
|
|
301
|
+
(_a = restProps.onTouchStart) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
302
|
+
startDrag({ clientX: e.touches[0].clientX, clientY: e.touches[0].clientY });
|
|
303
|
+
}, onTouchEnd: (e) => {
|
|
304
|
+
var _a;
|
|
305
|
+
(_a = restProps.onTouchEnd) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
306
|
+
setDotDraggable(null);
|
|
307
|
+
setThumbDraggingPoint(null);
|
|
308
|
+
}, children: [_jsxs("div", Object.assign({}, styled('slider__track', {
|
|
309
|
+
'slider__track--reverse': reverse,
|
|
310
|
+
}), { children: [_jsx("div", Object.assign({}, mergeCS(styled('slider__thumb', {
|
|
311
|
+
'slider__thumb.is-focused': thumbDraggingPoint,
|
|
312
|
+
'slider__thumb--draggable': rangeThumbDraggable,
|
|
313
|
+
}), {
|
|
314
|
+
style: vertical
|
|
315
|
+
? {
|
|
316
|
+
bottom: `calc(${Math.min(valueLeft, valueRight)} / ${max - min} * 100%)`,
|
|
317
|
+
top: `calc(${max - Math.max(valueLeft, valueRight)} / ${max - min} * 100%)`,
|
|
318
|
+
}
|
|
319
|
+
: {
|
|
320
|
+
left: `calc(${Math.min(valueLeft, valueRight)} / ${max - min} * 100%)`,
|
|
321
|
+
right: `calc(${max - Math.max(valueLeft, valueRight)} / ${max - min} * 100%)`,
|
|
322
|
+
},
|
|
323
|
+
}))), getDotNode(true), range && getDotNode(false)] })), markNodes] })));
|
|
324
|
+
}
|
package/slider/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Slider } from './Slider';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { FormControlProvider } from '../form/types';
|
|
4
|
+
import type { BaseProps, CloneHTMLElement } from '../types';
|
|
5
|
+
export {};
|
|
6
|
+
export interface SliderProps extends BaseProps<'slider', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
7
|
+
formControl?: FormControlProvider;
|
|
8
|
+
model?: number | [number, number];
|
|
9
|
+
defaultModel?: number | [number, number];
|
|
10
|
+
max?: number;
|
|
11
|
+
min?: number;
|
|
12
|
+
step?: number | null;
|
|
13
|
+
range?: boolean;
|
|
14
|
+
rangeMinDistance?: number;
|
|
15
|
+
rangeThumbDraggable?: boolean;
|
|
16
|
+
tooltip?: boolean | [boolean?, boolean?];
|
|
17
|
+
customTooltip?: (value: number) => React.ReactNode;
|
|
18
|
+
marks?: number | ({
|
|
19
|
+
value: number;
|
|
20
|
+
label: React.ReactNode;
|
|
21
|
+
} | number)[];
|
|
22
|
+
vertical?: boolean;
|
|
23
|
+
reverse?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
inputRef?: [React.ForwardedRef<HTMLInputElement>?, React.ForwardedRef<HTMLInputElement>?];
|
|
26
|
+
inputRender?: [CloneHTMLElement?, CloneHTMLElement?];
|
|
27
|
+
onModelChange?: (value: any) => void;
|
|
28
|
+
}
|
package/slider/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/slider/vars.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
slider: string;
|
|
3
|
+
'slider.is-disabled': string;
|
|
4
|
+
'slider--horizontal': string;
|
|
5
|
+
'slider--vertical': string;
|
|
6
|
+
slider__track: string;
|
|
7
|
+
'slider__track--reverse': string;
|
|
8
|
+
slider__thumb: string;
|
|
9
|
+
'slider__thumb.is-focused': string;
|
|
10
|
+
'slider__thumb--draggable': string;
|
|
11
|
+
slider__mark: string;
|
|
12
|
+
'slider__mark--hidden': string;
|
|
13
|
+
'slider__mark-label': string;
|
|
14
|
+
'slider__mark-label.is-active': string;
|
|
15
|
+
'slider__input-wrapper': string;
|
|
16
|
+
slider__input: string;
|
|
17
|
+
};
|
package/slider/vars.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
slider: '^slider',
|
|
3
|
+
'slider.is-disabled': 'is-disabled',
|
|
4
|
+
'slider--horizontal': '^slider--horizontal',
|
|
5
|
+
'slider--vertical': '^slider--vertical',
|
|
6
|
+
slider__track: '^slider__track',
|
|
7
|
+
'slider__track--reverse': '^slider__track--reverse',
|
|
8
|
+
slider__thumb: '^slider__thumb',
|
|
9
|
+
'slider__thumb.is-focused': 'is-focused',
|
|
10
|
+
'slider__thumb--draggable': '^slider__thumb--draggable',
|
|
11
|
+
slider__mark: '^slider__mark',
|
|
12
|
+
'slider__mark--hidden': '^slider__mark--hidden',
|
|
13
|
+
'slider__mark-label': '^slider__mark-label',
|
|
14
|
+
'slider__mark-label.is-active': 'is-active',
|
|
15
|
+
'slider__input-wrapper': '^slider__input-wrapper',
|
|
16
|
+
slider__input: '^slider__input',
|
|
17
|
+
};
|