@deepnoid/ui 0.1.109 → 0.1.110

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 (59) hide show
  1. package/.turbo/turbo-build.log +446 -466
  2. package/dist/chunk-CV6IVDL6.mjs +356 -0
  3. package/dist/{chunk-2EECKYM4.mjs → chunk-YCLB7ZNK.mjs} +1 -1
  4. package/dist/{chunk-7VS6YXNB.mjs → chunk-ZWLRSZTC.mjs} +2 -2
  5. package/dist/components/charts/circularProgress.js +2 -2
  6. package/dist/components/charts/circularProgress.mjs +1 -1
  7. package/dist/components/charts/index.js +2 -2
  8. package/dist/components/charts/index.mjs +1 -1
  9. package/dist/components/picker/index.d.mts +4 -0
  10. package/dist/components/picker/index.d.ts +4 -0
  11. package/dist/components/{dateTimePicker/calendar.js → picker/index.js} +716 -173
  12. package/dist/components/{dateTimePicker/calendar.mjs → picker/index.mjs} +7 -6
  13. package/dist/components/picker/timePicker.d.mts +251 -0
  14. package/dist/components/picker/timePicker.d.ts +251 -0
  15. package/dist/components/{dateTimePicker/dateTimePicker.js → picker/timePicker.js} +617 -904
  16. package/dist/components/{dateTimePicker → picker}/timePicker.mjs +7 -6
  17. package/dist/components/select/index.js +1 -1
  18. package/dist/components/select/index.mjs +1 -1
  19. package/dist/components/select/select.js +1 -1
  20. package/dist/components/select/select.mjs +1 -1
  21. package/dist/components/table/index.mjs +3 -3
  22. package/dist/components/table/table-body.mjs +3 -3
  23. package/dist/components/table/table-head.mjs +3 -3
  24. package/dist/components/table/table.mjs +3 -3
  25. package/dist/components/toast/index.mjs +2 -2
  26. package/dist/components/toast/use-toast.mjs +2 -2
  27. package/dist/index.d.mts +1 -1
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +383 -777
  30. package/dist/index.mjs +41 -45
  31. package/package.json +1 -1
  32. package/dist/chunk-FWJ2ZKH6.mjs +0 -87
  33. package/dist/chunk-P732YGHO.mjs +0 -18
  34. package/dist/chunk-X5XJWJSO.mjs +0 -122
  35. package/dist/chunk-Y4W76B42.mjs +0 -210
  36. package/dist/chunk-ZSQQFMEC.mjs +0 -366
  37. package/dist/components/dateTimePicker/calendar.d.mts +0 -68
  38. package/dist/components/dateTimePicker/calendar.d.ts +0 -68
  39. package/dist/components/dateTimePicker/dateTimePicker.d.mts +0 -288
  40. package/dist/components/dateTimePicker/dateTimePicker.d.ts +0 -288
  41. package/dist/components/dateTimePicker/dateTimePicker.mjs +0 -23
  42. package/dist/components/dateTimePicker/index.d.mts +0 -4
  43. package/dist/components/dateTimePicker/index.d.ts +0 -4
  44. package/dist/components/dateTimePicker/index.js +0 -6040
  45. package/dist/components/dateTimePicker/index.mjs +0 -22
  46. package/dist/components/dateTimePicker/timePicker.d.mts +0 -11
  47. package/dist/components/dateTimePicker/timePicker.d.ts +0 -11
  48. package/dist/components/dateTimePicker/timePicker.js +0 -5417
  49. package/dist/components/dateTimePicker/useDateTimePicker.d.mts +0 -34
  50. package/dist/components/dateTimePicker/useDateTimePicker.d.ts +0 -34
  51. package/dist/components/dateTimePicker/useDateTimePicker.js +0 -117
  52. package/dist/components/dateTimePicker/useDateTimePicker.mjs +0 -9
  53. package/dist/components/dateTimePicker/util.d.mts +0 -4
  54. package/dist/components/dateTimePicker/util.d.ts +0 -4
  55. package/dist/components/dateTimePicker/util.js +0 -42
  56. package/dist/components/dateTimePicker/util.mjs +0 -10
  57. package/dist/{chunk-75HLCORR.mjs → chunk-BG7VAVOX.mjs} +0 -0
  58. package/dist/{chunk-2OK3VF75.mjs → chunk-U3O7RIXM.mjs} +3 -3
  59. package/dist/{chunk-IQYWSATB.mjs → chunk-X67ELNP6.mjs} +3 -3
@@ -99,15 +99,15 @@ var require_plugin = __commonJS({
99
99
  }
100
100
  });
101
101
 
102
- // src/components/dateTimePicker/dateTimePicker.tsx
103
- var dateTimePicker_exports = {};
104
- __export(dateTimePicker_exports, {
105
- dateTimePickerStyle: () => dateTimePickerStyle,
106
- default: () => dateTimePicker_default
102
+ // src/components/picker/timePicker.tsx
103
+ var timePicker_exports = {};
104
+ __export(timePicker_exports, {
105
+ default: () => timePicker_default,
106
+ timePickerStyle: () => timePickerStyle
107
107
  });
108
- module.exports = __toCommonJS(dateTimePicker_exports);
109
- var import_react7 = __toESM(require("react"));
110
- var import_react_dom = require("react-dom");
108
+ module.exports = __toCommonJS(timePicker_exports);
109
+ var import_react2 = require("react");
110
+ var import_react_dom2 = require("react-dom");
111
111
 
112
112
  // src/utils/tailwind-variants.ts
113
113
  var import_tailwind_variants = require("tailwind-variants");
@@ -369,99 +369,6 @@ var mapPropsVariants = (props, variantKeys, removeVariantProps = true) => {
369
369
  }
370
370
  };
371
371
 
372
- // src/components/dateTimePicker/useDateTimePicker.tsx
373
- var import_react = require("react");
374
-
375
- // src/components/dateTimePicker/util.ts
376
- var formatDateToString = (date) => {
377
- const year = date.getFullYear();
378
- const month = String(date.getMonth() + 1).padStart(2, "0");
379
- const day = String(date.getDate()).padStart(2, "0");
380
- return `${year}-${month}-${day}`;
381
- };
382
- var formatStringToDate = (date) => {
383
- const formattedDate = new Date(date);
384
- return formattedDate;
385
- };
386
-
387
- // src/components/dateTimePicker/useDateTimePicker.tsx
388
- var useDatePicker = ({ initialDate, initialTime }) => {
389
- const [selectedDate, setSelectedDate] = (0, import_react.useState)(
390
- initialDate ? formatDateToString(initialDate) : ""
391
- );
392
- const [selectedTime, setSelectedTime] = (0, import_react.useState)(initialTime ? initialTime : "");
393
- const [targetRect, setTargetRect] = (0, import_react.useState)(null);
394
- const [popupWidth, setPopupWidth] = (0, import_react.useState)(0);
395
- const [popupHeight, setPopupHeight] = (0, import_react.useState)(0);
396
- const [isFocusInput, setIsFocusInput] = (0, import_react.useState)(false);
397
- const dateInputRef = (0, import_react.useRef)(null);
398
- const datePickerWrapperRef = (0, import_react.useRef)(null);
399
- const datePickerRef = (0, import_react.useRef)(null);
400
- const DATE_PICKER_GAP = 4;
401
- const calculatePositionWithScroll = (targetRect2) => {
402
- if (targetRect2 && popupWidth && popupHeight) {
403
- const scrollTop = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop;
404
- const scrollLeft = window.scrollX || document.documentElement.scrollLeft || document.body.scrollLeft;
405
- const spaceBelow = window.innerHeight - (targetRect2.y + targetRect2.height + DATE_PICKER_GAP);
406
- const spaceAbove = targetRect2.y - DATE_PICKER_GAP;
407
- const top = spaceBelow < popupHeight && spaceAbove > popupHeight ? targetRect2.y - popupHeight - DATE_PICKER_GAP : targetRect2.y + targetRect2.height + DATE_PICKER_GAP;
408
- return {
409
- top: top + scrollTop,
410
- left: targetRect2.x + targetRect2.width - popupWidth + scrollLeft
411
- };
412
- }
413
- };
414
- const handleToggleDatePicker = () => {
415
- if (datePickerRef.current) {
416
- const rect = datePickerRef.current.getBoundingClientRect();
417
- setTargetRect((prevRect) => prevRect ? null : { x: rect.x, y: rect.y, width: rect.width, height: rect.height });
418
- }
419
- };
420
- const handleChangeDate = (date) => {
421
- setSelectedDate(date);
422
- };
423
- const handleChangeTime = (time) => {
424
- setSelectedTime(time);
425
- };
426
- const handleFocusInput = () => {
427
- setIsFocusInput(true);
428
- };
429
- const handleBlueInput = () => {
430
- setIsFocusInput(false);
431
- };
432
- (0, import_react.useEffect)(() => {
433
- const onClickOutside = (e) => {
434
- if (datePickerRef.current && !datePickerRef.current.contains(e.target) && datePickerWrapperRef.current && !datePickerWrapperRef.current.contains(e.target)) {
435
- setTargetRect(null);
436
- }
437
- };
438
- window.addEventListener("mousedown", onClickOutside);
439
- return () => window.removeEventListener("mousedown", onClickOutside);
440
- }, []);
441
- (0, import_react.useEffect)(() => {
442
- if (datePickerWrapperRef.current) {
443
- setPopupHeight(datePickerWrapperRef.current.getBoundingClientRect().height);
444
- setPopupWidth(datePickerWrapperRef.current.getBoundingClientRect().width);
445
- }
446
- }, [targetRect]);
447
- return {
448
- selectedDate,
449
- selectedTime,
450
- targetRect,
451
- popupHeight,
452
- isFocusInput,
453
- dateInputRef,
454
- datePickerWrapperRef,
455
- datePickerRef,
456
- handleToggleDatePicker,
457
- handleChangeDate,
458
- handleChangeTime,
459
- handleFocusInput,
460
- handleBlueInput,
461
- calculatePositionWithScroll
462
- };
463
- };
464
-
465
372
  // src/components/icon/template.tsx
466
373
  var import_jsx_runtime = require("react/jsx-runtime");
467
374
  var template = {
@@ -5104,936 +5011,742 @@ var Icon = ({ name, size = "md", fill = false, className, onClick, ...props }) =
5104
5011
  };
5105
5012
  var Icon_default = Icon;
5106
5013
 
5107
- // src/components/dateTimePicker/calendar.tsx
5108
- var import_react2 = __toESM(require("react"));
5109
- var import_jsx_runtime3 = require("react/jsx-runtime");
5110
- var Calendar = (0, import_react2.forwardRef)((originalProps, ref) => {
5111
- const [props, variantProps] = mapPropsVariants(originalProps, calendarStyle.variantKeys);
5112
- const { selectedDate, classNames, highlightWeekend = true, onChangeDate, ...inputProps } = props;
5113
- const [currentDate, setCurrentDate] = (0, import_react2.useState)(selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date());
5114
- const daysOfWeek = ["S", "M", "T", "W", "T", "F", "S"];
5115
- (0, import_react2.useEffect)(() => {
5116
- if (selectedDate) {
5117
- setCurrentDate(new Date(selectedDate));
5118
- }
5119
- }, [selectedDate]);
5120
- const getCalendarDates = (0, import_react2.useCallback)(() => {
5121
- const year = currentDate.getFullYear();
5122
- const month = currentDate.getMonth();
5123
- const firstDayOfMonth = new Date(year, month, 1).getDay();
5124
- const lastDateOfMonth = new Date(year, month + 1, 0).getDate();
5125
- const lastDateOfPrevMonth = new Date(year, month, 0).getDate();
5126
- let dates = [];
5127
- for (let i = firstDayOfMonth - 1; i >= 0; i--) {
5128
- dates.push({
5129
- date: lastDateOfPrevMonth - i,
5130
- currentMonth: false
5131
- });
5132
- }
5133
- for (let date = 1; date <= lastDateOfMonth; date++) {
5134
- dates.push({
5135
- date,
5136
- currentMonth: true
5137
- });
5014
+ // src/components/select/select.tsx
5015
+ var import_react = require("react");
5016
+ var import_react_dom = require("react-dom");
5017
+
5018
+ // src/utils/clsx.ts
5019
+ function clsx(...args) {
5020
+ var i = 0, tmp, x, str = "";
5021
+ while (i < args.length) {
5022
+ if (tmp = args[i++]) {
5023
+ if (x = toVal(tmp)) {
5024
+ str && (str += " ");
5025
+ str += x;
5026
+ }
5138
5027
  }
5139
- const remainingDays = 42 - dates.length;
5140
- for (let i = 1; i <= remainingDays; i++) {
5141
- dates.push({
5142
- date: i,
5143
- currentMonth: false
5144
- });
5028
+ }
5029
+ return str;
5030
+ }
5031
+ function toVal(mix) {
5032
+ var k, y, str = "";
5033
+ if (typeof mix === "string" || typeof mix === "number") {
5034
+ str += mix;
5035
+ } else if (typeof mix === "object") {
5036
+ if (Array.isArray(mix)) {
5037
+ var len = mix.length;
5038
+ for (k = 0; k < len; k++) {
5039
+ if (mix[k]) {
5040
+ if (y = toVal(mix[k])) {
5041
+ str && (str += " ");
5042
+ str += y;
5043
+ }
5044
+ }
5045
+ }
5046
+ } else {
5047
+ for (y in mix) {
5048
+ if (mix[y]) {
5049
+ str && (str += " ");
5050
+ str += y;
5051
+ }
5052
+ }
5145
5053
  }
5146
- const weeks = [];
5147
- for (let i = 0; i < dates.length; i += 7) {
5148
- weeks.push(dates.slice(i, i + 7));
5054
+ }
5055
+ return str;
5056
+ }
5057
+
5058
+ // src/components/select/select.tsx
5059
+ var import_jsx_runtime3 = require("react/jsx-runtime");
5060
+ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
5061
+ var _a, _b;
5062
+ const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
5063
+ const {
5064
+ label,
5065
+ options,
5066
+ helperMessage,
5067
+ errorMessage,
5068
+ classNames,
5069
+ defaultSelectedOptions,
5070
+ onChange,
5071
+ multiple,
5072
+ ...inputProps
5073
+ } = props;
5074
+ const slots = (0, import_react.useMemo)(() => select({ ...variantProps }), [variantProps]);
5075
+ const [selectedOptions, setSelectedOptions] = (0, import_react.useState)(defaultSelectedOptions || []);
5076
+ const [targetRect, setTargetRect] = (0, import_react.useState)(null);
5077
+ const [optionWrapperHeight, setOptionWrapperHeight] = (0, import_react.useState)(0);
5078
+ const [isVisible, setIsVisible] = (0, import_react.useState)(false);
5079
+ const [isOpen, setIsOpen] = (0, import_react.useState)(false);
5080
+ const selectWrapperRef = (0, import_react.useRef)(null);
5081
+ const optionWrapperRef = (0, import_react.useRef)(null);
5082
+ const handleToggleSelect = () => {
5083
+ if (isOpen) {
5084
+ setIsOpen(false);
5085
+ setTimeout(() => setIsVisible(false), 150);
5086
+ } else {
5087
+ if (selectWrapperRef.current) {
5088
+ const rect = selectWrapperRef.current.getBoundingClientRect();
5089
+ setTargetRect(rect);
5090
+ setIsVisible(true);
5091
+ requestAnimationFrame(() => setIsOpen(true));
5092
+ }
5149
5093
  }
5150
- return weeks;
5151
- }, [currentDate]);
5152
- const handlePrevMonth = () => {
5153
- setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() - 1));
5154
5094
  };
5155
- const handleNextMonth = () => {
5156
- setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() + 1));
5095
+ const calculatePositionWithScroll = (rect, height) => {
5096
+ const scrollTop = window.scrollY;
5097
+ const scrollLeft = window.scrollX;
5098
+ const spaceBelow = window.innerHeight - (rect.y + rect.height + 4);
5099
+ const spaceAbove = rect.y - 4;
5100
+ const top = spaceBelow < height && spaceAbove > height ? rect.y - height - 4 : rect.y + rect.height + 4;
5101
+ return {
5102
+ top: top + scrollTop,
5103
+ left: rect.x + scrollLeft
5104
+ };
5157
5105
  };
5158
- const handleDateSelect = (date, isCurrentMonth) => {
5159
- if (!isCurrentMonth) return;
5160
- if (onChangeDate) {
5161
- const selected = new Date(currentDate.getFullYear(), currentDate.getMonth(), date);
5162
- const formatted = formatDateToString(selected);
5163
- onChangeDate(formatted);
5106
+ const handleChangeOption = (option) => {
5107
+ let nextOptions;
5108
+ if (multiple) {
5109
+ const exists = selectedOptions.some((o) => o.value === option.value);
5110
+ nextOptions = exists ? selectedOptions.filter((o) => o.value !== option.value) : [...selectedOptions, option];
5111
+ } else {
5112
+ nextOptions = [option];
5113
+ setIsOpen(false);
5114
+ setTimeout(() => setIsVisible(false), 150);
5164
5115
  }
5116
+ setSelectedOptions(nextOptions);
5117
+ onChange == null ? void 0 : onChange(nextOptions);
5165
5118
  };
5166
- (0, import_react2.useImperativeHandle)(ref, () => ({
5167
- getSelectedDate: () => selectedDate
5168
- }));
5169
- const slots = (0, import_react2.useMemo)(() => calendarStyle({ ...variantProps }), [variantProps]);
5170
- const getBaseProps = (0, import_react2.useCallback)(
5171
- () => ({
5172
- className: `${slots.base({ class: classNames == null ? void 0 : classNames.base })}`
5173
- }),
5174
- [slots, classNames]
5175
- );
5176
- const getDateTitleProps = (0, import_react2.useCallback)(
5177
- (index) => {
5178
- return {
5179
- className: `${slots.dateTitle({
5180
- class: classNames == null ? void 0 : classNames.date
5181
- })}`,
5182
- "data-saturday": highlightWeekend && index === 6,
5183
- "data-sunday": highlightWeekend && index === 0
5184
- };
5185
- },
5186
- [slots, classNames, highlightWeekend]
5187
- );
5188
- const getDateProps = (0, import_react2.useCallback)(
5189
- (dateObj) => {
5190
- const today = /* @__PURE__ */ new Date();
5191
- const isToday = today.getDate() === dateObj.date && today.getMonth() === currentDate.getMonth() && today.getFullYear() === currentDate.getFullYear();
5192
- const formatted = selectedDate ? formatStringToDate(selectedDate) : "";
5193
- const isSelected = formatted ? formatted.getDate() === dateObj.date && formatted.getMonth() === currentDate.getMonth() && formatted.getFullYear() === currentDate.getFullYear() : false;
5194
- const dayOfWeek = new Date(currentDate.getFullYear(), currentDate.getMonth(), dateObj.date).getDay();
5195
- return {
5196
- className: `${slots.date({
5197
- class: classNames == null ? void 0 : classNames.date
5198
- })}`,
5199
- "data-today": dateObj.currentMonth && isToday,
5200
- "data-selected": dateObj.currentMonth && isSelected,
5201
- "data-disabled": !dateObj.currentMonth,
5202
- "data-saturday": highlightWeekend && dayOfWeek === 6,
5203
- "data-sunday": highlightWeekend && dayOfWeek === 0,
5204
- onClick: () => handleDateSelect(dateObj.date, dateObj.currentMonth)
5205
- };
5206
- },
5207
- [slots, classNames, selectedDate, currentDate, highlightWeekend]
5208
- );
5209
- const calendarDates = getCalendarDates();
5210
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ...getBaseProps(), children: [
5211
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "calendar-header mb-4 flex items-center justify-between", children: [
5212
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: "brace-left", size: "md", className: "cursor-pointer", onClick: handlePrevMonth }),
5213
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-h6 font-semibold", children: currentDate.toLocaleString("default", { year: "numeric", month: "2-digit" }) }),
5214
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: "brace-right", size: "md", className: "cursor-pointer", onClick: handleNextMonth })
5215
- ] }),
5216
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "grid grid-cols-7 gap-2 text-center", children: daysOfWeek.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ...getDateTitleProps(index), children: day }, `${day}-${index}`)) }),
5217
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mt-2 grid grid-cols-7 gap-[5px] text-center", children: calendarDates.map((week, weekIndex) => {
5218
- const hasCurrentMonthDates = week.some((dateObj) => dateObj.currentMonth);
5219
- if (!hasCurrentMonthDates) return null;
5220
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react2.default.Fragment, { children: week.map((dateObj, index) => {
5221
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ...getDateProps(dateObj), children: dateObj.date }, index);
5222
- }) }, weekIndex);
5223
- }) })
5224
- ] }) });
5225
- });
5226
- Calendar.displayName = "Calendar";
5227
- var calendar_default = Calendar;
5228
- var calendarStyle = tv({
5229
- slots: {
5230
- base: [
5231
- "flex",
5232
- "flex-col",
5233
- "w-[240px]",
5234
- "border",
5235
- "border-neutral-main",
5236
- "bg-background",
5237
- "rounded-md",
5238
- "p-4",
5239
- "shadow-lg",
5240
- "select-none"
5241
- ],
5242
- dateTitle: ["text-sm", "font-[500]", "data-[saturday=true]:text-[#1E7EEE]", "data-[sunday=true]:text-[#FF4684]"],
5243
- date: [
5244
- "flex",
5245
- "justify-center",
5246
- "items-center",
5247
- "h-[25px]",
5248
- "text-sm",
5249
- "rounded-full",
5250
- "cursor-pointer",
5251
- "hover:bg-neutral-soft",
5252
- "data-[today=true]:border",
5253
- "data-[today=true]:border-foreground",
5254
- "data-[saturday=true]:text-[#1E7EEE]",
5255
- "data-[saturday=true]:!border-[#1E7EEE]",
5256
- "data-[sunday=true]:text-[#FF4684]",
5257
- "data-[sunday=true]:!border-[#FF4684]",
5258
- "data-[selected=true]:!text-white",
5259
- "data-[selected=true]:border-none",
5260
- "data-[disabled=true]:!text-neutral-main",
5261
- "data-[disabled=true]:cursor-default",
5262
- "data-[disabled=true]:hover:bg-transparent"
5263
- ]
5264
- },
5265
- variants: {
5266
- variant: {
5267
- solid: {}
5268
- },
5269
- color: {
5270
- primary: {
5271
- date: ["data-[selected=true]:!border-primary-main", "data-[selected=true]:bg-primary-main"]
5272
- },
5273
- secondary: {
5274
- date: ["data-[selected=true]:!border-secondary-main", "data-[selected=true]:bg-secondary-main"]
5119
+ (0, import_react.useEffect)(() => {
5120
+ const handleClickOutside = (e) => {
5121
+ var _a2;
5122
+ if (optionWrapperRef.current && !optionWrapperRef.current.contains(e.target) && !((_a2 = selectWrapperRef.current) == null ? void 0 : _a2.contains(e.target))) {
5123
+ setIsOpen(false);
5124
+ setTimeout(() => setIsVisible(false), 150);
5275
5125
  }
5126
+ };
5127
+ window.addEventListener("mousedown", handleClickOutside);
5128
+ return () => window.removeEventListener("mousedown", handleClickOutside);
5129
+ }, []);
5130
+ (0, import_react.useEffect)(() => {
5131
+ if (optionWrapperRef.current) {
5132
+ setOptionWrapperHeight(optionWrapperRef.current.getBoundingClientRect().height);
5276
5133
  }
5277
- },
5278
- defaultVariants: {
5279
- variant: "solid",
5280
- color: "primary"
5281
- },
5282
- compoundVariants: [
5283
- {
5284
- disabled: true,
5285
- isRequired: true,
5286
- class: {}
5287
- }
5288
- ]
5289
- });
5290
-
5291
- // src/components/dateTimePicker/timePicker.tsx
5292
- var import_react6 = require("react");
5293
-
5294
- // src/components/list/list.tsx
5295
- var import_react3 = require("react");
5296
- var import_jsx_runtime4 = require("react/jsx-runtime");
5297
- var List = (0, import_react3.forwardRef)((originalProps, ref) => {
5298
- const [props, variantProps] = mapPropsVariants(originalProps, listStyle.variantKeys);
5299
- const { children, classNames } = props;
5300
- const slots = (0, import_react3.useMemo)(() => listStyle(variantProps), [variantProps]);
5301
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: import_react3.Children.map(children, (child) => {
5302
- if (!(0, import_react3.isValidElement)(child)) return child;
5303
- return (0, import_react3.cloneElement)(child, {
5304
- ...variantProps,
5305
- ...child.props
5306
- });
5307
- }) });
5308
- });
5309
- List.displayName = "List";
5310
- var list_default = List;
5311
- var listStyle = tv({
5312
- slots: {
5313
- base: ["flex", "flex-col"]
5314
- },
5315
- variants: {
5316
- variant: {
5317
- solid: {},
5318
- outline: {}
5319
- },
5320
- size: {
5321
- sm: {},
5322
- md: {},
5323
- lg: {},
5324
- xl: {}
5325
- },
5326
- color: {
5327
- primary: {},
5328
- secondary: {},
5329
- neutral: {}
5330
- }
5331
- },
5332
- defaultVariants: {
5333
- variant: "solid",
5334
- color: "primary",
5335
- size: "md"
5336
- }
5337
- });
5338
-
5339
- // src/components/list/listItem.tsx
5340
- var import_react5 = require("react");
5341
-
5342
- // src/components/avatar/avatar.tsx
5343
- var import_react4 = require("react");
5344
- var import_jsx_runtime5 = require("react/jsx-runtime");
5345
- var Avatar = (0, import_react4.forwardRef)(
5346
- ({ variant = "square", size = "md", classNames, ...rest }, ref) => {
5347
- const SVGIcon = template["avatar"];
5348
- const slots = (0, import_react4.useMemo)(() => avatarStyle({ variant, size }), [variant, size]);
5349
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SVGIcon, { className: slots.content({ class: classNames == null ? void 0 : classNames.content }), ...rest }) });
5350
- }
5351
- );
5352
- Avatar.displayName = "Avatar";
5353
- var avatar_default = Avatar;
5354
- var avatarStyle = tv({
5355
- slots: {
5356
- base: ["w-fit", "h-fit", "flex", "items-center", "justify-center", "bg-neutral-soft", "overflow-hidden"],
5357
- content: []
5358
- },
5359
- variants: {
5360
- variant: {
5361
- square: {},
5362
- round: {}
5363
- },
5364
- size: {
5365
- sm: {
5366
- base: ["size-[20px]", "min-w-[20px]", "min-h-[20px]", "rounded-sm"]
5367
- },
5368
- md: {
5369
- base: ["size-[30px]", "min-w-[30px]", "min-h-[30px]", "rounded-md"]
5370
- },
5371
- lg: {
5372
- base: ["size-[40px]", "min-w-[40px]", "min-h-[40px]", "rounded-lg"]
5373
- },
5374
- xl: {
5375
- base: ["size-[50px]", "min-w-[50px]", "min-h-[50px]", "rounded-xl"]
5134
+ }, [targetRect]);
5135
+ const position = targetRect ? calculatePositionWithScroll(targetRect, optionWrapperHeight) : null;
5136
+ const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
5137
+ const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(", ") : ((_b = selectedOptions[0]) == null ? void 0 : _b.value) || "";
5138
+ const Option = ({
5139
+ option,
5140
+ isSelected,
5141
+ onClick
5142
+ }) => {
5143
+ const slot = select({ ...variantProps, isSelected });
5144
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
5145
+ "div",
5146
+ {
5147
+ role: "option",
5148
+ title: option.label,
5149
+ onClick,
5150
+ className: clsx(slot.option({ class: classNames == null ? void 0 : classNames.option })),
5151
+ children: [
5152
+ option.label,
5153
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: "check", size: originalProps.size })
5154
+ ]
5376
5155
  }
5156
+ );
5157
+ };
5158
+ const isControlled = originalProps.value !== void 0;
5159
+ (0, import_react.useEffect)(() => {
5160
+ if (isControlled) {
5161
+ const valueArray = Array.isArray(originalProps.value) ? originalProps.value : [originalProps.value];
5162
+ const matchedOptions = options.filter((opt) => valueArray.includes(opt.value));
5163
+ setSelectedOptions(matchedOptions);
5377
5164
  }
5378
- },
5379
- compoundVariants: [
5380
- {
5381
- variant: "round",
5382
- size: ["sm", "md", "lg", "xl"],
5383
- className: {
5384
- base: ["rounded-full"]
5385
- }
5165
+ }, [originalProps.value, options]);
5166
+ (0, import_react.useEffect)(() => {
5167
+ if (!isControlled && defaultSelectedOptions) {
5168
+ setSelectedOptions(defaultSelectedOptions);
5386
5169
  }
5387
- ],
5388
- defaultVariants: {
5389
- variant: "square",
5390
- size: "md"
5391
- }
5392
- });
5393
-
5394
- // src/components/list/listItem.tsx
5395
- var import_jsx_runtime6 = require("react/jsx-runtime");
5396
- var ListItem = (0, import_react5.forwardRef)((props, ref) => {
5397
- const [rawProps, variantProps] = mapPropsVariants(props, listItemStyle.variantKeys);
5398
- const {
5399
- title,
5400
- subTitle,
5401
- size = "md",
5402
- avatar,
5403
- startIconName,
5404
- selected,
5405
- classNames,
5406
- onClick
5407
- } = { ...rawProps, ...variantProps };
5408
- const slots = (0, import_react5.useMemo)(() => listItemStyle(variantProps), [variantProps]);
5409
- const iconSize = ["lg", "xl"].includes(size) ? "lg" : "md";
5410
- const avatarSize = iconSize;
5411
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), "data-selected": selected, onClick, children: [
5412
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
5413
- avatar && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(avatar_default, { ...avatar, variant: "round", size: avatarSize }),
5414
- startIconName && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon_default, { name: startIconName, fill: true, size, className: slots.startIcon({ class: classNames == null ? void 0 : classNames.startIcon }) }),
5415
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: slots.titleWrapper({ class: classNames == null ? void 0 : classNames.titleWrapper }), children: [
5416
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: slots.title({ class: classNames == null ? void 0 : classNames.title }), children: title }),
5417
- subTitle && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: slots.subTitle({ class: classNames == null ? void 0 : classNames.subTitle }), children: subTitle })
5418
- ] })
5419
- ] }),
5420
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon_default, { name: "right-chevron", size: iconSize, className: slots.icon({ class: classNames == null ? void 0 : classNames.icon }) })
5170
+ }, [defaultSelectedOptions]);
5171
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
5172
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
5173
+ "div",
5174
+ {
5175
+ className: clsx(
5176
+ slots.base({ class: classNames == null ? void 0 : classNames.base }),
5177
+ variantProps.direction === "horizon" ? slots.horizon({ class: classNames == null ? void 0 : classNames.horizon }) : slots.vertical({ class: classNames == null ? void 0 : classNames.vertical })
5178
+ ),
5179
+ children: [
5180
+ label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
5181
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
5182
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
5183
+ "div",
5184
+ {
5185
+ "data-expanded": isOpen,
5186
+ className: clsx(
5187
+ slots.selectWrapper({ class: classNames == null ? void 0 : classNames.selectWrapper }),
5188
+ inputProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
5189
+ ),
5190
+ ref: selectWrapperRef,
5191
+ onClick: handleToggleSelect,
5192
+ children: [
5193
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5194
+ "input",
5195
+ {
5196
+ ...inputProps,
5197
+ ref,
5198
+ className: clsx(
5199
+ slots.select({ class: classNames == null ? void 0 : classNames.select }),
5200
+ inputProps.readOnly ? "!placeholder:text-body-foreground" : ""
5201
+ ),
5202
+ name: void 0,
5203
+ value: displayValue,
5204
+ readOnly: true,
5205
+ size: 0
5206
+ }
5207
+ ),
5208
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "hidden", name: inputProps.name, value: selectedValue }),
5209
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5210
+ Icon_default,
5211
+ {
5212
+ name: "brace-up",
5213
+ size: originalProps.size,
5214
+ className: `transition-transform duration-200 ${isOpen ? "rotate-0" : "rotate-180"}`
5215
+ }
5216
+ )
5217
+ ]
5218
+ }
5219
+ ),
5220
+ helperMessage && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: slots.helperMessage({ class: classNames == null ? void 0 : classNames.helperMessage }), children: helperMessage }),
5221
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage })
5222
+ ] })
5223
+ ]
5224
+ }
5225
+ ),
5226
+ isVisible && (0, import_react_dom.createPortal)(
5227
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5228
+ "div",
5229
+ {
5230
+ ref: optionWrapperRef,
5231
+ role: "listbox",
5232
+ className: slots.optionsWrapper({ class: classNames == null ? void 0 : classNames.optionsWrapper }),
5233
+ style: {
5234
+ position: "absolute",
5235
+ top: position == null ? void 0 : position.top,
5236
+ left: position == null ? void 0 : position.left,
5237
+ width: targetRect == null ? void 0 : targetRect.width,
5238
+ zIndex: 1e3,
5239
+ opacity: isOpen ? 1 : 0,
5240
+ transform: isOpen ? "translateY(0)" : "translateY(-0.25rem)",
5241
+ transition: "opacity 150ms ease-out, transform 150ms ease-out"
5242
+ },
5243
+ children: options.map((option) => {
5244
+ const isSelected = selectedOptions.some((o) => o.value === option.value);
5245
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5246
+ Option,
5247
+ {
5248
+ option,
5249
+ isSelected,
5250
+ onClick: () => handleChangeOption(option)
5251
+ },
5252
+ option.value
5253
+ );
5254
+ })
5255
+ }
5256
+ ),
5257
+ document.body
5258
+ )
5421
5259
  ] });
5422
5260
  });
5423
- ListItem.displayName = "ListItem";
5424
- var listItem_default = ListItem;
5425
- var listItemStyle = tv({
5261
+ Select.displayName = "Select";
5262
+ var select_default = Select;
5263
+ var select = tv({
5426
5264
  slots: {
5427
- base: [
5428
- "group",
5429
- "w-full",
5265
+ base: ["group/select", "flex"],
5266
+ vertical: ["flex-col"],
5267
+ horizon: ["flex-row", "gap-0"],
5268
+ label: ["flex", "items-center", "font-bold", "text-body-foreground", "min-w-[80px]"],
5269
+ wrapper: ["flex", "flex-col"],
5270
+ selectWrapper: [
5430
5271
  "flex",
5431
- "justify-between",
5432
5272
  "items-center",
5433
- "gap-[10px]",
5434
- "bg-transparent",
5435
- "p-[10px]",
5273
+ "justify-between",
5274
+ "border",
5436
5275
  "cursor-pointer",
5437
- "select-none"
5276
+ "text-neutral-main",
5277
+ "hover:bg-trans-soft",
5278
+ "group-has-[p.error]/select:border-danger-main",
5279
+ "group-has-[p.error]/select:bg-danger-soft",
5280
+ "group-has-[p.error]/select:text-danger-main",
5281
+ "group-has-[p.error]/select:hover:bg-danger-soft"
5438
5282
  ],
5439
- wrapper: ["flex", "w-full", "items-center", "gap-[10px]", "flex-1", "min-w-0"],
5440
- startIcon: ["fill-neutral-dark"],
5441
- titleWrapper: ["flex", "flex-col", "overflow-hidden", "whitespace-nowrap", "text-overflow-ellipsis"],
5442
- title: ["text-neutral-dark", "font-bold", "truncate"],
5443
- subTitle: ["text-neutral-main", "truncate"],
5444
- icon: ["stroke-neutral-dark"]
5283
+ select: [
5284
+ "bg-transparent",
5285
+ "w-full",
5286
+ "outline-none",
5287
+ "placeholder:text-neutral-main",
5288
+ "text-body-foreground",
5289
+ "group-has-[p.error]/select:text-danger-main",
5290
+ "group-has-[p.error]/select:placeholder:text-danger-main"
5291
+ ],
5292
+ optionsWrapper: ["border", "rounded", "bg-body-background", "shadow", "overflow-auto"],
5293
+ option: ["flex", "justify-between", "items-center", "cursor-pointer"],
5294
+ helperMessage: ["text-neutral-main"],
5295
+ errorMessage: ["text-danger-main"],
5296
+ readonly: ["pointer-events-none", "!bg-trans-soft"]
5445
5297
  },
5446
5298
  variants: {
5447
- variant: {
5448
- solid: {},
5449
- outline: {}
5299
+ color: {
5300
+ primary: {
5301
+ selectWrapper: ["text-primary-main"],
5302
+ option: ["hover:bg-primary-soft", "hover:text-primary-main"],
5303
+ helperMessage: ["text-primary-main"]
5304
+ },
5305
+ secondary: {
5306
+ selectWrapper: ["text-secondary-main"],
5307
+ option: ["hover:bg-secondary-soft", "hover:text-secondary-main"],
5308
+ helperMessage: ["text-secondary-main"]
5309
+ }
5450
5310
  },
5451
5311
  size: {
5452
5312
  sm: {
5453
- base: ["min-h-[40px]", "rounded-sm", "!border-sm"],
5454
- title: ["text-sm"],
5455
- subTitle: ["text-sm"]
5313
+ base: ["text-sm", "gap-[4px]"],
5314
+ label: ["text-sm"],
5315
+ wrapper: ["gap-[4px]"],
5316
+ selectWrapper: ["w-[240px]", "h-[24px]", "rounded-sm", "px-[4px]"],
5317
+ select: ["text-sm"],
5318
+ option: ["px-[4px]", "py-[3px]", "text-sm"],
5319
+ helperMessage: ["text-sm"],
5320
+ errorMessage: ["text-sm"]
5456
5321
  },
5457
5322
  md: {
5458
- base: ["min-h-[45px]", "rounded-md", "!border-md"],
5459
- title: ["text-md"],
5460
- subTitle: ["text-sm"]
5323
+ base: ["text-md", "gap-[6px]", "rounded-md"],
5324
+ label: ["text-md"],
5325
+ wrapper: ["gap-[6px]"],
5326
+ selectWrapper: ["w-[240px]", "h-[32px]", "rounded-md", "px-[6px]"],
5327
+ select: ["text-md"],
5328
+ option: ["px-[6px]", "py-[5.5px]", "text-md"],
5329
+ helperMessage: ["text-sm"],
5330
+ errorMessage: ["text-sm"]
5461
5331
  },
5462
5332
  lg: {
5463
- base: ["min-h-[50px]", "rounded-lg", "!border-lg"],
5464
- title: ["text-lg"],
5465
- subTitle: ["text-md"]
5333
+ base: ["text-lg", "gap-[8px]"],
5334
+ label: ["text-lg"],
5335
+ wrapper: ["gap-[8px]"],
5336
+ selectWrapper: ["w-[240px]", "h-[40px]", "rounded-lg", "px-[8px]"],
5337
+ select: ["text-lg"],
5338
+ option: ["px-[8px]", "py-[8px]", "text-lg"],
5339
+ helperMessage: ["text-md"],
5340
+ errorMessage: ["text-md"]
5466
5341
  },
5467
5342
  xl: {
5468
- base: ["min-h-[55px]", "rounded-xl", "!border-xl"],
5469
- title: ["text-xl"],
5470
- subTitle: ["text-md"]
5343
+ base: ["text-xl", "gap-[10px]"],
5344
+ label: ["text-xl"],
5345
+ wrapper: ["gap-[10px]"],
5346
+ selectWrapper: ["w-[240px]", "h-[50px]", "rounded-lg", "px-[10px]"],
5347
+ select: ["text-xl"],
5348
+ option: ["px-[10px]", "py-[11.5px]"],
5349
+ helperMessage: ["text-md"],
5350
+ errorMessage: ["text-md"]
5471
5351
  }
5472
5352
  },
5473
- color: {
5474
- primary: {},
5475
- secondary: {},
5476
- neutral: {}
5353
+ direction: {
5354
+ vertical: "",
5355
+ horizon: ""
5356
+ },
5357
+ full: {
5358
+ true: {
5359
+ base: ["w-full"],
5360
+ wrapper: ["w-full"],
5361
+ selectWrapper: ["w-full"]
5362
+ }
5477
5363
  },
5478
5364
  disabled: {
5479
5365
  true: {
5480
- base: [
5481
- "!bg-transparent",
5482
- "!cursor-not-allowed",
5483
- "!opacity-disabled",
5484
- "!pointer-events-none",
5485
- "!data-[selected=true]:bg-transparent"
5366
+ base: ["pointer-events-none"],
5367
+ selectWrapper: [
5368
+ "bg-neutral-soft",
5369
+ "border-neutral-light",
5370
+ "group-has-[p.error]/select:text-danger-light",
5371
+ "group-has-[p.error]/select:bg-danger-soft",
5372
+ "group-has-[p.error]/select:border-danger-light"
5486
5373
  ],
5487
- startIcon: ["!fill-neutral-light"],
5488
- title: ["!text-neutral-light"],
5489
- subTitle: ["!text-neutral-light"],
5490
- icon: ["!stroke-neutral-light"]
5374
+ select: [
5375
+ "text-neutral-light",
5376
+ "placeholder:text-neutral-light",
5377
+ "group-has-[p.error]/select:text-danger-light",
5378
+ "group-has-[p.error]/select:placeholder:text-danger-light"
5379
+ ],
5380
+ helperMessage: ["!text-neutral-light"],
5381
+ errorMessage: ["!text-danger-light"]
5491
5382
  }
5383
+ },
5384
+ isSelected: {
5385
+ true: "",
5386
+ false: ""
5492
5387
  }
5493
5388
  },
5494
5389
  compoundVariants: [
5495
5390
  {
5496
- variant: ["solid", "outline"],
5497
- class: {
5498
- base: ["border", "border-transparent"]
5499
- }
5500
- },
5501
- {
5502
- variant: "solid",
5503
- color: "primary",
5504
- class: {
5505
- base: ["data-[selected=true]:bg-primary-soft"],
5506
- startIcon: ["group-data-[selected=true]:fill-neutral-strong", "group-hover:fill-primary-main"],
5507
- title: ["group-data-[selected=true]:text-neutral-strong", "group-hover:text-primary-main"],
5508
- subTitle: ["group-data-[selected=true]:text-neutral-strong"],
5509
- icon: ["group-data-[selected=true]:stroke-neutral-strong", "group-hover:stroke-primary-main"]
5510
- }
5511
- },
5512
- {
5513
- variant: "solid",
5514
- color: "secondary",
5515
- class: {
5516
- base: ["data-[selected=true]:bg-secondary-soft"],
5517
- startIcon: ["group-data-[selected=true]:fill-neutral-strong", "group-hover:fill-secondary-main"],
5518
- title: ["group-data-[selected=true]:text-neutral-strong", "group-hover:text-secondary-main"],
5519
- subTitle: ["group-data-[selected=true]:text-neutral-strong"],
5520
- icon: ["group-data-[selected=true]:stroke-neutral-strong", "group-hover:stroke-secondary-main"]
5521
- }
5522
- },
5523
- {
5524
- variant: "solid",
5525
- color: "neutral",
5526
- class: {
5527
- base: ["data-[selected=true]:bg-neutral-soft"],
5528
- startIcon: ["group-data-[selected=true]:fill-neutral-strong", "group-hover:fill-neutral-strong"],
5529
- title: ["group-data-[selected=true]:text-neutral-strong", "group-hover:text-neutral-strong"],
5530
- subTitle: ["group-data-[selected=true]:text-neutral-strong"],
5531
- icon: ["group-data-[selected=true]:stroke-neutral-strong", "group-hover:stroke-neutral-strong"]
5532
- }
5533
- },
5534
- {
5535
- variant: "outline",
5536
5391
  color: "primary",
5392
+ isSelected: true,
5537
5393
  class: {
5538
- base: [
5539
- "data-[selected=true]:border-primary-main",
5540
- "data-[selected=true]:bg-primary-soft",
5541
- "hover:border-primary-light"
5542
- ],
5543
- startIcon: ["group-data-[selected=true]:fill-neutral-strong"],
5544
- title: ["group-data-[selected=true]:text-neutral-strong"],
5545
- subTitle: ["group-data-[selected=true]:text-neutral-strong"],
5546
- icon: ["group-data-[selected=true]:stroke-neutral-strong"]
5394
+ option: "bg-primary-soft text-primary-main"
5547
5395
  }
5548
5396
  },
5549
5397
  {
5550
- variant: "outline",
5551
5398
  color: "secondary",
5399
+ isSelected: true,
5552
5400
  class: {
5553
- base: [
5554
- "group-data-[selected=true]:border-secondary-main",
5555
- "group-data-[selected=true]:bg-secondary-soft",
5556
- "group-hover:border-secondary-light"
5557
- ],
5558
- startIcon: ["group-data-[selected=true]:fill-neutral-strong"],
5559
- title: ["group-data-[selected=true]:text-neutral-strong"],
5560
- subTitle: ["group-data-[selected=true]:text-neutral-strong"],
5561
- icon: ["group-data-[selected=true]:stroke-neutral-strong"]
5562
- }
5563
- },
5564
- {
5565
- variant: "outline",
5566
- color: "neutral",
5567
- class: {
5568
- base: [
5569
- "group-data-[selected=true]:border-neutral-main",
5570
- "group-data-[selected=true]:bg-neutral-soft",
5571
- "group-hover:border-neutral-light"
5572
- ],
5573
- startIcon: ["group-data-[selected=true]:fill-neutral-strong"],
5574
- title: ["group-data-[selected=true]:text-neutral-strong"],
5575
- subTitle: ["group-data-[selected=true]:text-neutral-strong"],
5576
- icon: ["group-data-[selected=true]:stroke-neutral-strong"]
5401
+ option: "bg-secondary-soft text-secondary-main"
5577
5402
  }
5578
5403
  }
5579
5404
  ],
5580
5405
  defaultVariants: {
5581
- variant: "solid",
5582
5406
  color: "primary",
5583
- size: "md"
5407
+ size: "md",
5408
+ direction: "vertical",
5409
+ disabled: false,
5410
+ readonly: false
5584
5411
  }
5585
5412
  });
5586
5413
 
5587
- // src/components/dateTimePicker/timePicker.tsx
5588
- var import_jsx_runtime7 = require("react/jsx-runtime");
5589
- var TimePicker = ({ color = "primary", selectedTime, isFocusInput, onChangeTime }) => {
5590
- const TOTAL_HOURS = 12;
5591
- const TOTAL_MINUTES = 60;
5592
- const ITEM_HEIGHT = 30;
5593
- const PERIODS = ["AM", "PM"];
5594
- const [selectedHour, setSelectedHour] = (0, import_react6.useState)("01");
5595
- const [selectedMinute, setSelectedMinute] = (0, import_react6.useState)("00");
5596
- const [selectedPeriod, setSelectedPeriod] = (0, import_react6.useState)("AM");
5597
- const hourRef = (0, import_react6.useRef)(null);
5598
- const minuteRef = (0, import_react6.useRef)(null);
5599
- const periodRef = (0, import_react6.useRef)(null);
5600
- const hoursArray = [...Array(TOTAL_HOURS).keys()].map((i) => (i + 1).toString().padStart(2, "0"));
5601
- const minutesArray = [...Array(TOTAL_MINUTES).keys()].map((i) => i.toString().padStart(2, "0"));
5602
- (0, import_react6.useEffect)(() => {
5603
- if (selectedTime) {
5604
- const { formattedHour, minute, period } = parseAndFormatTime(selectedTime);
5605
- setSelectedHour(formattedHour);
5606
- setSelectedMinute(minute);
5607
- setSelectedPeriod(period);
5608
- }
5609
- if (isFocusInput) {
5610
- scrollToSelectedTime();
5611
- }
5612
- }, [selectedTime, isFocusInput]);
5613
- (0, import_react6.useEffect)(() => {
5614
- scrollToSelectedTime();
5615
- }, []);
5616
- const parseAndFormatTime = (time) => {
5617
- const [hour, minute] = time.split(":").map((part) => part.padStart(2, "0"));
5618
- const parsedHour = parseInt(hour, 10);
5619
- const period = parsedHour >= 12 ? "PM" : "AM";
5620
- const formattedHour = parsedHour % 12 === 0 ? "12" : (parsedHour % 12).toString().padStart(2, "0");
5621
- return { formattedHour, minute, period };
5622
- };
5623
- const scrollToSelectedTime = () => {
5624
- if (selectedTime) {
5625
- const { formattedHour, minute, period } = parseAndFormatTime(selectedTime);
5626
- if (hourRef.current) {
5627
- hourRef.current.scrollTop = (parseInt(formattedHour) - 1) * ITEM_HEIGHT;
5628
- }
5629
- if (minuteRef.current) {
5630
- minuteRef.current.scrollTop = parseInt(minute) * ITEM_HEIGHT;
5631
- }
5632
- if (periodRef.current) {
5633
- periodRef.current.scrollTop = period === "AM" ? 0 : ITEM_HEIGHT;
5634
- }
5635
- }
5636
- };
5637
- const handleTimeChange = (hour, minute, period) => {
5638
- const parsedHour = parseInt(hour);
5639
- let hour24 = parsedHour;
5640
- if (period === "PM" && parsedHour !== 12) {
5641
- hour24 = parsedHour + 12;
5642
- } else if (period === "AM" && parsedHour === 12) {
5643
- hour24 = 0;
5644
- }
5645
- const formattedTime = `${hour24.toString().padStart(2, "0")}:${minute}`;
5646
- if (onChangeTime) {
5647
- onChangeTime(formattedTime);
5648
- }
5649
- };
5650
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex h-[200px] p-[10px] gap-[5px] border border-neutral-main rounded-md bg-background shadow-lg", children: [
5651
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(list_default, { ref: periodRef, classNames: { base: "overflow-y-auto scrollbar-hide" }, children: PERIODS.map((period, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5652
- listItem_default,
5653
- {
5654
- color,
5655
- selected: period === selectedPeriod,
5656
- title: period,
5657
- size: "sm",
5658
- classNames: { base: "w-[50px] min-h-[30px]", titleWrapper: "flex justify-center" },
5659
- onClick: () => {
5660
- handleTimeChange(selectedHour, selectedMinute, period);
5661
- }
5662
- },
5663
- `${period}-${index}`
5664
- )) }),
5665
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(list_default, { ref: hourRef, classNames: { base: "overflow-y-auto scrollbar-hide" }, children: hoursArray.map((hour, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5666
- listItem_default,
5667
- {
5668
- color,
5669
- selected: hour === selectedHour,
5670
- title: hour,
5671
- size: "sm",
5672
- classNames: { base: "w-[50px] min-h-[30px]", titleWrapper: "flex justify-center" },
5673
- onClick: () => {
5674
- handleTimeChange(hour, selectedMinute, selectedPeriod);
5675
- }
5676
- },
5677
- `${hour}-${index}`
5678
- )) }),
5679
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(list_default, { ref: minuteRef, classNames: { base: "overflow-y-auto scrollbar-hide" }, children: minutesArray.map((minute, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5680
- listItem_default,
5681
- {
5682
- color,
5683
- selected: minute === selectedMinute,
5684
- title: minute,
5685
- size: "sm",
5686
- classNames: { base: "w-[50px] min-h-[30px]", titleWrapper: "flex justify-center" },
5687
- onClick: () => {
5688
- handleTimeChange(selectedHour, minute, selectedPeriod);
5689
- }
5690
- },
5691
- `${minute}-${index}`
5692
- )) })
5693
- ] });
5694
- };
5695
- var timePicker_default = TimePicker;
5696
-
5697
- // src/components/dateTimePicker/dateTimePicker.tsx
5698
- var import_jsx_runtime8 = require("react/jsx-runtime");
5699
- var DatePicker = (0, import_react7.forwardRef)((originalProps, ref) => {
5700
- const [props, variantProps] = mapPropsVariants(originalProps, dateTimePickerStyle.variantKeys);
5414
+ // src/components/picker/timePicker.tsx
5415
+ var import_jsx_runtime4 = require("react/jsx-runtime");
5416
+ var TimePicker = (0, import_react2.forwardRef)((originalProps, ref) => {
5417
+ const [props, variantProps] = mapPropsVariants(originalProps, timePickerStyle.variantKeys);
5701
5418
  const {
5702
5419
  classNames,
5703
5420
  label,
5704
5421
  errorMessage,
5705
- startContent,
5706
- endContent,
5707
- type = "date",
5708
- value,
5709
- onChangeDate,
5710
- onChangeTime,
5422
+ valueRange,
5423
+ onChangeRange,
5424
+ size,
5425
+ selectClassNames,
5426
+ placeholder = "",
5711
5427
  ...inputProps
5712
5428
  } = props;
5713
- const slots = (0, import_react7.useMemo)(() => dateTimePickerStyle({ ...variantProps }), [variantProps]);
5714
- const {
5715
- selectedDate,
5716
- selectedTime,
5717
- targetRect,
5718
- popupHeight,
5719
- isFocusInput,
5720
- datePickerRef,
5721
- dateInputRef,
5722
- datePickerWrapperRef,
5723
- handleToggleDatePicker,
5724
- handleChangeDate,
5725
- handleChangeTime,
5726
- handleFocusInput,
5727
- handleBlueInput,
5728
- calculatePositionWithScroll
5729
- } = useDatePicker({
5730
- initialDate: typeof value === "string" ? new Date(value) : void 0,
5731
- initialTime: typeof value === "string" ? value : void 0
5732
- });
5733
- const position = targetRect ? calculatePositionWithScroll(targetRect) : null;
5734
- const getBaseProps = (0, import_react7.useCallback)(
5735
- () => ({
5736
- className: slots.base({ class: classNames == null ? void 0 : classNames.base })
5737
- }),
5738
- [slots, classNames]
5739
- );
5740
- const getLabelProps = (0, import_react7.useCallback)(
5741
- () => ({
5742
- className: slots.label({ class: classNames == null ? void 0 : classNames.label })
5743
- }),
5744
- [slots, classNames]
5745
- );
5746
- const getInnerWrapperProps = (0, import_react7.useCallback)(
5747
- () => ({
5748
- className: slots.innerWrapper({ class: classNames == null ? void 0 : classNames.innerWrapper })
5749
- }),
5750
- [slots, classNames]
5429
+ const [selectedRange, setSelectedRange] = (0, import_react2.useState)(
5430
+ valueRange || { start: "", end: "" }
5751
5431
  );
5752
- const getInputWrapperProps = (0, import_react7.useCallback)(
5753
- () => ({
5754
- className: slots.inputWrapper({ class: classNames == null ? void 0 : classNames.inputWrapper }),
5755
- ref: datePickerRef
5756
- }),
5757
- [slots, classNames]
5758
- );
5759
- const getInputProps = (0, import_react7.useCallback)(
5760
- () => ({
5761
- ...inputProps,
5762
- ref: ref || dateInputRef,
5763
- className: slots.input({ class: classNames == null ? void 0 : classNames.input }),
5764
- size: 0,
5765
- type,
5766
- value: value !== void 0 ? value : type === "date" ? selectedDate || "" : type === "time" ? selectedTime || "" : "",
5767
- onChange: (e) => {
5768
- if (type === "date") {
5769
- handleChangeDate(e.target.value);
5770
- if (onChangeDate) {
5771
- onChangeDate(e.target.value);
5772
- }
5773
- } else if (type === "time") {
5774
- handleChangeTime(e.target.value);
5775
- if (onChangeTime) {
5776
- onChangeTime(e.target.value);
5777
- }
5778
- }
5779
- },
5780
- onFocus: (e) => {
5781
- handleFocusInput();
5782
- },
5783
- onBlur: (e) => {
5784
- handleBlueInput();
5785
- },
5786
- max: "9999-12-31"
5787
- }),
5788
- [inputProps, ref, dateInputRef, slots, classNames == null ? void 0 : classNames.input, selectedDate, selectedTime, type, value]
5789
- );
5790
- const getContentProps = (0, import_react7.useCallback)(
5791
- () => ({
5792
- className: slots.content({ class: classNames == null ? void 0 : classNames.content }),
5793
- size: originalProps.size
5794
- }),
5795
- [slots, classNames, originalProps.size]
5796
- );
5797
- const getErrorMessageProps = (0, import_react7.useCallback)(
5798
- () => ({
5799
- className: slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })
5800
- }),
5801
- [slots, classNames]
5802
- );
5803
- const renderStartContent = () => {
5804
- if (import_react7.default.isValidElement(startContent)) {
5805
- const existingProps = startContent.props;
5806
- const mergedProps = {
5807
- ...getContentProps(),
5808
- className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
5809
- };
5810
- return import_react7.default.cloneElement(startContent, mergedProps);
5811
- } else {
5812
- const contentProps = getContentProps();
5813
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ...contentProps, children: startContent });
5432
+ const [isPanelOpen, setIsPanelOpen] = (0, import_react2.useState)(false);
5433
+ const inputWrapperRef = (0, import_react2.useRef)(null);
5434
+ const panelWrapperRef = (0, import_react2.useRef)(null);
5435
+ const [panelPos, setPanelPos] = (0, import_react2.useState)({ top: -9999, left: -9999 });
5436
+ const displayValue = (0, import_react2.useMemo)(() => {
5437
+ if (selectedRange.start && selectedRange.end) {
5438
+ return `${selectedRange.start} ~ ${selectedRange.end}`;
5814
5439
  }
5815
- };
5816
- const renderDateTimePickerIcon = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ...getContentProps(), onClick: handleToggleDatePicker, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5817
- Icon_default,
5818
- {
5819
- name: type === "time" ? "clock" : "calendar",
5820
- size: originalProps.size,
5821
- className: "cursor-pointer",
5822
- fill: type === "date"
5823
- }
5824
- ) });
5825
- const renderContentWithIcon = () => {
5826
- if (import_react7.default.isValidElement(endContent)) {
5827
- const existingProps = endContent.props;
5828
- const mergedProps = {
5829
- ...getContentProps(),
5830
- className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
5831
- };
5832
- return import_react7.default.cloneElement(endContent, mergedProps);
5833
- } else if (errorMessage) {
5834
- const iconProps = { ...getContentProps(), className: getContentProps().className };
5835
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ...iconProps, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon_default, { name: "exclamation-circle", fill: true, size: originalProps.size }) });
5836
- } else {
5837
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, {});
5440
+ return "";
5441
+ }, [selectedRange]);
5442
+ const calculatePosition = (0, import_react2.useCallback)(() => {
5443
+ if (inputWrapperRef.current) {
5444
+ const rect = inputWrapperRef.current.getBoundingClientRect();
5445
+ setPanelPos({ top: rect.bottom + window.scrollY + 6, left: rect.left + window.scrollX });
5838
5446
  }
5447
+ }, []);
5448
+ const handleFocusInput = () => {
5449
+ calculatePosition();
5450
+ setIsPanelOpen(true);
5839
5451
  };
5840
- const renderEndContent = () => {
5841
- switch (type) {
5842
- case "date":
5843
- case "datetime-local":
5844
- case "month":
5845
- case "week":
5846
- case "time":
5847
- return renderDateTimePickerIcon();
5848
- default:
5849
- return renderContentWithIcon();
5452
+ const handleInputBlur = () => {
5453
+ setTimeout(() => setIsPanelOpen(false), 150);
5454
+ };
5455
+ const handleInputKeyDown = (e) => {
5456
+ if (e.key === "Enter" || e.key === " ") {
5457
+ e.preventDefault();
5458
+ calculatePosition();
5459
+ setIsPanelOpen((prev) => !prev);
5460
+ } else if (e.key === "Escape") {
5461
+ setIsPanelOpen(false);
5850
5462
  }
5851
5463
  };
5852
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
5853
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ...getBaseProps(), children: [
5854
- label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { ...getLabelProps(), children: label }),
5855
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ...getInnerWrapperProps(), children: [
5856
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ...getInputWrapperProps(), children: [
5857
- startContent && renderStartContent(),
5858
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { ...getInputProps() }),
5859
- renderEndContent()
5464
+ const slots = (0, import_react2.useMemo)(() => timePickerStyle({ ...variantProps }), [variantProps]);
5465
+ const renderHourOptions = () => {
5466
+ return Array.from({ length: 24 }, (_, i) => {
5467
+ const value = String(i).padStart(2, "0");
5468
+ return { label: value, value };
5469
+ });
5470
+ };
5471
+ const renderMinuteOptions = () => {
5472
+ return Array.from({ length: 60 }, (_, i) => {
5473
+ const value = String(i).padStart(2, "0");
5474
+ return { label: value, value };
5475
+ });
5476
+ };
5477
+ const defaultSelectClassNames = {
5478
+ selectWrapper: "!w-[80px]",
5479
+ optionsWrapper: "max-h-[300px]"
5480
+ };
5481
+ const handleRangeChange = (type, option) => {
5482
+ const [shRaw, smRaw] = selectedRange.start.split(":");
5483
+ const [ehRaw, emRaw] = selectedRange.end.split(":");
5484
+ const sh = (shRaw != null ? shRaw : "00").padStart(2, "0");
5485
+ const sm = (smRaw != null ? smRaw : "00").padStart(2, "0");
5486
+ const eh = (ehRaw != null ? ehRaw : "00").padStart(2, "0");
5487
+ const em = (emRaw != null ? emRaw : "00").padStart(2, "0");
5488
+ const range = {
5489
+ start: `${type === "startHour" ? option.value : sh}:${type === "startMinute" ? option.value : sm}`,
5490
+ end: `${type === "endHour" ? option.value : eh}:${type === "endMinute" ? option.value : em}`
5491
+ };
5492
+ setSelectedRange(range);
5493
+ onChangeRange == null ? void 0 : onChangeRange(range);
5494
+ };
5495
+ const mergedSelectClassNames = {
5496
+ selectWrapper: (selectClassNames == null ? void 0 : selectClassNames.selectWrapper) || defaultSelectClassNames.selectWrapper,
5497
+ optionsWrapper: (selectClassNames == null ? void 0 : selectClassNames.optionsWrapper) || defaultSelectClassNames.optionsWrapper
5498
+ };
5499
+ const getSelectValue = (timeString, part) => {
5500
+ if (!timeString) return "00";
5501
+ const [hour, minute] = timeString.split(":");
5502
+ return part === "hour" ? hour || "00" : minute || "00";
5503
+ };
5504
+ const handleClearRange = () => {
5505
+ const emptyRange = { start: "", end: "" };
5506
+ setSelectedRange(emptyRange);
5507
+ onChangeRange == null ? void 0 : onChangeRange(emptyRange);
5508
+ };
5509
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
5510
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
5511
+ label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
5512
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
5513
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref: inputWrapperRef, className: slots.inputWrapper({ class: classNames == null ? void 0 : classNames.inputWrapper }), children: [
5514
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5515
+ "input",
5516
+ {
5517
+ ...inputProps,
5518
+ ref,
5519
+ className: slots.input({ class: classNames == null ? void 0 : classNames.input }),
5520
+ type: "text",
5521
+ value: displayValue,
5522
+ placeholder,
5523
+ readOnly: true,
5524
+ onFocus: handleFocusInput,
5525
+ onBlur: handleInputBlur,
5526
+ onKeyDown: handleInputKeyDown
5527
+ }
5528
+ ),
5529
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: slots.icon({ class: classNames == null ? void 0 : classNames.icon }), children: [
5530
+ displayValue && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5531
+ Icon_default,
5532
+ {
5533
+ name: "close",
5534
+ className: "text-neutral-light hover:text-neutral-main mr-[5px] cursor-pointer",
5535
+ onClick: (e) => {
5536
+ e.stopPropagation();
5537
+ handleClearRange();
5538
+ }
5539
+ }
5540
+ ),
5541
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5542
+ Icon_default,
5543
+ {
5544
+ name: "clock",
5545
+ className: "cursor-pointer",
5546
+ onClick: () => {
5547
+ calculatePosition();
5548
+ setIsPanelOpen((v) => !v);
5549
+ }
5550
+ }
5551
+ )
5552
+ ] })
5860
5553
  ] }),
5861
- errorMessage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { ...getErrorMessageProps(), children: errorMessage })
5554
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage }), children: errorMessage })
5862
5555
  ] })
5863
5556
  ] }),
5864
- targetRect && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: (0, import_react_dom.createPortal)(
5865
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
5557
+ isPanelOpen && (0, import_react_dom2.createPortal)(
5558
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5866
5559
  "div",
5867
5560
  {
5868
- ref: datePickerWrapperRef,
5561
+ ref: panelWrapperRef,
5562
+ className: slots.optionsWrapper({ class: classNames == null ? void 0 : classNames.optionsWrapper }),
5869
5563
  style: {
5870
5564
  position: "absolute",
5871
- top: (position == null ? void 0 : position.top) || -99999,
5872
- left: (position == null ? void 0 : position.left) || -99999,
5565
+ top: panelPos.top,
5566
+ left: panelPos.left,
5873
5567
  zIndex: 1e3
5874
5568
  },
5875
- children: [
5876
- type === "date" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5877
- calendar_default,
5878
- {
5879
- color: originalProps.color,
5880
- selectedDate,
5881
- highlightWeekend: originalProps.highlightWeekend,
5882
- onChangeDate: (date) => {
5883
- handleChangeDate(date);
5884
- if (onChangeDate) onChangeDate(date);
5569
+ onMouseDown: (e) => e.preventDefault(),
5570
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "bg-body-background text-neutral-main flex items-center gap-[5px] p-[10px]", children: [
5571
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-[5px]", children: [
5572
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5573
+ select_default,
5574
+ {
5575
+ options: renderHourOptions(),
5576
+ value: getSelectValue(selectedRange.start, "hour"),
5577
+ onChange: (options) => {
5578
+ if (options[0]) handleRangeChange("startHour", options[0]);
5579
+ },
5580
+ classNames: mergedSelectClassNames
5885
5581
  }
5886
- }
5887
- ),
5888
- type === "time" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5889
- timePicker_default,
5890
- {
5891
- color: originalProps.color,
5892
- selectedTime,
5893
- isFocusInput,
5894
- onChangeTime: (time) => {
5895
- handleChangeTime(time);
5896
- if (onChangeTime) onChangeTime(time);
5582
+ ),
5583
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: ":" }),
5584
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5585
+ select_default,
5586
+ {
5587
+ options: renderMinuteOptions(),
5588
+ value: getSelectValue(selectedRange.start, "minute"),
5589
+ onChange: (options) => {
5590
+ if (options[0]) handleRangeChange("startMinute", options[0]);
5591
+ },
5592
+ classNames: mergedSelectClassNames
5897
5593
  }
5898
- }
5899
- )
5900
- ]
5594
+ )
5595
+ ] }),
5596
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "~" }),
5597
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-[5px]", children: [
5598
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5599
+ select_default,
5600
+ {
5601
+ options: renderHourOptions(),
5602
+ value: getSelectValue(selectedRange.end, "hour"),
5603
+ onChange: (options) => {
5604
+ if (options[0]) handleRangeChange("endHour", options[0]);
5605
+ },
5606
+ classNames: mergedSelectClassNames
5607
+ }
5608
+ ),
5609
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: ":" }),
5610
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5611
+ select_default,
5612
+ {
5613
+ options: renderMinuteOptions(),
5614
+ value: getSelectValue(selectedRange.end, "minute"),
5615
+ onChange: (options) => {
5616
+ if (options[0]) handleRangeChange("endMinute", options[0]);
5617
+ },
5618
+ classNames: mergedSelectClassNames
5619
+ }
5620
+ )
5621
+ ] })
5622
+ ] })
5901
5623
  }
5902
5624
  ),
5903
5625
  document.body
5904
- ) })
5626
+ )
5905
5627
  ] });
5906
5628
  });
5907
- DatePicker.displayName = "DatePicker";
5908
- var dateTimePicker_default = DatePicker;
5909
- var dateTimePickerStyle = tv({
5629
+ TimePicker.displayName = "TimePicker";
5630
+ var timePicker_default = TimePicker;
5631
+ var timePickerStyle = tv({
5910
5632
  slots: {
5911
- base: ["group/input", "flex", "flex-col", "inline-block"],
5912
- label: ["flex", "items-center"],
5913
- innerWrapper: ["flex", "flex-col"],
5633
+ base: ["group/timepicker", "flex", "flex-col"],
5634
+ label: ["flex", "items-center", "font-bold", "text-body-foreground", "min-w-[80px]"],
5635
+ wrapper: ["flex", "flex-col"],
5914
5636
  inputWrapper: [
5915
5637
  "flex",
5916
5638
  "items-center",
5917
- "transition",
5918
- "duration-200",
5919
- "group-has-[p]/input:border-danger-main",
5920
- "group-has-[p]/input:bg-danger-soft"
5639
+ "justify-between",
5640
+ "border",
5641
+ "cursor-pointer",
5642
+ "text-neutral-main",
5643
+ "hover:bg-trans-soft",
5644
+ "group-has-[p.error]/input:border-danger-main",
5645
+ "group-has-[p.error]/input:bg-danger-soft",
5646
+ "group-has-[p.error]/input:text-danger-main",
5647
+ "group-has-[p.error]/input:hover:bg-danger-soft"
5648
+ ],
5649
+ input: [
5650
+ "bg-transparent",
5651
+ "w-full",
5652
+ "outline-none",
5653
+ "placeholder:text-neutral-main",
5654
+ "text-body-foreground",
5655
+ "group-has-[p.error]/input:text-danger-main",
5656
+ "group-has-[p.error]/input:placeholder:text-danger-main",
5657
+ "cursor-pointer"
5921
5658
  ],
5922
- input: ["w-full", "h-full", "bg-transparent", "placeholder:text-neutral-main", "focus-visible:outline-none"],
5923
- content: ["flex", "items-center", "select-none", "group-has-[p]/input:text-danger-main"],
5924
- errorMessage: ["text-danger-main"]
5659
+ icon: ["flex", "items-center", "select-none", "text-body-foreground", "group-has-[p.error]/input:text-danger-main"],
5660
+ optionsWrapper: ["border", "rounded", "bg-body-background", "shadow", "overflow-auto"],
5661
+ errorMessage: ["text-danger-main", "mt-1", "text-sm"],
5662
+ selectWrapper: []
5925
5663
  },
5926
5664
  variants: {
5927
- variant: {
5928
- solid: {
5929
- inputWrapper: ["bg-trans-soft", "hover:bg-trans-light", "has-[:focus]:bg-trans-light"]
5930
- },
5931
- normal: {
5932
- inputWrapper: [
5933
- "bg-transparent",
5934
- "border",
5935
- "border-neutral-main",
5936
- "hover:bg-trans-soft",
5937
- "has-[:focus]:bg-trans-soft"
5938
- ]
5939
- },
5940
- line: {
5941
- inputWrapper: [
5942
- "bg-transparent",
5943
- "border-b",
5944
- "border-neutral-main",
5945
- "!rounded-none",
5946
- "hover:bg-trans-soft",
5947
- "has-[:focus]:bg-trans-soft"
5948
- ]
5949
- }
5950
- },
5951
5665
  color: {
5952
5666
  primary: {
5953
- inputWrapper: ["has-[:focus]:border-primary-main"],
5954
- content: ["text-primary-main"]
5667
+ icon: ["text-primary-main"]
5955
5668
  },
5956
5669
  secondary: {
5957
- inputWrapper: ["has-[:focus]:border-secondary-main"],
5958
- content: ["text-secondary-main"]
5670
+ icon: ["text-secondary-main"]
5959
5671
  }
5960
5672
  },
5961
5673
  size: {
5962
5674
  sm: {
5963
- base: ["text-sm", "gap-[6px]"],
5964
- innerWrapper: ["group-has-[p]/input:gap-[6px]"],
5965
- inputWrapper: ["w-[240px]", "h-[24px]", "rounded-sm", "px-[6px]", "py-[4.5px]", "gap-[6px]"],
5675
+ base: ["text-sm", "gap-[4px]"],
5676
+ label: ["text-sm"],
5677
+ wrapper: ["gap-[4px]"],
5678
+ inputWrapper: ["w-[240px]", "h-[24px]", "rounded-sm", "px-[4px]"],
5679
+ input: ["text-sm"],
5680
+ icon: ["text-sm"],
5966
5681
  errorMessage: ["text-sm"]
5967
5682
  },
5968
5683
  md: {
5969
- base: ["text-md", "gap-[8px]"],
5970
- innerWrapper: ["group-has-[p]/input:gap-[8px]"],
5971
- inputWrapper: ["w-[240px]", "h-[30px]", "rounded-md", "px-[8px]", "py-[6.5px]", "gap-[8px]"],
5972
- errorMessage: ["text-md"]
5684
+ base: ["text-md", "gap-[6px]"],
5685
+ label: ["text-md"],
5686
+ wrapper: ["gap-[6px]"],
5687
+ inputWrapper: ["w-[240px]", "h-[32px]", "rounded-md", "px-[6px]"],
5688
+ input: ["text-md"],
5689
+ icon: ["text-md"],
5690
+ errorMessage: ["text-sm"]
5973
5691
  },
5974
5692
  lg: {
5975
- base: ["text-lg", "gap-[10px]"],
5976
- innerWrapper: ["group-has-[p]/input:gap-[10px]"],
5977
- inputWrapper: ["w-[240px]", "h-[36px]", "rounded-lg", "px-[10px]", "py-[8px]", "gap-[10px]"],
5978
- errorMessage: ["text-lg"]
5693
+ base: ["text-lg", "gap-[8px]"],
5694
+ label: ["text-lg"],
5695
+ wrapper: ["gap-[8px]"],
5696
+ inputWrapper: ["w-[240px]", "h-[40px]", "rounded-lg", "px-[8px]"],
5697
+ input: ["text-lg"],
5698
+ icon: ["text-lg"],
5699
+ errorMessage: ["text-md"]
5979
5700
  },
5980
5701
  xl: {
5981
5702
  base: ["text-xl", "gap-[10px]"],
5982
- innerWrapper: ["group-has-[p]/input:gap-[10px]"],
5983
- inputWrapper: ["w-[240px]", "h-[36px]", "rounded-xl", "px-[10px]", "py-[8px]", "gap-[10px]"],
5984
- errorMessage: ["text-xl"]
5985
- }
5986
- },
5987
- radius: {
5988
- default: "",
5989
- none: {
5990
- inputWrapper: ["rounded-none"]
5991
- },
5992
- full: {
5993
- inputWrapper: ["rounded-full"]
5703
+ label: ["text-xl"],
5704
+ wrapper: ["gap-[10px]"],
5705
+ inputWrapper: ["w-[240px]", "h-[50px]", "rounded-lg", "px-[10px]"],
5706
+ input: ["text-xl"],
5707
+ icon: ["text-xl"],
5708
+ errorMessage: ["text-md"]
5994
5709
  }
5995
5710
  },
5996
5711
  full: {
5997
5712
  true: {
5998
5713
  base: ["w-full"],
5999
- innerWrapper: ["flex-1"],
5714
+ wrapper: ["w-full"],
6000
5715
  inputWrapper: ["w-full"]
6001
5716
  }
6002
5717
  },
6003
5718
  disabled: {
6004
5719
  true: {
5720
+ base: ["pointer-events-none"],
6005
5721
  label: ["text-neutral-light"],
6006
- inputWrapper: ["bg-neutral-soft", "border-neutral-light", "pointer-events-none"],
6007
- input: ["text-neutral-light", "placeholder:text-neutral-light"],
6008
- content: ["text-neutral-light"],
5722
+ inputWrapper: [
5723
+ "bg-neutral-soft",
5724
+ "border-neutral-light",
5725
+ "group-has-[p.error]/input:text-danger-light",
5726
+ "group-has-[p.error]/input:bg-danger-soft",
5727
+ "group-has-[p.error]/input:border-danger-light",
5728
+ "cursor-not-allowed"
5729
+ ],
5730
+ input: [
5731
+ "text-neutral-light",
5732
+ "placeholder:text-neutral-light",
5733
+ "group-has-[p.error]/input:text-danger-light",
5734
+ "group-has-[p.error]/input:placeholder:text-danger-light",
5735
+ "cursor-not-allowed"
5736
+ ],
5737
+ icon: ["text-neutral-light"],
6009
5738
  errorMessage: ["text-danger-light"]
6010
5739
  }
6011
- },
6012
- isRequired: {
6013
- true: {
6014
- label: ["after:content-['*']", "after:text-danger-main", "after:ml-0.5"]
6015
- }
6016
5740
  }
6017
5741
  },
6018
5742
  defaultVariants: {
6019
- variant: "solid",
6020
5743
  color: "primary",
6021
5744
  size: "md",
6022
5745
  full: false,
6023
- disabled: false,
6024
- isRequired: false
6025
- },
6026
- compoundVariants: [
6027
- {
6028
- disabled: true,
6029
- isRequired: true,
6030
- class: {
6031
- label: ["after:text-danger-light"]
6032
- }
6033
- }
6034
- ]
5746
+ disabled: false
5747
+ }
6035
5748
  });
6036
5749
  // Annotate the CommonJS export names for ESM import in node:
6037
5750
  0 && (module.exports = {
6038
- dateTimePickerStyle
5751
+ timePickerStyle
6039
5752
  });