@nexus-cross/design-system 1.0.8 → 1.0.10
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/chunks/{chunk-OE5BAEBE.js → chunk-6MT6Y6OF.js} +1 -1
- package/dist/chunks/{chunk-22O6YUYH.mjs → chunk-BMYFRG3M.mjs} +1 -1
- package/dist/chunks/chunk-FBC53TOS.mjs +99 -0
- package/dist/chunks/{chunk-2N2EPBO4.js → chunk-LTS674LF.js} +45 -43
- package/dist/chunks/{chunk-7G65JBTN.js → chunk-OX5MEJ7B.js} +2 -0
- package/dist/chunks/{chunk-DO6VK2QQ.mjs → chunk-QOREDNWO.mjs} +2 -0
- package/dist/components/DatePicker.d.ts.map +1 -1
- package/dist/components/Select.d.ts.map +1 -1
- package/dist/date-picker.js +2 -2
- package/dist/date-picker.mjs +1 -1
- package/dist/index.js +7 -7
- package/dist/index.mjs +2 -2
- package/dist/select.js +5 -5
- package/dist/select.mjs +1 -1
- package/dist/styles/.generated/built.d.ts +1 -1
- package/dist/styles/.generated/built.d.ts.map +1 -1
- package/dist/styles/layer.js +2 -2
- package/dist/styles/layer.mjs +1 -1
- package/dist/styles.css +137 -50
- package/dist/styles.js +2 -2
- package/dist/styles.layered.css +137 -50
- package/dist/styles.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunks/chunk-FUIBYZZ4.mjs +0 -98
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { cn } from './chunk-MCKOWMLS.mjs';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { DayPicker } from 'react-day-picker';
|
|
4
|
-
import { format } from 'date-fns';
|
|
5
|
-
import { ko } from 'date-fns/locale';
|
|
6
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
var CalendarIcon = ({ className }) => /* @__PURE__ */ jsxs("svg", { className, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
9
|
-
/* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "14", height: "14", rx: "2" }),
|
|
10
|
-
/* @__PURE__ */ jsx("path", { d: "M3 8h14M7 2v4M13 2v4", strokeLinecap: "round" })
|
|
11
|
-
] });
|
|
12
|
-
var DatePicker = ({
|
|
13
|
-
value,
|
|
14
|
-
defaultValue,
|
|
15
|
-
onChange,
|
|
16
|
-
placeholder = "\uB0A0\uC9DC \uC120\uD0DD",
|
|
17
|
-
disabled = false,
|
|
18
|
-
minDate,
|
|
19
|
-
maxDate,
|
|
20
|
-
locale: localeProp = "ko",
|
|
21
|
-
formatStr = "yyyy-MM-dd",
|
|
22
|
-
className
|
|
23
|
-
}) => {
|
|
24
|
-
const [internalDate, setInternalDate] = React.useState(defaultValue);
|
|
25
|
-
const [open, setOpen] = React.useState(false);
|
|
26
|
-
const wrapperRef = React.useRef(null);
|
|
27
|
-
const selected = value ?? internalDate;
|
|
28
|
-
const handleSelect = React.useCallback(
|
|
29
|
-
(date) => {
|
|
30
|
-
if (!value) setInternalDate(date);
|
|
31
|
-
onChange?.(date);
|
|
32
|
-
setOpen(false);
|
|
33
|
-
},
|
|
34
|
-
[value, onChange]
|
|
35
|
-
);
|
|
36
|
-
React.useEffect(() => {
|
|
37
|
-
const handleClickOutside = (e) => {
|
|
38
|
-
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
39
|
-
setOpen(false);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
if (open) document.addEventListener("mousedown", handleClickOutside);
|
|
43
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
44
|
-
}, [open]);
|
|
45
|
-
const displayText = selected ? format(selected, formatStr, { locale: localeProp === "ko" ? ko : void 0 }) : placeholder;
|
|
46
|
-
return /* @__PURE__ */ jsxs("div", { ref: wrapperRef, className: cn("nexus-datepicker", className), children: [
|
|
47
|
-
/* @__PURE__ */ jsxs(
|
|
48
|
-
"button",
|
|
49
|
-
{
|
|
50
|
-
type: "button",
|
|
51
|
-
className: cn(
|
|
52
|
-
"nexus-datepicker__trigger",
|
|
53
|
-
!selected && "nexus-datepicker__trigger--placeholder"
|
|
54
|
-
),
|
|
55
|
-
onClick: () => !disabled && setOpen(!open),
|
|
56
|
-
disabled,
|
|
57
|
-
children: [
|
|
58
|
-
/* @__PURE__ */ jsx(CalendarIcon, { className: "nexus-datepicker__icon" }),
|
|
59
|
-
/* @__PURE__ */ jsx("span", { children: displayText })
|
|
60
|
-
]
|
|
61
|
-
}
|
|
62
|
-
),
|
|
63
|
-
open && /* @__PURE__ */ jsx("div", { className: "nexus-datepicker__popover", children: /* @__PURE__ */ jsx(
|
|
64
|
-
DayPicker,
|
|
65
|
-
{
|
|
66
|
-
mode: "single",
|
|
67
|
-
selected,
|
|
68
|
-
onSelect: handleSelect,
|
|
69
|
-
locale: localeProp === "ko" ? ko : void 0,
|
|
70
|
-
disabled: [
|
|
71
|
-
...minDate ? [{ before: minDate }] : [],
|
|
72
|
-
...maxDate ? [{ after: maxDate }] : []
|
|
73
|
-
],
|
|
74
|
-
classNames: {
|
|
75
|
-
root: "nexus-calendar",
|
|
76
|
-
months: "nexus-calendar__months",
|
|
77
|
-
month_caption: "nexus-calendar__caption",
|
|
78
|
-
nav: "nexus-calendar__nav",
|
|
79
|
-
button_previous: "nexus-calendar__nav-btn",
|
|
80
|
-
button_next: "nexus-calendar__nav-btn",
|
|
81
|
-
month_grid: "nexus-calendar__grid",
|
|
82
|
-
weekdays: "nexus-calendar__head-row",
|
|
83
|
-
weekday: "nexus-calendar__head-cell",
|
|
84
|
-
week: "nexus-calendar__row",
|
|
85
|
-
day: "nexus-calendar__cell",
|
|
86
|
-
day_button: "nexus-calendar__day",
|
|
87
|
-
selected: "nexus-calendar__day--selected",
|
|
88
|
-
today: "nexus-calendar__day--today",
|
|
89
|
-
outside: "nexus-calendar__day--outside",
|
|
90
|
-
disabled: "nexus-calendar__day--disabled"
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
) })
|
|
94
|
-
] });
|
|
95
|
-
};
|
|
96
|
-
DatePicker.displayName = "DatePicker";
|
|
97
|
-
|
|
98
|
-
export { DatePicker };
|