@timeax/form-palette 0.0.15 → 0.0.17

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.mjs CHANGED
@@ -1158,11 +1158,11 @@ var init_parseHeaders = __esm({
1158
1158
  function normalizeHeader(header) {
1159
1159
  return header && String(header).trim().toLowerCase();
1160
1160
  }
1161
- function normalizeValue(value) {
1161
+ function normalizeValue2(value) {
1162
1162
  if (value === false || value == null) {
1163
1163
  return value;
1164
1164
  }
1165
- return utils_default.isArray(value) ? value.map(normalizeValue) : String(value);
1165
+ return utils_default.isArray(value) ? value.map(normalizeValue2) : String(value);
1166
1166
  }
1167
1167
  function parseTokens(str) {
1168
1168
  const tokens = /* @__PURE__ */ Object.create(null);
@@ -1224,7 +1224,7 @@ var init_AxiosHeaders = __esm({
1224
1224
  }
1225
1225
  const key = utils_default.findKey(self2, lHeader);
1226
1226
  if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
1227
- self2[key || _header] = normalizeValue(_value);
1227
+ self2[key || _header] = normalizeValue2(_value);
1228
1228
  }
1229
1229
  }
1230
1230
  const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
@@ -1315,7 +1315,7 @@ var init_AxiosHeaders = __esm({
1315
1315
  utils_default.forEach(this, (value, header) => {
1316
1316
  const key = utils_default.findKey(headers, header);
1317
1317
  if (key) {
1318
- self2[key] = normalizeValue(value);
1318
+ self2[key] = normalizeValue2(value);
1319
1319
  delete self2[header];
1320
1320
  return;
1321
1321
  }
@@ -1323,7 +1323,7 @@ var init_AxiosHeaders = __esm({
1323
1323
  if (normalized !== header) {
1324
1324
  delete self2[header];
1325
1325
  }
1326
- self2[normalized] = normalizeValue(value);
1326
+ self2[normalized] = normalizeValue2(value);
1327
1327
  headers[normalized] = true;
1328
1328
  });
1329
1329
  return this;
@@ -14068,516 +14068,6 @@ function CoreRoot(props) {
14068
14068
  children
14069
14069
  ] });
14070
14070
  }
14071
- function CoreShell(props) {
14072
- if (props.wrapped) {
14073
- const {
14074
- formProps: formProps2,
14075
- children: children2,
14076
- wrapped,
14077
- // eslint-disable-line @typescript-eslint/no-unused-vars
14078
- gap,
14079
- contentClassName,
14080
- ...coreProps2
14081
- } = props;
14082
- const content = /* @__PURE__ */ jsx(
14083
- "div",
14084
- {
14085
- className: contentClassName,
14086
- style: gap !== void 0 ? { gap } : void 0,
14087
- children: children2
14088
- }
14089
- );
14090
- return /* @__PURE__ */ jsx(CoreProvider, { ...coreProps2, children: /* @__PURE__ */ jsx(CoreRoot, { ...formProps2 != null ? formProps2 : {}, children: content }) });
14091
- }
14092
- const { formProps, children, ...coreProps } = props;
14093
- return /* @__PURE__ */ jsx(CoreProvider, { ...coreProps, children: /* @__PURE__ */ jsx(CoreRoot, { ...formProps != null ? formProps : {}, children }) });
14094
- }
14095
- function useButton(options) {
14096
- const form = useCoreContext();
14097
- const { name, submit, disabled: disabledProp = false, onClick } = options;
14098
- const [loading, setLoadingState] = React54.useState(false);
14099
- const [disabled, setDisabledState] = React54.useState(
14100
- Boolean(disabledProp)
14101
- );
14102
- const ref = React54.useRef(null);
14103
- const optsRef = React54.useRef(options);
14104
- React54.useEffect(() => {
14105
- optsRef.current = options;
14106
- }, [options]);
14107
- const buttonRef = React54.useRef(null);
14108
- if (!buttonRef.current) {
14109
- const btn = {
14110
- name,
14111
- // Accessor for "loading" as required by ButtonRef
14112
- set loading(v) {
14113
- setLoadingState(v);
14114
- },
14115
- // Accessor for "disable" (note: interface uses `disable`, not `disabled`)
14116
- //@ts-ignore
14117
- set disable(v) {
14118
- setDisabledState(v);
14119
- },
14120
- // Extra properties used by CoreProvider via any-casts
14121
- get loading() {
14122
- return loading;
14123
- },
14124
- setDisabled(v) {
14125
- setDisabledState(v);
14126
- },
14127
- get disabled() {
14128
- return disabled;
14129
- },
14130
- ref
14131
- };
14132
- btn.setLoading = (v) => {
14133
- setLoadingState(v);
14134
- };
14135
- buttonRef.current = btn;
14136
- }
14137
- React54.useEffect(() => {
14138
- if (!buttonRef.current) return;
14139
- buttonRef.current.name = name;
14140
- }, [name]);
14141
- React54.useEffect(() => {
14142
- if (!buttonRef.current) return;
14143
- form.button = buttonRef.current;
14144
- return () => {
14145
- const anyForm = form;
14146
- if (anyForm.button === buttonRef.current) {
14147
- anyForm.button = null;
14148
- }
14149
- };
14150
- }, [form]);
14151
- const handleClick = (event) => {
14152
- const currentOpts = optsRef.current;
14153
- const shouldSubmit = !!currentOpts.submit;
14154
- if (currentOpts.onClick) {
14155
- currentOpts.onClick(event, form);
14156
- }
14157
- if (event.defaultPrevented) {
14158
- return;
14159
- }
14160
- if (shouldSubmit) {
14161
- form.setActiveButton(currentOpts.name);
14162
- form.go();
14163
- }
14164
- };
14165
- const setLoading = (v) => {
14166
- setLoadingState(v);
14167
- };
14168
- const setDisabled = (v) => {
14169
- setDisabledState(v);
14170
- };
14171
- return {
14172
- loading,
14173
- setLoading,
14174
- disabled,
14175
- setDisabled,
14176
- ref,
14177
- onClick: handleClick,
14178
- buttonProps: {
14179
- ref,
14180
- disabled: disabled || loading,
14181
- "data-loading": loading ? "true" : "false",
14182
- onClick: handleClick
14183
- }
14184
- };
14185
- }
14186
- function useField(options) {
14187
- var _a;
14188
- const form = useCoreContext();
14189
- const {
14190
- name: rawName,
14191
- bindId: rawBindId,
14192
- bind: bind2,
14193
- shared,
14194
- groupId,
14195
- alias,
14196
- main,
14197
- ignore,
14198
- required: requiredProp = false,
14199
- defaultValue,
14200
- disabled: disabledProp = false,
14201
- readOnly: readOnlyProp = false,
14202
- validate,
14203
- getOriginalValue,
14204
- onValueChange
14205
- } = options;
14206
- const ref = React54.useRef(null);
14207
- const stateRef = React54.useRef({
14208
- value: defaultValue,
14209
- error: "",
14210
- loading: false,
14211
- original: getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
14212
- });
14213
- const [value, setValueState] = React54.useState(
14214
- stateRef.current.value
14215
- );
14216
- const [error, setErrorState] = React54.useState(
14217
- stateRef.current.error
14218
- );
14219
- const [loading, setLoadingState] = React54.useState(
14220
- stateRef.current.loading
14221
- );
14222
- const [required, setRequired] = React54.useState(
14223
- Boolean(requiredProp)
14224
- );
14225
- const [disabled, setDisabled] = React54.useState(
14226
- Boolean(disabledProp)
14227
- );
14228
- const [readOnly, setReadOnly] = React54.useState(
14229
- Boolean(readOnlyProp)
14230
- );
14231
- const id = React54.useId();
14232
- const keyRef = React54.useRef((() => {
14233
- if (rawName && rawName.trim()) return `${rawName.trim()}-${id}`;
14234
- if (rawBindId && rawBindId.trim()) return `${rawBindId.trim()}-${id}`;
14235
- return `field-${Math.random().toString(36).slice(2)}-${id}`;
14236
- })());
14237
- const bindIdRef = React54.useRef(
14238
- rawBindId && rawBindId.trim() || keyRef.current
14239
- );
14240
- const fieldRef = React54.useRef(null);
14241
- if (!fieldRef.current) {
14242
- const key = keyRef.current;
14243
- const bindId = bindIdRef.current;
14244
- const trimmedName = (_a = rawName == null ? void 0 : rawName.trim()) != null ? _a : "";
14245
- const validateFn = (report) => {
14246
- const curDisabled = disabled || readOnly;
14247
- if (curDisabled && !report) {
14248
- return true;
14249
- }
14250
- const current = stateRef.current.value;
14251
- let ok = true;
14252
- let message2 = "";
14253
- if (required && (current === void 0 || current === null || typeof current === "string" && current.trim() === "" || Array.isArray(current) && current.length === 0)) {
14254
- ok = false;
14255
- message2 = "This field is required.";
14256
- } else if (validate) {
14257
- const result = validate(current, !!report);
14258
- if (typeof result === "string") {
14259
- ok = false;
14260
- message2 = result;
14261
- } else if (result === false) {
14262
- ok = false;
14263
- }
14264
- }
14265
- if (!report) {
14266
- return ok;
14267
- }
14268
- stateRef.current.error = ok ? "" : message2;
14269
- setErrorState(ok ? "" : message2);
14270
- return ok;
14271
- };
14272
- const f = {
14273
- key,
14274
- bindId,
14275
- bind: bind2,
14276
- name: trimmedName,
14277
- shared,
14278
- groupId,
14279
- alias,
14280
- main,
14281
- ignore,
14282
- required,
14283
- ref,
14284
- get defaultValue() {
14285
- return stateRef.current.original;
14286
- },
14287
- get value() {
14288
- return stateRef.current.value;
14289
- },
14290
- set value(v) {
14291
- stateRef.current.value = v;
14292
- setValueState(v);
14293
- },
14294
- get originalValue() {
14295
- return stateRef.current.original;
14296
- },
14297
- get error() {
14298
- return stateRef.current.error;
14299
- },
14300
- set error(msg) {
14301
- stateRef.current.error = msg;
14302
- setErrorState(msg);
14303
- },
14304
- get loading() {
14305
- return stateRef.current.loading;
14306
- },
14307
- set loading(v) {
14308
- stateRef.current.loading = v;
14309
- setLoadingState(v);
14310
- },
14311
- validate: validateFn,
14312
- onChange(value2, old, variant) {
14313
- if (onValueChange) {
14314
- onValueChange(value2, old, variant);
14315
- }
14316
- }
14317
- // Flags not directly on the Field interface but used via `as any`
14318
- // in core-provider (getValue/setValue/reset).
14319
- };
14320
- f.getValue = () => stateRef.current.value;
14321
- f.setValue = (next) => {
14322
- stateRef.current.value = next;
14323
- setValueState(next);
14324
- };
14325
- f.reset = () => {
14326
- stateRef.current.value = defaultValue;
14327
- stateRef.current.error = "";
14328
- stateRef.current.loading = false;
14329
- setValueState(defaultValue);
14330
- setErrorState("");
14331
- setLoadingState(false);
14332
- };
14333
- fieldRef.current = f;
14334
- }
14335
- const field = fieldRef.current;
14336
- React54.useEffect(() => {
14337
- setRequired(!!requiredProp);
14338
- if (field) {
14339
- field.required = !!requiredProp;
14340
- }
14341
- }, [requiredProp, field]);
14342
- React54.useEffect(() => {
14343
- setDisabled(!!disabledProp);
14344
- }, [disabledProp]);
14345
- React54.useEffect(() => {
14346
- setReadOnly(!!readOnlyProp);
14347
- }, [readOnlyProp]);
14348
- React54.useEffect(() => {
14349
- if (!field) return;
14350
- form.addField(field);
14351
- return () => {
14352
- const registry3 = form.inputs;
14353
- if (registry3 && typeof registry3.remove === "function") {
14354
- registry3.remove(field.key);
14355
- }
14356
- };
14357
- }, [form, field]);
14358
- function setValue(next, variant = "direct") {
14359
- var _a2;
14360
- const prev = stateRef.current.value;
14361
- if (Object.is(prev, next)) return;
14362
- const runFormOnChange = () => {
14363
- var _a3;
14364
- const props2 = (_a3 = form.props) != null ? _a3 : {};
14365
- const fn = props2.onChange;
14366
- if (!fn) return;
14367
- fn(form, field, {
14368
- variant,
14369
- value: next,
14370
- previous: prev
14371
- });
14372
- };
14373
- const props = (_a2 = form.props) != null ? _a2 : {};
14374
- const changeBefore = !!props.changeBefore;
14375
- if (changeBefore) {
14376
- runFormOnChange();
14377
- }
14378
- stateRef.current.value = next;
14379
- setValueState(next);
14380
- if (field.onChange) {
14381
- field.onChange(next, prev, variant);
14382
- }
14383
- if (!changeBefore) {
14384
- runFormOnChange();
14385
- }
14386
- form.controlButton();
14387
- }
14388
- function setError(message2) {
14389
- stateRef.current.error = message2;
14390
- setErrorState(message2);
14391
- }
14392
- function setLoading(loading2) {
14393
- stateRef.current.loading = loading2;
14394
- setLoadingState(loading2);
14395
- }
14396
- return {
14397
- ref,
14398
- get key() {
14399
- return keyRef.current;
14400
- },
14401
- value,
14402
- setValue,
14403
- error,
14404
- setError,
14405
- loading,
14406
- setLoading,
14407
- required,
14408
- setRequired,
14409
- disabled,
14410
- setDisabled,
14411
- readOnly,
14412
- setReadOnly,
14413
- name: field.name,
14414
- bindId: field.bindId,
14415
- bind: field.bind,
14416
- shared: field.shared,
14417
- groupId: field.groupId,
14418
- alias: field.alias,
14419
- main: field.main,
14420
- ignore: field.ignore,
14421
- get defaultValue() {
14422
- return stateRef.current.original;
14423
- },
14424
- get originalValue() {
14425
- return stateRef.current.original;
14426
- },
14427
- form,
14428
- validate(report) {
14429
- var _a2;
14430
- return (_a2 = field.validate) == null ? void 0 : _a2.call(field, report);
14431
- }
14432
- };
14433
- }
14434
- function useOptionalField(options) {
14435
- var _a;
14436
- try {
14437
- return useField(options);
14438
- } catch {
14439
- }
14440
- {
14441
- console.warn(
14442
- "[FormPalette] useOptionalField: No CoreProvider found. Running in self-managed mode."
14443
- );
14444
- }
14445
- const {
14446
- name: rawName,
14447
- bindId: rawBindId,
14448
- bind: bind2,
14449
- shared,
14450
- groupId,
14451
- alias,
14452
- main,
14453
- ignore,
14454
- required: requiredProp = false,
14455
- defaultValue,
14456
- disabled: disabledProp = false,
14457
- readOnly: readOnlyProp = false,
14458
- validate,
14459
- getOriginalValue,
14460
- onValueChange
14461
- } = options;
14462
- const ref = React54.useRef(null);
14463
- const [value, setValueState] = React54.useState(defaultValue);
14464
- const [error, setErrorState] = React54.useState("");
14465
- const [loading, setLoadingState] = React54.useState(false);
14466
- const [required, setRequired] = React54.useState(!!requiredProp);
14467
- const [disabled, setDisabled] = React54.useState(!!disabledProp);
14468
- const [readOnly, setReadOnly] = React54.useState(!!readOnlyProp);
14469
- const originalRef = React54.useRef(
14470
- getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
14471
- );
14472
- const id = React54.useId();
14473
- const keyRef = React54.useRef("");
14474
- if (!keyRef.current) {
14475
- if (rawName && rawName.trim()) {
14476
- keyRef.current = `${rawName.trim()}-${id}`;
14477
- } else if (rawBindId && rawBindId.trim()) {
14478
- keyRef.current = `${rawBindId.trim()}-${id}`;
14479
- } else {
14480
- keyRef.current = `field-${Math.random().toString(36).slice(2)}-${id}`;
14481
- }
14482
- }
14483
- const bindIdRef = React54.useRef("");
14484
- if (!bindIdRef.current) {
14485
- bindIdRef.current = rawBindId && rawBindId.trim() || keyRef.current;
14486
- }
14487
- React54.useEffect(() => {
14488
- setRequired(!!requiredProp);
14489
- }, [requiredProp]);
14490
- React54.useEffect(() => {
14491
- setDisabled(!!disabledProp);
14492
- }, [disabledProp]);
14493
- React54.useEffect(() => {
14494
- setReadOnly(!!readOnlyProp);
14495
- }, [readOnlyProp]);
14496
- function setValue(next, variant = "direct") {
14497
- const prev = value;
14498
- if (Object.is(prev, next)) return;
14499
- setValueState(next);
14500
- if (onValueChange) {
14501
- onValueChange(next, prev, variant);
14502
- }
14503
- }
14504
- function setError(message2) {
14505
- setErrorState(message2);
14506
- }
14507
- function setLoading(next) {
14508
- setLoadingState(next);
14509
- }
14510
- function runValidate(report) {
14511
- const current = value;
14512
- let ok = true;
14513
- let message2 = "";
14514
- if (required && (current === void 0 || current === null || typeof current === "string" && current.trim() === "" || Array.isArray(current) && current.length === 0)) {
14515
- ok = false;
14516
- message2 = "This field is required.";
14517
- } else if (validate) {
14518
- const result = validate(current, !!report);
14519
- if (typeof result === "string") {
14520
- ok = false;
14521
- message2 = result;
14522
- } else if (result === false) {
14523
- ok = false;
14524
- }
14525
- }
14526
- if (report) {
14527
- setErrorState(ok ? "" : message2);
14528
- }
14529
- return ok;
14530
- }
14531
- const dummyForm = {};
14532
- return {
14533
- ref,
14534
- get key() {
14535
- return keyRef.current;
14536
- },
14537
- value,
14538
- setValue,
14539
- error,
14540
- setError,
14541
- loading,
14542
- setLoading,
14543
- required,
14544
- setRequired,
14545
- disabled,
14546
- setDisabled,
14547
- readOnly,
14548
- setReadOnly,
14549
- name: (_a = rawName == null ? void 0 : rawName.trim()) != null ? _a : "",
14550
- bindId: bindIdRef.current,
14551
- bind: bind2,
14552
- shared,
14553
- groupId,
14554
- alias,
14555
- main,
14556
- ignore,
14557
- get defaultValue() {
14558
- return originalRef.current;
14559
- },
14560
- get originalValue() {
14561
- return originalRef.current;
14562
- },
14563
- form: dummyForm,
14564
- validate(report) {
14565
- return runValidate(report);
14566
- }
14567
- };
14568
- }
14569
-
14570
- // src/variants/registry.ts
14571
- var registry2 = /* @__PURE__ */ new Map();
14572
- function registerVariant(module2) {
14573
- registry2.set(module2.variant, module2);
14574
- }
14575
- function getVariant(key) {
14576
- return registry2.get(key);
14577
- }
14578
- function listVariants() {
14579
- return Array.from(registry2.values());
14580
- }
14581
14071
 
14582
14072
  // ../../node_modules/clsx/dist/clsx.mjs
14583
14073
  function r(e) {
@@ -17607,6 +17097,516 @@ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
17607
17097
  function cn(...inputs) {
17608
17098
  return twMerge(clsx(inputs));
17609
17099
  }
17100
+ function CoreShell(props) {
17101
+ if (props.wrapped) {
17102
+ const {
17103
+ formProps: formProps2,
17104
+ children: children2,
17105
+ wrapped,
17106
+ // eslint-disable-line @typescript-eslint/no-unused-vars
17107
+ gap,
17108
+ contentClassName,
17109
+ ...coreProps2
17110
+ } = props;
17111
+ const content = /* @__PURE__ */ jsx(
17112
+ "div",
17113
+ {
17114
+ className: cn("flex flex-col", contentClassName),
17115
+ style: gap !== void 0 ? { gap } : void 0,
17116
+ children: children2
17117
+ }
17118
+ );
17119
+ return /* @__PURE__ */ jsx(CoreProvider, { ...coreProps2, children: /* @__PURE__ */ jsx(CoreRoot, { ...formProps2 != null ? formProps2 : {}, children: content }) });
17120
+ }
17121
+ const { formProps, children, ...coreProps } = props;
17122
+ return /* @__PURE__ */ jsx(CoreProvider, { ...coreProps, children: /* @__PURE__ */ jsx(CoreRoot, { ...formProps != null ? formProps : {}, children }) });
17123
+ }
17124
+ function useButton(options) {
17125
+ const form = useCoreContext();
17126
+ const { name, submit, disabled: disabledProp = false, onClick } = options;
17127
+ const [loading, setLoadingState] = React54.useState(false);
17128
+ const [disabled, setDisabledState] = React54.useState(
17129
+ Boolean(disabledProp)
17130
+ );
17131
+ const ref = React54.useRef(null);
17132
+ const optsRef = React54.useRef(options);
17133
+ React54.useEffect(() => {
17134
+ optsRef.current = options;
17135
+ }, [options]);
17136
+ const buttonRef = React54.useRef(null);
17137
+ if (!buttonRef.current) {
17138
+ const btn = {
17139
+ name,
17140
+ // Accessor for "loading" as required by ButtonRef
17141
+ set loading(v) {
17142
+ setLoadingState(v);
17143
+ },
17144
+ // Accessor for "disable" (note: interface uses `disable`, not `disabled`)
17145
+ //@ts-ignore
17146
+ set disable(v) {
17147
+ setDisabledState(v);
17148
+ },
17149
+ // Extra properties used by CoreProvider via any-casts
17150
+ get loading() {
17151
+ return loading;
17152
+ },
17153
+ setDisabled(v) {
17154
+ setDisabledState(v);
17155
+ },
17156
+ get disabled() {
17157
+ return disabled;
17158
+ },
17159
+ ref
17160
+ };
17161
+ btn.setLoading = (v) => {
17162
+ setLoadingState(v);
17163
+ };
17164
+ buttonRef.current = btn;
17165
+ }
17166
+ React54.useEffect(() => {
17167
+ if (!buttonRef.current) return;
17168
+ buttonRef.current.name = name;
17169
+ }, [name]);
17170
+ React54.useEffect(() => {
17171
+ if (!buttonRef.current) return;
17172
+ form.button = buttonRef.current;
17173
+ return () => {
17174
+ const anyForm = form;
17175
+ if (anyForm.button === buttonRef.current) {
17176
+ anyForm.button = null;
17177
+ }
17178
+ };
17179
+ }, [form]);
17180
+ const handleClick = (event) => {
17181
+ const currentOpts = optsRef.current;
17182
+ const shouldSubmit = !!currentOpts.submit;
17183
+ if (currentOpts.onClick) {
17184
+ currentOpts.onClick(event, form);
17185
+ }
17186
+ if (event.defaultPrevented) {
17187
+ return;
17188
+ }
17189
+ if (shouldSubmit) {
17190
+ form.setActiveButton(currentOpts.name);
17191
+ form.go();
17192
+ }
17193
+ };
17194
+ const setLoading = (v) => {
17195
+ setLoadingState(v);
17196
+ };
17197
+ const setDisabled = (v) => {
17198
+ setDisabledState(v);
17199
+ };
17200
+ return {
17201
+ loading,
17202
+ setLoading,
17203
+ disabled,
17204
+ setDisabled,
17205
+ ref,
17206
+ onClick: handleClick,
17207
+ buttonProps: {
17208
+ ref,
17209
+ disabled: disabled || loading,
17210
+ "data-loading": loading ? "true" : "false",
17211
+ onClick: handleClick
17212
+ }
17213
+ };
17214
+ }
17215
+ function useField(options) {
17216
+ var _a;
17217
+ const form = useCoreContext();
17218
+ const {
17219
+ name: rawName,
17220
+ bindId: rawBindId,
17221
+ bind: bind2,
17222
+ shared,
17223
+ groupId,
17224
+ alias,
17225
+ main,
17226
+ ignore,
17227
+ required: requiredProp = false,
17228
+ defaultValue,
17229
+ disabled: disabledProp = false,
17230
+ readOnly: readOnlyProp = false,
17231
+ validate,
17232
+ getOriginalValue,
17233
+ onValueChange
17234
+ } = options;
17235
+ const ref = React54.useRef(null);
17236
+ const stateRef = React54.useRef({
17237
+ value: defaultValue,
17238
+ error: "",
17239
+ loading: false,
17240
+ original: getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
17241
+ });
17242
+ const [value, setValueState] = React54.useState(
17243
+ stateRef.current.value
17244
+ );
17245
+ const [error, setErrorState] = React54.useState(
17246
+ stateRef.current.error
17247
+ );
17248
+ const [loading, setLoadingState] = React54.useState(
17249
+ stateRef.current.loading
17250
+ );
17251
+ const [required, setRequired] = React54.useState(
17252
+ Boolean(requiredProp)
17253
+ );
17254
+ const [disabled, setDisabled] = React54.useState(
17255
+ Boolean(disabledProp)
17256
+ );
17257
+ const [readOnly, setReadOnly] = React54.useState(
17258
+ Boolean(readOnlyProp)
17259
+ );
17260
+ const id = React54.useId();
17261
+ const keyRef = React54.useRef((() => {
17262
+ if (rawName && rawName.trim()) return `${rawName.trim()}-${id}`;
17263
+ if (rawBindId && rawBindId.trim()) return `${rawBindId.trim()}-${id}`;
17264
+ return `field-${Math.random().toString(36).slice(2)}-${id}`;
17265
+ })());
17266
+ const bindIdRef = React54.useRef(
17267
+ rawBindId && rawBindId.trim() || keyRef.current
17268
+ );
17269
+ const fieldRef = React54.useRef(null);
17270
+ if (!fieldRef.current) {
17271
+ const key = keyRef.current;
17272
+ const bindId = bindIdRef.current;
17273
+ const trimmedName = (_a = rawName == null ? void 0 : rawName.trim()) != null ? _a : "";
17274
+ const validateFn = (report) => {
17275
+ const curDisabled = disabled || readOnly;
17276
+ if (curDisabled && !report) {
17277
+ return true;
17278
+ }
17279
+ const current = stateRef.current.value;
17280
+ let ok = true;
17281
+ let message2 = "";
17282
+ if (required && (current === void 0 || current === null || typeof current === "string" && current.trim() === "" || Array.isArray(current) && current.length === 0)) {
17283
+ ok = false;
17284
+ message2 = "This field is required.";
17285
+ } else if (validate) {
17286
+ const result = validate(current, !!report);
17287
+ if (typeof result === "string") {
17288
+ ok = false;
17289
+ message2 = result;
17290
+ } else if (result === false) {
17291
+ ok = false;
17292
+ }
17293
+ }
17294
+ if (!report) {
17295
+ return ok;
17296
+ }
17297
+ stateRef.current.error = ok ? "" : message2;
17298
+ setErrorState(ok ? "" : message2);
17299
+ return ok;
17300
+ };
17301
+ const f = {
17302
+ key,
17303
+ bindId,
17304
+ bind: bind2,
17305
+ name: trimmedName,
17306
+ shared,
17307
+ groupId,
17308
+ alias,
17309
+ main,
17310
+ ignore,
17311
+ required,
17312
+ ref,
17313
+ get defaultValue() {
17314
+ return stateRef.current.original;
17315
+ },
17316
+ get value() {
17317
+ return stateRef.current.value;
17318
+ },
17319
+ set value(v) {
17320
+ stateRef.current.value = v;
17321
+ setValueState(v);
17322
+ },
17323
+ get originalValue() {
17324
+ return stateRef.current.original;
17325
+ },
17326
+ get error() {
17327
+ return stateRef.current.error;
17328
+ },
17329
+ set error(msg) {
17330
+ stateRef.current.error = msg;
17331
+ setErrorState(msg);
17332
+ },
17333
+ get loading() {
17334
+ return stateRef.current.loading;
17335
+ },
17336
+ set loading(v) {
17337
+ stateRef.current.loading = v;
17338
+ setLoadingState(v);
17339
+ },
17340
+ validate: validateFn,
17341
+ onChange(value2, old, variant) {
17342
+ if (onValueChange) {
17343
+ onValueChange(value2, old, variant);
17344
+ }
17345
+ }
17346
+ // Flags not directly on the Field interface but used via `as any`
17347
+ // in core-provider (getValue/setValue/reset).
17348
+ };
17349
+ f.getValue = () => stateRef.current.value;
17350
+ f.setValue = (next) => {
17351
+ stateRef.current.value = next;
17352
+ setValueState(next);
17353
+ };
17354
+ f.reset = () => {
17355
+ stateRef.current.value = defaultValue;
17356
+ stateRef.current.error = "";
17357
+ stateRef.current.loading = false;
17358
+ setValueState(defaultValue);
17359
+ setErrorState("");
17360
+ setLoadingState(false);
17361
+ };
17362
+ fieldRef.current = f;
17363
+ }
17364
+ const field = fieldRef.current;
17365
+ React54.useEffect(() => {
17366
+ setRequired(!!requiredProp);
17367
+ if (field) {
17368
+ field.required = !!requiredProp;
17369
+ }
17370
+ }, [requiredProp, field]);
17371
+ React54.useEffect(() => {
17372
+ setDisabled(!!disabledProp);
17373
+ }, [disabledProp]);
17374
+ React54.useEffect(() => {
17375
+ setReadOnly(!!readOnlyProp);
17376
+ }, [readOnlyProp]);
17377
+ React54.useEffect(() => {
17378
+ if (!field) return;
17379
+ form.addField(field);
17380
+ return () => {
17381
+ const registry3 = form.inputs;
17382
+ if (registry3 && typeof registry3.remove === "function") {
17383
+ registry3.remove(field.key);
17384
+ }
17385
+ };
17386
+ }, [form, field]);
17387
+ function setValue(next, variant = "direct") {
17388
+ var _a2;
17389
+ const prev = stateRef.current.value;
17390
+ if (Object.is(prev, next)) return;
17391
+ const runFormOnChange = () => {
17392
+ var _a3;
17393
+ const props2 = (_a3 = form.props) != null ? _a3 : {};
17394
+ const fn = props2.onChange;
17395
+ if (!fn) return;
17396
+ fn(form, field, {
17397
+ variant,
17398
+ value: next,
17399
+ previous: prev
17400
+ });
17401
+ };
17402
+ const props = (_a2 = form.props) != null ? _a2 : {};
17403
+ const changeBefore = !!props.changeBefore;
17404
+ if (changeBefore) {
17405
+ runFormOnChange();
17406
+ }
17407
+ stateRef.current.value = next;
17408
+ setValueState(next);
17409
+ if (field.onChange) {
17410
+ field.onChange(next, prev, variant);
17411
+ }
17412
+ if (!changeBefore) {
17413
+ runFormOnChange();
17414
+ }
17415
+ form.controlButton();
17416
+ }
17417
+ function setError(message2) {
17418
+ stateRef.current.error = message2;
17419
+ setErrorState(message2);
17420
+ }
17421
+ function setLoading(loading2) {
17422
+ stateRef.current.loading = loading2;
17423
+ setLoadingState(loading2);
17424
+ }
17425
+ return {
17426
+ ref,
17427
+ get key() {
17428
+ return keyRef.current;
17429
+ },
17430
+ value,
17431
+ setValue,
17432
+ error,
17433
+ setError,
17434
+ loading,
17435
+ setLoading,
17436
+ required,
17437
+ setRequired,
17438
+ disabled,
17439
+ setDisabled,
17440
+ readOnly,
17441
+ setReadOnly,
17442
+ name: field.name,
17443
+ bindId: field.bindId,
17444
+ bind: field.bind,
17445
+ shared: field.shared,
17446
+ groupId: field.groupId,
17447
+ alias: field.alias,
17448
+ main: field.main,
17449
+ ignore: field.ignore,
17450
+ get defaultValue() {
17451
+ return stateRef.current.original;
17452
+ },
17453
+ get originalValue() {
17454
+ return stateRef.current.original;
17455
+ },
17456
+ form,
17457
+ validate(report) {
17458
+ var _a2;
17459
+ return (_a2 = field.validate) == null ? void 0 : _a2.call(field, report);
17460
+ }
17461
+ };
17462
+ }
17463
+ function useOptionalField(options) {
17464
+ var _a;
17465
+ try {
17466
+ return useField(options);
17467
+ } catch {
17468
+ }
17469
+ {
17470
+ console.warn(
17471
+ "[FormPalette] useOptionalField: No CoreProvider found. Running in self-managed mode."
17472
+ );
17473
+ }
17474
+ const {
17475
+ name: rawName,
17476
+ bindId: rawBindId,
17477
+ bind: bind2,
17478
+ shared,
17479
+ groupId,
17480
+ alias,
17481
+ main,
17482
+ ignore,
17483
+ required: requiredProp = false,
17484
+ defaultValue,
17485
+ disabled: disabledProp = false,
17486
+ readOnly: readOnlyProp = false,
17487
+ validate,
17488
+ getOriginalValue,
17489
+ onValueChange
17490
+ } = options;
17491
+ const ref = React54.useRef(null);
17492
+ const [value, setValueState] = React54.useState(defaultValue);
17493
+ const [error, setErrorState] = React54.useState("");
17494
+ const [loading, setLoadingState] = React54.useState(false);
17495
+ const [required, setRequired] = React54.useState(!!requiredProp);
17496
+ const [disabled, setDisabled] = React54.useState(!!disabledProp);
17497
+ const [readOnly, setReadOnly] = React54.useState(!!readOnlyProp);
17498
+ const originalRef = React54.useRef(
17499
+ getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
17500
+ );
17501
+ const id = React54.useId();
17502
+ const keyRef = React54.useRef("");
17503
+ if (!keyRef.current) {
17504
+ if (rawName && rawName.trim()) {
17505
+ keyRef.current = `${rawName.trim()}-${id}`;
17506
+ } else if (rawBindId && rawBindId.trim()) {
17507
+ keyRef.current = `${rawBindId.trim()}-${id}`;
17508
+ } else {
17509
+ keyRef.current = `field-${Math.random().toString(36).slice(2)}-${id}`;
17510
+ }
17511
+ }
17512
+ const bindIdRef = React54.useRef("");
17513
+ if (!bindIdRef.current) {
17514
+ bindIdRef.current = rawBindId && rawBindId.trim() || keyRef.current;
17515
+ }
17516
+ React54.useEffect(() => {
17517
+ setRequired(!!requiredProp);
17518
+ }, [requiredProp]);
17519
+ React54.useEffect(() => {
17520
+ setDisabled(!!disabledProp);
17521
+ }, [disabledProp]);
17522
+ React54.useEffect(() => {
17523
+ setReadOnly(!!readOnlyProp);
17524
+ }, [readOnlyProp]);
17525
+ function setValue(next, variant = "direct") {
17526
+ const prev = value;
17527
+ if (Object.is(prev, next)) return;
17528
+ setValueState(next);
17529
+ if (onValueChange) {
17530
+ onValueChange(next, prev, variant);
17531
+ }
17532
+ }
17533
+ function setError(message2) {
17534
+ setErrorState(message2);
17535
+ }
17536
+ function setLoading(next) {
17537
+ setLoadingState(next);
17538
+ }
17539
+ function runValidate(report) {
17540
+ const current = value;
17541
+ let ok = true;
17542
+ let message2 = "";
17543
+ if (required && (current === void 0 || current === null || typeof current === "string" && current.trim() === "" || Array.isArray(current) && current.length === 0)) {
17544
+ ok = false;
17545
+ message2 = "This field is required.";
17546
+ } else if (validate) {
17547
+ const result = validate(current, !!report);
17548
+ if (typeof result === "string") {
17549
+ ok = false;
17550
+ message2 = result;
17551
+ } else if (result === false) {
17552
+ ok = false;
17553
+ }
17554
+ }
17555
+ if (report) {
17556
+ setErrorState(ok ? "" : message2);
17557
+ }
17558
+ return ok;
17559
+ }
17560
+ const dummyForm = {};
17561
+ return {
17562
+ ref,
17563
+ get key() {
17564
+ return keyRef.current;
17565
+ },
17566
+ value,
17567
+ setValue,
17568
+ error,
17569
+ setError,
17570
+ loading,
17571
+ setLoading,
17572
+ required,
17573
+ setRequired,
17574
+ disabled,
17575
+ setDisabled,
17576
+ readOnly,
17577
+ setReadOnly,
17578
+ name: (_a = rawName == null ? void 0 : rawName.trim()) != null ? _a : "",
17579
+ bindId: bindIdRef.current,
17580
+ bind: bind2,
17581
+ shared,
17582
+ groupId,
17583
+ alias,
17584
+ main,
17585
+ ignore,
17586
+ get defaultValue() {
17587
+ return originalRef.current;
17588
+ },
17589
+ get originalValue() {
17590
+ return originalRef.current;
17591
+ },
17592
+ form: dummyForm,
17593
+ validate(report) {
17594
+ return runValidate(report);
17595
+ }
17596
+ };
17597
+ }
17598
+
17599
+ // src/variants/registry.ts
17600
+ var registry2 = /* @__PURE__ */ new Map();
17601
+ function registerVariant(module2) {
17602
+ registry2.set(module2.variant, module2);
17603
+ }
17604
+ function getVariant(key) {
17605
+ return registry2.get(key);
17606
+ }
17607
+ function listVariants() {
17608
+ return Array.from(registry2.values());
17609
+ }
17610
17610
  var isEmpty = (val) => val === null || val === void 0 || val === "";
17611
17611
  var isAndroid = () => typeof navigator !== "undefined" && /android/i.test(navigator.userAgent || "");
17612
17612
  var isIOS = () => typeof navigator !== "undefined" && /(iphone|ipad|ipod)/i.test(navigator.userAgent || "");
@@ -20582,19 +20582,19 @@ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForD
20582
20582
  }
20583
20583
  function createContext2(rootComponentName, defaultContext) {
20584
20584
  const Context = React54.createContext(defaultContext);
20585
- const Provider = (props) => {
20585
+ const Provider2 = (props) => {
20586
20586
  const { children, ...context } = props;
20587
20587
  const value = React54.useMemo(() => context, Object.values(context));
20588
20588
  return /* @__PURE__ */ jsx(Context.Provider, { value, children });
20589
20589
  };
20590
- Provider.displayName = rootComponentName + "Provider";
20590
+ Provider2.displayName = rootComponentName + "Provider";
20591
20591
  function useContext22(consumerName) {
20592
20592
  const context = React54.useContext(Context);
20593
20593
  if (context) return context;
20594
20594
  if (defaultContext !== void 0) return defaultContext;
20595
20595
  throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
20596
20596
  }
20597
- return [Provider, useContext22];
20597
+ return [Provider2, useContext22];
20598
20598
  }
20599
20599
  function createContextScope(scopeName, createContextScopeDeps = []) {
20600
20600
  let defaultContexts = [];
@@ -20602,14 +20602,14 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
20602
20602
  const BaseContext = React54.createContext(defaultContext);
20603
20603
  const index2 = defaultContexts.length;
20604
20604
  defaultContexts = [...defaultContexts, defaultContext];
20605
- const Provider = (props) => {
20605
+ const Provider2 = (props) => {
20606
20606
  var _a;
20607
20607
  const { scope, children, ...context } = props;
20608
20608
  const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
20609
20609
  const value = React54.useMemo(() => context, Object.values(context));
20610
20610
  return /* @__PURE__ */ jsx(Context.Provider, { value, children });
20611
20611
  };
20612
- Provider.displayName = rootComponentName + "Provider";
20612
+ Provider2.displayName = rootComponentName + "Provider";
20613
20613
  function useContext22(consumerName, scope) {
20614
20614
  var _a;
20615
20615
  const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
@@ -20618,7 +20618,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
20618
20618
  if (defaultContext !== void 0) return defaultContext;
20619
20619
  throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
20620
20620
  }
20621
- return [Provider, useContext22];
20621
+ return [Provider2, useContext22];
20622
20622
  }
20623
20623
  const createScope = () => {
20624
20624
  const scopeContexts = defaultContexts.map((defaultContext) => {
@@ -20773,10 +20773,10 @@ function getElementRef(element) {
20773
20773
  return element.props.ref || element.ref;
20774
20774
  }
20775
20775
  function createCollection(name) {
20776
- const PROVIDER_NAME = name + "CollectionProvider";
20777
- const [createCollectionContext, createCollectionScope4] = createContextScope(PROVIDER_NAME);
20776
+ const PROVIDER_NAME2 = name + "CollectionProvider";
20777
+ const [createCollectionContext, createCollectionScope4] = createContextScope(PROVIDER_NAME2);
20778
20778
  const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
20779
- PROVIDER_NAME,
20779
+ PROVIDER_NAME2,
20780
20780
  { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
20781
20781
  );
20782
20782
  const CollectionProvider = (props) => {
@@ -20785,7 +20785,7 @@ function createCollection(name) {
20785
20785
  const itemMap = React54__default.useRef(/* @__PURE__ */ new Map()).current;
20786
20786
  return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
20787
20787
  };
20788
- CollectionProvider.displayName = PROVIDER_NAME;
20788
+ CollectionProvider.displayName = PROVIDER_NAME2;
20789
20789
  const COLLECTION_SLOT_NAME = name + "CollectionSlot";
20790
20790
  const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
20791
20791
  const CollectionSlot = React54__default.forwardRef(
@@ -24431,6 +24431,7 @@ var VisuallyHidden = React54.forwardRef(
24431
24431
  }
24432
24432
  );
24433
24433
  VisuallyHidden.displayName = NAME2;
24434
+ var Root3 = VisuallyHidden;
24434
24435
 
24435
24436
  // ../../node_modules/aria-hidden/dist/es2015/index.js
24436
24437
  var getDefaultParent = function(originalTarget) {
@@ -30465,7 +30466,7 @@ __export(custom_components_exports, {
30465
30466
  NextMonthButton: () => NextMonthButton,
30466
30467
  Option: () => Option,
30467
30468
  PreviousMonthButton: () => PreviousMonthButton,
30468
- Root: () => Root3,
30469
+ Root: () => Root4,
30469
30470
  Select: () => Select3,
30470
30471
  Week: () => Week,
30471
30472
  WeekNumber: () => WeekNumber,
@@ -30655,7 +30656,7 @@ function PreviousMonthButton(props) {
30655
30656
  const { components } = useDayPicker();
30656
30657
  return React54__default.createElement(components.Button, { ...props });
30657
30658
  }
30658
- function Root3(props) {
30659
+ function Root4(props) {
30659
30660
  const { rootRef, ...rest } = props;
30660
30661
  return React54__default.createElement("div", { ...rest, ref: rootRef });
30661
30662
  }
@@ -34508,7 +34509,7 @@ SwitchBubbleInput.displayName = BUBBLE_INPUT_NAME2;
34508
34509
  function getState2(checked) {
34509
34510
  return checked ? "checked" : "unchecked";
34510
34511
  }
34511
- var Root4 = Switch;
34512
+ var Root5 = Switch;
34512
34513
  var Thumb = SwitchThumb;
34513
34514
  function Switch2({
34514
34515
  className,
@@ -34516,7 +34517,7 @@ function Switch2({
34516
34517
  ...props
34517
34518
  }) {
34518
34519
  return /* @__PURE__ */ jsx(
34519
- Root4,
34520
+ Root5,
34520
34521
  {
34521
34522
  "data-slot": "switch",
34522
34523
  className: cn(
@@ -35119,7 +35120,7 @@ function focusFirst2(candidates, preventScroll = false) {
35119
35120
  function wrapArray2(array, startIndex) {
35120
35121
  return array.map((_, index2) => array[(startIndex + index2) % array.length]);
35121
35122
  }
35122
- var Root5 = RovingFocusGroup;
35123
+ var Root6 = RovingFocusGroup;
35123
35124
  var Item2 = RovingFocusGroupItem;
35124
35125
  var RADIO_NAME = "Radio";
35125
35126
  var [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);
@@ -35293,7 +35294,7 @@ var RadioGroup = React54.forwardRef(
35293
35294
  value,
35294
35295
  onValueChange: setValue,
35295
35296
  children: /* @__PURE__ */ jsx(
35296
- Root5,
35297
+ Root6,
35297
35298
  {
35298
35299
  asChild: true,
35299
35300
  ...rovingFocusGroupScope,
@@ -38548,7 +38549,7 @@ function roundValue(value, decimalCount) {
38548
38549
  const rounder = Math.pow(10, decimalCount);
38549
38550
  return Math.round(value * rounder) / rounder;
38550
38551
  }
38551
- var Root6 = Slider;
38552
+ var Root7 = Slider;
38552
38553
  var Track = SliderTrack;
38553
38554
  var Range = SliderRange;
38554
38555
  var Thumb2 = SliderThumb;
@@ -38565,7 +38566,7 @@ function Slider2({
38565
38566
  [value, defaultValue, min3, max3]
38566
38567
  );
38567
38568
  return /* @__PURE__ */ jsxs(
38568
- Root6,
38569
+ Root7,
38569
38570
  {
38570
38571
  "data-slot": "slider",
38571
38572
  defaultValue,
@@ -39405,7 +39406,7 @@ var DescriptionWarning = ({ contentRef, descriptionId }) => {
39405
39406
  }, [MESSAGE, contentRef, descriptionId]);
39406
39407
  return null;
39407
39408
  };
39408
- var Root7 = Dialog;
39409
+ var Root8 = Dialog;
39409
39410
  var Portal4 = DialogPortal;
39410
39411
  var Overlay = DialogOverlay;
39411
39412
  var Content3 = DialogContent;
@@ -39415,7 +39416,7 @@ var Close = DialogClose;
39415
39416
  function Dialog2({
39416
39417
  ...props
39417
39418
  }) {
39418
- return /* @__PURE__ */ jsx(Root7, { "data-slot": "dialog", ...props });
39419
+ return /* @__PURE__ */ jsx(Root8, { "data-slot": "dialog", ...props });
39419
39420
  }
39420
39421
  function DialogPortal2({
39421
39422
  ...props
@@ -41320,7 +41321,7 @@ function useResizeObserver(element, onResize) {
41320
41321
  }
41321
41322
  }, [element, handleResize]);
41322
41323
  }
41323
- var Root8 = ScrollArea;
41324
+ var Root9 = ScrollArea;
41324
41325
  var Viewport2 = ScrollAreaViewport;
41325
41326
  var Corner = ScrollAreaCorner;
41326
41327
  function ScrollArea2({
@@ -41329,7 +41330,7 @@ function ScrollArea2({
41329
41330
  ...props
41330
41331
  }) {
41331
41332
  return /* @__PURE__ */ jsxs(
41332
- Root8,
41333
+ Root9,
41333
41334
  {
41334
41335
  "data-slot": "scroll-area",
41335
41336
  className: cn("relative", className),
@@ -41601,32 +41602,77 @@ var ShadcnFileVariant = React54.forwardRef(
41601
41602
  };
41602
41603
  const FileChip = ({ item, condensed = false }) => {
41603
41604
  const name = formatFileName ? formatFileName(item) : item.name;
41604
- return /* @__PURE__ */ jsxs(
41605
- "div",
41606
- {
41607
- className: cn(
41608
- "flex items-center gap-1.5 overflow-hidden rounded-sm border bg-muted/60 px-1.5 py-0.5 text-xs transition-colors hover:bg-muted",
41609
- condensed ? "max-w-[120px]" : "max-w-[200px]"
41610
- ),
41611
- onClick: (e) => e.stopPropagation(),
41612
- children: [
41613
- /* @__PURE__ */ jsx(File2, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
41614
- /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: name }),
41615
- /* @__PURE__ */ jsx(
41616
- "button",
41617
- {
41618
- type: "button",
41619
- onClick: (e) => {
41620
- e.stopPropagation();
41621
- handleRemove(item.id);
41622
- },
41623
- className: "ml-auto rounded-full text-muted-foreground/70 hover:text-destructive",
41624
- children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
41625
- }
41626
- )
41627
- ]
41605
+ const [preview, setPreview] = React54.useState(null);
41606
+ const [isOpen, setIsOpen] = React54.useState(false);
41607
+ React54.useEffect(() => {
41608
+ var _a;
41609
+ const isImage2 = ((_a = item.type) == null ? void 0 : _a.startsWith("image/")) || item.name.match(/\.(jpg|jpeg|png|gif|webp)$/i);
41610
+ if (!isImage2) {
41611
+ setPreview(null);
41612
+ return;
41628
41613
  }
41629
- );
41614
+ if (item.file) {
41615
+ const url = URL.createObjectURL(item.file);
41616
+ setPreview(url);
41617
+ return () => URL.revokeObjectURL(url);
41618
+ }
41619
+ if (item.url || item.path) {
41620
+ setPreview(item.url || item.path || null);
41621
+ }
41622
+ }, [item]);
41623
+ return /* @__PURE__ */ jsxs(Popover2, { open: isOpen, onOpenChange: setIsOpen, children: [
41624
+ /* @__PURE__ */ jsx(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs(
41625
+ "div",
41626
+ {
41627
+ role: "button",
41628
+ tabIndex: 0,
41629
+ className: cn(
41630
+ "flex items-center gap-1.5 overflow-hidden rounded-sm border bg-muted/60 px-1.5 py-0.5 text-xs transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none cursor-pointer",
41631
+ condensed ? "max-w-[120px]" : "max-w-[200px]"
41632
+ ),
41633
+ onClick: (e) => {
41634
+ e.stopPropagation();
41635
+ setIsOpen(true);
41636
+ },
41637
+ onKeyDown: (e) => {
41638
+ if (e.key === "Enter" || e.key === " ") {
41639
+ e.stopPropagation();
41640
+ setIsOpen(true);
41641
+ }
41642
+ },
41643
+ children: [
41644
+ /* @__PURE__ */ jsx(File2, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
41645
+ /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: name }),
41646
+ /* @__PURE__ */ jsx(
41647
+ "button",
41648
+ {
41649
+ type: "button",
41650
+ onClick: (e) => {
41651
+ e.stopPropagation();
41652
+ handleRemove(item.id);
41653
+ },
41654
+ className: "ml-auto flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-muted-foreground/70 hover:bg-destructive/20 hover:text-destructive focus:outline-none",
41655
+ "aria-label": "Remove file",
41656
+ children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
41657
+ }
41658
+ )
41659
+ ]
41660
+ }
41661
+ ) }),
41662
+ /* @__PURE__ */ jsxs(PopoverContent2, { className: "w-64 p-0", align: "start", side: "bottom", children: [
41663
+ /* @__PURE__ */ jsx("div", { className: "relative aspect-video w-full flex items-center justify-center bg-muted/30 border-b", children: preview ? /* @__PURE__ */ jsx("img", { src: preview, alt: item.name, className: "h-full w-full object-contain" }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2 text-muted-foreground/50", children: [
41664
+ /* @__PURE__ */ jsx(File2, { className: "h-10 w-10" }),
41665
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] uppercase", children: "No Preview" })
41666
+ ] }) }),
41667
+ /* @__PURE__ */ jsxs("div", { className: "p-3", children: [
41668
+ /* @__PURE__ */ jsx("div", { className: "font-medium text-sm truncate", title: item.name, children: name }),
41669
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center justify-between text-xs text-muted-foreground", children: [
41670
+ /* @__PURE__ */ jsx("span", { children: formatFileSize(item.size) }),
41671
+ item.type && /* @__PURE__ */ jsx("span", { className: "uppercase opacity-70", children: item.type.split("/").pop() })
41672
+ ] })
41673
+ ] })
41674
+ ] })
41675
+ ] });
41630
41676
  };
41631
41677
  const TriggerRegion = React54.useMemo(() => {
41632
41678
  if (showDropArea) {
@@ -41646,7 +41692,7 @@ var ShadcnFileVariant = React54.forwardRef(
41646
41692
  dropAreaClassName
41647
41693
  ),
41648
41694
  children: [
41649
- /* @__PURE__ */ jsx("div", { className: "rounded-full bg-background p-3 shadow-sm", children: dropIcon != null ? dropIcon : /* @__PURE__ */ jsx(CloudUpload, { className: "h-5 w-5 text-muted-foreground" }) }),
41695
+ /* @__PURE__ */ jsx("div", { className: "rounded-full bg-surfaces-input p-3 shadow-sm", children: dropIcon != null ? dropIcon : /* @__PURE__ */ jsx(CloudUpload, { className: "h-5 w-5 text-muted-foreground" }) }),
41650
41696
  /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
41651
41697
  /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: dropTitle != null ? dropTitle : "Click or drag to select" }),
41652
41698
  /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: dropDescription != null ? dropDescription : multiple ? "Select files" : "Select a file" })
@@ -41667,7 +41713,7 @@ var ShadcnFileVariant = React54.forwardRef(
41667
41713
  className: cn(
41668
41714
  "relative flex w-full cursor-pointer items-center gap-2 px-3 transition-all",
41669
41715
  heightCls,
41670
- (!joinControls || !hasExternalControls) && "rounded-md border border-input bg-[var(--surfaces-input,_transparent)] shadow-xs ring-offset-background hover:bg-accent/5 focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
41716
+ (!joinControls || !hasExternalControls) && "rounded-md border border-input bg-surfaces-input ring-offset-background hover:bg-accent/5 focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
41671
41717
  dragOver && "border-primary ring-2 ring-primary/20",
41672
41718
  isDisabled && "cursor-not-allowed opacity-50",
41673
41719
  error && "border-destructive text-destructive",
@@ -41707,7 +41753,7 @@ var ShadcnFileVariant = React54.forwardRef(
41707
41753
  /* @__PURE__ */ jsx(
41708
41754
  PopoverContent2,
41709
41755
  {
41710
- className: "w-[--radix-popover-trigger-width] p-0",
41756
+ className: "w-(--radix-popover-trigger-width) p-0",
41711
41757
  align: "start",
41712
41758
  children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
41713
41759
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b px-3 py-2 text-xs font-medium text-muted-foreground", children: [
@@ -41779,7 +41825,7 @@ var ShadcnFileVariant = React54.forwardRef(
41779
41825
  },
41780
41826
  children: [
41781
41827
  /* @__PURE__ */ jsx(Plus, { className: "mr-2 h-3 w-3" }),
41782
- "Add files..."
41828
+ multiple ? "Add files..." : items.length ? "Replace file" : "Add file"
41783
41829
  ]
41784
41830
  }
41785
41831
  ) })
@@ -41870,7 +41916,7 @@ var ShadcnFileVariant = React54.forwardRef(
41870
41916
  children: [
41871
41917
  /* @__PURE__ */ jsxs("div", { className: cn(
41872
41918
  "flex w-full",
41873
- joinControls && extendBoxToControls && !showDropArea ? "items-stretch rounded-md border border-input bg-[var(--surfaces-input,_transparent)] shadow-xs ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2" : "items-start gap-2"
41919
+ joinControls && extendBoxToControls && !showDropArea ? "items-stretch rounded-md border border-input bg-surfaces-input shadow-xs ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2" : "items-start gap-2"
41874
41920
  ), children: [
41875
41921
  leadingControl && /* @__PURE__ */ jsx("div", { className: cn(
41876
41922
  "flex items-center",
@@ -41909,6 +41955,1410 @@ var fileManagerModule = {
41909
41955
  Variant: file_default,
41910
41956
  variant: "file"
41911
41957
  };
41958
+ // @__NO_SIDE_EFFECTS__
41959
+ function createSlot18(ownerName) {
41960
+ const SlotClone = /* @__PURE__ */ createSlotClone18(ownerName);
41961
+ const Slot22 = React54.forwardRef((props, forwardedRef) => {
41962
+ const { children, ...slotProps } = props;
41963
+ const childrenArray = React54.Children.toArray(children);
41964
+ const slottable = childrenArray.find(isSlottable18);
41965
+ if (slottable) {
41966
+ const newElement = slottable.props.children;
41967
+ const newChildren = childrenArray.map((child) => {
41968
+ if (child === slottable) {
41969
+ if (React54.Children.count(newElement) > 1) return React54.Children.only(null);
41970
+ return React54.isValidElement(newElement) ? newElement.props.children : null;
41971
+ } else {
41972
+ return child;
41973
+ }
41974
+ });
41975
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React54.isValidElement(newElement) ? React54.cloneElement(newElement, void 0, newChildren) : null });
41976
+ }
41977
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
41978
+ });
41979
+ Slot22.displayName = `${ownerName}.Slot`;
41980
+ return Slot22;
41981
+ }
41982
+ // @__NO_SIDE_EFFECTS__
41983
+ function createSlotClone18(ownerName) {
41984
+ const SlotClone = React54.forwardRef((props, forwardedRef) => {
41985
+ const { children, ...slotProps } = props;
41986
+ if (React54.isValidElement(children)) {
41987
+ const childrenRef = getElementRef19(children);
41988
+ const props2 = mergeProps18(slotProps, children.props);
41989
+ if (children.type !== React54.Fragment) {
41990
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
41991
+ }
41992
+ return React54.cloneElement(children, props2);
41993
+ }
41994
+ return React54.Children.count(children) > 1 ? React54.Children.only(null) : null;
41995
+ });
41996
+ SlotClone.displayName = `${ownerName}.SlotClone`;
41997
+ return SlotClone;
41998
+ }
41999
+ var SLOTTABLE_IDENTIFIER18 = /* @__PURE__ */ Symbol("radix.slottable");
42000
+ function isSlottable18(child) {
42001
+ return React54.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER18;
42002
+ }
42003
+ function mergeProps18(slotProps, childProps) {
42004
+ const overrideProps = { ...childProps };
42005
+ for (const propName in childProps) {
42006
+ const slotPropValue = slotProps[propName];
42007
+ const childPropValue = childProps[propName];
42008
+ const isHandler = /^on[A-Z]/.test(propName);
42009
+ if (isHandler) {
42010
+ if (slotPropValue && childPropValue) {
42011
+ overrideProps[propName] = (...args) => {
42012
+ const result = childPropValue(...args);
42013
+ slotPropValue(...args);
42014
+ return result;
42015
+ };
42016
+ } else if (slotPropValue) {
42017
+ overrideProps[propName] = slotPropValue;
42018
+ }
42019
+ } else if (propName === "style") {
42020
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
42021
+ } else if (propName === "className") {
42022
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
42023
+ }
42024
+ }
42025
+ return { ...slotProps, ...overrideProps };
42026
+ }
42027
+ function getElementRef19(element) {
42028
+ var _a, _b;
42029
+ let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
42030
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42031
+ if (mayWarn) {
42032
+ return element.ref;
42033
+ }
42034
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
42035
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42036
+ if (mayWarn) {
42037
+ return element.props.ref;
42038
+ }
42039
+ return element.props.ref || element.ref;
42040
+ }
42041
+ var NODES16 = [
42042
+ "a",
42043
+ "button",
42044
+ "div",
42045
+ "form",
42046
+ "h2",
42047
+ "h3",
42048
+ "img",
42049
+ "input",
42050
+ "label",
42051
+ "li",
42052
+ "nav",
42053
+ "ol",
42054
+ "p",
42055
+ "select",
42056
+ "span",
42057
+ "svg",
42058
+ "ul"
42059
+ ];
42060
+ var Primitive16 = NODES16.reduce((primitive, node) => {
42061
+ const Slot5 = createSlot18(`Primitive.${node}`);
42062
+ const Node2 = React54.forwardRef((props, forwardedRef) => {
42063
+ const { asChild, ...primitiveProps } = props;
42064
+ const Comp = asChild ? Slot5 : node;
42065
+ if (typeof window !== "undefined") {
42066
+ window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
42067
+ }
42068
+ return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
42069
+ });
42070
+ Node2.displayName = `Primitive.${node}`;
42071
+ return { ...primitive, [node]: Node2 };
42072
+ }, {});
42073
+ // @__NO_SIDE_EFFECTS__
42074
+ function createSlot19(ownerName) {
42075
+ const SlotClone = /* @__PURE__ */ createSlotClone19(ownerName);
42076
+ const Slot22 = React54.forwardRef((props, forwardedRef) => {
42077
+ const { children, ...slotProps } = props;
42078
+ const childrenArray = React54.Children.toArray(children);
42079
+ const slottable = childrenArray.find(isSlottable19);
42080
+ if (slottable) {
42081
+ const newElement = slottable.props.children;
42082
+ const newChildren = childrenArray.map((child) => {
42083
+ if (child === slottable) {
42084
+ if (React54.Children.count(newElement) > 1) return React54.Children.only(null);
42085
+ return React54.isValidElement(newElement) ? newElement.props.children : null;
42086
+ } else {
42087
+ return child;
42088
+ }
42089
+ });
42090
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React54.isValidElement(newElement) ? React54.cloneElement(newElement, void 0, newChildren) : null });
42091
+ }
42092
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
42093
+ });
42094
+ Slot22.displayName = `${ownerName}.Slot`;
42095
+ return Slot22;
42096
+ }
42097
+ // @__NO_SIDE_EFFECTS__
42098
+ function createSlotClone19(ownerName) {
42099
+ const SlotClone = React54.forwardRef((props, forwardedRef) => {
42100
+ const { children, ...slotProps } = props;
42101
+ if (React54.isValidElement(children)) {
42102
+ const childrenRef = getElementRef20(children);
42103
+ const props2 = mergeProps19(slotProps, children.props);
42104
+ if (children.type !== React54.Fragment) {
42105
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
42106
+ }
42107
+ return React54.cloneElement(children, props2);
42108
+ }
42109
+ return React54.Children.count(children) > 1 ? React54.Children.only(null) : null;
42110
+ });
42111
+ SlotClone.displayName = `${ownerName}.SlotClone`;
42112
+ return SlotClone;
42113
+ }
42114
+ var SLOTTABLE_IDENTIFIER19 = /* @__PURE__ */ Symbol("radix.slottable");
42115
+ function isSlottable19(child) {
42116
+ return React54.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER19;
42117
+ }
42118
+ function mergeProps19(slotProps, childProps) {
42119
+ const overrideProps = { ...childProps };
42120
+ for (const propName in childProps) {
42121
+ const slotPropValue = slotProps[propName];
42122
+ const childPropValue = childProps[propName];
42123
+ const isHandler = /^on[A-Z]/.test(propName);
42124
+ if (isHandler) {
42125
+ if (slotPropValue && childPropValue) {
42126
+ overrideProps[propName] = (...args) => {
42127
+ const result = childPropValue(...args);
42128
+ slotPropValue(...args);
42129
+ return result;
42130
+ };
42131
+ } else if (slotPropValue) {
42132
+ overrideProps[propName] = slotPropValue;
42133
+ }
42134
+ } else if (propName === "style") {
42135
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
42136
+ } else if (propName === "className") {
42137
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
42138
+ }
42139
+ }
42140
+ return { ...slotProps, ...overrideProps };
42141
+ }
42142
+ function getElementRef20(element) {
42143
+ var _a, _b;
42144
+ let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
42145
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42146
+ if (mayWarn) {
42147
+ return element.ref;
42148
+ }
42149
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
42150
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42151
+ if (mayWarn) {
42152
+ return element.props.ref;
42153
+ }
42154
+ return element.props.ref || element.ref;
42155
+ }
42156
+ var NODES17 = [
42157
+ "a",
42158
+ "button",
42159
+ "div",
42160
+ "form",
42161
+ "h2",
42162
+ "h3",
42163
+ "img",
42164
+ "input",
42165
+ "label",
42166
+ "li",
42167
+ "nav",
42168
+ "ol",
42169
+ "p",
42170
+ "select",
42171
+ "span",
42172
+ "svg",
42173
+ "ul"
42174
+ ];
42175
+ var Primitive17 = NODES17.reduce((primitive, node) => {
42176
+ const Slot5 = createSlot19(`Primitive.${node}`);
42177
+ const Node2 = React54.forwardRef((props, forwardedRef) => {
42178
+ const { asChild, ...primitiveProps } = props;
42179
+ const Comp = asChild ? Slot5 : node;
42180
+ if (typeof window !== "undefined") {
42181
+ window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
42182
+ }
42183
+ return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
42184
+ });
42185
+ Node2.displayName = `Primitive.${node}`;
42186
+ return { ...primitive, [node]: Node2 };
42187
+ }, {});
42188
+ var NAME3 = "Toggle";
42189
+ var Toggle = React54.forwardRef((props, forwardedRef) => {
42190
+ const { pressed: pressedProp, defaultPressed, onPressedChange, ...buttonProps } = props;
42191
+ const [pressed, setPressed] = useControllableState({
42192
+ prop: pressedProp,
42193
+ onChange: onPressedChange,
42194
+ defaultProp: defaultPressed != null ? defaultPressed : false,
42195
+ caller: NAME3
42196
+ });
42197
+ return /* @__PURE__ */ jsx(
42198
+ Primitive17.button,
42199
+ {
42200
+ type: "button",
42201
+ "aria-pressed": pressed,
42202
+ "data-state": pressed ? "on" : "off",
42203
+ "data-disabled": props.disabled ? "" : void 0,
42204
+ ...buttonProps,
42205
+ ref: forwardedRef,
42206
+ onClick: composeEventHandlers(props.onClick, () => {
42207
+ if (!props.disabled) {
42208
+ setPressed(!pressed);
42209
+ }
42210
+ })
42211
+ }
42212
+ );
42213
+ });
42214
+ Toggle.displayName = NAME3;
42215
+ var TOGGLE_GROUP_NAME = "ToggleGroup";
42216
+ var [createToggleGroupContext] = createContextScope(TOGGLE_GROUP_NAME, [
42217
+ createRovingFocusGroupScope
42218
+ ]);
42219
+ var useRovingFocusGroupScope2 = createRovingFocusGroupScope();
42220
+ var ToggleGroup = React54__default.forwardRef((props, forwardedRef) => {
42221
+ const { type, ...toggleGroupProps } = props;
42222
+ if (type === "single") {
42223
+ const singleProps = toggleGroupProps;
42224
+ return /* @__PURE__ */ jsx(ToggleGroupImplSingle, { ...singleProps, ref: forwardedRef });
42225
+ }
42226
+ if (type === "multiple") {
42227
+ const multipleProps = toggleGroupProps;
42228
+ return /* @__PURE__ */ jsx(ToggleGroupImplMultiple, { ...multipleProps, ref: forwardedRef });
42229
+ }
42230
+ throw new Error(`Missing prop \`type\` expected on \`${TOGGLE_GROUP_NAME}\``);
42231
+ });
42232
+ ToggleGroup.displayName = TOGGLE_GROUP_NAME;
42233
+ var [ToggleGroupValueProvider, useToggleGroupValueContext] = createToggleGroupContext(TOGGLE_GROUP_NAME);
42234
+ var ToggleGroupImplSingle = React54__default.forwardRef((props, forwardedRef) => {
42235
+ const {
42236
+ value: valueProp,
42237
+ defaultValue,
42238
+ onValueChange = () => {
42239
+ },
42240
+ ...toggleGroupSingleProps
42241
+ } = props;
42242
+ const [value, setValue] = useControllableState({
42243
+ prop: valueProp,
42244
+ defaultProp: defaultValue != null ? defaultValue : "",
42245
+ onChange: onValueChange,
42246
+ caller: TOGGLE_GROUP_NAME
42247
+ });
42248
+ return /* @__PURE__ */ jsx(
42249
+ ToggleGroupValueProvider,
42250
+ {
42251
+ scope: props.__scopeToggleGroup,
42252
+ type: "single",
42253
+ value: React54__default.useMemo(() => value ? [value] : [], [value]),
42254
+ onItemActivate: setValue,
42255
+ onItemDeactivate: React54__default.useCallback(() => setValue(""), [setValue]),
42256
+ children: /* @__PURE__ */ jsx(ToggleGroupImpl, { ...toggleGroupSingleProps, ref: forwardedRef })
42257
+ }
42258
+ );
42259
+ });
42260
+ var ToggleGroupImplMultiple = React54__default.forwardRef((props, forwardedRef) => {
42261
+ const {
42262
+ value: valueProp,
42263
+ defaultValue,
42264
+ onValueChange = () => {
42265
+ },
42266
+ ...toggleGroupMultipleProps
42267
+ } = props;
42268
+ const [value, setValue] = useControllableState({
42269
+ prop: valueProp,
42270
+ defaultProp: defaultValue != null ? defaultValue : [],
42271
+ onChange: onValueChange,
42272
+ caller: TOGGLE_GROUP_NAME
42273
+ });
42274
+ const handleButtonActivate = React54__default.useCallback(
42275
+ (itemValue) => setValue((prevValue = []) => [...prevValue, itemValue]),
42276
+ [setValue]
42277
+ );
42278
+ const handleButtonDeactivate = React54__default.useCallback(
42279
+ (itemValue) => setValue((prevValue = []) => prevValue.filter((value2) => value2 !== itemValue)),
42280
+ [setValue]
42281
+ );
42282
+ return /* @__PURE__ */ jsx(
42283
+ ToggleGroupValueProvider,
42284
+ {
42285
+ scope: props.__scopeToggleGroup,
42286
+ type: "multiple",
42287
+ value,
42288
+ onItemActivate: handleButtonActivate,
42289
+ onItemDeactivate: handleButtonDeactivate,
42290
+ children: /* @__PURE__ */ jsx(ToggleGroupImpl, { ...toggleGroupMultipleProps, ref: forwardedRef })
42291
+ }
42292
+ );
42293
+ });
42294
+ ToggleGroup.displayName = TOGGLE_GROUP_NAME;
42295
+ var [ToggleGroupContext, useToggleGroupContext] = createToggleGroupContext(TOGGLE_GROUP_NAME);
42296
+ var ToggleGroupImpl = React54__default.forwardRef(
42297
+ (props, forwardedRef) => {
42298
+ const {
42299
+ __scopeToggleGroup,
42300
+ disabled = false,
42301
+ rovingFocus = true,
42302
+ orientation,
42303
+ dir,
42304
+ loop = true,
42305
+ ...toggleGroupProps
42306
+ } = props;
42307
+ const rovingFocusGroupScope = useRovingFocusGroupScope2(__scopeToggleGroup);
42308
+ const direction = useDirection(dir);
42309
+ const commonProps = { role: "group", dir: direction, ...toggleGroupProps };
42310
+ return /* @__PURE__ */ jsx(ToggleGroupContext, { scope: __scopeToggleGroup, rovingFocus, disabled, children: rovingFocus ? /* @__PURE__ */ jsx(
42311
+ Root6,
42312
+ {
42313
+ asChild: true,
42314
+ ...rovingFocusGroupScope,
42315
+ orientation,
42316
+ dir: direction,
42317
+ loop,
42318
+ children: /* @__PURE__ */ jsx(Primitive16.div, { ...commonProps, ref: forwardedRef })
42319
+ }
42320
+ ) : /* @__PURE__ */ jsx(Primitive16.div, { ...commonProps, ref: forwardedRef }) });
42321
+ }
42322
+ );
42323
+ var ITEM_NAME4 = "ToggleGroupItem";
42324
+ var ToggleGroupItem = React54__default.forwardRef(
42325
+ (props, forwardedRef) => {
42326
+ const valueContext = useToggleGroupValueContext(ITEM_NAME4, props.__scopeToggleGroup);
42327
+ const context = useToggleGroupContext(ITEM_NAME4, props.__scopeToggleGroup);
42328
+ const rovingFocusGroupScope = useRovingFocusGroupScope2(props.__scopeToggleGroup);
42329
+ const pressed = valueContext.value.includes(props.value);
42330
+ const disabled = context.disabled || props.disabled;
42331
+ const commonProps = { ...props, pressed, disabled };
42332
+ const ref = React54__default.useRef(null);
42333
+ return context.rovingFocus ? /* @__PURE__ */ jsx(
42334
+ Item2,
42335
+ {
42336
+ asChild: true,
42337
+ ...rovingFocusGroupScope,
42338
+ focusable: !disabled,
42339
+ active: pressed,
42340
+ ref,
42341
+ children: /* @__PURE__ */ jsx(ToggleGroupItemImpl, { ...commonProps, ref: forwardedRef })
42342
+ }
42343
+ ) : /* @__PURE__ */ jsx(ToggleGroupItemImpl, { ...commonProps, ref: forwardedRef });
42344
+ }
42345
+ );
42346
+ ToggleGroupItem.displayName = ITEM_NAME4;
42347
+ var ToggleGroupItemImpl = React54__default.forwardRef(
42348
+ (props, forwardedRef) => {
42349
+ const { __scopeToggleGroup, value, ...itemProps } = props;
42350
+ const valueContext = useToggleGroupValueContext(ITEM_NAME4, __scopeToggleGroup);
42351
+ const singleProps = { role: "radio", "aria-checked": props.pressed, "aria-pressed": void 0 };
42352
+ const typeProps = valueContext.type === "single" ? singleProps : void 0;
42353
+ return /* @__PURE__ */ jsx(
42354
+ Toggle,
42355
+ {
42356
+ ...typeProps,
42357
+ ...itemProps,
42358
+ ref: forwardedRef,
42359
+ onPressedChange: (pressed) => {
42360
+ if (pressed) {
42361
+ valueContext.onItemActivate(value);
42362
+ } else {
42363
+ valueContext.onItemDeactivate(value);
42364
+ }
42365
+ }
42366
+ }
42367
+ );
42368
+ }
42369
+ );
42370
+ var Root25 = ToggleGroup;
42371
+ var Item23 = ToggleGroupItem;
42372
+ var toggleVariants = cva(
42373
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
42374
+ {
42375
+ variants: {
42376
+ variant: {
42377
+ default: "bg-transparent",
42378
+ outline: "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"
42379
+ },
42380
+ size: {
42381
+ default: "h-9 px-2 min-w-9",
42382
+ sm: "h-8 px-1.5 min-w-8",
42383
+ lg: "h-10 px-2.5 min-w-10"
42384
+ }
42385
+ },
42386
+ defaultVariants: {
42387
+ variant: "default",
42388
+ size: "default"
42389
+ }
42390
+ }
42391
+ );
42392
+ var ToggleGroupContext2 = React54.createContext({
42393
+ size: "default",
42394
+ variant: "default",
42395
+ spacing: 0
42396
+ });
42397
+ function ToggleGroup2({
42398
+ className,
42399
+ variant,
42400
+ size: size4,
42401
+ spacing = 0,
42402
+ children,
42403
+ ...props
42404
+ }) {
42405
+ return /* @__PURE__ */ jsx(
42406
+ Root25,
42407
+ {
42408
+ "data-slot": "toggle-group",
42409
+ "data-variant": variant,
42410
+ "data-size": size4,
42411
+ "data-spacing": spacing,
42412
+ style: { "--gap": spacing },
42413
+ className: cn(
42414
+ "group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",
42415
+ className
42416
+ ),
42417
+ ...props,
42418
+ children: /* @__PURE__ */ jsx(ToggleGroupContext2.Provider, { value: { variant, size: size4, spacing }, children })
42419
+ }
42420
+ );
42421
+ }
42422
+ function ToggleGroupItem2({
42423
+ className,
42424
+ children,
42425
+ variant,
42426
+ size: size4,
42427
+ ...props
42428
+ }) {
42429
+ const context = React54.useContext(ToggleGroupContext2);
42430
+ return /* @__PURE__ */ jsx(
42431
+ Item23,
42432
+ {
42433
+ "data-slot": "toggle-group-item",
42434
+ "data-variant": context.variant || variant,
42435
+ "data-size": context.size || size4,
42436
+ "data-spacing": context.spacing,
42437
+ className: cn(
42438
+ toggleVariants({
42439
+ variant: context.variant || variant,
42440
+ size: context.size || size4
42441
+ }),
42442
+ "w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10",
42443
+ "data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",
42444
+ className
42445
+ ),
42446
+ ...props,
42447
+ children
42448
+ }
42449
+ );
42450
+ }
42451
+ // @__NO_SIDE_EFFECTS__
42452
+ function createSlot20(ownerName) {
42453
+ const SlotClone = /* @__PURE__ */ createSlotClone20(ownerName);
42454
+ const Slot22 = React54.forwardRef((props, forwardedRef) => {
42455
+ const { children, ...slotProps } = props;
42456
+ const childrenArray = React54.Children.toArray(children);
42457
+ const slottable = childrenArray.find(isSlottable20);
42458
+ if (slottable) {
42459
+ const newElement = slottable.props.children;
42460
+ const newChildren = childrenArray.map((child) => {
42461
+ if (child === slottable) {
42462
+ if (React54.Children.count(newElement) > 1) return React54.Children.only(null);
42463
+ return React54.isValidElement(newElement) ? newElement.props.children : null;
42464
+ } else {
42465
+ return child;
42466
+ }
42467
+ });
42468
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React54.isValidElement(newElement) ? React54.cloneElement(newElement, void 0, newChildren) : null });
42469
+ }
42470
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
42471
+ });
42472
+ Slot22.displayName = `${ownerName}.Slot`;
42473
+ return Slot22;
42474
+ }
42475
+ // @__NO_SIDE_EFFECTS__
42476
+ function createSlotClone20(ownerName) {
42477
+ const SlotClone = React54.forwardRef((props, forwardedRef) => {
42478
+ const { children, ...slotProps } = props;
42479
+ if (React54.isValidElement(children)) {
42480
+ const childrenRef = getElementRef21(children);
42481
+ const props2 = mergeProps20(slotProps, children.props);
42482
+ if (children.type !== React54.Fragment) {
42483
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
42484
+ }
42485
+ return React54.cloneElement(children, props2);
42486
+ }
42487
+ return React54.Children.count(children) > 1 ? React54.Children.only(null) : null;
42488
+ });
42489
+ SlotClone.displayName = `${ownerName}.SlotClone`;
42490
+ return SlotClone;
42491
+ }
42492
+ var SLOTTABLE_IDENTIFIER20 = /* @__PURE__ */ Symbol("radix.slottable");
42493
+ // @__NO_SIDE_EFFECTS__
42494
+ function createSlottable(ownerName) {
42495
+ const Slottable2 = ({ children }) => {
42496
+ return /* @__PURE__ */ jsx(Fragment, { children });
42497
+ };
42498
+ Slottable2.displayName = `${ownerName}.Slottable`;
42499
+ Slottable2.__radixId = SLOTTABLE_IDENTIFIER20;
42500
+ return Slottable2;
42501
+ }
42502
+ function isSlottable20(child) {
42503
+ return React54.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER20;
42504
+ }
42505
+ function mergeProps20(slotProps, childProps) {
42506
+ const overrideProps = { ...childProps };
42507
+ for (const propName in childProps) {
42508
+ const slotPropValue = slotProps[propName];
42509
+ const childPropValue = childProps[propName];
42510
+ const isHandler = /^on[A-Z]/.test(propName);
42511
+ if (isHandler) {
42512
+ if (slotPropValue && childPropValue) {
42513
+ overrideProps[propName] = (...args) => {
42514
+ const result = childPropValue(...args);
42515
+ slotPropValue(...args);
42516
+ return result;
42517
+ };
42518
+ } else if (slotPropValue) {
42519
+ overrideProps[propName] = slotPropValue;
42520
+ }
42521
+ } else if (propName === "style") {
42522
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
42523
+ } else if (propName === "className") {
42524
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
42525
+ }
42526
+ }
42527
+ return { ...slotProps, ...overrideProps };
42528
+ }
42529
+ function getElementRef21(element) {
42530
+ var _a, _b;
42531
+ let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
42532
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42533
+ if (mayWarn) {
42534
+ return element.ref;
42535
+ }
42536
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
42537
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42538
+ if (mayWarn) {
42539
+ return element.props.ref;
42540
+ }
42541
+ return element.props.ref || element.ref;
42542
+ }
42543
+ var NODES18 = [
42544
+ "a",
42545
+ "button",
42546
+ "div",
42547
+ "form",
42548
+ "h2",
42549
+ "h3",
42550
+ "img",
42551
+ "input",
42552
+ "label",
42553
+ "li",
42554
+ "nav",
42555
+ "ol",
42556
+ "p",
42557
+ "select",
42558
+ "span",
42559
+ "svg",
42560
+ "ul"
42561
+ ];
42562
+ var Primitive18 = NODES18.reduce((primitive, node) => {
42563
+ const Slot5 = createSlot20(`Primitive.${node}`);
42564
+ const Node2 = React54.forwardRef((props, forwardedRef) => {
42565
+ const { asChild, ...primitiveProps } = props;
42566
+ const Comp = asChild ? Slot5 : node;
42567
+ if (typeof window !== "undefined") {
42568
+ window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
42569
+ }
42570
+ return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
42571
+ });
42572
+ Node2.displayName = `Primitive.${node}`;
42573
+ return { ...primitive, [node]: Node2 };
42574
+ }, {});
42575
+ var [createTooltipContext] = createContextScope("Tooltip", [
42576
+ createPopperScope
42577
+ ]);
42578
+ var usePopperScope3 = createPopperScope();
42579
+ var PROVIDER_NAME = "TooltipProvider";
42580
+ var DEFAULT_DELAY_DURATION = 700;
42581
+ var TOOLTIP_OPEN = "tooltip.open";
42582
+ var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
42583
+ var TooltipProvider = (props) => {
42584
+ const {
42585
+ __scopeTooltip,
42586
+ delayDuration = DEFAULT_DELAY_DURATION,
42587
+ skipDelayDuration = 300,
42588
+ disableHoverableContent = false,
42589
+ children
42590
+ } = props;
42591
+ const isOpenDelayedRef = React54.useRef(true);
42592
+ const isPointerInTransitRef = React54.useRef(false);
42593
+ const skipDelayTimerRef = React54.useRef(0);
42594
+ React54.useEffect(() => {
42595
+ const skipDelayTimer = skipDelayTimerRef.current;
42596
+ return () => window.clearTimeout(skipDelayTimer);
42597
+ }, []);
42598
+ return /* @__PURE__ */ jsx(
42599
+ TooltipProviderContextProvider,
42600
+ {
42601
+ scope: __scopeTooltip,
42602
+ isOpenDelayedRef,
42603
+ delayDuration,
42604
+ onOpen: React54.useCallback(() => {
42605
+ window.clearTimeout(skipDelayTimerRef.current);
42606
+ isOpenDelayedRef.current = false;
42607
+ }, []),
42608
+ onClose: React54.useCallback(() => {
42609
+ window.clearTimeout(skipDelayTimerRef.current);
42610
+ skipDelayTimerRef.current = window.setTimeout(
42611
+ () => isOpenDelayedRef.current = true,
42612
+ skipDelayDuration
42613
+ );
42614
+ }, [skipDelayDuration]),
42615
+ isPointerInTransitRef,
42616
+ onPointerInTransitChange: React54.useCallback((inTransit) => {
42617
+ isPointerInTransitRef.current = inTransit;
42618
+ }, []),
42619
+ disableHoverableContent,
42620
+ children
42621
+ }
42622
+ );
42623
+ };
42624
+ TooltipProvider.displayName = PROVIDER_NAME;
42625
+ var TOOLTIP_NAME = "Tooltip";
42626
+ var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
42627
+ var Tooltip = (props) => {
42628
+ const {
42629
+ __scopeTooltip,
42630
+ children,
42631
+ open: openProp,
42632
+ defaultOpen,
42633
+ onOpenChange,
42634
+ disableHoverableContent: disableHoverableContentProp,
42635
+ delayDuration: delayDurationProp
42636
+ } = props;
42637
+ const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
42638
+ const popperScope = usePopperScope3(__scopeTooltip);
42639
+ const [trigger, setTrigger] = React54.useState(null);
42640
+ const contentId = useId3();
42641
+ const openTimerRef = React54.useRef(0);
42642
+ const disableHoverableContent = disableHoverableContentProp != null ? disableHoverableContentProp : providerContext.disableHoverableContent;
42643
+ const delayDuration = delayDurationProp != null ? delayDurationProp : providerContext.delayDuration;
42644
+ const wasOpenDelayedRef = React54.useRef(false);
42645
+ const [open, setOpen] = useControllableState({
42646
+ prop: openProp,
42647
+ defaultProp: defaultOpen != null ? defaultOpen : false,
42648
+ onChange: (open2) => {
42649
+ if (open2) {
42650
+ providerContext.onOpen();
42651
+ document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
42652
+ } else {
42653
+ providerContext.onClose();
42654
+ }
42655
+ onOpenChange == null ? void 0 : onOpenChange(open2);
42656
+ },
42657
+ caller: TOOLTIP_NAME
42658
+ });
42659
+ const stateAttribute = React54.useMemo(() => {
42660
+ return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
42661
+ }, [open]);
42662
+ const handleOpen = React54.useCallback(() => {
42663
+ window.clearTimeout(openTimerRef.current);
42664
+ openTimerRef.current = 0;
42665
+ wasOpenDelayedRef.current = false;
42666
+ setOpen(true);
42667
+ }, [setOpen]);
42668
+ const handleClose = React54.useCallback(() => {
42669
+ window.clearTimeout(openTimerRef.current);
42670
+ openTimerRef.current = 0;
42671
+ setOpen(false);
42672
+ }, [setOpen]);
42673
+ const handleDelayedOpen = React54.useCallback(() => {
42674
+ window.clearTimeout(openTimerRef.current);
42675
+ openTimerRef.current = window.setTimeout(() => {
42676
+ wasOpenDelayedRef.current = true;
42677
+ setOpen(true);
42678
+ openTimerRef.current = 0;
42679
+ }, delayDuration);
42680
+ }, [delayDuration, setOpen]);
42681
+ React54.useEffect(() => {
42682
+ return () => {
42683
+ if (openTimerRef.current) {
42684
+ window.clearTimeout(openTimerRef.current);
42685
+ openTimerRef.current = 0;
42686
+ }
42687
+ };
42688
+ }, []);
42689
+ return /* @__PURE__ */ jsx(Root2, { ...popperScope, children: /* @__PURE__ */ jsx(
42690
+ TooltipContextProvider,
42691
+ {
42692
+ scope: __scopeTooltip,
42693
+ contentId,
42694
+ open,
42695
+ stateAttribute,
42696
+ trigger,
42697
+ onTriggerChange: setTrigger,
42698
+ onTriggerEnter: React54.useCallback(() => {
42699
+ if (providerContext.isOpenDelayedRef.current) handleDelayedOpen();
42700
+ else handleOpen();
42701
+ }, [providerContext.isOpenDelayedRef, handleDelayedOpen, handleOpen]),
42702
+ onTriggerLeave: React54.useCallback(() => {
42703
+ if (disableHoverableContent) {
42704
+ handleClose();
42705
+ } else {
42706
+ window.clearTimeout(openTimerRef.current);
42707
+ openTimerRef.current = 0;
42708
+ }
42709
+ }, [handleClose, disableHoverableContent]),
42710
+ onOpen: handleOpen,
42711
+ onClose: handleClose,
42712
+ disableHoverableContent,
42713
+ children
42714
+ }
42715
+ ) });
42716
+ };
42717
+ Tooltip.displayName = TOOLTIP_NAME;
42718
+ var TRIGGER_NAME5 = "TooltipTrigger";
42719
+ var TooltipTrigger = React54.forwardRef(
42720
+ (props, forwardedRef) => {
42721
+ const { __scopeTooltip, ...triggerProps } = props;
42722
+ const context = useTooltipContext(TRIGGER_NAME5, __scopeTooltip);
42723
+ const providerContext = useTooltipProviderContext(TRIGGER_NAME5, __scopeTooltip);
42724
+ const popperScope = usePopperScope3(__scopeTooltip);
42725
+ const ref = React54.useRef(null);
42726
+ const composedRefs = useComposedRefs(forwardedRef, ref, context.onTriggerChange);
42727
+ const isPointerDownRef = React54.useRef(false);
42728
+ const hasPointerMoveOpenedRef = React54.useRef(false);
42729
+ const handlePointerUp = React54.useCallback(() => isPointerDownRef.current = false, []);
42730
+ React54.useEffect(() => {
42731
+ return () => document.removeEventListener("pointerup", handlePointerUp);
42732
+ }, [handlePointerUp]);
42733
+ return /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsx(
42734
+ Primitive18.button,
42735
+ {
42736
+ "aria-describedby": context.open ? context.contentId : void 0,
42737
+ "data-state": context.stateAttribute,
42738
+ ...triggerProps,
42739
+ ref: composedRefs,
42740
+ onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
42741
+ if (event.pointerType === "touch") return;
42742
+ if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
42743
+ context.onTriggerEnter();
42744
+ hasPointerMoveOpenedRef.current = true;
42745
+ }
42746
+ }),
42747
+ onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
42748
+ context.onTriggerLeave();
42749
+ hasPointerMoveOpenedRef.current = false;
42750
+ }),
42751
+ onPointerDown: composeEventHandlers(props.onPointerDown, () => {
42752
+ if (context.open) {
42753
+ context.onClose();
42754
+ }
42755
+ isPointerDownRef.current = true;
42756
+ document.addEventListener("pointerup", handlePointerUp, { once: true });
42757
+ }),
42758
+ onFocus: composeEventHandlers(props.onFocus, () => {
42759
+ if (!isPointerDownRef.current) context.onOpen();
42760
+ }),
42761
+ onBlur: composeEventHandlers(props.onBlur, context.onClose),
42762
+ onClick: composeEventHandlers(props.onClick, context.onClose)
42763
+ }
42764
+ ) });
42765
+ }
42766
+ );
42767
+ TooltipTrigger.displayName = TRIGGER_NAME5;
42768
+ var PORTAL_NAME5 = "TooltipPortal";
42769
+ var [PortalProvider3, usePortalContext3] = createTooltipContext(PORTAL_NAME5, {
42770
+ forceMount: void 0
42771
+ });
42772
+ var TooltipPortal = (props) => {
42773
+ const { __scopeTooltip, forceMount, children, container } = props;
42774
+ const context = useTooltipContext(PORTAL_NAME5, __scopeTooltip);
42775
+ return /* @__PURE__ */ jsx(PortalProvider3, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal, { asChild: true, container, children }) }) });
42776
+ };
42777
+ TooltipPortal.displayName = PORTAL_NAME5;
42778
+ var CONTENT_NAME5 = "TooltipContent";
42779
+ var TooltipContent = React54.forwardRef(
42780
+ (props, forwardedRef) => {
42781
+ const portalContext = usePortalContext3(CONTENT_NAME5, props.__scopeTooltip);
42782
+ const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
42783
+ const context = useTooltipContext(CONTENT_NAME5, props.__scopeTooltip);
42784
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ jsx(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
42785
+ }
42786
+ );
42787
+ var TooltipContentHoverable = React54.forwardRef((props, forwardedRef) => {
42788
+ const context = useTooltipContext(CONTENT_NAME5, props.__scopeTooltip);
42789
+ const providerContext = useTooltipProviderContext(CONTENT_NAME5, props.__scopeTooltip);
42790
+ const ref = React54.useRef(null);
42791
+ const composedRefs = useComposedRefs(forwardedRef, ref);
42792
+ const [pointerGraceArea, setPointerGraceArea] = React54.useState(null);
42793
+ const { trigger, onClose } = context;
42794
+ const content = ref.current;
42795
+ const { onPointerInTransitChange } = providerContext;
42796
+ const handleRemoveGraceArea = React54.useCallback(() => {
42797
+ setPointerGraceArea(null);
42798
+ onPointerInTransitChange(false);
42799
+ }, [onPointerInTransitChange]);
42800
+ const handleCreateGraceArea = React54.useCallback(
42801
+ (event, hoverTarget) => {
42802
+ const currentTarget = event.currentTarget;
42803
+ const exitPoint = { x: event.clientX, y: event.clientY };
42804
+ const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
42805
+ const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
42806
+ const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
42807
+ const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);
42808
+ setPointerGraceArea(graceArea);
42809
+ onPointerInTransitChange(true);
42810
+ },
42811
+ [onPointerInTransitChange]
42812
+ );
42813
+ React54.useEffect(() => {
42814
+ return () => handleRemoveGraceArea();
42815
+ }, [handleRemoveGraceArea]);
42816
+ React54.useEffect(() => {
42817
+ if (trigger && content) {
42818
+ const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
42819
+ const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
42820
+ trigger.addEventListener("pointerleave", handleTriggerLeave);
42821
+ content.addEventListener("pointerleave", handleContentLeave);
42822
+ return () => {
42823
+ trigger.removeEventListener("pointerleave", handleTriggerLeave);
42824
+ content.removeEventListener("pointerleave", handleContentLeave);
42825
+ };
42826
+ }
42827
+ }, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
42828
+ React54.useEffect(() => {
42829
+ if (pointerGraceArea) {
42830
+ const handleTrackPointerGrace = (event) => {
42831
+ const target = event.target;
42832
+ const pointerPosition = { x: event.clientX, y: event.clientY };
42833
+ const hasEnteredTarget = (trigger == null ? void 0 : trigger.contains(target)) || (content == null ? void 0 : content.contains(target));
42834
+ const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
42835
+ if (hasEnteredTarget) {
42836
+ handleRemoveGraceArea();
42837
+ } else if (isPointerOutsideGraceArea) {
42838
+ handleRemoveGraceArea();
42839
+ onClose();
42840
+ }
42841
+ };
42842
+ document.addEventListener("pointermove", handleTrackPointerGrace);
42843
+ return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
42844
+ }
42845
+ }, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
42846
+ return /* @__PURE__ */ jsx(TooltipContentImpl, { ...props, ref: composedRefs });
42847
+ });
42848
+ var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
42849
+ var Slottable = createSlottable("TooltipContent");
42850
+ var TooltipContentImpl = React54.forwardRef(
42851
+ (props, forwardedRef) => {
42852
+ const {
42853
+ __scopeTooltip,
42854
+ children,
42855
+ "aria-label": ariaLabel,
42856
+ onEscapeKeyDown,
42857
+ onPointerDownOutside,
42858
+ ...contentProps
42859
+ } = props;
42860
+ const context = useTooltipContext(CONTENT_NAME5, __scopeTooltip);
42861
+ const popperScope = usePopperScope3(__scopeTooltip);
42862
+ const { onClose } = context;
42863
+ React54.useEffect(() => {
42864
+ document.addEventListener(TOOLTIP_OPEN, onClose);
42865
+ return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
42866
+ }, [onClose]);
42867
+ React54.useEffect(() => {
42868
+ if (context.trigger) {
42869
+ const handleScroll2 = (event) => {
42870
+ const target = event.target;
42871
+ if (target == null ? void 0 : target.contains(context.trigger)) onClose();
42872
+ };
42873
+ window.addEventListener("scroll", handleScroll2, { capture: true });
42874
+ return () => window.removeEventListener("scroll", handleScroll2, { capture: true });
42875
+ }
42876
+ }, [context.trigger, onClose]);
42877
+ return /* @__PURE__ */ jsx(
42878
+ DismissableLayer,
42879
+ {
42880
+ asChild: true,
42881
+ disableOutsidePointerEvents: false,
42882
+ onEscapeKeyDown,
42883
+ onPointerDownOutside,
42884
+ onFocusOutside: (event) => event.preventDefault(),
42885
+ onDismiss: onClose,
42886
+ children: /* @__PURE__ */ jsxs(
42887
+ Content,
42888
+ {
42889
+ "data-state": context.stateAttribute,
42890
+ ...popperScope,
42891
+ ...contentProps,
42892
+ ref: forwardedRef,
42893
+ style: {
42894
+ ...contentProps.style,
42895
+ // re-namespace exposed content custom properties
42896
+ ...{
42897
+ "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
42898
+ "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
42899
+ "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
42900
+ "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
42901
+ "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
42902
+ }
42903
+ },
42904
+ children: [
42905
+ /* @__PURE__ */ jsx(Slottable, { children }),
42906
+ /* @__PURE__ */ jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsx(Root3, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
42907
+ ]
42908
+ }
42909
+ )
42910
+ }
42911
+ );
42912
+ }
42913
+ );
42914
+ TooltipContent.displayName = CONTENT_NAME5;
42915
+ var ARROW_NAME4 = "TooltipArrow";
42916
+ var TooltipArrow = React54.forwardRef(
42917
+ (props, forwardedRef) => {
42918
+ const { __scopeTooltip, ...arrowProps } = props;
42919
+ const popperScope = usePopperScope3(__scopeTooltip);
42920
+ const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
42921
+ ARROW_NAME4,
42922
+ __scopeTooltip
42923
+ );
42924
+ return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsx(Arrow2, { ...popperScope, ...arrowProps, ref: forwardedRef });
42925
+ }
42926
+ );
42927
+ TooltipArrow.displayName = ARROW_NAME4;
42928
+ function getExitSideFromRect(point, rect) {
42929
+ const top = Math.abs(rect.top - point.y);
42930
+ const bottom = Math.abs(rect.bottom - point.y);
42931
+ const right = Math.abs(rect.right - point.x);
42932
+ const left = Math.abs(rect.left - point.x);
42933
+ switch (Math.min(top, bottom, right, left)) {
42934
+ case left:
42935
+ return "left";
42936
+ case right:
42937
+ return "right";
42938
+ case top:
42939
+ return "top";
42940
+ case bottom:
42941
+ return "bottom";
42942
+ default:
42943
+ throw new Error("unreachable");
42944
+ }
42945
+ }
42946
+ function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
42947
+ const paddedExitPoints = [];
42948
+ switch (exitSide) {
42949
+ case "top":
42950
+ paddedExitPoints.push(
42951
+ { x: exitPoint.x - padding, y: exitPoint.y + padding },
42952
+ { x: exitPoint.x + padding, y: exitPoint.y + padding }
42953
+ );
42954
+ break;
42955
+ case "bottom":
42956
+ paddedExitPoints.push(
42957
+ { x: exitPoint.x - padding, y: exitPoint.y - padding },
42958
+ { x: exitPoint.x + padding, y: exitPoint.y - padding }
42959
+ );
42960
+ break;
42961
+ case "left":
42962
+ paddedExitPoints.push(
42963
+ { x: exitPoint.x + padding, y: exitPoint.y - padding },
42964
+ { x: exitPoint.x + padding, y: exitPoint.y + padding }
42965
+ );
42966
+ break;
42967
+ case "right":
42968
+ paddedExitPoints.push(
42969
+ { x: exitPoint.x - padding, y: exitPoint.y - padding },
42970
+ { x: exitPoint.x - padding, y: exitPoint.y + padding }
42971
+ );
42972
+ break;
42973
+ }
42974
+ return paddedExitPoints;
42975
+ }
42976
+ function getPointsFromRect(rect) {
42977
+ const { top, right, bottom, left } = rect;
42978
+ return [
42979
+ { x: left, y: top },
42980
+ { x: right, y: top },
42981
+ { x: right, y: bottom },
42982
+ { x: left, y: bottom }
42983
+ ];
42984
+ }
42985
+ function isPointInPolygon(point, polygon) {
42986
+ const { x, y } = point;
42987
+ let inside = false;
42988
+ for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
42989
+ const ii = polygon[i];
42990
+ const jj = polygon[j];
42991
+ const xi = ii.x;
42992
+ const yi = ii.y;
42993
+ const xj = jj.x;
42994
+ const yj = jj.y;
42995
+ const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
42996
+ if (intersect) inside = !inside;
42997
+ }
42998
+ return inside;
42999
+ }
43000
+ function getHull(points) {
43001
+ const newPoints = points.slice();
43002
+ newPoints.sort((a, b) => {
43003
+ if (a.x < b.x) return -1;
43004
+ else if (a.x > b.x) return 1;
43005
+ else if (a.y < b.y) return -1;
43006
+ else if (a.y > b.y) return 1;
43007
+ else return 0;
43008
+ });
43009
+ return getHullPresorted(newPoints);
43010
+ }
43011
+ function getHullPresorted(points) {
43012
+ if (points.length <= 1) return points.slice();
43013
+ const upperHull = [];
43014
+ for (let i = 0; i < points.length; i++) {
43015
+ const p = points[i];
43016
+ while (upperHull.length >= 2) {
43017
+ const q = upperHull[upperHull.length - 1];
43018
+ const r2 = upperHull[upperHull.length - 2];
43019
+ if ((q.x - r2.x) * (p.y - r2.y) >= (q.y - r2.y) * (p.x - r2.x)) upperHull.pop();
43020
+ else break;
43021
+ }
43022
+ upperHull.push(p);
43023
+ }
43024
+ upperHull.pop();
43025
+ const lowerHull = [];
43026
+ for (let i = points.length - 1; i >= 0; i--) {
43027
+ const p = points[i];
43028
+ while (lowerHull.length >= 2) {
43029
+ const q = lowerHull[lowerHull.length - 1];
43030
+ const r2 = lowerHull[lowerHull.length - 2];
43031
+ if ((q.x - r2.x) * (p.y - r2.y) >= (q.y - r2.y) * (p.x - r2.x)) lowerHull.pop();
43032
+ else break;
43033
+ }
43034
+ lowerHull.push(p);
43035
+ }
43036
+ lowerHull.pop();
43037
+ if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
43038
+ return upperHull;
43039
+ } else {
43040
+ return upperHull.concat(lowerHull);
43041
+ }
43042
+ }
43043
+ var Provider = TooltipProvider;
43044
+ var Root32 = Tooltip;
43045
+ var Trigger4 = TooltipTrigger;
43046
+ var Portal5 = TooltipPortal;
43047
+ var Content23 = TooltipContent;
43048
+ var Arrow22 = TooltipArrow;
43049
+ function TooltipProvider2({
43050
+ delayDuration = 0,
43051
+ ...props
43052
+ }) {
43053
+ return /* @__PURE__ */ jsx(
43054
+ Provider,
43055
+ {
43056
+ "data-slot": "tooltip-provider",
43057
+ delayDuration,
43058
+ ...props
43059
+ }
43060
+ );
43061
+ }
43062
+ function Tooltip2({
43063
+ ...props
43064
+ }) {
43065
+ return /* @__PURE__ */ jsx(TooltipProvider2, { children: /* @__PURE__ */ jsx(Root32, { "data-slot": "tooltip", ...props }) });
43066
+ }
43067
+ function TooltipTrigger2({
43068
+ ...props
43069
+ }) {
43070
+ return /* @__PURE__ */ jsx(Trigger4, { "data-slot": "tooltip-trigger", ...props });
43071
+ }
43072
+ function TooltipContent2({
43073
+ className,
43074
+ sideOffset = 0,
43075
+ children,
43076
+ ...props
43077
+ }) {
43078
+ return /* @__PURE__ */ jsx(Portal5, { children: /* @__PURE__ */ jsxs(
43079
+ Content23,
43080
+ {
43081
+ "data-slot": "tooltip-content",
43082
+ sideOffset,
43083
+ className: cn(
43084
+ "bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
43085
+ className
43086
+ ),
43087
+ ...props,
43088
+ children: [
43089
+ children,
43090
+ /* @__PURE__ */ jsx(Arrow22, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
43091
+ ]
43092
+ }
43093
+ ) });
43094
+ }
43095
+ function mapSizeToToggleSize(size4) {
43096
+ switch (size4) {
43097
+ case "sm":
43098
+ return "sm";
43099
+ case "lg":
43100
+ return "lg";
43101
+ case "md":
43102
+ default:
43103
+ return "default";
43104
+ }
43105
+ }
43106
+ function normalizeValue(val, multiple) {
43107
+ if (multiple) {
43108
+ if (Array.isArray(val)) return val;
43109
+ if (typeof val === "string") return [val];
43110
+ return [];
43111
+ }
43112
+ if (Array.isArray(val)) return val[0] || "";
43113
+ return val || "";
43114
+ }
43115
+ function capitalizeFirst6(label) {
43116
+ if (!label) return label;
43117
+ return label.charAt(0).toUpperCase() + label.slice(1);
43118
+ }
43119
+ function normalizeOption(input, {
43120
+ optionValue,
43121
+ optionLabel,
43122
+ optionIcon,
43123
+ optionDisabled,
43124
+ optionTooltip,
43125
+ optionMeta
43126
+ }, autoCap) {
43127
+ var _a, _b, _c, _d, _e, _f;
43128
+ const anyInput = input;
43129
+ if (optionValue || optionLabel || optionIcon || optionDisabled || optionTooltip || optionMeta) {
43130
+ const rawValue = optionValue != null ? anyInput[optionValue] : (_a = anyInput.value) != null ? _a : input;
43131
+ const value2 = String(rawValue);
43132
+ let label2;
43133
+ if (optionLabel != null) {
43134
+ label2 = anyInput[optionLabel];
43135
+ } else if (anyInput.label != null) {
43136
+ label2 = anyInput.label;
43137
+ } else {
43138
+ label2 = String(rawValue != null ? rawValue : value2);
43139
+ }
43140
+ if (autoCap && typeof label2 === "string") {
43141
+ label2 = capitalizeFirst6(label2);
43142
+ }
43143
+ const icon = optionIcon != null ? anyInput[optionIcon] : (_b = anyInput.icon) != null ? _b : void 0;
43144
+ const disabled = optionDisabled != null ? !!anyInput[optionDisabled] : !!anyInput.disabled;
43145
+ const tooltip = optionTooltip != null ? anyInput[optionTooltip] : (_c = anyInput.tooltip) != null ? _c : void 0;
43146
+ const meta = optionMeta != null ? anyInput[optionMeta] : (_d = anyInput.meta) != null ? _d : void 0;
43147
+ return {
43148
+ ui: {
43149
+ value: value2,
43150
+ label: label2,
43151
+ icon,
43152
+ disabled,
43153
+ tooltip,
43154
+ meta
43155
+ },
43156
+ raw: input
43157
+ };
43158
+ }
43159
+ if (typeof input === "string" || typeof input === "number" || typeof input === "boolean") {
43160
+ const value2 = String(input);
43161
+ let label2 = value2;
43162
+ if (autoCap && typeof label2 === "string") {
43163
+ label2 = capitalizeFirst6(label2);
43164
+ }
43165
+ return {
43166
+ ui: {
43167
+ value: value2,
43168
+ label: label2
43169
+ },
43170
+ raw: input
43171
+ };
43172
+ }
43173
+ const baseValue = (_f = anyInput.value) != null ? _f : String((_e = anyInput.label) != null ? _e : "");
43174
+ const value = String(baseValue);
43175
+ let label = anyInput.label != null ? anyInput.label : String(value);
43176
+ if (autoCap && typeof label === "string") {
43177
+ label = capitalizeFirst6(label);
43178
+ }
43179
+ return {
43180
+ ui: {
43181
+ value,
43182
+ label,
43183
+ icon: anyInput.icon,
43184
+ disabled: !!anyInput.disabled,
43185
+ tooltip: anyInput.tooltip,
43186
+ meta: anyInput.meta
43187
+ },
43188
+ raw: input
43189
+ };
43190
+ }
43191
+ var ShadcnToggleVariant3 = React54.forwardRef(function ShadcnToggleVariant4(props, ref) {
43192
+ const {
43193
+ value,
43194
+ onValue,
43195
+ disabled,
43196
+ readOnly,
43197
+ error,
43198
+ size: size4 = "md",
43199
+ options = [],
43200
+ multiple = false,
43201
+ variant = "default",
43202
+ layout = "horizontal",
43203
+ gridCols = 2,
43204
+ fillWidth: fullWidth = false,
43205
+ optionValue,
43206
+ optionLabel,
43207
+ optionIcon,
43208
+ optionDisabled,
43209
+ optionTooltip,
43210
+ optionMeta,
43211
+ renderOption,
43212
+ className,
43213
+ itemClassName,
43214
+ activeClassName,
43215
+ autoCap = false,
43216
+ gap: itemGapPx
43217
+ } = props;
43218
+ const isDisabled = !!disabled || !!readOnly;
43219
+ const toggleSize = mapSizeToToggleSize(size4);
43220
+ const currentValue = normalizeValue(value, multiple);
43221
+ const normalizedOptions = React54.useMemo(
43222
+ () => options.map(
43223
+ (opt) => normalizeOption(
43224
+ opt,
43225
+ {
43226
+ optionValue,
43227
+ optionLabel,
43228
+ optionIcon,
43229
+ optionDisabled,
43230
+ optionTooltip,
43231
+ optionMeta
43232
+ },
43233
+ autoCap
43234
+ )
43235
+ ),
43236
+ [
43237
+ options,
43238
+ optionValue,
43239
+ optionLabel,
43240
+ optionIcon,
43241
+ optionDisabled,
43242
+ optionTooltip,
43243
+ optionMeta,
43244
+ autoCap
43245
+ ]
43246
+ );
43247
+ const handleChange = React54.useCallback(
43248
+ (val) => {
43249
+ if (readOnly) return;
43250
+ if (!onValue) return;
43251
+ let rawSelection;
43252
+ if (Array.isArray(val)) {
43253
+ const selected = normalizedOptions.filter(
43254
+ (entry) => val.includes(entry.ui.value)
43255
+ );
43256
+ rawSelection = selected.map((entry) => entry.raw);
43257
+ } else {
43258
+ const found = normalizedOptions.find(
43259
+ (entry) => entry.ui.value === val
43260
+ );
43261
+ rawSelection = found == null ? void 0 : found.raw;
43262
+ }
43263
+ const detail = {
43264
+ source: "variant",
43265
+ raw: rawSelection,
43266
+ // original item(s)
43267
+ nativeEvent: void 0,
43268
+ meta: { action: "toggle" }
43269
+ };
43270
+ onValue(val, detail);
43271
+ },
43272
+ [onValue, readOnly, normalizedOptions]
43273
+ );
43274
+ const layoutClasses = cn(
43275
+ layout === "horizontal" && "flex flex-wrap",
43276
+ layout === "vertical" && "flex flex-col items-stretch",
43277
+ layout === "grid" && "grid",
43278
+ fullWidth && "w-full",
43279
+ fullWidth && layout === "horizontal" && "[&>*]:flex-1",
43280
+ fullWidth && layout === "vertical" && "[&>*]:w-full",
43281
+ className
43282
+ );
43283
+ console.log(layoutClasses, fullWidth, autoCap);
43284
+ const groupStyle = React54.useMemo(() => {
43285
+ const style = {};
43286
+ if (layout === "grid") {
43287
+ style.gridTemplateColumns = `repeat(${gridCols}, minmax(0, 1fr))`;
43288
+ }
43289
+ if (typeof itemGapPx === "number") {
43290
+ style.gap = itemGapPx;
43291
+ }
43292
+ return Object.keys(style).length ? style : void 0;
43293
+ }, [layout, gridCols, itemGapPx]);
43294
+ return /* @__PURE__ */ jsx(
43295
+ ToggleGroup2,
43296
+ {
43297
+ ref,
43298
+ type: multiple ? "multiple" : "single",
43299
+ value: currentValue,
43300
+ onValueChange: handleChange,
43301
+ disabled: isDisabled,
43302
+ variant,
43303
+ size: toggleSize,
43304
+ className: layoutClasses,
43305
+ style: groupStyle,
43306
+ "aria-invalid": !!error,
43307
+ children: normalizedOptions.map(({ ui: opt }) => {
43308
+ const isSelected = multiple ? currentValue.includes(opt.value) : currentValue === opt.value;
43309
+ const contentNode = renderOption ? renderOption(opt, isSelected) : /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 truncate", children: [
43310
+ opt.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: opt.icon }),
43311
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: opt.label })
43312
+ ] });
43313
+ const itemNode = /* @__PURE__ */ jsx(
43314
+ ToggleGroupItem2,
43315
+ {
43316
+ value: opt.value,
43317
+ disabled: opt.disabled,
43318
+ "aria-label": typeof opt.label === "string" ? opt.label : opt.value,
43319
+ className: cn(
43320
+ // Base Transitions
43321
+ "transition-all",
43322
+ // Default Active State (Shadcn defaults)
43323
+ "data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",
43324
+ // Error State
43325
+ error && "border-destructive/50 hover:bg-destructive/10 data-[state=on]:bg-destructive data-[state=on]:text-destructive-foreground",
43326
+ // Variant: Outline specific tweaks
43327
+ variant === "outline" && layout === "horizontal" && !fullWidth && "first:rounded-l-md last:rounded-r-md rounded-none border-l-0 first:border-l",
43328
+ // Layout tweaks
43329
+ fullWidth && "justify-center",
43330
+ // Custom Item Class
43331
+ itemClassName,
43332
+ // Active Class Name (Applied only when selected)
43333
+ isSelected && activeClassName
43334
+ ),
43335
+ children: contentNode
43336
+ },
43337
+ opt.value
43338
+ );
43339
+ if (opt.tooltip && !isDisabled) {
43340
+ return /* @__PURE__ */ jsx(TooltipProvider2, { delayDuration: 300, children: /* @__PURE__ */ jsxs(Tooltip2, { children: [
43341
+ /* @__PURE__ */ jsx(TooltipTrigger2, { asChild: true, children: itemNode }),
43342
+ /* @__PURE__ */ jsx(TooltipContent2, { children: /* @__PURE__ */ jsx("p", { children: opt.tooltip }) })
43343
+ ] }) }, opt.value);
43344
+ }
43345
+ return itemNode;
43346
+ })
43347
+ }
43348
+ );
43349
+ });
43350
+ ShadcnToggleVariant3.displayName = "ShadcnToggleVariant";
43351
+
43352
+ // src/variants/core/toggle-group.tsx
43353
+ var toggleGroupModule = {
43354
+ variant: "toggle-group",
43355
+ Variant: ShadcnToggleVariant3,
43356
+ meta: {
43357
+ label: "Toggle group",
43358
+ description: "Toggle group component buttons.",
43359
+ tags: ["buttons", "toggle"]
43360
+ }
43361
+ };
41912
43362
 
41913
43363
  // src/variants/index.ts
41914
43364
  var variants = [
@@ -41929,13 +43379,14 @@ var variants = [
41929
43379
  keyValueModule,
41930
43380
  custom_default,
41931
43381
  treeselect_default2,
41932
- fileManagerModule
43382
+ fileManagerModule,
43383
+ toggleGroupModule
41933
43384
  ];
41934
43385
  function registerCoreVariants() {
41935
43386
  variants.forEach((item) => registerVariant(item));
41936
43387
  }
41937
43388
  registerCoreVariants();
41938
- var NODES16 = [
43389
+ var NODES19 = [
41939
43390
  "a",
41940
43391
  "button",
41941
43392
  "div",
@@ -41954,7 +43405,7 @@ var NODES16 = [
41954
43405
  "svg",
41955
43406
  "ul"
41956
43407
  ];
41957
- var Primitive16 = NODES16.reduce((primitive, node) => {
43408
+ var Primitive19 = NODES19.reduce((primitive, node) => {
41958
43409
  const Slot5 = createSlot10(`Primitive.${node}`);
41959
43410
  const Node2 = React54.forwardRef((props, forwardedRef) => {
41960
43411
  const { asChild, ...primitiveProps } = props;
@@ -41967,10 +43418,10 @@ var Primitive16 = NODES16.reduce((primitive, node) => {
41967
43418
  Node2.displayName = `Primitive.${node}`;
41968
43419
  return { ...primitive, [node]: Node2 };
41969
43420
  }, {});
41970
- var NAME3 = "Label";
43421
+ var NAME4 = "Label";
41971
43422
  var Label2 = React54.forwardRef((props, forwardedRef) => {
41972
43423
  return /* @__PURE__ */ jsx(
41973
- Primitive16.label,
43424
+ Primitive19.label,
41974
43425
  {
41975
43426
  ...props,
41976
43427
  ref: forwardedRef,
@@ -41984,14 +43435,14 @@ var Label2 = React54.forwardRef((props, forwardedRef) => {
41984
43435
  }
41985
43436
  );
41986
43437
  });
41987
- Label2.displayName = NAME3;
41988
- var Root9 = Label2;
43438
+ Label2.displayName = NAME4;
43439
+ var Root10 = Label2;
41989
43440
  function Label3({
41990
43441
  className,
41991
43442
  ...props
41992
43443
  }) {
41993
43444
  return /* @__PURE__ */ jsx(
41994
- Root9,
43445
+ Root10,
41995
43446
  {
41996
43447
  "data-slot": "label",
41997
43448
  className: cn(
@@ -42731,7 +44182,7 @@ function InputField(props) {
42731
44182
  ].filter(Boolean).join(" ");
42732
44183
  const hasStackedLabelBlock = lp !== "hidden" && hasAnyLabelBlockContent;
42733
44184
  const stackedGroupClassName = [
42734
- hasStackedLabelBlock && hasLabelRowContent ? "mt-1" : null,
44185
+ hasStackedLabelBlock && hasLabelRowContent ? "mt-0.5" : null,
42735
44186
  classes == null ? void 0 : classes.group
42736
44187
  ].filter(Boolean).join(" ");
42737
44188
  const Element2 = contain ? "div" : React54.Fragment;