@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,137 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.esm.js";
|
|
2
|
+
import { useIsMobile as t } from "../../hooks/useMediaQuery.esm.js";
|
|
3
|
+
import { overlayStack as n } from "../../lib/overlay-stack.esm.js";
|
|
4
|
+
import { Portal as r } from "../../lib/Portal.esm.js";
|
|
5
|
+
import { useEffect as i, useId as a } from "react";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
import { AnimatePresence as c, motion as l, useDragControls as u } from "motion/react";
|
|
8
|
+
//#region src/components/modal/Modal.tsx
|
|
9
|
+
function d({ isOpen: d, onClose: f, title: p, widthPx: m, footer: h, bodyPadded: g = !1, subView: _, className: v, children: y }) {
|
|
10
|
+
let b = t(), x = a(), S = u();
|
|
11
|
+
return i(() => {
|
|
12
|
+
if (d) return n.push(x), document.body.style.overflow = "hidden", () => {
|
|
13
|
+
n.pop(x), n.isEmpty() && (document.body.style.overflow = "");
|
|
14
|
+
};
|
|
15
|
+
}, [d, x]), i(() => {
|
|
16
|
+
let e = (e) => {
|
|
17
|
+
e.key === "Escape" && n.isTop(x) && f();
|
|
18
|
+
};
|
|
19
|
+
return d && window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
20
|
+
}, [
|
|
21
|
+
d,
|
|
22
|
+
f,
|
|
23
|
+
x
|
|
24
|
+
]), /* @__PURE__ */ s(r, { children: [/* @__PURE__ */ o(c, { children: d && /* @__PURE__ */ o(l.div, {
|
|
25
|
+
initial: { opacity: 0 },
|
|
26
|
+
animate: { opacity: 1 },
|
|
27
|
+
exit: { opacity: 0 },
|
|
28
|
+
transition: { duration: .2 },
|
|
29
|
+
onClick: () => {
|
|
30
|
+
n.isTop(x) && f();
|
|
31
|
+
},
|
|
32
|
+
className: "fixed inset-0 z-50 bg-black/50"
|
|
33
|
+
}, "modal-backdrop") }), /* @__PURE__ */ o(c, { children: d && /* @__PURE__ */ s(l.div, {
|
|
34
|
+
initial: b ? { y: "100%" } : {
|
|
35
|
+
opacity: 0,
|
|
36
|
+
y: 24,
|
|
37
|
+
scale: .96
|
|
38
|
+
},
|
|
39
|
+
animate: b ? { y: 0 } : {
|
|
40
|
+
opacity: 1,
|
|
41
|
+
y: 0,
|
|
42
|
+
scale: 1
|
|
43
|
+
},
|
|
44
|
+
exit: b ? {
|
|
45
|
+
y: "100%",
|
|
46
|
+
transition: {
|
|
47
|
+
duration: .2,
|
|
48
|
+
ease: [
|
|
49
|
+
.4,
|
|
50
|
+
0,
|
|
51
|
+
1,
|
|
52
|
+
1
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
} : {
|
|
56
|
+
opacity: 0,
|
|
57
|
+
y: 24,
|
|
58
|
+
scale: .96
|
|
59
|
+
},
|
|
60
|
+
transition: b ? {
|
|
61
|
+
type: "spring",
|
|
62
|
+
damping: 38,
|
|
63
|
+
stiffness: 320
|
|
64
|
+
} : {
|
|
65
|
+
duration: .25,
|
|
66
|
+
ease: [
|
|
67
|
+
.32,
|
|
68
|
+
.72,
|
|
69
|
+
0,
|
|
70
|
+
1
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
drag: b ? "y" : !1,
|
|
74
|
+
dragListener: !1,
|
|
75
|
+
dragControls: S,
|
|
76
|
+
dragConstraints: {
|
|
77
|
+
top: 0,
|
|
78
|
+
bottom: 0
|
|
79
|
+
},
|
|
80
|
+
dragElastic: {
|
|
81
|
+
top: 0,
|
|
82
|
+
bottom: .4
|
|
83
|
+
},
|
|
84
|
+
onDragEnd: (e, t) => {
|
|
85
|
+
(t.offset.y > 100 || t.velocity.y > 500) && f();
|
|
86
|
+
},
|
|
87
|
+
className: e("fixed -bottom-8 left-0 right-0 z-50 mx-auto flex max-h-[88vh] w-full flex-col overflow-hidden rounded-t-2xl bg-white pb-8 shadow-xl sm:bottom-auto sm:left-1/2 sm:right-auto sm:top-1/2 sm:max-h-[90vh] sm:w-auto sm:min-w-[320px] sm:max-w-[90vw] sm:rounded-lg sm:pb-0 dark:bg-neutral-800", v),
|
|
88
|
+
style: b ? void 0 : {
|
|
89
|
+
translateX: "-50%",
|
|
90
|
+
translateY: "-50%",
|
|
91
|
+
...m ? { width: m } : {}
|
|
92
|
+
},
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ o("div", {
|
|
95
|
+
className: "flex justify-center pt-2 pb-1 cursor-grab touch-none active:cursor-grabbing sm:hidden",
|
|
96
|
+
onPointerDown: (e) => S.start(e),
|
|
97
|
+
children: /* @__PURE__ */ o("div", { className: "h-1 w-10 rounded-full bg-neutral-300 dark:bg-neutral-600" })
|
|
98
|
+
}),
|
|
99
|
+
p && /* @__PURE__ */ s("div", {
|
|
100
|
+
className: "flex items-center justify-between px-4 py-3",
|
|
101
|
+
children: [/* @__PURE__ */ o("h3", {
|
|
102
|
+
className: "text-base font-semibold text-neutral-900 sm:text-lg dark:text-white",
|
|
103
|
+
children: p
|
|
104
|
+
}), /* @__PURE__ */ o("button", {
|
|
105
|
+
onClick: f,
|
|
106
|
+
className: "rounded p-1 text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300",
|
|
107
|
+
"aria-label": "닫기",
|
|
108
|
+
children: /* @__PURE__ */ o("svg", {
|
|
109
|
+
className: "h-5 w-5",
|
|
110
|
+
fill: "none",
|
|
111
|
+
stroke: "currentColor",
|
|
112
|
+
viewBox: "0 0 24 24",
|
|
113
|
+
children: /* @__PURE__ */ o("path", {
|
|
114
|
+
strokeLinecap: "round",
|
|
115
|
+
strokeLinejoin: "round",
|
|
116
|
+
strokeWidth: 2,
|
|
117
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
})]
|
|
121
|
+
}),
|
|
122
|
+
/* @__PURE__ */ s("div", {
|
|
123
|
+
className: "relative flex min-h-0 flex-1 flex-col overflow-hidden",
|
|
124
|
+
children: [/* @__PURE__ */ o("div", {
|
|
125
|
+
className: `transform-[translateZ(0)] flex-1 overflow-y-auto overflow-x-hidden${g ? " mx-1 sm:mx-4" : ""}`,
|
|
126
|
+
children: y
|
|
127
|
+
}), _]
|
|
128
|
+
}),
|
|
129
|
+
h && /* @__PURE__ */ o("div", {
|
|
130
|
+
className: "shrink-0",
|
|
131
|
+
children: h
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
}, "modal-sheet") })] });
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
export { d as Modal };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../node_modules/lucide-react/dist/esm/icons/arrow-left.cjs.js"),t=require("../../lib/overlay-stack.cjs.js");let n=require("react"),r=require("react/jsx-runtime"),i=require("motion/react");function a({open:a,onBack:o,title:s,headerRight:c,bodyPadded:l=!0,contentPadded:u=!0,variant:d=`full`,children:f}){let p=(0,n.useId)();(0,n.useEffect)(()=>{if(a)return t.overlayStack.push(p),()=>{t.overlayStack.pop(p)}},[a,p]),(0,n.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t.overlayStack.isTop(p)&&o()};return a&&window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a,o,p]);let m=(0,r.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border-tertiary px-4 py-3 dark:border-neutral-700`,children:[(0,r.jsx)(`button`,{type:`button`,onClick:o,className:`rounded p-1 text-text-tertiary transition-colors hover:bg-bg-base-secondary hover:text-text-secondary dark:text-neutral-400 dark:hover:bg-neutral-700 dark:hover:text-neutral-200`,"aria-label":`뒤로 가기`,children:(0,r.jsx)(e.ArrowLeft,{className:`h-4 w-4`})}),s&&(0,r.jsx)(`div`,{className:`flex-1 text-sm font-semibold text-text-primary dark:text-white`,children:s}),c]}),h=(0,r.jsx)(`div`,{className:`transform-[translateZ(0)] flex-1 overflow-y-auto overflow-x-hidden${l?` mx-1 sm:mx-4`:``}`,children:u?(0,r.jsx)(`div`,{className:`px-2 py-3 sm:px-4 sm:py-5`,children:f}):f});return d===`drawer`?(0,r.jsx)(i.AnimatePresence,{children:a&&(0,r.jsxs)(`div`,{className:`absolute inset-0 z-10`,children:[(0,r.jsx)(i.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},onClick:o,className:`absolute inset-0 bg-black/40`},`subview-drawer-backdrop`),(0,r.jsxs)(i.motion.div,{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`,transition:{duration:.2,ease:[.4,0,1,1]}},transition:{type:`spring`,damping:30,stiffness:320},className:`absolute right-0 top-0 bottom-0 flex w-[85%] max-w-md flex-col bg-bg-white shadow-xl dark:bg-neutral-800`,children:[m,h]},`subview-drawer-sheet`)]})}):(0,r.jsx)(i.AnimatePresence,{children:a&&(0,r.jsxs)(i.motion.div,{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`},transition:{duration:.25,ease:`easeOut`},className:`absolute inset-0 z-10 flex flex-col bg-bg-white dark:bg-neutral-800`,children:[m,h]})})}exports.ModalSubView=a;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ArrowLeft as e } from "../../node_modules/lucide-react/dist/esm/icons/arrow-left.esm.js";
|
|
2
|
+
import { overlayStack as t } from "../../lib/overlay-stack.esm.js";
|
|
3
|
+
import { useEffect as n, useId as r } from "react";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
import { AnimatePresence as o, motion as s } from "motion/react";
|
|
6
|
+
//#region src/components/modal/ModalSubView.tsx
|
|
7
|
+
function c({ open: c, onBack: l, title: u, headerRight: d, bodyPadded: f = !0, contentPadded: p = !0, variant: m = "full", children: h }) {
|
|
8
|
+
let g = r();
|
|
9
|
+
n(() => {
|
|
10
|
+
if (c) return t.push(g), () => {
|
|
11
|
+
t.pop(g);
|
|
12
|
+
};
|
|
13
|
+
}, [c, g]), n(() => {
|
|
14
|
+
let e = (e) => {
|
|
15
|
+
e.key === "Escape" && t.isTop(g) && l();
|
|
16
|
+
};
|
|
17
|
+
return c && window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
18
|
+
}, [
|
|
19
|
+
c,
|
|
20
|
+
l,
|
|
21
|
+
g
|
|
22
|
+
]);
|
|
23
|
+
let _ = /* @__PURE__ */ a("div", {
|
|
24
|
+
className: "flex items-center gap-2 border-b border-border-tertiary px-4 py-3 dark:border-neutral-700",
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ i("button", {
|
|
27
|
+
type: "button",
|
|
28
|
+
onClick: l,
|
|
29
|
+
className: "rounded p-1 text-text-tertiary transition-colors hover:bg-bg-base-secondary hover:text-text-secondary dark:text-neutral-400 dark:hover:bg-neutral-700 dark:hover:text-neutral-200",
|
|
30
|
+
"aria-label": "뒤로 가기",
|
|
31
|
+
children: /* @__PURE__ */ i(e, { className: "h-4 w-4" })
|
|
32
|
+
}),
|
|
33
|
+
u && /* @__PURE__ */ i("div", {
|
|
34
|
+
className: "flex-1 text-sm font-semibold text-text-primary dark:text-white",
|
|
35
|
+
children: u
|
|
36
|
+
}),
|
|
37
|
+
d
|
|
38
|
+
]
|
|
39
|
+
}), v = /* @__PURE__ */ i("div", {
|
|
40
|
+
className: `transform-[translateZ(0)] flex-1 overflow-y-auto overflow-x-hidden${f ? " mx-1 sm:mx-4" : ""}`,
|
|
41
|
+
children: p ? /* @__PURE__ */ i("div", {
|
|
42
|
+
className: "px-2 py-3 sm:px-4 sm:py-5",
|
|
43
|
+
children: h
|
|
44
|
+
}) : h
|
|
45
|
+
});
|
|
46
|
+
return m === "drawer" ? /* @__PURE__ */ i(o, { children: c && /* @__PURE__ */ a("div", {
|
|
47
|
+
className: "absolute inset-0 z-10",
|
|
48
|
+
children: [/* @__PURE__ */ i(s.div, {
|
|
49
|
+
initial: { opacity: 0 },
|
|
50
|
+
animate: { opacity: 1 },
|
|
51
|
+
exit: { opacity: 0 },
|
|
52
|
+
transition: { duration: .2 },
|
|
53
|
+
onClick: l,
|
|
54
|
+
className: "absolute inset-0 bg-black/40"
|
|
55
|
+
}, "subview-drawer-backdrop"), /* @__PURE__ */ a(s.div, {
|
|
56
|
+
initial: { x: "100%" },
|
|
57
|
+
animate: { x: 0 },
|
|
58
|
+
exit: {
|
|
59
|
+
x: "100%",
|
|
60
|
+
transition: {
|
|
61
|
+
duration: .2,
|
|
62
|
+
ease: [
|
|
63
|
+
.4,
|
|
64
|
+
0,
|
|
65
|
+
1,
|
|
66
|
+
1
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
transition: {
|
|
71
|
+
type: "spring",
|
|
72
|
+
damping: 30,
|
|
73
|
+
stiffness: 320
|
|
74
|
+
},
|
|
75
|
+
className: "absolute right-0 top-0 bottom-0 flex w-[85%] max-w-md flex-col bg-bg-white shadow-xl dark:bg-neutral-800",
|
|
76
|
+
children: [_, v]
|
|
77
|
+
}, "subview-drawer-sheet")]
|
|
78
|
+
}) }) : /* @__PURE__ */ i(o, { children: c && /* @__PURE__ */ a(s.div, {
|
|
79
|
+
initial: { x: "100%" },
|
|
80
|
+
animate: { x: 0 },
|
|
81
|
+
exit: { x: "100%" },
|
|
82
|
+
transition: {
|
|
83
|
+
duration: .25,
|
|
84
|
+
ease: "easeOut"
|
|
85
|
+
},
|
|
86
|
+
className: "absolute inset-0 z-10 flex flex-col bg-bg-white dark:bg-neutral-800",
|
|
87
|
+
children: [_, v]
|
|
88
|
+
}) });
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { c as ModalSubView };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../button/Button.cjs.js"),t=require("../../hooks/useMediaQuery.cjs.js"),n=require("./Modal.cjs.js");let r=require("react/jsx-runtime");function i({isOpen:i,onClose:a,title:o,widthPx:s,subView:c,primaryAction:l,secondaryAction:u,leftAction:d,bodyNoPadding:f,children:p}){let m=t.useIsMobile(),h=l||u||d,g=m?`mini`:`small`,_=(t,n)=>(0,r.jsx)(e.Button,{variant:t.variant??n.variant,appearance:t.appearance??n.appearance,size:g,display:`block`,leadingIcon:t.leadingIcon,onClick:t.onClick,loading:t.loading,disabled:t.disabled,children:t.label});return(0,r.jsx)(n.Modal,{isOpen:i,onClose:a,title:o,widthPx:s,bodyPadded:!0,subView:c,footer:h?(0,r.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-t border-neutral-200 px-4 py-3 sm:px-5 sm:py-4 dark:border-neutral-700`,children:[(0,r.jsx)(`div`,{children:d&&(0,r.jsx)(`div`,{className:`w-[88px] sm:w-28`,children:_(d,{variant:`tertiary`,appearance:`outlined`})})}),(0,r.jsxs)(`div`,{className:`flex gap-2`,children:[u&&(0,r.jsx)(`div`,{className:`w-16 sm:w-24`,children:_(u,{variant:`secondary`,appearance:`outlined`})}),l&&(0,r.jsx)(`div`,{className:`w-16 sm:w-24`,children:_(l,{variant:`primary`})})]})]}):void 0,children:f?p:(0,r.jsx)(`div`,{className:`px-2 py-3 sm:px-4 sm:py-5`,children:p})})}exports.StandardModal=i;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Button as e } from "../button/Button.esm.js";
|
|
2
|
+
import { useIsMobile as t } from "../../hooks/useMediaQuery.esm.js";
|
|
3
|
+
import { Modal as n } from "./Modal.esm.js";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/modal/StandardModal.tsx
|
|
6
|
+
function a({ isOpen: a, onClose: o, title: s, widthPx: c, subView: l, primaryAction: u, secondaryAction: d, leftAction: f, bodyNoPadding: p, children: m }) {
|
|
7
|
+
let h = t(), g = u || d || f, _ = h ? "mini" : "small", v = (t, n) => /* @__PURE__ */ r(e, {
|
|
8
|
+
variant: t.variant ?? n.variant,
|
|
9
|
+
appearance: t.appearance ?? n.appearance,
|
|
10
|
+
size: _,
|
|
11
|
+
display: "block",
|
|
12
|
+
leadingIcon: t.leadingIcon,
|
|
13
|
+
onClick: t.onClick,
|
|
14
|
+
loading: t.loading,
|
|
15
|
+
disabled: t.disabled,
|
|
16
|
+
children: t.label
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ r(n, {
|
|
19
|
+
isOpen: a,
|
|
20
|
+
onClose: o,
|
|
21
|
+
title: s,
|
|
22
|
+
widthPx: c,
|
|
23
|
+
bodyPadded: !0,
|
|
24
|
+
subView: l,
|
|
25
|
+
footer: g ? /* @__PURE__ */ i("div", {
|
|
26
|
+
className: "flex items-center justify-between gap-2 border-t border-neutral-200 px-4 py-3 sm:px-5 sm:py-4 dark:border-neutral-700",
|
|
27
|
+
children: [/* @__PURE__ */ r("div", { children: f && /* @__PURE__ */ r("div", {
|
|
28
|
+
className: "w-[88px] sm:w-28",
|
|
29
|
+
children: v(f, {
|
|
30
|
+
variant: "tertiary",
|
|
31
|
+
appearance: "outlined"
|
|
32
|
+
})
|
|
33
|
+
}) }), /* @__PURE__ */ i("div", {
|
|
34
|
+
className: "flex gap-2",
|
|
35
|
+
children: [d && /* @__PURE__ */ r("div", {
|
|
36
|
+
className: "w-16 sm:w-24",
|
|
37
|
+
children: v(d, {
|
|
38
|
+
variant: "secondary",
|
|
39
|
+
appearance: "outlined"
|
|
40
|
+
})
|
|
41
|
+
}), u && /* @__PURE__ */ r("div", {
|
|
42
|
+
className: "w-16 sm:w-24",
|
|
43
|
+
children: v(u, { variant: "primary" })
|
|
44
|
+
})]
|
|
45
|
+
})]
|
|
46
|
+
}) : void 0,
|
|
47
|
+
children: p ? m : /* @__PURE__ */ r("div", {
|
|
48
|
+
className: "px-2 py-3 sm:px-4 sm:py-5",
|
|
49
|
+
children: m
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { a as StandardModal };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("react/jsx-runtime");function t({title:t,subtitle:n,className:r=``}){return(0,e.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-x-3 ${r}`,children:[(0,e.jsx)(`h1`,{className:`min-w-0 shrink truncate text-base font-semibold text-text-secondary sm:text-lg`,children:t}),n&&(0,e.jsx)(`p`,{className:`min-w-0 shrink-3 truncate text-xs text-text-tertiary sm:text-sm`,children:n})]})}exports.PageTitle=t;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
//#region src/components/page-title/PageTitle.tsx
|
|
3
|
+
function n({ title: n, subtitle: r, className: i = "" }) {
|
|
4
|
+
return /* @__PURE__ */ t("div", {
|
|
5
|
+
className: `flex min-w-0 items-baseline gap-x-3 ${i}`,
|
|
6
|
+
children: [/* @__PURE__ */ e("h1", {
|
|
7
|
+
className: "min-w-0 shrink truncate text-base font-semibold text-text-secondary sm:text-lg",
|
|
8
|
+
children: n
|
|
9
|
+
}), r && /* @__PURE__ */ e("p", {
|
|
10
|
+
className: "min-w-0 shrink-3 truncate text-xs text-text-tertiary sm:text-sm",
|
|
11
|
+
children: r
|
|
12
|
+
})]
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { n as PageTitle };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../lib/utils.cjs.js");let t=require("react"),n=require("react/jsx-runtime"),r=require("motion/react"),i=require("@floating-ui/react");function a({trigger:a,content:o,placement:s=`bottom`,onOpenChange:c,className:l}){let[u,d]=(0,t.useState)(!1),f=e=>{d(e),c?.(e)},{refs:p,floatingStyles:m,context:h}=(0,i.useFloating)({open:u,onOpenChange:f,placement:s,whileElementsMounted:i.autoUpdate,middleware:[(0,i.offset)(8),(0,i.flip)({fallbackAxisSideDirection:`start`}),(0,i.shift)({padding:8})]}),{getReferenceProps:g,getFloatingProps:_}=(0,i.useInteractions)([(0,i.useClick)(h),(0,i.useDismiss)(h),(0,i.useRole)(h,{role:`dialog`})]),v=()=>f(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`span`,{ref:p.setReference,tabIndex:0,role:`button`,...g(),className:`inline-flex cursor-pointer select-none`,children:a}),(0,n.jsx)(i.FloatingPortal,{children:(0,n.jsx)(r.AnimatePresence,{children:u&&(0,n.jsx)(`div`,{ref:p.setFloating,style:m,..._(),className:`z-9999`,children:(0,n.jsx)(r.motion.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.15},className:e.cn(`bg-white dark:bg-neutral-800 rounded-lg shadow-md border border-border-tertiary dark:border-border-secondary p-4 min-w-60 max-w-[320px]`,l),children:typeof o==`function`?o(v):o})})})})]})}exports.Popover=a;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.esm.js";
|
|
2
|
+
import { useState as t } from "react";
|
|
3
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
import { AnimatePresence as a, motion as o } from "motion/react";
|
|
5
|
+
import { FloatingPortal as s, autoUpdate as c, flip as l, offset as u, shift as d, useClick as f, useDismiss as p, useFloating as m, useInteractions as h, useRole as g } from "@floating-ui/react";
|
|
6
|
+
//#region src/components/popover/Popover.tsx
|
|
7
|
+
function _({ trigger: _, content: v, placement: y = "bottom", onOpenChange: b, className: x }) {
|
|
8
|
+
let [S, C] = t(!1), w = (e) => {
|
|
9
|
+
C(e), b?.(e);
|
|
10
|
+
}, { refs: T, floatingStyles: E, context: D } = m({
|
|
11
|
+
open: S,
|
|
12
|
+
onOpenChange: w,
|
|
13
|
+
placement: y,
|
|
14
|
+
whileElementsMounted: c,
|
|
15
|
+
middleware: [
|
|
16
|
+
u(8),
|
|
17
|
+
l({ fallbackAxisSideDirection: "start" }),
|
|
18
|
+
d({ padding: 8 })
|
|
19
|
+
]
|
|
20
|
+
}), { getReferenceProps: O, getFloatingProps: k } = h([
|
|
21
|
+
f(D),
|
|
22
|
+
p(D),
|
|
23
|
+
g(D, { role: "dialog" })
|
|
24
|
+
]), A = () => w(!1);
|
|
25
|
+
return /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r("span", {
|
|
26
|
+
ref: T.setReference,
|
|
27
|
+
tabIndex: 0,
|
|
28
|
+
role: "button",
|
|
29
|
+
...O(),
|
|
30
|
+
className: "inline-flex cursor-pointer select-none",
|
|
31
|
+
children: _
|
|
32
|
+
}), /* @__PURE__ */ r(s, { children: /* @__PURE__ */ r(a, { children: S && /* @__PURE__ */ r("div", {
|
|
33
|
+
ref: T.setFloating,
|
|
34
|
+
style: E,
|
|
35
|
+
...k(),
|
|
36
|
+
className: "z-9999",
|
|
37
|
+
children: /* @__PURE__ */ r(o.div, {
|
|
38
|
+
initial: {
|
|
39
|
+
opacity: 0,
|
|
40
|
+
scale: .95
|
|
41
|
+
},
|
|
42
|
+
animate: {
|
|
43
|
+
opacity: 1,
|
|
44
|
+
scale: 1
|
|
45
|
+
},
|
|
46
|
+
exit: {
|
|
47
|
+
opacity: 0,
|
|
48
|
+
scale: .95
|
|
49
|
+
},
|
|
50
|
+
transition: { duration: .15 },
|
|
51
|
+
className: e("bg-white dark:bg-neutral-800 rounded-lg shadow-md border border-border-tertiary dark:border-border-secondary p-4 min-w-60 max-w-[320px]", x),
|
|
52
|
+
children: typeof v == "function" ? v(A) : v
|
|
53
|
+
})
|
|
54
|
+
}) }) })] });
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { _ as Popover };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../node_modules/lucide-react/dist/esm/icons/check.cjs.js");let t=require("react/jsx-runtime");function n({value:n,onChange:r,size:i}){let a=i===`mini`;return(0,t.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1 select-none`,children:[(0,t.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked),className:`peer sr-only`}),(0,t.jsx)(e.Check,{className:`${a?`h-3.5 w-3.5`:`h-4 w-4`} stroke-3 transition-colors peer-focus-visible:outline-2 peer-focus-visible:outline-primary-500 peer-focus-visible:outline-offset-1 ${n?`text-primary-500`:`text-icon-tertiary`}`,"aria-hidden":`true`}),(0,t.jsx)(`span`,{className:`${a?`text-xs`:`text-sm`} font-medium transition-colors ${n?`text-primary-500`:`text-text-tertiary`}`,children:`완전일치`})]})}exports.ExactMatchToggle=n;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Check as e } from "../../node_modules/lucide-react/dist/esm/icons/check.esm.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/search-box/ExactMatchToggle.tsx
|
|
4
|
+
function r({ value: r, onChange: i, size: a }) {
|
|
5
|
+
let o = a === "mini";
|
|
6
|
+
return /* @__PURE__ */ n("label", {
|
|
7
|
+
className: "inline-flex cursor-pointer items-center gap-1 select-none",
|
|
8
|
+
children: [
|
|
9
|
+
/* @__PURE__ */ t("input", {
|
|
10
|
+
type: "checkbox",
|
|
11
|
+
checked: r,
|
|
12
|
+
onChange: (e) => i(e.target.checked),
|
|
13
|
+
className: "peer sr-only"
|
|
14
|
+
}),
|
|
15
|
+
/* @__PURE__ */ t(e, {
|
|
16
|
+
className: `${o ? "h-3.5 w-3.5" : "h-4 w-4"} stroke-3 transition-colors peer-focus-visible:outline-2 peer-focus-visible:outline-primary-500 peer-focus-visible:outline-offset-1 ${r ? "text-primary-500" : "text-icon-tertiary"}`,
|
|
17
|
+
"aria-hidden": "true"
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ t("span", {
|
|
20
|
+
className: `${o ? "text-xs" : "text-sm"} font-medium transition-colors ${r ? "text-primary-500" : "text-text-tertiary"}`,
|
|
21
|
+
children: "완전일치"
|
|
22
|
+
})
|
|
23
|
+
]
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { r as ExactMatchToggle };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../button/Button.cjs.js"),t=require("../../node_modules/lucide-react/dist/esm/icons/list-filter.cjs.js"),n=require("../../node_modules/lucide-react/dist/esm/icons/rotate-ccw.cjs.js"),r=require("../../node_modules/lucide-react/dist/esm/icons/search.cjs.js"),i=require("../../hooks/useMediaQuery.cjs.js"),a=require("../modal/StandardModal.cjs.js"),o=require("./ExactMatchToggle.cjs.js"),s=require("./SearchBoxChips.cjs.js"),c=require("./SearchBoxSheetContext.cjs.js"),l=require("./SearchBoxField.cjs.js"),u=require("./useSearchBoxState.cjs.js");let d=require("react"),f=require("react/jsx-runtime");function p({fields:p,values:h,onSearch:g,onClear:_,isSubmitting:v=!1,exactMatch:y,className:b=``}){let x=i.useIsMobile(),S=x?`mini`:`small`,[C,w]=(0,d.useState)(!1),{draft:T,setFieldValue:E,submit:D,clear:O,chips:k,removeChip:A}=u.useSearchBoxState({fields:p,values:h,onSearch:g,onClear:_}),j=()=>v?!1:D(),M=()=>{j()&&w(!1)};return x?(0,f.jsxs)(`div`,{className:`w-full ${b}`,children:[(0,f.jsxs)(`div`,{className:`flex w-full items-center justify-end gap-1`,children:[(0,f.jsx)(m,{label:`초기화`,onClick:O,variant:`ghost`,icon:(0,f.jsx)(n.RotateCcw,{className:`h-4 w-4`})}),(0,f.jsx)(m,{label:`검색`,onClick:j,disabled:v,variant:`primary`,icon:(0,f.jsx)(r.Search,{className:`h-4 w-4`})}),(0,f.jsx)(m,{label:`필터`,onClick:()=>w(!0),variant:`ghost`,icon:(0,f.jsx)(t.ListFilter,{className:`h-4 w-4`}),activeDot:k.length>0})]}),k.length>0&&(0,f.jsx)(`div`,{className:`mt-2`,children:(0,f.jsx)(s.SearchBoxChips,{chips:k,onRemove:A})}),(0,f.jsx)(a.StandardModal,{isOpen:C,onClose:()=>w(!1),title:`필터`,primaryAction:{label:`적용`,onClick:M,loading:v},secondaryAction:{label:`닫기`,onClick:()=>w(!1)},children:(0,f.jsx)(c.SearchBoxSheetContext.Provider,{value:!0,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[p.filter(e=>!e.hidden).map(e=>(0,f.jsx)(l.SearchBoxField,{field:e,value:T[e.key]??``,onChange:t=>E(e.key,t),onEnter:M,size:`small`},e.key)),y&&(0,f.jsx)(`div`,{className:`flex justify-end`,children:(0,f.jsx)(o.ExactMatchToggle,{value:y.value,onChange:y.onChange,size:`small`})})]})})})]}):(0,f.jsxs)(`div`,{className:`w-full ${b}`,children:[(0,f.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-x-3 gap-y-2`,children:[p.filter(e=>!e.hidden).map(e=>(0,f.jsx)(`div`,{className:e.className??`w-44`,children:(0,f.jsx)(l.SearchBoxField,{field:e,value:T[e.key]??``,onChange:t=>E(e.key,t),onEnter:j,size:S})},e.key)),(0,f.jsxs)(`div`,{className:`ml-auto flex items-center gap-3`,children:[y&&(0,f.jsx)(o.ExactMatchToggle,{value:y.value,onChange:y.onChange,size:S}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(e.Button,{variant:`tertiary`,appearance:`outlined`,size:S,onClick:O,leadingIcon:(0,f.jsx)(n.RotateCcw,{className:`h-3.5 w-3.5`}),className:`h-10 border-border-tertiary! dark:border-border-secondary!`,children:`초기화`}),(0,f.jsx)(e.Button,{variant:`primary`,size:S,onClick:j,loading:v,leadingIcon:(0,f.jsx)(r.Search,{className:`h-3.5 w-3.5`}),className:`h-10`,children:`검색`})]})]})]}),k.length>0&&(0,f.jsx)(`div`,{className:`mt-2`,children:(0,f.jsx)(s.SearchBoxChips,{chips:k,onRemove:A})})]})}function m({label:e,onClick:t,icon:n,variant:r,disabled:i,activeDot:a}){return(0,f.jsxs)(`button`,{type:`button`,"aria-label":e,onClick:t,disabled:i,className:`relative inline-flex h-9 w-9 items-center justify-center rounded-lg transition-colors disabled:opacity-50 ${r===`primary`?`bg-primary-500 text-white hover:bg-primary-600`:`text-icon-secondary hover:bg-bg-base-secondary`}`,children:[n,a&&(0,f.jsx)(`span`,{className:`absolute top-1.5 right-1.5 h-1.5 w-1.5 rounded-full bg-primary-500`})]})}exports.SearchBox=p;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Button as e } from "../button/Button.esm.js";
|
|
2
|
+
import { ListFilter as t } from "../../node_modules/lucide-react/dist/esm/icons/list-filter.esm.js";
|
|
3
|
+
import { RotateCcw as n } from "../../node_modules/lucide-react/dist/esm/icons/rotate-ccw.esm.js";
|
|
4
|
+
import { Search as r } from "../../node_modules/lucide-react/dist/esm/icons/search.esm.js";
|
|
5
|
+
import { useIsMobile as i } from "../../hooks/useMediaQuery.esm.js";
|
|
6
|
+
import { StandardModal as a } from "../modal/StandardModal.esm.js";
|
|
7
|
+
import { ExactMatchToggle as o } from "./ExactMatchToggle.esm.js";
|
|
8
|
+
import { SearchBoxChips as s } from "./SearchBoxChips.esm.js";
|
|
9
|
+
import { SearchBoxSheetContext as c } from "./SearchBoxSheetContext.esm.js";
|
|
10
|
+
import { SearchBoxField as l } from "./SearchBoxField.esm.js";
|
|
11
|
+
import { useSearchBoxState as u } from "./useSearchBoxState.esm.js";
|
|
12
|
+
import { useState as d } from "react";
|
|
13
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
14
|
+
//#region src/components/search-box/SearchBox.tsx
|
|
15
|
+
function m({ fields: m, values: g, onSearch: _, onClear: v, isSubmitting: y = !1, exactMatch: b, className: x = "" }) {
|
|
16
|
+
let S = i(), C = S ? "mini" : "small", [w, T] = d(!1), { draft: E, setFieldValue: D, submit: O, clear: k, chips: A, removeChip: j } = u({
|
|
17
|
+
fields: m,
|
|
18
|
+
values: g,
|
|
19
|
+
onSearch: _,
|
|
20
|
+
onClear: v
|
|
21
|
+
}), M = () => y ? !1 : O(), N = () => {
|
|
22
|
+
M() && T(!1);
|
|
23
|
+
};
|
|
24
|
+
return S ? /* @__PURE__ */ p("div", {
|
|
25
|
+
className: `w-full ${x}`,
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ p("div", {
|
|
28
|
+
className: "flex w-full items-center justify-end gap-1",
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ f(h, {
|
|
31
|
+
label: "초기화",
|
|
32
|
+
onClick: k,
|
|
33
|
+
variant: "ghost",
|
|
34
|
+
icon: /* @__PURE__ */ f(n, { className: "h-4 w-4" })
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ f(h, {
|
|
37
|
+
label: "검색",
|
|
38
|
+
onClick: M,
|
|
39
|
+
disabled: y,
|
|
40
|
+
variant: "primary",
|
|
41
|
+
icon: /* @__PURE__ */ f(r, { className: "h-4 w-4" })
|
|
42
|
+
}),
|
|
43
|
+
/* @__PURE__ */ f(h, {
|
|
44
|
+
label: "필터",
|
|
45
|
+
onClick: () => T(!0),
|
|
46
|
+
variant: "ghost",
|
|
47
|
+
icon: /* @__PURE__ */ f(t, { className: "h-4 w-4" }),
|
|
48
|
+
activeDot: A.length > 0
|
|
49
|
+
})
|
|
50
|
+
]
|
|
51
|
+
}),
|
|
52
|
+
A.length > 0 && /* @__PURE__ */ f("div", {
|
|
53
|
+
className: "mt-2",
|
|
54
|
+
children: /* @__PURE__ */ f(s, {
|
|
55
|
+
chips: A,
|
|
56
|
+
onRemove: j
|
|
57
|
+
})
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ f(a, {
|
|
60
|
+
isOpen: w,
|
|
61
|
+
onClose: () => T(!1),
|
|
62
|
+
title: "필터",
|
|
63
|
+
primaryAction: {
|
|
64
|
+
label: "적용",
|
|
65
|
+
onClick: N,
|
|
66
|
+
loading: y
|
|
67
|
+
},
|
|
68
|
+
secondaryAction: {
|
|
69
|
+
label: "닫기",
|
|
70
|
+
onClick: () => T(!1)
|
|
71
|
+
},
|
|
72
|
+
children: /* @__PURE__ */ f(c.Provider, {
|
|
73
|
+
value: !0,
|
|
74
|
+
children: /* @__PURE__ */ p("div", {
|
|
75
|
+
className: "flex flex-col gap-4",
|
|
76
|
+
children: [m.filter((e) => !e.hidden).map((e) => /* @__PURE__ */ f(l, {
|
|
77
|
+
field: e,
|
|
78
|
+
value: E[e.key] ?? "",
|
|
79
|
+
onChange: (t) => D(e.key, t),
|
|
80
|
+
onEnter: N,
|
|
81
|
+
size: "small"
|
|
82
|
+
}, e.key)), b && /* @__PURE__ */ f("div", {
|
|
83
|
+
className: "flex justify-end",
|
|
84
|
+
children: /* @__PURE__ */ f(o, {
|
|
85
|
+
value: b.value,
|
|
86
|
+
onChange: b.onChange,
|
|
87
|
+
size: "small"
|
|
88
|
+
})
|
|
89
|
+
})]
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
}) : /* @__PURE__ */ p("div", {
|
|
95
|
+
className: `w-full ${x}`,
|
|
96
|
+
children: [/* @__PURE__ */ p("div", {
|
|
97
|
+
className: "flex w-full flex-wrap items-center gap-x-3 gap-y-2",
|
|
98
|
+
children: [m.filter((e) => !e.hidden).map((e) => /* @__PURE__ */ f("div", {
|
|
99
|
+
className: e.className ?? "w-44",
|
|
100
|
+
children: /* @__PURE__ */ f(l, {
|
|
101
|
+
field: e,
|
|
102
|
+
value: E[e.key] ?? "",
|
|
103
|
+
onChange: (t) => D(e.key, t),
|
|
104
|
+
onEnter: M,
|
|
105
|
+
size: C
|
|
106
|
+
})
|
|
107
|
+
}, e.key)), /* @__PURE__ */ p("div", {
|
|
108
|
+
className: "ml-auto flex items-center gap-3",
|
|
109
|
+
children: [b && /* @__PURE__ */ f(o, {
|
|
110
|
+
value: b.value,
|
|
111
|
+
onChange: b.onChange,
|
|
112
|
+
size: C
|
|
113
|
+
}), /* @__PURE__ */ p("div", {
|
|
114
|
+
className: "flex items-center gap-2",
|
|
115
|
+
children: [/* @__PURE__ */ f(e, {
|
|
116
|
+
variant: "tertiary",
|
|
117
|
+
appearance: "outlined",
|
|
118
|
+
size: C,
|
|
119
|
+
onClick: k,
|
|
120
|
+
leadingIcon: /* @__PURE__ */ f(n, { className: "h-3.5 w-3.5" }),
|
|
121
|
+
className: "h-10 border-border-tertiary! dark:border-border-secondary!",
|
|
122
|
+
children: "초기화"
|
|
123
|
+
}), /* @__PURE__ */ f(e, {
|
|
124
|
+
variant: "primary",
|
|
125
|
+
size: C,
|
|
126
|
+
onClick: M,
|
|
127
|
+
loading: y,
|
|
128
|
+
leadingIcon: /* @__PURE__ */ f(r, { className: "h-3.5 w-3.5" }),
|
|
129
|
+
className: "h-10",
|
|
130
|
+
children: "검색"
|
|
131
|
+
})]
|
|
132
|
+
})]
|
|
133
|
+
})]
|
|
134
|
+
}), A.length > 0 && /* @__PURE__ */ f("div", {
|
|
135
|
+
className: "mt-2",
|
|
136
|
+
children: /* @__PURE__ */ f(s, {
|
|
137
|
+
chips: A,
|
|
138
|
+
onRemove: j
|
|
139
|
+
})
|
|
140
|
+
})]
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function h({ label: e, onClick: t, icon: n, variant: r, disabled: i, activeDot: a }) {
|
|
144
|
+
return /* @__PURE__ */ p("button", {
|
|
145
|
+
type: "button",
|
|
146
|
+
"aria-label": e,
|
|
147
|
+
onClick: t,
|
|
148
|
+
disabled: i,
|
|
149
|
+
className: `relative inline-flex h-9 w-9 items-center justify-center rounded-lg transition-colors disabled:opacity-50 ${r === "primary" ? "bg-primary-500 text-white hover:bg-primary-600" : "text-icon-secondary hover:bg-bg-base-secondary"}`,
|
|
150
|
+
children: [n, a && /* @__PURE__ */ f("span", { className: "absolute top-1.5 right-1.5 h-1.5 w-1.5 rounded-full bg-primary-500" })]
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
export { m as SearchBox };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../node_modules/lucide-react/dist/esm/icons/x.cjs.js"),t=require("../tooltip/Tooltip.cjs.js");let n=require("react/jsx-runtime");function r({chips:r,onRemove:i}){return r.length===0?null:(0,n.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:r.map(r=>(0,n.jsx)(t.Tooltip,{content:`${r.label} | ${r.valueLabel}`,position:`top`,children:(0,n.jsxs)(`button`,{type:`button`,onClick:()=>i(r.key),className:`inline-flex max-w-65 items-center gap-1.5 rounded-full border border-primary-200 bg-primary-50 px-2 py-0.5 text-xs text-primary-700 transition-colors hover:bg-primary-100 dark:border-primary-800 dark:bg-primary-900/30 dark:text-primary-300 dark:hover:bg-primary-900/50`,"aria-label":`${r.label} 필터 제거`,children:[(0,n.jsx)(`span`,{className:`shrink-0 text-text-tertiary`,children:r.label}),(0,n.jsx)(`span`,{className:`text-primary-300 dark:text-primary-700`,children:`|`}),(0,n.jsx)(`span`,{className:`truncate font-medium`,children:r.valueLabel}),(0,n.jsx)(e.X,{className:`h-3 w-3 shrink-0`})]})},r.key))})}exports.SearchBoxChips=r;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { X as e } from "../../node_modules/lucide-react/dist/esm/icons/x.esm.js";
|
|
2
|
+
import { Tooltip as t } from "../tooltip/Tooltip.esm.js";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/search-box/SearchBoxChips.tsx
|
|
5
|
+
function i({ chips: i, onRemove: a }) {
|
|
6
|
+
return i.length === 0 ? null : /* @__PURE__ */ n("div", {
|
|
7
|
+
className: "flex flex-wrap items-center gap-1.5",
|
|
8
|
+
children: i.map((i) => /* @__PURE__ */ n(t, {
|
|
9
|
+
content: `${i.label} | ${i.valueLabel}`,
|
|
10
|
+
position: "top",
|
|
11
|
+
children: /* @__PURE__ */ r("button", {
|
|
12
|
+
type: "button",
|
|
13
|
+
onClick: () => a(i.key),
|
|
14
|
+
className: "inline-flex max-w-65 items-center gap-1.5 rounded-full border border-primary-200 bg-primary-50 px-2 py-0.5 text-xs text-primary-700 transition-colors hover:bg-primary-100 dark:border-primary-800 dark:bg-primary-900/30 dark:text-primary-300 dark:hover:bg-primary-900/50",
|
|
15
|
+
"aria-label": `${i.label} 필터 제거`,
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ n("span", {
|
|
18
|
+
className: "shrink-0 text-text-tertiary",
|
|
19
|
+
children: i.label
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ n("span", {
|
|
22
|
+
className: "text-primary-300 dark:text-primary-700",
|
|
23
|
+
children: "|"
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ n("span", {
|
|
26
|
+
className: "truncate font-medium",
|
|
27
|
+
children: i.valueLabel
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ n(e, { className: "h-3 w-3 shrink-0" })
|
|
30
|
+
]
|
|
31
|
+
})
|
|
32
|
+
}, i.key))
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { i as SearchBoxChips };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../button/Button.cjs.js"),t=require("../date-input/DateInput.cjs.js"),n=require("./parseDateRange.cjs.js"),r=require("./SearchBoxSheetContext.cjs.js");let i=require("react"),a=require("react/jsx-runtime");function o({value:o,onChange:s,presets:c,size:l}){let{from:u,to:d}=n.parseDateRangeValue(o),f=(0,i.useContext)(r.SearchBoxSheetContext),p=(0,i.useMemo)(()=>c?.map(e=>({preset:e,range:e.range()}))??[],[c]),m=e=>{let t=e.range();s(n.serializeDateRangeValue(t.from,t.to))};return(0,a.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,a.jsx)(t.DateInput,{value:u,onChange:e=>s(n.serializeDateRangeValue(e,d)),size:l,ariaLabel:`시작일`,disableMobileSheet:f}),(0,a.jsx)(`span`,{className:`text-neutral-400`,children:`~`}),(0,a.jsx)(t.DateInput,{value:d,onChange:e=>s(n.serializeDateRangeValue(u,e)),size:l,ariaLabel:`종료일`,disableMobileSheet:f})]}),p.length>0&&(0,a.jsx)(`div`,{className:`flex items-center gap-1`,children:p.map(({preset:t,range:n})=>{let r=u===n.from&&d===n.to;return(0,a.jsx)(e.Button,{variant:r?`primary`:`tertiary`,appearance:r?`filled`:`outlined`,size:l,onClick:()=>m(t),className:`whitespace-nowrap ${l===`small`?`h-10`:``} ${r?``:`border-border-tertiary! dark:border-border-secondary!`}`,children:t.label},t.label)})})]})}exports.SearchBoxDateRange=o;
|