@seed-design/react 2.1.0 → 2.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/lib/components/DatePicker/DatePicker.cjs +351 -0
- package/lib/components/DatePicker/DatePicker.d.ts +39 -0
- package/lib/components/DatePicker/DatePicker.d.ts.map +1 -0
- package/lib/components/DatePicker/DatePicker.js +345 -0
- package/lib/components/DatePicker/DatePicker.test.d.ts +2 -0
- package/lib/components/DatePicker/DatePicker.test.d.ts.map +1 -0
- package/lib/components/DatePicker/index.cjs +62 -0
- package/lib/components/DatePicker/index.d.ts +3 -0
- package/lib/components/DatePicker/index.d.ts.map +1 -0
- package/lib/components/DatePicker/index.js +3 -0
- package/lib/components/QuantityPicker/QuantityPicker.d.ts +13 -1
- package/lib/components/QuantityPicker/QuantityPicker.d.ts.map +1 -1
- package/lib/components/TimePicker/TimePicker.cjs +97 -0
- package/lib/components/TimePicker/TimePicker.d.ts +28 -0
- package/lib/components/TimePicker/TimePicker.d.ts.map +1 -0
- package/lib/components/TimePicker/TimePicker.js +94 -0
- package/lib/components/TimePicker/TimePicker.test.d.ts +2 -0
- package/lib/components/TimePicker/TimePicker.test.d.ts.map +1 -0
- package/lib/components/TimePicker/index.cjs +3 -0
- package/lib/components/TimePicker/index.d.ts +2 -0
- package/lib/components/TimePicker/index.d.ts.map +1 -0
- package/lib/components/TimePicker/index.js +2 -0
- package/lib/components/index.cjs +63 -1
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +5 -2
- package/lib/components/private/WheelPicker.cjs +64 -0
- package/lib/components/private/WheelPicker.d.ts +16 -0
- package/lib/components/private/WheelPicker.d.ts.map +1 -0
- package/lib/components/private/WheelPicker.js +59 -0
- package/lib/components/private/WheelPicker.test.d.ts +2 -0
- package/lib/components/private/WheelPicker.test.d.ts.map +1 -0
- package/lib/index.cjs +63 -1
- package/lib/index.js +5 -2
- package/package.json +8 -5
- package/src/components/DatePicker/DatePicker.test.tsx +234 -0
- package/src/components/DatePicker/DatePicker.tsx +574 -0
- package/src/components/DatePicker/index.ts +34 -0
- package/src/components/QuantityPicker/QuantityPicker.test.tsx +10 -0
- package/src/components/QuantityPicker/QuantityPicker.tsx +14 -2
- package/src/components/TimePicker/TimePicker.test.tsx +166 -0
- package/src/components/TimePicker/TimePicker.tsx +163 -0
- package/src/components/TimePicker/index.ts +6 -0
- package/src/components/index.ts +2 -0
- package/src/components/private/WheelPicker.test.tsx +54 -0
- package/src/components/private/WheelPicker.tsx +110 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_styled = require("../../utils/styled.cjs");
|
|
5
|
+
const require_Icon = require("../Icon/Icon.cjs");
|
|
6
|
+
const require_ActionButton = require("../ActionButton/ActionButton.cjs");
|
|
7
|
+
const require_WheelPicker = require("../private/WheelPicker.cjs");
|
|
8
|
+
let _seed_design_react_primitive = require("@seed-design/react-primitive");
|
|
9
|
+
let clsx = require("clsx");
|
|
10
|
+
clsx = require_runtime.__toESM(clsx);
|
|
11
|
+
let react = require("react");
|
|
12
|
+
react = require_runtime.__toESM(react);
|
|
13
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
|
+
let _seed_design_dom_utils = require("@seed-design/dom-utils");
|
|
15
|
+
let _radix_ui_react_compose_refs = require("@radix-ui/react-compose-refs");
|
|
16
|
+
let _seed_design_css_recipes_date_picker = require("@seed-design/css/recipes/date-picker");
|
|
17
|
+
let _seed_design_react_date_picker = require("@seed-design/react-date-picker");
|
|
18
|
+
//#region src/components/DatePicker/DatePicker.tsx
|
|
19
|
+
var WHEEL_ITEM_SIZE = 44;
|
|
20
|
+
var WHEEL_VISIBLE_ITEM_COUNT = 7;
|
|
21
|
+
function getContinuousSpacerStyle(height) {
|
|
22
|
+
return { "--seed-date-picker-continuous-spacer-height": `${height}px` };
|
|
23
|
+
}
|
|
24
|
+
var NavigationChevronIcon = react.forwardRef(({ direction, ...props }, ref) => {
|
|
25
|
+
const path = direction === "left" ? "M22.7931 13.0704C23.0788 13.3703 23.0672 13.8451 22.7673 14.1307L16.5875 20.0166L22.7672 25.9017C23.0672 26.1873 23.0788 26.6621 22.7931 26.962C22.5075 27.262 22.0327 27.2736 21.7328 26.9879L14.9828 20.5598C14.8341 20.4182 14.75 20.2219 14.75 20.0167C14.75 19.8114 14.8341 19.6151 14.9827 19.4736L21.7327 13.0446C22.0327 12.7589 22.5074 12.7704 22.7931 13.0704Z" : "M17.2069 13.0704C16.9212 13.3703 16.9328 13.8451 17.2327 14.1307L23.4125 20.0166L17.2328 25.9017C16.9328 26.1873 16.9212 26.6621 17.2069 26.962C17.4925 27.262 17.9673 27.2736 18.2672 26.9879L25.0172 20.5598C25.1659 20.4182 25.25 20.2219 25.25 20.0167C25.25 19.8114 25.1659 19.6151 25.0173 19.4736L18.2673 13.0446C17.9673 12.7589 17.4926 12.7704 17.2069 13.0704Z";
|
|
26
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
27
|
+
ref,
|
|
28
|
+
...props,
|
|
29
|
+
viewBox: "8 8 24 24",
|
|
30
|
+
fill: "none",
|
|
31
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
32
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
33
|
+
fillRule: "evenodd",
|
|
34
|
+
clipRule: "evenodd",
|
|
35
|
+
d: path,
|
|
36
|
+
fill: "currentColor"
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
NavigationChevronIcon.displayName = "NavigationChevronIcon";
|
|
41
|
+
var HeaderChevronIcon = react.forwardRef(({ expanded, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
42
|
+
ref,
|
|
43
|
+
...props,
|
|
44
|
+
viewBox: "0 0 20 20",
|
|
45
|
+
fill: "none",
|
|
46
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
47
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
48
|
+
fillRule: "evenodd",
|
|
49
|
+
clipRule: "evenodd",
|
|
50
|
+
d: "M5.2453 7.74286C5.57141 7.4181 6.09905 7.41919 6.42381 7.7453L9.98736 11.3237L13.5808 7.77134C13.9081 7.44778 14.4357 7.45081 14.7593 7.77812C15.0829 8.10542 15.0798 8.63305 14.7525 8.95661L10.5686 13.0926C10.2422 13.4154 9.7162 13.4133 9.39228 13.088L5.24286 8.92137C4.9181 8.59526 4.91919 8.06762 5.2453 7.74286Z",
|
|
51
|
+
fill: "currentColor",
|
|
52
|
+
transform: expanded ? "rotate(180 10 10)" : void 0
|
|
53
|
+
})
|
|
54
|
+
}));
|
|
55
|
+
HeaderChevronIcon.displayName = "HeaderChevronIcon";
|
|
56
|
+
function WeekdayRow({ api, classNames, semantic = true }) {
|
|
57
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
58
|
+
role: semantic ? "row" : void 0,
|
|
59
|
+
"aria-hidden": semantic ? void 0 : true,
|
|
60
|
+
className: classNames.weekdayRow,
|
|
61
|
+
children: api.weekdayLabels.map((weekday) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
62
|
+
role: semantic ? "columnheader" : void 0,
|
|
63
|
+
"aria-label": semantic ? weekday.long : void 0,
|
|
64
|
+
className: classNames.weekday,
|
|
65
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
66
|
+
"aria-hidden": "true",
|
|
67
|
+
children: weekday.short
|
|
68
|
+
})
|
|
69
|
+
}, weekday.key))
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function DateCellView({ cell, classNames, renderDateCellContent, renderDateCellSupplement }) {
|
|
73
|
+
if (cell === null) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
74
|
+
role: "gridcell",
|
|
75
|
+
className: classNames.emptyCell
|
|
76
|
+
});
|
|
77
|
+
const { cellProps, buttonProps, key: _key, ...renderProps } = cell;
|
|
78
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
79
|
+
...cellProps,
|
|
80
|
+
className: classNames.dateCell,
|
|
81
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.button, {
|
|
82
|
+
...buttonProps,
|
|
83
|
+
className: classNames.dateButton,
|
|
84
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.span, {
|
|
85
|
+
className: classNames.dateContent,
|
|
86
|
+
children: renderDateCellContent ? renderDateCellContent(renderProps) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.span, {
|
|
87
|
+
"data-date-picker-day": "",
|
|
88
|
+
children: cell.formattedDay
|
|
89
|
+
}), renderDateCellSupplement?.(renderProps)] })
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function MonthView({ api, classNames, month, renderDateCellContent, renderDateCellSupplement, showWeekdays, showMonthLabel, renderHeader, monthRef }) {
|
|
95
|
+
const labelId = `${api.rootProps.id}-${month.key}-label`;
|
|
96
|
+
const headerLabelId = `${api.rootProps.id}-header-label`;
|
|
97
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_seed_design_react_primitive.Primitive.div, {
|
|
98
|
+
ref: monthRef,
|
|
99
|
+
className: classNames.month,
|
|
100
|
+
children: [
|
|
101
|
+
renderHeader?.(labelId),
|
|
102
|
+
showMonthLabel ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
103
|
+
id: labelId,
|
|
104
|
+
className: classNames.monthLabel,
|
|
105
|
+
children: month.label
|
|
106
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.span, {
|
|
107
|
+
id: labelId,
|
|
108
|
+
className: classNames.liveRegion,
|
|
109
|
+
children: month.label
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_seed_design_react_primitive.Primitive.div, {
|
|
112
|
+
...api.gridProps,
|
|
113
|
+
"aria-labelledby": showMonthLabel || renderHeader ? labelId : api.visibleRange === "month" ? headerLabelId : labelId,
|
|
114
|
+
className: classNames.grid,
|
|
115
|
+
children: [showWeekdays && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WeekdayRow, {
|
|
116
|
+
api,
|
|
117
|
+
classNames
|
|
118
|
+
}), month.weeks.map((week) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
119
|
+
role: "row",
|
|
120
|
+
className: classNames.weekRow,
|
|
121
|
+
children: week.cells.map((cell, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DateCellView, {
|
|
122
|
+
cell,
|
|
123
|
+
classNames,
|
|
124
|
+
renderDateCellContent,
|
|
125
|
+
renderDateCellSupplement
|
|
126
|
+
}, cell?.key ?? `${week.key}-empty-${index}`))
|
|
127
|
+
}, week.key))]
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function NavigationButton({ direction, className, ...props }) {
|
|
133
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ActionButton.ActionButton, {
|
|
134
|
+
...props,
|
|
135
|
+
variant: "ghost",
|
|
136
|
+
size: "medium",
|
|
137
|
+
layout: "iconOnly",
|
|
138
|
+
className,
|
|
139
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, { svg: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationChevronIcon, { direction }) })
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function Header({ api, classNames }) {
|
|
143
|
+
const previousDirection = api.isRtl ? "right" : "left";
|
|
144
|
+
const nextDirection = api.isRtl ? "left" : "right";
|
|
145
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_seed_design_react_primitive.Primitive.div, {
|
|
146
|
+
className: classNames.header,
|
|
147
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_seed_design_react_primitive.Primitive.button, {
|
|
148
|
+
...api.monthYearButtonProps,
|
|
149
|
+
id: `${api.rootProps.id}-header-label`,
|
|
150
|
+
className: classNames.headerLabel,
|
|
151
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.span, {
|
|
152
|
+
"data-date-picker-header-label": "",
|
|
153
|
+
children: api.headerLabel
|
|
154
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.span, {
|
|
155
|
+
className: classNames.headerChevron,
|
|
156
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, { svg: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeaderChevronIcon, { expanded: api.isWheelOpen }) })
|
|
157
|
+
})]
|
|
158
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_seed_design_react_primitive.Primitive.div, {
|
|
159
|
+
className: classNames.navigation,
|
|
160
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationButton, {
|
|
161
|
+
...api.previousButtonProps,
|
|
162
|
+
direction: previousDirection,
|
|
163
|
+
className: classNames.navigationButton
|
|
164
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationButton, {
|
|
165
|
+
...api.nextButtonProps,
|
|
166
|
+
direction: nextDirection,
|
|
167
|
+
className: classNames.navigationButton
|
|
168
|
+
})]
|
|
169
|
+
})]
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
function TwoMonthHeader({ api, classNames, label, labelId, position }) {
|
|
173
|
+
const isFirst = position === "first";
|
|
174
|
+
const direction = api.isRtl ? isFirst ? "right" : "left" : isFirst ? "left" : "right";
|
|
175
|
+
const buttonProps = isFirst ? api.previousButtonProps : api.nextButtonProps;
|
|
176
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_seed_design_react_primitive.Primitive.div, {
|
|
177
|
+
className: classNames.twoMonthHeader,
|
|
178
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
179
|
+
id: labelId,
|
|
180
|
+
className: classNames.twoMonthLabel,
|
|
181
|
+
children: label
|
|
182
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationButton, {
|
|
183
|
+
...buttonProps,
|
|
184
|
+
direction,
|
|
185
|
+
"data-placement": isFirst ? "start" : "end",
|
|
186
|
+
className: classNames.twoMonthNavigationButton
|
|
187
|
+
})]
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
function WheelView({ api, classNames }) {
|
|
191
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
192
|
+
className: classNames.wheelContainer,
|
|
193
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_WheelPicker.InternalWheelPickerRoot, {
|
|
194
|
+
...api.wheelProps,
|
|
195
|
+
itemSize: WHEEL_ITEM_SIZE,
|
|
196
|
+
visibleItemCount: WHEEL_VISIBLE_ITEM_COUNT,
|
|
197
|
+
disabled: api.disabled,
|
|
198
|
+
readOnly: api.readOnly,
|
|
199
|
+
"aria-label": api.headerLabel,
|
|
200
|
+
className: classNames.wheelView,
|
|
201
|
+
columnsClassName: classNames.wheelColumns,
|
|
202
|
+
scrollFogClassName: classNames.wheelScrollFog,
|
|
203
|
+
selectionIndicatorClassName: classNames.wheelSelectionIndicator,
|
|
204
|
+
fogSize: 102,
|
|
205
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_WheelPicker.InternalWheelPickerColumn, {
|
|
206
|
+
"aria-label": api.ariaLabels.yearWheel,
|
|
207
|
+
className: classNames.yearColumn,
|
|
208
|
+
itemClassName: classNames.wheelItem,
|
|
209
|
+
options: api.wheel.yearOptions,
|
|
210
|
+
value: api.wheel.yearValue,
|
|
211
|
+
onValueChange: api.wheel.onYearValueChange,
|
|
212
|
+
loop: false
|
|
213
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_WheelPicker.InternalWheelPickerColumn, {
|
|
214
|
+
"aria-label": api.ariaLabels.monthWheel,
|
|
215
|
+
className: classNames.monthColumn,
|
|
216
|
+
itemClassName: classNames.wheelItem,
|
|
217
|
+
options: api.wheel.monthOptions,
|
|
218
|
+
value: api.wheel.monthValue,
|
|
219
|
+
onValueChange: api.wheel.onMonthValueChange,
|
|
220
|
+
loop: true
|
|
221
|
+
})]
|
|
222
|
+
})
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
var DatePickerImplementation = react.forwardRef((props, forwardedRef) => {
|
|
226
|
+
const api = (0, _seed_design_react_date_picker.useDatePicker)(props);
|
|
227
|
+
const [variantProps, otherProps] = _seed_design_css_recipes_date_picker.datePicker.splitVariantProps(props);
|
|
228
|
+
const classNames = (0, _seed_design_css_recipes_date_picker.datePicker)({
|
|
229
|
+
...variantProps,
|
|
230
|
+
visibleRange: api.visibleRange
|
|
231
|
+
});
|
|
232
|
+
const { renderDateCellContent, renderDateCellSupplement, actionsRef, selectionMode: _selectionMode, value: _value, defaultValue: _defaultValue, onValueChange: _onValueChange, viewDate: _viewDate, defaultViewDate: _defaultViewDate, onViewDateChange: _onViewDateChange, today: _today, locale: _locale, weekStartsOn: _weekStartsOn, yearRange: _yearRange, constraints: _constraints, disabled: _disabled, readOnly: _readOnly, ariaLabels: _ariaLabels, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ...styleAndRootProps } = otherProps;
|
|
233
|
+
const { style: styleProps, restProps: rootProps } = require_styled.useStyleProps(styleAndRootProps);
|
|
234
|
+
const rootRef = react.useRef(null);
|
|
235
|
+
const hasContinuousSizeConstraint = props.height !== void 0 || props.minHeight !== void 0 || props.maxHeight !== void 0;
|
|
236
|
+
react.useEffect(() => {
|
|
237
|
+
if (process.env.NODE_ENV === "production" || api.visibleRange !== "continuous") return;
|
|
238
|
+
if (!hasContinuousSizeConstraint) console.warn("ContinuousDatePicker: height, minHeight 또는 maxHeight가 필요합니다.");
|
|
239
|
+
}, [api.visibleRange, hasContinuousSizeConstraint]);
|
|
240
|
+
react.useImperativeHandle(actionsRef, () => api.actions, [api.actions]);
|
|
241
|
+
const rootAriaLabel = ariaLabelledby ? ariaLabel : ariaLabel ?? api.ariaLabels.root;
|
|
242
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_seed_design_react_primitive.Primitive.div, {
|
|
243
|
+
ref: (0, _radix_ui_react_compose_refs.composeRefs)(forwardedRef, rootRef, api.refs.root),
|
|
244
|
+
...(0, _seed_design_dom_utils.mergeProps)(api.rootProps, rootProps),
|
|
245
|
+
"aria-label": rootAriaLabel,
|
|
246
|
+
"aria-labelledby": ariaLabelledby,
|
|
247
|
+
className: (0, clsx.default)(classNames.root, className),
|
|
248
|
+
style: styleProps,
|
|
249
|
+
children: [api.visibleRange === "continuous" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_seed_design_react_primitive.Primitive.div, {
|
|
250
|
+
ref: api.refs.continuousScroll,
|
|
251
|
+
...api.continuousScrollProps,
|
|
252
|
+
"data-date-picker-continuous-scroll": "",
|
|
253
|
+
className: classNames.continuousScroll,
|
|
254
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(WeekdayRow, {
|
|
255
|
+
api,
|
|
256
|
+
classNames,
|
|
257
|
+
semantic: false
|
|
258
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_seed_design_react_primitive.Primitive.div, {
|
|
259
|
+
className: classNames.continuousContent,
|
|
260
|
+
children: [
|
|
261
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
262
|
+
"aria-hidden": "true",
|
|
263
|
+
"data-date-picker-continuous-spacer": "",
|
|
264
|
+
className: classNames.continuousSpacer,
|
|
265
|
+
style: getContinuousSpacerStyle(api.virtual.topHeight)
|
|
266
|
+
}),
|
|
267
|
+
api.months.map((month) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MonthView, {
|
|
268
|
+
api,
|
|
269
|
+
classNames,
|
|
270
|
+
month,
|
|
271
|
+
renderDateCellContent,
|
|
272
|
+
renderDateCellSupplement,
|
|
273
|
+
showWeekdays: false,
|
|
274
|
+
showMonthLabel: true,
|
|
275
|
+
monthRef: api.refs.continuousMonth(month.key)
|
|
276
|
+
}, month.key)),
|
|
277
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
278
|
+
"aria-hidden": "true",
|
|
279
|
+
"data-date-picker-continuous-spacer": "",
|
|
280
|
+
className: classNames.continuousSpacer,
|
|
281
|
+
style: getContinuousSpacerStyle(api.virtual.bottomHeight)
|
|
282
|
+
})
|
|
283
|
+
]
|
|
284
|
+
})]
|
|
285
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
286
|
+
api.visibleRange !== "twoMonths" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Header, {
|
|
287
|
+
api,
|
|
288
|
+
classNames
|
|
289
|
+
}),
|
|
290
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
291
|
+
"data-wheel-open": api.isWheelOpen && api.visibleRange !== "twoMonths" ? "" : void 0,
|
|
292
|
+
"aria-hidden": api.isWheelOpen && api.visibleRange !== "twoMonths" ? true : void 0,
|
|
293
|
+
className: classNames.months,
|
|
294
|
+
children: api.months.map((month, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MonthView, {
|
|
295
|
+
api,
|
|
296
|
+
classNames,
|
|
297
|
+
month,
|
|
298
|
+
renderDateCellContent,
|
|
299
|
+
renderDateCellSupplement,
|
|
300
|
+
showWeekdays: true,
|
|
301
|
+
showMonthLabel: false,
|
|
302
|
+
renderHeader: api.visibleRange === "twoMonths" ? (labelId) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TwoMonthHeader, {
|
|
303
|
+
api,
|
|
304
|
+
classNames,
|
|
305
|
+
label: month.label,
|
|
306
|
+
labelId,
|
|
307
|
+
position: index === 0 ? "first" : "last"
|
|
308
|
+
}) : void 0
|
|
309
|
+
}, month.key))
|
|
310
|
+
}),
|
|
311
|
+
api.isWheelOpen && api.visibleRange !== "twoMonths" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WheelView, {
|
|
312
|
+
api,
|
|
313
|
+
classNames
|
|
314
|
+
})
|
|
315
|
+
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.span, {
|
|
316
|
+
...api.liveRegionProps,
|
|
317
|
+
className: classNames.liveRegion,
|
|
318
|
+
children: api.headerLabel
|
|
319
|
+
})]
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
DatePickerImplementation.displayName = "DatePickerImplementation";
|
|
323
|
+
var DatePicker = react.forwardRef((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DatePickerImplementation, {
|
|
324
|
+
ref,
|
|
325
|
+
...props,
|
|
326
|
+
visibleRange: "month"
|
|
327
|
+
}));
|
|
328
|
+
DatePicker.displayName = "DatePicker";
|
|
329
|
+
var TwoMonthDatePicker = react.forwardRef((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DatePickerImplementation, {
|
|
330
|
+
ref,
|
|
331
|
+
...props,
|
|
332
|
+
visibleRange: "twoMonths"
|
|
333
|
+
}));
|
|
334
|
+
TwoMonthDatePicker.displayName = "TwoMonthDatePicker";
|
|
335
|
+
var WeekDatePicker = react.forwardRef((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DatePickerImplementation, {
|
|
336
|
+
ref,
|
|
337
|
+
...props,
|
|
338
|
+
visibleRange: "week"
|
|
339
|
+
}));
|
|
340
|
+
WeekDatePicker.displayName = "WeekDatePicker";
|
|
341
|
+
var ContinuousDatePicker = react.forwardRef((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DatePickerImplementation, {
|
|
342
|
+
ref,
|
|
343
|
+
...props,
|
|
344
|
+
visibleRange: "continuous"
|
|
345
|
+
}));
|
|
346
|
+
ContinuousDatePicker.displayName = "ContinuousDatePicker";
|
|
347
|
+
//#endregion
|
|
348
|
+
exports.ContinuousDatePicker = ContinuousDatePicker;
|
|
349
|
+
exports.DatePicker = DatePicker;
|
|
350
|
+
exports.TwoMonthDatePicker = TwoMonthDatePicker;
|
|
351
|
+
exports.WeekDatePicker = WeekDatePicker;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { DatePickerActions, DatePickerCellState, UseDatePickerProps } from '@seed-design/react-date-picker';
|
|
2
|
+
import { PrimitiveProps } from '@seed-design/react-primitive';
|
|
3
|
+
import { StyleProps } from '../../utils/styled';
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
type DatePickerRootProps = PrimitiveProps & Pick<StyleProps, "height" | "minHeight" | "maxHeight"> & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "defaultValue" | "onChange" | "onValueChange">;
|
|
6
|
+
export interface DatePickerCellContentRenderProps extends DatePickerCellState {
|
|
7
|
+
}
|
|
8
|
+
type DatePickerBehaviorProps = UseDatePickerProps extends infer Props ? Props extends UseDatePickerProps ? Omit<Props, "visibleRange"> : never : never;
|
|
9
|
+
type DatePickerCellCustomization = {
|
|
10
|
+
/**
|
|
11
|
+
* 기본 날짜 숫자 아래에 부가 콘텐츠를 추가합니다.
|
|
12
|
+
* 날짜 숫자를 유지하는 대부분의 사례에서는 이 prop을 우선 사용하세요.
|
|
13
|
+
*/
|
|
14
|
+
renderDateCellSupplement?: (props: DatePickerCellContentRenderProps) => React.ReactNode;
|
|
15
|
+
renderDateCellContent?: never;
|
|
16
|
+
} | {
|
|
17
|
+
/**
|
|
18
|
+
* `renderDateCellSupplement`로 표현할 수 없을 때 내부 콘텐츠 전체를 교체하는
|
|
19
|
+
* 저수준 이스케이프 해치입니다. 날짜 셀의 접근성·인터랙션 구조는 유지됩니다.
|
|
20
|
+
*/
|
|
21
|
+
renderDateCellContent?: (props: DatePickerCellContentRenderProps) => React.ReactNode;
|
|
22
|
+
renderDateCellSupplement?: never;
|
|
23
|
+
};
|
|
24
|
+
type DatePickerSharedProps = DatePickerBehaviorProps & DatePickerRootProps & {
|
|
25
|
+
/** 날짜 이동과 포커스 action을 받는 ref입니다. */
|
|
26
|
+
actionsRef?: React.Ref<DatePickerActions>;
|
|
27
|
+
} & DatePickerCellCustomization;
|
|
28
|
+
type ContinuousSizeConstraint = (Required<Pick<StyleProps, "height">> & Pick<StyleProps, "minHeight" | "maxHeight">) | (Required<Pick<StyleProps, "minHeight">> & Pick<StyleProps, "height" | "maxHeight">) | (Required<Pick<StyleProps, "maxHeight">> & Pick<StyleProps, "height" | "minHeight">);
|
|
29
|
+
export type DatePickerProps = DatePickerSharedProps;
|
|
30
|
+
export type TwoMonthDatePickerProps = DatePickerSharedProps;
|
|
31
|
+
export type WeekDatePickerProps = DatePickerSharedProps;
|
|
32
|
+
type DatePickerPropsWithoutSize<Props = DatePickerSharedProps> = Props extends DatePickerSharedProps ? Omit<Props, "height" | "minHeight" | "maxHeight"> : never;
|
|
33
|
+
export type ContinuousDatePickerProps = DatePickerPropsWithoutSize & ContinuousSizeConstraint;
|
|
34
|
+
export declare const DatePicker: React.ForwardRefExoticComponent<DatePickerSharedProps & React.RefAttributes<HTMLDivElement>>;
|
|
35
|
+
export declare const TwoMonthDatePicker: React.ForwardRefExoticComponent<DatePickerSharedProps & React.RefAttributes<HTMLDivElement>>;
|
|
36
|
+
export declare const WeekDatePicker: React.ForwardRefExoticComponent<DatePickerSharedProps & React.RefAttributes<HTMLDivElement>>;
|
|
37
|
+
export declare const ContinuousDatePicker: React.ForwardRefExoticComponent<ContinuousDatePickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
38
|
+
export type { DatePickerActions, DatePickerAriaLabels, DatePickerConstraint, DatePickerConstraintContext, DatePickerDate, DatePickerMultipleProps, DatePickerRangeProps, DatePickerRangeValue, DatePickerSelectionMode, DatePickerSingleProps, DatePickerValue, } from '@seed-design/react-date-picker';
|
|
39
|
+
//# sourceMappingURL=DatePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,iBAAiB,EAEtB,KAAK,mBAAmB,EAGxB,KAAK,kBAAkB,EACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAgBpE,KAAK,mBAAmB,GAAG,cAAc,GACvC,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC,GACtD,IAAI,CACF,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,UAAU,GAAG,cAAc,GAAG,UAAU,GAAG,eAAe,CAC3D,CAAC;AAEJ,MAAM,WAAW,gCAAiC,SAAQ,mBAAmB;CAAG;AAEhF,KAAK,uBAAuB,GAAG,kBAAkB,SAAS,MAAM,KAAK,GACjE,KAAK,SAAS,kBAAkB,GAC9B,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC,GAC3B,KAAK,GACP,KAAK,CAAC;AAEV,KAAK,2BAA2B,GAC5B;IACE;;;OAGG;IACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,gCAAgC,KAAK,KAAK,CAAC,SAAS,CAAC;IACxF,qBAAqB,CAAC,EAAE,KAAK,CAAC;CAC/B,GACD;IACE;;;OAGG;IACH,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,gCAAgC,KAAK,KAAK,CAAC,SAAS,CAAC;IACrF,wBAAwB,CAAC,EAAE,KAAK,CAAC;CAClC,CAAC;AAEN,KAAK,qBAAqB,GAAG,uBAAuB,GAClD,mBAAmB,GAAG;IACpB,oCAAoC;IACpC,UAAU,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;CAC3C,GAAG,2BAA2B,CAAC;AAElC,KAAK,wBAAwB,GACzB,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,WAAW,CAAC,CAAC,GACpF,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,WAAW,CAAC,CAAC,GACpF,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC;AAEzF,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AACpD,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAC5D,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AACxD,KAAK,0BAA0B,CAAC,KAAK,GAAG,qBAAqB,IAAI,KAAK,SAAS,qBAAqB,GAChG,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC,GACjD,KAAK,CAAC;AACV,MAAM,MAAM,yBAAyB,GAAG,0BAA0B,GAAG,wBAAwB,CAAC;AAyc9F,eAAO,MAAM,UAAU,8FAErB,CAAC;AAGH,eAAO,MAAM,kBAAkB,8FAE9B,CAAC;AAGF,eAAO,MAAM,cAAc,8FAE1B,CAAC;AAGF,eAAO,MAAM,oBAAoB,kGAEhC,CAAC;AAGF,YAAY,EACV,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,2BAA2B,EAC3B,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,GAChB,MAAM,gCAAgC,CAAC"}
|