@thewrong/ui 0.1.0 → 0.3.0
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/README.md +25 -4
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/components/_shared/form-size-tokens.cjs +1 -0
- package/dist/{src/components → components}/_shared/form-size-tokens.d.ts +3 -1
- package/dist/components/_shared/form-size-tokens.esm.js +34 -0
- package/dist/components/action-toast/ActionToast.cjs +1 -0
- package/dist/{src/components → components}/action-toast/ActionToast.d.ts +17 -3
- package/dist/components/action-toast/ActionToast.esm.js +238 -0
- package/dist/{src/components → components}/action-toast/index.d.ts +2 -2
- package/dist/components/animated-height/AnimatedHeight.cjs +1 -0
- package/dist/components/animated-height/AnimatedHeight.esm.js +36 -0
- package/dist/components/animated-height/index.d.ts +2 -0
- package/dist/components/badge/Badge.cjs +1 -0
- package/dist/{src/components → components}/badge/Badge.d.ts +1 -1
- package/dist/components/badge/Badge.esm.js +26 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/utils.cjs +1 -0
- package/dist/{src/components → components}/badge/utils.d.ts +1 -1
- package/dist/components/badge/utils.esm.js +38 -0
- package/dist/components/button/Button.cjs +1 -0
- package/dist/components/button/Button.d.ts +19 -0
- package/dist/components/button/Button.esm.js +77 -0
- package/dist/{src/components → components}/button/index.d.ts +2 -2
- package/dist/components/button/utils.cjs +1 -0
- package/dist/{src/components → components}/button/utils.d.ts +1 -1
- package/dist/components/button/utils.esm.js +38 -0
- package/dist/components/checkbox/Checkbox.cjs +1 -0
- package/dist/{src/components → components}/checkbox/Checkbox.d.ts +1 -1
- package/dist/components/checkbox/Checkbox.esm.js +69 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/utils.cjs +1 -0
- package/dist/{src/components → components}/checkbox/utils.d.ts +1 -1
- package/dist/components/checkbox/utils.esm.js +44 -0
- package/dist/components/collapsible/Collapsible.cjs +1 -0
- package/dist/components/collapsible/Collapsible.esm.js +20 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/copyable-text/CopyableText.cjs +1 -0
- package/dist/components/copyable-text/CopyableText.d.ts +22 -0
- package/dist/components/copyable-text/CopyableText.esm.js +50 -0
- package/dist/components/copyable-text/index.d.ts +2 -0
- package/dist/components/date-input/DateInput.cjs +1 -0
- package/dist/{src/components → components}/date-input/DateInput.d.ts +1 -0
- package/dist/components/date-input/DateInput.esm.js +40 -0
- package/dist/components/date-input/index.d.ts +1 -0
- package/dist/components/date-picker/PickerSheet.cjs +1 -0
- package/dist/components/date-picker/PickerSheet.d.ts +22 -0
- package/dist/components/date-picker/PickerSheet.esm.js +77 -0
- package/dist/components/date-picker/date-picker.cjs +1 -0
- package/dist/{src/components → components}/date-picker/date-picker.d.ts +1 -0
- package/dist/components/date-picker/date-picker.esm.js +183 -0
- package/dist/components/date-picker/date-range-picker.cjs +1 -0
- package/dist/{src/components → components}/date-picker/date-range-picker.d.ts +3 -1
- package/dist/components/date-picker/date-range-picker.esm.js +238 -0
- package/dist/components/date-picker/index.d.ts +5 -0
- package/dist/components/date-picker/month-picker.cjs +1 -0
- package/dist/{src/components → components}/date-picker/month-picker.d.ts +1 -0
- package/dist/components/date-picker/month-picker.esm.js +103 -0
- package/dist/components/drawer/Drawer.cjs +1 -0
- package/dist/components/drawer/Drawer.d.ts +45 -0
- package/dist/components/drawer/Drawer.esm.js +143 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/error-boundary/ErrorBoundary.cjs +1 -0
- package/dist/components/error-boundary/ErrorBoundary.d.ts +23 -0
- package/dist/components/error-boundary/ErrorBoundary.esm.js +46 -0
- package/dist/components/error-boundary/chunk-reload.cjs +1 -0
- package/dist/components/error-boundary/chunk-reload.d.ts +77 -0
- package/dist/components/error-boundary/chunk-reload.esm.js +73 -0
- package/dist/components/error-boundary/index.d.ts +4 -0
- package/dist/components/error-boundary/types.d.ts +23 -0
- package/dist/components/field/Field.cjs +1 -0
- package/dist/components/field/Field.d.ts +16 -0
- package/dist/components/field/Field.esm.js +34 -0
- package/dist/components/field/FieldMessage.cjs +1 -0
- package/dist/components/field/FieldMessage.d.ts +19 -0
- package/dist/components/field/FieldMessage.esm.js +12 -0
- package/dist/components/field/index.d.ts +3 -0
- package/dist/components/field/types.d.ts +24 -0
- package/dist/components/info-tooltip/InfoTooltip.cjs +1 -0
- package/dist/{src/components → components}/info-tooltip/InfoTooltip.d.ts +7 -0
- package/dist/components/info-tooltip/InfoTooltip.esm.js +25 -0
- package/dist/components/info-tooltip/index.d.ts +2 -0
- package/dist/components/input/DecimalInput.cjs +1 -0
- package/dist/components/input/DecimalInput.d.ts +18 -0
- package/dist/components/input/DecimalInput.esm.js +40 -0
- package/dist/components/input/Input.cjs +1 -0
- package/dist/{src/components → components}/input/Input.d.ts +1 -1
- package/dist/components/input/Input.esm.js +89 -0
- package/dist/components/input/PasswordInput.cjs +1 -0
- package/dist/{src/components → components}/input/PasswordInput.d.ts +1 -1
- package/dist/components/input/PasswordInput.esm.js +29 -0
- package/dist/components/input/decimal-validation.cjs +1 -0
- package/dist/components/input/decimal-validation.d.ts +7 -0
- package/dist/components/input/decimal-validation.esm.js +66 -0
- package/dist/components/input/format.cjs +1 -0
- package/dist/{src/components → components}/input/format.d.ts +17 -1
- package/dist/components/input/format.esm.js +44 -0
- package/dist/components/input/index.d.ts +7 -0
- package/dist/{src/components → components}/input/types.d.ts +2 -2
- package/dist/components/input/use-input-format.cjs +1 -0
- package/dist/components/input/use-input-format.d.ts +43 -0
- package/dist/components/input/use-input-format.esm.js +75 -0
- package/dist/components/input/utils.cjs +1 -0
- package/dist/{src/components → components}/input/utils.d.ts +1 -1
- package/dist/components/input/utils.esm.js +24 -0
- package/dist/components/loading-spinner/LoadingSpinner.cjs +1 -0
- package/dist/{src/components → components}/loading-spinner/LoadingSpinner.d.ts +7 -0
- package/dist/components/loading-spinner/LoadingSpinner.esm.js +48 -0
- package/dist/components/loading-spinner/index.d.ts +2 -0
- package/dist/components/modal/Modal.cjs +1 -0
- package/dist/{src/components → components}/modal/Modal.d.ts +34 -2
- package/dist/components/modal/Modal.esm.js +167 -0
- package/dist/components/modal/ModalFocusTrapContext.cjs +1 -0
- package/dist/components/modal/ModalFocusTrapContext.d.ts +18 -0
- package/dist/components/modal/ModalFocusTrapContext.esm.js +36 -0
- package/dist/components/modal/ModalSubView.cjs +1 -0
- package/dist/{src/components → components}/modal/ModalSubView.d.ts +6 -1
- package/dist/components/modal/ModalSubView.esm.js +111 -0
- package/dist/components/modal/StandardModal.cjs +1 -0
- package/dist/{src/components → components}/modal/StandardModal.d.ts +8 -2
- package/dist/components/modal/StandardModal.esm.js +57 -0
- package/dist/components/modal/index.d.ts +6 -0
- package/dist/components/month-range-picker/index.d.ts +2 -0
- package/dist/components/month-range-picker/month-range-picker.cjs +1 -0
- package/dist/components/month-range-picker/month-range-picker.d.ts +16 -0
- package/dist/components/month-range-picker/month-range-picker.esm.js +227 -0
- package/dist/components/month-range-picker/month-range-utils.cjs +1 -0
- package/dist/components/month-range-picker/month-range-utils.d.ts +9 -0
- package/dist/components/month-range-picker/month-range-utils.esm.js +28 -0
- package/dist/components/page-title/PageTitle.cjs +1 -0
- package/dist/components/page-title/PageTitle.esm.js +17 -0
- package/dist/components/page-title/index.d.ts +1 -0
- package/dist/components/popover/Popover.cjs +1 -0
- package/dist/{src/components → components}/popover/Popover.d.ts +19 -1
- package/dist/components/popover/Popover.esm.js +57 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/progress/Progress.cjs +1 -0
- package/dist/components/progress/Progress.d.ts +13 -0
- package/dist/components/progress/Progress.esm.js +24 -0
- package/dist/components/progress/index.d.ts +2 -0
- package/dist/components/progress/types.d.ts +13 -0
- package/dist/components/radio/Radio.cjs +1 -0
- package/dist/components/radio/Radio.d.ts +31 -0
- package/dist/components/radio/Radio.esm.js +118 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/radio/types.d.ts +24 -0
- package/dist/components/search-box/ExactMatchToggle.cjs +1 -0
- package/dist/components/search-box/ExactMatchToggle.esm.js +28 -0
- package/dist/components/search-box/SearchBox.cjs +1 -0
- package/dist/{src/components → components}/search-box/SearchBox.d.ts +1 -1
- package/dist/components/search-box/SearchBox.esm.js +155 -0
- package/dist/components/search-box/SearchBoxChips.cjs +1 -0
- package/dist/components/search-box/SearchBoxChips.esm.js +36 -0
- package/dist/components/search-box/SearchBoxDateRange.cjs +1 -0
- package/dist/{src/components → components}/search-box/SearchBoxDateRange.d.ts +1 -1
- package/dist/components/search-box/SearchBoxDateRange.esm.js +60 -0
- package/dist/components/search-box/SearchBoxDateSingle.cjs +1 -0
- package/dist/{src/components → components}/search-box/SearchBoxDateSingle.d.ts +1 -1
- package/dist/components/search-box/SearchBoxDateSingle.esm.js +39 -0
- package/dist/components/search-box/SearchBoxField.cjs +1 -0
- package/dist/{src/components → components}/search-box/SearchBoxField.d.ts +1 -1
- package/dist/components/search-box/SearchBoxField.esm.js +48 -0
- package/dist/components/search-box/SearchBoxFloatingInput.cjs +1 -0
- package/dist/components/search-box/SearchBoxFloatingInput.esm.js +43 -0
- package/dist/components/search-box/SearchBoxFloatingSelect.cjs +1 -0
- package/dist/{src/components → components}/search-box/SearchBoxFloatingSelect.d.ts +1 -1
- package/dist/components/search-box/SearchBoxFloatingSelect.esm.js +79 -0
- package/dist/components/search-box/SearchBoxMonth.cjs +1 -0
- package/dist/components/search-box/SearchBoxMonth.esm.js +36 -0
- package/dist/components/search-box/SearchBoxMultiSelect.cjs +1 -0
- package/dist/{src/components → components}/search-box/SearchBoxMultiSelect.d.ts +2 -2
- package/dist/components/search-box/SearchBoxMultiSelect.esm.js +83 -0
- package/dist/components/search-box/SearchBoxSheetContext.cjs +1 -0
- package/dist/components/search-box/SearchBoxSheetContext.esm.js +5 -0
- package/dist/components/search-box/dateRangePresets.cjs +1 -0
- package/dist/{src/components → components}/search-box/dateRangePresets.d.ts +1 -1
- package/dist/components/search-box/dateRangePresets.esm.js +59 -0
- package/dist/{src/components → components}/search-box/index.d.ts +5 -5
- package/dist/components/search-box/parseDateRange.cjs +1 -0
- package/dist/components/search-box/parseDateRange.esm.js +21 -0
- package/dist/components/search-box/parseSearchValues.cjs +1 -0
- package/dist/{src/components → components}/search-box/parseSearchValues.d.ts +2 -2
- package/dist/components/search-box/parseSearchValues.esm.js +15 -0
- package/dist/{src/components → components}/search-box/types.d.ts +1 -1
- package/dist/components/search-box/useSearchBoxState.cjs +1 -0
- package/dist/{src/components → components}/search-box/useSearchBoxState.d.ts +1 -1
- package/dist/components/search-box/useSearchBoxState.esm.js +87 -0
- package/dist/components/segmented-code-input/SegmentedCodeInput.cjs +1 -0
- package/dist/components/segmented-code-input/SegmentedCodeInput.d.ts +49 -0
- package/dist/components/segmented-code-input/SegmentedCodeInput.esm.js +87 -0
- package/dist/components/segmented-code-input/code-utils.cjs +1 -0
- package/dist/components/segmented-code-input/code-utils.d.ts +4 -0
- package/dist/components/segmented-code-input/code-utils.esm.js +9 -0
- package/dist/components/segmented-code-input/index.d.ts +2 -0
- package/dist/components/segmented-control/SegmentedControl.cjs +1 -0
- package/dist/components/segmented-control/SegmentedControl.d.ts +27 -0
- package/dist/components/segmented-control/SegmentedControl.esm.js +84 -0
- package/dist/components/segmented-control/index.d.ts +2 -0
- package/dist/components/segmented-control/types.d.ts +30 -0
- package/dist/components/select/MultiSelect.cjs +1 -0
- package/dist/{src/components → components}/select/MultiSelect.d.ts +11 -3
- package/dist/components/select/MultiSelect.esm.js +279 -0
- package/dist/components/select/Select.cjs +1 -0
- package/dist/{src/components → components}/select/Select.d.ts +16 -2
- package/dist/components/select/Select.esm.js +320 -0
- package/dist/components/select/index.d.ts +4 -0
- package/dist/components/select/loading-dots.cjs +1 -0
- package/dist/components/select/loading-dots.d.ts +3 -0
- package/dist/components/select/loading-dots.esm.js +24 -0
- package/dist/components/select/panel-width.cjs +1 -0
- package/dist/components/select/panel-width.d.ts +2 -0
- package/dist/components/select/panel-width.esm.js +7 -0
- package/dist/{src/components → components}/select/utils.d.ts +1 -1
- package/dist/components/skeleton/Skeleton.cjs +1 -0
- package/dist/components/skeleton/Skeleton.d.ts +6 -0
- package/dist/components/skeleton/Skeleton.esm.js +12 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/types.d.ts +2 -0
- package/dist/components/stepper/Stepper.cjs +1 -0
- package/dist/components/stepper/Stepper.d.ts +51 -0
- package/dist/components/stepper/Stepper.esm.js +142 -0
- package/dist/components/stepper/index.d.ts +4 -0
- package/dist/components/stepper/use-stepper.cjs +1 -0
- package/dist/components/stepper/use-stepper.d.ts +43 -0
- package/dist/components/stepper/use-stepper.esm.js +57 -0
- package/dist/components/switch/Switch.cjs +1 -0
- package/dist/{src/components → components}/switch/Switch.d.ts +1 -1
- package/dist/components/switch/Switch.esm.js +37 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/utils.cjs +1 -0
- package/dist/{src/components → components}/switch/utils.d.ts +2 -2
- package/dist/components/switch/utils.esm.js +40 -0
- package/dist/components/table/accordion-table.cjs +1 -0
- package/dist/{src/components → components}/table/accordion-table.d.ts +1 -1
- package/dist/components/table/accordion-table.esm.js +418 -0
- package/dist/components/table/column-group-utils.cjs +1 -0
- package/dist/{src/components → components}/table/column-group-utils.d.ts +1 -1
- package/dist/components/table/column-group-utils.esm.js +53 -0
- package/dist/components/table/components/ColumnPresetSelector.cjs +1 -0
- package/dist/{src/components → components}/table/components/ColumnPresetSelector.d.ts +2 -2
- package/dist/components/table/components/ColumnPresetSelector.esm.js +166 -0
- package/dist/components/table/components/ColumnSettingsTable.cjs +1 -0
- package/dist/{src/components → components}/table/components/ColumnSettingsTable.d.ts +1 -1
- package/dist/components/table/components/ColumnSettingsTable.esm.js +194 -0
- package/dist/components/table/components/KeyboardNavButton.cjs +1 -0
- package/dist/components/table/components/KeyboardNavButton.esm.js +24 -0
- package/dist/components/table/components/PageJumpInput.cjs +1 -0
- package/dist/components/table/components/PageJumpInput.esm.js +54 -0
- package/dist/components/table/components/Pagination.cjs +1 -0
- package/dist/components/table/components/Pagination.esm.js +163 -0
- package/dist/components/table/components/PaginationFooter.cjs +1 -0
- package/dist/components/table/components/PaginationFooter.esm.js +80 -0
- package/dist/components/table/components/SortableHeaderCell.cjs +1 -0
- package/dist/components/table/components/SortableHeaderCell.esm.js +30 -0
- package/dist/components/table/hooks/useColumnPresets.cjs +1 -0
- package/dist/{src/components → components}/table/hooks/useColumnPresets.d.ts +2 -2
- package/dist/components/table/hooks/useColumnPresets.esm.js +165 -0
- package/dist/components/table/hooks/useColumnResize.cjs +1 -0
- package/dist/{src/components → components}/table/hooks/useColumnResize.d.ts +12 -0
- package/dist/components/table/hooks/useColumnResize.esm.js +118 -0
- package/dist/components/table/hooks/useFillEmptyRows.d.ts +2 -0
- package/dist/components/table/hooks/useInfiniteScroll.d.ts +2 -0
- package/dist/components/table/hooks/useTableColumnState.cjs +1 -0
- package/dist/{src/components → components}/table/hooks/useTableColumnState.d.ts +1 -1
- package/dist/components/table/hooks/useTableColumnState.esm.js +46 -0
- package/dist/components/table/hooks/useTableDragSelection.d.ts +2 -0
- package/dist/components/table/hooks/useTableSort.cjs +1 -0
- package/dist/{src/components → components}/table/hooks/useTableSort.d.ts +1 -1
- package/dist/components/table/hooks/useTableSort.esm.js +30 -0
- package/dist/components/table/hooks/useVirtualTable.cjs +1 -0
- package/dist/components/table/hooks/useVirtualTable.esm.js +18 -0
- package/dist/components/table/index.d.ts +27 -0
- package/dist/components/table/mini-table.cjs +1 -0
- package/dist/{src/components → components}/table/mini-table.d.ts +1 -1
- package/dist/components/table/mini-table.esm.js +127 -0
- package/dist/components/table/paginated-mini-table.cjs +1 -0
- package/dist/{src/components → components}/table/paginated-mini-table.d.ts +1 -1
- package/dist/components/table/paginated-mini-table.esm.js +31 -0
- package/dist/components/table/paginated-table.cjs +1 -0
- package/dist/{src/components → components}/table/paginated-table.d.ts +1 -1
- package/dist/components/table/paginated-table.esm.js +31 -0
- package/dist/components/table/table.cjs +1 -0
- package/dist/{src/components → components}/table/table.d.ts +2 -1
- package/dist/components/table/table.esm.js +343 -0
- package/dist/components/table/utils.cjs +35 -0
- package/dist/{src/components → components}/table/utils.d.ts +2 -2
- package/dist/components/table/utils.esm.js +16 -0
- package/dist/components/table-checkbox/TableCheckbox.cjs +1 -0
- package/dist/components/table-checkbox/TableCheckbox.esm.js +40 -0
- package/dist/components/table-checkbox/index.d.ts +1 -0
- package/dist/components/table-page-layout/TablePageLayout.cjs +1 -0
- package/dist/components/table-page-layout/TablePageLayout.esm.js +37 -0
- package/dist/{src/components → components}/table-page-layout/index.d.ts +1 -1
- package/dist/components/textarea/Textarea.cjs +1 -0
- package/dist/{src/components → components}/textarea/Textarea.d.ts +1 -1
- package/dist/components/textarea/Textarea.esm.js +64 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/time-picker/index.d.ts +2 -0
- package/dist/components/time-picker/time-picker.cjs +1 -0
- package/dist/components/time-picker/time-picker.d.ts +35 -0
- package/dist/components/time-picker/time-picker.esm.js +193 -0
- package/dist/components/time-picker/time-utils.cjs +1 -0
- package/dist/components/time-picker/time-utils.d.ts +12 -0
- package/dist/components/time-picker/time-utils.esm.js +56 -0
- package/dist/components/toast/ToastProvider.cjs +1 -0
- package/dist/{src/components → components}/toast/ToastProvider.d.ts +3 -0
- package/dist/components/toast/ToastProvider.esm.js +86 -0
- package/dist/components/toast/index.d.ts +3 -0
- package/dist/components/toast/index.esm.js +3 -0
- package/dist/components/toolbar/Toolbar.cjs +1 -0
- package/dist/{src/components → components}/toolbar/Toolbar.d.ts +1 -1
- package/dist/components/toolbar/Toolbar.esm.js +149 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/tooltip/Tooltip.cjs +1 -0
- package/dist/{src/components → components}/tooltip/Tooltip.d.ts +10 -0
- package/dist/components/tooltip/Tooltip.esm.js +39 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/typewriter-text/TypewriterText.cjs +1 -0
- package/dist/components/typewriter-text/TypewriterText.d.ts +7 -0
- package/dist/components/typewriter-text/TypewriterText.esm.js +58 -0
- package/dist/components/typewriter-text/index.d.ts +2 -0
- package/dist/components/typewriter-text/types.d.ts +12 -0
- package/dist/components/typing-dots/TypingDots.cjs +1 -0
- package/dist/components/typing-dots/TypingDots.d.ts +10 -0
- package/dist/components/typing-dots/TypingDots.esm.js +37 -0
- package/dist/components/typing-dots/index.d.ts +2 -0
- package/dist/components/typing-dots/types.d.ts +4 -0
- package/dist/hooks/awaitableOverlayController.cjs +1 -0
- package/dist/hooks/awaitableOverlayController.d.ts +6 -0
- package/dist/hooks/awaitableOverlayController.esm.js +18 -0
- package/dist/hooks/index.d.ts +17 -0
- package/dist/hooks/useAwaitableOverlay.cjs +1 -0
- package/dist/hooks/useAwaitableOverlay.d.ts +16 -0
- package/dist/hooks/useAwaitableOverlay.esm.js +22 -0
- package/dist/hooks/useBottomSheetDrag.cjs +1 -0
- package/dist/hooks/useBottomSheetDrag.esm.js +17 -0
- package/dist/hooks/useClickOutside.cjs +1 -0
- package/dist/hooks/useClickOutside.esm.js +20 -0
- package/dist/hooks/useFillEmptyRows.cjs +1 -0
- package/dist/{src/components/table/hooks → hooks}/useFillEmptyRows.d.ts +10 -1
- package/dist/hooks/useFillEmptyRows.esm.js +60 -0
- package/dist/hooks/useFocusTrap.cjs +1 -0
- package/dist/hooks/useFocusTrap.d.ts +47 -0
- package/dist/hooks/useFocusTrap.esm.js +210 -0
- package/dist/hooks/useInfiniteScroll.cjs +1 -0
- package/dist/hooks/useInfiniteScroll.d.ts +36 -0
- package/dist/hooks/useInfiniteScroll.esm.js +31 -0
- package/dist/hooks/useMediaQuery.cjs +1 -0
- package/dist/hooks/useMediaQuery.esm.js +15 -0
- package/dist/hooks/useScrollLock.cjs +1 -0
- package/dist/hooks/useScrollLock.esm.js +16 -0
- package/dist/hooks/useTableDragSelection.cjs +1 -0
- package/dist/{src/components/table/hooks → hooks}/useTableDragSelection.d.ts +3 -4
- package/dist/hooks/useTableDragSelection.esm.js +79 -0
- package/dist/hooks/useVirtualRows.cjs +1 -0
- package/dist/hooks/useVirtualRows.d.ts +56 -0
- package/dist/hooks/useVirtualRows.esm.js +20 -0
- package/dist/hooks.cjs +1 -0
- package/dist/hooks.esm.js +12 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.esm.js +81 -0
- package/dist/lib/Portal.cjs +1 -0
- package/dist/lib/Portal.esm.js +11 -0
- package/dist/lib/column-preset-storage.cjs +1 -0
- package/dist/lib/column-preset-storage.esm.js +123 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/overlay-stack.cjs +1 -0
- package/dist/lib/overlay-stack.esm.js +28 -0
- package/dist/lib/utils.cjs +1 -0
- package/dist/{src/lib → lib}/utils.d.ts +2 -1
- package/dist/lib/utils.esm.js +114 -0
- package/dist/node_modules/clsx/dist/clsx.cjs +1 -0
- package/dist/node_modules/clsx/dist/clsx.esm.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/Icon.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/Icon.esm.js +23 -0
- package/dist/node_modules/lucide-react/dist/esm/context.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/context.esm.js +6 -0
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.esm.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.esm.js +14 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-left.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-left.esm.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/calendar.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/calendar.esm.js +25 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/check.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/check.esm.js +7 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.esm.js +7 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.esm.js +7 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.esm.js +7 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-left.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-left.esm.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-right.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-right.esm.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.esm.js +12 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/circle-x.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/circle-x.esm.js +19 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/clock.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/clock.esm.js +12 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/copy.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/copy.esm.js +15 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/eye-off.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/eye-off.esm.js +21 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/eye.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/eye.esm.js +12 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/grip-vertical.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/grip-vertical.esm.js +41 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/info.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/info.esm.js +19 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/keyboard.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/keyboard.esm.js +45 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/list-filter.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/list-filter.esm.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/loader-circle.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/loader-circle.esm.js +7 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/minus.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/minus.esm.js +7 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/rotate-ccw.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/rotate-ccw.esm.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/save.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/save.esm.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/search.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/search.esm.js +12 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/settings.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/settings.esm.js +12 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/triangle-alert.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/triangle-alert.esm.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/wrench.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/wrench.esm.js +7 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/x.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/x.esm.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.esm.js +7 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.esm.js +4 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.esm.js +4 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.esm.js +4 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.esm.js +8 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.cjs +1 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.esm.js +1723 -0
- package/dist/node_modules/use-debounce/dist/index.module.cjs +1 -0
- package/dist/node_modules/use-debounce/dist/index.module.esm.js +70 -0
- package/dist/tokens.css +1085 -0
- package/dist/ui.css +1 -1
- package/llms.txt +117 -0
- package/package.json +18 -9
- package/dist/index.cjs.js +0 -40
- package/dist/index.es.js +0 -8066
- package/dist/src/components/animated-height/index.d.ts +0 -2
- package/dist/src/components/badge/index.d.ts +0 -2
- package/dist/src/components/button/Button.d.ts +0 -2
- package/dist/src/components/checkbox/index.d.ts +0 -2
- package/dist/src/components/collapsible/index.d.ts +0 -2
- package/dist/src/components/date-input/index.d.ts +0 -1
- package/dist/src/components/date-picker/index.d.ts +0 -5
- package/dist/src/components/drawer/Drawer.d.ts +0 -18
- package/dist/src/components/drawer/index.d.ts +0 -2
- package/dist/src/components/info-tooltip/index.d.ts +0 -2
- package/dist/src/components/input/index.d.ts +0 -4
- package/dist/src/components/loading-spinner/index.d.ts +0 -2
- package/dist/src/components/modal/index.d.ts +0 -6
- package/dist/src/components/page-title/index.d.ts +0 -1
- package/dist/src/components/popover/index.d.ts +0 -2
- package/dist/src/components/select/index.d.ts +0 -4
- package/dist/src/components/select/loading-dots.d.ts +0 -9
- package/dist/src/components/switch/index.d.ts +0 -2
- package/dist/src/components/table/hooks/useInfiniteScroll.d.ts +0 -58
- package/dist/src/components/table/index.d.ts +0 -27
- package/dist/src/components/table-checkbox/index.d.ts +0 -1
- package/dist/src/components/textarea/index.d.ts +0 -2
- package/dist/src/components/toast/index.d.ts +0 -3
- package/dist/src/components/toolbar/index.d.ts +0 -2
- package/dist/src/components/tooltip/index.d.ts +0 -2
- package/dist/src/hooks/index.d.ts +0 -4
- package/dist/src/index.d.ts +0 -27
- package/dist/src/lib/index.d.ts +0 -6
- /package/dist/{src/components → components}/animated-height/AnimatedHeight.d.ts +0 -0
- /package/dist/{src/components → components}/badge/types.d.ts +0 -0
- /package/dist/{src/components → components}/button/types.d.ts +0 -0
- /package/dist/{src/components → components}/checkbox/types.d.ts +0 -0
- /package/dist/{src/components → components}/collapsible/Collapsible.d.ts +0 -0
- /package/dist/{src/components → components}/page-title/PageTitle.d.ts +0 -0
- /package/dist/{src/components → components}/search-box/ExactMatchToggle.d.ts +0 -0
- /package/dist/{src/components → components}/search-box/SearchBoxChips.d.ts +0 -0
- /package/dist/{src/components → components}/search-box/SearchBoxFloatingInput.d.ts +0 -0
- /package/dist/{src/components → components}/search-box/SearchBoxMonth.d.ts +0 -0
- /package/dist/{src/components → components}/search-box/SearchBoxSheetContext.d.ts +0 -0
- /package/dist/{src/components → components}/search-box/parseDateRange.d.ts +0 -0
- /package/dist/{src/components → components}/select/types.d.ts +0 -0
- /package/dist/{src/components → components}/switch/types.d.ts +0 -0
- /package/dist/{src/components → components}/table/components/KeyboardNavButton.d.ts +0 -0
- /package/dist/{src/components → components}/table/components/PageJumpInput.d.ts +0 -0
- /package/dist/{src/components → components}/table/components/Pagination.d.ts +0 -0
- /package/dist/{src/components → components}/table/components/PaginationFooter.d.ts +0 -0
- /package/dist/{src/components → components}/table/components/SortableHeaderCell.d.ts +0 -0
- /package/dist/{src/components → components}/table/hooks/useVirtualTable.d.ts +0 -0
- /package/dist/{src/components → components}/table/types.d.ts +0 -0
- /package/dist/{src/components → components}/table-checkbox/TableCheckbox.d.ts +0 -0
- /package/dist/{src/components → components}/table-page-layout/TablePageLayout.d.ts +0 -0
- /package/dist/{src/components → components}/textarea/types.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useBottomSheetDrag.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useClickOutside.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useMediaQuery.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useScrollLock.d.ts +0 -0
- /package/dist/{src/lib → lib}/Portal.d.ts +0 -0
- /package/dist/{src/lib → lib}/column-preset-storage.d.ts +0 -0
- /package/dist/{src/lib → lib}/overlay-stack.d.ts +0 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { cn as e } from "../../../lib/utils.esm.js";
|
|
2
|
+
import { ChevronLeft as t } from "../../../node_modules/lucide-react/dist/esm/icons/chevron-left.esm.js";
|
|
3
|
+
import { ChevronRight as n } from "../../../node_modules/lucide-react/dist/esm/icons/chevron-right.esm.js";
|
|
4
|
+
import { ChevronsLeft as r } from "../../../node_modules/lucide-react/dist/esm/icons/chevrons-left.esm.js";
|
|
5
|
+
import { ChevronsRight as i } from "../../../node_modules/lucide-react/dist/esm/icons/chevrons-right.esm.js";
|
|
6
|
+
import { useLayoutEffect as a, useRef as o, useState as s } from "react";
|
|
7
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/table/components/Pagination.tsx
|
|
9
|
+
var d = [
|
|
10
|
+
9,
|
|
11
|
+
7,
|
|
12
|
+
5,
|
|
13
|
+
3,
|
|
14
|
+
1
|
|
15
|
+
], f = 16, p = "px-0.5 text-xs text-fg-subtle font-mono @min-[640px]/pagebar:px-1 @min-[640px]/pagebar:text-sm", m = "inline-flex h-7 min-w-6 items-center justify-center rounded-control-mini px-1.5 font-mono text-xs tabular-nums transition-colors @min-[640px]/pagebar:h-8 @min-[640px]/pagebar:min-w-7 @min-[640px]/pagebar:px-2 @min-[640px]/pagebar:text-sm", h = "text-fg-disabled hover:bg-bg-subtle hover:text-fg-default", g = "font-bold text-fg-default", _ = "outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary", v = "disabled:cursor-not-allowed disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:text-fg-subtle";
|
|
16
|
+
function y({ active: t = !1, className: n = "", children: r, ...i }) {
|
|
17
|
+
return /* @__PURE__ */ l("button", {
|
|
18
|
+
type: "button",
|
|
19
|
+
"aria-current": t ? "page" : void 0,
|
|
20
|
+
className: e(m, t ? g : h, _, v, n),
|
|
21
|
+
...i,
|
|
22
|
+
children: r
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function b(e, t, n) {
|
|
26
|
+
let r = Math.floor(n / 2), i = Math.max(1, e - r), a = Math.min(t, i + n - 1);
|
|
27
|
+
a - i < n - 1 && (i = Math.max(1, a - n + 1));
|
|
28
|
+
let o = [];
|
|
29
|
+
for (let e = i; e <= a; e++) o.push(e);
|
|
30
|
+
return o;
|
|
31
|
+
}
|
|
32
|
+
function x(e, t) {
|
|
33
|
+
let n = t <= 28 ? 4 : 8, r = t <= 28, i = r ? 24 : 28, a = r ? 7 : 8;
|
|
34
|
+
return e.reduce((e, t) => {
|
|
35
|
+
let n = String(t).length;
|
|
36
|
+
return e + Math.max(i, i + (n - 1) * a);
|
|
37
|
+
}, 0) + n * Math.max(0, e.length - 1) + f * 2 + 24;
|
|
38
|
+
}
|
|
39
|
+
function S(e, t, n, r, i, a) {
|
|
40
|
+
let o = e - r, s = d.filter((e) => e <= a);
|
|
41
|
+
for (let e of s) if (x(b(t, n, e), i) <= o) return e;
|
|
42
|
+
return 1;
|
|
43
|
+
}
|
|
44
|
+
function C({ currentPage: e, totalPages: t, pages: n, onPageChange: r, testId: i }) {
|
|
45
|
+
if (n.length === 0) return null;
|
|
46
|
+
let a = n[0] > 1, o = n[n.length - 1] < t;
|
|
47
|
+
return /* @__PURE__ */ u(c, { children: [
|
|
48
|
+
a && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(y, {
|
|
49
|
+
active: e === 1,
|
|
50
|
+
onClick: () => r(1),
|
|
51
|
+
"data-testid": i ? `${i}-page-1` : void 0,
|
|
52
|
+
children: "1"
|
|
53
|
+
}), n[0] > 2 && /* @__PURE__ */ l("span", {
|
|
54
|
+
className: p,
|
|
55
|
+
children: "…"
|
|
56
|
+
})] }),
|
|
57
|
+
n.map((t) => /* @__PURE__ */ l(y, {
|
|
58
|
+
active: e === t,
|
|
59
|
+
onClick: () => r(t),
|
|
60
|
+
"data-testid": i ? `${i}-page-${t}` : void 0,
|
|
61
|
+
children: t
|
|
62
|
+
}, t)),
|
|
63
|
+
o && /* @__PURE__ */ u(c, { children: [n[n.length - 1] < t - 1 && /* @__PURE__ */ l("span", {
|
|
64
|
+
className: p,
|
|
65
|
+
children: "…"
|
|
66
|
+
}), /* @__PURE__ */ l(y, {
|
|
67
|
+
active: e === t,
|
|
68
|
+
onClick: () => r(t),
|
|
69
|
+
"data-testid": i ? `${i}-page-${t}` : void 0,
|
|
70
|
+
children: t
|
|
71
|
+
})] })
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
function w({ currentPage: c, totalPages: d, onPageChange: f, hasPreviousPage: p, hasNextPage: m, maxPageButtons: h = 9, className: g = "", "data-testid": _, ...v }) {
|
|
75
|
+
let x = o(null), [w, T] = s(h);
|
|
76
|
+
if (a(() => {
|
|
77
|
+
let e = x.current;
|
|
78
|
+
if (!e) return;
|
|
79
|
+
let t = e.parentElement;
|
|
80
|
+
if (!t) return;
|
|
81
|
+
let n = () => {
|
|
82
|
+
let e = t.offsetWidth, n = e < 640, r = n ? 28 : 32, i = n ? 4 : 8, a = S(e, c, d, r * 4 + i * 5, r, h);
|
|
83
|
+
T((e) => e === a ? e : a);
|
|
84
|
+
};
|
|
85
|
+
n();
|
|
86
|
+
let r = new ResizeObserver(n);
|
|
87
|
+
return r.observe(t), () => r.disconnect();
|
|
88
|
+
}, [
|
|
89
|
+
c,
|
|
90
|
+
d,
|
|
91
|
+
h
|
|
92
|
+
]), d < 1) return null;
|
|
93
|
+
if (d === 1) return /* @__PURE__ */ l("div", {
|
|
94
|
+
ref: x,
|
|
95
|
+
className: e("flex items-center justify-center gap-1 sm:gap-2", g),
|
|
96
|
+
"data-testid": _,
|
|
97
|
+
...v,
|
|
98
|
+
children: /* @__PURE__ */ l(y, {
|
|
99
|
+
active: !0,
|
|
100
|
+
disabled: !0,
|
|
101
|
+
"data-testid": _ ? `${_}-page-1` : void 0,
|
|
102
|
+
children: "1"
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
let E = b(c, d, w);
|
|
106
|
+
return /* @__PURE__ */ u("div", {
|
|
107
|
+
ref: x,
|
|
108
|
+
className: e("flex items-center justify-center gap-1 sm:gap-2", g),
|
|
109
|
+
"data-testid": _,
|
|
110
|
+
...v,
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ l(y, {
|
|
113
|
+
disabled: c === 1,
|
|
114
|
+
onClick: () => f(1),
|
|
115
|
+
"data-testid": _ ? `${_}-first` : void 0,
|
|
116
|
+
"aria-label": "첫 페이지",
|
|
117
|
+
children: /* @__PURE__ */ l(r, {
|
|
118
|
+
className: "h-3.5 w-3.5",
|
|
119
|
+
"aria-hidden": "true"
|
|
120
|
+
})
|
|
121
|
+
}),
|
|
122
|
+
/* @__PURE__ */ l(y, {
|
|
123
|
+
disabled: p === !1 || c === 1,
|
|
124
|
+
onClick: () => f(c - 1),
|
|
125
|
+
"data-testid": _ ? `${_}-prev` : void 0,
|
|
126
|
+
"aria-label": "이전 페이지",
|
|
127
|
+
children: /* @__PURE__ */ l(t, {
|
|
128
|
+
className: "h-3.5 w-3.5",
|
|
129
|
+
"aria-hidden": "true"
|
|
130
|
+
})
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ l(C, {
|
|
133
|
+
currentPage: c,
|
|
134
|
+
totalPages: d,
|
|
135
|
+
pages: E,
|
|
136
|
+
onPageChange: f,
|
|
137
|
+
testId: _
|
|
138
|
+
}),
|
|
139
|
+
/* @__PURE__ */ l(y, {
|
|
140
|
+
disabled: m === !1 || c === d,
|
|
141
|
+
onClick: () => f(c + 1),
|
|
142
|
+
"data-testid": _ ? `${_}-next` : void 0,
|
|
143
|
+
"aria-label": "다음 페이지",
|
|
144
|
+
children: /* @__PURE__ */ l(n, {
|
|
145
|
+
className: "h-3.5 w-3.5",
|
|
146
|
+
"aria-hidden": "true"
|
|
147
|
+
})
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ l(y, {
|
|
150
|
+
disabled: c === d,
|
|
151
|
+
onClick: () => f(d),
|
|
152
|
+
"data-testid": _ ? `${_}-last` : void 0,
|
|
153
|
+
"aria-label": "마지막 페이지",
|
|
154
|
+
children: /* @__PURE__ */ l(i, {
|
|
155
|
+
className: "h-3.5 w-3.5",
|
|
156
|
+
"aria-hidden": "true"
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
//#endregion
|
|
163
|
+
export { w as Pagination };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../select/Select.cjs"),t=require("./KeyboardNavButton.cjs"),n=require("./PageJumpInput.cjs"),r=require("./Pagination.cjs");let i=require("react/jsx-runtime");var a=[30,50,100];function o({currentPage:o,totalPages:s,onPageChange:c,pageSize:l,pageSizeOptions:u=a,onPageSizeChange:d,hasPreviousPage:f,hasNextPage:p,totalElements:m,showTotalCount:h=!0,enablePageJump:g=!0,enableKeyboardPagination:_=!0,"data-testid":v}){let y=f??o>1,b=p??o<s,x=e=>{_&&(e.altKey||e.metaKey||e.ctrlKey||e.shiftKey||(e.key===`ArrowLeft`&&y?(e.preventDefault(),c(o-1)):e.key===`ArrowRight`&&b&&(e.preventDefault(),c(o+1))))};return(0,i.jsxs)(`nav`,{"aria-label":`페이지 네비게이션`,className:`@container/pagebar group/footer flex flex-wrap items-center justify-between gap-x-3 gap-y-2 shrink-0`,children:[(0,i.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 text-sm text-fg-muted`,children:[h&&m!==void 0&&(0,i.jsxs)(`span`,{children:[`총 `,m.toLocaleString(),`건`]}),d&&l!==void 0&&(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(`span`,{className:`text-fg-muted`,children:`페이지당`}),(0,i.jsx)(`div`,{className:`w-20`,children:(0,i.jsx)(e.Select,{variant:`box`,selectSize:`mini`,value:String(l),onChange:e=>d(Number(e)),options:u.map(e=>({value:String(e),label:String(e)})),placeholder:`선택`,"data-testid":v?`${v}-page-size`:void 0})})]}),(0,i.jsx)(`div`,{className:`contents @min-[640px]/pagebar:hidden`,children:g&&s>1&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.PageJumpInput,{currentPage:o,totalPages:s,onPageChange:c,"data-testid":v?`${v}-page-jump`:void 0}),_&&(0,i.jsx)(t.KeyboardNavButton,{onKeyDown:x})]})})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-3 @min-[640px]/pagebar:flex-1 @min-[640px]/pagebar:justify-end @max-[639px]/pagebar:w-full @max-[639px]/pagebar:justify-center`,children:[(0,i.jsx)(`div`,{className:`hidden @min-[640px]/pagebar:contents`,children:g&&s>1&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.PageJumpInput,{currentPage:o,totalPages:s,onPageChange:c,"data-testid":v?`${v}-page-jump`:void 0}),_&&(0,i.jsx)(t.KeyboardNavButton,{onKeyDown:x})]})}),(0,i.jsx)(r.Pagination,{currentPage:o,totalPages:s,onPageChange:c,hasPreviousPage:y,hasNextPage:b,"data-testid":v?`${v}-pagination`:void 0})]})]})}exports.PaginationFooter=o;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Select as e } from "../../select/Select.esm.js";
|
|
2
|
+
import { KeyboardNavButton as t } from "./KeyboardNavButton.esm.js";
|
|
3
|
+
import { PageJumpInput as n } from "./PageJumpInput.esm.js";
|
|
4
|
+
import { Pagination as r } from "./Pagination.esm.js";
|
|
5
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/table/components/PaginationFooter.tsx
|
|
7
|
+
var s = [
|
|
8
|
+
30,
|
|
9
|
+
50,
|
|
10
|
+
100
|
|
11
|
+
];
|
|
12
|
+
function c({ currentPage: c, totalPages: l, onPageChange: u, pageSize: d, pageSizeOptions: f = s, onPageSizeChange: p, hasPreviousPage: m, hasNextPage: h, totalElements: g, showTotalCount: _ = !0, enablePageJump: v = !0, enableKeyboardPagination: y = !0, "data-testid": b }) {
|
|
13
|
+
let x = m ?? c > 1, S = h ?? c < l, C = (e) => {
|
|
14
|
+
y && (e.altKey || e.metaKey || e.ctrlKey || e.shiftKey || (e.key === "ArrowLeft" && x ? (e.preventDefault(), u(c - 1)) : e.key === "ArrowRight" && S && (e.preventDefault(), u(c + 1))));
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ o("nav", {
|
|
17
|
+
"aria-label": "페이지 네비게이션",
|
|
18
|
+
className: "@container/pagebar group/footer flex flex-wrap items-center justify-between gap-x-3 gap-y-2 shrink-0",
|
|
19
|
+
children: [/* @__PURE__ */ o("div", {
|
|
20
|
+
className: "flex flex-wrap items-center gap-x-3 gap-y-2 text-sm text-fg-muted",
|
|
21
|
+
children: [
|
|
22
|
+
_ && g !== void 0 && /* @__PURE__ */ o("span", { children: [
|
|
23
|
+
"총 ",
|
|
24
|
+
g.toLocaleString(),
|
|
25
|
+
"건"
|
|
26
|
+
] }),
|
|
27
|
+
p && d !== void 0 && /* @__PURE__ */ o("div", {
|
|
28
|
+
className: "flex items-center gap-1",
|
|
29
|
+
children: [/* @__PURE__ */ a("span", {
|
|
30
|
+
className: "text-fg-muted",
|
|
31
|
+
children: "페이지당"
|
|
32
|
+
}), /* @__PURE__ */ a("div", {
|
|
33
|
+
className: "w-20",
|
|
34
|
+
children: /* @__PURE__ */ a(e, {
|
|
35
|
+
variant: "box",
|
|
36
|
+
selectSize: "mini",
|
|
37
|
+
value: String(d),
|
|
38
|
+
onChange: (e) => p(Number(e)),
|
|
39
|
+
options: f.map((e) => ({
|
|
40
|
+
value: String(e),
|
|
41
|
+
label: String(e)
|
|
42
|
+
})),
|
|
43
|
+
placeholder: "선택",
|
|
44
|
+
"data-testid": b ? `${b}-page-size` : void 0
|
|
45
|
+
})
|
|
46
|
+
})]
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ a("div", {
|
|
49
|
+
className: "contents @min-[640px]/pagebar:hidden",
|
|
50
|
+
children: v && l > 1 && /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(n, {
|
|
51
|
+
currentPage: c,
|
|
52
|
+
totalPages: l,
|
|
53
|
+
onPageChange: u,
|
|
54
|
+
"data-testid": b ? `${b}-page-jump` : void 0
|
|
55
|
+
}), y && /* @__PURE__ */ a(t, { onKeyDown: C })] })
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
}), /* @__PURE__ */ o("div", {
|
|
59
|
+
className: "flex items-center gap-3 @min-[640px]/pagebar:flex-1 @min-[640px]/pagebar:justify-end @max-[639px]/pagebar:w-full @max-[639px]/pagebar:justify-center",
|
|
60
|
+
children: [/* @__PURE__ */ a("div", {
|
|
61
|
+
className: "hidden @min-[640px]/pagebar:contents",
|
|
62
|
+
children: v && l > 1 && /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(n, {
|
|
63
|
+
currentPage: c,
|
|
64
|
+
totalPages: l,
|
|
65
|
+
onPageChange: u,
|
|
66
|
+
"data-testid": b ? `${b}-page-jump` : void 0
|
|
67
|
+
}), y && /* @__PURE__ */ a(t, { onKeyDown: C })] })
|
|
68
|
+
}), /* @__PURE__ */ a(r, {
|
|
69
|
+
currentPage: c,
|
|
70
|
+
totalPages: l,
|
|
71
|
+
onPageChange: u,
|
|
72
|
+
hasPreviousPage: x,
|
|
73
|
+
hasNextPage: S,
|
|
74
|
+
"data-testid": b ? `${b}-pagination` : void 0
|
|
75
|
+
})]
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { c as PaginationFooter };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("react/jsx-runtime"),t=require("@dnd-kit/sortable"),n=require("@dnd-kit/utilities");function r({id:r,disabled:i=!1,as:a=`div`,colSpan:o,rowSpan:s,className:c,style:l,children:u}){let{setNodeRef:d,attributes:f,listeners:p,transform:m,transition:h,isDragging:g}=(0,t.useSortable)({id:r,disabled:i});return(0,e.jsx)(a,{ref:d,className:c,style:{...l,transform:n.CSS.Translate.toString(m),transition:h,opacity:g?.5:1,cursor:i?void 0:`grab`},...a===`th`?{...o===void 0?{}:{colSpan:o},...s===void 0?{}:{rowSpan:s}}:{},...i?{}:f,...i?{}:p,children:u})}exports.SortableHeaderCell=r;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useSortable as t } from "@dnd-kit/sortable";
|
|
3
|
+
import { CSS as n } from "@dnd-kit/utilities";
|
|
4
|
+
//#region src/components/table/components/SortableHeaderCell.tsx
|
|
5
|
+
function r({ id: r, disabled: i = !1, as: a = "div", colSpan: o, rowSpan: s, className: c, style: l, children: u }) {
|
|
6
|
+
let { setNodeRef: d, attributes: f, listeners: p, transform: m, transition: h, isDragging: g } = t({
|
|
7
|
+
id: r,
|
|
8
|
+
disabled: i
|
|
9
|
+
});
|
|
10
|
+
return /* @__PURE__ */ e(a, {
|
|
11
|
+
ref: d,
|
|
12
|
+
className: c,
|
|
13
|
+
style: {
|
|
14
|
+
...l,
|
|
15
|
+
transform: n.Translate.toString(m),
|
|
16
|
+
transition: h,
|
|
17
|
+
opacity: g ? .5 : 1,
|
|
18
|
+
cursor: i ? void 0 : "grab"
|
|
19
|
+
},
|
|
20
|
+
...a === "th" ? {
|
|
21
|
+
...o === void 0 ? {} : { colSpan: o },
|
|
22
|
+
...s === void 0 ? {} : { rowSpan: s }
|
|
23
|
+
} : {},
|
|
24
|
+
...i ? {} : f,
|
|
25
|
+
...i ? {} : p,
|
|
26
|
+
children: u
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { r as SortableHeaderCell };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../column-group-utils.cjs"),t=require("../../../lib/column-preset-storage.cjs");let n=require("react");function r(e,t){let n=new Set(t),r=new Set(e),i=e.filter(e=>n.has(e)),a=t.filter(e=>!r.has(e)),o=[...i,...a];if(o.length===e.length){let t=!0;for(let n=0;n<o.length;n++)if(o[n]!==e[n]){t=!1;break}if(t)return e}return o}function i(e,t){return!e||e.columnOrder.length===0?{columnOrder:t,hiddenColumns:[],columnWidths:e?.columnWidths??{}}:{columnOrder:r(e.columnOrder,t),hiddenColumns:e.hiddenColumns??[],columnWidths:e.columnWidths??{}}}function a(e,t){if(e.columnOrder.length!==t.columnOrder.length)return!1;for(let n=0;n<e.columnOrder.length;n++)if(e.columnOrder[n]!==t.columnOrder[n])return!1;if(e.hiddenColumns.length!==t.hiddenColumns.length)return!1;let n=new Set(t.hiddenColumns);for(let t of e.hiddenColumns)if(!n.has(t))return!1;let r=Object.keys(e.columnWidths),i=Object.keys(t.columnWidths);if(r.length!==i.length)return!1;for(let n of r)if(e.columnWidths[n]!==t.columnWidths[n])return!1;return!0}function o({pageKey:o,columns:s,columnGroups:c,legacyStorageKey:l}){let u=(0,n.useMemo)(()=>e.getDefaultSlotOrder(e.buildColumnSlots(s,c)),[s,c]),[d,f]=(0,n.useState)(1),[p,m]=(0,n.useState)(u),[h,g]=(0,n.useState)([]),[_,v]=(0,n.useState)({}),[y,b]=(0,n.useState)({columnOrder:u,hiddenColumns:[],columnWidths:{}}),x=(0,n.useCallback)(e=>{b(e),m(e.columnOrder),g(e.hiddenColumns),v(e.columnWidths)},[]),S=(0,n.useRef)(void 0),C=(0,n.useRef)(l);return C.current=l,(0,n.useEffect)(()=>{if(!o){S.current=o,f(1),x({columnOrder:u,hiddenColumns:[],columnWidths:{}});return}let e=S.current!==o;if(S.current=o,e){let e=C.current;e&&t.ColumnPresetStorage.migrateFromLegacyStorage(o,e);let n=t.ColumnPresetStorage.getActivePreset(o),r=i(t.ColumnPresetStorage.getPresetColumns(o,n),u);f(n),x(r);return}m(e=>r(e,u)),b(e=>{let t=r(e.columnOrder,u);return t===e.columnOrder?e:{...e,columnOrder:t}})},[x,u,o]),{activePreset:d,columnOrder:p,hiddenColumns:h,columnWidths:_,isDirty:(0,n.useMemo)(()=>!a({columnOrder:p,hiddenColumns:h,columnWidths:_},y),[p,h,_,y]),hasPreset:(0,n.useCallback)(e=>o?t.ColumnPresetStorage.hasPreset(o,e):!1,[o]),applyPreset:(0,n.useCallback)(e=>{if(f(e),!o){x({columnOrder:u,hiddenColumns:[],columnWidths:{}});return}t.ColumnPresetStorage.setActivePreset(o,e),x(i(t.ColumnPresetStorage.getPresetColumns(o,e),u))},[x,u,o]),saveActivePreset:(0,n.useCallback)(()=>!o||p.length===0?!1:(t.ColumnPresetStorage.savePreset(o,d,{columnOrder:p,hiddenColumns:h,columnWidths:_}),b({columnOrder:p,hiddenColumns:h,columnWidths:_}),!0),[d,p,_,h,o]),saveAsPreset:(0,n.useCallback)(e=>o?p.length===0?!1:(t.ColumnPresetStorage.savePreset(o,e,{columnOrder:p,hiddenColumns:h,columnWidths:_}),t.ColumnPresetStorage.setActivePreset(o,e),f(e),b({columnOrder:p,hiddenColumns:h,columnWidths:_}),!0):(f(e),!1),[p,_,h,o]),resetActivePreset:(0,n.useCallback)(()=>{o&&t.ColumnPresetStorage.clearPreset(o,d),x({columnOrder:u,hiddenColumns:[],columnWidths:{}})},[d,x,u,o]),setColumnOrder:(0,n.useCallback)(e=>{m(e)},[]),setHiddenColumns:(0,n.useCallback)(e=>{g(e)},[]),setColumnWidths:(0,n.useCallback)(e=>{v(e)},[]),setColumnWidth:(0,n.useCallback)((e,t)=>{v(n=>{let r={...n};return t>0?r[e]=t:delete r[e],r})},[])}}exports.useColumnPresets=o;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PresetNumber } from '
|
|
2
|
-
import { TableColumn, TableColumnGroupMeta } from '../types';
|
|
1
|
+
import { PresetNumber } from '../../../lib/column-preset-storage.js';
|
|
2
|
+
import { TableColumn, TableColumnGroupMeta } from '../types.js';
|
|
3
3
|
export interface UseColumnPresetsOptions<T> {
|
|
4
4
|
/** localStorage 페이지 키. 미지정 시 메모리만 사용. */
|
|
5
5
|
pageKey?: string;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { buildColumnSlots as e, getDefaultSlotOrder as t } from "../column-group-utils.esm.js";
|
|
2
|
+
import { ColumnPresetStorage as n } from "../../../lib/column-preset-storage.esm.js";
|
|
3
|
+
import { useCallback as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
4
|
+
//#region src/components/table/hooks/useColumnPresets.ts
|
|
5
|
+
function c(e, t) {
|
|
6
|
+
let n = new Set(t), r = new Set(e), i = e.filter((e) => n.has(e)), a = t.filter((e) => !r.has(e)), o = [...i, ...a];
|
|
7
|
+
if (o.length === e.length) {
|
|
8
|
+
let t = !0;
|
|
9
|
+
for (let n = 0; n < o.length; n++) if (o[n] !== e[n]) {
|
|
10
|
+
t = !1;
|
|
11
|
+
break;
|
|
12
|
+
}
|
|
13
|
+
if (t) return e;
|
|
14
|
+
}
|
|
15
|
+
return o;
|
|
16
|
+
}
|
|
17
|
+
function l(e, t) {
|
|
18
|
+
return !e || e.columnOrder.length === 0 ? {
|
|
19
|
+
columnOrder: t,
|
|
20
|
+
hiddenColumns: [],
|
|
21
|
+
columnWidths: e?.columnWidths ?? {}
|
|
22
|
+
} : {
|
|
23
|
+
columnOrder: c(e.columnOrder, t),
|
|
24
|
+
hiddenColumns: e.hiddenColumns ?? [],
|
|
25
|
+
columnWidths: e.columnWidths ?? {}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function u(e, t) {
|
|
29
|
+
if (e.columnOrder.length !== t.columnOrder.length) return !1;
|
|
30
|
+
for (let n = 0; n < e.columnOrder.length; n++) if (e.columnOrder[n] !== t.columnOrder[n]) return !1;
|
|
31
|
+
if (e.hiddenColumns.length !== t.hiddenColumns.length) return !1;
|
|
32
|
+
let n = new Set(t.hiddenColumns);
|
|
33
|
+
for (let t of e.hiddenColumns) if (!n.has(t)) return !1;
|
|
34
|
+
let r = Object.keys(e.columnWidths), i = Object.keys(t.columnWidths);
|
|
35
|
+
if (r.length !== i.length) return !1;
|
|
36
|
+
for (let n of r) if (e.columnWidths[n] !== t.columnWidths[n]) return !1;
|
|
37
|
+
return !0;
|
|
38
|
+
}
|
|
39
|
+
function d({ pageKey: d, columns: f, columnGroups: p, legacyStorageKey: m }) {
|
|
40
|
+
let h = a(() => t(e(f, p)), [f, p]), [g, _] = s(1), [v, y] = s(h), [b, x] = s([]), [S, C] = s({}), [w, T] = s({
|
|
41
|
+
columnOrder: h,
|
|
42
|
+
hiddenColumns: [],
|
|
43
|
+
columnWidths: {}
|
|
44
|
+
}), E = r((e) => {
|
|
45
|
+
T(e), y(e.columnOrder), x(e.hiddenColumns), C(e.columnWidths);
|
|
46
|
+
}, []), D = o(void 0), O = o(m);
|
|
47
|
+
return O.current = m, i(() => {
|
|
48
|
+
if (!d) {
|
|
49
|
+
D.current = d, _(1), E({
|
|
50
|
+
columnOrder: h,
|
|
51
|
+
hiddenColumns: [],
|
|
52
|
+
columnWidths: {}
|
|
53
|
+
});
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
let e = D.current !== d;
|
|
57
|
+
if (D.current = d, e) {
|
|
58
|
+
let e = O.current;
|
|
59
|
+
e && n.migrateFromLegacyStorage(d, e);
|
|
60
|
+
let t = n.getActivePreset(d), r = l(n.getPresetColumns(d, t), h);
|
|
61
|
+
_(t), E(r);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
y((e) => c(e, h)), T((e) => {
|
|
65
|
+
let t = c(e.columnOrder, h);
|
|
66
|
+
return t === e.columnOrder ? e : {
|
|
67
|
+
...e,
|
|
68
|
+
columnOrder: t
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
}, [
|
|
72
|
+
E,
|
|
73
|
+
h,
|
|
74
|
+
d
|
|
75
|
+
]), {
|
|
76
|
+
activePreset: g,
|
|
77
|
+
columnOrder: v,
|
|
78
|
+
hiddenColumns: b,
|
|
79
|
+
columnWidths: S,
|
|
80
|
+
isDirty: a(() => !u({
|
|
81
|
+
columnOrder: v,
|
|
82
|
+
hiddenColumns: b,
|
|
83
|
+
columnWidths: S
|
|
84
|
+
}, w), [
|
|
85
|
+
v,
|
|
86
|
+
b,
|
|
87
|
+
S,
|
|
88
|
+
w
|
|
89
|
+
]),
|
|
90
|
+
hasPreset: r((e) => d ? n.hasPreset(d, e) : !1, [d]),
|
|
91
|
+
applyPreset: r((e) => {
|
|
92
|
+
if (_(e), !d) {
|
|
93
|
+
E({
|
|
94
|
+
columnOrder: h,
|
|
95
|
+
hiddenColumns: [],
|
|
96
|
+
columnWidths: {}
|
|
97
|
+
});
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
n.setActivePreset(d, e), E(l(n.getPresetColumns(d, e), h));
|
|
101
|
+
}, [
|
|
102
|
+
E,
|
|
103
|
+
h,
|
|
104
|
+
d
|
|
105
|
+
]),
|
|
106
|
+
saveActivePreset: r(() => !d || v.length === 0 ? !1 : (n.savePreset(d, g, {
|
|
107
|
+
columnOrder: v,
|
|
108
|
+
hiddenColumns: b,
|
|
109
|
+
columnWidths: S
|
|
110
|
+
}), T({
|
|
111
|
+
columnOrder: v,
|
|
112
|
+
hiddenColumns: b,
|
|
113
|
+
columnWidths: S
|
|
114
|
+
}), !0), [
|
|
115
|
+
g,
|
|
116
|
+
v,
|
|
117
|
+
S,
|
|
118
|
+
b,
|
|
119
|
+
d
|
|
120
|
+
]),
|
|
121
|
+
saveAsPreset: r((e) => d ? v.length === 0 ? !1 : (n.savePreset(d, e, {
|
|
122
|
+
columnOrder: v,
|
|
123
|
+
hiddenColumns: b,
|
|
124
|
+
columnWidths: S
|
|
125
|
+
}), n.setActivePreset(d, e), _(e), T({
|
|
126
|
+
columnOrder: v,
|
|
127
|
+
hiddenColumns: b,
|
|
128
|
+
columnWidths: S
|
|
129
|
+
}), !0) : (_(e), !1), [
|
|
130
|
+
v,
|
|
131
|
+
S,
|
|
132
|
+
b,
|
|
133
|
+
d
|
|
134
|
+
]),
|
|
135
|
+
resetActivePreset: r(() => {
|
|
136
|
+
d && n.clearPreset(d, g), E({
|
|
137
|
+
columnOrder: h,
|
|
138
|
+
hiddenColumns: [],
|
|
139
|
+
columnWidths: {}
|
|
140
|
+
});
|
|
141
|
+
}, [
|
|
142
|
+
g,
|
|
143
|
+
E,
|
|
144
|
+
h,
|
|
145
|
+
d
|
|
146
|
+
]),
|
|
147
|
+
setColumnOrder: r((e) => {
|
|
148
|
+
y(e);
|
|
149
|
+
}, []),
|
|
150
|
+
setHiddenColumns: r((e) => {
|
|
151
|
+
x(e);
|
|
152
|
+
}, []),
|
|
153
|
+
setColumnWidths: r((e) => {
|
|
154
|
+
C(e);
|
|
155
|
+
}, []),
|
|
156
|
+
setColumnWidth: r((e, t) => {
|
|
157
|
+
C((n) => {
|
|
158
|
+
let r = { ...n };
|
|
159
|
+
return t > 0 ? r[e] = t : delete r[e], r;
|
|
160
|
+
});
|
|
161
|
+
}, [])
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
export { d as useColumnPresets };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("react");function t(e,t,n,r){if(e)return e;let i=t?.style.width.trim();if(i&&/^(?:\d+\.?\d*|\.\d+)px$/i.test(i)){let e=parseFloat(i);if(Number.isFinite(e))return e}let a=t?.getBoundingClientRect().width;if(a&&Number.isFinite(a)&&a>0)return a;let o=n?.getBoundingClientRect().width;return o&&Number.isFinite(o)&&o>0?o:r}function n({columns:n,defaultWidth:r=150,minWidth:i=50,maxWidth:a,tableRef:o,storageKey:s,controlledWidths:c,onColumnWidthsChange:l}){let u=c!==void 0,d=(0,e.useCallback)(()=>{if(u||!s)return{};try{let e=localStorage.getItem(s);if(e){let t=JSON.parse(e),n={};return Object.entries(t).forEach(([e,t])=>{typeof t==`number`&&t>=i&&(n[e]=t)}),n}}catch(e){console.warn(`[ColumnResize] Failed to load saved widths:`,e)}return{}},[u,s,i]),[f,p]=(0,e.useState)(()=>d()),m=u?c:f,h=(0,e.useCallback)(e=>{if(u){let t=typeof e==`function`?e(m):e;l?.(t);return}p(e)},[m,u,l]);(0,e.useEffect)(()=>{if(!u&&!(!s||Object.keys(f).length===0))try{localStorage.setItem(s,JSON.stringify(f))}catch(e){console.warn(`[ColumnResize] Failed to save widths:`,e)}},[f,u,s]);let g=(0,e.useRef)(null),_=(0,e.useRef)(null),v=(0,e.useCallback)(e=>{if(typeof e==`string`)return e;if(typeof e==`number`)return String(e);if(e==null)return``;if(Array.isArray(e))return e.map(e=>v(e)).join(``);if(typeof e==`object`&&`props`in e){let t=e.props;if(t?.children)return v(t.children)}return``},[]),y=(0,e.useCallback)(e=>{if(!_.current)return r;let t=n.find(t=>t.key===e)?.header,a=typeof t==`string`?t:v(t);_.current.textContent=a||e,_.current.style.fontSize=`14px`,_.current.style.fontWeight=`600`,_.current.style.padding=`0 24px`;let o=_.current.offsetWidth;return Math.max(i,o+20)},[n,v,r,i]);return{columnWidths:m,handleMouseDown:(0,e.useCallback)((e,n)=>{n.preventDefault(),n.stopPropagation();let s=o?.current?.querySelector(`colgroup col[data-col-key="${CSS.escape(e)}"]`)??null,c=t(m[e],s,n.currentTarget.closest(`th`),r);g.current={key:e,startX:n.clientX,startWidth:c};let l=o?.current??null,u=(l?parseFloat(l.style.width)||l.offsetWidth:0)-c,d=l?.parentElement?.clientWidth||1/0,f=Math.min(a??1/0,d),p=c,_=null,v=e=>{if(!g.current)return;let t=e.clientX-g.current.startX,n=Math.max(i,g.current.startWidth+t);p=Math.max(i,Math.min(n,f)),_===null&&(_=requestAnimationFrame(()=>{_=null,s&&(s.style.width=`${p}px`),l&&(l.style.width=`${u+p}px`)}))},y=()=>{_!==null&&cancelAnimationFrame(_);let e=g.current?.key;g.current=null,document.removeEventListener(`mousemove`,v),document.removeEventListener(`mouseup`,y),e&&h(t=>({...t,[e]:p}))};document.addEventListener(`mousemove`,v),document.addEventListener(`mouseup`,y)},[m,r,i,a,o,h]),handleDoubleClick:(0,e.useCallback)(()=>{},[]),getColumnWidth:(0,e.useCallback)((e,t)=>m[e]?`${m[e]}px`:t?typeof t==`number`?`${t}px`:t:`${y(e)}px`,[m,y]),measureRef:_}}exports.useColumnResize=n;
|
|
@@ -81,6 +81,18 @@ export interface UseColumnResizeReturn {
|
|
|
81
81
|
*/
|
|
82
82
|
measureRef: React.RefObject<HTMLDivElement | null>;
|
|
83
83
|
}
|
|
84
|
+
export declare function getResizeStartWidth(savedWidth: number | undefined, colEl: {
|
|
85
|
+
style: {
|
|
86
|
+
width: string;
|
|
87
|
+
};
|
|
88
|
+
getBoundingClientRect: () => {
|
|
89
|
+
width: number;
|
|
90
|
+
};
|
|
91
|
+
} | null, headerEl: {
|
|
92
|
+
getBoundingClientRect: () => {
|
|
93
|
+
width: number;
|
|
94
|
+
};
|
|
95
|
+
} | null, defaultWidth: number): number;
|
|
84
96
|
/**
|
|
85
97
|
* 컬럼 리사이즈 훅
|
|
86
98
|
*
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
+
//#region src/components/table/hooks/useColumnResize.ts
|
|
3
|
+
function i(e, t, n, r) {
|
|
4
|
+
if (e) return e;
|
|
5
|
+
let i = t?.style.width.trim();
|
|
6
|
+
if (i && /^(?:\d+\.?\d*|\.\d+)px$/i.test(i)) {
|
|
7
|
+
let e = parseFloat(i);
|
|
8
|
+
if (Number.isFinite(e)) return e;
|
|
9
|
+
}
|
|
10
|
+
let a = t?.getBoundingClientRect().width;
|
|
11
|
+
if (a && Number.isFinite(a) && a > 0) return a;
|
|
12
|
+
let o = n?.getBoundingClientRect().width;
|
|
13
|
+
return o && Number.isFinite(o) && o > 0 ? o : r;
|
|
14
|
+
}
|
|
15
|
+
function a({ columns: a, defaultWidth: o = 150, minWidth: s = 50, maxWidth: c, tableRef: l, storageKey: u, controlledWidths: d, onColumnWidthsChange: f }) {
|
|
16
|
+
let p = d !== void 0, m = e(() => {
|
|
17
|
+
if (p || !u) return {};
|
|
18
|
+
try {
|
|
19
|
+
let e = localStorage.getItem(u);
|
|
20
|
+
if (e) {
|
|
21
|
+
let t = JSON.parse(e), n = {};
|
|
22
|
+
return Object.entries(t).forEach(([e, t]) => {
|
|
23
|
+
typeof t == "number" && t >= s && (n[e] = t);
|
|
24
|
+
}), n;
|
|
25
|
+
}
|
|
26
|
+
} catch (e) {
|
|
27
|
+
console.warn("[ColumnResize] Failed to load saved widths:", e);
|
|
28
|
+
}
|
|
29
|
+
return {};
|
|
30
|
+
}, [
|
|
31
|
+
p,
|
|
32
|
+
u,
|
|
33
|
+
s
|
|
34
|
+
]), [h, g] = r(() => m()), _ = p ? d : h, v = e((e) => {
|
|
35
|
+
if (p) {
|
|
36
|
+
let t = typeof e == "function" ? e(_) : e;
|
|
37
|
+
f?.(t);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
g(e);
|
|
41
|
+
}, [
|
|
42
|
+
_,
|
|
43
|
+
p,
|
|
44
|
+
f
|
|
45
|
+
]);
|
|
46
|
+
t(() => {
|
|
47
|
+
if (!p && !(!u || Object.keys(h).length === 0)) try {
|
|
48
|
+
localStorage.setItem(u, JSON.stringify(h));
|
|
49
|
+
} catch (e) {
|
|
50
|
+
console.warn("[ColumnResize] Failed to save widths:", e);
|
|
51
|
+
}
|
|
52
|
+
}, [
|
|
53
|
+
h,
|
|
54
|
+
p,
|
|
55
|
+
u
|
|
56
|
+
]);
|
|
57
|
+
let y = n(null), b = n(null), x = e((e) => {
|
|
58
|
+
if (typeof e == "string") return e;
|
|
59
|
+
if (typeof e == "number") return String(e);
|
|
60
|
+
if (e == null) return "";
|
|
61
|
+
if (Array.isArray(e)) return e.map((e) => x(e)).join("");
|
|
62
|
+
if (typeof e == "object" && "props" in e) {
|
|
63
|
+
let t = e.props;
|
|
64
|
+
if (t?.children) return x(t.children);
|
|
65
|
+
}
|
|
66
|
+
return "";
|
|
67
|
+
}, []), S = e((e) => {
|
|
68
|
+
if (!b.current) return o;
|
|
69
|
+
let t = a.find((t) => t.key === e)?.header, n = typeof t == "string" ? t : x(t);
|
|
70
|
+
b.current.textContent = n || e, b.current.style.fontSize = "14px", b.current.style.fontWeight = "600", b.current.style.padding = "0 24px";
|
|
71
|
+
let r = b.current.offsetWidth;
|
|
72
|
+
return Math.max(s, r + 20);
|
|
73
|
+
}, [
|
|
74
|
+
a,
|
|
75
|
+
x,
|
|
76
|
+
o,
|
|
77
|
+
s
|
|
78
|
+
]);
|
|
79
|
+
return {
|
|
80
|
+
columnWidths: _,
|
|
81
|
+
handleMouseDown: e((e, t) => {
|
|
82
|
+
t.preventDefault(), t.stopPropagation();
|
|
83
|
+
let n = l?.current?.querySelector(`colgroup col[data-col-key="${CSS.escape(e)}"]`) ?? null, r = i(_[e], n, t.currentTarget.closest("th"), o);
|
|
84
|
+
y.current = {
|
|
85
|
+
key: e,
|
|
86
|
+
startX: t.clientX,
|
|
87
|
+
startWidth: r
|
|
88
|
+
};
|
|
89
|
+
let a = l?.current ?? null, u = (a ? parseFloat(a.style.width) || a.offsetWidth : 0) - r, d = a?.parentElement?.clientWidth || Infinity, f = Math.min(c ?? Infinity, d), p = r, m = null, h = (e) => {
|
|
90
|
+
if (!y.current) return;
|
|
91
|
+
let t = e.clientX - y.current.startX, r = Math.max(s, y.current.startWidth + t);
|
|
92
|
+
p = Math.max(s, Math.min(r, f)), m === null && (m = requestAnimationFrame(() => {
|
|
93
|
+
m = null, n && (n.style.width = `${p}px`), a && (a.style.width = `${u + p}px`);
|
|
94
|
+
}));
|
|
95
|
+
}, g = () => {
|
|
96
|
+
m !== null && cancelAnimationFrame(m);
|
|
97
|
+
let e = y.current?.key;
|
|
98
|
+
y.current = null, document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", g), e && v((t) => ({
|
|
99
|
+
...t,
|
|
100
|
+
[e]: p
|
|
101
|
+
}));
|
|
102
|
+
};
|
|
103
|
+
document.addEventListener("mousemove", h), document.addEventListener("mouseup", g);
|
|
104
|
+
}, [
|
|
105
|
+
_,
|
|
106
|
+
o,
|
|
107
|
+
s,
|
|
108
|
+
c,
|
|
109
|
+
l,
|
|
110
|
+
v
|
|
111
|
+
]),
|
|
112
|
+
handleDoubleClick: e(() => {}, []),
|
|
113
|
+
getColumnWidth: e((e, t) => _[e] ? `${_[e]}px` : t ? typeof t == "number" ? `${t}px` : t : `${S(e)}px`, [_, S]),
|
|
114
|
+
measureRef: b
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
118
|
+
export { a as useColumnResize };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../components/ColumnPresetSelector.cjs"),t=require("./useColumnPresets.cjs");let n=require("react"),r=require("react/jsx-runtime");function i({pageKey:i,columns:a,columnGroups:o,showSelector:s=!0,selectorClassName:c}){let l=t.useColumnPresets({pageKey:i,columns:a,columnGroups:o});return{columnState:(0,n.useMemo)(()=>({columnOrder:l.columnOrder,hiddenColumns:l.hiddenColumns,columnWidths:l.columnWidths,onColumnOrderChange:l.setColumnOrder,onColumnWidthsChange:l.setColumnWidths}),[l.columnOrder,l.hiddenColumns,l.columnWidths,l.setColumnOrder,l.setColumnWidths]),selector:s&&i?(0,r.jsx)(e.ColumnPresetSelector,{columns:a,columnGroups:o,activePreset:l.activePreset,columnOrder:l.columnOrder,hiddenColumns:l.hiddenColumns,columnWidths:l.columnWidths,isDirty:l.isDirty,hasPreset:l.hasPreset,onApplyPreset:l.applyPreset,onSaveActivePreset:l.saveActivePreset,onResetActivePreset:l.resetActivePreset,onColumnOrderChange:l.setColumnOrder,onHiddenColumnsChange:l.setHiddenColumns,onSetColumnWidth:l.setColumnWidth,className:c}):null}}exports.useTableColumnState=i;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import { TableColumn, TableColumnGroupMeta, TableColumnState } from '../types';
|
|
2
|
+
import { TableColumn, TableColumnGroupMeta, TableColumnState } from '../types.js';
|
|
3
3
|
interface Options<T> {
|
|
4
4
|
/** localStorage 페이지 키. 없으면 프리셋 비활성(컬럼 상태는 메모리만). */
|
|
5
5
|
pageKey?: string;
|