@deepnoid/ui 0.1.206 → 0.1.208

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 (67) hide show
  1. package/.turbo/turbo-build.log +494 -484
  2. package/dist/chunk-3IBJXQTJ.mjs +42 -0
  3. package/dist/chunk-4TAZM6EF.mjs +285 -0
  4. package/dist/chunk-I4YRN4UE.mjs +79 -0
  5. package/dist/{chunk-BTO7MP5N.mjs → chunk-JPNMYMDN.mjs} +4 -4
  6. package/dist/chunk-QBWQHWNV.mjs +81 -0
  7. package/dist/components/breadcrumb/breadcrumb.mjs +1 -1
  8. package/dist/components/breadcrumb/index.mjs +1 -1
  9. package/dist/components/button/button.mjs +1 -1
  10. package/dist/components/button/icon-button.mjs +1 -1
  11. package/dist/components/button/index.mjs +1 -1
  12. package/dist/components/chip/chip.mjs +1 -1
  13. package/dist/components/chip/index.mjs +1 -1
  14. package/dist/components/fileUpload/fileUpload.mjs +1 -1
  15. package/dist/components/fileUpload/index.mjs +1 -1
  16. package/dist/components/input/index.mjs +1 -1
  17. package/dist/components/input/input.mjs +1 -1
  18. package/dist/components/list/index.mjs +3 -3
  19. package/dist/components/list/listItem.mjs +3 -3
  20. package/dist/components/modal/index.mjs +4 -4
  21. package/dist/components/modal/modal.mjs +4 -4
  22. package/dist/components/pagination/index.mjs +1 -1
  23. package/dist/components/pagination/pagination.mjs +1 -1
  24. package/dist/components/picker/datePicker.mjs +3 -3
  25. package/dist/components/picker/index.d.mts +1 -1
  26. package/dist/components/picker/index.d.ts +1 -1
  27. package/dist/components/picker/index.js +266 -679
  28. package/dist/components/picker/index.mjs +8 -8
  29. package/dist/components/picker/timePicker/Panel.d.mts +11 -0
  30. package/dist/components/picker/timePicker/Panel.d.ts +11 -0
  31. package/dist/components/picker/timePicker/Panel.js +740 -0
  32. package/dist/components/picker/timePicker/Panel.mjs +26 -0
  33. package/dist/components/picker/timePicker/WheelColumn.d.mts +10 -0
  34. package/dist/components/picker/timePicker/WheelColumn.d.ts +10 -0
  35. package/dist/components/picker/timePicker/WheelColumn.js +98 -0
  36. package/dist/components/picker/timePicker/WheelColumn.mjs +8 -0
  37. package/dist/components/picker/{timePicker.d.ts → timePicker/index.d.mts} +41 -52
  38. package/dist/components/picker/{timePicker.d.mts → timePicker/index.d.ts} +41 -52
  39. package/dist/components/picker/{timePicker.js → timePicker/index.js} +702 -1003
  40. package/dist/components/picker/timePicker/index.mjs +29 -0
  41. package/dist/components/picker/utils.d.mts +11 -1
  42. package/dist/components/picker/utils.d.ts +11 -1
  43. package/dist/components/picker/utils.js +28 -2
  44. package/dist/components/picker/utils.mjs +7 -3
  45. package/dist/components/select/index.mjs +1 -1
  46. package/dist/components/select/select.mjs +1 -1
  47. package/dist/components/starRating/index.mjs +1 -1
  48. package/dist/components/starRating/starRating.mjs +1 -1
  49. package/dist/components/table/index.mjs +1 -1
  50. package/dist/components/table/table-body.mjs +1 -1
  51. package/dist/components/table/table-head.mjs +1 -1
  52. package/dist/components/table/table.mjs +1 -1
  53. package/dist/components/timePicker/calendar.mjs +2 -2
  54. package/dist/components/timePicker/useDateTimePicker.mjs +1 -1
  55. package/dist/components/toast/index.mjs +1 -1
  56. package/dist/components/toast/toast.mjs +1 -1
  57. package/dist/components/toast/use-toast.mjs +1 -1
  58. package/dist/index.d.mts +1 -1
  59. package/dist/index.d.ts +1 -1
  60. package/dist/index.js +479 -397
  61. package/dist/index.mjs +40 -38
  62. package/package.json +1 -1
  63. package/dist/chunk-COGGK5Q6.mjs +0 -365
  64. package/dist/chunk-FWFEKWWD.mjs +0 -18
  65. package/dist/components/picker/timePicker.mjs +0 -26
  66. package/dist/{chunk-IG7QEXDU.mjs → chunk-D72ILS4A.mjs} +3 -3
  67. package/dist/{chunk-YO4PZXCM.mjs → chunk-K3M3QEEV.mjs} +3 -3
@@ -99,15 +99,15 @@ var require_plugin = __commonJS({
99
99
  }
100
100
  });
101
101
 
102
- // src/components/picker/timePicker.tsx
102
+ // src/components/picker/timePicker/index.tsx
103
103
  var timePicker_exports = {};
104
104
  __export(timePicker_exports, {
105
105
  default: () => timePicker_default,
106
106
  timePickerStyle: () => timePickerStyle
107
107
  });
108
108
  module.exports = __toCommonJS(timePicker_exports);
109
- var import_react4 = require("react");
110
- var import_react_dom2 = require("react-dom");
109
+ var import_react5 = require("react");
110
+ var import_react_dom = require("react-dom");
111
111
 
112
112
  // src/utils/tailwind-variants.ts
113
113
  var import_tailwind_variants = require("tailwind-variants");
@@ -5157,9 +5157,85 @@ var Icon = ({ name, size = "md", fill = false, className, onClick, ...props }) =
5157
5157
  };
5158
5158
  var Icon_default = Icon;
5159
5159
 
5160
- // src/components/select/select.tsx
5160
+ // src/components/picker/timePicker/Panel.tsx
5161
5161
  var import_react3 = require("react");
5162
- var import_react_dom = require("react-dom");
5162
+
5163
+ // src/components/picker/timePicker/WheelColumn.tsx
5164
+ var import_react = require("react");
5165
+ var import_jsx_runtime3 = require("react/jsx-runtime");
5166
+ var ITEM_HEIGHT = 30;
5167
+ var ACTIVE_HEIGHT = 34;
5168
+ function WheelColumn({ list, value, onChange }) {
5169
+ const ref = (0, import_react.useRef)(null);
5170
+ const internalChangeRef = (0, import_react.useRef)(false);
5171
+ const [currentIndex, setCurrentIndex] = (0, import_react.useState)(0);
5172
+ const scrollToIndex = (index, behavior = "smooth") => {
5173
+ if (!ref.current) return;
5174
+ const diff = ACTIVE_HEIGHT - ITEM_HEIGHT;
5175
+ let centerOffset = index > 0 && behavior === "auto" ? diff : 0;
5176
+ if (behavior === "auto" && currentIndex !== 0) centerOffset -= 4;
5177
+ const top = index * ITEM_HEIGHT + centerOffset;
5178
+ ref.current.scrollTo({ top, behavior });
5179
+ };
5180
+ const finalizeScroll = (index) => {
5181
+ internalChangeRef.current = true;
5182
+ const v = list[index];
5183
+ setCurrentIndex(index);
5184
+ scrollToIndex(index, "smooth");
5185
+ if (v) onChange(v);
5186
+ };
5187
+ const handleClick = (index) => finalizeScroll(index);
5188
+ (0, import_react.useEffect)(() => {
5189
+ if (!ref.current || !value) return;
5190
+ const idx = list.indexOf(value);
5191
+ if (idx < 0) return;
5192
+ if (internalChangeRef.current) {
5193
+ internalChangeRef.current = false;
5194
+ return;
5195
+ }
5196
+ setCurrentIndex(idx);
5197
+ scrollToIndex(idx, "auto");
5198
+ }, [value]);
5199
+ (0, import_react.useEffect)(() => {
5200
+ const el = ref.current;
5201
+ if (!el) return;
5202
+ const handleWheel = (e) => {
5203
+ e.preventDefault();
5204
+ let newIndex = currentIndex;
5205
+ if (e.deltaY > 0) {
5206
+ newIndex = Math.min(currentIndex + 1, list.length - 1);
5207
+ } else if (e.deltaY < 0) {
5208
+ newIndex = Math.max(currentIndex - 1, 0);
5209
+ }
5210
+ finalizeScroll(newIndex);
5211
+ };
5212
+ el.addEventListener("wheel", handleWheel, { passive: false });
5213
+ return () => el.removeEventListener("wheel", handleWheel);
5214
+ }, [currentIndex, list, onChange]);
5215
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "relative h-[94px] w-[40px]", children: [
5216
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "pointer-events-none absolute left-1/2 top-[30px] h-[34px] w-[40px] -translate-x-1/2 rounded-[10px] shadow-[inset_0_0_0_1.5px_var(--dn-primary-light)]" }),
5217
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref, className: "scrollbar-none relative h-full select-none overflow-y-scroll py-[0]", children: [
5218
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { height: ITEM_HEIGHT } }),
5219
+ list.map((v, i) => {
5220
+ const isActive = i === currentIndex;
5221
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5222
+ "div",
5223
+ {
5224
+ onClick: () => handleClick(i),
5225
+ className: `flex items-center justify-center text-sm font-bold transition-all ${isActive ? "text-body-foreground" : "text-neutral-light"}`,
5226
+ style: { height: isActive ? ACTIVE_HEIGHT : ITEM_HEIGHT },
5227
+ children: v
5228
+ },
5229
+ i
5230
+ );
5231
+ }),
5232
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { height: list.length >= 3 ? ITEM_HEIGHT + 4 : ITEM_HEIGHT } })
5233
+ ] })
5234
+ ] });
5235
+ }
5236
+
5237
+ // src/components/button/text-button.tsx
5238
+ var import_react2 = require("react");
5163
5239
 
5164
5240
  // src/utils/clsx.ts
5165
5241
  function clsx(...args) {
@@ -5201,138 +5277,64 @@ function toVal(mix) {
5201
5277
  return str;
5202
5278
  }
5203
5279
 
5204
- // src/components/ripple/ripple.tsx
5205
- var import_framer_motion = require("framer-motion");
5206
- var import_jsx_runtime3 = require("react/jsx-runtime");
5207
- var Ripple = (props) => {
5208
- const { ripples = [], motionProps, color = "currentColor", style, onClear } = props;
5209
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: ripples.map((ripple) => {
5210
- const duration = (0, import_framer_motion.clamp)(ripple.size > 100 ? 0.75 : 0.5, 0.01 * ripple.size, 0.2);
5211
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_framer_motion.LazyMotion, { features: import_framer_motion.domAnimation, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_framer_motion.AnimatePresence, { mode: "popLayout", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5212
- import_framer_motion.m.span,
5213
- {
5214
- animate: { transform: "scale(2)", opacity: 0 },
5215
- className: "deepnoidui-ripple",
5216
- exit: { opacity: 0 },
5217
- initial: { transform: "scale(0)", opacity: 0.35 },
5218
- style: {
5219
- position: "absolute",
5220
- backgroundColor: color,
5221
- borderRadius: "100%",
5222
- transformOrigin: "center",
5223
- pointerEvents: "none",
5224
- overflow: "hidden",
5225
- inset: 0,
5226
- zIndex: 0,
5227
- top: ripple.y,
5228
- left: ripple.x,
5229
- width: `${ripple.size}px`,
5230
- height: `${ripple.size}px`,
5231
- ...style
5232
- },
5233
- transition: { duration },
5234
- onAnimationComplete: () => {
5235
- onClear(ripple.key);
5236
- },
5237
- ...motionProps
5238
- }
5239
- ) }) }, ripple.key);
5240
- }) });
5241
- };
5242
- Ripple.displayName = "HeroUI.Ripple";
5243
- var ripple_default = Ripple;
5244
-
5245
- // src/components/ripple/useRipple.ts
5246
- var import_react = require("react");
5247
- function useRipple(props = {}) {
5248
- const [ripples, setRipples] = (0, import_react.useState)([]);
5249
- const getUniqueID = (key) => `${key}-${Math.random().toString(36).substr(2, 9)}`;
5250
- const onPress = (0, import_react.useCallback)((event) => {
5251
- const trigger = event.currentTarget;
5252
- const rect = trigger.getBoundingClientRect();
5253
- const size = Math.max(trigger.clientWidth, trigger.clientHeight);
5254
- setRipples((prevRipples) => [
5255
- ...prevRipples,
5256
- {
5257
- key: getUniqueID(prevRipples.length.toString()),
5258
- size,
5259
- x: event.clientX - rect.left - size / 2,
5260
- y: event.clientY - rect.top - size / 2
5261
- }
5262
- ]);
5263
- }, []);
5264
- const onClear = (0, import_react.useCallback)((key) => {
5265
- setRipples((prevState) => prevState.filter((ripple) => ripple.key !== key));
5266
- }, []);
5267
- return { ripples, onClear, onPress, ...props };
5268
- }
5269
-
5270
- // src/components/button/icon-button.tsx
5271
- var import_react2 = require("react");
5280
+ // src/components/button/text-button.tsx
5272
5281
  var import_jsx_runtime4 = require("react/jsx-runtime");
5273
- var IconButton = (0, import_react2.forwardRef)((props, ref) => {
5274
- const [localProps, variantProps] = mapPropsVariants(props, iconButtonStyle.variantKeys);
5275
- const { classNames, name, disableRipple, disabled, isLoading, size, full, isInGroup, onMouseDown, ...buttonProps } = {
5276
- ...localProps,
5282
+ var TextButton = (0, import_react2.forwardRef)((originalProps, ref) => {
5283
+ const [props, variantProps] = mapPropsVariants(originalProps, textButtonStyle.variantKeys);
5284
+ const { children, startContent, endContent, classNames, variant, disabled, size, ...buttonProps } = {
5285
+ ...props,
5277
5286
  ...variantProps
5278
5287
  };
5279
- const slots = (0, import_react2.useMemo)(() => iconButtonStyle({ ...variantProps }), [variantProps]);
5280
- const { onPress, onClear, ripples } = useRipple();
5281
- const handleRipple = (0, import_react2.useCallback)(
5282
- (e) => {
5283
- if (!disableRipple && !disabled) {
5284
- onPress(e);
5285
- }
5286
- },
5287
- [disableRipple, disabled, onPress]
5288
- );
5289
- const handleMouseDown = (0, import_react2.useCallback)(
5290
- (e) => {
5291
- onMouseDown == null ? void 0 : onMouseDown(e);
5292
- handleRipple(e);
5293
- },
5294
- [onMouseDown, handleRipple]
5295
- );
5296
- const rippleProps = (0, import_react2.useMemo)(() => ({ ripples, onClear }), [ripples, onClear]);
5297
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5288
+ const slots = (0, import_react2.useMemo)(() => textButtonStyle({ ...variantProps }), [variantProps]);
5289
+ const getContentProps = (0, import_react2.useCallback)(() => {
5290
+ const className = slots.content({ class: classNames == null ? void 0 : classNames.content });
5291
+ return { className, size };
5292
+ }, [slots, classNames, size]);
5293
+ const renderContent = (content) => {
5294
+ const contentProps = getContentProps();
5295
+ if ((0, import_react2.isValidElement)(content)) {
5296
+ const _content = content;
5297
+ const contentProps2 = getContentProps();
5298
+ const mergedProps = {
5299
+ ...contentProps2,
5300
+ ...typeof _content.props.className === "string" && {
5301
+ className: clsx(contentProps2.className, _content.props.className)
5302
+ }
5303
+ };
5304
+ return (0, import_react2.cloneElement)(_content, mergedProps);
5305
+ }
5306
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ...contentProps, children: content });
5307
+ };
5308
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5298
5309
  "button",
5299
5310
  {
5300
5311
  ...buttonProps,
5301
- onMouseDown: handleMouseDown,
5302
5312
  ref,
5303
- disabled: disabled || isLoading,
5304
- "data-loading": isLoading,
5305
- className: slots.base({ class: classNames == null ? void 0 : classNames.base }),
5306
- children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon_default, { name: "loading", size, className: "animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
5307
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon_default, { name, size }),
5308
- !disableRipple && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ripple_default, { ...rippleProps })
5309
- ] })
5313
+ disabled,
5314
+ className: clsx(
5315
+ slots.base({ class: classNames == null ? void 0 : classNames.base }),
5316
+ variant === "underline" && slots.underline({ class: classNames == null ? void 0 : classNames.underline })
5317
+ ),
5318
+ children: [
5319
+ startContent && renderContent(startContent),
5320
+ children,
5321
+ endContent && renderContent(endContent)
5322
+ ]
5310
5323
  }
5311
5324
  );
5312
5325
  });
5313
- IconButton.displayName = "IconButton";
5314
- var icon_button_default = IconButton;
5315
- var iconButtonStyle = tv({
5326
+ TextButton.displayName = "TextButton";
5327
+ var text_button_default = TextButton;
5328
+ var textButtonStyle = tv({
5316
5329
  slots: {
5317
- base: [
5318
- "relative",
5319
- "flex",
5320
- "items-center",
5321
- "justify-center",
5322
- "whitespace-nowrap",
5323
- "transition",
5324
- "duration-200",
5325
- "select-none",
5326
- "overflow-hidden",
5327
- "box-border"
5328
- ]
5330
+ base: ["flex", "items-center", "justify-center", "whitespace-nowrap", "overflow-hidden"],
5331
+ content: [],
5332
+ underline: ["underline", "decoration-skip-ink", "underline-offset-auto"]
5329
5333
  },
5330
5334
  variants: {
5331
5335
  variant: {
5332
- solid: [],
5333
- soft: [],
5334
- outline: [],
5335
- ghost: []
5336
+ "non-under": [],
5337
+ underline: []
5336
5338
  },
5337
5339
  color: {
5338
5340
  primary: [],
@@ -5345,24 +5347,25 @@ var iconButtonStyle = tv({
5345
5347
  },
5346
5348
  size: {
5347
5349
  sm: {
5348
- base: ["w-[24px]", "h-[24px]", "rounded-sm"]
5350
+ base: ["text-sm"],
5351
+ underline: ["decoration-[1px]"]
5349
5352
  },
5350
5353
  md: {
5351
- base: ["w-[32px]", "h-[32px]", "rounded-md"]
5354
+ base: ["text-md"],
5355
+ underline: ["decoration-[1.25px]"]
5352
5356
  },
5353
5357
  lg: {
5354
- base: ["w-[40px]", "h-[40px]", "rounded-lg"]
5358
+ base: ["text-lg"],
5359
+ underline: ["decoration-[1.5px]"]
5355
5360
  },
5356
5361
  xl: {
5357
- base: ["w-[50px]", "h-[50px]", "rounded-xl"]
5362
+ base: ["text-xl"],
5363
+ underline: ["decoration-[1.75px]"]
5358
5364
  }
5359
5365
  },
5360
- isLoading: {
5361
- true: {}
5362
- },
5363
5366
  disabled: {
5364
5367
  true: {
5365
- base: ["!bg-neutral-soft", "!border-neutral-soft", "!text-neutral-light", "pointer-events-none"]
5368
+ base: ["!text-neutral-light", "pointer-events-none"]
5366
5369
  }
5367
5370
  },
5368
5371
  isInGroup: {
@@ -5378,960 +5381,641 @@ var iconButtonStyle = tv({
5378
5381
  },
5379
5382
  compoundVariants: [
5380
5383
  {
5381
- variant: "solid",
5382
- color: "primary",
5383
- class: {
5384
- base: ["text-white", "bg-primary-main", "hover:bg-gradient-to-t", "hover:from-white/20", "hover:to-white/20"]
5385
- }
5386
- },
5387
- {
5388
- variant: "solid",
5389
- color: "secondary",
5390
- class: {
5391
- base: ["text-white", "bg-secondary-main", "hover:bg-gradient-to-t", "hover:from-white/20", "hover:to-white/20"]
5392
- }
5393
- },
5394
- {
5395
- variant: "solid",
5396
- color: "neutral",
5397
- class: {
5398
- base: ["text-white", "bg-neutral-main", "hover:bg-gradient-to-t", "hover:from-white/20", "hover:to-white/20"]
5399
- }
5400
- },
5401
- {
5402
- variant: "solid",
5403
- color: "info",
5404
- class: {
5405
- base: ["text-white", "bg-info-main", "hover:bg-gradient-to-t", "hover:from-white/20", "hover:to-white/20"]
5406
- }
5407
- },
5408
- {
5409
- variant: "solid",
5410
- color: "success",
5411
- class: {
5412
- base: ["text-white", "bg-success-main", "hover:bg-gradient-to-t", "hover:from-white/20", "hover:to-white/20"]
5413
- }
5414
- },
5415
- {
5416
- variant: "solid",
5417
- color: "warning",
5418
- class: {
5419
- base: ["text-white", "bg-warning-main", "hover:bg-gradient-to-t", "hover:from-white/20", "hover:to-white/20"]
5420
- }
5421
- },
5422
- {
5423
- variant: "solid",
5424
- color: "danger",
5425
- class: {
5426
- base: ["text-white", "bg-danger-main", "hover:bg-gradient-to-t", "hover:from-white/20", "hover:to-white/20"]
5427
- }
5428
- },
5429
- // soft
5430
- {
5431
- variant: "soft",
5432
5384
  color: "primary",
5433
5385
  class: {
5434
- base: ["text-primary-main", "bg-primary-soft", "!border-primary-soft", "hover:!border-primary-light"]
5386
+ base: ["text-primary-main", "hover:text-primary-dark", "active:text-primary-strong"]
5435
5387
  }
5436
5388
  },
5437
5389
  {
5438
- variant: "soft",
5439
5390
  color: "secondary",
5440
5391
  class: {
5441
- base: ["text-secondary-main", "bg-secondary-soft", "!border-secondary-soft", "hover:!border-secondary-light"]
5392
+ base: ["text-secondary-main", "hover:text-secondary-dark", "active:text-secondary-strong"]
5442
5393
  }
5443
5394
  },
5444
5395
  {
5445
- variant: "soft",
5446
5396
  color: "neutral",
5447
5397
  class: {
5448
- base: ["text-neutral-main", "bg-neutral-soft", "!border-neutral-soft", "hover:!border-neutral-light"]
5398
+ base: ["text-neutral-main", "hover:text-neutral-dark", "active:text-neutral-strong"]
5449
5399
  }
5450
5400
  },
5451
5401
  {
5452
- variant: "soft",
5453
5402
  color: "info",
5454
5403
  class: {
5455
- base: ["text-info-main", "bg-info-soft", "!border-info-soft", "hover:!border-info-light"]
5404
+ base: ["text-info-main", "hover:text-info-dark", "active:text-info-strong"]
5456
5405
  }
5457
5406
  },
5458
5407
  {
5459
- variant: "soft",
5460
5408
  color: "success",
5461
5409
  class: {
5462
- base: ["text-success-main", "bg-success-soft", "!border-success-soft", "hover:!border-success-light"]
5410
+ base: ["text-success-main", "hover:text-success-dark", "active:text-success-strong"]
5463
5411
  }
5464
5412
  },
5465
5413
  {
5466
- variant: "soft",
5467
5414
  color: "warning",
5468
5415
  class: {
5469
- base: ["text-warning-main", "bg-warning-soft", "!border-warning-soft", "hover:!border-warning-light"]
5416
+ base: ["text-warning-main", "hover:text-warning-dark", "active:text-warning-strong"]
5470
5417
  }
5471
5418
  },
5472
5419
  {
5473
- variant: "soft",
5474
5420
  color: "danger",
5475
5421
  class: {
5476
- base: ["text-danger-main", "bg-danger-soft", "!border-danger-soft", "hover:!border-danger-light"]
5477
- }
5478
- },
5479
- // outline
5480
- {
5481
- variant: "outline",
5482
- color: "primary",
5483
- class: {
5484
- base: ["bg-body-background", "!border-primary-main", "text-primary-main", "hover:bg-primary-soft"]
5485
- }
5486
- },
5487
- {
5488
- variant: "outline",
5489
- color: "secondary",
5490
- class: {
5491
- base: ["bg-body-background", "!border-secondary-main", "text-secondary-main", "hover:bg-secondary-soft"]
5492
- }
5493
- },
5494
- {
5495
- variant: "outline",
5496
- color: "neutral",
5497
- class: {
5498
- base: ["bg-body-background", "!border-neutral-light", "text-neutral-main", "hover:bg-neutral-soft"]
5499
- }
5500
- },
5501
- {
5502
- variant: "outline",
5503
- color: "info",
5504
- class: {
5505
- base: ["bg-body-background", "!border-info-main", "text-info-main", "hover:bg-info-soft"]
5506
- }
5507
- },
5508
- {
5509
- variant: "outline",
5510
- color: "success",
5511
- class: {
5512
- base: ["bg-body-background", "!border-success-main", "text-success-main", "hover:bg-success-soft"]
5513
- }
5514
- },
5515
- {
5516
- variant: "outline",
5517
- color: "warning",
5518
- class: {
5519
- base: ["bg-body-background", "!border-warning-main", "text-warning-main", "hover:bg-warning-soft"]
5520
- }
5521
- },
5522
- {
5523
- variant: "outline",
5524
- color: "danger",
5525
- class: {
5526
- base: ["bg-body-background", "!border-danger-main", "text-danger-main", "hover:bg-danger-soft"]
5527
- }
5528
- },
5529
- // ghost
5530
- {
5531
- variant: "ghost",
5532
- color: "primary",
5533
- class: {
5534
- base: ["text-primary-main", "border-transparent", "hover:bg-primary-soft"]
5535
- }
5536
- },
5537
- {
5538
- variant: "ghost",
5539
- color: "secondary",
5540
- class: {
5541
- base: ["text-secondary-main", "border-transparent", "hover:bg-secondary-soft"]
5542
- }
5543
- },
5544
- {
5545
- variant: "ghost",
5546
- color: "neutral",
5547
- class: {
5548
- base: ["text-neutral-main", "border-transparent", "hover:bg-neutral-soft"]
5549
- }
5550
- },
5551
- {
5552
- variant: "ghost",
5553
- color: "info",
5554
- class: {
5555
- base: ["text-info-main", "border-transparent", "hover:bg-info-soft"]
5556
- }
5557
- },
5558
- {
5559
- variant: "ghost",
5560
- color: "success",
5561
- class: {
5562
- base: ["text-success-main", "border-transparent", "hover:bg-success-soft"]
5563
- }
5564
- },
5565
- {
5566
- variant: "ghost",
5567
- color: "warning",
5568
- class: {
5569
- base: ["text-warning-main", "border-transparent", "hover:bg-warning-soft"]
5570
- }
5571
- },
5572
- {
5573
- variant: "ghost",
5574
- color: "danger",
5575
- class: {
5576
- base: ["text-danger-main", "border-transparent", "hover:bg-danger-soft"]
5577
- }
5578
- },
5579
- // soft/outline + size
5580
- {
5581
- variant: ["soft", "outline"],
5582
- size: "sm",
5583
- class: {
5584
- base: ["border-sm"]
5585
- }
5586
- },
5587
- {
5588
- variant: ["soft", "outline"],
5589
- size: "md",
5590
- class: {
5591
- base: ["border-md"]
5592
- }
5593
- },
5594
- {
5595
- variant: ["soft", "outline"],
5596
- size: "lg",
5597
- class: {
5598
- base: ["border-lg"]
5599
- }
5600
- },
5601
- {
5602
- variant: ["soft", "outline"],
5603
- size: "xl",
5604
- class: {
5605
- base: ["border-xl"]
5606
- }
5607
- },
5608
- // disabled + variant
5609
- {
5610
- variant: ["soft", "ghost"],
5611
- disabled: true,
5612
- class: {
5613
- base: ["!border-neutral-soft"]
5614
- }
5615
- },
5616
- {
5617
- variant: ["outline"],
5618
- disabled: true,
5619
- class: {
5620
- base: ["!border-neutral-light"]
5422
+ base: ["text-danger-main", "hover:text-danger-dark", "active:text-danger-strong"]
5621
5423
  }
5622
5424
  }
5623
5425
  ],
5624
5426
  defaultVariants: {
5625
5427
  size: "md",
5626
- variant: "solid",
5627
5428
  color: "primary",
5628
- full: false,
5429
+ variant: "non-under",
5629
5430
  disabled: false,
5630
- isLoading: false,
5631
5431
  isInGroup: false
5632
5432
  }
5633
5433
  });
5634
5434
 
5635
- // src/components/select/select.tsx
5636
- var import_jsx_runtime5 = require("react/jsx-runtime");
5637
- var ALL_OPTION_VALUE = "__ALL__";
5638
- var Select = (0, import_react3.forwardRef)((originalProps, ref) => {
5639
- var _a, _b, _c;
5640
- const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
5641
- const {
5642
- label,
5643
- options,
5644
- helperMessage,
5645
- errorMessage,
5646
- classNames,
5647
- defaultSelectedOptions,
5648
- onChange,
5649
- multiple,
5650
- enableSelectAll,
5651
- dropdownIconName = "brace-up",
5652
- optionIconName,
5653
- optionIconPlacement,
5654
- clearable,
5655
- ...inputProps
5656
- } = props;
5657
- const slots = (0, import_react3.useMemo)(() => select({ ...variantProps }), [variantProps]);
5658
- const [selectedOptions, setSelectedOptions] = (0, import_react3.useState)(defaultSelectedOptions || []);
5659
- const [targetRect, setTargetRect] = (0, import_react3.useState)(null);
5660
- const [optionWrapperHeight, setOptionWrapperHeight] = (0, import_react3.useState)(0);
5661
- const [isVisible, setIsVisible] = (0, import_react3.useState)(false);
5662
- const [isOpen, setIsOpen] = (0, import_react3.useState)(false);
5663
- const selectWrapperRef = (0, import_react3.useRef)(null);
5664
- const optionWrapperRef = (0, import_react3.useRef)(null);
5665
- const isControlled = originalProps.value !== void 0;
5666
- const openSelect = () => {
5667
- if (selectWrapperRef.current) {
5668
- const rect = selectWrapperRef.current.getBoundingClientRect();
5669
- setTargetRect(rect);
5670
- setIsVisible(true);
5671
- requestAnimationFrame(() => setIsOpen(true));
5672
- }
5673
- };
5674
- const closeSelect = () => {
5675
- setIsOpen(false);
5676
- setTimeout(() => setIsVisible(false), 150);
5677
- };
5678
- const handleToggleSelect = () => {
5679
- isOpen ? closeSelect() : openSelect();
5435
+ // src/components/picker/utils.ts
5436
+ var convert24To12 = (time24) => {
5437
+ const [HH, MM] = time24.split(":");
5438
+ let h = Number(HH);
5439
+ const minute = MM || "";
5440
+ const meridiem = h >= 12 ? "PM" : "AM";
5441
+ let hour12 = h % 12;
5442
+ if (hour12 === 0) hour12 = 12;
5443
+ const hour = String(hour12).padStart(2, "0");
5444
+ return { hour, minute, meridiem };
5445
+ };
5446
+ var getCurrent12Hour = () => {
5447
+ const now = /* @__PURE__ */ new Date();
5448
+ let hour = now.getHours();
5449
+ const minute = String(now.getMinutes()).padStart(2, "0");
5450
+ const meridiem = hour >= 12 ? "PM" : "AM";
5451
+ hour = hour % 12 || 12;
5452
+ return {
5453
+ hour: String(hour).padStart(2, "0"),
5454
+ minute,
5455
+ meridiem
5680
5456
  };
5681
- const calculatePositionWithScroll = (rect, height) => {
5682
- const scrollTop = window.scrollY;
5683
- const scrollLeft = window.scrollX;
5684
- const spaceBelow = window.innerHeight - (rect.y + rect.height + 4);
5685
- const spaceAbove = rect.y - 4;
5686
- const top = spaceBelow < height && spaceAbove > height ? rect.y - height - 4 : rect.y + rect.height + 4;
5687
- return {
5688
- top: top + scrollTop,
5689
- left: rect.x + scrollLeft
5457
+ };
5458
+
5459
+ // src/components/picker/timePicker/Panel.tsx
5460
+ var import_jsx_runtime5 = require("react/jsx-runtime");
5461
+ var hours = [...Array(12)].map((_, i) => String(i + 1).padStart(2, "0"));
5462
+ var minutes = [...Array(60)].map((_, i) => String(i).padStart(2, "0"));
5463
+ var meridiemList = ["AM", "PM"];
5464
+ var TimePickerPanel = (0, import_react3.forwardRef)(
5465
+ ({ value, onChange, nowTitle, confirmTitle }, ref) => {
5466
+ const [time, setTime] = (0, import_react3.useState)({ hour: "", minute: "", meridiem: "" });
5467
+ const handleNow = () => {
5468
+ setTime(getCurrent12Hour());
5690
5469
  };
5691
- };
5692
- const handleChangeOption = (option) => {
5693
- let nextOptions = [];
5694
- if (multiple) {
5695
- if (enableSelectAll && option.value === ALL_OPTION_VALUE) {
5696
- nextOptions = selectedOptions.length === options.length ? [] : [...options];
5470
+ const handleConfirm = (time2) => {
5471
+ const { hour, minute, meridiem } = time2;
5472
+ let h = Number(hour);
5473
+ if (meridiem === "AM") {
5474
+ if (h === 12) h = 0;
5697
5475
  } else {
5698
- const exists = selectedOptions.some((o) => o.value === option.value);
5699
- nextOptions = exists ? selectedOptions.filter((o) => o.value !== option.value) : [...selectedOptions, option];
5476
+ if (h !== 12) h += 12;
5700
5477
  }
5478
+ const HH = String(h).padStart(2, "0");
5479
+ const MM = minute.padStart(2, "0");
5480
+ const SS = "00";
5481
+ onChange(`${HH}:${MM}:${SS}`);
5482
+ };
5483
+ (0, import_react3.useEffect)(() => {
5484
+ setTime(value ? convert24To12(value) : getCurrent12Hour());
5485
+ }, [value]);
5486
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
5487
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { ref, className: "flex gap-[10px]", children: [
5488
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center justify-center gap-[5px]", children: [
5489
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(WheelColumn, { list: hours, value: time.hour, onChange: (v) => setTime({ ...time, hour: v }) }),
5490
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "w-[5px] text-sm font-bold", children: ":" }),
5491
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(WheelColumn, { list: minutes, value: time.minute, onChange: (v) => setTime({ ...time, minute: v }) })
5492
+ ] }),
5493
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(WheelColumn, { list: meridiemList, value: time.meridiem, onChange: (v) => setTime({ ...time, meridiem: v }) })
5494
+ ] }),
5495
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex justify-between px-1 text-sm", children: [
5496
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5497
+ text_button_default,
5498
+ {
5499
+ variant: "underline",
5500
+ color: "neutral",
5501
+ size: "sm",
5502
+ classNames: { base: "font-bold" },
5503
+ onClick: handleNow,
5504
+ children: nowTitle
5505
+ }
5506
+ ),
5507
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5508
+ text_button_default,
5509
+ {
5510
+ variant: "underline",
5511
+ size: "sm",
5512
+ classNames: { base: "font-bold" },
5513
+ onClick: () => handleConfirm(time),
5514
+ children: confirmTitle
5515
+ }
5516
+ )
5517
+ ] })
5518
+ ] });
5519
+ }
5520
+ );
5521
+ var Panel_default = TimePickerPanel;
5522
+
5523
+ // src/components/input/input.tsx
5524
+ var import_react4 = require("react");
5525
+ var import_jsx_runtime6 = require("react/jsx-runtime");
5526
+ var Input = (0, import_react4.forwardRef)((originalProps, ref) => {
5527
+ const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
5528
+ const { classNames, label, helperMessage, errorMessage, startContent, endContent, ...inputProps } = props;
5529
+ const inputRef = (0, import_react4.useRef)(null);
5530
+ const slots = (0, import_react4.useMemo)(() => inputStyle({ ...variantProps }), [variantProps]);
5531
+ const getContentProps = (0, import_react4.useCallback)(
5532
+ () => ({
5533
+ className: clsx(
5534
+ slots.content({ class: classNames == null ? void 0 : classNames.content }),
5535
+ inputProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
5536
+ ),
5537
+ size: originalProps.size
5538
+ }),
5539
+ [slots, classNames, originalProps.size, inputProps.readOnly]
5540
+ );
5541
+ const renderStartContent = () => {
5542
+ if ((0, import_react4.isValidElement)(startContent)) {
5543
+ const existingProps = startContent.props;
5544
+ const mergedProps = {
5545
+ ...getContentProps(),
5546
+ className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
5547
+ };
5548
+ return (0, import_react4.cloneElement)(startContent, mergedProps);
5701
5549
  } else {
5702
- nextOptions = [option];
5703
- closeSelect();
5550
+ const contentProps = getContentProps();
5551
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...contentProps, children: startContent });
5704
5552
  }
5705
- setSelectedOptions(nextOptions);
5706
- onChange == null ? void 0 : onChange(nextOptions);
5707
5553
  };
5708
- const handleClear = (e) => {
5709
- e.stopPropagation();
5710
- setSelectedOptions([]);
5711
- onChange == null ? void 0 : onChange([]);
5712
- };
5713
- (0, import_react3.useEffect)(() => {
5714
- const handleClickOutside = (e) => {
5715
- var _a2;
5716
- const target = e.target;
5717
- if (optionWrapperRef.current && !optionWrapperRef.current.contains(target) && !((_a2 = selectWrapperRef.current) == null ? void 0 : _a2.contains(target))) {
5718
- closeSelect();
5719
- }
5720
- };
5721
- window.addEventListener("mousedown", handleClickOutside);
5722
- return () => window.removeEventListener("mousedown", handleClickOutside);
5723
- }, []);
5724
- (0, import_react3.useEffect)(() => {
5725
- if (optionWrapperRef.current) {
5726
- setOptionWrapperHeight(optionWrapperRef.current.getBoundingClientRect().height);
5727
- }
5728
- }, [targetRect]);
5729
- (0, import_react3.useEffect)(() => {
5730
- if (isControlled) {
5731
- const valueArray = Array.isArray(originalProps.value) ? originalProps.value : [originalProps.value];
5732
- const matched = options.filter((opt) => valueArray.includes(opt.value));
5733
- setSelectedOptions(matched);
5734
- } else if (defaultSelectedOptions) {
5735
- setSelectedOptions(defaultSelectedOptions);
5554
+ const renderDateTimePickerIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5555
+ "div",
5556
+ {
5557
+ ...getContentProps(),
5558
+ onClick: () => {
5559
+ const target = ref && "current" in ref ? ref.current : inputRef.current;
5560
+ target == null ? void 0 : target.focus();
5561
+ target == null ? void 0 : target.showPicker();
5562
+ },
5563
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon_default, { name: props.type === "time" ? "clock" : "calendar", size: originalProps.size, className: "cursor-pointer" })
5736
5564
  }
5737
- }, [originalProps.value, defaultSelectedOptions, options]);
5738
- const position = targetRect ? calculatePositionWithScroll(targetRect, optionWrapperHeight) : null;
5739
- let allOptionValue = "";
5740
- if (multiple) {
5741
- if (selectedOptions.length === 0) {
5742
- allOptionValue = "\uC804\uCCB4 \uC120\uD0DD";
5743
- } else if (selectedOptions.length === options.length) {
5744
- allOptionValue = `\uC804\uCCB4 (${options.length}) \uC120\uD0DD\uB428`;
5565
+ );
5566
+ const renderContentWithIcon = () => {
5567
+ if ((0, import_react4.isValidElement)(endContent)) {
5568
+ const existingProps = endContent.props;
5569
+ const mergedProps = {
5570
+ ...getContentProps(),
5571
+ className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
5572
+ };
5573
+ return (0, import_react4.cloneElement)(endContent, mergedProps);
5574
+ } else if (errorMessage && errorMessage.length > 0) {
5575
+ const iconProps = { ...getContentProps(), className: getContentProps().className };
5576
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...iconProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon_default, { name: "exclamation-circle", fill: true, size: originalProps.size }) });
5745
5577
  } else {
5746
- allOptionValue = `${selectedOptions.length} / ${options.length} \uC120\uD0DD\uB428`;
5578
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, {});
5747
5579
  }
5748
- } else {
5749
- allOptionValue = ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
5750
- }
5751
- const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_b = selectedOptions[0]) == null ? void 0 : _b.label) || "";
5752
- const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(",") : ((_c = selectedOptions[0]) == null ? void 0 : _c.value) || "";
5753
- const renderOptions = () => {
5754
- if (!isVisible) return null;
5755
- const renderedOptions = [...options];
5756
- if (multiple && enableSelectAll) {
5757
- renderedOptions.unshift({ label: allOptionValue, value: ALL_OPTION_VALUE });
5580
+ };
5581
+ const renderEndContent = () => {
5582
+ switch (props.type) {
5583
+ case "date":
5584
+ case "datetime-local":
5585
+ case "month":
5586
+ case "week":
5587
+ case "time":
5588
+ return renderDateTimePickerIcon();
5589
+ default:
5590
+ return renderContentWithIcon();
5758
5591
  }
5759
- return (0, import_react_dom.createPortal)(
5760
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5761
- "div",
5762
- {
5763
- ref: optionWrapperRef,
5764
- role: "listbox",
5765
- className: slots.optionsWrapper({ class: classNames == null ? void 0 : classNames.optionsWrapper }),
5766
- style: {
5767
- position: "absolute",
5768
- top: position == null ? void 0 : position.top,
5769
- left: position == null ? void 0 : position.left,
5770
- width: targetRect == null ? void 0 : targetRect.width,
5771
- zIndex: 1e3,
5772
- opacity: isOpen ? 1 : 0,
5773
- transform: isOpen ? "translateY(0)" : "translateY(-0.25rem)",
5774
- transition: "opacity 150ms ease-out, transform 150ms ease-out"
5775
- },
5776
- children: renderedOptions.map((option) => {
5777
- const isSelected = option.value === ALL_OPTION_VALUE ? selectedOptions.length === options.length : selectedOptions.some((o) => o.value === option.value);
5778
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
5779
- "div",
5780
- {
5781
- role: "option",
5782
- onClick: () => handleChangeOption(option),
5783
- className: clsx(
5784
- select({ ...variantProps, isSelected }).option({ class: classNames == null ? void 0 : classNames.option }),
5785
- optionIconPlacement === "end" ? "justify-between" : ""
5786
- ),
5787
- children: [
5788
- optionIconName && optionIconPlacement === "start" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon_default, { name: optionIconName, size: originalProps.size }),
5789
- option.label,
5790
- optionIconName && optionIconPlacement === "end" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon_default, { name: optionIconName, size: originalProps.size })
5791
- ]
5792
- },
5793
- option.value
5794
- );
5795
- })
5796
- }
5797
- ),
5798
- document.body
5799
- );
5800
5592
  };
5801
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
5802
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
5803
- "div",
5804
- {
5805
- className: clsx(
5806
- slots.base({ class: classNames == null ? void 0 : classNames.base }),
5807
- variantProps.direction === "horizon" ? slots.horizon({ class: classNames == null ? void 0 : classNames.horizon }) : slots.vertical({ class: classNames == null ? void 0 : classNames.vertical })
5808
- ),
5809
- children: [
5810
- label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
5811
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
5812
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
5813
- "div",
5814
- {
5815
- "data-expanded": isOpen,
5816
- className: clsx(
5817
- slots.selectWrapper({ class: classNames == null ? void 0 : classNames.selectWrapper }),
5818
- inputProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
5593
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
5594
+ "div",
5595
+ {
5596
+ className: clsx(
5597
+ slots.base({ class: classNames == null ? void 0 : classNames.base }),
5598
+ variantProps.direction === "horizon" ? slots.horizon({ class: classNames == null ? void 0 : classNames.horizon }) : slots.vertical({ class: classNames == null ? void 0 : classNames.vertical })
5599
+ ),
5600
+ children: [
5601
+ label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
5602
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: slots.innerWrapper({ class: classNames == null ? void 0 : classNames.innerWrapper }), children: [
5603
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
5604
+ "div",
5605
+ {
5606
+ className: clsx(
5607
+ slots.inputWrapper({ class: classNames == null ? void 0 : classNames.inputWrapper }),
5608
+ inputProps.readOnly ? slots.readonlyWrapper({ class: classNames == null ? void 0 : classNames.readonlyWrapper }) : ""
5609
+ ),
5610
+ children: [
5611
+ startContent && renderStartContent(),
5612
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5613
+ "input",
5614
+ {
5615
+ ref: ref || inputRef,
5616
+ ...inputProps,
5617
+ readOnly: props.readOnly,
5618
+ className: clsx(slots.input({ class: classNames == null ? void 0 : classNames.input })),
5619
+ size: 0
5620
+ }
5819
5621
  ),
5820
- ref: selectWrapperRef,
5821
- onClick: handleToggleSelect,
5822
- children: [
5823
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5824
- "input",
5825
- {
5826
- ...inputProps,
5827
- ref,
5828
- className: clsx(
5829
- slots.select({ class: classNames == null ? void 0 : classNames.select }),
5830
- inputProps.readOnly ? "!placeholder:text-body-foreground" : ""
5831
- ),
5832
- name: void 0,
5833
- value: displayValue,
5834
- readOnly: true,
5835
- size: 0
5836
- }
5837
- ),
5838
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "hidden", name: inputProps.name, value: selectedValue }),
5839
- clearable && selectedOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5840
- icon_button_default,
5841
- {
5842
- name: "close",
5843
- variant: "ghost",
5844
- size: "sm",
5845
- color: "neutral",
5846
- onClick: handleClear,
5847
- classNames: { base: "pr-[2px]" }
5848
- }
5849
- ),
5850
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5851
- Icon_default,
5852
- {
5853
- name: dropdownIconName,
5854
- size: originalProps.size,
5855
- className: `transition-transform duration-200 ${isOpen ? "rotate-0" : "rotate-180"}`
5856
- }
5857
- )
5858
- ]
5859
- }
5860
- ),
5861
- helperMessage && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: slots.helperMessage({ class: classNames == null ? void 0 : classNames.helperMessage }), children: helperMessage }),
5862
- errorMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage })
5863
- ] })
5864
- ]
5865
- }
5866
- ),
5867
- renderOptions()
5868
- ] });
5622
+ renderEndContent()
5623
+ ]
5624
+ }
5625
+ ),
5626
+ helperMessage && !(errorMessage !== void 0) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5627
+ "p",
5628
+ {
5629
+ className: clsx(
5630
+ slots.helperMessage({ class: classNames == null ? void 0 : classNames.helperMessage }),
5631
+ inputProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
5632
+ ),
5633
+ children: helperMessage
5634
+ }
5635
+ ),
5636
+ errorMessage && errorMessage.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage }),
5637
+ errorMessage === "" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: clsx("error", "sr-only"), "aria-hidden": "true" })
5638
+ ] })
5639
+ ]
5640
+ }
5641
+ );
5869
5642
  });
5870
- Select.displayName = "Select";
5871
- var select_default = Select;
5872
- var select = tv({
5873
- slots: {
5874
- base: ["group/select", "flex"],
5875
- vertical: ["flex-col"],
5876
- horizon: ["flex-row", "gap-0"],
5877
- label: ["flex", "items-center", "font-bold", "text-body-foreground", "min-w-[80px]"],
5878
- wrapper: ["flex", "flex-col"],
5879
- selectWrapper: [
5880
- "flex",
5881
- "items-center",
5882
- "justify-between",
5883
- "cursor-pointer",
5884
- "text-neutral-main",
5885
- "bg-body-background",
5886
- "hover:bg-trans-soft",
5887
- "group-has-[p.error]/select:border-danger-main",
5888
- "group-has-[p.error]/select:bg-danger-soft",
5889
- "group-has-[p.error]/select:text-danger-main",
5890
- "group-has-[p.error]/select:hover:bg-danger-soft"
5891
- ],
5892
- select: [
5893
- "bg-transparent",
5894
- "w-full",
5895
- "outline-none",
5896
- "placeholder:text-neutral-main",
5897
- "text-body-foreground",
5898
- "group-has-[p.error]/select:text-danger-main",
5899
- "group-has-[p.error]/select:placeholder:text-danger-main",
5900
- "truncate"
5901
- ],
5902
- optionsWrapper: ["bg-body-background", "overflow-auto", "flex", "flex-col", "gap-[10px]"],
5903
- option: [
5904
- "flex",
5905
- "items-center",
5906
- "cursor-pointer",
5907
- "text-neutral-dark",
5908
- "hover:bg-trans-soft",
5909
- "hover:text-neutral-strong"
5910
- ],
5911
- helperMessage: ["text-neutral-main"],
5912
- errorMessage: ["text-danger-main"],
5913
- readonly: ["pointer-events-none", "!bg-trans-soft"]
5914
- },
5915
- variants: {
5916
- variant: {
5917
- solid: {
5918
- selectWrapper: ["border-transparent", "bg-trans-soft"],
5919
- option: [],
5920
- readonlyWrapper: ["!bg-trans-light"]
5643
+ Input.displayName = "Input";
5644
+ var input_default = Input;
5645
+ var inputStyle = tv(
5646
+ {
5647
+ slots: {
5648
+ base: ["group/input", "flex", "select-none"],
5649
+ vertical: ["flex-col"],
5650
+ horizon: ["flex-row", "gap-0"],
5651
+ label: ["flex", "items-center", "font-bold", "text-body-foreground", "min-w-[80px]"],
5652
+ innerWrapper: ["flex", "flex-col"],
5653
+ inputWrapper: ["flex", "items-center", "duration-200", "group-has-[p.error]/input:!bg-danger-soft"],
5654
+ input: [
5655
+ "w-full",
5656
+ "h-full",
5657
+ "bg-transparent",
5658
+ "text-neutral-main",
5659
+ "placeholder:text-neutral-main",
5660
+ "outline-none",
5661
+ "focus:ring-0",
5662
+ "group-has-[:hover:not(:read-only):not(:focus)]/input:text-neutral-dark",
5663
+ "group-has-[:hover:not(:read-only):not(:focus)]/input:placeholder:text-neutral-dark",
5664
+ "group-has-[:focus:not(:read-only)]/input:text-neutral-dark",
5665
+ "group-has-[:focus:not(:read-only)]/input:placeholder:text-neutral-dark",
5666
+ "read-only:!text-body-foreground",
5667
+ "read-only:placeholder:!text-body-foreground"
5668
+ ],
5669
+ content: [
5670
+ "flex",
5671
+ "items-center",
5672
+ "select-none",
5673
+ "text-neutral-main",
5674
+ "group-has-[:hover:not(:read-only):not(:focus)]/input:text-neutral-dark",
5675
+ "read-only:!text-body-foreground"
5676
+ ],
5677
+ helperMessage: ["text-neutral-main", "group-has-[:hover:not(:read-only):not(:focus)]/input:text-neutral-dark"],
5678
+ errorMessage: ["text-danger-main"],
5679
+ readonlyWrapper: [
5680
+ "pointer-events-none",
5681
+ "text-body-foreground",
5682
+ "placeholder:text-body-foreground",
5683
+ "[&>input]:text-body-foreground",
5684
+ "[&>input]:placeholder:text-body-foreground"
5685
+ ],
5686
+ readonly: ["text-body-foreground"]
5687
+ },
5688
+ variants: {
5689
+ variant: {
5690
+ solid: {
5691
+ inputWrapper: ["border-transparent", "bg-trans-soft"],
5692
+ readonlyWrapper: ["!bg-trans-light"]
5693
+ },
5694
+ outline: {
5695
+ inputWrapper: [
5696
+ "border-neutral-light",
5697
+ "group-has-[:hover:not(:read-only):not(:focus)]/input:bg-trans-soft",
5698
+ "group-has-[:focus:not(:read-only)]/input:bg-body-background",
5699
+ "group-has-[p.error]/input:border-danger-main"
5700
+ ],
5701
+ readonlyWrapper: ["!bg-trans-soft"]
5702
+ },
5703
+ underline: {
5704
+ inputWrapper: [
5705
+ "bg-transparent",
5706
+ "rounded-none",
5707
+ "group-has-[:hover:not(:read-only):not(:focus)]/input:bg-trans-soft",
5708
+ "group-has-[:focus:not(:read-only)]/input:bg-body-background",
5709
+ "group-has-[p.error]/input:border-danger-main"
5710
+ ],
5711
+ readonlyWrapper: ["!bg-trans-soft"]
5712
+ }
5921
5713
  },
5922
- outline: {
5923
- selectWrapper: [
5924
- "border-neutral-light",
5925
- "border",
5926
- "group-has-[:hover]/select:bg-trans-soft",
5927
- "group-has-[:focus]/select:bg-body-background",
5928
- "group-has-[p.error]/select:border-danger-main"
5929
- ],
5930
- option: [],
5931
- readonlyWrapper: ["!bg-trans-soft"]
5714
+ color: {
5715
+ primary: {
5716
+ content: ["group-has-[:focus:not(:read-only)]/input:text-primary-main", "read-only:!text-primary-main"],
5717
+ helperMessage: ["group-has-[:focus:not(:read-only)]/input:text-primary-main"],
5718
+ readonly: ["text-primary-main"]
5719
+ },
5720
+ secondary: {
5721
+ content: ["group-has-[:focus:not(:read-only)]/input:text-secondary-main", "read-only:!text-secondary-main"],
5722
+ helperMessage: ["group-has-[:focus:not(:read-only)]/input:text-secondary-main"],
5723
+ readonly: ["text-secondary-main"]
5724
+ }
5932
5725
  },
5933
- underline: {
5934
- selectWrapper: [
5935
- "bg-transparent",
5936
- "border-neutral-light",
5937
- "!rounded-none",
5938
- "group-has-[:hover]/select:bg-trans-soft",
5939
- "group-has-[:focus]/select:bg-body-background",
5940
- "group-has-[p.error]/select:border-danger-main"
5941
- ],
5942
- option: ["!rounded-none"],
5943
- readonlyWrapper: ["!bg-trans-soft"]
5944
- }
5945
- },
5946
- color: {
5947
- primary: {
5948
- selectWrapper: ["text-primary-main"],
5949
- option: [],
5950
- helperMessage: ["text-primary-main"]
5726
+ size: {
5727
+ sm: {
5728
+ base: ["text-sm", "gap-[4px]"],
5729
+ label: ["text-sm"],
5730
+ innerWrapper: ["gap-[4px]"],
5731
+ inputWrapper: ["w-[240px]", "h-[24px]", "rounded-sm", "px-[4px]", "gap-[4px]"],
5732
+ helperMessage: ["text-sm"],
5733
+ errorMessage: ["text-sm"]
5734
+ },
5735
+ md: {
5736
+ base: ["text-md", "gap-[6px]"],
5737
+ label: ["text-md"],
5738
+ innerWrapper: ["gap-[6px]"],
5739
+ inputWrapper: ["w-[240px]", "h-[32px]", "rounded-md", "px-[6px]", "gap-[6px]"],
5740
+ helperMessage: ["text-sm"],
5741
+ errorMessage: ["text-sm"]
5742
+ },
5743
+ lg: {
5744
+ base: ["text-lg", "gap-[8px]"],
5745
+ label: ["text-lg"],
5746
+ innerWrapper: ["gap-[8px]"],
5747
+ inputWrapper: ["w-[240px]", "h-[40px]", "rounded-lg", "px-[8px]", "gap-[8px]"],
5748
+ helperMessage: ["text-md"],
5749
+ errorMessage: ["text-md"]
5750
+ },
5751
+ xl: {
5752
+ base: ["text-xl", "gap-[10px]"],
5753
+ label: ["text-xl"],
5754
+ innerWrapper: ["gap-[10px]"],
5755
+ inputWrapper: ["w-[240px]", "h-[50px]", "rounded-lg", "px-[10px]", "gap-[10px]"],
5756
+ helperMessage: ["text-md"],
5757
+ errorMessage: ["text-md"]
5758
+ }
5951
5759
  },
5952
- secondary: {
5953
- selectWrapper: ["text-secondary-main"],
5954
- option: [],
5955
- helperMessage: ["text-secondary-main"]
5956
- }
5957
- },
5958
- size: {
5959
- sm: {
5960
- base: ["text-sm", "gap-[4px]"],
5961
- label: ["text-sm"],
5962
- wrapper: ["gap-[4px]"],
5963
- selectWrapper: ["w-[240px]", "h-[24px]", "rounded-sm", "px-[4px]"],
5964
- select: ["text-sm"],
5965
- optionsWrapper: ["shadow-drop-sm", "rounded-sm", "p-[4px]"],
5966
- option: ["px-[4px]", "py-[3px]", "rounded-sm", "text-sm", "gap-[4px]"],
5967
- helperMessage: ["text-sm"],
5968
- errorMessage: ["text-sm"]
5760
+ direction: {
5761
+ vertical: "",
5762
+ horizon: ""
5969
5763
  },
5970
- md: {
5971
- base: ["text-md", "gap-[6px]", "rounded-md"],
5972
- label: ["text-md"],
5973
- wrapper: ["gap-[6px]"],
5974
- selectWrapper: ["w-[240px]", "h-[32px]", "rounded-md", "px-[6px]"],
5975
- select: ["text-md"],
5976
- optionsWrapper: ["shadow-drop-md", "rounded-md", "p-[6px]"],
5977
- option: ["px-[6px]", "py-[5.5px]", "rounded-md", "text-md", "gap-[6px]"],
5978
- helperMessage: ["text-sm"],
5979
- errorMessage: ["text-sm"]
5764
+ full: {
5765
+ true: {
5766
+ base: ["w-full"],
5767
+ innerWrapper: ["flex-1"],
5768
+ inputWrapper: ["w-full"]
5769
+ }
5980
5770
  },
5981
- lg: {
5982
- base: ["text-lg", "gap-[8px]"],
5983
- label: ["text-lg"],
5984
- wrapper: ["gap-[8px]"],
5985
- selectWrapper: ["w-[240px]", "h-[40px]", "rounded-lg", "px-[8px]"],
5986
- select: ["text-lg"],
5987
- optionsWrapper: ["shadow-drop-lg", "rounded-lg", "p-[8px]"],
5988
- option: ["px-[8px]", "py-[8px]", "rounded-lg", "text-lg", "gap-[8px]"],
5989
- helperMessage: ["text-md"],
5990
- errorMessage: ["text-md"]
5771
+ disabled: {
5772
+ true: {
5773
+ inputWrapper: ["!bg-neutral-soft", "pointer-events-none"],
5774
+ input: ["!text-neutral-light", "placeholder:!text-neutral-light"],
5775
+ content: ["!text-neutral-light"],
5776
+ helperMessage: ["!text-neutral-light"],
5777
+ errorMessage: ["!text-danger-light"]
5778
+ }
5991
5779
  },
5992
- xl: {
5993
- base: ["text-xl", "gap-[10px]"],
5994
- label: ["text-xl"],
5995
- wrapper: ["gap-[10px]"],
5996
- selectWrapper: ["w-[240px]", "h-[50px]", "rounded-xl", "px-[10px]"],
5997
- select: ["text-xl"],
5998
- optionsWrapper: ["shadow-drop-xl", "rounded-xl", "p-[10px]"],
5999
- option: ["px-[10px]", "py-[11.5px]", "rounded-xl", "text-xl", "gap-[10px]"],
6000
- helperMessage: ["text-md"],
6001
- errorMessage: ["text-md"]
6002
- }
6003
- },
6004
- direction: {
6005
- vertical: "",
6006
- horizon: ""
6007
- },
6008
- full: {
6009
- true: {
6010
- base: ["w-full"],
6011
- wrapper: ["w-full"],
6012
- selectWrapper: ["w-full"]
6013
- }
6014
- },
6015
- disabled: {
6016
- true: {
6017
- base: ["pointer-events-none"],
6018
- selectWrapper: [
6019
- "bg-neutral-soft",
6020
- "border-neutral-light",
6021
- "group-has-[p.error]/select:text-danger-light",
6022
- "group-has-[p.error]/select:bg-danger-soft",
6023
- "group-has-[p.error]/select:border-danger-light"
6024
- ],
6025
- select: [
6026
- "text-neutral-light",
6027
- "placeholder:text-neutral-light",
6028
- "group-has-[p.error]/select:text-danger-light",
6029
- "group-has-[p.error]/select:placeholder:text-danger-light"
6030
- ],
6031
- helperMessage: ["!text-neutral-light"],
6032
- errorMessage: ["!text-danger-light"]
6033
- }
6034
- },
6035
- isSelected: {
6036
- true: "",
6037
- false: ""
6038
- }
6039
- },
6040
- compoundVariants: [
6041
- {
6042
- variant: "outline",
6043
- size: "sm",
6044
- class: {
6045
- option: ["hover:shadow-[inset_0_0_0_1px_var(--dn-neutral-light)]"]
6046
- }
6047
- },
6048
- {
6049
- variant: "outline",
6050
- size: "md",
6051
- class: {
6052
- option: ["hover:shadow-[inset_0_0_0_1.25px_var(--dn-neutral-light)]"]
6053
- }
6054
- },
6055
- {
6056
- variant: "outline",
6057
- size: "lg",
6058
- class: {
6059
- option: ["hover:shadow-[inset_0_0_0_1.5px_var(--dn-neutral-light)]"]
6060
- }
6061
- },
6062
- {
6063
- variant: "outline",
6064
- size: "xl",
6065
- class: {
6066
- option: ["hover:shadow-[inset_0_0_0_1.75px_var(--dn-neutral-light)]"]
6067
- }
6068
- },
6069
- {
6070
- variant: "underline",
6071
- size: "sm",
6072
- class: {
6073
- selectWrapper: ["border-b-sm"],
6074
- option: ["hover:shadow-[inset_0_-1px_0_0_var(--dn-neutral-light)]"]
6075
- }
6076
- },
6077
- {
6078
- variant: "underline",
6079
- size: "md",
6080
- class: {
6081
- selectWrapper: ["border-b-md"],
6082
- option: ["hover:shadow-[inset_0_-1.25px_0_0_var(--dn-neutral-light)]"]
6083
- }
6084
- },
6085
- {
6086
- variant: "underline",
6087
- size: "lg",
6088
- class: {
6089
- selectWrapper: ["border-b-lg"],
6090
- option: ["hover:shadow-[inset_0_-1.5px_0_0_var(--dn-neutral-light)]"]
5780
+ readonly: {
5781
+ true: {
5782
+ readonlyWrapper: ["pointer-events-none"],
5783
+ input: ["!text-body-foreground", "placeholder:!text-body-foreground"],
5784
+ content: ["!text-body-foreground"],
5785
+ helperMessage: ["!text-body-foreground"]
5786
+ }
6091
5787
  }
6092
5788
  },
6093
- {
6094
- variant: "underline",
6095
- size: "xl",
6096
- class: {
6097
- selectWrapper: ["border-b-xl"],
6098
- option: ["hover:shadow-[inset_0_-1.75px_0_0_var(--dn-neutral-light)]"]
5789
+ compoundVariants: [
5790
+ {
5791
+ variant: "outline",
5792
+ size: "sm",
5793
+ class: {
5794
+ inputWrapper: ["border-sm"]
5795
+ }
5796
+ },
5797
+ {
5798
+ variant: "outline",
5799
+ size: "md",
5800
+ class: {
5801
+ inputWrapper: ["border-md"]
5802
+ }
5803
+ },
5804
+ {
5805
+ variant: "outline",
5806
+ size: "lg",
5807
+ class: {
5808
+ inputWrapper: ["border-lg"]
5809
+ }
5810
+ },
5811
+ {
5812
+ variant: "outline",
5813
+ size: "xl",
5814
+ class: {
5815
+ inputWrapper: ["border-xl"]
5816
+ }
5817
+ },
5818
+ {
5819
+ variant: "underline",
5820
+ size: "sm",
5821
+ class: {
5822
+ inputWrapper: ["border-b-sm"]
5823
+ }
5824
+ },
5825
+ {
5826
+ variant: "underline",
5827
+ size: "md",
5828
+ class: {
5829
+ inputWrapper: ["border-b-md"]
5830
+ }
5831
+ },
5832
+ {
5833
+ variant: "underline",
5834
+ size: "lg",
5835
+ class: {
5836
+ inputWrapper: ["border-b-lg"]
5837
+ }
5838
+ },
5839
+ {
5840
+ variant: "underline",
5841
+ size: "xl",
5842
+ class: {
5843
+ inputWrapper: ["border-b-xl"]
5844
+ }
5845
+ },
5846
+ {
5847
+ readonly: true,
5848
+ color: "primary",
5849
+ class: {
5850
+ input: ["!text-primary-main", "placeholder:!text-primary-main"],
5851
+ content: ["!text-primary-main"]
5852
+ }
5853
+ },
5854
+ {
5855
+ readonly: true,
5856
+ color: "secondary",
5857
+ class: {
5858
+ input: ["!text-secondary-main", "placeholder:!text-secondary-main"],
5859
+ content: ["!text-secondary-main"]
5860
+ }
5861
+ },
5862
+ {
5863
+ disabled: true,
5864
+ class: {
5865
+ input: [
5866
+ "group-has-[p.error]/input:!text-danger-light",
5867
+ "group-has-[p.error]/input:placeholder:!text-danger-light"
5868
+ ],
5869
+ content: ["group-has-[p.error]/input:!text-danger-light"],
5870
+ helperMessage: ["group-has-[p.error]/input:!text-danger-light"],
5871
+ errorMessage: ["!text-danger-light"]
5872
+ }
5873
+ },
5874
+ {
5875
+ disabled: true,
5876
+ variant: ["outline", "underline"],
5877
+ class: {
5878
+ inputWrapper: ["!bg-body-background", "group-has-[p.error]/input:!border-danger-light"]
5879
+ }
5880
+ },
5881
+ {
5882
+ disabled: false,
5883
+ class: {
5884
+ input: [
5885
+ "group-has-[p.error]/input:!text-danger-main",
5886
+ "group-has-[p.error]/input:placeholder:!text-danger-main"
5887
+ ],
5888
+ content: ["group-has-[p.error]/input:!text-danger-main"],
5889
+ helperMessage: ["group-has-[p.error]/input:!text-danger-main"],
5890
+ errorMessage: ["!text-danger-main"]
5891
+ }
6099
5892
  }
6100
- },
6101
- {
5893
+ ],
5894
+ defaultVariants: {
5895
+ variant: "solid",
6102
5896
  color: "primary",
6103
- isSelected: true,
6104
- class: {
6105
- option: ["text-primary-main"]
6106
- }
6107
- },
6108
- {
6109
- color: "secondary",
6110
- isSelected: true,
6111
- class: {
6112
- option: ["text-secondary-main"]
6113
- }
5897
+ size: "md",
5898
+ direction: "vertical",
5899
+ disabled: false,
5900
+ readonly: false
6114
5901
  }
6115
- ],
6116
- defaultVariants: {
6117
- variant: "solid",
6118
- color: "primary",
6119
- size: "md",
6120
- direction: "vertical",
6121
- disabled: false,
6122
- readonly: false
5902
+ },
5903
+ {
5904
+ twMerge: false
6123
5905
  }
6124
- });
5906
+ );
6125
5907
 
6126
- // src/components/picker/timePicker.tsx
6127
- var import_jsx_runtime6 = require("react/jsx-runtime");
6128
- var TimePicker = (0, import_react4.forwardRef)((originalProps, ref) => {
5908
+ // src/components/picker/timePicker/index.tsx
5909
+ var import_jsx_runtime7 = require("react/jsx-runtime");
5910
+ var TimePicker = (0, import_react5.forwardRef)((originalProps, ref) => {
6129
5911
  const [props, variantProps] = mapPropsVariants(originalProps, timePickerStyle.variantKeys);
6130
5912
  const {
6131
5913
  classNames,
6132
5914
  label,
6133
5915
  errorMessage,
6134
- valueRange,
6135
- onChangeRange,
6136
- size,
6137
- selectClassNames,
5916
+ value,
5917
+ onChange,
5918
+ size = "md",
5919
+ variant = "solid",
5920
+ full = false,
5921
+ disabled = false,
6138
5922
  placeholder = "",
5923
+ nowTitle,
5924
+ confirmTitle,
6139
5925
  ...inputProps
6140
- } = props;
6141
- const [selectedRange, setSelectedRange] = (0, import_react4.useState)(
6142
- valueRange || { start: "", end: "" }
6143
- );
6144
- const [isPanelOpen, setIsPanelOpen] = (0, import_react4.useState)(false);
6145
- const inputWrapperRef = (0, import_react4.useRef)(null);
6146
- const panelWrapperRef = (0, import_react4.useRef)(null);
6147
- const [panelPos, setPanelPos] = (0, import_react4.useState)({ top: -9999, left: -9999 });
6148
- const displayValue = (0, import_react4.useMemo)(() => {
6149
- if (selectedRange.start && selectedRange.end) {
6150
- return `${selectedRange.start} ~ ${selectedRange.end}`;
6151
- }
6152
- return "";
6153
- }, [selectedRange]);
6154
- const calculatePosition = (0, import_react4.useCallback)(() => {
5926
+ } = { ...props, ...variantProps };
5927
+ const slots = (0, import_react5.useMemo)(() => timePickerStyle({ ...variantProps }), [variantProps]);
5928
+ const [isPanelOpen, setIsPanelOpen] = (0, import_react5.useState)(false);
5929
+ const inputWrapperRef = (0, import_react5.useRef)(null);
5930
+ const panelWrapperRef = (0, import_react5.useRef)(null);
5931
+ const [panelPos, setPanelPos] = (0, import_react5.useState)({
5932
+ top: -9999,
5933
+ left: -9999
5934
+ });
5935
+ const displayValue = (0, import_react5.useMemo)(() => {
5936
+ if (!value) return "";
5937
+ const { hour, minute, meridiem } = convert24To12(value);
5938
+ return `${hour}:${minute} ${meridiem}`;
5939
+ }, [value]);
5940
+ const calculatePosition = (0, import_react5.useCallback)(() => {
6155
5941
  if (inputWrapperRef.current) {
6156
5942
  const rect = inputWrapperRef.current.getBoundingClientRect();
6157
- setPanelPos({ top: rect.bottom + window.scrollY + 6, left: rect.left + window.scrollX });
5943
+ setPanelPos({
5944
+ top: rect.bottom + window.scrollY + 6,
5945
+ left: rect.left + window.scrollX
5946
+ });
6158
5947
  }
6159
5948
  }, []);
6160
- const handleFocusInput = () => {
5949
+ const openPanel = () => {
6161
5950
  calculatePosition();
6162
5951
  setIsPanelOpen(true);
6163
5952
  };
6164
- const handleInputBlur = () => {
6165
- setTimeout(() => setIsPanelOpen(false), 150);
5953
+ const handleInputFocus = () => {
5954
+ openPanel();
6166
5955
  };
6167
5956
  const handleInputKeyDown = (e) => {
6168
5957
  if (e.key === "Enter" || e.key === " ") {
6169
5958
  e.preventDefault();
6170
5959
  calculatePosition();
6171
5960
  setIsPanelOpen((prev) => !prev);
6172
- } else if (e.key === "Escape") {
6173
- setIsPanelOpen(false);
6174
- }
6175
- };
6176
- const slots = (0, import_react4.useMemo)(() => timePickerStyle({ ...variantProps }), [variantProps]);
6177
- const renderHourOptions = () => {
6178
- return Array.from({ length: 24 }, (_, i) => {
6179
- const value = String(i).padStart(2, "0");
6180
- return { label: value, value };
6181
- });
6182
- };
6183
- const renderMinuteOptions = () => {
6184
- return Array.from({ length: 60 }, (_, i) => {
6185
- const value = String(i).padStart(2, "0");
6186
- return { label: value, value };
6187
- });
5961
+ } else if (e.key === "Escape") setIsPanelOpen(false);
6188
5962
  };
6189
- const defaultSelectClassNames = {
6190
- selectWrapper: "!w-[80px]",
6191
- optionsWrapper: "max-h-[300px]"
5963
+ const handleChange = (time) => {
5964
+ onChange == null ? void 0 : onChange(time);
5965
+ setIsPanelOpen(false);
6192
5966
  };
6193
- const handleRangeChange = (type, option) => {
6194
- const [shRaw, smRaw] = selectedRange.start.split(":");
6195
- const [ehRaw, emRaw] = selectedRange.end.split(":");
6196
- const sh = (shRaw != null ? shRaw : "00").padStart(2, "0");
6197
- const sm = (smRaw != null ? smRaw : "00").padStart(2, "0");
6198
- const eh = (ehRaw != null ? ehRaw : "00").padStart(2, "0");
6199
- const em = (emRaw != null ? emRaw : "00").padStart(2, "0");
6200
- const range = {
6201
- start: `${type === "startHour" ? option.value : sh}:${type === "startMinute" ? option.value : sm}`,
6202
- end: `${type === "endHour" ? option.value : eh}:${type === "endMinute" ? option.value : em}`
5967
+ (0, import_react5.useEffect)(() => {
5968
+ const handleClickOutside = (e) => {
5969
+ var _a, _b;
5970
+ const target = e.target;
5971
+ if ((_a = inputWrapperRef.current) == null ? void 0 : _a.contains(target)) return;
5972
+ if ((_b = panelWrapperRef.current) == null ? void 0 : _b.contains(target)) return;
5973
+ setIsPanelOpen(false);
6203
5974
  };
6204
- setSelectedRange(range);
6205
- onChangeRange == null ? void 0 : onChangeRange(range);
6206
- };
6207
- const mergedSelectClassNames = {
6208
- selectWrapper: (selectClassNames == null ? void 0 : selectClassNames.selectWrapper) || defaultSelectClassNames.selectWrapper,
6209
- optionsWrapper: (selectClassNames == null ? void 0 : selectClassNames.optionsWrapper) || defaultSelectClassNames.optionsWrapper
6210
- };
6211
- const getSelectValue = (timeString, part) => {
6212
- if (!timeString) return "00";
6213
- const [hour, minute] = timeString.split(":");
6214
- return part === "hour" ? hour || "00" : minute || "00";
6215
- };
6216
- const handleClearRange = () => {
6217
- const emptyRange = { start: "", end: "" };
6218
- setSelectedRange(emptyRange);
6219
- onChangeRange == null ? void 0 : onChangeRange(emptyRange);
6220
- };
6221
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
6222
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
6223
- label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
6224
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
6225
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref: inputWrapperRef, className: slots.inputWrapper({ class: classNames == null ? void 0 : classNames.inputWrapper }), children: [
6226
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
6227
- "input",
6228
- {
6229
- ...inputProps,
6230
- ref,
6231
- className: slots.input({ class: classNames == null ? void 0 : classNames.input }),
6232
- type: "text",
6233
- value: displayValue,
6234
- placeholder,
6235
- readOnly: true,
6236
- onFocus: handleFocusInput,
6237
- onBlur: handleInputBlur,
6238
- onKeyDown: handleInputKeyDown
6239
- }
6240
- ),
6241
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: slots.icon({ class: classNames == null ? void 0 : classNames.icon }), children: [
6242
- displayValue && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
6243
- Icon_default,
6244
- {
6245
- name: "close",
6246
- className: "text-neutral-light hover:text-neutral-main mr-[5px] cursor-pointer",
6247
- onClick: (e) => {
6248
- e.stopPropagation();
6249
- handleClearRange();
6250
- }
6251
- }
6252
- ),
6253
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
6254
- Icon_default,
6255
- {
6256
- name: "clock",
6257
- className: "cursor-pointer",
6258
- onClick: () => {
6259
- calculatePosition();
6260
- setIsPanelOpen((v) => !v);
6261
- }
6262
- }
6263
- )
6264
- ] })
6265
- ] }),
6266
- errorMessage && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage })
6267
- ] })
6268
- ] }),
6269
- isPanelOpen && (0, import_react_dom2.createPortal)(
6270
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5975
+ document.addEventListener("mousedown", handleClickOutside);
5976
+ return () => document.removeEventListener("mousedown", handleClickOutside);
5977
+ }, []);
5978
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
5979
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: inputWrapperRef, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), onClick: openPanel, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5980
+ input_default,
5981
+ {
5982
+ ...inputProps,
5983
+ autoComplete: "off",
5984
+ ref,
5985
+ label,
5986
+ value: displayValue,
5987
+ placeholder,
5988
+ errorMessage,
5989
+ size,
5990
+ variant,
5991
+ full,
5992
+ disabled,
5993
+ endContent: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon_default, { name: "clock", size, className: "cursor-pointer" }),
5994
+ onFocus: handleInputFocus,
5995
+ onKeyDown: handleInputKeyDown,
5996
+ onChange: () => {
5997
+ },
5998
+ classNames: {
5999
+ inputWrapper: classNames == null ? void 0 : classNames.inputWrapper,
6000
+ input: classNames == null ? void 0 : classNames.input,
6001
+ label: classNames == null ? void 0 : classNames.label,
6002
+ errorMessage: classNames == null ? void 0 : classNames.errorMessage
6003
+ }
6004
+ }
6005
+ ) }),
6006
+ isPanelOpen && (0, import_react_dom.createPortal)(
6007
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
6271
6008
  "div",
6272
6009
  {
6273
6010
  ref: panelWrapperRef,
6274
- className: slots.optionsWrapper({ class: classNames == null ? void 0 : classNames.optionsWrapper }),
6011
+ onMouseDown: (e) => e.preventDefault(),
6012
+ className: slots.portalWrapper({ class: classNames == null ? void 0 : classNames.portalWrapper }),
6275
6013
  style: {
6276
6014
  position: "absolute",
6277
6015
  top: panelPos.top,
6278
- left: panelPos.left,
6279
- zIndex: 1e3
6016
+ left: panelPos.left
6280
6017
  },
6281
- onMouseDown: (e) => e.preventDefault(),
6282
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "bg-body-background text-neutral-main flex items-center gap-[5px] p-[10px]", children: [
6283
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-[5px]", children: [
6284
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
6285
- select_default,
6286
- {
6287
- options: renderHourOptions(),
6288
- value: getSelectValue(selectedRange.start, "hour"),
6289
- onChange: (options) => {
6290
- if (options[0]) handleRangeChange("startHour", options[0]);
6291
- },
6292
- classNames: mergedSelectClassNames
6293
- }
6294
- ),
6295
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: ":" }),
6296
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
6297
- select_default,
6298
- {
6299
- options: renderMinuteOptions(),
6300
- value: getSelectValue(selectedRange.start, "minute"),
6301
- onChange: (options) => {
6302
- if (options[0]) handleRangeChange("startMinute", options[0]);
6303
- },
6304
- classNames: mergedSelectClassNames
6305
- }
6306
- )
6307
- ] }),
6308
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "~" }),
6309
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-[5px]", children: [
6310
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
6311
- select_default,
6312
- {
6313
- options: renderHourOptions(),
6314
- value: getSelectValue(selectedRange.end, "hour"),
6315
- onChange: (options) => {
6316
- if (options[0]) handleRangeChange("endHour", options[0]);
6317
- },
6318
- classNames: mergedSelectClassNames
6319
- }
6320
- ),
6321
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: ":" }),
6322
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
6323
- select_default,
6324
- {
6325
- options: renderMinuteOptions(),
6326
- value: getSelectValue(selectedRange.end, "minute"),
6327
- onChange: (options) => {
6328
- if (options[0]) handleRangeChange("endMinute", options[0]);
6329
- },
6330
- classNames: mergedSelectClassNames
6331
- }
6332
- )
6333
- ] })
6334
- ] })
6018
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Panel_default, { nowTitle, confirmTitle, value, onChange: handleChange })
6335
6019
  }
6336
6020
  ),
6337
6021
  document.body
@@ -6368,24 +6052,44 @@ var timePickerStyle = tv({
6368
6052
  "group-has-[p.error]/timepicker:placeholder:text-danger-main",
6369
6053
  "cursor-pointer"
6370
6054
  ],
6371
- icon: [
6055
+ portalWrapper: [
6056
+ "rounded-[10px]",
6057
+ "bg-body-background",
6058
+ "shadow-drop-md",
6059
+ "overflow-auto",
6060
+ "p-[10px]",
6061
+ "w-[165px]",
6062
+ "h-[137px]",
6372
6063
  "flex",
6373
- "items-center",
6374
- "select-none",
6375
- "text-body-foreground",
6376
- "group-has-[p.error]/timepicker:text-danger-main"
6064
+ "flex-col",
6065
+ "gap-[5px]"
6377
6066
  ],
6378
- optionsWrapper: ["border", "rounded", "bg-body-background", "shadow", "overflow-auto"],
6379
- errorMessage: ["text-danger-main", "text-sm"],
6380
- selectWrapper: []
6067
+ errorMessage: ["text-danger-main", "text-sm"]
6381
6068
  },
6382
6069
  variants: {
6383
- color: {
6384
- primary: {
6385
- icon: ["text-primary-main"]
6070
+ variant: {
6071
+ solid: {
6072
+ inputWrapper: ["border-transparent", "bg-trans-soft"],
6073
+ readonlyWrapper: ["!bg-trans-light"]
6386
6074
  },
6387
- secondary: {
6388
- icon: ["text-secondary-main"]
6075
+ outline: {
6076
+ inputWrapper: [
6077
+ "border-neutral-light",
6078
+ "group-has-[:hover:not(:read-only):not(:focus)]/input:bg-trans-soft",
6079
+ "group-has-[:focus:not(:read-only)]/input:bg-body-background",
6080
+ "group-has-[p.error]/input:border-danger-main"
6081
+ ],
6082
+ readonlyWrapper: ["!bg-trans-soft"]
6083
+ },
6084
+ underline: {
6085
+ inputWrapper: [
6086
+ "bg-transparent",
6087
+ "rounded-none",
6088
+ "group-has-[:hover:not(:read-only):not(:focus)]/input:bg-trans-soft",
6089
+ "group-has-[:focus:not(:read-only)]/input:bg-body-background",
6090
+ "group-has-[p.error]/input:border-danger-main"
6091
+ ],
6092
+ readonlyWrapper: ["!bg-trans-soft"]
6389
6093
  }
6390
6094
  },
6391
6095
  size: {
@@ -6395,7 +6099,6 @@ var timePickerStyle = tv({
6395
6099
  wrapper: ["gap-[4px]"],
6396
6100
  inputWrapper: ["w-[240px]", "h-[24px]", "rounded-sm", "px-[4px]"],
6397
6101
  input: ["text-sm"],
6398
- icon: ["text-sm"],
6399
6102
  errorMessage: ["text-sm"]
6400
6103
  },
6401
6104
  md: {
@@ -6404,7 +6107,6 @@ var timePickerStyle = tv({
6404
6107
  wrapper: ["gap-[6px]"],
6405
6108
  inputWrapper: ["w-[240px]", "h-[32px]", "rounded-md", "px-[6px]"],
6406
6109
  input: ["text-md"],
6407
- icon: ["text-md"],
6408
6110
  errorMessage: ["text-sm"]
6409
6111
  },
6410
6112
  lg: {
@@ -6413,7 +6115,6 @@ var timePickerStyle = tv({
6413
6115
  wrapper: ["gap-[8px]"],
6414
6116
  inputWrapper: ["w-[240px]", "h-[40px]", "rounded-lg", "px-[8px]"],
6415
6117
  input: ["text-lg"],
6416
- icon: ["text-lg"],
6417
6118
  errorMessage: ["text-md"]
6418
6119
  },
6419
6120
  xl: {
@@ -6422,7 +6123,6 @@ var timePickerStyle = tv({
6422
6123
  wrapper: ["gap-[10px]"],
6423
6124
  inputWrapper: ["w-[240px]", "h-[50px]", "rounded-lg", "px-[10px]"],
6424
6125
  input: ["text-xl"],
6425
- icon: ["text-xl"],
6426
6126
  errorMessage: ["text-md"]
6427
6127
  }
6428
6128
  },
@@ -6452,7 +6152,6 @@ var timePickerStyle = tv({
6452
6152
  "group-has-[p.error]/timepicker:placeholder:text-danger-light",
6453
6153
  "cursor-not-allowed"
6454
6154
  ],
6455
- icon: ["text-neutral-light"],
6456
6155
  errorMessage: ["text-danger-light"]
6457
6156
  }
6458
6157
  }