@deepnoid/ui 0.0.89 → 0.0.91

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.
Files changed (117) hide show
  1. package/dist/chunk-75HLCORR.mjs +1 -0
  2. package/dist/chunk-D5GGG7IO.mjs +122 -0
  3. package/dist/{chunk-FPCP4OOL.mjs → chunk-EDEV4IK4.mjs} +3 -3
  4. package/dist/chunk-FWJ2ZKH6.mjs +87 -0
  5. package/dist/chunk-HHYPMVLY.mjs +359 -0
  6. package/dist/{chunk-HFVZFUC3.mjs → chunk-L7P6OBUX.mjs} +1 -1
  7. package/dist/chunk-P732YGHO.mjs +18 -0
  8. package/dist/{chunk-MOINJECK.mjs → chunk-S3O52LLG.mjs} +1 -2
  9. package/dist/chunk-WX32MAKV.mjs +219 -0
  10. package/dist/components/accordion/accordion.d.mts +2 -2
  11. package/dist/components/accordion/accordion.d.ts +2 -2
  12. package/dist/components/accordion/accordion.test.mjs +3 -3
  13. package/dist/components/accordion/accordionItem.d.mts +2 -2
  14. package/dist/components/accordion/accordionItem.d.ts +2 -2
  15. package/dist/components/button/button-group.d.mts +2 -2
  16. package/dist/components/button/button-group.d.ts +2 -2
  17. package/dist/components/button/button-group.test.mjs +3 -3
  18. package/dist/components/button/button.d.mts +2 -2
  19. package/dist/components/button/button.d.ts +2 -2
  20. package/dist/components/button/button.test.mjs +3 -3
  21. package/dist/components/card/card.d.mts +2 -2
  22. package/dist/components/card/card.d.ts +2 -2
  23. package/dist/components/checkbox/checkbox.d.mts +2 -2
  24. package/dist/components/checkbox/checkbox.d.ts +2 -2
  25. package/dist/components/checkbox/checkbox.test.mjs +3 -3
  26. package/dist/components/dateTimePicker/calendar.d.mts +118 -0
  27. package/dist/components/dateTimePicker/calendar.d.ts +118 -0
  28. package/dist/components/dateTimePicker/calendar.js +3854 -0
  29. package/dist/components/dateTimePicker/calendar.mjs +16 -0
  30. package/dist/components/dateTimePicker/dateTimePicker.d.mts +445 -0
  31. package/dist/components/dateTimePicker/dateTimePicker.d.ts +445 -0
  32. package/dist/components/dateTimePicker/dateTimePicker.js +4540 -0
  33. package/dist/components/dateTimePicker/dateTimePicker.mjs +22 -0
  34. package/dist/components/dateTimePicker/index.d.mts +5 -0
  35. package/dist/components/dateTimePicker/index.d.ts +5 -0
  36. package/dist/components/dateTimePicker/index.js +4541 -0
  37. package/dist/components/dateTimePicker/index.mjs +21 -0
  38. package/dist/components/dateTimePicker/timePicker.d.mts +11 -0
  39. package/dist/components/dateTimePicker/timePicker.d.ts +11 -0
  40. package/dist/components/dateTimePicker/timePicker.js +345 -0
  41. package/dist/components/dateTimePicker/timePicker.mjs +13 -0
  42. package/dist/components/dateTimePicker/useDateTimePicker.d.mts +34 -0
  43. package/dist/components/dateTimePicker/useDateTimePicker.d.ts +34 -0
  44. package/dist/components/dateTimePicker/useDateTimePicker.js +117 -0
  45. package/dist/components/dateTimePicker/useDateTimePicker.mjs +9 -0
  46. package/dist/components/dateTimePicker/util.d.mts +4 -0
  47. package/dist/components/dateTimePicker/util.d.ts +4 -0
  48. package/dist/components/dateTimePicker/util.js +42 -0
  49. package/dist/components/dateTimePicker/util.mjs +10 -0
  50. package/dist/components/input/input.d.mts +2 -2
  51. package/dist/components/input/input.d.ts +2 -2
  52. package/dist/components/input/input.test.mjs +1 -1
  53. package/dist/components/list/index.js +3 -3
  54. package/dist/components/list/index.mjs +1 -1
  55. package/dist/components/list/list.d.mts +2 -2
  56. package/dist/components/list/list.d.ts +2 -2
  57. package/dist/components/list/listItem.d.mts +3 -3
  58. package/dist/components/list/listItem.d.ts +3 -3
  59. package/dist/components/list/listItem.js +3 -3
  60. package/dist/components/list/listItem.mjs +1 -1
  61. package/dist/components/modal/index.js +1 -1
  62. package/dist/components/modal/index.mjs +1 -1
  63. package/dist/components/modal/modal.d.mts +2 -2
  64. package/dist/components/modal/modal.d.ts +2 -2
  65. package/dist/components/modal/modal.js +1 -1
  66. package/dist/components/modal/modal.mjs +1 -1
  67. package/dist/components/modal/modal.test.js +1 -1
  68. package/dist/components/modal/modal.test.mjs +2 -2
  69. package/dist/components/pagination/pagination.d.mts +2 -2
  70. package/dist/components/pagination/pagination.d.ts +2 -2
  71. package/dist/components/progress/progress.d.mts +2 -2
  72. package/dist/components/progress/progress.d.ts +2 -2
  73. package/dist/components/radio/radio.d.mts +2 -2
  74. package/dist/components/radio/radio.d.ts +2 -2
  75. package/dist/components/select/select.d.mts +2 -2
  76. package/dist/components/select/select.d.ts +2 -2
  77. package/dist/components/select/select.test.mjs +3 -3
  78. package/dist/components/select/useSelect.d.mts +3 -3
  79. package/dist/components/select/useSelect.d.ts +3 -3
  80. package/dist/components/slider/slider.d.mts +2 -2
  81. package/dist/components/slider/slider.d.ts +2 -2
  82. package/dist/components/switch/index.js +1 -2
  83. package/dist/components/switch/index.mjs +1 -1
  84. package/dist/components/switch/switch.d.mts +2 -2
  85. package/dist/components/switch/switch.d.ts +2 -2
  86. package/dist/components/switch/switch.js +1 -2
  87. package/dist/components/switch/switch.mjs +1 -1
  88. package/dist/components/switch/switch.test.js +1 -2
  89. package/dist/components/switch/switch.test.mjs +1 -1
  90. package/dist/components/table/table-body.d.mts +2 -2
  91. package/dist/components/table/table-body.d.ts +2 -2
  92. package/dist/components/table/table.d.mts +5 -5
  93. package/dist/components/table/table.d.ts +5 -5
  94. package/dist/components/tabs/tabs.d.mts +2 -2
  95. package/dist/components/tabs/tabs.d.ts +2 -2
  96. package/dist/components/tabs/tabs.test.mjs +3 -3
  97. package/dist/components/textarea/textarea.d.mts +2 -2
  98. package/dist/components/textarea/textarea.d.ts +2 -2
  99. package/dist/components/textarea/textarea.test.mjs +1 -1
  100. package/dist/components/toast/toast.d.mts +2 -2
  101. package/dist/components/toast/toast.d.ts +2 -2
  102. package/dist/components/tooltip/index.d.mts +1 -1
  103. package/dist/components/tooltip/index.d.ts +1 -1
  104. package/dist/components/tooltip/tooltip-utils.d.mts +1 -1
  105. package/dist/components/tooltip/tooltip-utils.d.ts +1 -1
  106. package/dist/components/tooltip/tooltip.d.mts +3 -3
  107. package/dist/components/tooltip/tooltip.d.ts +3 -3
  108. package/dist/components/tooltip/tooltip.test.mjs +3 -3
  109. package/dist/components/tooltip/useTooltip.d.mts +1 -1
  110. package/dist/components/tooltip/useTooltip.d.ts +1 -1
  111. package/dist/index.d.mts +2 -1
  112. package/dist/index.d.ts +2 -1
  113. package/dist/index.js +751 -6
  114. package/dist/index.mjs +62 -43
  115. package/dist/{tooltip-utils-DCKA5gnI.d.ts → tooltip-utils-CrCabndd.d.mts} +2 -2
  116. package/dist/{tooltip-utils-DCKA5gnI.d.mts → tooltip-utils-CrCabndd.d.ts} +2 -2
  117. package/package.json +1 -1
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import "../../chunk-75HLCORR.mjs";
3
+ import {
4
+ dateTimePicker_default
5
+ } from "../../chunk-HHYPMVLY.mjs";
6
+ import "../../chunk-FWJ2ZKH6.mjs";
7
+ import "../../chunk-WX32MAKV.mjs";
8
+ import "../../chunk-P732YGHO.mjs";
9
+ import "../../chunk-D5GGG7IO.mjs";
10
+ import "../../chunk-7MVEAQ7Z.mjs";
11
+ import "../../chunk-EYY4CRRR.mjs";
12
+ import "../../chunk-EDEV4IK4.mjs";
13
+ import "../../chunk-ZYIIXWVY.mjs";
14
+ import "../../chunk-LCI6RPWE.mjs";
15
+ import "../../chunk-IOCRFIQF.mjs";
16
+ import "../../chunk-E3G5QXSH.mjs";
17
+ import "../../chunk-J725QONZ.mjs";
18
+ import "../../chunk-IZ6II3QA.mjs";
19
+ export {
20
+ dateTimePicker_default as DateTimePicker
21
+ };
@@ -0,0 +1,11 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface Props {
4
+ color?: "primary" | "secondary";
5
+ selectedTime?: string;
6
+ isFocusInput?: boolean;
7
+ onChangeTime?: (time: string) => void;
8
+ }
9
+ declare const TimePicker: ({ color, selectedTime, isFocusInput, onChangeTime }: Props) => react_jsx_runtime.JSX.Element;
10
+
11
+ export { type Props, TimePicker as default };
@@ -0,0 +1,11 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface Props {
4
+ color?: "primary" | "secondary";
5
+ selectedTime?: string;
6
+ isFocusInput?: boolean;
7
+ onChangeTime?: (time: string) => void;
8
+ }
9
+ declare const TimePicker: ({ color, selectedTime, isFocusInput, onChangeTime }: Props) => react_jsx_runtime.JSX.Element;
10
+
11
+ export { type Props, TimePicker as default };
@@ -0,0 +1,345 @@
1
+ "use client";
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/components/dateTimePicker/timePicker.tsx
32
+ var timePicker_exports = {};
33
+ __export(timePicker_exports, {
34
+ default: () => timePicker_default
35
+ });
36
+ module.exports = __toCommonJS(timePicker_exports);
37
+ var import_react3 = require("react");
38
+
39
+ // src/components/list/list.tsx
40
+ var import_react = __toESM(require("react"));
41
+
42
+ // src/utils/tailwind-variants.ts
43
+ var import_tailwind_variants = require("tailwind-variants");
44
+ var COMMON_SIZE = ["sm", "md", "lg"];
45
+ var COMMON_RADIUS = ["xlg", "xxlg", "none", "full"];
46
+ var COMMON_FONTSIZE = ["h1", "h2", "h3", "h4", "h5"];
47
+ var COMMON_SHADOW = ["inner", "drop"];
48
+ var tv = (0, import_tailwind_variants.createTV)({
49
+ // twMerge: false,
50
+ twMergeConfig: {
51
+ classGroups: {
52
+ fontSize: [{ text: [...COMMON_SIZE, ...COMMON_FONTSIZE] }],
53
+ borderRadius: [{ rounded: [...COMMON_RADIUS, ...COMMON_SIZE] }],
54
+ boxShadow: [{ shadow: [...COMMON_SHADOW] }],
55
+ padding: [{ p: [...COMMON_SIZE] }],
56
+ gap: [{ gap: [...COMMON_SIZE] }]
57
+ }
58
+ }
59
+ });
60
+
61
+ // src/utils/props.ts
62
+ var mapPropsVariants = (props, variantKeys, removeVariantProps = true) => {
63
+ if (!variantKeys) {
64
+ return [props, {}];
65
+ }
66
+ const picked = variantKeys.reduce((acc, key) => {
67
+ if (key in props) {
68
+ return { ...acc, [key]: props[key] };
69
+ } else {
70
+ return acc;
71
+ }
72
+ }, {});
73
+ if (removeVariantProps) {
74
+ const omitted = Object.keys(props).filter((key) => !variantKeys.includes(key)).reduce((acc, key) => ({ ...acc, [key]: props[key] }), {});
75
+ return [omitted, picked];
76
+ } else {
77
+ return [props, picked];
78
+ }
79
+ };
80
+
81
+ // src/components/list/list.tsx
82
+ var import_jsx_runtime = require("react/jsx-runtime");
83
+ var List = (0, import_react.forwardRef)((originalProps, ref) => {
84
+ const [props, variantProps] = mapPropsVariants(originalProps, list.variantKeys);
85
+ const { children, classNames } = props;
86
+ const slots = (0, import_react.useMemo)(() => list({ ...variantProps }), [...Object.values(variantProps)]);
87
+ const getBaseProps = (0, import_react.useCallback)(() => {
88
+ return {
89
+ className: slots.base({ class: classNames == null ? void 0 : classNames.base })
90
+ };
91
+ }, [slots, classNames == null ? void 0 : classNames.base]);
92
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, ...getBaseProps(), children: import_react.default.Children.map(children, (child, index) => {
93
+ return import_react.default.cloneElement(child, {
94
+ ...variantProps,
95
+ ...child.props
96
+ });
97
+ }) });
98
+ });
99
+ List.displayName = "List";
100
+ var list_default = List;
101
+ var list = tv({
102
+ slots: {
103
+ base: ["flex", "flex-col"]
104
+ },
105
+ variants: {
106
+ variant: {
107
+ solid: {},
108
+ line: {}
109
+ },
110
+ size: {
111
+ sm: {},
112
+ md: {},
113
+ lg: {}
114
+ },
115
+ color: {
116
+ primary: {},
117
+ secondary: {}
118
+ }
119
+ },
120
+ defaultVariants: {
121
+ variant: "solid",
122
+ color: "primary",
123
+ size: "md"
124
+ }
125
+ });
126
+
127
+ // src/components/list/listItem.tsx
128
+ var import_react2 = require("react");
129
+ var import_jsx_runtime2 = require("react/jsx-runtime");
130
+ var ListItem = (0, import_react2.forwardRef)((originalProps, ref) => {
131
+ const [props, variantProps] = mapPropsVariants(originalProps, listItem.variantKeys);
132
+ const { title, selected, startContent, endContent, classNames, onClick } = props;
133
+ const slots = (0, import_react2.useMemo)(() => listItem({ ...variantProps }), [...Object.values(variantProps)]);
134
+ const getBaseProps = (0, import_react2.useCallback)(() => {
135
+ return {
136
+ className: slots.base({ class: classNames == null ? void 0 : classNames.base }),
137
+ "data-selected": selected,
138
+ onClick
139
+ };
140
+ }, [slots, classNames == null ? void 0 : classNames.base, selected, onClick]);
141
+ const getTitleWrapperProps = (0, import_react2.useCallback)(() => {
142
+ return {
143
+ className: slots.titleWrapper({ class: classNames == null ? void 0 : classNames.titleWrapper })
144
+ };
145
+ }, [slots, classNames == null ? void 0 : classNames.titleWrapper]);
146
+ const getTitleProps = (0, import_react2.useCallback)(() => {
147
+ return {
148
+ className: slots.title({ class: classNames == null ? void 0 : classNames.title })
149
+ };
150
+ }, [slots, classNames == null ? void 0 : classNames.title]);
151
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref, ...getBaseProps(), children: [
152
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ...getTitleWrapperProps(), children: [
153
+ startContent && startContent,
154
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { ...getTitleProps(), children: title })
155
+ ] }),
156
+ endContent && endContent
157
+ ] });
158
+ });
159
+ ListItem.displayName = "ListItem";
160
+ var listItem_default = ListItem;
161
+ var listItem = tv({
162
+ slots: {
163
+ base: [
164
+ "group",
165
+ "w-full",
166
+ "flex",
167
+ "justify-between",
168
+ "items-center",
169
+ "text-foreground",
170
+ "bg-transparent",
171
+ "px-[10px]",
172
+ "cursor-pointer",
173
+ "select-none",
174
+ "gap-[10px]"
175
+ ],
176
+ titleWrapper: ["flex", "w-full", "gap-[10px]", "overflow-hidden", "whitespace-nowrap", "text-overflow-ellipsis"],
177
+ title: "truncate"
178
+ },
179
+ variants: {
180
+ variant: {
181
+ solid: {},
182
+ line: {}
183
+ },
184
+ size: {
185
+ sm: {
186
+ base: "min-h-[30px] text-sm"
187
+ },
188
+ md: {
189
+ base: "min-h-[40px] text-md"
190
+ },
191
+ lg: {
192
+ base: "min-h-[50px] text-lg"
193
+ }
194
+ },
195
+ color: {
196
+ primary: {},
197
+ secondary: {}
198
+ },
199
+ isInGroup: {
200
+ true: ""
201
+ }
202
+ },
203
+ defaultVariants: {
204
+ variant: "solid",
205
+ color: "primary",
206
+ size: "md",
207
+ isInGroup: false
208
+ },
209
+ compoundVariants: [
210
+ {
211
+ variant: "solid",
212
+ color: "primary",
213
+ class: {
214
+ base: [
215
+ "hover:text-primary-main",
216
+ "hover:bg-primary-soft",
217
+ "data-[selected=true]:text-primary-main",
218
+ "data-[selected=true]:bg-primary-soft"
219
+ ]
220
+ }
221
+ },
222
+ {
223
+ variant: "solid",
224
+ color: "secondary",
225
+ class: {
226
+ base: [
227
+ "hover:text-secondary-main",
228
+ "hover:bg-secondary-soft",
229
+ "data-[selected=true]:text-secondary-main",
230
+ "data-[selected=true]:bg-secondary-soft"
231
+ ]
232
+ }
233
+ }
234
+ ]
235
+ });
236
+
237
+ // src/components/dateTimePicker/timePicker.tsx
238
+ var import_jsx_runtime3 = require("react/jsx-runtime");
239
+ var TimePicker = ({ color = "primary", selectedTime, isFocusInput, onChangeTime }) => {
240
+ const TOTAL_HOURS = 12;
241
+ const TOTAL_MINUTES = 60;
242
+ const ITEM_HEIGHT = 30;
243
+ const PERIODS = ["AM", "PM"];
244
+ const [selectedHour, setSelectedHour] = (0, import_react3.useState)("01");
245
+ const [selectedMinute, setSelectedMinute] = (0, import_react3.useState)("00");
246
+ const [selectedPeriod, setSelectedPeriod] = (0, import_react3.useState)("AM");
247
+ const hourRef = (0, import_react3.useRef)(null);
248
+ const minuteRef = (0, import_react3.useRef)(null);
249
+ const periodRef = (0, import_react3.useRef)(null);
250
+ const hoursArray = [...Array(TOTAL_HOURS).keys()].map((i) => (i + 1).toString().padStart(2, "0"));
251
+ const minutesArray = [...Array(TOTAL_MINUTES).keys()].map((i) => i.toString().padStart(2, "0"));
252
+ (0, import_react3.useEffect)(() => {
253
+ if (selectedTime) {
254
+ const { formattedHour, minute, period } = parseAndFormatTime(selectedTime);
255
+ setSelectedHour(formattedHour);
256
+ setSelectedMinute(minute);
257
+ setSelectedPeriod(period);
258
+ }
259
+ if (isFocusInput) {
260
+ scrollToSelectedTime();
261
+ }
262
+ }, [selectedTime, isFocusInput]);
263
+ (0, import_react3.useEffect)(() => {
264
+ scrollToSelectedTime();
265
+ }, []);
266
+ const parseAndFormatTime = (time) => {
267
+ const [hour, minute] = time.split(":").map((part) => part.padStart(2, "0"));
268
+ const parsedHour = parseInt(hour, 10);
269
+ const period = parsedHour >= 12 ? "PM" : "AM";
270
+ const formattedHour = parsedHour % 12 === 0 ? "12" : (parsedHour % 12).toString().padStart(2, "0");
271
+ return { formattedHour, minute, period };
272
+ };
273
+ const scrollToSelectedTime = () => {
274
+ if (selectedTime) {
275
+ const { formattedHour, minute, period } = parseAndFormatTime(selectedTime);
276
+ if (hourRef.current) {
277
+ hourRef.current.scrollTop = (parseInt(formattedHour) - 1) * ITEM_HEIGHT;
278
+ }
279
+ if (minuteRef.current) {
280
+ minuteRef.current.scrollTop = parseInt(minute) * ITEM_HEIGHT;
281
+ }
282
+ if (periodRef.current) {
283
+ periodRef.current.scrollTop = period === "AM" ? 0 : ITEM_HEIGHT;
284
+ }
285
+ }
286
+ };
287
+ const handleTimeChange = (hour, minute, period) => {
288
+ const parsedHour = parseInt(hour);
289
+ let hour24 = parsedHour;
290
+ if (period === "PM" && parsedHour !== 12) {
291
+ hour24 = parsedHour + 12;
292
+ } else if (period === "AM" && parsedHour === 12) {
293
+ hour24 = 0;
294
+ }
295
+ const formattedTime = `${hour24.toString().padStart(2, "0")}:${minute}`;
296
+ if (onChangeTime) {
297
+ onChangeTime(formattedTime);
298
+ }
299
+ };
300
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex h-[200px] p-[10px] gap-[5px] border border-neutral-main rounded-md bg-background shadow-lg", children: [
301
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(list_default, { ref: periodRef, classNames: { base: "overflow-y-auto scrollbar-hide" }, children: PERIODS.map((period, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
302
+ listItem_default,
303
+ {
304
+ color,
305
+ selected: period === selectedPeriod,
306
+ title: period,
307
+ size: "sm",
308
+ classNames: { base: "w-[50px] min-h-[30px]", titleWrapper: "flex justify-center" },
309
+ onClick: () => {
310
+ handleTimeChange(selectedHour, selectedMinute, period);
311
+ }
312
+ },
313
+ `${period}-${index}`
314
+ )) }),
315
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(list_default, { ref: hourRef, classNames: { base: "overflow-y-auto scrollbar-hide" }, children: hoursArray.map((hour, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
316
+ listItem_default,
317
+ {
318
+ color,
319
+ selected: hour === selectedHour,
320
+ title: hour,
321
+ size: "sm",
322
+ classNames: { base: "w-[50px] min-h-[30px]", titleWrapper: "flex justify-center" },
323
+ onClick: () => {
324
+ handleTimeChange(hour, selectedMinute, selectedPeriod);
325
+ }
326
+ },
327
+ `${hour}-${index}`
328
+ )) }),
329
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(list_default, { ref: minuteRef, classNames: { base: "overflow-y-auto scrollbar-hide" }, children: minutesArray.map((minute, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
330
+ listItem_default,
331
+ {
332
+ color,
333
+ selected: minute === selectedMinute,
334
+ title: minute,
335
+ size: "sm",
336
+ classNames: { base: "w-[50px] min-h-[30px]", titleWrapper: "flex justify-center" },
337
+ onClick: () => {
338
+ handleTimeChange(selectedHour, minute, selectedPeriod);
339
+ }
340
+ },
341
+ `${minute}-${index}`
342
+ )) })
343
+ ] });
344
+ };
345
+ var timePicker_default = TimePicker;
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import {
3
+ timePicker_default
4
+ } from "../../chunk-D5GGG7IO.mjs";
5
+ import "../../chunk-7MVEAQ7Z.mjs";
6
+ import "../../chunk-EYY4CRRR.mjs";
7
+ import "../../chunk-EDEV4IK4.mjs";
8
+ import "../../chunk-E3G5QXSH.mjs";
9
+ import "../../chunk-J725QONZ.mjs";
10
+ import "../../chunk-IZ6II3QA.mjs";
11
+ export {
12
+ timePicker_default as default
13
+ };
@@ -0,0 +1,34 @@
1
+ import * as React from 'react';
2
+
3
+ interface DatePickerHookProps {
4
+ initialDate?: Date;
5
+ initialTime?: string;
6
+ onChange?: (date: Date) => void;
7
+ }
8
+ type TargetRect = {
9
+ x: number;
10
+ y: number;
11
+ width: number;
12
+ height: number;
13
+ };
14
+ declare const useDatePicker: ({ initialDate, initialTime }: DatePickerHookProps) => {
15
+ selectedDate: string | undefined;
16
+ selectedTime: string | undefined;
17
+ targetRect: TargetRect | null;
18
+ popupHeight: number;
19
+ isFocusInput: boolean;
20
+ dateInputRef: React.RefObject<HTMLInputElement>;
21
+ datePickerWrapperRef: React.RefObject<HTMLDivElement>;
22
+ datePickerRef: React.RefObject<HTMLDivElement>;
23
+ handleToggleDatePicker: () => void;
24
+ handleChangeDate: (date: string) => void;
25
+ handleChangeTime: (time: string) => void;
26
+ handleFocusInput: () => void;
27
+ handleBlueInput: () => void;
28
+ calculatePositionWithScroll: (targetRect: TargetRect) => {
29
+ top: number;
30
+ left: number;
31
+ } | undefined;
32
+ };
33
+
34
+ export { useDatePicker };
@@ -0,0 +1,34 @@
1
+ import * as React from 'react';
2
+
3
+ interface DatePickerHookProps {
4
+ initialDate?: Date;
5
+ initialTime?: string;
6
+ onChange?: (date: Date) => void;
7
+ }
8
+ type TargetRect = {
9
+ x: number;
10
+ y: number;
11
+ width: number;
12
+ height: number;
13
+ };
14
+ declare const useDatePicker: ({ initialDate, initialTime }: DatePickerHookProps) => {
15
+ selectedDate: string | undefined;
16
+ selectedTime: string | undefined;
17
+ targetRect: TargetRect | null;
18
+ popupHeight: number;
19
+ isFocusInput: boolean;
20
+ dateInputRef: React.RefObject<HTMLInputElement>;
21
+ datePickerWrapperRef: React.RefObject<HTMLDivElement>;
22
+ datePickerRef: React.RefObject<HTMLDivElement>;
23
+ handleToggleDatePicker: () => void;
24
+ handleChangeDate: (date: string) => void;
25
+ handleChangeTime: (time: string) => void;
26
+ handleFocusInput: () => void;
27
+ handleBlueInput: () => void;
28
+ calculatePositionWithScroll: (targetRect: TargetRect) => {
29
+ top: number;
30
+ left: number;
31
+ } | undefined;
32
+ };
33
+
34
+ export { useDatePicker };
@@ -0,0 +1,117 @@
1
+ "use client";
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/components/dateTimePicker/useDateTimePicker.tsx
22
+ var useDateTimePicker_exports = {};
23
+ __export(useDateTimePicker_exports, {
24
+ useDatePicker: () => useDatePicker
25
+ });
26
+ module.exports = __toCommonJS(useDateTimePicker_exports);
27
+ var import_react = require("react");
28
+
29
+ // src/components/dateTimePicker/util.ts
30
+ var formatDateToString = (date) => {
31
+ const year = date.getFullYear();
32
+ const month = String(date.getMonth() + 1).padStart(2, "0");
33
+ const day = String(date.getDate()).padStart(2, "0");
34
+ return `${year}-${month}-${day}`;
35
+ };
36
+
37
+ // src/components/dateTimePicker/useDateTimePicker.tsx
38
+ var useDatePicker = ({ initialDate, initialTime }) => {
39
+ const [selectedDate, setSelectedDate] = (0, import_react.useState)(
40
+ initialDate ? formatDateToString(initialDate) : ""
41
+ );
42
+ const [selectedTime, setSelectedTime] = (0, import_react.useState)(initialTime ? initialTime : "");
43
+ const [targetRect, setTargetRect] = (0, import_react.useState)(null);
44
+ const [popupWidth, setPopupWidth] = (0, import_react.useState)(0);
45
+ const [popupHeight, setPopupHeight] = (0, import_react.useState)(0);
46
+ const [isFocusInput, setIsFocusInput] = (0, import_react.useState)(false);
47
+ const dateInputRef = (0, import_react.useRef)(null);
48
+ const datePickerWrapperRef = (0, import_react.useRef)(null);
49
+ const datePickerRef = (0, import_react.useRef)(null);
50
+ const DATE_PICKER_GAP = 4;
51
+ const calculatePositionWithScroll = (targetRect2) => {
52
+ if (targetRect2 && popupWidth && popupHeight) {
53
+ const scrollTop = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop;
54
+ const scrollLeft = window.scrollX || document.documentElement.scrollLeft || document.body.scrollLeft;
55
+ const spaceBelow = window.innerHeight - (targetRect2.y + targetRect2.height + DATE_PICKER_GAP);
56
+ const spaceAbove = targetRect2.y - DATE_PICKER_GAP;
57
+ const top = spaceBelow < popupHeight && spaceAbove > popupHeight ? targetRect2.y - popupHeight - DATE_PICKER_GAP : targetRect2.y + targetRect2.height + DATE_PICKER_GAP;
58
+ return {
59
+ top: top + scrollTop,
60
+ left: targetRect2.x + targetRect2.width - popupWidth + scrollLeft
61
+ };
62
+ }
63
+ };
64
+ const handleToggleDatePicker = () => {
65
+ if (datePickerRef.current) {
66
+ const rect = datePickerRef.current.getBoundingClientRect();
67
+ setTargetRect((prevRect) => prevRect ? null : { x: rect.x, y: rect.y, width: rect.width, height: rect.height });
68
+ }
69
+ };
70
+ const handleChangeDate = (date) => {
71
+ setSelectedDate(date);
72
+ };
73
+ const handleChangeTime = (time) => {
74
+ setSelectedTime(time);
75
+ };
76
+ const handleFocusInput = () => {
77
+ setIsFocusInput(true);
78
+ };
79
+ const handleBlueInput = () => {
80
+ setIsFocusInput(false);
81
+ };
82
+ (0, import_react.useEffect)(() => {
83
+ const onClickOutside = (e) => {
84
+ if (datePickerRef.current && !datePickerRef.current.contains(e.target) && datePickerWrapperRef.current && !datePickerWrapperRef.current.contains(e.target)) {
85
+ setTargetRect(null);
86
+ }
87
+ };
88
+ window.addEventListener("mousedown", onClickOutside);
89
+ return () => window.removeEventListener("mousedown", onClickOutside);
90
+ }, []);
91
+ (0, import_react.useEffect)(() => {
92
+ if (datePickerWrapperRef.current) {
93
+ setPopupHeight(datePickerWrapperRef.current.getBoundingClientRect().height);
94
+ setPopupWidth(datePickerWrapperRef.current.getBoundingClientRect().width);
95
+ }
96
+ }, [targetRect]);
97
+ return {
98
+ selectedDate,
99
+ selectedTime,
100
+ targetRect,
101
+ popupHeight,
102
+ isFocusInput,
103
+ dateInputRef,
104
+ datePickerWrapperRef,
105
+ datePickerRef,
106
+ handleToggleDatePicker,
107
+ handleChangeDate,
108
+ handleChangeTime,
109
+ handleFocusInput,
110
+ handleBlueInput,
111
+ calculatePositionWithScroll
112
+ };
113
+ };
114
+ // Annotate the CommonJS export names for ESM import in node:
115
+ 0 && (module.exports = {
116
+ useDatePicker
117
+ });
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import {
3
+ useDatePicker
4
+ } from "../../chunk-FWJ2ZKH6.mjs";
5
+ import "../../chunk-P732YGHO.mjs";
6
+ import "../../chunk-IZ6II3QA.mjs";
7
+ export {
8
+ useDatePicker
9
+ };
@@ -0,0 +1,4 @@
1
+ declare const formatDateToString: (date: Date) => string;
2
+ declare const formatStringToDate: (date: string) => Date;
3
+
4
+ export { formatDateToString, formatStringToDate };
@@ -0,0 +1,4 @@
1
+ declare const formatDateToString: (date: Date) => string;
2
+ declare const formatStringToDate: (date: string) => Date;
3
+
4
+ export { formatDateToString, formatStringToDate };
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/components/dateTimePicker/util.ts
22
+ var util_exports = {};
23
+ __export(util_exports, {
24
+ formatDateToString: () => formatDateToString,
25
+ formatStringToDate: () => formatStringToDate
26
+ });
27
+ module.exports = __toCommonJS(util_exports);
28
+ var formatDateToString = (date) => {
29
+ const year = date.getFullYear();
30
+ const month = String(date.getMonth() + 1).padStart(2, "0");
31
+ const day = String(date.getDate()).padStart(2, "0");
32
+ return `${year}-${month}-${day}`;
33
+ };
34
+ var formatStringToDate = (date) => {
35
+ const formattedDate = new Date(date);
36
+ return formattedDate;
37
+ };
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ formatDateToString,
41
+ formatStringToDate
42
+ });
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import {
3
+ formatDateToString,
4
+ formatStringToDate
5
+ } from "../../chunk-P732YGHO.mjs";
6
+ import "../../chunk-IZ6II3QA.mjs";
7
+ export {
8
+ formatDateToString,
9
+ formatStringToDate
10
+ };