@geomak/ui 5.2.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -15,6 +15,7 @@ var ContextMenuPrimitive = require('@radix-ui/react-context-menu');
15
15
  var Popover = require('@radix-ui/react-popover');
16
16
  var SwitchPrimitive = require('@radix-ui/react-switch');
17
17
  var CheckboxPrimitive = require('@radix-ui/react-checkbox');
18
+ var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
18
19
 
19
20
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
20
21
 
@@ -47,6 +48,7 @@ var ContextMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(ContextMenu
47
48
  var Popover__namespace = /*#__PURE__*/_interopNamespace(Popover);
48
49
  var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive);
49
50
  var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
51
+ var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
50
52
 
51
53
  var Moon = ({ color = "gray" }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: color, viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: color, className: "w-8 h-8", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M21.752 15.002A9.718 9.718 0 0118 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 003 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 009.002-5.998z" }) });
52
54
  var Sun = ({ color = "yellow" }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: color, viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: color, className: "w-8 h-8", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" }) });
@@ -2165,46 +2167,112 @@ function Wizard({
2165
2167
  ] }) })
2166
2168
  ] });
2167
2169
  }
2168
- var SearchInput = React8__default.default.forwardRef(function SearchInput2({
2169
- value,
2170
- onChange,
2171
- disabled,
2170
+ var FIELD_SIZE = {
2171
+ sm: { control: "h-control-sm", text: "text-xs", padX: "px-2.5", gap: "gap-1.5" },
2172
+ md: { control: "h-control-md", text: "text-sm", padX: "px-3", gap: "gap-2" },
2173
+ lg: { control: "h-control-lg", text: "text-sm", padX: "px-3.5", gap: "gap-2.5" }
2174
+ };
2175
+ var FOCUS_WITHIN = "focus-within:outline-none focus-within:border-accent focus-within:ring-[3px] focus-within:ring-focus-ring";
2176
+ var FOCUS_VISIBLE = "focus-visible:outline-none focus-visible:border-accent focus-visible:ring-[3px] focus-visible:ring-focus-ring";
2177
+ var FOCUS_WITHIN_ERROR = "focus-within:border-status-error focus-within:ring-focus-ring-error";
2178
+ var FOCUS_VISIBLE_ERROR = "focus-visible:border-status-error focus-visible:ring-focus-ring-error";
2179
+ function fieldShell({
2180
+ size = "md",
2181
+ hasError = false,
2182
+ disabled = false,
2183
+ focusWithin = false,
2184
+ sized = true
2185
+ } = {}) {
2186
+ const s = FIELD_SIZE[size];
2187
+ return [
2188
+ "w-full rounded-lg border bg-surface text-foreground",
2189
+ "transition-[color,box-shadow,border-color] duration-150",
2190
+ s.text,
2191
+ sized ? `${s.control} ${s.padX}` : "",
2192
+ // resting border
2193
+ hasError ? "border-status-error" : "border-border",
2194
+ // hover (only when interactive + no error)
2195
+ disabled ? "bg-surface-raised text-foreground-muted cursor-not-allowed" : hasError ? "" : "hover:border-border-strong",
2196
+ // focus
2197
+ focusWithin ? FOCUS_WITHIN : FOCUS_VISIBLE,
2198
+ hasError ? focusWithin ? FOCUS_WITHIN_ERROR : FOCUS_VISIBLE_ERROR : "",
2199
+ // placeholder colour for native inputs
2200
+ "placeholder:text-foreground-muted"
2201
+ ].filter(Boolean).join(" ");
2202
+ }
2203
+ function Field({
2172
2204
  label,
2173
2205
  htmlFor,
2174
- placeholder,
2175
- name,
2176
- inputStyle,
2177
- style,
2178
- layout = "vertical"
2179
- }, ref) {
2180
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative flex flex-col items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs(
2206
+ errorId,
2207
+ errorMessage,
2208
+ layout = "vertical",
2209
+ required,
2210
+ labelStyle,
2211
+ labelWidth,
2212
+ className = "",
2213
+ children
2214
+ }) {
2215
+ const hasError = errorMessage != null;
2216
+ const horizontal = layout === "horizontal";
2217
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2181
2218
  "div",
2182
2219
  {
2183
- className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`,
2184
- style: style ?? {},
2220
+ className: [
2221
+ "flex",
2222
+ horizontal ? "flex-row items-start gap-3" : "flex-col gap-1.5",
2223
+ className
2224
+ ].filter(Boolean).join(" "),
2185
2225
  children: [
2186
- label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium ml-1 max-content text-foreground", htmlFor, children: label }),
2187
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-surface text-foreground flex items-center gap-1 rounded-lg border border-border pr-2 focus-within:border-transparent focus-within:ring-2 focus-within:ring-accent transition-colors", children: [
2188
- /* @__PURE__ */ jsxRuntime.jsx(
2189
- "input",
2190
- {
2191
- ref,
2192
- disabled,
2193
- value,
2194
- onChange,
2195
- type: "search",
2196
- enterKeyHint: "search",
2197
- name,
2198
- id: htmlFor,
2199
- className: "bg-transparent focus:outline-none pl-2 h-9 w-56 rounded-lg disabled:cursor-not-allowed",
2200
- style: inputStyle ?? {},
2201
- placeholder: placeholder ?? ""
2202
- }
2203
- ),
2204
- /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-5 h-5 text-foreground-muted", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M10.5 3.75a6.75 6.75 0 100 13.5 6.75 6.75 0 000-13.5zM2.25 10.5a8.25 8.25 0 1114.59 5.28l4.69 4.69a.75.75 0 11-1.06 1.06l-4.69-4.69A8.25 8.25 0 012.25 10.5z", clipRule: "evenodd" }) })
2226
+ label && /* @__PURE__ */ jsxRuntime.jsxs(
2227
+ "label",
2228
+ {
2229
+ htmlFor,
2230
+ style: { width: horizontal ? labelWidth : void 0, ...labelStyle },
2231
+ className: [
2232
+ "text-sm font-medium text-foreground select-none",
2233
+ horizontal ? "mt-2 flex-shrink-0" : ""
2234
+ ].filter(Boolean).join(" "),
2235
+ children: [
2236
+ label,
2237
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-status-error ml-0.5", "aria-hidden": "true", children: "*" })
2238
+ ]
2239
+ }
2240
+ ),
2241
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
2242
+ children,
2243
+ hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-status-error text-xs mt-1", children: errorMessage })
2205
2244
  ] })
2206
2245
  ]
2207
2246
  }
2247
+ );
2248
+ }
2249
+ var SearchIcon = /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-4 h-4", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M10.5 3.75a6.75 6.75 0 100 13.5 6.75 6.75 0 000-13.5zM2.25 10.5a8.25 8.25 0 1114.59 5.28l4.69 4.69a.75.75 0 11-1.06 1.06l-4.69-4.69A8.25 8.25 0 012.25 10.5z", clipRule: "evenodd" }) });
2250
+ var SearchInput = React8__default.default.forwardRef(function SearchInput2({ value, onChange, disabled, label, htmlFor, placeholder, name, inputStyle, style, layout = "vertical", size = "md", icon }, ref) {
2251
+ return /* @__PURE__ */ jsxRuntime.jsx(Field, { label, htmlFor, layout, children: /* @__PURE__ */ jsxRuntime.jsxs(
2252
+ "div",
2253
+ {
2254
+ className: `flex items-center ${fieldShell({ size, disabled, focusWithin: true })}`,
2255
+ style,
2256
+ children: [
2257
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0 mr-2 text-foreground-muted", children: icon ?? SearchIcon }),
2258
+ /* @__PURE__ */ jsxRuntime.jsx(
2259
+ "input",
2260
+ {
2261
+ ref,
2262
+ disabled,
2263
+ value,
2264
+ onChange,
2265
+ type: "search",
2266
+ enterKeyHint: "search",
2267
+ name,
2268
+ id: htmlFor,
2269
+ className: "min-w-0 flex-1 bg-transparent outline-none disabled:cursor-not-allowed placeholder:text-foreground-muted",
2270
+ style: inputStyle,
2271
+ placeholder: placeholder ?? ""
2272
+ }
2273
+ )
2274
+ ]
2275
+ }
2208
2276
  ) });
2209
2277
  });
2210
2278
  var SearchInput_default = SearchInput;
@@ -2232,7 +2300,8 @@ function Dropdown({
2232
2300
  items = [],
2233
2301
  labelStyle = {},
2234
2302
  placeholder,
2235
- showSelectedCount = false
2303
+ showSelectedCount = false,
2304
+ size = "md"
2236
2305
  }) {
2237
2306
  const [open, setOpen] = React8.useState(false);
2238
2307
  const [selectedItems, setSelectedItems] = React8.useState([]);
@@ -2295,7 +2364,7 @@ function Dropdown({
2295
2364
  "aria-invalid": hasError || void 0,
2296
2365
  "aria-describedby": hasError ? errorId : void 0,
2297
2366
  style,
2298
- className: `flex items-center justify-between relative h-9 rounded-lg border border-border cursor-pointer select-none focus:outline-none focus-visible:border-transparent focus-visible:ring-2 focus-visible:ring-accent ${disabled ? "cursor-not-allowed bg-surface-raised text-foreground-muted" : "bg-surface text-foreground"} ${hasError ? "border-status-error" : ""}`,
2367
+ className: `flex items-center justify-between cursor-pointer select-none ${fieldShell({ size, hasError, disabled })}`,
2299
2368
  tabIndex: disabled ? -1 : 0,
2300
2369
  onKeyDown: (e) => {
2301
2370
  if (disabled) return;
@@ -2308,7 +2377,7 @@ function Dropdown({
2308
2377
  /* @__PURE__ */ jsxRuntime.jsx(
2309
2378
  "div",
2310
2379
  {
2311
- className: `h-7 pl-2 ${!style?.width ? "min-w-[240px]" : ""} flex items-center gap-1 overflow-hidden`,
2380
+ className: `${!style?.width ? "min-w-[200px]" : ""} flex items-center gap-1 overflow-hidden`,
2312
2381
  children: !value || Array.isArray(value) && value.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-muted text-sm", children: placeholder }) : Array.isArray(value) ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2313
2382
  value.slice(0, 1).map((val) => /* @__PURE__ */ jsxRuntime.jsx(
2314
2383
  DropdownPill,
@@ -2322,7 +2391,7 @@ function Dropdown({
2322
2391
  ] }) : /* @__PURE__ */ jsxRuntime.jsx(DropdownPill, { value: innerItems.find((it) => it.key === value)?.label })
2323
2392
  }
2324
2393
  ),
2325
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: `transition-transform duration-200 mr-2 ${open ? "rotate-180" : "rotate-0"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-4 w-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) }) })
2394
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex-shrink-0 ml-2 text-foreground-muted transition-transform duration-200 ${open ? "rotate-180" : "rotate-0"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-4 w-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) }) })
2326
2395
  ]
2327
2396
  }
2328
2397
  ) }),
@@ -3246,58 +3315,61 @@ function TextInput({
3246
3315
  htmlFor,
3247
3316
  placeholder,
3248
3317
  name,
3318
+ type = "text",
3249
3319
  inputStyle,
3250
3320
  style,
3251
- layout,
3321
+ layout = "vertical",
3322
+ size = "md",
3252
3323
  onBlur,
3253
3324
  errorMessage,
3254
- labelColor
3325
+ required,
3326
+ prefix,
3327
+ suffix
3255
3328
  }) {
3256
3329
  const errorId = React8.useId();
3257
3330
  const hasError = errorMessage != null;
3258
- return (
3259
- // In horizontal mode the row layout is [label, input-with-error-column].
3260
- // The error sits under the input ONLY, not spanning the label too.
3261
- // In vertical mode the whole thing is a column.
3262
- /* @__PURE__ */ jsxRuntime.jsxs(
3263
- "div",
3264
- {
3265
- className: `flex ${layout === "vertical" ? "flex-col gap-1" : "flex-row items-start gap-2"}`,
3266
- style: style ?? {},
3267
- children: [
3268
- label && /* @__PURE__ */ jsxRuntime.jsx(
3269
- "label",
3270
- {
3271
- style: { color: labelColor || void 0 },
3272
- className: `text-sm font-medium ${layout === "horizontal" ? "mt-2" : ""} max-content ${!labelColor && "text-foreground"}`,
3273
- htmlFor,
3274
- children: label
3275
- }
3276
- ),
3277
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
3278
- /* @__PURE__ */ jsxRuntime.jsx(
3279
- "input",
3280
- {
3281
- autoComplete: "off",
3282
- disabled,
3283
- value,
3284
- onChange,
3285
- onBlur,
3286
- type: "text",
3287
- name,
3288
- id: htmlFor,
3289
- "aria-invalid": hasError || void 0,
3290
- "aria-describedby": hasError ? errorId : void 0,
3291
- className: `${hasError ? "border border-status-error" : "border border-border"} bg-surface text-foreground p-2 h-9 w-60 rounded-lg disabled:bg-surface-raised disabled:text-foreground-muted disabled:cursor-not-allowed focus:outline-none focus:border-transparent focus:ring-2 focus:ring-accent transition-colors`,
3292
- style: inputStyle ?? {},
3293
- placeholder: placeholder ?? ""
3294
- }
3295
- ),
3296
- hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-status-error text-xs mt-1", children: errorMessage })
3297
- ] })
3298
- ]
3299
- }
3300
- )
3331
+ const hasAdornment = prefix != null || suffix != null;
3332
+ const input = /* @__PURE__ */ jsxRuntime.jsx(
3333
+ "input",
3334
+ {
3335
+ autoComplete: "off",
3336
+ disabled,
3337
+ value,
3338
+ onChange,
3339
+ onBlur,
3340
+ type,
3341
+ name,
3342
+ id: htmlFor,
3343
+ "aria-invalid": hasError || void 0,
3344
+ "aria-describedby": hasError ? errorId : void 0,
3345
+ placeholder: placeholder ?? "",
3346
+ className: hasAdornment ? "min-w-0 flex-1 bg-transparent outline-none disabled:cursor-not-allowed placeholder:text-foreground-muted" : fieldShell({ size, hasError, disabled }),
3347
+ style: inputStyle
3348
+ }
3349
+ );
3350
+ return /* @__PURE__ */ jsxRuntime.jsx(
3351
+ Field,
3352
+ {
3353
+ label,
3354
+ htmlFor,
3355
+ errorId,
3356
+ errorMessage,
3357
+ layout,
3358
+ required,
3359
+ className: style ? void 0 : void 0,
3360
+ children: hasAdornment ? /* @__PURE__ */ jsxRuntime.jsxs(
3361
+ "div",
3362
+ {
3363
+ className: `flex items-center ${fieldShell({ size, hasError, disabled, focusWithin: true })}`,
3364
+ style,
3365
+ children: [
3366
+ prefix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0 mr-2 text-foreground-muted", children: prefix }),
3367
+ input,
3368
+ suffix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0 ml-2 text-foreground-muted", children: suffix })
3369
+ ]
3370
+ }
3371
+ ) : input
3372
+ }
3301
3373
  );
3302
3374
  }
3303
3375
  function NumberInput({
@@ -3308,8 +3380,10 @@ function NumberInput({
3308
3380
  htmlFor,
3309
3381
  name,
3310
3382
  disabled,
3311
- layout = "horizontal",
3383
+ layout = "vertical",
3384
+ size = "md",
3312
3385
  errorMessage,
3386
+ required,
3313
3387
  inputStyle,
3314
3388
  labelStyle,
3315
3389
  placeholder,
@@ -3350,22 +3424,21 @@ function NumberInput({
3350
3424
  if (Number.isNaN(parsed)) return;
3351
3425
  onChange?.({ target: { value: round(parsed), id: htmlFor, name } });
3352
3426
  };
3353
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
3354
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex ${layout === "vertical" ? "flex-col gap-1" : "flex-row items-center gap-2"}`, children: [
3355
- label && /* @__PURE__ */ jsxRuntime.jsx(
3356
- "label",
3357
- {
3358
- className: "text-sm font-medium ml-1 max-content select-none text-foreground",
3359
- style: labelStyle,
3360
- htmlFor,
3361
- children: label
3362
- }
3363
- ),
3364
- /* @__PURE__ */ jsxRuntime.jsxs(
3427
+ return /* @__PURE__ */ jsxRuntime.jsx(
3428
+ Field,
3429
+ {
3430
+ label,
3431
+ htmlFor,
3432
+ errorId,
3433
+ errorMessage,
3434
+ layout,
3435
+ required,
3436
+ labelStyle,
3437
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
3365
3438
  "div",
3366
3439
  {
3367
3440
  style,
3368
- className: `flex items-center rounded-lg border overflow-hidden ${hasError ? "border-status-error" : "border-border"} ${disabled ? "bg-surface-raised text-foreground-muted cursor-not-allowed" : "bg-surface text-foreground"} focus-within:border-transparent focus-within:ring-2 focus-within:ring-accent transition-colors`,
3441
+ className: `flex items-center overflow-hidden pr-0 ${fieldShell({ size, hasError, disabled, focusWithin: true })}`,
3369
3442
  children: [
3370
3443
  /* @__PURE__ */ jsxRuntime.jsx(
3371
3444
  "input",
@@ -3382,13 +3455,13 @@ function NumberInput({
3382
3455
  type: "number",
3383
3456
  "aria-invalid": hasError || void 0,
3384
3457
  "aria-describedby": hasError ? errorId : void 0,
3385
- className: "bg-transparent focus:outline-none h-9 w-full px-3 disabled:cursor-not-allowed [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
3386
- style: inputStyle ?? {},
3458
+ className: "min-w-0 flex-1 bg-transparent outline-none h-full disabled:cursor-not-allowed [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none placeholder:text-foreground-muted",
3459
+ style: inputStyle,
3387
3460
  placeholder: placeholder ?? "",
3388
3461
  readOnly
3389
3462
  }
3390
3463
  ),
3391
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col border-l border-border h-9", children: [
3464
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col self-stretch border-l border-border flex-shrink-0", children: [
3392
3465
  /* @__PURE__ */ jsxRuntime.jsx(
3393
3466
  "button",
3394
3467
  {
@@ -3397,7 +3470,7 @@ function NumberInput({
3397
3470
  onClick: onIncrement,
3398
3471
  disabled: disabled || readOnly || max !== void 0 && numeric >= max,
3399
3472
  "aria-label": "Increase value",
3400
- className: "flex-1 px-1.5 flex items-center justify-center hover:bg-surface-raised disabled:opacity-30 disabled:cursor-not-allowed transition-colors focus:outline-none focus-visible:bg-surface-raised",
3473
+ className: "flex-1 px-1.5 flex items-center justify-center text-foreground-muted hover:bg-surface-raised hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed transition-colors",
3401
3474
  children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, className: "h-3 w-3", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 15l7-7 7 7" }) })
3402
3475
  }
3403
3476
  ),
@@ -3409,7 +3482,7 @@ function NumberInput({
3409
3482
  onClick: onDecrement,
3410
3483
  disabled: disabled || readOnly || min !== void 0 && numeric <= min,
3411
3484
  "aria-label": "Decrease value",
3412
- className: "flex-1 px-1.5 flex items-center justify-center hover:bg-surface-raised disabled:opacity-30 disabled:cursor-not-allowed transition-colors focus:outline-none focus-visible:bg-surface-raised border-t border-border",
3485
+ className: "flex-1 px-1.5 flex items-center justify-center text-foreground-muted hover:bg-surface-raised hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed transition-colors border-t border-border",
3413
3486
  children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, className: "h-3 w-3", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) })
3414
3487
  }
3415
3488
  )
@@ -3417,10 +3490,18 @@ function NumberInput({
3417
3490
  ]
3418
3491
  }
3419
3492
  )
3420
- ] }),
3421
- hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-xs text-status-error ml-1", children: errorMessage })
3422
- ] });
3493
+ }
3494
+ );
3423
3495
  }
3496
+ var EyeIcon = /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-5 h-5", "aria-hidden": "true", children: [
3497
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 15a3 3 0 100-6 3 3 0 000 6z" }),
3498
+ /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 010-1.113zM17.25 12a5.25 5.25 0 11-10.5 0 5.25 5.25 0 0110.5 0z", clipRule: "evenodd" })
3499
+ ] });
3500
+ var EyeSlashIcon = /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-5 h-5", "aria-hidden": "true", children: [
3501
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.53 2.47a.75.75 0 00-1.06 1.06l18 18a.75.75 0 101.06-1.06l-18-18zM22.676 12.553a11.249 11.249 0 01-2.631 4.31l-3.099-3.099a5.25 5.25 0 00-6.71-6.71L7.759 4.577a11.217 11.217 0 014.242-.827c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113z" }),
3502
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15.75 12c0 .18-.013.357-.037.53l-4.244-4.243A3.75 3.75 0 0115.75 12zM12.53 15.713l-4.243-4.244a3.75 3.75 0 004.243 4.243z" }),
3503
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.75 12c0-.619.107-1.213.304-1.764l-3.1-3.1a11.25 11.25 0 00-2.63 4.31c-.12.362-.12.752 0 1.114 1.489 4.467 5.704 7.69 10.675 7.69 1.5 0 2.933-.294 4.242-.827l-2.477-2.477A5.25 5.25 0 016.75 12z" })
3504
+ ] });
3424
3505
  function Password({
3425
3506
  value,
3426
3507
  onChange,
@@ -3431,32 +3512,32 @@ function Password({
3431
3512
  name,
3432
3513
  inputStyle,
3433
3514
  style,
3434
- layout,
3515
+ layout = "vertical",
3516
+ size = "md",
3435
3517
  onBlur,
3436
3518
  errorMessage,
3437
- labelColor,
3438
- iconColor
3519
+ required,
3520
+ showIcon,
3521
+ hideIcon
3439
3522
  }) {
3440
- const [passwordVisible, setPasswordVisible] = React8.useState(false);
3523
+ const [visible, setVisible] = React8.useState(false);
3441
3524
  const errorId = React8.useId();
3442
3525
  const hasError = errorMessage != null;
3443
- return /* @__PURE__ */ jsxRuntime.jsxs(
3444
- "div",
3526
+ return /* @__PURE__ */ jsxRuntime.jsx(
3527
+ Field,
3445
3528
  {
3446
- className: `flex ${layout === "vertical" ? "flex-col gap-1" : "flex-row items-start gap-2"}`,
3447
- style: style ?? {},
3448
- children: [
3449
- label && /* @__PURE__ */ jsxRuntime.jsx(
3450
- "label",
3451
- {
3452
- style: { color: labelColor || void 0 },
3453
- className: `text-sm font-medium ${layout === "horizontal" ? "mt-2" : ""} max-content ${!labelColor && "text-foreground"}`,
3454
- htmlFor,
3455
- children: label
3456
- }
3457
- ),
3458
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
3459
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
3529
+ label,
3530
+ htmlFor,
3531
+ errorId,
3532
+ errorMessage,
3533
+ layout,
3534
+ required,
3535
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
3536
+ "div",
3537
+ {
3538
+ className: `flex items-center ${fieldShell({ size, hasError, disabled, focusWithin: true })}`,
3539
+ style,
3540
+ children: [
3460
3541
  /* @__PURE__ */ jsxRuntime.jsx(
3461
3542
  "input",
3462
3543
  {
@@ -3465,44 +3546,30 @@ function Password({
3465
3546
  value,
3466
3547
  onChange,
3467
3548
  onBlur,
3468
- type: passwordVisible ? "text" : "password",
3549
+ type: visible ? "text" : "password",
3469
3550
  name,
3470
3551
  id: htmlFor,
3471
3552
  "aria-invalid": hasError || void 0,
3472
3553
  "aria-describedby": hasError ? errorId : void 0,
3473
- className: `${hasError ? "border border-status-error" : "border border-border"} bg-surface text-foreground p-2 h-9 w-52 rounded-lg disabled:bg-surface-raised disabled:text-foreground-muted disabled:cursor-not-allowed focus:outline-none focus:border-transparent focus:ring-2 focus:ring-accent transition-colors`,
3474
- style: inputStyle ?? {},
3475
- placeholder: placeholder ?? ""
3554
+ placeholder: placeholder ?? "",
3555
+ className: "min-w-0 flex-1 bg-transparent outline-none disabled:cursor-not-allowed placeholder:text-foreground-muted",
3556
+ style: inputStyle
3476
3557
  }
3477
3558
  ),
3478
3559
  /* @__PURE__ */ jsxRuntime.jsx(
3479
3560
  "button",
3480
3561
  {
3481
3562
  type: "button",
3482
- className: "cursor-pointer p-1 text-foreground-secondary hover:text-foreground rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
3483
- style: iconColor ? { color: iconColor } : void 0,
3484
- onClick: () => setPasswordVisible(!passwordVisible),
3485
- "aria-label": passwordVisible ? "Hide password" : "Show password",
3486
- children: passwordVisible ? (
3487
- /* EyeSlash */
3488
- /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-6 h-6", children: [
3489
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.53 2.47a.75.75 0 00-1.06 1.06l18 18a.75.75 0 101.06-1.06l-18-18zM22.676 12.553a11.249 11.249 0 01-2.631 4.31l-3.099-3.099a5.25 5.25 0 00-6.71-6.71L7.759 4.577a11.217 11.217 0 014.242-.827c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113z" }),
3490
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15.75 12c0 .18-.013.357-.037.53l-4.244-4.243A3.75 3.75 0 0115.75 12zM12.53 15.713l-4.243-4.244a3.75 3.75 0 004.243 4.243z" }),
3491
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.75 12c0-.619.107-1.213.304-1.764l-3.1-3.1a11.25 11.25 0 00-2.63 4.31c-.12.362-.12.752 0 1.114 1.489 4.467 5.704 7.69 10.675 7.69 1.5 0 2.933-.294 4.242-.827l-2.477-2.477A5.25 5.25 0 016.75 12z" })
3492
- ] })
3493
- ) : (
3494
- /* Eye */
3495
- /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-6 h-6", children: [
3496
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 15a3 3 0 100-6 3 3 0 000 6z" }),
3497
- /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 010-1.113zM17.25 12a5.25 5.25 0 11-10.5 0 5.25 5.25 0 0110.5 0z", clipRule: "evenodd" })
3498
- ] })
3499
- )
3563
+ disabled,
3564
+ className: `flex-shrink-0 ml-2 ${FIELD_SIZE[size].gap} rounded text-foreground-muted hover:text-foreground transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed`,
3565
+ onClick: () => setVisible((v) => !v),
3566
+ "aria-label": visible ? "Hide password" : "Show password",
3567
+ children: visible ? hideIcon ?? EyeSlashIcon : showIcon ?? EyeIcon
3500
3568
  }
3501
3569
  )
3502
- ] }),
3503
- hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-status-error text-xs mt-1", children: errorMessage })
3504
- ] })
3505
- ]
3570
+ ]
3571
+ }
3572
+ )
3506
3573
  }
3507
3574
  );
3508
3575
  }
@@ -3585,6 +3652,96 @@ function Checkbox({
3585
3652
  errorMessage && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-status-error pl-[26px]", children: errorMessage })
3586
3653
  ] });
3587
3654
  }
3655
+ var DOT_SIZE = {
3656
+ sm: "h-3.5 w-3.5",
3657
+ md: "h-4 w-4",
3658
+ lg: "h-5 w-5"
3659
+ };
3660
+ var TEXT_SIZE = {
3661
+ sm: "text-xs",
3662
+ md: "text-sm",
3663
+ lg: "text-base"
3664
+ };
3665
+ function RadioGroup({
3666
+ options,
3667
+ value,
3668
+ defaultValue,
3669
+ onChange,
3670
+ name,
3671
+ label,
3672
+ orientation = "vertical",
3673
+ size = "md",
3674
+ disabled,
3675
+ required,
3676
+ errorMessage
3677
+ }) {
3678
+ const errorId = React8.useId();
3679
+ const groupId = React8.useId();
3680
+ const hasError = errorMessage != null;
3681
+ return /* @__PURE__ */ jsxRuntime.jsx(
3682
+ Field,
3683
+ {
3684
+ label,
3685
+ htmlFor: groupId,
3686
+ errorId,
3687
+ errorMessage,
3688
+ required,
3689
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3690
+ RadioGroupPrimitive__namespace.Root,
3691
+ {
3692
+ id: groupId,
3693
+ name,
3694
+ value,
3695
+ defaultValue,
3696
+ onValueChange: onChange,
3697
+ disabled,
3698
+ required,
3699
+ "aria-invalid": hasError || void 0,
3700
+ "aria-describedby": hasError ? errorId : void 0,
3701
+ orientation,
3702
+ className: orientation === "horizontal" ? "flex flex-row flex-wrap gap-5" : "flex flex-col gap-3",
3703
+ children: options.map((opt) => {
3704
+ const itemId = `${groupId}-${opt.value}`;
3705
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2.5", children: [
3706
+ /* @__PURE__ */ jsxRuntime.jsx(
3707
+ RadioGroupPrimitive__namespace.Item,
3708
+ {
3709
+ id: itemId,
3710
+ value: opt.value,
3711
+ disabled: opt.disabled,
3712
+ className: [
3713
+ DOT_SIZE[size],
3714
+ "mt-0.5 flex-shrink-0 rounded-full border bg-surface transition-colors duration-150",
3715
+ "border-border-strong",
3716
+ "hover:border-accent",
3717
+ "data-[state=checked]:border-accent",
3718
+ "focus:outline-none focus-visible:ring-[3px] focus-visible:ring-focus-ring",
3719
+ "disabled:cursor-not-allowed disabled:opacity-50"
3720
+ ].join(" "),
3721
+ children: /* @__PURE__ */ jsxRuntime.jsx(RadioGroupPrimitive__namespace.Indicator, { className: "flex h-full w-full items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block h-1/2 w-1/2 rounded-full bg-accent" }) })
3722
+ }
3723
+ ),
3724
+ /* @__PURE__ */ jsxRuntime.jsxs(
3725
+ "label",
3726
+ {
3727
+ htmlFor: itemId,
3728
+ className: [
3729
+ "select-none",
3730
+ opt.disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
3731
+ ].join(" "),
3732
+ children: [
3733
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: `block ${TEXT_SIZE[size]} text-foreground`, children: opt.label }),
3734
+ opt.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-foreground-secondary mt-0.5", children: opt.description })
3735
+ ]
3736
+ }
3737
+ )
3738
+ ] }, opt.value);
3739
+ })
3740
+ }
3741
+ )
3742
+ }
3743
+ );
3744
+ }
3588
3745
  function Switch({
3589
3746
  checked = false,
3590
3747
  onChange,
@@ -3622,7 +3779,9 @@ function AutoComplete({
3622
3779
  debounce = 250,
3623
3780
  onItemClick,
3624
3781
  emptyText = "No results found",
3625
- loadingText = "Searching\u2026"
3782
+ loadingText = "Searching\u2026",
3783
+ size = "md",
3784
+ icon
3626
3785
  }) {
3627
3786
  const [term, setTerm] = React8.useState("");
3628
3787
  const [open, setOpen] = React8.useState(false);
@@ -3670,15 +3829,15 @@ function AutoComplete({
3670
3829
  onItemClick?.(item.value);
3671
3830
  setOpen(false);
3672
3831
  };
3673
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative flex flex-col items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs(
3832
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3674
3833
  "div",
3675
3834
  {
3676
- className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`,
3677
- style: style ?? {},
3835
+ className: `flex ${layout === "vertical" ? "flex-col gap-1.5" : "flex-row items-start gap-3"}`,
3836
+ style,
3678
3837
  children: [
3679
- label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium ml-1 max-content text-foreground", children: label }),
3680
- /* @__PURE__ */ jsxRuntime.jsxs(Popover__namespace.Root, { open: open && !disabled, onOpenChange: (o) => !disabled && setOpen(o), children: [
3681
- /* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Anchor, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-surface text-foreground flex items-center gap-1 rounded-lg border border-border pr-2 focus-within:border-transparent focus-within:ring-2 focus-within:ring-accent transition-colors", children: [
3838
+ label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: `text-sm font-medium text-foreground select-none ${layout === "horizontal" ? "mt-2 flex-shrink-0" : ""}`, children: label }),
3839
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col min-w-0 flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs(Popover__namespace.Root, { open: open && !disabled, onOpenChange: (o) => !disabled && setOpen(o), children: [
3840
+ /* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Anchor, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex items-center ${fieldShell({ size, disabled, focusWithin: true })}`, children: [
3682
3841
  /* @__PURE__ */ jsxRuntime.jsx(
3683
3842
  "input",
3684
3843
  {
@@ -3691,8 +3850,8 @@ function AutoComplete({
3691
3850
  onFocus: () => setOpen(true),
3692
3851
  type: "text",
3693
3852
  name,
3694
- className: "bg-transparent focus:outline-none pl-2 h-9 w-56 rounded-lg disabled:cursor-not-allowed",
3695
- style: inputStyle ?? {},
3853
+ className: "min-w-0 flex-1 bg-transparent outline-none disabled:cursor-not-allowed placeholder:text-foreground-muted",
3854
+ style: inputStyle,
3696
3855
  placeholder: placeholder ?? "",
3697
3856
  autoComplete: "off",
3698
3857
  "aria-haspopup": "listbox",
@@ -3701,7 +3860,7 @@ function AutoComplete({
3701
3860
  "aria-busy": loading || void 0
3702
3861
  }
3703
3862
  ),
3704
- loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-5 h-5 flex-shrink-0 flex items-center justify-center text-accent", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner, { inline: true, size: "xs", spinnerColor: "currentColor" }) }) : /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-5 h-5 flex-shrink-0 text-foreground-muted", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M10.5 3.75a6.75 6.75 0 100 13.5 6.75 6.75 0 000-13.5zM2.25 10.5a8.25 8.25 0 1114.59 5.28l4.69 4.69a.75.75 0 11-1.06 1.06l-4.69-4.69A8.25 8.25 0 012.25 10.5z", clipRule: "evenodd" }) })
3863
+ loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 w-4 h-4 flex-shrink-0 flex items-center justify-center text-accent", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner, { inline: true, size: "xs", spinnerColor: "currentColor" }) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 flex-shrink-0 text-foreground-muted", children: icon ?? /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-4 h-4", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M10.5 3.75a6.75 6.75 0 100 13.5 6.75 6.75 0 000-13.5zM2.25 10.5a8.25 8.25 0 1114.59 5.28l4.69 4.69a.75.75 0 11-1.06 1.06l-4.69-4.69A8.25 8.25 0 012.25 10.5z", clipRule: "evenodd" }) }) })
3705
3864
  ] }) }),
3706
3865
  /* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
3707
3866
  Popover__namespace.Content,
@@ -3740,10 +3899,10 @@ function AutoComplete({
3740
3899
  )) })
3741
3900
  }
3742
3901
  ) })
3743
- ] })
3902
+ ] }) })
3744
3903
  ]
3745
3904
  }
3746
- ) });
3905
+ );
3747
3906
  }
3748
3907
  function flattenVisible(items, expanded, depth = 0, out = []) {
3749
3908
  for (const node of items) {
@@ -3778,7 +3937,8 @@ function TreeSelect({
3778
3937
  items = [],
3779
3938
  placeholder = "Select\u2026",
3780
3939
  parentsSelectable = true,
3781
- defaultExpandedKeys = []
3940
+ defaultExpandedKeys = [],
3941
+ size = "md"
3782
3942
  }) {
3783
3943
  const errorId = React8.useId();
3784
3944
  const hasError = errorMessage != null;
@@ -3877,7 +4037,7 @@ function TreeSelect({
3877
4037
  "aria-invalid": hasError || void 0,
3878
4038
  "aria-describedby": hasError ? errorId : void 0,
3879
4039
  disabled,
3880
- className: `flex items-center justify-between h-9 rounded-lg border ${hasError ? "border-status-error" : "border-border"} px-3 cursor-pointer select-none focus:outline-none focus-visible:border-transparent focus-visible:ring-2 focus-visible:ring-accent ${disabled ? "cursor-not-allowed bg-surface-raised text-foreground-muted" : "bg-surface text-foreground"} ${!style?.width ? "min-w-[240px]" : ""}`,
4040
+ className: `flex items-center justify-between cursor-pointer select-none ${!style?.width ? "min-w-[240px]" : ""} ${fieldShell({ size, hasError, disabled })}`,
3881
4041
  children: [
3882
4042
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm truncate text-left", children: selectedNode ? selectedNode.label : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-muted", children: placeholder }) }),
3883
4043
  /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: `h-4 w-4 flex-shrink-0 transition-transform duration-200 ${open ? "rotate-180" : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) })
@@ -4004,111 +4164,162 @@ function TreeNodeRow({
4004
4164
  }
4005
4165
  );
4006
4166
  }
4167
+ function formatBytes(bytes) {
4168
+ if (bytes === 0) return "0 B";
4169
+ const units = ["B", "KB", "MB", "GB"];
4170
+ const i = Math.floor(Math.log(bytes) / Math.log(1024));
4171
+ return `${(bytes / Math.pow(1024, i)).toFixed(i === 0 ? 0 : 1)} ${units[i]}`;
4172
+ }
4173
+ var UploadGlyph = /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.5, className: "w-6 h-6", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 16V4m0 0L8 8m4-4l4 4M4 16v2a2 2 0 002 2h12a2 2 0 002-2v-2" }) });
4174
+ var FileGlyph = /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.5, className: "w-5 h-5", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M14 3v4a1 1 0 001 1h4M5 3h9l5 5v11a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2z" }) });
4007
4175
  function FileInput({
4008
4176
  allowMultiple = false,
4009
4177
  onChange,
4010
4178
  name,
4011
- accept = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.xlsx"
4179
+ htmlFor,
4180
+ label,
4181
+ accept,
4182
+ prompt = "Click to upload or drag and drop",
4183
+ hint,
4184
+ maxSize,
4185
+ errorMessage,
4186
+ disabled,
4187
+ required,
4188
+ icon
4012
4189
  }) {
4013
- const fileInput = React8.useRef(null);
4190
+ const inputRef = React8.useRef(null);
4191
+ const errorId = React8.useId();
4014
4192
  const [files, setFiles] = React8.useState([]);
4193
+ const [dragging, setDragging] = React8.useState(false);
4194
+ const [sizeError, setSizeError] = React8.useState(null);
4195
+ const effectiveError = errorMessage ?? sizeError ?? void 0;
4015
4196
  const openPicker = () => {
4016
- fileInput.current?.click();
4197
+ if (!disabled) inputRef.current?.click();
4017
4198
  };
4018
- const handleFiles = (list) => {
4199
+ const commit = (list) => {
4200
+ if (maxSize != null) {
4201
+ const tooBig = list.find((f) => f.size > maxSize);
4202
+ if (tooBig) {
4203
+ setSizeError(`"${tooBig.name}" exceeds the ${formatBytes(maxSize)} limit`);
4204
+ return;
4205
+ }
4206
+ }
4207
+ setSizeError(null);
4019
4208
  setFiles(list);
4020
- onChange?.({ target: { files: list } });
4209
+ onChange?.({ target: { files: list, name, id: htmlFor ?? name } });
4021
4210
  };
4022
4211
  const onDrop = (e) => {
4023
4212
  e.preventDefault();
4024
- const fileList = [];
4025
- if (e.dataTransfer.items) {
4026
- for (let i = 0; i < e.dataTransfer.items.length; i++) {
4027
- if (e.dataTransfer.items[i].kind === "file") {
4028
- const f = e.dataTransfer.items[i].getAsFile();
4029
- if (f) fileList.push(f);
4030
- }
4031
- }
4032
- } else {
4033
- for (let i = 0; i < e.dataTransfer.files.length; i++) {
4034
- fileList.push(e.dataTransfer.files[i]);
4035
- }
4036
- }
4037
- handleFiles(fileList);
4038
- };
4039
- const localOnChange = (e) => {
4040
- handleFiles(Array.from(e.target.files ?? []));
4213
+ setDragging(false);
4214
+ if (disabled) return;
4215
+ const dropped = Array.from(e.dataTransfer.files ?? []);
4216
+ commit(allowMultiple ? dropped : dropped.slice(0, 1));
4041
4217
  };
4042
- const removeFile = (e) => {
4043
- e.stopPropagation();
4044
- setFiles([]);
4045
- onChange?.({ target: { files: [], name, id: name, value: "" } });
4046
- if (fileInput.current) fileInput.current.value = "";
4218
+ const removeFile = (idx) => {
4219
+ const next = files.filter((_, i) => i !== idx);
4220
+ setFiles(next);
4221
+ setSizeError(null);
4222
+ onChange?.({ target: { files: next, name, id: htmlFor ?? name, value: "" } });
4223
+ if (next.length === 0 && inputRef.current) inputRef.current.value = "";
4047
4224
  };
4048
- return (
4049
- // Dropzone is keyboard-activatable: role="button", focusable via
4050
- // tabIndex, and Space/Enter trigger the file picker. Without these
4051
- // a keyboard-only user could not upload a file.
4052
- /* @__PURE__ */ jsxRuntime.jsxs(
4053
- "div",
4054
- {
4055
- role: "button",
4056
- tabIndex: 0,
4057
- "aria-label": "Upload file \u2014 click or drop",
4058
- onClick: openPicker,
4059
- onKeyDown: (e) => {
4060
- if (e.key === "Enter" || e.key === " ") {
4061
- e.preventDefault();
4062
- openPicker();
4063
- }
4064
- },
4065
- className: "border-2 border-dashed border-border hover:border-accent w-full h-full rounded-md transition-colors duration-200 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-accent text-foreground-secondary hover:text-foreground",
4066
- onDragOver: (e) => e.preventDefault(),
4067
- onDrop,
4068
- children: [
4069
- /* @__PURE__ */ jsxRuntime.jsx(
4070
- "input",
4071
- {
4072
- id: name,
4073
- name,
4074
- onChange: localOnChange,
4075
- ref: fileInput,
4076
- hidden: true,
4077
- type: "file",
4078
- accept,
4079
- multiple: allowMultiple
4080
- }
4081
- ),
4082
- files.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col h-full items-center justify-center gap-2", children: [
4083
- /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-16 h-16", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M11.47 2.47a.75.75 0 011.06 0l4.5 4.5a.75.75 0 01-1.06 1.06l-3.22-3.22V16.5a.75.75 0 01-1.5 0V4.81L8.03 8.03a.75.75 0 01-1.06-1.06l4.5-4.5zM3 15.75a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z", clipRule: "evenodd" }) }),
4084
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm", children: "Click or Drop a file" })
4085
- ] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3 items-center justify-center w-full h-full p-3", children: files.map((file, id) => /* @__PURE__ */ jsxRuntime.jsxs(
4086
- "div",
4087
- {
4088
- className: "text-xs flex flex-col items-center w-20 h-24 text-center bg-surface-raised text-foreground p-4 rounded-md relative",
4089
- children: [
4090
- /* @__PURE__ */ jsxRuntime.jsx(
4091
- "button",
4092
- {
4093
- type: "button",
4094
- onClick: removeFile,
4095
- className: "bg-status-error rounded-full w-4 h-4 absolute right-[-5px] top-[-5px] cursor-pointer flex items-center justify-center focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
4096
- "aria-label": "Remove file",
4097
- children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 5L5 15M5 5l10 10", stroke: "#fff", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
4098
- }
4099
- ),
4100
- /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-10 h-10", "aria-hidden": "true", children: [
4101
- /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M5.625 1.5c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0016.5 9h-1.875a1.875 1.875 0 01-1.875-1.875V5.25A3.75 3.75 0 009 1.5H5.625z", clipRule: "evenodd" }),
4102
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12.971 1.816A5.23 5.23 0 0114.25 5.25v1.875c0 .207.168.375.375.375H16.5a5.23 5.23 0 013.434 1.279 9.768 9.768 0 00-6.963-6.963z" })
4103
- ] }),
4104
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ellipsis whitespace-nowrap overflow-hidden w-full", children: file.name })
4105
- ]
4225
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4226
+ Field,
4227
+ {
4228
+ label,
4229
+ htmlFor,
4230
+ errorId,
4231
+ errorMessage: effectiveError,
4232
+ required,
4233
+ children: [
4234
+ /* @__PURE__ */ jsxRuntime.jsxs(
4235
+ "div",
4236
+ {
4237
+ role: "button",
4238
+ tabIndex: disabled ? -1 : 0,
4239
+ "aria-label": typeof prompt === "string" ? prompt : "Upload file",
4240
+ "aria-disabled": disabled || void 0,
4241
+ "aria-invalid": effectiveError != null || void 0,
4242
+ "aria-describedby": effectiveError != null ? errorId : void 0,
4243
+ onClick: openPicker,
4244
+ onKeyDown: (e) => {
4245
+ if (disabled) return;
4246
+ if (e.key === "Enter" || e.key === " ") {
4247
+ e.preventDefault();
4248
+ openPicker();
4249
+ }
4106
4250
  },
4107
- `${id}${file.name}`
4108
- )) })
4109
- ]
4110
- }
4111
- )
4251
+ onDragOver: (e) => {
4252
+ e.preventDefault();
4253
+ if (!disabled) setDragging(true);
4254
+ },
4255
+ onDragLeave: () => setDragging(false),
4256
+ onDrop,
4257
+ className: [
4258
+ "group flex flex-col items-center justify-center gap-3 w-full rounded-xl border border-dashed px-6 py-8 text-center",
4259
+ "transition-colors duration-150 focus:outline-none focus-visible:ring-[3px] focus-visible:ring-focus-ring",
4260
+ disabled ? "border-border bg-surface-raised cursor-not-allowed opacity-60" : effectiveError != null ? "border-status-error bg-surface cursor-pointer" : dragging ? "border-accent bg-surface-raised cursor-copy" : "border-border bg-surface hover:border-border-strong cursor-pointer"
4261
+ ].join(" "),
4262
+ children: [
4263
+ /* @__PURE__ */ jsxRuntime.jsx(
4264
+ "input",
4265
+ {
4266
+ id: htmlFor ?? name,
4267
+ name,
4268
+ onChange: (e) => commit(Array.from(e.target.files ?? [])),
4269
+ ref: inputRef,
4270
+ hidden: true,
4271
+ type: "file",
4272
+ accept,
4273
+ multiple: allowMultiple,
4274
+ disabled
4275
+ }
4276
+ ),
4277
+ /* @__PURE__ */ jsxRuntime.jsx(
4278
+ "span",
4279
+ {
4280
+ className: [
4281
+ "flex h-11 w-11 items-center justify-center rounded-full transition-colors duration-150",
4282
+ dragging ? "bg-accent text-accent-fg" : "bg-surface-raised text-foreground-secondary group-hover:text-foreground"
4283
+ ].join(" "),
4284
+ children: icon ?? UploadGlyph
4285
+ }
4286
+ ),
4287
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-0.5", children: [
4288
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium text-foreground", children: dragging ? "Drop to upload" : prompt }),
4289
+ hint && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-foreground-muted", children: hint })
4290
+ ] })
4291
+ ]
4292
+ }
4293
+ ),
4294
+ files.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "mt-3 flex flex-col gap-2", children: files.map((file, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
4295
+ "li",
4296
+ {
4297
+ className: "flex items-center gap-3 rounded-lg border border-border bg-surface px-3 py-2",
4298
+ children: [
4299
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0 text-foreground-muted", children: FileGlyph }),
4300
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex-1 min-w-0", children: [
4301
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-sm text-foreground truncate", children: file.name }),
4302
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-foreground-muted", children: formatBytes(file.size) })
4303
+ ] }),
4304
+ /* @__PURE__ */ jsxRuntime.jsx(
4305
+ "button",
4306
+ {
4307
+ type: "button",
4308
+ onClick: (e) => {
4309
+ e.stopPropagation();
4310
+ removeFile(idx);
4311
+ },
4312
+ "aria-label": `Remove ${file.name}`,
4313
+ className: "flex-shrink-0 w-7 h-7 inline-flex items-center justify-center rounded-md text-foreground-muted hover:text-status-error hover:bg-surface-raised transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
4314
+ children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 5L5 15M5 5l10 10", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) })
4315
+ }
4316
+ )
4317
+ ]
4318
+ },
4319
+ `${idx}-${file.name}`
4320
+ )) })
4321
+ ]
4322
+ }
4112
4323
  );
4113
4324
  }
4114
4325
  var MONTH_NAMES = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
@@ -4163,7 +4374,8 @@ function DatePicker({
4163
4374
  style,
4164
4375
  format = defaultFormat,
4165
4376
  weekStartsOn = 0,
4166
- clearable = true
4377
+ clearable = true,
4378
+ size = "md"
4167
4379
  }) {
4168
4380
  const errorId = React8.useId();
4169
4381
  const hasError = errorMessage != null;
@@ -4266,7 +4478,7 @@ function DatePicker({
4266
4478
  "aria-describedby": hasError ? errorId : void 0,
4267
4479
  "aria-haspopup": "dialog",
4268
4480
  "aria-expanded": open,
4269
- className: `flex items-center justify-between h-9 rounded-lg border px-3 cursor-pointer select-none focus:outline-none focus-visible:border-transparent focus-visible:ring-2 focus-visible:ring-accent ${hasError ? "border-status-error" : "border-border"} ${disabled ? "cursor-not-allowed bg-surface-raised text-foreground-muted" : "bg-surface text-foreground"} ${!style?.width ? "min-w-[200px]" : ""}`,
4481
+ className: `flex items-center justify-between cursor-pointer select-none ${!style?.width ? "min-w-[200px]" : ""} ${fieldShell({ size, hasError, disabled })}`,
4270
4482
  children: [
4271
4483
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: `text-sm truncate ${displayValue ? "" : "text-foreground-muted"}`, children: displayValue || placeholder }),
4272
4484
  /* @__PURE__ */ jsxRuntime.jsx(CalendarIcon, {})
@@ -4481,6 +4693,7 @@ exports.ContextMenu = ContextMenu;
4481
4693
  exports.Drawer = Drawer;
4482
4694
  exports.Dropdown = Dropdown;
4483
4695
  exports.FadingBase = FadingBase;
4696
+ exports.Field = Field;
4484
4697
  exports.FileInput = FileInput;
4485
4698
  exports.Flex = Flex;
4486
4699
  exports.Grid = Grid2;
@@ -4495,6 +4708,7 @@ exports.NumberInput = NumberInput;
4495
4708
  exports.OpaqueGridCard = OpaqueGridCard;
4496
4709
  exports.Password = Password;
4497
4710
  exports.Portal = Portal;
4711
+ exports.RadioGroup = RadioGroup;
4498
4712
  exports.ScalableContainer = ScalableContainer;
4499
4713
  exports.SearchInput = SearchInput_default;
4500
4714
  exports.Sidebar = Sidebar;
@@ -4517,6 +4731,7 @@ exports.Tree = Tree;
4517
4731
  exports.TreeSelect = TreeSelect;
4518
4732
  exports.Typography = Typography;
4519
4733
  exports.Wizard = Wizard;
4734
+ exports.fieldShell = fieldShell;
4520
4735
  exports.useNotification = useNotification;
4521
4736
  //# sourceMappingURL=index.cjs.map
4522
4737
  //# sourceMappingURL=index.cjs.map