@bioturing/components 0.31.0 → 0.32.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/dist/components/badge/component.d.ts +7 -0
- package/dist/components/badge/component.d.ts.map +1 -0
- package/dist/components/badge/component.js.map +1 -1
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.d.ts.map +1 -0
- package/dist/components/breadcrumb/component.d.ts +6 -0
- package/dist/components/breadcrumb/component.d.ts.map +1 -0
- package/dist/components/breadcrumb/component.js.map +1 -1
- package/dist/components/breadcrumb/index.d.ts +3 -0
- package/dist/components/breadcrumb/index.d.ts.map +1 -0
- package/dist/components/breadcrumb/types.d.ts +19 -0
- package/dist/components/breadcrumb/types.d.ts.map +1 -0
- package/dist/components/breadcrumb/useItemRender.d.ts +7 -0
- package/dist/components/breadcrumb/useItemRender.d.ts.map +1 -0
- package/dist/components/breadcrumb/useItemRender.js.map +1 -1
- package/dist/components/button/component.d.ts +14 -0
- package/dist/components/button/component.d.ts.map +1 -0
- package/dist/components/button/component.js.map +1 -1
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.d.ts.map +1 -0
- package/dist/components/checkbox/component.d.ts +16 -0
- package/dist/components/checkbox/component.d.ts.map +1 -0
- package/dist/components/checkbox/component.js.map +1 -1
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.d.ts.map +1 -0
- package/dist/components/choice-list/component.d.ts +35 -0
- package/dist/components/choice-list/component.d.ts.map +1 -0
- package/dist/components/choice-list/component.js.map +1 -1
- package/dist/components/choice-list/index.d.ts +2 -0
- package/dist/components/choice-list/index.d.ts.map +1 -0
- package/dist/components/cmdk/command-score.d.ts +2 -0
- package/dist/components/cmdk/command-score.d.ts.map +1 -0
- package/dist/components/cmdk/command-score.js.map +1 -1
- package/dist/components/cmdk/index.d.ts +440 -0
- package/dist/components/cmdk/index.d.ts.map +1 -0
- package/dist/components/cmdk/index.js +332 -348
- package/dist/components/cmdk/index.js.map +1 -1
- package/dist/components/code-block/component.d.ts +3 -0
- package/dist/components/code-block/component.d.ts.map +1 -0
- package/dist/components/code-block/component.js +83 -84
- package/dist/components/code-block/component.js.map +1 -1
- package/dist/components/code-block/index.d.ts +3 -0
- package/dist/components/code-block/index.d.ts.map +1 -0
- package/dist/components/code-block/types.d.ts +64 -0
- package/dist/components/code-block/types.d.ts.map +1 -0
- package/dist/components/collapse/component.d.ts +14 -0
- package/dist/components/collapse/component.d.ts.map +1 -0
- package/dist/components/collapse/component.js.map +1 -1
- package/dist/components/collapse/index.d.ts +2 -0
- package/dist/components/collapse/index.d.ts.map +1 -0
- package/dist/components/color-select/component.d.ts +36 -0
- package/dist/components/color-select/component.d.ts.map +1 -0
- package/dist/components/color-select/component.js +28 -30
- package/dist/components/color-select/component.js.map +1 -1
- package/dist/components/color-select/index.d.ts +2 -0
- package/dist/components/color-select/index.d.ts.map +1 -0
- package/dist/components/combobox/component.d.ts +119 -0
- package/dist/components/combobox/component.d.ts.map +1 -0
- package/dist/components/combobox/component.js +166 -162
- package/dist/components/combobox/component.js.map +1 -1
- package/dist/components/combobox/index.d.ts +3 -0
- package/dist/components/combobox/index.d.ts.map +1 -0
- package/dist/components/command-palette/component.d.ts +41 -0
- package/dist/components/command-palette/component.d.ts.map +1 -0
- package/dist/components/command-palette/component.js +36 -36
- package/dist/components/command-palette/component.js.map +1 -1
- package/dist/components/command-palette/index.d.ts +2 -0
- package/dist/components/command-palette/index.d.ts.map +1 -0
- package/dist/components/command-palette/style.css +1 -1
- package/dist/components/drag-drop/context.d.ts +10 -0
- package/dist/components/drag-drop/context.d.ts.map +1 -0
- package/dist/components/drag-drop/context.js.map +1 -1
- package/dist/components/drag-drop/draggable.d.ts +6 -0
- package/dist/components/drag-drop/draggable.d.ts.map +1 -0
- package/dist/components/drag-drop/draggable.js.map +1 -1
- package/dist/components/drag-drop/droppable.d.ts +9 -0
- package/dist/components/drag-drop/droppable.d.ts.map +1 -0
- package/dist/components/drag-drop/droppable.js.map +1 -1
- package/dist/components/drag-drop/hooks.d.ts +42 -0
- package/dist/components/drag-drop/hooks.d.ts.map +1 -0
- package/dist/components/drag-drop/hooks.js +71 -73
- package/dist/components/drag-drop/hooks.js.map +1 -1
- package/dist/components/drag-drop/index.d.ts +26 -0
- package/dist/components/drag-drop/index.d.ts.map +1 -0
- package/dist/components/drag-drop/index.js.map +1 -1
- package/dist/components/drag-drop/types.d.ts +232 -0
- package/dist/components/drag-drop/types.d.ts.map +1 -0
- package/dist/components/drag-drop/value.d.ts +8 -0
- package/dist/components/drag-drop/value.d.ts.map +1 -0
- package/dist/components/drag-drop/value.js +66 -66
- package/dist/components/drag-drop/value.js.map +1 -1
- package/dist/components/dropdown-menu/component.d.ts +79 -0
- package/dist/components/dropdown-menu/component.d.ts.map +1 -0
- package/dist/components/dropdown-menu/component.js +108 -106
- package/dist/components/dropdown-menu/component.js.map +1 -1
- package/dist/components/dropdown-menu/divider.d.ts +6 -0
- package/dist/components/dropdown-menu/divider.d.ts.map +1 -0
- package/dist/components/dropdown-menu/divider.js.map +1 -1
- package/dist/components/dropdown-menu/index.d.ts +4 -0
- package/dist/components/dropdown-menu/index.d.ts.map +1 -0
- package/dist/components/dropdown-menu/item.d.ts +56 -0
- package/dist/components/dropdown-menu/item.d.ts.map +1 -0
- package/dist/components/dropdown-menu/item.js +72 -66
- package/dist/components/dropdown-menu/item.js.map +1 -1
- package/dist/components/dropdown-menu/types.d.ts +88 -0
- package/dist/components/dropdown-menu/types.d.ts.map +1 -0
- package/dist/components/dropdown-menu/useDropdownMenu.d.ts +58 -0
- package/dist/components/dropdown-menu/useDropdownMenu.d.ts.map +1 -0
- package/dist/components/dropdown-menu/useDropdownMenu.js +80 -77
- package/dist/components/dropdown-menu/useDropdownMenu.js.map +1 -1
- package/dist/components/ds-root/component.d.ts +14 -0
- package/dist/components/ds-root/component.d.ts.map +1 -0
- package/dist/components/ds-root/component.js.map +1 -1
- package/dist/components/ds-root/context.d.ts +8 -0
- package/dist/components/ds-root/context.d.ts.map +1 -0
- package/dist/components/ds-root/index.d.ts +3 -0
- package/dist/components/ds-root/index.d.ts.map +1 -0
- package/dist/components/empty/component.d.ts +13 -0
- package/dist/components/empty/component.d.ts.map +1 -0
- package/dist/components/empty/component.js.map +1 -1
- package/dist/components/empty/index.d.ts +2 -0
- package/dist/components/empty/index.d.ts.map +1 -0
- package/dist/components/field/component.d.ts +42 -0
- package/dist/components/field/component.d.ts.map +1 -0
- package/dist/components/field/component.js.map +1 -1
- package/dist/components/field/index.d.ts +2 -0
- package/dist/components/field/index.d.ts.map +1 -0
- package/dist/components/form/component.d.ts +22 -0
- package/dist/components/form/component.d.ts.map +1 -0
- package/dist/components/form/component.js.map +1 -1
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.d.ts.map +1 -0
- package/dist/components/form/item.d.ts +24 -0
- package/dist/components/form/item.d.ts.map +1 -0
- package/dist/components/form/item.js +24 -24
- package/dist/components/form/item.js.map +1 -1
- package/dist/components/form/label.d.ts +32 -0
- package/dist/components/form/label.d.ts.map +1 -0
- package/dist/components/form/label.js.map +1 -1
- package/dist/components/hooks/antd.d.ts +11 -0
- package/dist/components/hooks/antd.d.ts.map +1 -0
- package/dist/components/hooks/antd.js.map +1 -1
- package/dist/components/hooks/base-ui.d.ts +11 -0
- package/dist/components/hooks/base-ui.d.ts.map +1 -0
- package/dist/components/hooks/base-ui.js +22 -25
- package/dist/components/hooks/base-ui.js.map +1 -1
- package/dist/components/hooks/index.d.ts +11 -0
- package/dist/components/hooks/index.d.ts.map +1 -0
- package/dist/components/hooks/useBreakpoint.d.ts +39 -0
- package/dist/components/hooks/useBreakpoint.d.ts.map +1 -0
- package/dist/components/hooks/useBreakpoint.js +14 -15
- package/dist/components/hooks/useBreakpoint.js.map +1 -1
- package/dist/components/hooks/useCSSVariables.d.ts +7 -0
- package/dist/components/hooks/useCSSVariables.d.ts.map +1 -0
- package/dist/components/hooks/useCSSVariables.js.map +1 -1
- package/dist/components/hooks/useCharts.d.ts +41 -0
- package/dist/components/hooks/useCharts.d.ts.map +1 -0
- package/dist/components/hooks/useCharts.js.map +1 -1
- package/dist/components/hooks/useControlledState.d.ts +13 -0
- package/dist/components/hooks/useControlledState.d.ts.map +1 -0
- package/dist/components/hooks/useControlledState.js.map +1 -1
- package/dist/components/hooks/useDraggable.d.ts +4 -0
- package/dist/components/hooks/useDraggable.d.ts.map +1 -0
- package/dist/components/hooks/useDraggable.js +19 -20
- package/dist/components/hooks/useDraggable.js.map +1 -1
- package/dist/components/hooks/useHover.d.ts +5 -0
- package/dist/components/hooks/useHover.d.ts.map +1 -0
- package/dist/components/hooks/useHover.js +16 -17
- package/dist/components/hooks/useHover.js.map +1 -1
- package/dist/components/hooks/useResizeObserver.d.ts +9 -0
- package/dist/components/hooks/useResizeObserver.d.ts.map +1 -0
- package/dist/components/hooks/useResizeObserver.js +29 -30
- package/dist/components/hooks/useResizeObserver.js.map +1 -1
- package/dist/components/hooks/useTransitionStatus.d.ts +13 -0
- package/dist/components/hooks/useTransitionStatus.d.ts.map +1 -0
- package/dist/components/hooks/useTransitionStatus.js.map +1 -1
- package/dist/components/hooks/useWindowSize.d.ts +5 -0
- package/dist/components/hooks/useWindowSize.d.ts.map +1 -0
- package/dist/components/hooks/useWindowSize.js.map +1 -1
- package/dist/components/icon-button/component.d.ts +45 -0
- package/dist/components/icon-button/component.d.ts.map +1 -0
- package/dist/components/icon-button/component.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +2 -0
- package/dist/components/icon-button/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +53 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/input/component.d.ts +29 -0
- package/dist/components/input/component.d.ts.map +1 -0
- package/dist/components/input/component.js +42 -41
- package/dist/components/input/component.js.map +1 -1
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.d.ts.map +1 -0
- package/dist/components/keyboard-shortcut/component.d.ts +15 -0
- package/dist/components/keyboard-shortcut/component.d.ts.map +1 -0
- package/dist/components/keyboard-shortcut/component.js.map +1 -1
- package/dist/components/keyboard-shortcut/index.d.ts +2 -0
- package/dist/components/keyboard-shortcut/index.d.ts.map +1 -0
- package/dist/components/loader/component.d.ts +5 -0
- package/dist/components/loader/component.d.ts.map +1 -0
- package/dist/components/loader/component.js.map +1 -1
- package/dist/components/loader/index.d.ts +2 -0
- package/dist/components/loader/index.d.ts.map +1 -0
- package/dist/components/modal/Modal.d.ts +85 -0
- package/dist/components/modal/Modal.d.ts.map +1 -0
- package/dist/components/modal/Modal.js +75 -75
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/modal/ModalProvider.d.ts +6 -0
- package/dist/components/modal/ModalProvider.d.ts.map +1 -0
- package/dist/components/modal/ModalProvider.js +25 -25
- package/dist/components/modal/ModalProvider.js.map +1 -1
- package/dist/components/modal/ModalService.d.ts +34 -0
- package/dist/components/modal/ModalService.d.ts.map +1 -0
- package/dist/components/modal/ModalService.js +5 -10
- package/dist/components/modal/ModalService.js.map +1 -1
- package/dist/components/modal/constants.d.ts +10 -0
- package/dist/components/modal/constants.d.ts.map +1 -0
- package/dist/components/modal/constants.js.map +1 -1
- package/dist/components/modal/functions.d.ts +28 -0
- package/dist/components/modal/functions.d.ts.map +1 -0
- package/dist/components/modal/functions.js.map +1 -1
- package/dist/components/modal/index.d.ts +16 -0
- package/dist/components/modal/index.d.ts.map +1 -0
- package/dist/components/modal/index.js.map +1 -1
- package/dist/components/nav/context.d.ts +10 -0
- package/dist/components/nav/context.d.ts.map +1 -0
- package/dist/components/nav/context.js.map +1 -1
- package/dist/components/nav/group.d.ts +15 -0
- package/dist/components/nav/group.d.ts.map +1 -0
- package/dist/components/nav/group.js.map +1 -1
- package/dist/components/nav/heading.d.ts +6 -0
- package/dist/components/nav/heading.d.ts.map +1 -0
- package/dist/components/nav/heading.js.map +1 -1
- package/dist/components/nav/index.d.ts +12 -0
- package/dist/components/nav/index.d.ts.map +1 -0
- package/dist/components/nav/item.d.ts +35 -0
- package/dist/components/nav/item.d.ts.map +1 -0
- package/dist/components/nav/item.js.map +1 -1
- package/dist/components/popover/component.d.ts +10 -0
- package/dist/components/popover/component.d.ts.map +1 -0
- package/dist/components/popover/component.js.map +1 -1
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.d.ts.map +1 -0
- package/dist/components/popup-panel/component.d.ts +100 -0
- package/dist/components/popup-panel/component.d.ts.map +1 -0
- package/dist/components/popup-panel/component.js +105 -105
- package/dist/components/popup-panel/component.js.map +1 -1
- package/dist/components/popup-panel/constants.d.ts +8 -0
- package/dist/components/popup-panel/constants.d.ts.map +1 -0
- package/dist/components/popup-panel/constants.js.map +1 -1
- package/dist/components/popup-panel/index.d.ts +2 -0
- package/dist/components/popup-panel/index.d.ts.map +1 -0
- package/dist/components/radio/component.d.ts +8 -0
- package/dist/components/radio/component.d.ts.map +1 -0
- package/dist/components/radio/component.js.map +1 -1
- package/dist/components/radio/index.d.ts +3 -0
- package/dist/components/radio/index.d.ts.map +1 -0
- package/dist/components/radio/interface.d.ts +6 -0
- package/dist/components/radio/interface.d.ts.map +1 -0
- package/dist/components/resizable/component.d.ts +70 -0
- package/dist/components/resizable/component.d.ts.map +1 -0
- package/dist/components/resizable/component.js +147 -147
- package/dist/components/resizable/component.js.map +1 -1
- package/dist/components/resizable/index.d.ts +3 -0
- package/dist/components/resizable/index.d.ts.map +1 -0
- package/dist/components/scroll-area/component.d.ts +67 -0
- package/dist/components/scroll-area/component.d.ts.map +1 -0
- package/dist/components/scroll-area/component.js +75 -56
- package/dist/components/scroll-area/component.js.map +1 -1
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.d.ts.map +1 -0
- package/dist/components/segmented/component.d.ts +10 -0
- package/dist/components/segmented/component.d.ts.map +1 -0
- package/dist/components/segmented/component.js.map +1 -1
- package/dist/components/segmented/index.d.ts +2 -0
- package/dist/components/segmented/index.d.ts.map +1 -0
- package/dist/components/select/component.d.ts +48 -0
- package/dist/components/select/component.d.ts.map +1 -0
- package/dist/components/select/component.js +93 -94
- package/dist/components/select/component.js.map +1 -1
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.d.ts.map +1 -0
- package/dist/components/select/item.d.ts +14 -0
- package/dist/components/select/item.d.ts.map +1 -0
- package/dist/components/select/item.js.map +1 -1
- package/dist/components/select-trigger/component.d.ts +45 -0
- package/dist/components/select-trigger/component.d.ts.map +1 -0
- package/dist/components/select-trigger/component.js +96 -96
- package/dist/components/select-trigger/component.js.map +1 -1
- package/dist/components/select-trigger/index.d.ts +3 -0
- package/dist/components/select-trigger/index.d.ts.map +1 -0
- package/dist/components/slider/component.d.ts +6 -0
- package/dist/components/slider/component.d.ts.map +1 -0
- package/dist/components/slider/component.js.map +1 -1
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.d.ts.map +1 -0
- package/dist/components/spin/component.d.ts +6 -0
- package/dist/components/spin/component.d.ts.map +1 -0
- package/dist/components/spin/component.js.map +1 -1
- package/dist/components/spin/index.d.ts +2 -0
- package/dist/components/spin/index.d.ts.map +1 -0
- package/dist/components/splitter/component.d.ts +10 -0
- package/dist/components/splitter/component.d.ts.map +1 -0
- package/dist/components/splitter/component.js +7 -7
- package/dist/components/splitter/component.js.map +1 -1
- package/dist/components/splitter/context.d.ts +5 -0
- package/dist/components/splitter/context.d.ts.map +1 -0
- package/dist/components/splitter/context.js.map +1 -1
- package/dist/components/splitter/index.d.ts +2 -0
- package/dist/components/splitter/index.d.ts.map +1 -0
- package/dist/components/splitter/splitter-panel.d.ts +12 -0
- package/dist/components/splitter/splitter-panel.d.ts.map +1 -0
- package/dist/components/splitter/splitter-panel.js.map +1 -1
- package/dist/components/splitter/splitter.d.ts +11 -0
- package/dist/components/splitter/splitter.d.ts.map +1 -0
- package/dist/components/splitter/splitter.js +112 -112
- package/dist/components/splitter/splitter.js.map +1 -1
- package/dist/components/splitter/useSizes.d.ts +9 -0
- package/dist/components/splitter/useSizes.d.ts.map +1 -0
- package/dist/components/splitter/useSizes.js +35 -35
- package/dist/components/splitter/useSizes.js.map +1 -1
- package/dist/components/stack/Stack.d.ts +40 -0
- package/dist/components/stack/Stack.d.ts.map +1 -0
- package/dist/components/stack/Stack.js.map +1 -1
- package/dist/components/stack/StackChild.d.ts +31 -0
- package/dist/components/stack/StackChild.d.ts.map +1 -0
- package/dist/components/stack/StackChild.js.map +1 -1
- package/dist/components/stack/index.d.ts +8 -0
- package/dist/components/stack/index.d.ts.map +1 -0
- package/dist/components/stack/index.js.map +1 -1
- package/dist/components/status-icon/component.d.ts +23 -0
- package/dist/components/status-icon/component.d.ts.map +1 -0
- package/dist/components/status-icon/component.js.map +1 -1
- package/dist/components/status-icon/index.d.ts +2 -0
- package/dist/components/status-icon/index.d.ts.map +1 -0
- package/dist/components/switch/component.d.ts +9 -0
- package/dist/components/switch/component.d.ts.map +1 -0
- package/dist/components/switch/component.js.map +1 -1
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.d.ts.map +1 -0
- package/dist/components/table/component.d.ts +32 -0
- package/dist/components/table/component.d.ts.map +1 -0
- package/dist/components/table/component.js +57 -58
- package/dist/components/table/component.js.map +1 -1
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/index.d.ts.map +1 -0
- package/dist/components/tag/component.d.ts +22 -0
- package/dist/components/tag/component.d.ts.map +1 -0
- package/dist/components/tag/component.js.map +1 -1
- package/dist/components/tag/index.d.ts +2 -0
- package/dist/components/tag/index.d.ts.map +1 -0
- package/dist/components/theme-provider/component.d.ts +7 -0
- package/dist/components/theme-provider/component.d.ts.map +1 -0
- package/dist/components/theme-provider/component.js.map +1 -1
- package/dist/components/theme-provider/index.d.ts +2 -0
- package/dist/components/theme-provider/index.d.ts.map +1 -0
- package/dist/components/toast/component.d.ts +15 -0
- package/dist/components/toast/component.d.ts.map +1 -0
- package/dist/components/toast/component.js +49 -50
- package/dist/components/toast/component.js.map +1 -1
- package/dist/components/toast/function.d.ts +11 -0
- package/dist/components/toast/function.d.ts.map +1 -0
- package/dist/components/toast/function.js.map +1 -1
- package/dist/components/toast/index.d.ts +4 -0
- package/dist/components/toast/index.d.ts.map +1 -0
- package/dist/components/toast/types.d.ts +4 -0
- package/dist/components/toast/types.d.ts.map +1 -0
- package/dist/components/tooltip/component.d.ts +10 -0
- package/dist/components/tooltip/component.d.ts.map +1 -0
- package/dist/components/tooltip/component.js.map +1 -1
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.d.ts.map +1 -0
- package/dist/components/tour/component.d.ts +8 -0
- package/dist/components/tour/component.d.ts.map +1 -0
- package/dist/components/tour/component.js.map +1 -1
- package/dist/components/tour/index.d.ts +2 -0
- package/dist/components/tour/index.d.ts.map +1 -0
- package/dist/components/transition/component.d.ts +30 -0
- package/dist/components/transition/component.d.ts.map +1 -0
- package/dist/components/transition/component.js +32 -32
- package/dist/components/transition/component.js.map +1 -1
- package/dist/components/transition/index.d.ts +2 -0
- package/dist/components/transition/index.d.ts.map +1 -0
- package/dist/components/tree/components.d.ts +14 -0
- package/dist/components/tree/components.d.ts.map +1 -0
- package/dist/components/tree/components.js.map +1 -1
- package/dist/components/tree/helpers.d.ts +6 -0
- package/dist/components/tree/helpers.d.ts.map +1 -0
- package/dist/components/tree/helpers.js.map +1 -1
- package/dist/components/tree/index.d.ts +5 -0
- package/dist/components/tree/index.d.ts.map +1 -0
- package/dist/components/tree/types.d.ts +56 -0
- package/dist/components/tree/types.d.ts.map +1 -0
- package/dist/components/tree/useTreeCommon.d.ts +179 -0
- package/dist/components/tree/useTreeCommon.d.ts.map +1 -0
- package/dist/components/tree/useTreeCommon.js +29 -29
- package/dist/components/tree/useTreeCommon.js.map +1 -1
- package/dist/components/tree/useUniqueKeysTree.d.ts +34 -0
- package/dist/components/tree/useUniqueKeysTree.d.ts.map +1 -0
- package/dist/components/tree/useUniqueKeysTree.js.map +1 -1
- package/dist/components/truncate/component.d.ts +17 -0
- package/dist/components/truncate/component.d.ts.map +1 -0
- package/dist/components/truncate/component.js +38 -39
- package/dist/components/truncate/component.js.map +1 -1
- package/dist/components/truncate/helpers.d.ts +17 -0
- package/dist/components/truncate/helpers.d.ts.map +1 -0
- package/dist/components/truncate/helpers.js +27 -30
- package/dist/components/truncate/helpers.js.map +1 -1
- package/dist/components/truncate/index.d.ts +2 -0
- package/dist/components/truncate/index.d.ts.map +1 -0
- package/dist/components/upload/component.d.ts +17 -0
- package/dist/components/upload/component.d.ts.map +1 -0
- package/dist/components/upload/component.js.map +1 -1
- package/dist/components/upload/dragger.d.ts +14 -0
- package/dist/components/upload/dragger.d.ts.map +1 -0
- package/dist/components/upload/dragger.js.map +1 -1
- package/dist/components/upload/hooks.d.ts +6 -0
- package/dist/components/upload/hooks.d.ts.map +1 -0
- package/dist/components/upload/hooks.js.map +1 -1
- package/dist/components/upload/index.d.ts +4 -0
- package/dist/components/upload/index.d.ts.map +1 -0
- package/dist/components/upload/item.d.ts +12 -0
- package/dist/components/upload/item.d.ts.map +1 -0
- package/dist/components/upload/item.js.map +1 -1
- package/dist/components/upload/utils.d.ts +2 -0
- package/dist/components/upload/utils.d.ts.map +1 -0
- package/dist/components/upload/utils.js.map +1 -1
- package/dist/components/utils/WithAntdTokens.d.ts +8 -0
- package/dist/components/utils/WithAntdTokens.d.ts.map +1 -0
- package/dist/components/utils/WithAntdTokens.js.map +1 -1
- package/dist/components/utils/WithRenderProp.d.ts +14 -0
- package/dist/components/utils/WithRenderProp.d.ts.map +1 -0
- package/dist/components/utils/WithRenderProp.js.map +1 -1
- package/dist/components/utils/antdUtils.d.ts +11 -0
- package/dist/components/utils/antdUtils.d.ts.map +1 -0
- package/dist/components/utils/antdUtils.js +9 -12
- package/dist/components/utils/antdUtils.js.map +1 -1
- package/dist/components/utils/client.d.ts +6 -0
- package/dist/components/utils/client.d.ts.map +1 -0
- package/dist/components/utils/cn.d.ts +5 -0
- package/dist/components/utils/cn.d.ts.map +1 -0
- package/dist/components/utils/cn.js.map +1 -1
- package/dist/components/utils/colors.d.ts +2 -0
- package/dist/components/utils/colors.d.ts.map +1 -0
- package/dist/components/utils/constants.d.ts +15 -0
- package/dist/components/utils/constants.d.ts.map +1 -0
- package/dist/components/utils/index.d.ts +6 -0
- package/dist/components/utils/index.d.ts.map +1 -0
- package/dist/components/utils/isTracebackError.d.ts +2 -0
- package/dist/components/utils/isTracebackError.d.ts.map +1 -0
- package/dist/components/utils/isTracebackError.js.map +1 -1
- package/dist/components/utils/main.d.ts +7 -0
- package/dist/components/utils/main.d.ts.map +1 -0
- package/dist/components/utils/placement.d.ts +21 -0
- package/dist/components/utils/placement.d.ts.map +1 -0
- package/dist/components/utils/placement.js.map +1 -1
- package/dist/components/utils/reactElement.d.ts +2 -0
- package/dist/components/utils/reactElement.d.ts.map +1 -0
- package/dist/components/utils/reactToString.d.ts +3 -0
- package/dist/components/utils/reactToString.d.ts.map +1 -0
- package/dist/components/utils/reactToString.js.map +1 -1
- package/dist/components/utils/selectionRange.d.ts +2 -0
- package/dist/components/utils/selectionRange.d.ts.map +1 -0
- package/dist/components/utils/selectionRange.js.map +1 -1
- package/dist/components/utils/theme.d.ts +6 -0
- package/dist/components/utils/theme.d.ts.map +1 -0
- package/dist/components/utils/theme.js.map +1 -1
- package/dist/components/utils/types.d.ts +12 -0
- package/dist/components/utils/types.d.ts.map +1 -0
- package/dist/components/vertical-collapsible-panel/component.d.ts +65 -0
- package/dist/components/vertical-collapsible-panel/component.d.ts.map +1 -0
- package/dist/components/vertical-collapsible-panel/component.js.map +1 -1
- package/dist/components/vertical-collapsible-panel/index.d.ts +2 -0
- package/dist/components/vertical-collapsible-panel/index.d.ts.map +1 -0
- package/dist/index.d.ts +4 -4390
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +166 -164
- package/dist/index.js.map +1 -1
- package/dist/metadata.d.ts +446 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js.map +1 -1
- package/dist/tokens/and-theme/index.d.ts +2 -0
- package/dist/tokens/and-theme/index.d.ts.map +1 -0
- package/dist/tokens/and-theme/tokens.d.ts +6 -0
- package/dist/tokens/and-theme/tokens.d.ts.map +1 -0
- package/dist/tokens/and-theme/tokens.js.map +1 -1
- package/dist/tokens/charts/index.d.ts +5 -0
- package/dist/tokens/charts/index.d.ts.map +1 -0
- package/dist/tokens/charts/palettes/cloudscape.d.ts +460 -0
- package/dist/tokens/charts/palettes/cloudscape.d.ts.map +1 -0
- package/dist/tokens/charts/palettes/cloudscape.js.map +1 -1
- package/dist/tokens/charts/palettes/colorbrewer.d.ts +338 -0
- package/dist/tokens/charts/palettes/colorbrewer.d.ts.map +1 -0
- package/dist/tokens/charts/palettes/colorbrewer.js.map +1 -1
- package/dist/tokens/charts/palettes/index.d.ts +24 -0
- package/dist/tokens/charts/palettes/index.d.ts.map +1 -0
- package/dist/tokens/charts/palettes/index.js.map +1 -1
- package/dist/tokens/charts/palettes/tableau.d.ts +11 -0
- package/dist/tokens/charts/palettes/tableau.d.ts.map +1 -0
- package/dist/tokens/index.d.ts +5 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/types.d.ts +10 -0
- package/dist/tokens/types.d.ts.map +1 -0
- package/dist/tokens/utils.d.ts +9 -0
- package/dist/tokens/utils.d.ts.map +1 -0
- package/dist/tokens/utils.js.map +1 -1
- package/package.json +2 -2
- package/dist/tailwind.d.ts +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DragEndEvent, DragStartEvent, Data as DragData, DragDropDraggableProps, DragDropDroppableProps, DragDropProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The root component for the drag and drop functionality
|
|
4
|
+
*/
|
|
5
|
+
export declare function DragDropRoot<T extends DragData = DragData>({ children, onDragEnd: _onDragEnd, onDragStart: _onDragStart, onDrop: _onDrop, className, }: DragDropProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* Drag component with subcomponents
|
|
8
|
+
*/
|
|
9
|
+
export declare const DragDrop: typeof DragDropRoot & {
|
|
10
|
+
/**
|
|
11
|
+
* Item that can be dragged
|
|
12
|
+
*/
|
|
13
|
+
Draggable: <T extends DragData = unknown>({ id, children, className, disabled, data, style, render, onDragEnd, onDragStart, indicator, onlyIndicatorDraggable, ...rest }: DragDropDraggableProps<T>) => null;
|
|
14
|
+
/**
|
|
15
|
+
* Zone where items can be dropped
|
|
16
|
+
*/
|
|
17
|
+
Droppable: <T extends DragData = unknown, M extends boolean = false>({ id, children, className, disabled, placeholder, icon, render, onDrop, validate, multiple, value, onChange, maxItems, renderValueLabel, renderValueIcon, ...rest }: DragDropDroppableProps<T, M>) => null;
|
|
18
|
+
/**
|
|
19
|
+
* Value component to display the value of the dragged item
|
|
20
|
+
*/
|
|
21
|
+
Value: <T extends DragData, M extends boolean>(props: import('./types').DragDropValueProps<T, M> & {
|
|
22
|
+
ref?: import('react').ForwardedRef<HTMLDivElement>;
|
|
23
|
+
}) => ReturnType<(<T_1 extends DragData, M_1 extends boolean>({ value, onChange, multiple, renderValueLabel, renderValueIcon, className, style, maxItems, ...rest }: import('./types').DragDropValueProps<T_1, M_1>, ref: import('react').ForwardedRef<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element)>;
|
|
24
|
+
};
|
|
25
|
+
export type { DragEndEvent, DragStartEvent, DragDropDraggableProps, DragDropDroppableProps, DragData, DragDropProps, };
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/drag-drop/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,IAAI,IAAI,QAAQ,EAErB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AASjB,OAAO,aAAa,CAAC;AAErB;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAAE,EAC1D,QAAQ,EAER,SAAS,EAAE,UAAU,EACrB,WAAW,EAAE,YAAY,EACzB,MAAM,EAAE,OAAO,EACf,SAAS,GACV,EAAE,aAAa,CAAC,CAAC,CAAC,2CA6BlB;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ;IACnB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;WAY+rD,CAAC;;CAVnsD,CAAC;AAEH,YAAY,EACV,YAAY,EACZ,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,QAAQ,EACR,aAAa,GACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/drag-drop/index.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type DragEndEvent,\n type DragStartEvent,\n type Data as DragData,\n type UniqueIdentifier,\n type DragDropDraggableProps,\n type DragDropDroppableProps,\n type DragDropProps,\n} from \"./types\";\nimport { useState } from \"react\";\nimport { clsx, useCls } from \"../utils\";\nimport { Draggable } from \"./draggable\";\nimport { Droppable } from \"./droppable\";\nimport { Value } from \"./value\";\nimport { DragDropContext } from \"./context\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\n/**\n * The root component for the drag and drop functionality\n */\nexport function DragDropRoot<T extends DragData = DragData>({\n children,\n // These callbacks are passed to child components via context\n onDragEnd: _onDragEnd,\n onDragStart: _onDragStart,\n onDrop: _onDrop,\n className,\n}: DragDropProps<T>) {\n const cls = useCls();\n const [active, setActive] = useState<{\n data: T;\n id: UniqueIdentifier;\n } | null>(null);\n\n const [isDragging, setIsDragging] = useState(false);\n\n // These functions are now handled directly in the Item and DropZone components\n\n // Create context value for child components\n const contextValue = {\n active,\n setActive: (item: { data: unknown; id: UniqueIdentifier } | null) => {\n setActive(item as { data: T; id: UniqueIdentifier } | null);\n },\n isDragging,\n setIsDragging,\n onDragStart: _onDragStart,\n onDragEnd: _onDragEnd,\n onDrop: _onDrop,\n };\n\n return (\n <DragDropContext.Provider value={contextValue}>\n <div className={clsx(cls(\"drag-container\"), className)}>{children}</div>\n </DragDropContext.Provider>\n );\n}\n\n/**\n * Drag component with subcomponents\n */\nexport const DragDrop = Object.assign(DragDropRoot, {\n /**\n * Item that can be dragged\n */\n Draggable,\n\n /**\n * Zone where items can be dropped\n */\n Droppable,\n\n /**\n * Value component to display the value of the dragged item\n */\n Value,\n});\n\nexport type {\n DragEndEvent,\n DragStartEvent,\n DragDropDraggableProps,\n DragDropDroppableProps,\n DragData,\n DragDropProps,\n};\n"],"names":["DragDropRoot","children","_onDragEnd","_onDragStart","_onDrop","className","cls","useCls","active","setActive","useState","isDragging","setIsDragging","contextValue","item","DragDropContext","jsx","clsx","DragDrop","Draggable","Droppable","Value"],"mappings":";;;;;;;;;;AAwBO,SAASA,EAA4C;AAAA,EAC1D,UAAAC;AAAA;AAAA,EAEA,WAAWC;AAAA,EACX,aAAaC;AAAA,EACb,QAAQC;AAAA,EACR,WAAAC;AACF,GAAqB;AACnB,QAAMC,IAAMC,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/drag-drop/index.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type DragEndEvent,\n type DragStartEvent,\n type Data as DragData,\n type UniqueIdentifier,\n type DragDropDraggableProps,\n type DragDropDroppableProps,\n type DragDropProps,\n} from \"./types\";\nimport { useState } from \"react\";\nimport { clsx, useCls } from \"../utils\";\nimport { Draggable } from \"./draggable\";\nimport { Droppable } from \"./droppable\";\nimport { Value } from \"./value\";\nimport { DragDropContext } from \"./context\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\n/**\n * The root component for the drag and drop functionality\n */\nexport function DragDropRoot<T extends DragData = DragData>({\n children,\n // These callbacks are passed to child components via context\n onDragEnd: _onDragEnd,\n onDragStart: _onDragStart,\n onDrop: _onDrop,\n className,\n}: DragDropProps<T>) {\n const cls = useCls();\n const [active, setActive] = useState<{\n data: T;\n id: UniqueIdentifier;\n } | null>(null);\n\n const [isDragging, setIsDragging] = useState(false);\n\n // These functions are now handled directly in the Item and DropZone components\n\n // Create context value for child components\n const contextValue = {\n active,\n setActive: (item: { data: unknown; id: UniqueIdentifier } | null) => {\n setActive(item as { data: T; id: UniqueIdentifier } | null);\n },\n isDragging,\n setIsDragging,\n onDragStart: _onDragStart,\n onDragEnd: _onDragEnd,\n onDrop: _onDrop,\n };\n\n return (\n <DragDropContext.Provider value={contextValue}>\n <div className={clsx(cls(\"drag-container\"), className)}>{children}</div>\n </DragDropContext.Provider>\n );\n}\n\n/**\n * Drag component with subcomponents\n */\nexport const DragDrop = Object.assign(DragDropRoot, {\n /**\n * Item that can be dragged\n */\n Draggable,\n\n /**\n * Zone where items can be dropped\n */\n Droppable,\n\n /**\n * Value component to display the value of the dragged item\n */\n Value,\n});\n\nexport type {\n DragEndEvent,\n DragStartEvent,\n DragDropDraggableProps,\n DragDropDroppableProps,\n DragData,\n DragDropProps,\n};\n"],"names":["DragDropRoot","children","_onDragEnd","_onDragStart","_onDrop","className","cls","useCls","active","setActive","useState","isDragging","setIsDragging","contextValue","item","DragDropContext","jsx","clsx","DragDrop","Draggable","Droppable","Value"],"mappings":";;;;;;;;;;AAwBO,SAASA,EAA4C;AAAA,EAC1D,UAAAC;AAAA;AAAA,EAEA,WAAWC;AAAA,EACX,aAAaC;AAAA,EACb,QAAQC;AAAA,EACR,WAAAC;AACF,GAAqB;AACnB,QAAMC,IAAMC,EAAA,GACN,CAACC,GAAQC,CAAS,IAAIC,EAGlB,IAAI,GAER,CAACC,GAAYC,CAAa,IAAIF,EAAS,EAAK,GAK5CG,IAAe;AAAA,IACnB,QAAAL;AAAA,IACA,WAAW,CAACM,MAAyD;AACnE,MAAAL,EAAUK,CAAgD;AAAA,IAC5D;AAAA,IACA,YAAAH;AAAA,IACA,eAAAC;AAAA,IACA,aAAaT;AAAA,IACb,WAAWD;AAAA,IACX,QAAQE;AAAA,EAAA;AAGV,2BACGW,EAAgB,UAAhB,EAAyB,OAAOF,GAC/B,UAAA,gBAAAG,EAAC,OAAA,EAAI,WAAWC,EAAKX,EAAI,gBAAgB,GAAGD,CAAS,GAAI,UAAAJ,GAAS,GACpE;AAEJ;AAKO,MAAMiB,IAAW,OAAO,OAAOlB,GAAc;AAAA;AAAA;AAAA;AAAA,EAIlD,WAAAmB;AAAA;AAAA;AAAA;AAAA,EAKA,WAAAC;AAAA;AAAA;AAAA;AAAA,EAKA,OAAAC;AACF,CAAC;"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactElement, ReactNode, ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { useRender } from '@base-ui-components/react/use-render';
|
|
3
|
+
/**
|
|
4
|
+
* Base data type for drag and drop operations
|
|
5
|
+
*/
|
|
6
|
+
export type UniqueIdentifier = string | number;
|
|
7
|
+
export type Data = unknown;
|
|
8
|
+
export type DraggableInfo<T extends Data = Data> = {
|
|
9
|
+
id: UniqueIdentifier;
|
|
10
|
+
data: T;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Event types for drag and drop operations
|
|
14
|
+
*/
|
|
15
|
+
export interface DragStartEvent<T extends Data = Data> {
|
|
16
|
+
active: {
|
|
17
|
+
id: UniqueIdentifier;
|
|
18
|
+
data: T;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface DragEndEvent<T extends Data = Data> {
|
|
22
|
+
active: {
|
|
23
|
+
id: UniqueIdentifier;
|
|
24
|
+
data: T;
|
|
25
|
+
};
|
|
26
|
+
over: {
|
|
27
|
+
id: UniqueIdentifier;
|
|
28
|
+
} | null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Props for useDraggable hook
|
|
32
|
+
*/
|
|
33
|
+
export interface UseDraggableProps<T extends Data = Data> {
|
|
34
|
+
id: UniqueIdentifier;
|
|
35
|
+
data?: T;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
onDragStart?: (event: DragStartEvent<T>) => void;
|
|
38
|
+
onDragEnd?: (event: DragEndEvent<T>) => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Props for useDroppable hook
|
|
42
|
+
*/
|
|
43
|
+
export interface UseDroppableProps<T extends Data = Data> {
|
|
44
|
+
id: UniqueIdentifier;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
onDrop?: (item: DraggableInfo<T>) => void;
|
|
47
|
+
validate?: (item: DraggableInfo<T>) => boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Function to render the item
|
|
51
|
+
*/
|
|
52
|
+
export type ItemRenderFn<T extends Data = Data> = (state: {
|
|
53
|
+
data: T;
|
|
54
|
+
id: UniqueIdentifier;
|
|
55
|
+
}, props: HTMLAttributes<HTMLElement>) => ReactElement;
|
|
56
|
+
/**
|
|
57
|
+
* Context for the Drag component to share state between components
|
|
58
|
+
*/
|
|
59
|
+
export interface DragDropContextType<T extends Data = Data> {
|
|
60
|
+
/**
|
|
61
|
+
* The currently active (dragging) info
|
|
62
|
+
*/
|
|
63
|
+
active: DraggableInfo<T> | null;
|
|
64
|
+
/**
|
|
65
|
+
* Set the currently active info
|
|
66
|
+
*/
|
|
67
|
+
setActive: (id: DraggableInfo<T> | null) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Whether an item is being dragged
|
|
70
|
+
*/
|
|
71
|
+
isDragging: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Set whether an item is being dragged
|
|
74
|
+
*/
|
|
75
|
+
setIsDragging: (dragging: boolean) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Callback fired when a drag operation starts
|
|
78
|
+
*/
|
|
79
|
+
onDragStart?: (event: DragStartEvent<T>) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Callback fired when a drag operation ends
|
|
82
|
+
*/
|
|
83
|
+
onDragEnd?: (event: DragEndEvent<T>) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Callback fired when an item is dropped on this zone
|
|
86
|
+
*/
|
|
87
|
+
onDrop?: (item: DraggableInfo<T>) => void;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Props for the draggable item component
|
|
91
|
+
*/
|
|
92
|
+
export interface DragDropDraggableProps<T extends Data = Data> extends Omit<React.ComponentPropsWithoutRef<"div">, "id" | "onDragEnd" | "onDragStart"> {
|
|
93
|
+
/**
|
|
94
|
+
* Unique identifier for the draggable item
|
|
95
|
+
*/
|
|
96
|
+
id: UniqueIdentifier;
|
|
97
|
+
/**
|
|
98
|
+
* Whether the item is disabled from being dragged
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
disabled?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Data to be passed to the drag event
|
|
104
|
+
*/
|
|
105
|
+
data?: T;
|
|
106
|
+
/**
|
|
107
|
+
* Function to render the item
|
|
108
|
+
*/
|
|
109
|
+
render?: useRender.RenderProp<DraggableInfo<T> & {
|
|
110
|
+
isDragging: boolean;
|
|
111
|
+
}>;
|
|
112
|
+
/**
|
|
113
|
+
* Callback fired when the drag operation ends
|
|
114
|
+
*/
|
|
115
|
+
onDragEnd?: (event: DragEndEvent<T>) => void;
|
|
116
|
+
/**
|
|
117
|
+
* Callback fired when the drag operation starts
|
|
118
|
+
*/
|
|
119
|
+
onDragStart?: (event: DragStartEvent<T>) => void;
|
|
120
|
+
/**
|
|
121
|
+
* Indicator to display if item is draggable
|
|
122
|
+
* @default false
|
|
123
|
+
*/
|
|
124
|
+
indicator?: ReactNode | boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Whether if only indicator is draggable
|
|
127
|
+
* @default false
|
|
128
|
+
*/
|
|
129
|
+
onlyIndicatorDraggable?: boolean;
|
|
130
|
+
}
|
|
131
|
+
export type DragDropDropableRenderFnProps<T extends Data = Data, M extends boolean = false> = {
|
|
132
|
+
isOver: boolean;
|
|
133
|
+
id: UniqueIdentifier;
|
|
134
|
+
value: M extends true ? T[] : T;
|
|
135
|
+
onChange: (value: M extends true ? T[] : T) => void;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Props for the DropZone component
|
|
139
|
+
*/
|
|
140
|
+
export interface DragDropDroppableProps<T extends Data = Data, M extends boolean = false> extends Omit<React.ComponentPropsWithoutRef<"div">, "id" | "onDragEnter" | "onDragOver" | "onDragLeave" | "onDrop" | "onChange">, Omit<DragDropValueProps<T, M>, "id"> {
|
|
141
|
+
/**
|
|
142
|
+
* Unique identifier for the droppable area
|
|
143
|
+
*/
|
|
144
|
+
id: UniqueIdentifier;
|
|
145
|
+
/**
|
|
146
|
+
* Whether the drop zone is disabled
|
|
147
|
+
* @default false
|
|
148
|
+
*/
|
|
149
|
+
disabled?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Text to display when no children are provided
|
|
152
|
+
* @default "Drop items here"
|
|
153
|
+
*/
|
|
154
|
+
placeholder?: ReactNode;
|
|
155
|
+
/**
|
|
156
|
+
* Icon to display when no children are provided
|
|
157
|
+
*/
|
|
158
|
+
icon?: ReactNode;
|
|
159
|
+
/**
|
|
160
|
+
* Custom render function
|
|
161
|
+
*/
|
|
162
|
+
render?: useRender.RenderProp<DragDropDropableRenderFnProps<T, M>>;
|
|
163
|
+
/**
|
|
164
|
+
* Callback fired when an item is dropped on this zone
|
|
165
|
+
*/
|
|
166
|
+
onDrop?: (item: {
|
|
167
|
+
id: UniqueIdentifier;
|
|
168
|
+
data: T;
|
|
169
|
+
}) => void;
|
|
170
|
+
/**
|
|
171
|
+
* Validate if the item can be dropped
|
|
172
|
+
*/
|
|
173
|
+
validate?: (item: DraggableInfo<T>) => boolean;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Props for the Drag component
|
|
177
|
+
*/
|
|
178
|
+
export interface DragDropProps<T extends Data = Data> {
|
|
179
|
+
/**
|
|
180
|
+
* Children of the component
|
|
181
|
+
*/
|
|
182
|
+
children: ReactNode;
|
|
183
|
+
/**
|
|
184
|
+
* Callback fired when a drag operation ends
|
|
185
|
+
*/
|
|
186
|
+
onDragEnd?: (event: DragEndEvent<T>) => void;
|
|
187
|
+
/**
|
|
188
|
+
* Callback fired when a drag operation starts
|
|
189
|
+
*/
|
|
190
|
+
onDragStart?: (event: DragStartEvent<T>) => void;
|
|
191
|
+
/**
|
|
192
|
+
* Callback fired when an item is dropped on this zone
|
|
193
|
+
*/
|
|
194
|
+
onDrop?: (item: DraggableInfo<T>) => void;
|
|
195
|
+
/**
|
|
196
|
+
* Additional class name
|
|
197
|
+
*/
|
|
198
|
+
className?: string;
|
|
199
|
+
/**
|
|
200
|
+
* Whether to cancel drops on containers that don't handle the dropped item type
|
|
201
|
+
* @default true
|
|
202
|
+
*/
|
|
203
|
+
cancelDrop?: boolean;
|
|
204
|
+
}
|
|
205
|
+
export interface DragDropValueProps<T extends Data = Data, M extends boolean = false> extends Omit<ComponentPropsWithoutRef<"div">, "onDragEnter" | "onDragOver" | "onDragLeave" | "onDrop" | "onChange"> {
|
|
206
|
+
/**
|
|
207
|
+
* Whether to allow multiple values
|
|
208
|
+
* @default false
|
|
209
|
+
*/
|
|
210
|
+
multiple?: M;
|
|
211
|
+
/**
|
|
212
|
+
* The current value(s) of the drop zone
|
|
213
|
+
*/
|
|
214
|
+
value?: M extends true ? T[] : T;
|
|
215
|
+
/**
|
|
216
|
+
* Callback fired when the value changes
|
|
217
|
+
*/
|
|
218
|
+
onChange?: M extends true ? (value: T[]) => void : (value: T) => void;
|
|
219
|
+
/**
|
|
220
|
+
* Function to render the label for a single value
|
|
221
|
+
*/
|
|
222
|
+
renderValueLabel?: (singleValue: T) => ReactElement | string;
|
|
223
|
+
/**
|
|
224
|
+
* Function to render the icon for a single value
|
|
225
|
+
*/
|
|
226
|
+
renderValueIcon?: (singleValue: T) => ReactElement;
|
|
227
|
+
/**
|
|
228
|
+
* Maximum number of items that can be dropped
|
|
229
|
+
*/
|
|
230
|
+
maxItems?: number;
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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AED,MAAM,WAAW,kBAAkB,CACjC,CAAC,SAAS,IAAI,GAAG,IAAI,EACrB,CAAC,SAAS,OAAO,GAAG,KAAK,CACzB,SAAQ,IAAI,CACV,wBAAwB,CAAC,KAAK,CAAC,EAC/B,aAAa,GAAG,YAAY,GAAG,aAAa,GAAG,QAAQ,GAAG,UAAU,CACrE;IACD;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,SAAS,IAAI,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,SAAS,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IACtE;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,YAAY,GAAG,MAAM,CAAC;IAC7D;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,YAAY,CAAC;IACnD;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ForwardedRef } from 'react';
|
|
2
|
+
import { DragDropValueProps, Data } from './types';
|
|
3
|
+
declare function ValueInner<T extends Data, M extends boolean>({ value, onChange, multiple, renderValueLabel, renderValueIcon, className, style, maxItems, ...rest }: DragDropValueProps<T, M>, ref: ForwardedRef<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const Value: <T extends Data, M extends boolean>(props: DragDropValueProps<T, M> & {
|
|
5
|
+
ref?: ForwardedRef<HTMLDivElement>;
|
|
6
|
+
}) => ReturnType<typeof ValueInner>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value.d.ts","sourceRoot":"","sources":["../../../src/components/drag-drop/value.tsx"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,YAAY,EAElB,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,kBAAkB,EAAE,KAAK,IAAI,EAAE,MAAM,SAAS,CAAC;AAGxD,iBAAS,UAAU,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,OAAO,EACnD,EACE,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EAC3B,GAAG,EAAE,YAAY,CAAC,cAAc,CAAC,2CAwHlC;AAED,eAAO,MAAM,KAAK,EAAmC,CACnD,CAAC,SAAS,IAAI,EACd,CAAC,SAAS,OAAO,EAEjB,KAAK,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,cAAc,CAAC,CAAA;CAAE,KACrE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -1,78 +1,78 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as o, jsxs as
|
|
3
|
-
import { FileIcon as
|
|
4
|
-
import { isEqual as
|
|
5
|
-
import { memo as
|
|
6
|
-
import { Stack as
|
|
7
|
-
import
|
|
8
|
-
import { Tag as
|
|
9
|
-
import { useCls as
|
|
10
|
-
import { Truncate as
|
|
11
|
-
import { IconButton as
|
|
12
|
-
function
|
|
2
|
+
import { jsx as o, jsxs as I, Fragment as h } from "react/jsx-runtime";
|
|
3
|
+
import { FileIcon as M, XIcon as T } from "@bioturing/assets";
|
|
4
|
+
import { isEqual as q } from "es-toolkit";
|
|
5
|
+
import { memo as x, forwardRef as y, useState as B, useCallback as n, cloneElement as C } from "react";
|
|
6
|
+
import { Stack as X } from "../stack/index.js";
|
|
7
|
+
import v from "merge-refs";
|
|
8
|
+
import { Tag as A } from "../tag/component.js";
|
|
9
|
+
import { useCls as D } from "../utils/antdUtils.js";
|
|
10
|
+
import { Truncate as G } from "../truncate/component.js";
|
|
11
|
+
import { IconButton as H } from "../icon-button/component.js";
|
|
12
|
+
function J({
|
|
13
13
|
value: s,
|
|
14
|
-
onChange:
|
|
15
|
-
multiple:
|
|
14
|
+
onChange: c,
|
|
15
|
+
multiple: t,
|
|
16
16
|
renderValueLabel: d,
|
|
17
17
|
renderValueIcon: f,
|
|
18
|
-
className:
|
|
19
|
-
style:
|
|
18
|
+
className: R,
|
|
19
|
+
style: E,
|
|
20
20
|
maxItems: m,
|
|
21
|
-
...
|
|
22
|
-
},
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
}, []), i =
|
|
26
|
-
(
|
|
27
|
-
const
|
|
28
|
-
return typeof
|
|
29
|
-
|
|
21
|
+
...N
|
|
22
|
+
}, S) {
|
|
23
|
+
const l = D(), [u, k] = B(null), g = n((e) => {
|
|
24
|
+
k(e);
|
|
25
|
+
}, []), i = n(
|
|
26
|
+
(e) => {
|
|
27
|
+
const r = d(e);
|
|
28
|
+
return typeof r == "string" ? /* @__PURE__ */ o(
|
|
29
|
+
G,
|
|
30
30
|
{
|
|
31
31
|
position: "middle",
|
|
32
|
-
className:
|
|
32
|
+
className: l("dropzone-value-label"),
|
|
33
33
|
container: u,
|
|
34
|
-
children:
|
|
34
|
+
children: r
|
|
35
35
|
}
|
|
36
|
-
) : /* @__PURE__ */ o("span", { className:
|
|
36
|
+
) : /* @__PURE__ */ o("span", { className: l("dropzone-value-label"), children: r });
|
|
37
37
|
},
|
|
38
|
-
[
|
|
39
|
-
), a =
|
|
40
|
-
(
|
|
41
|
-
className:
|
|
38
|
+
[l, u, d]
|
|
39
|
+
), a = n(
|
|
40
|
+
(e) => C(f(e) || /* @__PURE__ */ o(M, {}), {
|
|
41
|
+
className: l("dropzone-value-icon")
|
|
42
42
|
}),
|
|
43
|
-
[
|
|
44
|
-
), b =
|
|
45
|
-
(
|
|
46
|
-
|
|
47
|
-
s.filter((
|
|
43
|
+
[l, f]
|
|
44
|
+
), b = n(
|
|
45
|
+
(e) => {
|
|
46
|
+
c(
|
|
47
|
+
s.filter((r) => !q(r, e))
|
|
48
48
|
);
|
|
49
49
|
},
|
|
50
|
-
[
|
|
51
|
-
), z =
|
|
52
|
-
|
|
53
|
-
}, [
|
|
54
|
-
(
|
|
55
|
-
const
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
a(
|
|
58
|
-
|
|
59
|
-
/* @__PURE__ */ o(
|
|
50
|
+
[c, s]
|
|
51
|
+
), z = n(() => {
|
|
52
|
+
t ? c([]) : c?.(null);
|
|
53
|
+
}, [c, t]), p = n(
|
|
54
|
+
(e) => {
|
|
55
|
+
const r = i(e);
|
|
56
|
+
return /* @__PURE__ */ I(h, { children: [
|
|
57
|
+
a(e),
|
|
58
|
+
r,
|
|
59
|
+
/* @__PURE__ */ o(H, { size: "small", onClick: z, children: /* @__PURE__ */ o(T, {}) })
|
|
60
60
|
] });
|
|
61
61
|
},
|
|
62
62
|
[i, a, z]
|
|
63
|
-
),
|
|
64
|
-
(
|
|
65
|
-
const
|
|
63
|
+
), j = n(
|
|
64
|
+
(e) => m == 1 ? p(e[0]) : /* @__PURE__ */ o(h, { children: (e || []).map((r, w) => {
|
|
65
|
+
const F = i(r);
|
|
66
66
|
return /* @__PURE__ */ o(
|
|
67
|
-
|
|
67
|
+
A,
|
|
68
68
|
{
|
|
69
|
-
icon: a(
|
|
69
|
+
icon: a(r),
|
|
70
70
|
size: "large",
|
|
71
71
|
closable: !0,
|
|
72
|
-
onClose: () => b(
|
|
73
|
-
children:
|
|
72
|
+
onClose: () => b(r),
|
|
73
|
+
children: F
|
|
74
74
|
},
|
|
75
|
-
|
|
75
|
+
w
|
|
76
76
|
);
|
|
77
77
|
}) }),
|
|
78
78
|
[
|
|
@@ -84,25 +84,25 @@ function L({
|
|
|
84
84
|
]
|
|
85
85
|
);
|
|
86
86
|
return /* @__PURE__ */ o(
|
|
87
|
-
|
|
87
|
+
X,
|
|
88
88
|
{
|
|
89
|
-
ref:
|
|
90
|
-
gap:
|
|
89
|
+
ref: v(S, g),
|
|
90
|
+
gap: t ? 4 : 8,
|
|
91
91
|
align: "center",
|
|
92
|
-
wrap:
|
|
93
|
-
className:
|
|
92
|
+
wrap: t && m !== 1,
|
|
93
|
+
className: l(
|
|
94
94
|
"dropzone-value",
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
t && "dropzone-value-multiple",
|
|
96
|
+
R
|
|
97
97
|
),
|
|
98
|
-
style:
|
|
99
|
-
...
|
|
100
|
-
children:
|
|
98
|
+
style: E,
|
|
99
|
+
...N,
|
|
100
|
+
children: t ? j(s) : p(s)
|
|
101
101
|
}
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
|
-
const
|
|
104
|
+
const $ = x(y(J));
|
|
105
105
|
export {
|
|
106
|
-
|
|
106
|
+
$ as Value
|
|
107
107
|
};
|
|
108
108
|
//# sourceMappingURL=value.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value.js","sources":["../../../src/components/drag-drop/value.tsx"],"sourcesContent":["\"use client\";\nimport { FileIcon, XIcon } from \"@bioturing/assets\";\nimport { isEqual } from \"es-toolkit\";\nimport {\n cloneElement,\n forwardRef,\n memo,\n useCallback,\n type ForwardedRef,\n useState,\n} from \"react\";\nimport { IconButton } from \"../icon-button\";\nimport { Stack } from \"../stack\";\nimport { Tag } from \"../tag\";\nimport { Truncate } from \"../truncate\";\nimport { useCls } from \"../utils\";\nimport { DragDropValueProps, type Data } from \"./types\";\nimport mergeRefs from \"merge-refs\";\n\nfunction ValueInner<T extends Data, M extends boolean>(\n {\n value,\n onChange,\n multiple,\n renderValueLabel,\n renderValueIcon,\n className,\n style,\n maxItems,\n ...rest\n }: DragDropValueProps<T, M>,\n ref: ForwardedRef<HTMLDivElement>\n) {\n const cls = useCls();\n\n // todo: make this as reusable hook\n const [containerEl, setContainerEl] = useState<HTMLDivElement>(null);\n const containerRef = useCallback((el: HTMLDivElement | null) => {\n setContainerEl(el);\n }, []);\n\n const renderLabel = useCallback(\n (value: T) => {\n const label = renderValueLabel(value);\n return typeof label === \"string\" ? (\n <Truncate\n position=\"middle\"\n className={cls(\"dropzone-value-label\")}\n container={containerEl}\n >\n {label}\n </Truncate>\n ) : (\n <span className={cls(\"dropzone-value-label\")}>{label}</span>\n );\n },\n [cls, containerEl, renderValueLabel]\n );\n\n const renderedValueIcon = useCallback(\n (value: T) => {\n return cloneElement(renderValueIcon(value) || <FileIcon />, {\n className: cls(\"dropzone-value-icon\"),\n });\n },\n [cls, renderValueIcon]\n );\n\n const handleResetMultiple = useCallback(\n (singleValue: T) => {\n (onChange as (value: T[]) => void)(\n (value as T[]).filter((v) => !isEqual(v, singleValue))\n );\n },\n [onChange, value]\n );\n\n const handleResetSingle = useCallback(() => {\n if (multiple) {\n (onChange as (value: T[]) => void)([] as T[]);\n } else {\n onChange?.(null);\n }\n }, [onChange, multiple]);\n\n const renderSingle = useCallback(\n (value: T) => {\n const label = renderLabel(value as T);\n return (\n <>\n {renderedValueIcon(value as T)}\n {label}\n <IconButton size=\"small\" onClick={handleResetSingle}>\n <XIcon />\n </IconButton>\n </>\n );\n },\n [renderLabel, renderedValueIcon, handleResetSingle]\n );\n\n const renderMultiple = useCallback(\n (value: T[]) => {\n if (maxItems == 1) {\n return renderSingle(value[0]);\n }\n return (\n <>\n {((value as T[]) || []).map((singleValue, index) => {\n const label = renderLabel(singleValue);\n return (\n <Tag\n key={index}\n icon={renderedValueIcon(singleValue)}\n size=\"large\"\n closable\n onClose={() => handleResetMultiple(singleValue)}\n >\n {label}\n </Tag>\n );\n })}\n </>\n );\n },\n [\n renderLabel,\n renderedValueIcon,\n maxItems,\n renderSingle,\n handleResetMultiple,\n ]\n );\n\n return (\n <Stack\n ref={mergeRefs(ref, containerRef)}\n gap={multiple ? 4 : 8}\n align=\"center\"\n wrap={multiple && maxItems !== 1}\n className={cls(\n \"dropzone-value\",\n multiple && \"dropzone-value-multiple\",\n className\n )}\n style={style}\n {...rest}\n >\n {multiple ? renderMultiple(value as T[]) : renderSingle(value as T)}\n </Stack>\n );\n}\n\nexport const Value = memo(forwardRef(ValueInner)) as <\n T extends Data,\n M extends boolean\n>(\n props: DragDropValueProps<T, M> & { ref?: ForwardedRef<HTMLDivElement> }\n) => ReturnType<typeof ValueInner>;\n"],"names":["ValueInner","value","onChange","multiple","renderValueLabel","renderValueIcon","className","style","maxItems","rest","ref","cls","useCls","containerEl","setContainerEl","useState","containerRef","useCallback","el","renderLabel","label","jsx","Truncate","renderedValueIcon","cloneElement","FileIcon","handleResetMultiple","singleValue","v","isEqual","handleResetSingle","renderSingle","jsxs","Fragment","IconButton","XIcon","renderMultiple","index","Tag","Stack","mergeRefs","Value","memo","forwardRef"],"mappings":";;;;;;;;;;;AAmBA,SAASA,EACP;AAAA,EACE,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAMC,
|
|
1
|
+
{"version":3,"file":"value.js","sources":["../../../src/components/drag-drop/value.tsx"],"sourcesContent":["\"use client\";\nimport { FileIcon, XIcon } from \"@bioturing/assets\";\nimport { isEqual } from \"es-toolkit\";\nimport {\n cloneElement,\n forwardRef,\n memo,\n useCallback,\n type ForwardedRef,\n useState,\n} from \"react\";\nimport { IconButton } from \"../icon-button\";\nimport { Stack } from \"../stack\";\nimport { Tag } from \"../tag\";\nimport { Truncate } from \"../truncate\";\nimport { useCls } from \"../utils\";\nimport { DragDropValueProps, type Data } from \"./types\";\nimport mergeRefs from \"merge-refs\";\n\nfunction ValueInner<T extends Data, M extends boolean>(\n {\n value,\n onChange,\n multiple,\n renderValueLabel,\n renderValueIcon,\n className,\n style,\n maxItems,\n ...rest\n }: DragDropValueProps<T, M>,\n ref: ForwardedRef<HTMLDivElement>\n) {\n const cls = useCls();\n\n // todo: make this as reusable hook\n const [containerEl, setContainerEl] = useState<HTMLDivElement>(null);\n const containerRef = useCallback((el: HTMLDivElement | null) => {\n setContainerEl(el);\n }, []);\n\n const renderLabel = useCallback(\n (value: T) => {\n const label = renderValueLabel(value);\n return typeof label === \"string\" ? (\n <Truncate\n position=\"middle\"\n className={cls(\"dropzone-value-label\")}\n container={containerEl}\n >\n {label}\n </Truncate>\n ) : (\n <span className={cls(\"dropzone-value-label\")}>{label}</span>\n );\n },\n [cls, containerEl, renderValueLabel]\n );\n\n const renderedValueIcon = useCallback(\n (value: T) => {\n return cloneElement(renderValueIcon(value) || <FileIcon />, {\n className: cls(\"dropzone-value-icon\"),\n });\n },\n [cls, renderValueIcon]\n );\n\n const handleResetMultiple = useCallback(\n (singleValue: T) => {\n (onChange as (value: T[]) => void)(\n (value as T[]).filter((v) => !isEqual(v, singleValue))\n );\n },\n [onChange, value]\n );\n\n const handleResetSingle = useCallback(() => {\n if (multiple) {\n (onChange as (value: T[]) => void)([] as T[]);\n } else {\n onChange?.(null);\n }\n }, [onChange, multiple]);\n\n const renderSingle = useCallback(\n (value: T) => {\n const label = renderLabel(value as T);\n return (\n <>\n {renderedValueIcon(value as T)}\n {label}\n <IconButton size=\"small\" onClick={handleResetSingle}>\n <XIcon />\n </IconButton>\n </>\n );\n },\n [renderLabel, renderedValueIcon, handleResetSingle]\n );\n\n const renderMultiple = useCallback(\n (value: T[]) => {\n if (maxItems == 1) {\n return renderSingle(value[0]);\n }\n return (\n <>\n {((value as T[]) || []).map((singleValue, index) => {\n const label = renderLabel(singleValue);\n return (\n <Tag\n key={index}\n icon={renderedValueIcon(singleValue)}\n size=\"large\"\n closable\n onClose={() => handleResetMultiple(singleValue)}\n >\n {label}\n </Tag>\n );\n })}\n </>\n );\n },\n [\n renderLabel,\n renderedValueIcon,\n maxItems,\n renderSingle,\n handleResetMultiple,\n ]\n );\n\n return (\n <Stack\n ref={mergeRefs(ref, containerRef)}\n gap={multiple ? 4 : 8}\n align=\"center\"\n wrap={multiple && maxItems !== 1}\n className={cls(\n \"dropzone-value\",\n multiple && \"dropzone-value-multiple\",\n className\n )}\n style={style}\n {...rest}\n >\n {multiple ? renderMultiple(value as T[]) : renderSingle(value as T)}\n </Stack>\n );\n}\n\nexport const Value = memo(forwardRef(ValueInner)) as <\n T extends Data,\n M extends boolean\n>(\n props: DragDropValueProps<T, M> & { ref?: ForwardedRef<HTMLDivElement> }\n) => ReturnType<typeof ValueInner>;\n"],"names":["ValueInner","value","onChange","multiple","renderValueLabel","renderValueIcon","className","style","maxItems","rest","ref","cls","useCls","containerEl","setContainerEl","useState","containerRef","useCallback","el","renderLabel","label","jsx","Truncate","renderedValueIcon","cloneElement","FileIcon","handleResetMultiple","singleValue","v","isEqual","handleResetSingle","renderSingle","jsxs","Fragment","IconButton","XIcon","renderMultiple","index","Tag","Stack","mergeRefs","Value","memo","forwardRef"],"mappings":";;;;;;;;;;;AAmBA,SAASA,EACP;AAAA,EACE,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAMC,EAAA,GAGN,CAACC,GAAaC,CAAc,IAAIC,EAAyB,IAAI,GAC7DC,IAAeC,EAAY,CAACC,MAA8B;AAC9D,IAAAJ,EAAeI,CAAE;AAAA,EACnB,GAAG,CAAA,CAAE,GAECC,IAAcF;AAAA,IAClB,CAAChB,MAAa;AACZ,YAAMmB,IAAQhB,EAAiBH,CAAK;AACpC,aAAO,OAAOmB,KAAU,WACtB,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,UAAS;AAAA,UACT,WAAWX,EAAI,sBAAsB;AAAA,UACrC,WAAWE;AAAA,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jB,IAAQD,EAAYQ,CAAW;AACrC,aACE,gBAAAN;AAAA,QAACiB;AAAA,QAAA;AAAA,UAEC,MAAMf,EAAkBI,CAAW;AAAA,UACnC,MAAK;AAAA,UACL,UAAQ;AAAA,UACR,SAAS,MAAMD,EAAoBC,CAAW;AAAA,UAE7C,UAAAP;AAAA,QAAA;AAAA,QANIiB;AAAA,MAAA;AAAA,IASX,CAAC,EAAA,CACH;AAAA,IAGJ;AAAA,MACElB;AAAA,MACAI;AAAA,MACAf;AAAA,MACAuB;AAAA,MACAL;AAAA,IAAA;AAAA,EACF;AAGF,SACE,gBAAAL;AAAA,IAACkB;AAAA,IAAA;AAAA,MACC,KAAKC,EAAU9B,GAAKM,CAAY;AAAA,MAChC,KAAKb,IAAW,IAAI;AAAA,MACpB,OAAM;AAAA,MACN,MAAMA,KAAYK,MAAa;AAAA,MAC/B,WAAWG;AAAA,QACT;AAAA,QACAR,KAAY;AAAA,QACZG;AAAA,MAAA;AAAA,MAEF,OAAAC;AAAA,MACC,GAAGE;AAAA,MAEH,UAAAN,IAAWiC,EAAenC,CAAY,IAAI8B,EAAa9B,CAAU;AAAA,IAAA;AAAA,EAAA;AAGxE;AAEO,MAAMwC,IAAQC,EAAKC,EAAW3C,CAAU,CAAC;"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Menu } from '@base-ui-components/react/menu';
|
|
2
|
+
import { PopoverProps } from 'antd/es/popover';
|
|
3
|
+
import { Command } from '../cmdk';
|
|
4
|
+
import { PopupPanelSize } from '../popup-panel/constants';
|
|
5
|
+
import { DropdownMenuItemType } from './types';
|
|
6
|
+
import { UseDropdownMenuProps } from './useDropdownMenu';
|
|
7
|
+
export interface DropdownMenuProps extends Omit<UseDropdownMenuProps, "classNames"> {
|
|
8
|
+
/** Array of menu items to be displayed in the dropdown */
|
|
9
|
+
items: DropdownMenuItemType[];
|
|
10
|
+
/** Custom render function for the trigger element */
|
|
11
|
+
children?: React.ComponentProps<typeof Menu.Trigger>["render"];
|
|
12
|
+
/**
|
|
13
|
+
* Placement of the dropdown relative to the trigger element
|
|
14
|
+
* @default "bottomLeft"
|
|
15
|
+
*/
|
|
16
|
+
placement?: PopoverProps["placement"];
|
|
17
|
+
/**
|
|
18
|
+
* Whether to open the dropdown on hover instead of click
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
openOnHover?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Controlled open state of the dropdown
|
|
24
|
+
*/
|
|
25
|
+
open?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Callback fired when the dropdown open state changes
|
|
28
|
+
*/
|
|
29
|
+
onOpenChange?: (open: boolean) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Default open state of the dropdown
|
|
32
|
+
*/
|
|
33
|
+
defaultOpen?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Additional CSS class for the dropdown component
|
|
36
|
+
*/
|
|
37
|
+
className?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Custom class names for different parts of the dropdown
|
|
40
|
+
* @default {}
|
|
41
|
+
*/
|
|
42
|
+
classNames?: {
|
|
43
|
+
root?: string;
|
|
44
|
+
trigger?: string;
|
|
45
|
+
popup?: string;
|
|
46
|
+
itemIcon?: string;
|
|
47
|
+
itemText?: string;
|
|
48
|
+
positioner?: string;
|
|
49
|
+
} & UseDropdownMenuProps["classNames"];
|
|
50
|
+
/**
|
|
51
|
+
* Whether to show search input
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
showSearch?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Size of the dropdown menu
|
|
57
|
+
* @default "auto"
|
|
58
|
+
*/
|
|
59
|
+
size?: "auto" | keyof typeof PopupPanelSize;
|
|
60
|
+
/**
|
|
61
|
+
* Search placeholder
|
|
62
|
+
*/
|
|
63
|
+
searchProps?: Omit<React.ComponentProps<typeof Command.Input>, "size" | "ref">;
|
|
64
|
+
/**
|
|
65
|
+
* Whether to match the width of the popup with the trigger
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
popupMatchTriggerWidth?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Content to display before the list
|
|
71
|
+
*/
|
|
72
|
+
beforeList?: React.ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Content to display after the list
|
|
75
|
+
*/
|
|
76
|
+
afterList?: React.ReactNode;
|
|
77
|
+
}
|
|
78
|
+
export declare const DropdownMenu: ({ children, items, placement, openOnHover, open: outsideOpen, onOpenChange: outsideOnOpenChange, defaultOpen, className, itemRender, classNames, size, showSearch, inCombobox: inComboboxProp, searchProps, popupMatchTriggerWidth, beforeList, afterList, keepOpenOnSelect, highlightedItemKey, selectedItemKeys, getItemKeywords, showCheckbox, itemLabelRender, }: DropdownMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu/component.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAEtD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AASpD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAMlC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAmB,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAG1E,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,YAAY,CAAC;IAChD,0DAA0D;IAC1D,KAAK,EAAE,oBAAoB,EAAE,CAAC;IAC9B,qDAAqD;IACrD,QAAQ,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,C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