@thewrong/ui 0.1.0 → 0.2.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/dist/_virtual/_rolldown/runtime.cjs.js +1 -0
- package/dist/components/_shared/form-size-tokens.cjs.js +1 -0
- package/dist/components/_shared/form-size-tokens.esm.js +29 -0
- package/dist/components/action-toast/ActionToast.cjs.js +1 -0
- package/dist/components/action-toast/ActionToast.esm.js +228 -0
- package/dist/components/animated-height/AnimatedHeight.cjs.js +1 -0
- package/dist/components/animated-height/AnimatedHeight.esm.js +36 -0
- package/dist/components/badge/Badge.cjs.js +1 -0
- package/dist/components/badge/Badge.esm.js +30 -0
- package/dist/components/badge/utils.cjs.js +1 -0
- package/dist/components/badge/utils.esm.js +38 -0
- package/dist/components/button/Button.cjs.js +1 -0
- package/dist/components/button/Button.esm.js +84 -0
- package/dist/components/button/utils.cjs.js +1 -0
- package/dist/components/button/utils.esm.js +38 -0
- package/dist/components/checkbox/Checkbox.cjs.js +1 -0
- package/dist/components/checkbox/Checkbox.esm.js +68 -0
- package/dist/components/checkbox/utils.cjs.js +1 -0
- package/dist/components/checkbox/utils.esm.js +44 -0
- package/dist/components/collapsible/Collapsible.cjs.js +1 -0
- package/dist/components/collapsible/Collapsible.esm.js +19 -0
- package/dist/components/date-input/DateInput.cjs.js +1 -0
- package/dist/components/date-input/DateInput.esm.js +39 -0
- package/dist/components/date-picker/date-picker.cjs.js +1 -0
- package/dist/components/date-picker/date-picker.esm.js +231 -0
- package/dist/components/date-picker/date-range-picker.cjs.js +1 -0
- package/dist/components/date-picker/date-range-picker.esm.js +287 -0
- package/dist/components/date-picker/month-picker.cjs.js +1 -0
- package/dist/components/date-picker/month-picker.esm.js +147 -0
- package/dist/components/drawer/Drawer.cjs.js +1 -0
- package/dist/components/drawer/Drawer.esm.js +113 -0
- package/dist/components/info-tooltip/InfoTooltip.cjs.js +1 -0
- package/dist/components/info-tooltip/InfoTooltip.esm.js +24 -0
- package/dist/components/input/Input.cjs.js +1 -0
- package/dist/components/input/Input.esm.js +95 -0
- package/dist/components/input/PasswordInput.cjs.js +1 -0
- package/dist/components/input/PasswordInput.esm.js +29 -0
- package/dist/components/input/format.cjs.js +1 -0
- package/dist/components/input/format.esm.js +33 -0
- package/dist/components/input/utils.cjs.js +1 -0
- package/dist/components/input/utils.esm.js +23 -0
- package/dist/components/loading-spinner/LoadingSpinner.cjs.js +1 -0
- package/dist/components/loading-spinner/LoadingSpinner.esm.js +47 -0
- package/dist/components/modal/Modal.cjs.js +1 -0
- package/dist/components/modal/Modal.esm.js +137 -0
- package/dist/components/modal/ModalSubView.cjs.js +1 -0
- package/dist/components/modal/ModalSubView.esm.js +91 -0
- package/dist/components/modal/StandardModal.cjs.js +1 -0
- package/dist/components/modal/StandardModal.esm.js +54 -0
- package/dist/components/page-title/PageTitle.cjs.js +1 -0
- package/dist/components/page-title/PageTitle.esm.js +16 -0
- package/dist/components/popover/Popover.cjs.js +1 -0
- package/dist/components/popover/Popover.esm.js +57 -0
- package/dist/components/search-box/ExactMatchToggle.cjs.js +1 -0
- package/dist/components/search-box/ExactMatchToggle.esm.js +27 -0
- package/dist/components/search-box/SearchBox.cjs.js +1 -0
- package/dist/components/search-box/SearchBox.esm.js +154 -0
- package/dist/components/search-box/SearchBoxChips.cjs.js +1 -0
- package/dist/components/search-box/SearchBoxChips.esm.js +36 -0
- package/dist/components/search-box/SearchBoxDateRange.cjs.js +1 -0
- package/dist/components/search-box/SearchBoxDateRange.esm.js +57 -0
- package/dist/components/search-box/SearchBoxDateSingle.cjs.js +1 -0
- package/dist/components/search-box/SearchBoxDateSingle.esm.js +37 -0
- package/dist/components/search-box/SearchBoxField.cjs.js +1 -0
- package/dist/components/search-box/SearchBoxField.esm.js +48 -0
- package/dist/components/search-box/SearchBoxFloatingInput.cjs.js +1 -0
- package/dist/components/search-box/SearchBoxFloatingInput.esm.js +38 -0
- package/dist/components/search-box/SearchBoxFloatingSelect.cjs.js +1 -0
- package/dist/components/search-box/SearchBoxFloatingSelect.esm.js +74 -0
- package/dist/components/search-box/SearchBoxMonth.cjs.js +1 -0
- package/dist/components/search-box/SearchBoxMonth.esm.js +35 -0
- package/dist/components/search-box/SearchBoxMultiSelect.cjs.js +1 -0
- package/dist/components/search-box/SearchBoxMultiSelect.esm.js +78 -0
- package/dist/components/search-box/SearchBoxSheetContext.cjs.js +1 -0
- package/dist/components/search-box/SearchBoxSheetContext.esm.js +5 -0
- package/dist/components/search-box/dateRangePresets.cjs.js +1 -0
- package/dist/components/search-box/dateRangePresets.esm.js +59 -0
- package/dist/components/search-box/parseDateRange.cjs.js +1 -0
- package/dist/components/search-box/parseDateRange.esm.js +21 -0
- package/dist/components/search-box/parseSearchValues.cjs.js +1 -0
- package/dist/components/search-box/parseSearchValues.esm.js +15 -0
- package/dist/components/search-box/useSearchBoxState.cjs.js +1 -0
- package/dist/components/search-box/useSearchBoxState.esm.js +87 -0
- package/dist/components/select/MultiSelect.cjs.js +1 -0
- package/dist/components/select/MultiSelect.esm.js +277 -0
- package/dist/components/select/Select.cjs.js +1 -0
- package/dist/components/select/Select.esm.js +308 -0
- package/dist/components/select/loading-dots.cjs.js +1 -0
- package/dist/components/select/loading-dots.esm.js +23 -0
- package/dist/components/switch/Switch.cjs.js +1 -0
- package/dist/components/switch/Switch.esm.js +36 -0
- package/dist/components/switch/utils.cjs.js +1 -0
- package/dist/components/switch/utils.esm.js +39 -0
- package/dist/components/table/accordion-table.cjs.js +1 -0
- package/dist/components/table/accordion-table.esm.js +418 -0
- package/dist/components/table/column-group-utils.cjs.js +1 -0
- package/dist/components/table/column-group-utils.esm.js +53 -0
- package/dist/components/table/components/ColumnPresetSelector.cjs.js +1 -0
- package/dist/components/table/components/ColumnPresetSelector.esm.js +165 -0
- package/dist/components/table/components/ColumnSettingsTable.cjs.js +4 -0
- package/dist/components/table/components/ColumnSettingsTable.esm.js +196 -0
- package/dist/components/table/components/KeyboardNavButton.cjs.js +1 -0
- package/dist/components/table/components/KeyboardNavButton.esm.js +24 -0
- package/dist/components/table/components/PageJumpInput.cjs.js +1 -0
- package/dist/components/table/components/PageJumpInput.esm.js +53 -0
- package/dist/components/table/components/Pagination.cjs.js +1 -0
- package/dist/components/table/components/Pagination.esm.js +162 -0
- package/dist/components/table/components/PaginationFooter.cjs.js +1 -0
- package/dist/components/table/components/PaginationFooter.esm.js +80 -0
- package/dist/components/table/components/SortableHeaderCell.cjs.js +1 -0
- package/dist/components/table/components/SortableHeaderCell.esm.js +30 -0
- package/dist/components/table/hooks/useColumnPresets.cjs.js +1 -0
- package/dist/components/table/hooks/useColumnPresets.esm.js +165 -0
- package/dist/components/table/hooks/useColumnResize.cjs.js +1 -0
- package/dist/components/table/hooks/useColumnResize.esm.js +106 -0
- package/dist/components/table/hooks/useFillEmptyRows.cjs.js +1 -0
- package/dist/components/table/hooks/useFillEmptyRows.esm.js +49 -0
- package/dist/components/table/hooks/useInfiniteScroll.cjs.js +1 -0
- package/dist/components/table/hooks/useInfiniteScroll.esm.js +32 -0
- package/dist/components/table/hooks/useTableColumnState.cjs.js +1 -0
- package/dist/components/table/hooks/useTableColumnState.esm.js +46 -0
- package/dist/components/table/hooks/useTableDragSelection.cjs.js +1 -0
- package/dist/components/table/hooks/useTableDragSelection.esm.js +76 -0
- package/dist/components/table/hooks/useTableSort.cjs.js +1 -0
- package/dist/components/table/hooks/useTableSort.esm.js +30 -0
- package/dist/components/table/hooks/useVirtualTable.cjs.js +1 -0
- package/dist/components/table/hooks/useVirtualTable.esm.js +18 -0
- package/dist/components/table/mini-table.cjs.js +1 -0
- package/dist/components/table/mini-table.esm.js +126 -0
- package/dist/components/table/paginated-mini-table.cjs.js +1 -0
- package/dist/components/table/paginated-mini-table.esm.js +31 -0
- package/dist/components/table/paginated-table.cjs.js +1 -0
- package/dist/components/table/paginated-table.esm.js +31 -0
- package/dist/components/table/table.cjs.js +1 -0
- package/dist/components/table/table.esm.js +342 -0
- package/dist/components/table/utils.cjs.js +37 -0
- package/dist/components/table/utils.esm.js +16 -0
- package/dist/components/table-checkbox/TableCheckbox.cjs.js +1 -0
- package/dist/components/table-checkbox/TableCheckbox.esm.js +39 -0
- package/dist/components/table-page-layout/TablePageLayout.cjs.js +1 -0
- package/dist/components/table-page-layout/TablePageLayout.esm.js +37 -0
- package/dist/components/textarea/Textarea.cjs.js +1 -0
- package/dist/components/textarea/Textarea.esm.js +62 -0
- package/dist/components/toast/ToastProvider.cjs.js +1 -0
- package/dist/components/toast/ToastProvider.esm.js +82 -0
- package/dist/components/toast/index.esm.js +3 -0
- package/dist/components/toolbar/Toolbar.cjs.js +1 -0
- package/dist/components/toolbar/Toolbar.esm.js +148 -0
- package/dist/components/tooltip/Tooltip.cjs.js +1 -0
- package/dist/components/tooltip/Tooltip.esm.js +39 -0
- package/dist/hooks/useBottomSheetDrag.cjs.js +1 -0
- package/dist/hooks/useBottomSheetDrag.esm.js +17 -0
- package/dist/hooks/useClickOutside.cjs.js +1 -0
- package/dist/hooks/useClickOutside.esm.js +20 -0
- package/dist/hooks/useMediaQuery.cjs.js +1 -0
- package/dist/hooks/useMediaQuery.esm.js +15 -0
- package/dist/hooks/useScrollLock.cjs.js +1 -0
- package/dist/hooks/useScrollLock.esm.js +16 -0
- package/dist/hooks.cjs.js +1 -0
- package/dist/hooks.esm.js +5 -0
- package/dist/index.cjs.js +1 -40
- package/dist/index.esm.js +58 -0
- package/dist/lib/Portal.cjs.js +1 -0
- package/dist/lib/Portal.esm.js +11 -0
- package/dist/lib/column-preset-storage.cjs.js +1 -0
- package/dist/lib/column-preset-storage.esm.js +123 -0
- package/dist/lib/overlay-stack.cjs.js +1 -0
- package/dist/lib/overlay-stack.esm.js +28 -0
- package/dist/lib/utils.cjs.js +1 -0
- package/dist/lib/utils.esm.js +11 -0
- package/dist/node_modules/clsx/dist/clsx.cjs.js +1 -0
- package/dist/node_modules/clsx/dist/clsx.esm.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/Icon.cjs.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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/eye-off.cjs.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +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.js +1 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.esm.js +1714 -0
- package/dist/node_modules/use-debounce/dist/index.module.cjs.js +1 -0
- package/dist/node_modules/use-debounce/dist/index.module.esm.js +70 -0
- package/dist/src/components/action-toast/ActionToast.d.ts +6 -1
- package/dist/src/components/button/Button.d.ts +16 -0
- package/dist/src/components/drawer/Drawer.d.ts +6 -1
- package/dist/src/components/info-tooltip/InfoTooltip.d.ts +7 -0
- package/dist/src/components/loading-spinner/LoadingSpinner.d.ts +7 -0
- package/dist/src/components/modal/Modal.d.ts +7 -1
- package/dist/src/components/popover/Popover.d.ts +19 -1
- package/dist/src/components/tooltip/Tooltip.d.ts +10 -0
- package/dist/ui.css +1 -1
- package/llms.txt +91 -0
- package/package.json +10 -4
- package/dist/index.es.js +0 -8066
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region src/components/checkbox/utils.ts
|
|
2
|
+
function e() {
|
|
3
|
+
return "appearance-none cursor-pointer transition-all duration-200 focus:outline-hidden";
|
|
4
|
+
}
|
|
5
|
+
function t(t = "primary") {
|
|
6
|
+
return `${e()} rounded-full border-2 ${{
|
|
7
|
+
primary: "border-neutral-300 peer-checked:bg-primary-500 peer-checked:border-primary-500 text-white",
|
|
8
|
+
secondary: "border-neutral-300 peer-checked:bg-secondary-500 peer-checked:border-secondary-500 text-white",
|
|
9
|
+
neutral: "border-neutral-300 peer-checked:bg-neutral-600 peer-checked:border-neutral-600 text-white"
|
|
10
|
+
}[t]} relative flex items-center justify-center transition-all duration-200`;
|
|
11
|
+
}
|
|
12
|
+
function n(t = "primary") {
|
|
13
|
+
return `${e()} rounded-sm border-2 ${{
|
|
14
|
+
primary: "border-neutral-300 peer-checked:bg-primary-500 peer-checked:border-primary-500 text-white",
|
|
15
|
+
secondary: "border-neutral-300 peer-checked:bg-secondary-500 peer-checked:border-secondary-500 text-white",
|
|
16
|
+
neutral: "border-neutral-300 peer-checked:bg-neutral-600 peer-checked:border-neutral-600 text-white"
|
|
17
|
+
}[t]} relative flex items-center justify-center transition-all duration-200`;
|
|
18
|
+
}
|
|
19
|
+
function r(t = "primary") {
|
|
20
|
+
return `${e()} rounded-sm border-2 bg-transparent ${{
|
|
21
|
+
primary: "border-neutral-200 peer-checked:border-primary-500 text-primary-500",
|
|
22
|
+
secondary: "border-neutral-200 peer-checked:border-secondary-500 text-secondary-500",
|
|
23
|
+
neutral: "border-neutral-200 peer-checked:border-neutral-600 text-neutral-600"
|
|
24
|
+
}[t]} relative flex items-center justify-center transition-all duration-200`;
|
|
25
|
+
}
|
|
26
|
+
function i(e, i = "primary") {
|
|
27
|
+
switch (e) {
|
|
28
|
+
case "circle": return t(i);
|
|
29
|
+
case "line": return n(i);
|
|
30
|
+
case "lineTransparent": return r(i);
|
|
31
|
+
default: return n(i);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function a(e = 24) {
|
|
35
|
+
return {
|
|
36
|
+
width: `${e}px`,
|
|
37
|
+
height: `${e}px`
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function o() {
|
|
41
|
+
return "inline-flex items-center gap-2 cursor-pointer select-none";
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { a as getCheckboxSizeStyle, i as getCheckboxVariantClasses, o as getLabelClasses };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("react/jsx-runtime");function t({open:t,durationMs:n=200,ease:r=`cubic-bezier(0.16, 1, 0.3, 1)`,unmountWhenClosed:i=!1,fade:a=!0,className:o=``,children:s}){return i&&!t?null:(0,e.jsx)(`div`,{className:`grid ${o}`,style:{gridTemplateRows:t?`1fr`:`0fr`,opacity:a?+!!t:void 0,transition:[`grid-template-rows ${n}ms ${r}`,a?`opacity ${n}ms ${r}`:null].filter(Boolean).join(`, `)},"aria-hidden":!t,children:(0,e.jsx)(`div`,{className:`overflow-hidden`,children:s})})}exports.Collapsible=t;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
//#region src/components/collapsible/Collapsible.tsx
|
|
3
|
+
function t({ open: t, durationMs: n = 200, ease: r = "cubic-bezier(0.16, 1, 0.3, 1)", unmountWhenClosed: i = !1, fade: a = !0, className: o = "", children: s }) {
|
|
4
|
+
return i && !t ? null : /* @__PURE__ */ e("div", {
|
|
5
|
+
className: `grid ${o}`,
|
|
6
|
+
style: {
|
|
7
|
+
gridTemplateRows: t ? "1fr" : "0fr",
|
|
8
|
+
opacity: a ? +!!t : void 0,
|
|
9
|
+
transition: [`grid-template-rows ${n}ms ${r}`, a ? `opacity ${n}ms ${r}` : null].filter(Boolean).join(", ")
|
|
10
|
+
},
|
|
11
|
+
"aria-hidden": !t,
|
|
12
|
+
children: /* @__PURE__ */ e("div", {
|
|
13
|
+
className: "overflow-hidden",
|
|
14
|
+
children: s
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { t as Collapsible };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../node_modules/lucide-react/dist/esm/icons/calendar.cjs.js"),t=require("../date-picker/date-picker.cjs.js");let n=require("react/jsx-runtime");function r({value:r,onChange:i,size:a=`small`,ariaLabel:o,label:s,className:c=``,disableMobileSheet:l=!1}){let u=a===`mini`,d=u?`h-8`:`h-10`,f=u?`w-30`:`w-36`,p=u?`pl-2 pr-0.5`:`pl-2.5 pr-1`,m=u?`text-xs`:`text-sm`,h=u?`h-5 w-5`:`h-6 w-6`,g=u?`h-3 w-3`:`h-3.5 w-3.5`,_=`group relative ${d} ${f} ${p} flex items-center gap-1 rounded-lg border border-border-tertiary dark:border-border-secondary bg-bg-white transition-colors focus-within:border-primary-500 ${c}`,v=r?`text-text-primary`:`text-text-tertiary`,y=!!s;return(0,n.jsxs)(`div`,{className:_,children:[(0,n.jsx)(`input`,{type:`date`,value:r,onChange:e=>i(e.target.value),min:`1900-01-01`,max:`9999-12-31`,"aria-label":o??s,className:`search-box-date-input flex-1 bg-transparent ${m} outline-none ${v}`}),(0,n.jsx)(t.DatePicker,{value:r||null,onApply:e=>i(e),disableMobileSheet:l,children:(0,n.jsx)(`button`,{type:`button`,"aria-label":`달력에서 날짜 선택`,className:`flex ${h} items-center justify-center rounded text-neutral-400 transition-colors hover:bg-neutral-100 hover:text-neutral-600 dark:hover:bg-neutral-800 dark:hover:text-neutral-200`,children:(0,n.jsx)(e.Calendar,{className:g})})}),y&&(0,n.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute -top-2 left-2 bg-bg-white px-1 text-text-secondary group-focus-within:text-primary-500 ${u?`text-[10px]`:`text-xs`}`,children:s})]})}exports.DateInput=r;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Calendar as e } from "../../node_modules/lucide-react/dist/esm/icons/calendar.esm.js";
|
|
2
|
+
import { DatePicker as t } from "../date-picker/date-picker.esm.js";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/date-input/DateInput.tsx
|
|
5
|
+
function i({ value: i, onChange: a, size: o = "small", ariaLabel: s, label: c, className: l = "", disableMobileSheet: u = !1 }) {
|
|
6
|
+
let d = o === "mini", f = d ? "h-8" : "h-10", p = d ? "w-30" : "w-36", m = d ? "pl-2 pr-0.5" : "pl-2.5 pr-1", h = d ? "text-xs" : "text-sm", g = d ? "h-5 w-5" : "h-6 w-6", _ = d ? "h-3 w-3" : "h-3.5 w-3.5", v = `group relative ${f} ${p} ${m} flex items-center gap-1 rounded-lg border border-border-tertiary dark:border-border-secondary bg-bg-white transition-colors focus-within:border-primary-500 ${l}`, y = i ? "text-text-primary" : "text-text-tertiary", b = !!c;
|
|
7
|
+
return /* @__PURE__ */ r("div", {
|
|
8
|
+
className: v,
|
|
9
|
+
children: [
|
|
10
|
+
/* @__PURE__ */ n("input", {
|
|
11
|
+
type: "date",
|
|
12
|
+
value: i,
|
|
13
|
+
onChange: (e) => a(e.target.value),
|
|
14
|
+
min: "1900-01-01",
|
|
15
|
+
max: "9999-12-31",
|
|
16
|
+
"aria-label": s ?? c,
|
|
17
|
+
className: `search-box-date-input flex-1 bg-transparent ${h} outline-none ${y}`
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ n(t, {
|
|
20
|
+
value: i || null,
|
|
21
|
+
onApply: (e) => a(e),
|
|
22
|
+
disableMobileSheet: u,
|
|
23
|
+
children: /* @__PURE__ */ n("button", {
|
|
24
|
+
type: "button",
|
|
25
|
+
"aria-label": "달력에서 날짜 선택",
|
|
26
|
+
className: `flex ${g} items-center justify-center rounded text-neutral-400 transition-colors hover:bg-neutral-100 hover:text-neutral-600 dark:hover:bg-neutral-800 dark:hover:text-neutral-200`,
|
|
27
|
+
children: /* @__PURE__ */ n(e, { className: _ })
|
|
28
|
+
})
|
|
29
|
+
}),
|
|
30
|
+
b && /* @__PURE__ */ n("span", {
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
className: `pointer-events-none absolute -top-2 left-2 bg-bg-white px-1 text-text-secondary group-focus-within:text-primary-500 ${d ? "text-[10px]" : "text-xs"}`,
|
|
33
|
+
children: c
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { i as DateInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../node_modules/lucide-react/dist/esm/icons/chevron-down.cjs.js"),t=require("../../node_modules/lucide-react/dist/esm/icons/chevron-left.cjs.js"),n=require("../../node_modules/lucide-react/dist/esm/icons/chevron-right.cjs.js"),r=require("../animated-height/AnimatedHeight.cjs.js"),i=require("../../lib/utils.cjs.js"),a=require("../../hooks/useMediaQuery.cjs.js"),o=require("../../hooks/useBottomSheetDrag.cjs.js"),s=require("../../hooks/useScrollLock.cjs.js");let c=require("react"),l=require("react/jsx-runtime"),u=require("motion/react"),d=require("@floating-ui/react"),f=require("date-fns"),p=require("date-fns/locale");var m=24;function h({children:e,value:t,onApply:n,disabled:r,disableMobileSheet:i=!1}){let[f,p]=(0,c.useState)(!1),m=a.useIsMobile()&&!i,{refs:h,floatingStyles:_,context:v}=(0,d.useFloating)({open:f,onOpenChange:e=>{r||p(e)},placement:`bottom-start`,whileElementsMounted:d.autoUpdate,middleware:[(0,d.offset)(8),(0,d.flip)({fallbackAxisSideDirection:`start`}),(0,d.shift)({padding:8})]}),{getReferenceProps:y,getFloatingProps:b}=(0,d.useInteractions)([(0,d.useClick)(v,{enabled:!r}),(0,d.useDismiss)(v),(0,d.useRole)(v,{role:`dialog`})]);s.useScrollLock(f&&m);let x=e=>{n(e),p(!1)},{dragControls:S,handleDragEnd:C,startDrag:w}=o.useBottomSheetDrag({onDismiss:()=>p(!1)});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`span`,{ref:h.setReference,...y(),className:`inline-flex`,children:e}),(0,l.jsx)(d.FloatingPortal,{children:m?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(u.AnimatePresence,{children:f&&(0,l.jsx)(u.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:`fixed inset-0 z-50 bg-black/40`,onClick:()=>p(!1)},`date-picker-dimmer`)}),(0,l.jsx)(u.AnimatePresence,{children:f&&(0,l.jsxs)(u.motion.div,{ref:h.setFloating,...b(),initial:{y:`100%`},animate:{y:0},exit:{y:`100%`,transition:{duration:.2,ease:[.4,0,1,1]}},transition:{type:`spring`,damping:30,stiffness:320},drag:`y`,dragListener:!1,dragControls:S,dragConstraints:{top:0},dragElastic:{top:0,bottom:.4},onDragEnd:C,className:`fixed inset-x-0 bottom-0 z-50 flex flex-col gap-5 rounded-t-2xl bg-bg-card p-5 pb-[max(20px,env(safe-area-inset-bottom))] shadow-2xl`,children:[(0,l.jsx)(`div`,{className:`self-center h-1 w-10 rounded-full bg-bg-base-tertiary cursor-grab touch-none active:cursor-grabbing`,onPointerDown:w}),(0,l.jsx)(g,{initialValue:t,onApply:x,onClose:()=>p(!1)})]},`date-picker-sheet`)})]}):f&&(0,l.jsx)(`div`,{ref:h.setFloating,style:_,...b(),className:`z-9999 w-80 rounded-2xl border border-border-tertiary bg-bg-card p-6 shadow-md`,children:(0,l.jsx)(g,{initialValue:t,onApply:x,onClose:()=>p(!1)})})})]})}function g({initialValue:e,onApply:t,onClose:n}){let r=y(e),[i,a]=(0,c.useState)(r),[o,s]=(0,c.useState)(r??new Date);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(_,{month:o,onMonthChange:s,onPrev:()=>s((0,f.subMonths)(o,1)),onNext:()=>s((0,f.addMonths)(o,1)),selected:i,onDayClick:e=>a(e)}),(0,l.jsxs)(`div`,{className:`mt-6 flex items-center justify-end gap-2`,children:[(0,l.jsx)(`button`,{type:`button`,onClick:n,className:`cursor-pointer rounded-full bg-bg-base-primary px-5 py-2 text-sm font-semibold text-text-secondary transition-colors hover:bg-bg-base-secondary`,children:`닫기`}),(0,l.jsx)(`button`,{type:`button`,onClick:()=>{if(!i){n();return}t((0,f.format)(i,`yyyy-MM-dd`))},className:`cursor-pointer rounded-full bg-primary-500 px-5 py-2 text-sm font-semibold text-white transition-opacity hover:opacity-90`,children:`적용`})]})]})}function _({month:t,onMonthChange:n,onPrev:a,onNext:o,selected:s,onDayClick:u}){let[d,h]=(0,c.useState)(!1),g=(0,c.useMemo)(()=>(0,f.eachDayOfInterval)({start:(0,f.startOfWeek)((0,f.startOfMonth)(t),{weekStartsOn:0}),end:(0,f.endOfWeek)((0,f.endOfMonth)(t),{weekStartsOn:0})}),[t]),_=(0,c.useMemo)(()=>{let e=[];for(let t=-24;t<=m;t++)e.push((0,f.addMonths)((0,f.startOfMonth)(new Date),t));return e},[]);return(0,l.jsxs)(`div`,{className:`mx-auto flex w-full max-w-75 flex-col sm:w-65`,children:[(0,l.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,l.jsx)(v,{direction:`left`,onClick:a}),(0,l.jsxs)(`div`,{className:`relative flex flex-1 justify-center`,children:[(0,l.jsxs)(`button`,{type:`button`,onClick:()=>h(e=>!e),className:`flex cursor-pointer items-center gap-1 rounded px-3 py-1.5 text-sm font-semibold text-text-primary transition-colors hover:bg-bg-base-primary`,children:[(0,f.format)(t,`yyyy. MM.`),(0,l.jsx)(e.ChevronDown,{className:`h-3.5 w-3.5 text-text-tertiary`})]}),d&&(0,l.jsx)(`div`,{className:`scrollbar-brand absolute top-full z-20 mt-1 max-h-60 w-35 overflow-y-auto rounded-lg border border-border-tertiary bg-bg-card py-1 shadow-lg`,children:_.map(e=>(0,l.jsx)(`button`,{type:`button`,onClick:()=>{n(e),h(!1)},className:i.cn(`w-full cursor-pointer bg-bg-card px-4 py-2 text-left text-sm transition-colors`,(0,f.isSameMonth)(e,t)?`bg-bg-base-secondary font-semibold text-text-primary`:`text-text-secondary hover:bg-bg-base-primary`),children:(0,f.format)(e,`yyyy. MM.`)},e.toISOString()))})]}),(0,l.jsx)(v,{direction:`right`,onClick:o})]}),(0,l.jsx)(`div`,{className:`mb-2 grid grid-cols-7`,children:[`일`,`월`,`화`,`수`,`목`,`금`,`토`].map(e=>(0,l.jsx)(`div`,{className:`py-1 text-center text-xs font-medium text-text-tertiary`,children:e},e))}),(0,l.jsx)(r.AnimatedHeight,{children:(0,l.jsx)(`div`,{className:`grid grid-cols-7 gap-y-1`,children:g.map(e=>{let r=(0,f.isSameMonth)(e,t),a=!!(s&&(0,f.isSameDay)(e,s));return(0,l.jsxs)(`button`,{type:`button`,onClick:()=>{r||n(e),u(e)},className:`group relative flex h-9 cursor-pointer items-center justify-center text-sm`,"aria-label":(0,f.format)(e,`yyyy년 M월 d일`,{locale:p.ko}),children:[a&&(0,l.jsx)(`span`,{className:`absolute left-1/2 top-1/2 h-9 w-9 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-500`,"aria-hidden":!0}),(0,l.jsx)(`span`,{className:i.cn(`relative z-10`,!r&&`text-text-disabled`,r&&!a&&`text-text-primary`,a&&`font-bold text-white`),children:(0,f.format)(e,`d`)})]},e.toISOString())})})})]})}function v({direction:e,onClick:r}){return(0,l.jsx)(`button`,{type:`button`,onClick:r,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border-tertiary text-text-secondary transition-colors hover:bg-bg-base-primary`,"aria-label":e===`left`?`이전 달`:`다음 달`,children:(0,l.jsx)(e===`left`?t.ChevronLeft:n.ChevronRight,{className:`h-4 w-4`})})}function y(e){if(!e)return null;let t=(0,f.parseISO)(e);return(0,f.isValid)(t)?t:null}exports.DatePicker=h,exports.DatePickerBody=g;
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { ChevronDown as e } from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.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 { AnimatedHeight as r } from "../animated-height/AnimatedHeight.esm.js";
|
|
5
|
+
import { cn as i } from "../../lib/utils.esm.js";
|
|
6
|
+
import { useIsMobile as a } from "../../hooks/useMediaQuery.esm.js";
|
|
7
|
+
import { useBottomSheetDrag as o } from "../../hooks/useBottomSheetDrag.esm.js";
|
|
8
|
+
import { useScrollLock as s } from "../../hooks/useScrollLock.esm.js";
|
|
9
|
+
import { useMemo as c, useState as l } from "react";
|
|
10
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
11
|
+
import { AnimatePresence as p, motion as m } from "motion/react";
|
|
12
|
+
import { FloatingPortal as h, autoUpdate as g, flip as _, offset as v, shift as y, useClick as b, useDismiss as x, useFloating as S, useInteractions as C, useRole as w } from "@floating-ui/react";
|
|
13
|
+
import { addMonths as T, eachDayOfInterval as E, endOfMonth as D, endOfWeek as O, format as k, isSameDay as A, isSameMonth as j, isValid as M, parseISO as N, startOfMonth as P, startOfWeek as F, subMonths as I } from "date-fns";
|
|
14
|
+
import { ko as L } from "date-fns/locale";
|
|
15
|
+
//#region src/components/date-picker/date-picker.tsx
|
|
16
|
+
var R = 24;
|
|
17
|
+
function z({ children: e, value: t, onApply: n, disabled: r, disableMobileSheet: i = !1 }) {
|
|
18
|
+
let [c, T] = l(!1), E = a() && !i, { refs: D, floatingStyles: O, context: k } = S({
|
|
19
|
+
open: c,
|
|
20
|
+
onOpenChange: (e) => {
|
|
21
|
+
r || T(e);
|
|
22
|
+
},
|
|
23
|
+
placement: "bottom-start",
|
|
24
|
+
whileElementsMounted: g,
|
|
25
|
+
middleware: [
|
|
26
|
+
v(8),
|
|
27
|
+
_({ fallbackAxisSideDirection: "start" }),
|
|
28
|
+
y({ padding: 8 })
|
|
29
|
+
]
|
|
30
|
+
}), { getReferenceProps: A, getFloatingProps: j } = C([
|
|
31
|
+
b(k, { enabled: !r }),
|
|
32
|
+
x(k),
|
|
33
|
+
w(k, { role: "dialog" })
|
|
34
|
+
]);
|
|
35
|
+
s(c && E);
|
|
36
|
+
let M = (e) => {
|
|
37
|
+
n(e), T(!1);
|
|
38
|
+
}, { dragControls: N, handleDragEnd: P, startDrag: F } = o({ onDismiss: () => T(!1) });
|
|
39
|
+
return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("span", {
|
|
40
|
+
ref: D.setReference,
|
|
41
|
+
...A(),
|
|
42
|
+
className: "inline-flex",
|
|
43
|
+
children: e
|
|
44
|
+
}), /* @__PURE__ */ d(h, { children: E ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(p, { children: c && /* @__PURE__ */ d(m.div, {
|
|
45
|
+
initial: { opacity: 0 },
|
|
46
|
+
animate: { opacity: 1 },
|
|
47
|
+
exit: { opacity: 0 },
|
|
48
|
+
transition: { duration: .2 },
|
|
49
|
+
className: "fixed inset-0 z-50 bg-black/40",
|
|
50
|
+
onClick: () => T(!1)
|
|
51
|
+
}, "date-picker-dimmer") }), /* @__PURE__ */ d(p, { children: c && /* @__PURE__ */ f(m.div, {
|
|
52
|
+
ref: D.setFloating,
|
|
53
|
+
...j(),
|
|
54
|
+
initial: { y: "100%" },
|
|
55
|
+
animate: { y: 0 },
|
|
56
|
+
exit: {
|
|
57
|
+
y: "100%",
|
|
58
|
+
transition: {
|
|
59
|
+
duration: .2,
|
|
60
|
+
ease: [
|
|
61
|
+
.4,
|
|
62
|
+
0,
|
|
63
|
+
1,
|
|
64
|
+
1
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
transition: {
|
|
69
|
+
type: "spring",
|
|
70
|
+
damping: 30,
|
|
71
|
+
stiffness: 320
|
|
72
|
+
},
|
|
73
|
+
drag: "y",
|
|
74
|
+
dragListener: !1,
|
|
75
|
+
dragControls: N,
|
|
76
|
+
dragConstraints: { top: 0 },
|
|
77
|
+
dragElastic: {
|
|
78
|
+
top: 0,
|
|
79
|
+
bottom: .4
|
|
80
|
+
},
|
|
81
|
+
onDragEnd: P,
|
|
82
|
+
className: "fixed inset-x-0 bottom-0 z-50 flex flex-col gap-5 rounded-t-2xl bg-bg-card p-5 pb-[max(20px,env(safe-area-inset-bottom))] shadow-2xl",
|
|
83
|
+
children: [/* @__PURE__ */ d("div", {
|
|
84
|
+
className: "self-center h-1 w-10 rounded-full bg-bg-base-tertiary cursor-grab touch-none active:cursor-grabbing",
|
|
85
|
+
onPointerDown: F
|
|
86
|
+
}), /* @__PURE__ */ d(B, {
|
|
87
|
+
initialValue: t,
|
|
88
|
+
onApply: M,
|
|
89
|
+
onClose: () => T(!1)
|
|
90
|
+
})]
|
|
91
|
+
}, "date-picker-sheet") })] }) : c && /* @__PURE__ */ d("div", {
|
|
92
|
+
ref: D.setFloating,
|
|
93
|
+
style: O,
|
|
94
|
+
...j(),
|
|
95
|
+
className: "z-9999 w-80 rounded-2xl border border-border-tertiary bg-bg-card p-6 shadow-md",
|
|
96
|
+
children: /* @__PURE__ */ d(B, {
|
|
97
|
+
initialValue: t,
|
|
98
|
+
onApply: M,
|
|
99
|
+
onClose: () => T(!1)
|
|
100
|
+
})
|
|
101
|
+
}) })] });
|
|
102
|
+
}
|
|
103
|
+
function B({ initialValue: e, onApply: t, onClose: n }) {
|
|
104
|
+
let r = U(e), [i, a] = l(r), [o, s] = l(r ?? /* @__PURE__ */ new Date());
|
|
105
|
+
return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(V, {
|
|
106
|
+
month: o,
|
|
107
|
+
onMonthChange: s,
|
|
108
|
+
onPrev: () => s(I(o, 1)),
|
|
109
|
+
onNext: () => s(T(o, 1)),
|
|
110
|
+
selected: i,
|
|
111
|
+
onDayClick: (e) => a(e)
|
|
112
|
+
}), /* @__PURE__ */ f("div", {
|
|
113
|
+
className: "mt-6 flex items-center justify-end gap-2",
|
|
114
|
+
children: [/* @__PURE__ */ d("button", {
|
|
115
|
+
type: "button",
|
|
116
|
+
onClick: n,
|
|
117
|
+
className: "cursor-pointer rounded-full bg-bg-base-primary px-5 py-2 text-sm font-semibold text-text-secondary transition-colors hover:bg-bg-base-secondary",
|
|
118
|
+
children: "닫기"
|
|
119
|
+
}), /* @__PURE__ */ d("button", {
|
|
120
|
+
type: "button",
|
|
121
|
+
onClick: () => {
|
|
122
|
+
if (!i) {
|
|
123
|
+
n();
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
t(k(i, "yyyy-MM-dd"));
|
|
127
|
+
},
|
|
128
|
+
className: "cursor-pointer rounded-full bg-primary-500 px-5 py-2 text-sm font-semibold text-white transition-opacity hover:opacity-90",
|
|
129
|
+
children: "적용"
|
|
130
|
+
})]
|
|
131
|
+
})] });
|
|
132
|
+
}
|
|
133
|
+
function V({ month: t, onMonthChange: n, onPrev: a, onNext: o, selected: s, onDayClick: u }) {
|
|
134
|
+
let [p, m] = l(!1), h = c(() => E({
|
|
135
|
+
start: F(P(t), { weekStartsOn: 0 }),
|
|
136
|
+
end: O(D(t), { weekStartsOn: 0 })
|
|
137
|
+
}), [t]), g = c(() => {
|
|
138
|
+
let e = [];
|
|
139
|
+
for (let t = -24; t <= R; t++) e.push(T(P(/* @__PURE__ */ new Date()), t));
|
|
140
|
+
return e;
|
|
141
|
+
}, []);
|
|
142
|
+
return /* @__PURE__ */ f("div", {
|
|
143
|
+
className: "mx-auto flex w-full max-w-75 flex-col sm:w-65",
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ f("div", {
|
|
146
|
+
className: "mb-4 flex items-center justify-between",
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ d(H, {
|
|
149
|
+
direction: "left",
|
|
150
|
+
onClick: a
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ f("div", {
|
|
153
|
+
className: "relative flex flex-1 justify-center",
|
|
154
|
+
children: [/* @__PURE__ */ f("button", {
|
|
155
|
+
type: "button",
|
|
156
|
+
onClick: () => m((e) => !e),
|
|
157
|
+
className: "flex cursor-pointer items-center gap-1 rounded px-3 py-1.5 text-sm font-semibold text-text-primary transition-colors hover:bg-bg-base-primary",
|
|
158
|
+
children: [k(t, "yyyy. MM."), /* @__PURE__ */ d(e, { className: "h-3.5 w-3.5 text-text-tertiary" })]
|
|
159
|
+
}), p && /* @__PURE__ */ d("div", {
|
|
160
|
+
className: "scrollbar-brand absolute top-full z-20 mt-1 max-h-60 w-35 overflow-y-auto rounded-lg border border-border-tertiary bg-bg-card py-1 shadow-lg",
|
|
161
|
+
children: g.map((e) => /* @__PURE__ */ d("button", {
|
|
162
|
+
type: "button",
|
|
163
|
+
onClick: () => {
|
|
164
|
+
n(e), m(!1);
|
|
165
|
+
},
|
|
166
|
+
className: i("w-full cursor-pointer bg-bg-card px-4 py-2 text-left text-sm transition-colors", j(e, t) ? "bg-bg-base-secondary font-semibold text-text-primary" : "text-text-secondary hover:bg-bg-base-primary"),
|
|
167
|
+
children: k(e, "yyyy. MM.")
|
|
168
|
+
}, e.toISOString()))
|
|
169
|
+
})]
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ d(H, {
|
|
172
|
+
direction: "right",
|
|
173
|
+
onClick: o
|
|
174
|
+
})
|
|
175
|
+
]
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ d("div", {
|
|
178
|
+
className: "mb-2 grid grid-cols-7",
|
|
179
|
+
children: [
|
|
180
|
+
"일",
|
|
181
|
+
"월",
|
|
182
|
+
"화",
|
|
183
|
+
"수",
|
|
184
|
+
"목",
|
|
185
|
+
"금",
|
|
186
|
+
"토"
|
|
187
|
+
].map((e) => /* @__PURE__ */ d("div", {
|
|
188
|
+
className: "py-1 text-center text-xs font-medium text-text-tertiary",
|
|
189
|
+
children: e
|
|
190
|
+
}, e))
|
|
191
|
+
}),
|
|
192
|
+
/* @__PURE__ */ d(r, { children: /* @__PURE__ */ d("div", {
|
|
193
|
+
className: "grid grid-cols-7 gap-y-1",
|
|
194
|
+
children: h.map((e) => {
|
|
195
|
+
let r = j(e, t), a = !!(s && A(e, s));
|
|
196
|
+
return /* @__PURE__ */ f("button", {
|
|
197
|
+
type: "button",
|
|
198
|
+
onClick: () => {
|
|
199
|
+
r || n(e), u(e);
|
|
200
|
+
},
|
|
201
|
+
className: "group relative flex h-9 cursor-pointer items-center justify-center text-sm",
|
|
202
|
+
"aria-label": k(e, "yyyy년 M월 d일", { locale: L }),
|
|
203
|
+
children: [a && /* @__PURE__ */ d("span", {
|
|
204
|
+
className: "absolute left-1/2 top-1/2 h-9 w-9 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-500",
|
|
205
|
+
"aria-hidden": !0
|
|
206
|
+
}), /* @__PURE__ */ d("span", {
|
|
207
|
+
className: i("relative z-10", !r && "text-text-disabled", r && !a && "text-text-primary", a && "font-bold text-white"),
|
|
208
|
+
children: k(e, "d")
|
|
209
|
+
})]
|
|
210
|
+
}, e.toISOString());
|
|
211
|
+
})
|
|
212
|
+
}) })
|
|
213
|
+
]
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function H({ direction: e, onClick: r }) {
|
|
217
|
+
return /* @__PURE__ */ d("button", {
|
|
218
|
+
type: "button",
|
|
219
|
+
onClick: r,
|
|
220
|
+
className: "flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border-tertiary text-text-secondary transition-colors hover:bg-bg-base-primary",
|
|
221
|
+
"aria-label": e === "left" ? "이전 달" : "다음 달",
|
|
222
|
+
children: /* @__PURE__ */ d(e === "left" ? t : n, { className: "h-4 w-4" })
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
function U(e) {
|
|
226
|
+
if (!e) return null;
|
|
227
|
+
let t = N(e);
|
|
228
|
+
return M(t) ? t : null;
|
|
229
|
+
}
|
|
230
|
+
//#endregion
|
|
231
|
+
export { z as DatePicker, B as DatePickerBody };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../node_modules/lucide-react/dist/esm/icons/chevron-down.cjs.js"),t=require("../../node_modules/lucide-react/dist/esm/icons/chevron-left.cjs.js"),n=require("../../node_modules/lucide-react/dist/esm/icons/chevron-right.cjs.js"),r=require("../../lib/utils.cjs.js"),i=require("../../hooks/useMediaQuery.cjs.js"),a=require("../../hooks/useBottomSheetDrag.cjs.js"),o=require("../../hooks/useScrollLock.cjs.js");let s=require("react"),c=require("react/jsx-runtime"),l=require("motion/react"),u=require("@floating-ui/react"),d=require("date-fns"),f=require("date-fns/locale");var p=24;function m({children:e,value:t,onApply:n,disabled:r}){let[d,f]=(0,s.useState)(!1),p=i.useIsMobile(),{refs:m,floatingStyles:g,context:_}=(0,u.useFloating)({open:d,onOpenChange:e=>{r||f(e)},placement:`bottom-start`,whileElementsMounted:u.autoUpdate,middleware:[(0,u.offset)(8),(0,u.flip)({fallbackAxisSideDirection:`start`}),(0,u.shift)({padding:8})]}),{getReferenceProps:v,getFloatingProps:y}=(0,u.useInteractions)([(0,u.useClick)(_,{enabled:!r}),(0,u.useDismiss)(_),(0,u.useRole)(_,{role:`dialog`})]);o.useScrollLock(d&&p);let{dragControls:b,handleDragEnd:x,startDrag:S}=a.useBottomSheetDrag({onDismiss:()=>f(!1)}),C=e=>{n(e),f(!1)};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`span`,{ref:m.setReference,...v(),className:`inline-flex`,children:e}),(0,c.jsx)(u.FloatingPortal,{children:p?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.AnimatePresence,{children:d&&(0,c.jsx)(l.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:`fixed inset-0 z-50 bg-black/40`,onClick:()=>f(!1)},`date-range-picker-dimmer`)}),(0,c.jsx)(l.AnimatePresence,{children:d&&(0,c.jsxs)(l.motion.div,{ref:m.setFloating,...y(),initial:{y:`100%`},animate:{y:0},exit:{y:`100%`,transition:{duration:.2,ease:[.4,0,1,1]}},transition:{type:`spring`,damping:30,stiffness:320},drag:`y`,dragListener:!1,dragControls:b,dragConstraints:{top:0},dragElastic:{top:0,bottom:.4},onDragEnd:x,className:`fixed inset-x-0 bottom-0 z-50 flex flex-col gap-5 rounded-t-2xl bg-bg-card p-5 pb-[max(20px,env(safe-area-inset-bottom))] shadow-2xl`,children:[(0,c.jsx)(`div`,{className:`self-center h-1 w-10 rounded-full bg-bg-base-tertiary cursor-grab touch-none active:cursor-grabbing`,onPointerDown:S}),(0,c.jsx)(h,{value:t,isMobile:!0,onApply:C,onClose:()=>f(!1)})]},`date-range-picker-sheet`)})]}):d&&(0,c.jsx)(`div`,{ref:m.setFloating,style:g,...y(),className:`z-9999 rounded-2xl border border-border-tertiary bg-bg-card p-6 shadow-md`,children:(0,c.jsx)(h,{value:t,isMobile:!1,onApply:C,onClose:()=>f(!1)})})})]})}function h({value:e,isMobile:t,onApply:n,onClose:r}){let i=v(e?.from),a=v(e?.to),[o,l]=(0,s.useState)(i),[u,f]=(0,s.useState)(a),[p,m]=(0,s.useState)(i??new Date),h=(0,d.addMonths)(p,1),_=e=>{if(!o||o&&u){l(e),f(null);return}if((0,d.isBefore)(e,o)){l(e),f(null);return}f(e)},y=(0,c.jsxs)(`div`,{className:`mt-6 flex items-center justify-end gap-2`,children:[(0,c.jsx)(`button`,{type:`button`,onClick:r,className:`cursor-pointer rounded-full bg-bg-base-primary px-5 py-2 text-sm font-semibold text-text-secondary transition-colors hover:bg-bg-base-secondary`,children:`닫기`}),(0,c.jsx)(`button`,{type:`button`,onClick:()=>{if(!o){r();return}n({from:(0,d.format)(o,`yyyy-MM-dd`),to:(0,d.format)(u??o,`yyyy-MM-dd`)})},className:`cursor-pointer rounded-full bg-primary-500 px-5 py-2 text-sm font-semibold text-white transition-opacity hover:opacity-90`,children:`적용`})]});return t?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`div`,{className:`flex justify-center`,children:(0,c.jsx)(g,{month:p,onMonthChange:m,onPrev:()=>m((0,d.subMonths)(p,1)),onNext:()=>m((0,d.addMonths)(p,1)),showPrev:!0,showNext:!0,rangeFrom:o,rangeTo:u,onDayClick:_})}),y]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(`div`,{className:`flex items-stretch gap-8`,children:[(0,c.jsx)(g,{month:p,onMonthChange:m,onPrev:()=>m((0,d.subMonths)(p,1)),showPrev:!0,rangeFrom:o,rangeTo:u,onDayClick:_}),(0,c.jsx)(`div`,{className:`w-px bg-border-tertiary`}),(0,c.jsx)(g,{month:h,onMonthChange:e=>m((0,d.subMonths)(e,1)),onNext:()=>m((0,d.addMonths)(p,1)),showNext:!0,rangeFrom:o,rangeTo:u,onDayClick:_})]}),y]})}function g({month:t,onMonthChange:n,onPrev:i,onNext:a,showPrev:o,showNext:l,rangeFrom:u,rangeTo:m,onDayClick:h}){let[g,v]=(0,s.useState)(!1),y=(0,s.useMemo)(()=>(0,d.eachDayOfInterval)({start:(0,d.startOfWeek)((0,d.startOfMonth)(t),{weekStartsOn:0}),end:(0,d.endOfWeek)((0,d.endOfMonth)(t),{weekStartsOn:0})}),[t]),b=(0,s.useMemo)(()=>{let e=[];for(let t=-24;t<=p;t++)e.push((0,d.addMonths)((0,d.startOfMonth)(new Date),t));return e},[]);return(0,c.jsxs)(`div`,{className:`flex w-full max-w-[300px] flex-col sm:w-[260px]`,children:[(0,c.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,c.jsx)(_,{direction:`left`,onClick:i,visible:!!o}),(0,c.jsxs)(`div`,{className:`relative flex flex-1 justify-center`,children:[(0,c.jsxs)(`button`,{type:`button`,onClick:()=>v(e=>!e),className:`flex cursor-pointer items-center gap-1 rounded px-3 py-1.5 text-sm font-semibold text-text-primary transition-colors hover:bg-bg-base-primary`,children:[(0,d.format)(t,`yyyy. MM.`),(0,c.jsx)(e.ChevronDown,{className:`h-3.5 w-3.5 text-text-tertiary`})]}),g&&(0,c.jsx)(`div`,{className:`scrollbar-brand absolute top-full z-20 mt-1 max-h-[240px] w-[140px] overflow-y-auto rounded-lg border border-border-tertiary bg-bg-card py-1 shadow-lg`,children:b.map(e=>(0,c.jsx)(`button`,{type:`button`,onClick:()=>{n(e),v(!1)},className:r.cn(`w-full cursor-pointer bg-bg-card px-4 py-2 text-left text-sm transition-colors`,(0,d.isSameMonth)(e,t)?`bg-bg-base-secondary font-semibold text-text-primary`:`text-text-secondary hover:bg-bg-base-primary`),children:(0,d.format)(e,`yyyy. MM.`)},e.toISOString()))})]}),(0,c.jsx)(_,{direction:`right`,onClick:a,visible:!!l})]}),(0,c.jsx)(`div`,{className:`mb-2 grid grid-cols-7`,children:[`일`,`월`,`화`,`수`,`목`,`금`,`토`].map(e=>(0,c.jsx)(`div`,{className:`py-1 text-center text-xs font-medium text-text-tertiary`,children:e},e))}),(0,c.jsx)(`div`,{className:`grid grid-cols-7 gap-y-1`,children:y.map(e=>{let i=(0,d.isSameMonth)(e,t),a=!!(u&&(0,d.isSameDay)(e,u)),o=!!(m&&(0,d.isSameDay)(e,m)),s=!!u&&!!m&&(0,d.isAfter)(e,u)&&(0,d.isBefore)(e,m),l=a||o,p=s||o&&!!u,g=s||a&&!!m;return(0,c.jsxs)(`button`,{type:`button`,onClick:()=>{i||n(e),h(e)},className:`group relative flex h-9 cursor-pointer items-center justify-center text-sm`,"aria-label":(0,d.format)(e,`yyyy년 M월 d일`,{locale:f.ko}),children:[p&&(0,c.jsx)(`span`,{className:`absolute inset-y-0 left-0 right-1/2 bg-bg-base-secondary`,"aria-hidden":!0}),g&&(0,c.jsx)(`span`,{className:`absolute inset-y-0 left-1/2 right-0 bg-bg-base-secondary`,"aria-hidden":!0}),l&&(0,c.jsx)(`span`,{className:`absolute left-1/2 top-1/2 h-9 w-9 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-500`,"aria-hidden":!0}),(0,c.jsx)(`span`,{className:r.cn(`relative z-10`,!i&&`text-text-disabled`,i&&!l&&`text-text-primary`,l&&`font-bold text-white`),children:(0,d.format)(e,`d`)})]},e.toISOString())})})]})}function _({direction:e,onClick:r,visible:i}){let a=e===`left`?t.ChevronLeft:n.ChevronRight;return i?(0,c.jsx)(`button`,{type:`button`,onClick:r,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border-tertiary text-text-secondary transition-colors hover:bg-bg-base-primary`,"aria-label":e===`left`?`이전 달`:`다음 달`,children:(0,c.jsx)(a,{className:`h-4 w-4`})}):(0,c.jsx)(`div`,{className:`w-8`})}function v(e){if(!e)return null;let t=(0,d.parseISO)(e);return(0,d.isValid)(t)?t:null}exports.DateRangePicker=m;
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { ChevronDown as e } from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.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 { cn as r } from "../../lib/utils.esm.js";
|
|
5
|
+
import { useIsMobile as i } from "../../hooks/useMediaQuery.esm.js";
|
|
6
|
+
import { useBottomSheetDrag as a } from "../../hooks/useBottomSheetDrag.esm.js";
|
|
7
|
+
import { useScrollLock as o } from "../../hooks/useScrollLock.esm.js";
|
|
8
|
+
import { useMemo as s, useState as c } from "react";
|
|
9
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
10
|
+
import { AnimatePresence as f, motion as p } from "motion/react";
|
|
11
|
+
import { FloatingPortal as m, autoUpdate as h, flip as g, offset as _, shift as v, useClick as y, useDismiss as b, useFloating as x, useInteractions as S, useRole as C } from "@floating-ui/react";
|
|
12
|
+
import { addMonths as w, eachDayOfInterval as T, endOfMonth as E, endOfWeek as D, format as O, isAfter as k, isBefore as A, isSameDay as j, isSameMonth as M, isValid as N, parseISO as P, startOfMonth as F, startOfWeek as I, subMonths as L } from "date-fns";
|
|
13
|
+
import { ko as R } from "date-fns/locale";
|
|
14
|
+
//#region src/components/date-picker/date-range-picker.tsx
|
|
15
|
+
var z = 24;
|
|
16
|
+
function B({ children: e, value: t, onApply: n, disabled: r }) {
|
|
17
|
+
let [s, w] = c(!1), T = i(), { refs: E, floatingStyles: D, context: O } = x({
|
|
18
|
+
open: s,
|
|
19
|
+
onOpenChange: (e) => {
|
|
20
|
+
r || w(e);
|
|
21
|
+
},
|
|
22
|
+
placement: "bottom-start",
|
|
23
|
+
whileElementsMounted: h,
|
|
24
|
+
middleware: [
|
|
25
|
+
_(8),
|
|
26
|
+
g({ fallbackAxisSideDirection: "start" }),
|
|
27
|
+
v({ padding: 8 })
|
|
28
|
+
]
|
|
29
|
+
}), { getReferenceProps: k, getFloatingProps: A } = S([
|
|
30
|
+
y(O, { enabled: !r }),
|
|
31
|
+
b(O),
|
|
32
|
+
C(O, { role: "dialog" })
|
|
33
|
+
]);
|
|
34
|
+
o(s && T);
|
|
35
|
+
let { dragControls: j, handleDragEnd: M, startDrag: N } = a({ onDismiss: () => w(!1) }), P = (e) => {
|
|
36
|
+
n(e), w(!1);
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("span", {
|
|
39
|
+
ref: E.setReference,
|
|
40
|
+
...k(),
|
|
41
|
+
className: "inline-flex",
|
|
42
|
+
children: e
|
|
43
|
+
}), /* @__PURE__ */ u(m, { children: T ? /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(f, { children: s && /* @__PURE__ */ u(p.div, {
|
|
44
|
+
initial: { opacity: 0 },
|
|
45
|
+
animate: { opacity: 1 },
|
|
46
|
+
exit: { opacity: 0 },
|
|
47
|
+
transition: { duration: .2 },
|
|
48
|
+
className: "fixed inset-0 z-50 bg-black/40",
|
|
49
|
+
onClick: () => w(!1)
|
|
50
|
+
}, "date-range-picker-dimmer") }), /* @__PURE__ */ u(f, { children: s && /* @__PURE__ */ d(p.div, {
|
|
51
|
+
ref: E.setFloating,
|
|
52
|
+
...A(),
|
|
53
|
+
initial: { y: "100%" },
|
|
54
|
+
animate: { y: 0 },
|
|
55
|
+
exit: {
|
|
56
|
+
y: "100%",
|
|
57
|
+
transition: {
|
|
58
|
+
duration: .2,
|
|
59
|
+
ease: [
|
|
60
|
+
.4,
|
|
61
|
+
0,
|
|
62
|
+
1,
|
|
63
|
+
1
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
transition: {
|
|
68
|
+
type: "spring",
|
|
69
|
+
damping: 30,
|
|
70
|
+
stiffness: 320
|
|
71
|
+
},
|
|
72
|
+
drag: "y",
|
|
73
|
+
dragListener: !1,
|
|
74
|
+
dragControls: j,
|
|
75
|
+
dragConstraints: { top: 0 },
|
|
76
|
+
dragElastic: {
|
|
77
|
+
top: 0,
|
|
78
|
+
bottom: .4
|
|
79
|
+
},
|
|
80
|
+
onDragEnd: M,
|
|
81
|
+
className: "fixed inset-x-0 bottom-0 z-50 flex flex-col gap-5 rounded-t-2xl bg-bg-card p-5 pb-[max(20px,env(safe-area-inset-bottom))] shadow-2xl",
|
|
82
|
+
children: [/* @__PURE__ */ u("div", {
|
|
83
|
+
className: "self-center h-1 w-10 rounded-full bg-bg-base-tertiary cursor-grab touch-none active:cursor-grabbing",
|
|
84
|
+
onPointerDown: N
|
|
85
|
+
}), /* @__PURE__ */ u(V, {
|
|
86
|
+
value: t,
|
|
87
|
+
isMobile: !0,
|
|
88
|
+
onApply: P,
|
|
89
|
+
onClose: () => w(!1)
|
|
90
|
+
})]
|
|
91
|
+
}, "date-range-picker-sheet") })] }) : s && /* @__PURE__ */ u("div", {
|
|
92
|
+
ref: E.setFloating,
|
|
93
|
+
style: D,
|
|
94
|
+
...A(),
|
|
95
|
+
className: "z-9999 rounded-2xl border border-border-tertiary bg-bg-card p-6 shadow-md",
|
|
96
|
+
children: /* @__PURE__ */ u(V, {
|
|
97
|
+
value: t,
|
|
98
|
+
isMobile: !1,
|
|
99
|
+
onApply: P,
|
|
100
|
+
onClose: () => w(!1)
|
|
101
|
+
})
|
|
102
|
+
}) })] });
|
|
103
|
+
}
|
|
104
|
+
function V({ value: e, isMobile: t, onApply: n, onClose: r }) {
|
|
105
|
+
let i = W(e?.from), a = W(e?.to), [o, s] = c(i), [f, p] = c(a), [m, h] = c(i ?? /* @__PURE__ */ new Date()), g = w(m, 1), _ = (e) => {
|
|
106
|
+
if (!o || o && f) {
|
|
107
|
+
s(e), p(null);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (A(e, o)) {
|
|
111
|
+
s(e), p(null);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
p(e);
|
|
115
|
+
}, v = /* @__PURE__ */ d("div", {
|
|
116
|
+
className: "mt-6 flex items-center justify-end gap-2",
|
|
117
|
+
children: [/* @__PURE__ */ u("button", {
|
|
118
|
+
type: "button",
|
|
119
|
+
onClick: r,
|
|
120
|
+
className: "cursor-pointer rounded-full bg-bg-base-primary px-5 py-2 text-sm font-semibold text-text-secondary transition-colors hover:bg-bg-base-secondary",
|
|
121
|
+
children: "닫기"
|
|
122
|
+
}), /* @__PURE__ */ u("button", {
|
|
123
|
+
type: "button",
|
|
124
|
+
onClick: () => {
|
|
125
|
+
if (!o) {
|
|
126
|
+
r();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
n({
|
|
130
|
+
from: O(o, "yyyy-MM-dd"),
|
|
131
|
+
to: O(f ?? o, "yyyy-MM-dd")
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
className: "cursor-pointer rounded-full bg-primary-500 px-5 py-2 text-sm font-semibold text-white transition-opacity hover:opacity-90",
|
|
135
|
+
children: "적용"
|
|
136
|
+
})]
|
|
137
|
+
});
|
|
138
|
+
return t ? /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("div", {
|
|
139
|
+
className: "flex justify-center",
|
|
140
|
+
children: /* @__PURE__ */ u(H, {
|
|
141
|
+
month: m,
|
|
142
|
+
onMonthChange: h,
|
|
143
|
+
onPrev: () => h(L(m, 1)),
|
|
144
|
+
onNext: () => h(w(m, 1)),
|
|
145
|
+
showPrev: !0,
|
|
146
|
+
showNext: !0,
|
|
147
|
+
rangeFrom: o,
|
|
148
|
+
rangeTo: f,
|
|
149
|
+
onDayClick: _
|
|
150
|
+
})
|
|
151
|
+
}), v] }) : /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ d("div", {
|
|
152
|
+
className: "flex items-stretch gap-8",
|
|
153
|
+
children: [
|
|
154
|
+
/* @__PURE__ */ u(H, {
|
|
155
|
+
month: m,
|
|
156
|
+
onMonthChange: h,
|
|
157
|
+
onPrev: () => h(L(m, 1)),
|
|
158
|
+
showPrev: !0,
|
|
159
|
+
rangeFrom: o,
|
|
160
|
+
rangeTo: f,
|
|
161
|
+
onDayClick: _
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ u("div", { className: "w-px bg-border-tertiary" }),
|
|
164
|
+
/* @__PURE__ */ u(H, {
|
|
165
|
+
month: g,
|
|
166
|
+
onMonthChange: (e) => h(L(e, 1)),
|
|
167
|
+
onNext: () => h(w(m, 1)),
|
|
168
|
+
showNext: !0,
|
|
169
|
+
rangeFrom: o,
|
|
170
|
+
rangeTo: f,
|
|
171
|
+
onDayClick: _
|
|
172
|
+
})
|
|
173
|
+
]
|
|
174
|
+
}), v] });
|
|
175
|
+
}
|
|
176
|
+
function H({ month: t, onMonthChange: n, onPrev: i, onNext: a, showPrev: o, showNext: l, rangeFrom: f, rangeTo: p, onDayClick: m }) {
|
|
177
|
+
let [h, g] = c(!1), _ = s(() => T({
|
|
178
|
+
start: I(F(t), { weekStartsOn: 0 }),
|
|
179
|
+
end: D(E(t), { weekStartsOn: 0 })
|
|
180
|
+
}), [t]), v = s(() => {
|
|
181
|
+
let e = [];
|
|
182
|
+
for (let t = -24; t <= z; t++) e.push(w(F(/* @__PURE__ */ new Date()), t));
|
|
183
|
+
return e;
|
|
184
|
+
}, []);
|
|
185
|
+
return /* @__PURE__ */ d("div", {
|
|
186
|
+
className: "flex w-full max-w-[300px] flex-col sm:w-[260px]",
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ d("div", {
|
|
189
|
+
className: "mb-4 flex items-center justify-between",
|
|
190
|
+
children: [
|
|
191
|
+
/* @__PURE__ */ u(U, {
|
|
192
|
+
direction: "left",
|
|
193
|
+
onClick: i,
|
|
194
|
+
visible: !!o
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ d("div", {
|
|
197
|
+
className: "relative flex flex-1 justify-center",
|
|
198
|
+
children: [/* @__PURE__ */ d("button", {
|
|
199
|
+
type: "button",
|
|
200
|
+
onClick: () => g((e) => !e),
|
|
201
|
+
className: "flex cursor-pointer items-center gap-1 rounded px-3 py-1.5 text-sm font-semibold text-text-primary transition-colors hover:bg-bg-base-primary",
|
|
202
|
+
children: [O(t, "yyyy. MM."), /* @__PURE__ */ u(e, { className: "h-3.5 w-3.5 text-text-tertiary" })]
|
|
203
|
+
}), h && /* @__PURE__ */ u("div", {
|
|
204
|
+
className: "scrollbar-brand absolute top-full z-20 mt-1 max-h-[240px] w-[140px] overflow-y-auto rounded-lg border border-border-tertiary bg-bg-card py-1 shadow-lg",
|
|
205
|
+
children: v.map((e) => /* @__PURE__ */ u("button", {
|
|
206
|
+
type: "button",
|
|
207
|
+
onClick: () => {
|
|
208
|
+
n(e), g(!1);
|
|
209
|
+
},
|
|
210
|
+
className: r("w-full cursor-pointer bg-bg-card px-4 py-2 text-left text-sm transition-colors", M(e, t) ? "bg-bg-base-secondary font-semibold text-text-primary" : "text-text-secondary hover:bg-bg-base-primary"),
|
|
211
|
+
children: O(e, "yyyy. MM.")
|
|
212
|
+
}, e.toISOString()))
|
|
213
|
+
})]
|
|
214
|
+
}),
|
|
215
|
+
/* @__PURE__ */ u(U, {
|
|
216
|
+
direction: "right",
|
|
217
|
+
onClick: a,
|
|
218
|
+
visible: !!l
|
|
219
|
+
})
|
|
220
|
+
]
|
|
221
|
+
}),
|
|
222
|
+
/* @__PURE__ */ u("div", {
|
|
223
|
+
className: "mb-2 grid grid-cols-7",
|
|
224
|
+
children: [
|
|
225
|
+
"일",
|
|
226
|
+
"월",
|
|
227
|
+
"화",
|
|
228
|
+
"수",
|
|
229
|
+
"목",
|
|
230
|
+
"금",
|
|
231
|
+
"토"
|
|
232
|
+
].map((e) => /* @__PURE__ */ u("div", {
|
|
233
|
+
className: "py-1 text-center text-xs font-medium text-text-tertiary",
|
|
234
|
+
children: e
|
|
235
|
+
}, e))
|
|
236
|
+
}),
|
|
237
|
+
/* @__PURE__ */ u("div", {
|
|
238
|
+
className: "grid grid-cols-7 gap-y-1",
|
|
239
|
+
children: _.map((e) => {
|
|
240
|
+
let i = M(e, t), a = !!(f && j(e, f)), o = !!(p && j(e, p)), s = !!f && !!p && k(e, f) && A(e, p), c = a || o, l = s || o && !!f, h = s || a && !!p;
|
|
241
|
+
return /* @__PURE__ */ d("button", {
|
|
242
|
+
type: "button",
|
|
243
|
+
onClick: () => {
|
|
244
|
+
i || n(e), m(e);
|
|
245
|
+
},
|
|
246
|
+
className: "group relative flex h-9 cursor-pointer items-center justify-center text-sm",
|
|
247
|
+
"aria-label": O(e, "yyyy년 M월 d일", { locale: R }),
|
|
248
|
+
children: [
|
|
249
|
+
l && /* @__PURE__ */ u("span", {
|
|
250
|
+
className: "absolute inset-y-0 left-0 right-1/2 bg-bg-base-secondary",
|
|
251
|
+
"aria-hidden": !0
|
|
252
|
+
}),
|
|
253
|
+
h && /* @__PURE__ */ u("span", {
|
|
254
|
+
className: "absolute inset-y-0 left-1/2 right-0 bg-bg-base-secondary",
|
|
255
|
+
"aria-hidden": !0
|
|
256
|
+
}),
|
|
257
|
+
c && /* @__PURE__ */ u("span", {
|
|
258
|
+
className: "absolute left-1/2 top-1/2 h-9 w-9 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-500",
|
|
259
|
+
"aria-hidden": !0
|
|
260
|
+
}),
|
|
261
|
+
/* @__PURE__ */ u("span", {
|
|
262
|
+
className: r("relative z-10", !i && "text-text-disabled", i && !c && "text-text-primary", c && "font-bold text-white"),
|
|
263
|
+
children: O(e, "d")
|
|
264
|
+
})
|
|
265
|
+
]
|
|
266
|
+
}, e.toISOString());
|
|
267
|
+
})
|
|
268
|
+
})
|
|
269
|
+
]
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
function U({ direction: e, onClick: r, visible: i }) {
|
|
273
|
+
return i ? /* @__PURE__ */ u("button", {
|
|
274
|
+
type: "button",
|
|
275
|
+
onClick: r,
|
|
276
|
+
className: "flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border-tertiary text-text-secondary transition-colors hover:bg-bg-base-primary",
|
|
277
|
+
"aria-label": e === "left" ? "이전 달" : "다음 달",
|
|
278
|
+
children: /* @__PURE__ */ u(e === "left" ? t : n, { className: "h-4 w-4" })
|
|
279
|
+
}) : /* @__PURE__ */ u("div", { className: "w-8" });
|
|
280
|
+
}
|
|
281
|
+
function W(e) {
|
|
282
|
+
if (!e) return null;
|
|
283
|
+
let t = P(e);
|
|
284
|
+
return N(t) ? t : null;
|
|
285
|
+
}
|
|
286
|
+
//#endregion
|
|
287
|
+
export { B as DateRangePicker };
|