@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,83 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.esm.js";
|
|
2
|
+
import { Check as t } from "../../node_modules/lucide-react/dist/esm/icons/check.esm.js";
|
|
3
|
+
import { ChevronDown as n } from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.esm.js";
|
|
4
|
+
import { useState as r } from "react";
|
|
5
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import { FloatingPortal as s, autoUpdate as c, flip as l, offset as u, shift as d, size as f, useClick as p, useDismiss as m, useFloating as h, useInteractions as g, useRole as _ } from "@floating-ui/react";
|
|
7
|
+
//#region src/components/search-box/SearchBoxMultiSelect.tsx
|
|
8
|
+
function v({ label: v, options: y, value: b, onChange: x, size: S }) {
|
|
9
|
+
let [C, w] = r(!1), { refs: T, floatingStyles: E, context: D } = h({
|
|
10
|
+
open: C,
|
|
11
|
+
onOpenChange: w,
|
|
12
|
+
placement: "bottom-start",
|
|
13
|
+
whileElementsMounted: c,
|
|
14
|
+
middleware: [
|
|
15
|
+
u(4),
|
|
16
|
+
l({ fallbackAxisSideDirection: "start" }),
|
|
17
|
+
d({ padding: 8 }),
|
|
18
|
+
f({ apply({ rects: e, elements: t }) {
|
|
19
|
+
Object.assign(t.floating.style, { minWidth: `${e.reference.width}px` });
|
|
20
|
+
} })
|
|
21
|
+
]
|
|
22
|
+
}), { getReferenceProps: O, getFloatingProps: k } = g([
|
|
23
|
+
p(D),
|
|
24
|
+
m(D),
|
|
25
|
+
_(D, { role: "listbox" })
|
|
26
|
+
]), A = b ? b.split(",").filter(Boolean) : [], j = new Set(A), M = A.length > 0, N = C || M, P = (e) => {
|
|
27
|
+
let t = new Set(j);
|
|
28
|
+
t.has(e) ? t.delete(e) : t.add(e), x(y.filter((e) => t.has(String(e.value))).map((e) => String(e.value)).join(","));
|
|
29
|
+
}, F = S === "mini" ? "h-8" : "h-10", I = S === "mini" ? "rounded-control-mini" : "rounded-control-small", L = S === "mini" ? "text-xs" : "text-sm", R = S === "mini" ? "px-2.5" : "px-3", z = M ? y.filter((e) => j.has(String(e.value))).map((e) => e.label).join(", ") : "";
|
|
30
|
+
return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ o("button", {
|
|
31
|
+
ref: T.setReference,
|
|
32
|
+
type: "button",
|
|
33
|
+
...O(),
|
|
34
|
+
"aria-expanded": C,
|
|
35
|
+
"aria-haspopup": "listbox",
|
|
36
|
+
className: e("relative w-full border bg-bg-surface text-left transition-colors focus-visible:border-primary focus-visible:outline-hidden", F, I, R, C ? "border-primary" : "border-border-subtle"),
|
|
37
|
+
children: [/* @__PURE__ */ o("div", {
|
|
38
|
+
className: "flex h-full w-full items-center justify-between gap-2",
|
|
39
|
+
children: [/* @__PURE__ */ a("span", {
|
|
40
|
+
className: e("truncate", L, M ? "text-fg-default" : "text-fg-subtle"),
|
|
41
|
+
children: z
|
|
42
|
+
}), /* @__PURE__ */ a(n, { className: e("h-3.5 w-3.5 shrink-0 text-icon-tertiary transition-transform", C && "rotate-180") })]
|
|
43
|
+
}), /* @__PURE__ */ a("span", {
|
|
44
|
+
"aria-hidden": "true",
|
|
45
|
+
className: e("pointer-events-none absolute left-2 px-1 transition-all bg-bg-surface", N ? [
|
|
46
|
+
"-top-2",
|
|
47
|
+
S === "mini" ? "text-[10px]" : "text-xs",
|
|
48
|
+
C ? "text-primary-fg" : "text-fg-muted"
|
|
49
|
+
] : ["top-1/2 -translate-y-1/2 text-fg-subtle", L]),
|
|
50
|
+
children: v
|
|
51
|
+
})]
|
|
52
|
+
}), C && /* @__PURE__ */ a(s, { children: /* @__PURE__ */ o("div", {
|
|
53
|
+
ref: T.setFloating,
|
|
54
|
+
style: E,
|
|
55
|
+
...k(),
|
|
56
|
+
className: "z-floating max-h-60 overflow-y-auto rounded-surface border border-border-subtle bg-bg-surface py-1 shadow-overlay",
|
|
57
|
+
children: [y.map((n) => {
|
|
58
|
+
let r = String(n.value), i = j.has(r);
|
|
59
|
+
return /* @__PURE__ */ o("button", {
|
|
60
|
+
type: "button",
|
|
61
|
+
onClick: () => P(r),
|
|
62
|
+
className: e("flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-bg-subtle", L, i ? "text-fg-default" : "text-fg-muted"),
|
|
63
|
+
role: "option",
|
|
64
|
+
"aria-selected": i,
|
|
65
|
+
children: [/* @__PURE__ */ a("span", {
|
|
66
|
+
className: e("flex h-4 w-4 shrink-0 items-center justify-center rounded border", i ? "border-primary bg-primary text-fg-inverse" : "border-border-default"),
|
|
67
|
+
children: i && /* @__PURE__ */ a(t, {
|
|
68
|
+
className: "h-3 w-3",
|
|
69
|
+
strokeWidth: 3
|
|
70
|
+
})
|
|
71
|
+
}), /* @__PURE__ */ a("span", {
|
|
72
|
+
className: "flex-1 truncate",
|
|
73
|
+
children: n.label
|
|
74
|
+
})]
|
|
75
|
+
}, r);
|
|
76
|
+
}), y.length === 0 && /* @__PURE__ */ a("div", {
|
|
77
|
+
className: "px-3 py-2 text-xs text-fg-subtle",
|
|
78
|
+
children: "옵션이 없어요"
|
|
79
|
+
})]
|
|
80
|
+
}) })] });
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { v as SearchBoxMultiSelect };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=(0,require("react").createContext)(!1);exports.SearchBoxSheetContext=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./parseDateRange.cjs");let t=require("date-fns");var n=`yyyy-MM-dd`;function r(){let e=(0,t.format)(new Date,n);return{from:e,to:e}}function i(){let{from:t,to:n}=r();return e.serializeDateRangeValue(t,n)}var a=[{label:`전일`,range:()=>{let e=(0,t.format)((0,t.subDays)(new Date,1),n);return{from:e,to:e}}},{label:`당일`,range:()=>{let e=(0,t.format)(new Date,n);return{from:e,to:e}}},{label:`당월`,range:()=>{let e=new Date;return{from:(0,t.format)((0,t.startOfMonth)(e),n),to:(0,t.format)((0,t.endOfMonth)(e),n)}}},{label:`전월`,range:()=>{let e=(0,t.subMonths)(new Date,1);return{from:(0,t.format)((0,t.startOfMonth)(e),n),to:(0,t.format)((0,t.endOfMonth)(e),n)}}}];exports.DEFAULT_DATE_RANGE_PRESETS=a,exports.getTodayDateRange=r,exports.getTodayDateRangeValue=i;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { serializeDateRangeValue as e } from "./parseDateRange.esm.js";
|
|
2
|
+
import { endOfMonth as t, format as n, startOfMonth as r, subDays as i, subMonths as a } from "date-fns";
|
|
3
|
+
//#region src/components/search-box/dateRangePresets.ts
|
|
4
|
+
var o = "yyyy-MM-dd";
|
|
5
|
+
function s() {
|
|
6
|
+
let e = n(/* @__PURE__ */ new Date(), o);
|
|
7
|
+
return {
|
|
8
|
+
from: e,
|
|
9
|
+
to: e
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function c() {
|
|
13
|
+
let { from: t, to: n } = s();
|
|
14
|
+
return e(t, n);
|
|
15
|
+
}
|
|
16
|
+
var l = [
|
|
17
|
+
{
|
|
18
|
+
label: "전일",
|
|
19
|
+
range: () => {
|
|
20
|
+
let e = n(i(/* @__PURE__ */ new Date(), 1), o);
|
|
21
|
+
return {
|
|
22
|
+
from: e,
|
|
23
|
+
to: e
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: "당일",
|
|
29
|
+
range: () => {
|
|
30
|
+
let e = n(/* @__PURE__ */ new Date(), o);
|
|
31
|
+
return {
|
|
32
|
+
from: e,
|
|
33
|
+
to: e
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: "당월",
|
|
39
|
+
range: () => {
|
|
40
|
+
let e = /* @__PURE__ */ new Date();
|
|
41
|
+
return {
|
|
42
|
+
from: n(r(e), o),
|
|
43
|
+
to: n(t(e), o)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: "전월",
|
|
49
|
+
range: () => {
|
|
50
|
+
let e = a(/* @__PURE__ */ new Date(), 1);
|
|
51
|
+
return {
|
|
52
|
+
from: n(r(e), o),
|
|
53
|
+
to: n(t(e), o)
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
//#endregion
|
|
59
|
+
export { l as DEFAULT_DATE_RANGE_PRESETS, s as getTodayDateRange, c as getTodayDateRangeValue };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { SearchBox } from './SearchBox';
|
|
2
|
-
export { parseSearchValues, parseMultiSelectValue, } from './parseSearchValues';
|
|
3
|
-
export { parseDateRangeValue, serializeDateRangeValue, type DateRangeValue, } from './parseDateRange';
|
|
4
|
-
export { DEFAULT_DATE_RANGE_PRESETS, getTodayDateRange, getTodayDateRangeValue, } from './dateRangePresets';
|
|
5
|
-
export type { SearchField, SearchFieldText, SearchFieldSelect, SearchFieldMultiSelect, SearchFieldDateRange, SearchFieldDateSingle, DateRangePreset, DateSinglePreset, SearchValues, } from './types';
|
|
1
|
+
export { SearchBox } from './SearchBox.js';
|
|
2
|
+
export { parseSearchValues, parseMultiSelectValue, } from './parseSearchValues.js';
|
|
3
|
+
export { parseDateRangeValue, serializeDateRangeValue, type DateRangeValue, } from './parseDateRange.js';
|
|
4
|
+
export { DEFAULT_DATE_RANGE_PRESETS, getTodayDateRange, getTodayDateRangeValue, } from './dateRangePresets.js';
|
|
5
|
+
export type { SearchField, SearchFieldText, SearchFieldSelect, SearchFieldMultiSelect, SearchFieldDateRange, SearchFieldDateSingle, DateRangePreset, DateSinglePreset, SearchValues, } from './types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`~`;function t(t){if(!t)return{from:``,to:``};let n=t.indexOf(e);return n===-1?{from:t,to:``}:{from:t.slice(0,n),to:t.slice(n+1)}}function n(t,n){return!t&&!n?``:`${t}${e}${n}`}exports.parseDateRangeValue=t,exports.serializeDateRangeValue=n;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/components/search-box/parseDateRange.ts
|
|
2
|
+
var e = "~";
|
|
3
|
+
function t(t) {
|
|
4
|
+
if (!t) return {
|
|
5
|
+
from: "",
|
|
6
|
+
to: ""
|
|
7
|
+
};
|
|
8
|
+
let n = t.indexOf(e);
|
|
9
|
+
return n === -1 ? {
|
|
10
|
+
from: t,
|
|
11
|
+
to: ""
|
|
12
|
+
} : {
|
|
13
|
+
from: t.slice(0, n),
|
|
14
|
+
to: t.slice(n + 1)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function n(t, n) {
|
|
18
|
+
return !t && !n ? "" : `${t}${e}${n}`;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { t as parseDateRangeValue, n as serializeDateRangeValue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./parseDateRange.cjs");function t(e){return e?e.split(`,`).filter(Boolean):[]}function n(n,r){let i={};for(let a of n){let n=a.hidden?``:r[a.key]??``;a.type===`multiSelect`?i[a.key]=t(n):a.type===`dateRange`?i[a.key]=e.parseDateRangeValue(n):i[a.key]=n}return i}exports.parseMultiSelectValue=t,exports.parseSearchValues=n;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DateRangeValue } from './parseDateRange';
|
|
2
|
-
import { SearchField, SearchValues } from './types';
|
|
1
|
+
import { DateRangeValue } from './parseDateRange.js';
|
|
2
|
+
import { SearchField, SearchValues } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* SearchValues를 type-aware하게 파싱한 결과.
|
|
5
5
|
* - text/select 필드: `string` 그대로 (빈 값이면 `""`)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { parseDateRangeValue as e } from "./parseDateRange.esm.js";
|
|
2
|
+
//#region src/components/search-box/parseSearchValues.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
return e ? e.split(",").filter(Boolean) : [];
|
|
5
|
+
}
|
|
6
|
+
function n(n, r) {
|
|
7
|
+
let i = {};
|
|
8
|
+
for (let a of n) {
|
|
9
|
+
let n = a.hidden ? "" : r[a.key] ?? "";
|
|
10
|
+
a.type === "multiSelect" ? i[a.key] = t(n) : a.type === "dateRange" ? i[a.key] = e(n) : i[a.key] = n;
|
|
11
|
+
}
|
|
12
|
+
return i;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { t as parseMultiSelectValue, n as parseSearchValues };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SelectOption } from '
|
|
1
|
+
import { SelectOption } from '../select/index.js';
|
|
2
2
|
/** 검색 필드 정의 — discriminated union. 새 타입은 여기에 추가. */
|
|
3
3
|
export type SearchField = SearchFieldText | SearchFieldSelect | SearchFieldMultiSelect | SearchFieldDateRange | SearchFieldDateSingle | SearchFieldMonth;
|
|
4
4
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("./parseDateRange.cjs");let n=require("react"),r=require("react-hot-toast");r=e.__toESM(r,1);function i({fields:e,values:i,onSearch:l,onClear:u}){let[d,f]=(0,n.useState)(()=>a(e,i)),p=(0,n.useRef)(i);return(0,n.useEffect)(()=>{let t=p.current;c(i,t,e)||(f(n=>{let r={...n};for(let a of e)(n[a.key]??``)===(t[a.key]??``)&&(r[a.key]=i[a.key]??``);return r}),p.current=i)},[i]),{draft:d,setFieldValue:(e,t)=>{f(n=>({...n,[e]:t}))},submit:()=>{for(let n of e){if(n.hidden||n.type!==`dateRange`)continue;let{from:e,to:i}=t.parseDateRangeValue(d[n.key]??``);if(e&&i&&e>i)return r.default.error(`${n.label} 종료일이 시작일보다 빠를 수 없어요`),!1}return l(s(e,d)),!0},clear:()=>{let t=o(e);f(t),u?u():l(t)},chips:e.map(e=>{if(e.hidden)return null;let t=i[e.key]??``;if(t===``)return null;if(e.type===`select`){let n=e.options.find(e=>String(e.value)===t);return{key:e.key,label:e.label,valueLabel:n?.label??t}}if(e.type===`multiSelect`){let n=t.split(`,`).filter(Boolean);if(n.length===0)return null;let r=new Map(e.options.map(e=>[String(e.value),e.label])),i=n.map(e=>r.get(e)??e);return{key:e.key,label:e.label,valueLabel:i.join(`, `)}}return null}).filter(e=>e!==null),removeChip:e=>{let t={...i,[e]:``};f(t),l(t)}}}function a(e,t){let n={};for(let r of e)n[r.key]=t[r.key]??``;return n}function o(e){let t={};for(let n of e)t[n.key]=``;return t}function s(e,t){let n={...t};for(let t of e)t.hidden&&(n[t.key]=``);return n}function c(e,t,n){for(let r of n)if((e[r.key]??``)!==(t[r.key]??``))return!1;return!0}exports.useSearchBoxState=i;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { parseDateRangeValue as e } from "./parseDateRange.esm.js";
|
|
2
|
+
import { useEffect as t, useRef as n, useState as r } from "react";
|
|
3
|
+
import i from "react-hot-toast";
|
|
4
|
+
//#region src/components/search-box/useSearchBoxState.ts
|
|
5
|
+
function a({ fields: a, values: u, onSearch: d, onClear: f }) {
|
|
6
|
+
let [p, m] = r(() => o(a, u)), h = n(u);
|
|
7
|
+
return t(() => {
|
|
8
|
+
let e = h.current;
|
|
9
|
+
l(u, e, a) || (m((t) => {
|
|
10
|
+
let n = { ...t };
|
|
11
|
+
for (let r of a) (t[r.key] ?? "") === (e[r.key] ?? "") && (n[r.key] = u[r.key] ?? "");
|
|
12
|
+
return n;
|
|
13
|
+
}), h.current = u);
|
|
14
|
+
}, [u]), {
|
|
15
|
+
draft: p,
|
|
16
|
+
setFieldValue: (e, t) => {
|
|
17
|
+
m((n) => ({
|
|
18
|
+
...n,
|
|
19
|
+
[e]: t
|
|
20
|
+
}));
|
|
21
|
+
},
|
|
22
|
+
submit: () => {
|
|
23
|
+
for (let t of a) {
|
|
24
|
+
if (t.hidden || t.type !== "dateRange") continue;
|
|
25
|
+
let { from: n, to: r } = e(p[t.key] ?? "");
|
|
26
|
+
if (n && r && n > r) return i.error(`${t.label} 종료일이 시작일보다 빠를 수 없어요`), !1;
|
|
27
|
+
}
|
|
28
|
+
return d(c(a, p)), !0;
|
|
29
|
+
},
|
|
30
|
+
clear: () => {
|
|
31
|
+
let e = s(a);
|
|
32
|
+
m(e), f ? f() : d(e);
|
|
33
|
+
},
|
|
34
|
+
chips: a.map((e) => {
|
|
35
|
+
if (e.hidden) return null;
|
|
36
|
+
let t = u[e.key] ?? "";
|
|
37
|
+
if (t === "") return null;
|
|
38
|
+
if (e.type === "select") {
|
|
39
|
+
let n = e.options.find((e) => String(e.value) === t);
|
|
40
|
+
return {
|
|
41
|
+
key: e.key,
|
|
42
|
+
label: e.label,
|
|
43
|
+
valueLabel: n?.label ?? t
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (e.type === "multiSelect") {
|
|
47
|
+
let n = t.split(",").filter(Boolean);
|
|
48
|
+
if (n.length === 0) return null;
|
|
49
|
+
let r = new Map(e.options.map((e) => [String(e.value), e.label])), i = n.map((e) => r.get(e) ?? e);
|
|
50
|
+
return {
|
|
51
|
+
key: e.key,
|
|
52
|
+
label: e.label,
|
|
53
|
+
valueLabel: i.join(", ")
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}).filter((e) => e !== null),
|
|
58
|
+
removeChip: (e) => {
|
|
59
|
+
let t = {
|
|
60
|
+
...u,
|
|
61
|
+
[e]: ""
|
|
62
|
+
};
|
|
63
|
+
m(t), d(t);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function o(e, t) {
|
|
68
|
+
let n = {};
|
|
69
|
+
for (let r of e) n[r.key] = t[r.key] ?? "";
|
|
70
|
+
return n;
|
|
71
|
+
}
|
|
72
|
+
function s(e) {
|
|
73
|
+
let t = {};
|
|
74
|
+
for (let n of e) t[n.key] = "";
|
|
75
|
+
return t;
|
|
76
|
+
}
|
|
77
|
+
function c(e, t) {
|
|
78
|
+
let n = { ...t };
|
|
79
|
+
for (let t of e) t.hidden && (n[t.key] = "");
|
|
80
|
+
return n;
|
|
81
|
+
}
|
|
82
|
+
function l(e, t, n) {
|
|
83
|
+
for (let r of n) if ((e[r.key] ?? "") !== (t[r.key] ?? "")) return !1;
|
|
84
|
+
return !0;
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { a as useSearchBoxState };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../lib/utils.cjs"),t=require("../button/Button.cjs"),n=require("../../node_modules/lucide-react/dist/esm/icons/eye-off.cjs"),r=require("../../node_modules/lucide-react/dist/esm/icons/eye.cjs"),i=require("./code-utils.cjs");let a=require("react"),o=require("react/jsx-runtime");var s={show:`인증번호 표시`,hide:`인증번호 숨기기`};function c({onKeyDown:c,value:l,onChange:u,length:d=6,hasError:f=!1,describedBy:p,autoFocus:m=!1,masked:h=!0,variant:g=`box`,disabled:_=!1,id:v,"aria-label":y,maskToggleLabels:b=s}){let x=(0,a.useRef)(null),[S,C]=(0,a.useState)(!1),[w,T]=(0,a.useState)(!1),E=h&&!w,D=Math.min(l.length,d-1),O=()=>{window.requestAnimationFrame(()=>{let e=x.current;e&&e.setSelectionRange(e.value.length,e.value.length)})};return(0,o.jsxs)(`div`,{className:`relative flex w-full items-center justify-center`,children:[(0,o.jsxs)(`div`,{className:e.cn(`relative w-full max-w-[320px]`,h&&`mx-12`),children:[(0,o.jsx)(`input`,{ref:x,id:v,type:E?`password`:`text`,inputMode:`numeric`,pattern:`[0-9]*`,autoComplete:`one-time-code`,"aria-label":y,"aria-invalid":f,"aria-describedby":p,value:l,maxLength:d,autoFocus:m,disabled:_,className:`absolute inset-0 z-10 h-full w-full cursor-text opacity-0 disabled:cursor-not-allowed`,onFocus:()=>{C(!0),O()},onKeyDown:c,onClick:O,onBlur:()=>C(!1),onPaste:e=>{e.preventDefault();let t=e.currentTarget;u(i.pasteCode(l,e.clipboardData.getData(`text`),t.selectionStart??l.length,t.selectionEnd??l.length,d)),O()},onChange:e=>{u(i.normalizeCode(e.target.value,d))}}),(0,o.jsx)(`div`,{className:`flex justify-center gap-2`,"aria-hidden":`true`,children:Array.from({length:d},(t,n)=>{let r=S&&n===D,i=l[n];return(0,o.jsx)(`span`,{"data-code-slot":!0,"data-active":r||void 0,className:e.cn(`flex h-control-large w-11 min-w-0 max-w-11 flex-1 items-center justify-center text-lg font-semibold text-fg-default transition-colors duration-control ease-control motion-reduce:transition-none`,g===`line`?`rounded-control-mini border-b-2 pb-1`:`rounded-control-large border-control bg-bg-surface`,f?`border-border-danger text-fg-danger`:r?g===`line`?`border-primary`:`border-primary ring-control ring-inset ring-focus-primary`:`border-border-subtle`),children:i===void 0?null:E?(0,o.jsx)(`span`,{"data-code-mask":!0,className:e.cn(`size-2.5 rounded-circle`,f?`bg-error`:`bg-fg-default`)}):i},n)})})]}),h?(0,o.jsx)(t.Button,{type:`button`,variant:`secondary`,appearance:`transparent`,disabled:_,"aria-label":E?b.show:b.hide,"aria-pressed":!E,size:`large`,className:`absolute right-0 top-1/2 w-control-large -translate-y-1/2 px-0`,onClick:()=>T(e=>!e),children:E?(0,o.jsx)(r.Eye,{"aria-hidden":`true`,className:`size-5`}):(0,o.jsx)(n.EyeOff,{"aria-hidden":`true`,className:`size-5`})}):null]})}exports.SegmentedCodeInput=c;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { KeyboardEvent } from 'react';
|
|
2
|
+
export interface SegmentedCodeInputProps {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (value: string) => void;
|
|
5
|
+
length?: number;
|
|
6
|
+
hasError?: boolean;
|
|
7
|
+
describedBy?: string;
|
|
8
|
+
autoFocus?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 숨겨진 실제 input의 keydown 핸들러. `<form>` 안에 놓이면 Enter가 자동으로
|
|
11
|
+
* submit되지만, 모달처럼 제출 버튼이 폼 밖에 있는 경우엔 Enter가 갈 곳이
|
|
12
|
+
* 없다. 그런 호출부가 Enter를 직접 처리할 수 있게 열어둔다.
|
|
13
|
+
*/
|
|
14
|
+
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
15
|
+
/** 숨겨진 실제 input의 `id`. 같은 화면에 여러 인스턴스(코드·코드 확인 등)가
|
|
16
|
+
* 있을 수 있으므로 호출부가 고유값을 넘긴다. */
|
|
17
|
+
id: string;
|
|
18
|
+
/** 숨겨진 실제 input의 접근성 라벨. */
|
|
19
|
+
"aria-label": string;
|
|
20
|
+
/**
|
|
21
|
+
* 값 마스킹 여부. 기본값 `true`(마스킹 + 눈 토글).
|
|
22
|
+
*
|
|
23
|
+
* 영구 비밀값(예: PIN)은 가려야 하지만, 1회용 인증번호(OTP·SMS·이메일)는
|
|
24
|
+
* 사용자가 다른 앱·문자를 보며 옮겨 적는 값이라 가리면 대조하기만
|
|
25
|
+
* 불편해진다(GitHub·Slack·Stripe 등 주요 서비스도 1회용 코드를 마스킹하지
|
|
26
|
+
* 않는다). `masked={false}`면 마스킹도 눈 토글 버튼도 렌더하지 않는다.
|
|
27
|
+
*/
|
|
28
|
+
masked?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* 슬롯 외형. 기본값 `"box"`(사방 테두리 + 라운드).
|
|
31
|
+
*
|
|
32
|
+
* `"line"`은 아래 보더만 남긴 얇은 형태다. 자릿수가 적을 때 상자가
|
|
33
|
+
* 과하게 무거워 보이는 자리에 쓴다.
|
|
34
|
+
*/
|
|
35
|
+
variant?: "box" | "line";
|
|
36
|
+
/** true면 입력을 막는다(예: 코드 만료). 기본값 `false`. */
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
/** 마스킹 해제 토글 버튼의 접근성 라벨. 기본값 "인증번호 표시"/"인증번호 숨기기". */
|
|
39
|
+
maskToggleLabels?: {
|
|
40
|
+
show: string;
|
|
41
|
+
hide: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 브라우저의 OTP 자동 완성·붙여넣기는 단일 input에 맡기고,
|
|
46
|
+
* 화면에서는 각 자리를 분리된 슬롯으로 표현한다. 숫자만 허용하며 length는 1 이상의 정수로 지정한다.
|
|
47
|
+
* 값과 onChange는 호출부에서 관리하고, 일회용 코드는 masked={false}로 표시할 수 있다.
|
|
48
|
+
*/
|
|
49
|
+
export declare function SegmentedCodeInput({ onKeyDown, value, onChange, length, hasError, describedBy, autoFocus, masked, variant, disabled, id, "aria-label": ariaLabel, maskToggleLabels, }: SegmentedCodeInputProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.esm.js";
|
|
2
|
+
import { Button as t } from "../button/Button.esm.js";
|
|
3
|
+
import { EyeOff as n } from "../../node_modules/lucide-react/dist/esm/icons/eye-off.esm.js";
|
|
4
|
+
import { Eye as r } from "../../node_modules/lucide-react/dist/esm/icons/eye.esm.js";
|
|
5
|
+
import { normalizeCode as i, pasteCode as a } from "./code-utils.esm.js";
|
|
6
|
+
import { useRef as o, useState as s } from "react";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/segmented-code-input/SegmentedCodeInput.tsx
|
|
9
|
+
var u = {
|
|
10
|
+
show: "인증번호 표시",
|
|
11
|
+
hide: "인증번호 숨기기"
|
|
12
|
+
};
|
|
13
|
+
function d({ onKeyDown: d, value: f, onChange: p, length: m = 6, hasError: h = !1, describedBy: g, autoFocus: _ = !1, masked: v = !0, variant: y = "box", disabled: b = !1, id: x, "aria-label": S, maskToggleLabels: C = u }) {
|
|
14
|
+
let w = o(null), [T, E] = s(!1), [D, O] = s(!1), k = v && !D, A = Math.min(f.length, m - 1), j = () => {
|
|
15
|
+
window.requestAnimationFrame(() => {
|
|
16
|
+
let e = w.current;
|
|
17
|
+
e && e.setSelectionRange(e.value.length, e.value.length);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ l("div", {
|
|
21
|
+
className: "relative flex w-full items-center justify-center",
|
|
22
|
+
children: [/* @__PURE__ */ l("div", {
|
|
23
|
+
className: e("relative w-full max-w-[320px]", v && "mx-12"),
|
|
24
|
+
children: [/* @__PURE__ */ c("input", {
|
|
25
|
+
ref: w,
|
|
26
|
+
id: x,
|
|
27
|
+
type: k ? "password" : "text",
|
|
28
|
+
inputMode: "numeric",
|
|
29
|
+
pattern: "[0-9]*",
|
|
30
|
+
autoComplete: "one-time-code",
|
|
31
|
+
"aria-label": S,
|
|
32
|
+
"aria-invalid": h,
|
|
33
|
+
"aria-describedby": g,
|
|
34
|
+
value: f,
|
|
35
|
+
maxLength: m,
|
|
36
|
+
autoFocus: _,
|
|
37
|
+
disabled: b,
|
|
38
|
+
className: "absolute inset-0 z-10 h-full w-full cursor-text opacity-0 disabled:cursor-not-allowed",
|
|
39
|
+
onFocus: () => {
|
|
40
|
+
E(!0), j();
|
|
41
|
+
},
|
|
42
|
+
onKeyDown: d,
|
|
43
|
+
onClick: j,
|
|
44
|
+
onBlur: () => E(!1),
|
|
45
|
+
onPaste: (e) => {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
let t = e.currentTarget;
|
|
48
|
+
p(a(f, e.clipboardData.getData("text"), t.selectionStart ?? f.length, t.selectionEnd ?? f.length, m)), j();
|
|
49
|
+
},
|
|
50
|
+
onChange: (e) => {
|
|
51
|
+
p(i(e.target.value, m));
|
|
52
|
+
}
|
|
53
|
+
}), /* @__PURE__ */ c("div", {
|
|
54
|
+
className: "flex justify-center gap-2",
|
|
55
|
+
"aria-hidden": "true",
|
|
56
|
+
children: Array.from({ length: m }, (t, n) => {
|
|
57
|
+
let r = T && n === A, i = f[n];
|
|
58
|
+
return /* @__PURE__ */ c("span", {
|
|
59
|
+
"data-code-slot": !0,
|
|
60
|
+
"data-active": r || void 0,
|
|
61
|
+
className: e("flex h-control-large w-11 min-w-0 max-w-11 flex-1 items-center justify-center text-lg font-semibold text-fg-default transition-colors duration-control ease-control motion-reduce:transition-none", y === "line" ? "rounded-control-mini border-b-2 pb-1" : "rounded-control-large border-control bg-bg-surface", h ? "border-border-danger text-fg-danger" : r ? y === "line" ? "border-primary" : "border-primary ring-control ring-inset ring-focus-primary" : "border-border-subtle"),
|
|
62
|
+
children: i === void 0 ? null : k ? /* @__PURE__ */ c("span", {
|
|
63
|
+
"data-code-mask": !0,
|
|
64
|
+
className: e("size-2.5 rounded-circle", h ? "bg-error" : "bg-fg-default")
|
|
65
|
+
}) : i
|
|
66
|
+
}, n);
|
|
67
|
+
})
|
|
68
|
+
})]
|
|
69
|
+
}), v ? /* @__PURE__ */ c(t, {
|
|
70
|
+
type: "button",
|
|
71
|
+
variant: "secondary",
|
|
72
|
+
appearance: "transparent",
|
|
73
|
+
disabled: b,
|
|
74
|
+
"aria-label": k ? C.show : C.hide,
|
|
75
|
+
"aria-pressed": !k,
|
|
76
|
+
size: "large",
|
|
77
|
+
className: "absolute right-0 top-1/2 w-control-large -translate-y-1/2 px-0",
|
|
78
|
+
onClick: () => O((e) => !e),
|
|
79
|
+
children: c(k ? r : n, {
|
|
80
|
+
"aria-hidden": "true",
|
|
81
|
+
className: "size-5"
|
|
82
|
+
})
|
|
83
|
+
}) : null]
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { d as SegmentedCodeInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t){return e.replace(/\D/g,``).slice(0,t)}function t(t,n,r,i,a){return e(t.slice(0,r)+n.replace(/\D/g,``)+t.slice(i),a)}exports.normalizeCode=e,exports.pasteCode=t;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/components/segmented-code-input/code-utils.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
return e.replace(/\D/g, "").slice(0, t);
|
|
4
|
+
}
|
|
5
|
+
function t(t, n, r, i, a) {
|
|
6
|
+
return e(t.slice(0, r) + n.replace(/\D/g, "") + t.slice(i), a);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { e as normalizeCode, t as pasteCode };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../lib/utils.cjs");let t=require("react"),n=require("react/jsx-runtime");function r({value:r,onChange:i,options:a,name:o,"aria-label":s,"aria-labelledby":c,disabled:l,className:u}){let d=(0,t.useId)(),f=o??d,p=(0,t.useRef)(new Map),m=(0,t.useRef)(null),[h,g]=(0,t.useState)(null),_=(0,t.useCallback)(()=>{let e=p.current.get(r);if(!e){g(null);return}g(t=>({left:e.offsetLeft,width:e.offsetWidth,animate:t!==null}))},[r]);(0,t.useLayoutEffect)(()=>{_()},[_]),(0,t.useLayoutEffect)(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(_);return m.current=e,p.current.forEach(t=>e.observe(t)),()=>{e.disconnect(),m.current=null}},[_]);let v=(0,t.useCallback)(e=>t=>{let n=p.current.get(e);n&&m.current?.unobserve(n),t?(p.current.set(e,t),m.current?.observe(t)):p.current.delete(e)},[]),y=e=>{let t=e.key===`ArrowRight`||e.key===`ArrowDown`?1:e.key===`ArrowLeft`||e.key===`ArrowUp`?-1:0;if(t===0)return;let n=e.currentTarget,r=Array.from(n.ownerDocument.getElementsByName(n.name)).filter(e=>e instanceof HTMLInputElement&&e.type===`radio`&&e.form===n.form&&!e.disabled),i=r.indexOf(n);if(i<0||r.length<2)return;e.preventDefault();let a=r[(i+t+r.length)%r.length];a?.focus(),a?.click()};return(0,n.jsxs)(`div`,{role:`radiogroup`,"aria-label":s,"aria-labelledby":c,className:e.cn(`relative inline-flex items-stretch gap-1 rounded-control-medium border-control border-border-subtle bg-bg-surface p-1`,u),children:[(0,n.jsx)(`span`,{"aria-hidden":`true`,"data-segmented-control-indicator":!0,className:e.cn(`pointer-events-none absolute top-1 bottom-1 left-0 rounded-control-small bg-bg-subtle transition-[transform,width] duration-200 ease-out motion-reduce:transition-none`,!h?.animate&&`transition-none`,!h&&`hidden`),style:{transform:`translateX(${h?.left??0}px)`,width:`${h?.width??0}px`}}),a.map(t=>{let a=t.value===r,o=l||t.disabled;return(0,n.jsxs)(`label`,{ref:v(t.value),className:e.cn(`relative flex flex-1 items-center justify-center`,o?`cursor-not-allowed`:`cursor-pointer`),children:[(0,n.jsx)(`input`,{type:`radio`,className:`peer sr-only`,name:f,value:t.value,checked:a,disabled:o,onChange:()=>i(t.value),onKeyDown:y}),(0,n.jsxs)(`span`,{className:e.cn(`relative z-10 flex h-full w-full min-w-0 items-center justify-center gap-slot-small rounded-control-small px-2 py-1.5 text-control-small font-control-field font-medium text-fg-muted outline-none transition-colors duration-control ease-control`,!o&&`hover:text-fg-default`,`peer-checked:font-semibold peer-checked:text-fg-default`,`peer-focus:ring-control peer-focus:ring-focus-primary peer-focus:ring-offset-2 peer-focus:ring-offset-bg-surface`,`peer-disabled:text-fg-disabled peer-disabled:hover:bg-transparent`),children:[t.icon?(0,n.jsx)(`span`,{"aria-hidden":`true`,"data-segmented-control-leading":!0,className:`flex h-slot-icon-small w-slot-icon-small shrink-0 items-center justify-center [&>*]:h-slot-icon-small [&>*]:w-slot-icon-small`,children:t.icon}):null,(0,n.jsx)(`span`,{"data-segmented-control-label":!0,className:`min-w-0 truncate`,children:t.label})]})]},t.value)})]})}exports.SegmentedControl=r;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SegmentedControlProps } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 알약형 컨테이너 하나 안에 칸으로 나뉜 세그먼트 컨트롤.
|
|
4
|
+
*
|
|
5
|
+
* 2~3택 짧은 선택지가 여러 줄 쌓이는 설정 화면에 적합하다. 원형 indicator
|
|
6
|
+
* 없이 흰 바탕+테두리 컨테이너 안에서 칸이 폭을 균등 분배(2택=50%,
|
|
7
|
+
* 3택=33%)하며, 선택 표시는 각 칸의 배경이 아니라 컨테이너 안에서
|
|
8
|
+
* 미끄러지는 인디케이터 하나(`bg-bg-subtle`)가 담당한다.
|
|
9
|
+
*
|
|
10
|
+
* 네이티브 semantics(`role="radiogroup"` + sr-only `type="radio"` input)를
|
|
11
|
+
* 유지해 방향키 roving focus·Space 선택·스크린리더 announcement가 그대로
|
|
12
|
+
* 동작한다.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <SegmentedControl
|
|
17
|
+
* aria-label="주기"
|
|
18
|
+
* value={period}
|
|
19
|
+
* onChange={setPeriod}
|
|
20
|
+
* options={[
|
|
21
|
+
* { value: "month", label: "월간" },
|
|
22
|
+
* { value: "year", label: "연간" },
|
|
23
|
+
* ]}
|
|
24
|
+
* />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function SegmentedControl<V extends string>({ value, onChange, options, name, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, disabled, className, }: SegmentedControlProps<V>): import("react").JSX.Element;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.esm.js";
|
|
2
|
+
import { useCallback as t, useId as n, useLayoutEffect as r, useRef as i, useState as a } from "react";
|
|
3
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/segmented-control/SegmentedControl.tsx
|
|
5
|
+
function c({ value: c, onChange: l, options: u, name: d, "aria-label": f, "aria-labelledby": p, disabled: m, className: h }) {
|
|
6
|
+
let g = n(), _ = d ?? g, v = i(/* @__PURE__ */ new Map()), y = i(null), [b, x] = a(null), S = t(() => {
|
|
7
|
+
let e = v.current.get(c);
|
|
8
|
+
if (!e) {
|
|
9
|
+
x(null);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
x((t) => ({
|
|
13
|
+
left: e.offsetLeft,
|
|
14
|
+
width: e.offsetWidth,
|
|
15
|
+
animate: t !== null
|
|
16
|
+
}));
|
|
17
|
+
}, [c]);
|
|
18
|
+
r(() => {
|
|
19
|
+
S();
|
|
20
|
+
}, [S]), r(() => {
|
|
21
|
+
if (typeof ResizeObserver > "u") return;
|
|
22
|
+
let e = new ResizeObserver(S);
|
|
23
|
+
return y.current = e, v.current.forEach((t) => e.observe(t)), () => {
|
|
24
|
+
e.disconnect(), y.current = null;
|
|
25
|
+
};
|
|
26
|
+
}, [S]);
|
|
27
|
+
let C = t((e) => (t) => {
|
|
28
|
+
let n = v.current.get(e);
|
|
29
|
+
n && y.current?.unobserve(n), t ? (v.current.set(e, t), y.current?.observe(t)) : v.current.delete(e);
|
|
30
|
+
}, []), w = (e) => {
|
|
31
|
+
let t = e.key === "ArrowRight" || e.key === "ArrowDown" ? 1 : e.key === "ArrowLeft" || e.key === "ArrowUp" ? -1 : 0;
|
|
32
|
+
if (t === 0) return;
|
|
33
|
+
let n = e.currentTarget, r = Array.from(n.ownerDocument.getElementsByName(n.name)).filter((e) => e instanceof HTMLInputElement && e.type === "radio" && e.form === n.form && !e.disabled), i = r.indexOf(n);
|
|
34
|
+
if (i < 0 || r.length < 2) return;
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
let a = r[(i + t + r.length) % r.length];
|
|
37
|
+
a?.focus(), a?.click();
|
|
38
|
+
};
|
|
39
|
+
return /* @__PURE__ */ s("div", {
|
|
40
|
+
role: "radiogroup",
|
|
41
|
+
"aria-label": f,
|
|
42
|
+
"aria-labelledby": p,
|
|
43
|
+
className: e("relative inline-flex items-stretch gap-1 rounded-control-medium border-control border-border-subtle bg-bg-surface p-1", h),
|
|
44
|
+
children: [/* @__PURE__ */ o("span", {
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
"data-segmented-control-indicator": !0,
|
|
47
|
+
className: e("pointer-events-none absolute top-1 bottom-1 left-0 rounded-control-small bg-bg-subtle transition-[transform,width] duration-200 ease-out motion-reduce:transition-none", !b?.animate && "transition-none", !b && "hidden"),
|
|
48
|
+
style: {
|
|
49
|
+
transform: `translateX(${b?.left ?? 0}px)`,
|
|
50
|
+
width: `${b?.width ?? 0}px`
|
|
51
|
+
}
|
|
52
|
+
}), u.map((t) => {
|
|
53
|
+
let n = t.value === c, r = m || t.disabled;
|
|
54
|
+
return /* @__PURE__ */ s("label", {
|
|
55
|
+
ref: C(t.value),
|
|
56
|
+
className: e("relative flex flex-1 items-center justify-center", r ? "cursor-not-allowed" : "cursor-pointer"),
|
|
57
|
+
children: [/* @__PURE__ */ o("input", {
|
|
58
|
+
type: "radio",
|
|
59
|
+
className: "peer sr-only",
|
|
60
|
+
name: _,
|
|
61
|
+
value: t.value,
|
|
62
|
+
checked: n,
|
|
63
|
+
disabled: r,
|
|
64
|
+
onChange: () => l(t.value),
|
|
65
|
+
onKeyDown: w
|
|
66
|
+
}), /* @__PURE__ */ s("span", {
|
|
67
|
+
className: e("relative z-10 flex h-full w-full min-w-0 items-center justify-center gap-slot-small rounded-control-small px-2 py-1.5 text-control-small font-control-field font-medium text-fg-muted outline-none transition-colors duration-control ease-control", !r && "hover:text-fg-default", "peer-checked:font-semibold peer-checked:text-fg-default", "peer-focus:ring-control peer-focus:ring-focus-primary peer-focus:ring-offset-2 peer-focus:ring-offset-bg-surface", "peer-disabled:text-fg-disabled peer-disabled:hover:bg-transparent"),
|
|
68
|
+
children: [t.icon ? /* @__PURE__ */ o("span", {
|
|
69
|
+
"aria-hidden": "true",
|
|
70
|
+
"data-segmented-control-leading": !0,
|
|
71
|
+
className: "flex h-slot-icon-small w-slot-icon-small shrink-0 items-center justify-center [&>*]:h-slot-icon-small [&>*]:w-slot-icon-small",
|
|
72
|
+
children: t.icon
|
|
73
|
+
}) : null, /* @__PURE__ */ o("span", {
|
|
74
|
+
"data-segmented-control-label": !0,
|
|
75
|
+
className: "min-w-0 truncate",
|
|
76
|
+
children: t.label
|
|
77
|
+
})]
|
|
78
|
+
})]
|
|
79
|
+
}, t.value);
|
|
80
|
+
})]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { c as SegmentedControl };
|