@timeax/form-palette 0.0.14 → 0.0.16

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.js CHANGED
@@ -14089,749 +14089,259 @@ function CoreRoot(props) {
14089
14089
  children
14090
14090
  ] });
14091
14091
  }
14092
- function CoreShell(props) {
14093
- const { formProps, children, ...coreProps } = props;
14094
- return /* @__PURE__ */ jsxRuntime.jsx(CoreProvider, { ...coreProps, children: /* @__PURE__ */ jsxRuntime.jsx(CoreRoot, { ...formProps != null ? formProps : {}, children }) });
14092
+
14093
+ // ../../node_modules/clsx/dist/clsx.mjs
14094
+ function r(e) {
14095
+ var t, f, n = "";
14096
+ if ("string" == typeof e || "number" == typeof e) n += e;
14097
+ else if ("object" == typeof e) if (Array.isArray(e)) {
14098
+ var o = e.length;
14099
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
14100
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
14101
+ return n;
14095
14102
  }
14096
- function useButton(options) {
14097
- const form = useCoreContext();
14098
- const { name, submit, disabled: disabledProp = false, onClick } = options;
14099
- const [loading, setLoadingState] = React54__namespace.useState(false);
14100
- const [disabled, setDisabledState] = React54__namespace.useState(
14101
- Boolean(disabledProp)
14102
- );
14103
- const ref = React54__namespace.useRef(null);
14104
- const optsRef = React54__namespace.useRef(options);
14105
- React54__namespace.useEffect(() => {
14106
- optsRef.current = options;
14107
- }, [options]);
14108
- const buttonRef = React54__namespace.useRef(null);
14109
- if (!buttonRef.current) {
14110
- const btn = {
14111
- name,
14112
- // Accessor for "loading" as required by ButtonRef
14113
- set loading(v) {
14114
- setLoadingState(v);
14115
- },
14116
- // Accessor for "disable" (note: interface uses `disable`, not `disabled`)
14117
- //@ts-ignore
14118
- set disable(v) {
14119
- setDisabledState(v);
14120
- },
14121
- // Extra properties used by CoreProvider via any-casts
14122
- get loading() {
14123
- return loading;
14124
- },
14125
- setDisabled(v) {
14126
- setDisabledState(v);
14127
- },
14128
- get disabled() {
14129
- return disabled;
14130
- },
14131
- ref
14132
- };
14133
- btn.setLoading = (v) => {
14134
- setLoadingState(v);
14135
- };
14136
- buttonRef.current = btn;
14103
+ function clsx() {
14104
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
14105
+ return n;
14106
+ }
14107
+
14108
+ // ../../node_modules/tailwind-merge/dist/bundle-mjs.mjs
14109
+ var concatArrays = (array1, array2) => {
14110
+ const combinedArray = new Array(array1.length + array2.length);
14111
+ for (let i = 0; i < array1.length; i++) {
14112
+ combinedArray[i] = array1[i];
14137
14113
  }
14138
- React54__namespace.useEffect(() => {
14139
- if (!buttonRef.current) return;
14140
- buttonRef.current.name = name;
14141
- }, [name]);
14142
- React54__namespace.useEffect(() => {
14143
- if (!buttonRef.current) return;
14144
- form.button = buttonRef.current;
14145
- return () => {
14146
- const anyForm = form;
14147
- if (anyForm.button === buttonRef.current) {
14148
- anyForm.button = null;
14149
- }
14150
- };
14151
- }, [form]);
14152
- const handleClick = (event) => {
14153
- const currentOpts = optsRef.current;
14154
- const shouldSubmit = !!currentOpts.submit;
14155
- if (currentOpts.onClick) {
14156
- currentOpts.onClick(event, form);
14157
- }
14158
- if (event.defaultPrevented) {
14159
- return;
14160
- }
14161
- if (shouldSubmit) {
14162
- form.setActiveButton(currentOpts.name);
14163
- form.go();
14114
+ for (let i = 0; i < array2.length; i++) {
14115
+ combinedArray[array1.length + i] = array2[i];
14116
+ }
14117
+ return combinedArray;
14118
+ };
14119
+ var createClassValidatorObject = (classGroupId, validator) => ({
14120
+ classGroupId,
14121
+ validator
14122
+ });
14123
+ var createClassPartObject = (nextPart = /* @__PURE__ */ new Map(), validators3 = null, classGroupId) => ({
14124
+ nextPart,
14125
+ validators: validators3,
14126
+ classGroupId
14127
+ });
14128
+ var CLASS_PART_SEPARATOR = "-";
14129
+ var EMPTY_CONFLICTS = [];
14130
+ var ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
14131
+ var createClassGroupUtils = (config3) => {
14132
+ const classMap = createClassMap(config3);
14133
+ const {
14134
+ conflictingClassGroups,
14135
+ conflictingClassGroupModifiers
14136
+ } = config3;
14137
+ const getClassGroupId = (className) => {
14138
+ if (className.startsWith("[") && className.endsWith("]")) {
14139
+ return getGroupIdForArbitraryProperty(className);
14164
14140
  }
14141
+ const classParts = className.split(CLASS_PART_SEPARATOR);
14142
+ const startIndex = classParts[0] === "" && classParts.length > 1 ? 1 : 0;
14143
+ return getGroupRecursive(classParts, startIndex, classMap);
14165
14144
  };
14166
- const setLoading = (v) => {
14167
- setLoadingState(v);
14168
- };
14169
- const setDisabled = (v) => {
14170
- setDisabledState(v);
14145
+ const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
14146
+ if (hasPostfixModifier) {
14147
+ const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
14148
+ const baseConflicts = conflictingClassGroups[classGroupId];
14149
+ if (modifierConflicts) {
14150
+ if (baseConflicts) {
14151
+ return concatArrays(baseConflicts, modifierConflicts);
14152
+ }
14153
+ return modifierConflicts;
14154
+ }
14155
+ return baseConflicts || EMPTY_CONFLICTS;
14156
+ }
14157
+ return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
14171
14158
  };
14172
14159
  return {
14173
- loading,
14174
- setLoading,
14175
- disabled,
14176
- setDisabled,
14177
- ref,
14178
- onClick: handleClick,
14179
- buttonProps: {
14180
- ref,
14181
- disabled: disabled || loading,
14182
- "data-loading": loading ? "true" : "false",
14183
- onClick: handleClick
14184
- }
14160
+ getClassGroupId,
14161
+ getConflictingClassGroupIds
14185
14162
  };
14186
- }
14187
- function useField(options) {
14188
- var _a;
14189
- const form = useCoreContext();
14163
+ };
14164
+ var getGroupRecursive = (classParts, startIndex, classPartObject) => {
14165
+ const classPathsLength = classParts.length - startIndex;
14166
+ if (classPathsLength === 0) {
14167
+ return classPartObject.classGroupId;
14168
+ }
14169
+ const currentClassPart = classParts[startIndex];
14170
+ const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
14171
+ if (nextClassPartObject) {
14172
+ const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
14173
+ if (result) return result;
14174
+ }
14175
+ const validators3 = classPartObject.validators;
14176
+ if (validators3 === null) {
14177
+ return void 0;
14178
+ }
14179
+ const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
14180
+ const validatorsLength = validators3.length;
14181
+ for (let i = 0; i < validatorsLength; i++) {
14182
+ const validatorObj = validators3[i];
14183
+ if (validatorObj.validator(classRest)) {
14184
+ return validatorObj.classGroupId;
14185
+ }
14186
+ }
14187
+ return void 0;
14188
+ };
14189
+ var getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
14190
+ const content = className.slice(1, -1);
14191
+ const colonIndex = content.indexOf(":");
14192
+ const property = content.slice(0, colonIndex);
14193
+ return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
14194
+ })();
14195
+ var createClassMap = (config3) => {
14190
14196
  const {
14191
- name: rawName,
14192
- bindId: rawBindId,
14193
- bind: bind2,
14194
- shared,
14195
- groupId,
14196
- alias,
14197
- main,
14198
- ignore,
14199
- required: requiredProp = false,
14200
- defaultValue,
14201
- disabled: disabledProp = false,
14202
- readOnly: readOnlyProp = false,
14203
- validate,
14204
- getOriginalValue,
14205
- onValueChange
14206
- } = options;
14207
- const ref = React54__namespace.useRef(null);
14208
- const stateRef = React54__namespace.useRef({
14209
- value: defaultValue,
14210
- error: "",
14211
- loading: false,
14212
- original: getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
14213
- });
14214
- const [value, setValueState] = React54__namespace.useState(
14215
- stateRef.current.value
14216
- );
14217
- const [error, setErrorState] = React54__namespace.useState(
14218
- stateRef.current.error
14219
- );
14220
- const [loading, setLoadingState] = React54__namespace.useState(
14221
- stateRef.current.loading
14222
- );
14223
- const [required, setRequired] = React54__namespace.useState(
14224
- Boolean(requiredProp)
14225
- );
14226
- const [disabled, setDisabled] = React54__namespace.useState(
14227
- Boolean(disabledProp)
14228
- );
14229
- const [readOnly, setReadOnly] = React54__namespace.useState(
14230
- Boolean(readOnlyProp)
14231
- );
14232
- const id = React54__namespace.useId();
14233
- const keyRef = React54__namespace.useRef((() => {
14234
- if (rawName && rawName.trim()) return `${rawName.trim()}-${id}`;
14235
- if (rawBindId && rawBindId.trim()) return `${rawBindId.trim()}-${id}`;
14236
- return `field-${Math.random().toString(36).slice(2)}-${id}`;
14237
- })());
14238
- const bindIdRef = React54__namespace.useRef(
14239
- rawBindId && rawBindId.trim() || keyRef.current
14240
- );
14241
- const fieldRef = React54__namespace.useRef(null);
14242
- if (!fieldRef.current) {
14243
- const key = keyRef.current;
14244
- const bindId = bindIdRef.current;
14245
- const trimmedName = (_a = rawName == null ? void 0 : rawName.trim()) != null ? _a : "";
14246
- const validateFn = (report) => {
14247
- const curDisabled = disabled || readOnly;
14248
- if (curDisabled && !report) {
14249
- return true;
14250
- }
14251
- const current = stateRef.current.value;
14252
- let ok = true;
14253
- let message2 = "";
14254
- if (required && (current === void 0 || current === null || typeof current === "string" && current.trim() === "" || Array.isArray(current) && current.length === 0)) {
14255
- ok = false;
14256
- message2 = "This field is required.";
14257
- } else if (validate) {
14258
- const result = validate(current, !!report);
14259
- if (typeof result === "string") {
14260
- ok = false;
14261
- message2 = result;
14262
- } else if (result === false) {
14263
- ok = false;
14264
- }
14265
- }
14266
- if (!report) {
14267
- return ok;
14268
- }
14269
- stateRef.current.error = ok ? "" : message2;
14270
- setErrorState(ok ? "" : message2);
14271
- return ok;
14272
- };
14273
- const f = {
14274
- key,
14275
- bindId,
14276
- bind: bind2,
14277
- name: trimmedName,
14278
- shared,
14279
- groupId,
14280
- alias,
14281
- main,
14282
- ignore,
14283
- required,
14284
- ref,
14285
- get defaultValue() {
14286
- return stateRef.current.original;
14287
- },
14288
- get value() {
14289
- return stateRef.current.value;
14290
- },
14291
- set value(v) {
14292
- stateRef.current.value = v;
14293
- setValueState(v);
14294
- },
14295
- get originalValue() {
14296
- return stateRef.current.original;
14297
- },
14298
- get error() {
14299
- return stateRef.current.error;
14300
- },
14301
- set error(msg) {
14302
- stateRef.current.error = msg;
14303
- setErrorState(msg);
14304
- },
14305
- get loading() {
14306
- return stateRef.current.loading;
14307
- },
14308
- set loading(v) {
14309
- stateRef.current.loading = v;
14310
- setLoadingState(v);
14311
- },
14312
- validate: validateFn,
14313
- onChange(value2, old, variant) {
14314
- if (onValueChange) {
14315
- onValueChange(value2, old, variant);
14316
- }
14317
- }
14318
- // Flags not directly on the Field interface but used via `as any`
14319
- // in core-provider (getValue/setValue/reset).
14320
- };
14321
- f.getValue = () => stateRef.current.value;
14322
- f.setValue = (next) => {
14323
- stateRef.current.value = next;
14324
- setValueState(next);
14325
- };
14326
- f.reset = () => {
14327
- stateRef.current.value = defaultValue;
14328
- stateRef.current.error = "";
14329
- stateRef.current.loading = false;
14330
- setValueState(defaultValue);
14331
- setErrorState("");
14332
- setLoadingState(false);
14333
- };
14334
- fieldRef.current = f;
14197
+ theme,
14198
+ classGroups
14199
+ } = config3;
14200
+ return processClassGroups(classGroups, theme);
14201
+ };
14202
+ var processClassGroups = (classGroups, theme) => {
14203
+ const classMap = createClassPartObject();
14204
+ for (const classGroupId in classGroups) {
14205
+ const group = classGroups[classGroupId];
14206
+ processClassesRecursively(group, classMap, classGroupId, theme);
14335
14207
  }
14336
- const field = fieldRef.current;
14337
- React54__namespace.useEffect(() => {
14338
- setRequired(!!requiredProp);
14339
- if (field) {
14340
- field.required = !!requiredProp;
14341
- }
14342
- }, [requiredProp, field]);
14343
- React54__namespace.useEffect(() => {
14344
- setDisabled(!!disabledProp);
14345
- }, [disabledProp]);
14346
- React54__namespace.useEffect(() => {
14347
- setReadOnly(!!readOnlyProp);
14348
- }, [readOnlyProp]);
14349
- React54__namespace.useEffect(() => {
14350
- if (!field) return;
14351
- form.addField(field);
14352
- return () => {
14353
- const registry3 = form.inputs;
14354
- if (registry3 && typeof registry3.remove === "function") {
14355
- registry3.remove(field.key);
14356
- }
14357
- };
14358
- }, [form, field]);
14359
- function setValue(next, variant = "direct") {
14360
- var _a2;
14361
- const prev = stateRef.current.value;
14362
- if (Object.is(prev, next)) return;
14363
- const runFormOnChange = () => {
14364
- var _a3;
14365
- const props2 = (_a3 = form.props) != null ? _a3 : {};
14366
- const fn = props2.onChange;
14367
- if (!fn) return;
14368
- fn(form, field, {
14369
- variant,
14370
- value: next,
14371
- previous: prev
14372
- });
14373
- };
14374
- const props = (_a2 = form.props) != null ? _a2 : {};
14375
- const changeBefore = !!props.changeBefore;
14376
- if (changeBefore) {
14377
- runFormOnChange();
14378
- }
14379
- stateRef.current.value = next;
14380
- setValueState(next);
14381
- if (field.onChange) {
14382
- field.onChange(next, prev, variant);
14383
- }
14384
- if (!changeBefore) {
14385
- runFormOnChange();
14386
- }
14387
- form.controlButton();
14208
+ return classMap;
14209
+ };
14210
+ var processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
14211
+ const len = classGroup.length;
14212
+ for (let i = 0; i < len; i++) {
14213
+ const classDefinition = classGroup[i];
14214
+ processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
14388
14215
  }
14389
- function setError(message2) {
14390
- stateRef.current.error = message2;
14391
- setErrorState(message2);
14216
+ };
14217
+ var processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14218
+ if (typeof classDefinition === "string") {
14219
+ processStringDefinition(classDefinition, classPartObject, classGroupId);
14220
+ return;
14392
14221
  }
14393
- function setLoading(loading2) {
14394
- stateRef.current.loading = loading2;
14395
- setLoadingState(loading2);
14222
+ if (typeof classDefinition === "function") {
14223
+ processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
14224
+ return;
14396
14225
  }
14397
- return {
14398
- ref,
14399
- get key() {
14400
- return keyRef.current;
14401
- },
14402
- value,
14403
- setValue,
14404
- error,
14405
- setError,
14406
- loading,
14407
- setLoading,
14408
- required,
14409
- setRequired,
14410
- disabled,
14411
- setDisabled,
14412
- readOnly,
14413
- setReadOnly,
14414
- name: field.name,
14415
- bindId: field.bindId,
14416
- bind: field.bind,
14417
- shared: field.shared,
14418
- groupId: field.groupId,
14419
- alias: field.alias,
14420
- main: field.main,
14421
- ignore: field.ignore,
14422
- get defaultValue() {
14423
- return stateRef.current.original;
14424
- },
14425
- get originalValue() {
14426
- return stateRef.current.original;
14427
- },
14428
- form,
14429
- validate(report) {
14430
- var _a2;
14431
- return (_a2 = field.validate) == null ? void 0 : _a2.call(field, report);
14226
+ processObjectDefinition(classDefinition, classPartObject, classGroupId, theme);
14227
+ };
14228
+ var processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
14229
+ const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
14230
+ classPartObjectToEdit.classGroupId = classGroupId;
14231
+ };
14232
+ var processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14233
+ if (isThemeGetter(classDefinition)) {
14234
+ processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
14235
+ return;
14236
+ }
14237
+ if (classPartObject.validators === null) {
14238
+ classPartObject.validators = [];
14239
+ }
14240
+ classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
14241
+ };
14242
+ var processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14243
+ const entries = Object.entries(classDefinition);
14244
+ const len = entries.length;
14245
+ for (let i = 0; i < len; i++) {
14246
+ const [key, value] = entries[i];
14247
+ processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
14248
+ }
14249
+ };
14250
+ var getPart = (classPartObject, path) => {
14251
+ let current = classPartObject;
14252
+ const parts = path.split(CLASS_PART_SEPARATOR);
14253
+ const len = parts.length;
14254
+ for (let i = 0; i < len; i++) {
14255
+ const part = parts[i];
14256
+ let next = current.nextPart.get(part);
14257
+ if (!next) {
14258
+ next = createClassPartObject();
14259
+ current.nextPart.set(part, next);
14432
14260
  }
14433
- };
14434
- }
14435
- function useOptionalField(options) {
14436
- var _a;
14437
- try {
14438
- return useField(options);
14439
- } catch {
14261
+ current = next;
14440
14262
  }
14441
- {
14442
- console.warn(
14443
- "[FormPalette] useOptionalField: No CoreProvider found. Running in self-managed mode."
14444
- );
14263
+ return current;
14264
+ };
14265
+ var isThemeGetter = (func) => "isThemeGetter" in func && func.isThemeGetter === true;
14266
+ var createLruCache = (maxCacheSize) => {
14267
+ if (maxCacheSize < 1) {
14268
+ return {
14269
+ get: () => void 0,
14270
+ set: () => {
14271
+ }
14272
+ };
14445
14273
  }
14446
- const {
14447
- name: rawName,
14448
- bindId: rawBindId,
14449
- bind: bind2,
14450
- shared,
14451
- groupId,
14452
- alias,
14453
- main,
14454
- ignore,
14455
- required: requiredProp = false,
14456
- defaultValue,
14457
- disabled: disabledProp = false,
14458
- readOnly: readOnlyProp = false,
14459
- validate,
14460
- getOriginalValue,
14461
- onValueChange
14462
- } = options;
14463
- const ref = React54__namespace.useRef(null);
14464
- const [value, setValueState] = React54__namespace.useState(defaultValue);
14465
- const [error, setErrorState] = React54__namespace.useState("");
14466
- const [loading, setLoadingState] = React54__namespace.useState(false);
14467
- const [required, setRequired] = React54__namespace.useState(!!requiredProp);
14468
- const [disabled, setDisabled] = React54__namespace.useState(!!disabledProp);
14469
- const [readOnly, setReadOnly] = React54__namespace.useState(!!readOnlyProp);
14470
- const originalRef = React54__namespace.useRef(
14471
- getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
14472
- );
14473
- const id = React54__namespace.useId();
14474
- const keyRef = React54__namespace.useRef("");
14475
- if (!keyRef.current) {
14476
- if (rawName && rawName.trim()) {
14477
- keyRef.current = `${rawName.trim()}-${id}`;
14478
- } else if (rawBindId && rawBindId.trim()) {
14479
- keyRef.current = `${rawBindId.trim()}-${id}`;
14480
- } else {
14481
- keyRef.current = `field-${Math.random().toString(36).slice(2)}-${id}`;
14482
- }
14483
- }
14484
- const bindIdRef = React54__namespace.useRef("");
14485
- if (!bindIdRef.current) {
14486
- bindIdRef.current = rawBindId && rawBindId.trim() || keyRef.current;
14487
- }
14488
- React54__namespace.useEffect(() => {
14489
- setRequired(!!requiredProp);
14490
- }, [requiredProp]);
14491
- React54__namespace.useEffect(() => {
14492
- setDisabled(!!disabledProp);
14493
- }, [disabledProp]);
14494
- React54__namespace.useEffect(() => {
14495
- setReadOnly(!!readOnlyProp);
14496
- }, [readOnlyProp]);
14497
- function setValue(next, variant = "direct") {
14498
- const prev = value;
14499
- if (Object.is(prev, next)) return;
14500
- setValueState(next);
14501
- if (onValueChange) {
14502
- onValueChange(next, prev, variant);
14503
- }
14504
- }
14505
- function setError(message2) {
14506
- setErrorState(message2);
14507
- }
14508
- function setLoading(next) {
14509
- setLoadingState(next);
14510
- }
14511
- function runValidate(report) {
14512
- const current = value;
14513
- let ok = true;
14514
- let message2 = "";
14515
- if (required && (current === void 0 || current === null || typeof current === "string" && current.trim() === "" || Array.isArray(current) && current.length === 0)) {
14516
- ok = false;
14517
- message2 = "This field is required.";
14518
- } else if (validate) {
14519
- const result = validate(current, !!report);
14520
- if (typeof result === "string") {
14521
- ok = false;
14522
- message2 = result;
14523
- } else if (result === false) {
14524
- ok = false;
14525
- }
14526
- }
14527
- if (report) {
14528
- setErrorState(ok ? "" : message2);
14274
+ let cacheSize = 0;
14275
+ let cache = /* @__PURE__ */ Object.create(null);
14276
+ let previousCache = /* @__PURE__ */ Object.create(null);
14277
+ const update = (key, value) => {
14278
+ cache[key] = value;
14279
+ cacheSize++;
14280
+ if (cacheSize > maxCacheSize) {
14281
+ cacheSize = 0;
14282
+ previousCache = cache;
14283
+ cache = /* @__PURE__ */ Object.create(null);
14529
14284
  }
14530
- return ok;
14531
- }
14532
- const dummyForm = {};
14285
+ };
14533
14286
  return {
14534
- ref,
14535
- get key() {
14536
- return keyRef.current;
14537
- },
14538
- value,
14539
- setValue,
14540
- error,
14541
- setError,
14542
- loading,
14543
- setLoading,
14544
- required,
14545
- setRequired,
14546
- disabled,
14547
- setDisabled,
14548
- readOnly,
14549
- setReadOnly,
14550
- name: (_a = rawName == null ? void 0 : rawName.trim()) != null ? _a : "",
14551
- bindId: bindIdRef.current,
14552
- bind: bind2,
14553
- shared,
14554
- groupId,
14555
- alias,
14556
- main,
14557
- ignore,
14558
- get defaultValue() {
14559
- return originalRef.current;
14560
- },
14561
- get originalValue() {
14562
- return originalRef.current;
14287
+ get(key) {
14288
+ let value = cache[key];
14289
+ if (value !== void 0) {
14290
+ return value;
14291
+ }
14292
+ if ((value = previousCache[key]) !== void 0) {
14293
+ update(key, value);
14294
+ return value;
14295
+ }
14563
14296
  },
14564
- form: dummyForm,
14565
- validate(report) {
14566
- return runValidate(report);
14297
+ set(key, value) {
14298
+ if (key in cache) {
14299
+ cache[key] = value;
14300
+ } else {
14301
+ update(key, value);
14302
+ }
14567
14303
  }
14568
14304
  };
14569
- }
14570
-
14571
- // src/variants/registry.ts
14572
- var registry2 = /* @__PURE__ */ new Map();
14573
- function registerVariant(module2) {
14574
- registry2.set(module2.variant, module2);
14575
- }
14576
- function getVariant(key) {
14577
- return registry2.get(key);
14578
- }
14579
- function listVariants() {
14580
- return Array.from(registry2.values());
14581
- }
14582
-
14583
- // ../../node_modules/clsx/dist/clsx.mjs
14584
- function r(e) {
14585
- var t, f, n = "";
14586
- if ("string" == typeof e || "number" == typeof e) n += e;
14587
- else if ("object" == typeof e) if (Array.isArray(e)) {
14588
- var o = e.length;
14589
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
14590
- } else for (f in e) e[f] && (n && (n += " "), n += f);
14591
- return n;
14592
- }
14593
- function clsx() {
14594
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
14595
- return n;
14596
- }
14597
-
14598
- // ../../node_modules/tailwind-merge/dist/bundle-mjs.mjs
14599
- var concatArrays = (array1, array2) => {
14600
- const combinedArray = new Array(array1.length + array2.length);
14601
- for (let i = 0; i < array1.length; i++) {
14602
- combinedArray[i] = array1[i];
14603
- }
14604
- for (let i = 0; i < array2.length; i++) {
14605
- combinedArray[array1.length + i] = array2[i];
14606
- }
14607
- return combinedArray;
14608
14305
  };
14609
- var createClassValidatorObject = (classGroupId, validator) => ({
14610
- classGroupId,
14611
- validator
14612
- });
14613
- var createClassPartObject = (nextPart = /* @__PURE__ */ new Map(), validators3 = null, classGroupId) => ({
14614
- nextPart,
14615
- validators: validators3,
14616
- classGroupId
14306
+ var IMPORTANT_MODIFIER = "!";
14307
+ var MODIFIER_SEPARATOR = ":";
14308
+ var EMPTY_MODIFIERS = [];
14309
+ var createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
14310
+ modifiers,
14311
+ hasImportantModifier,
14312
+ baseClassName,
14313
+ maybePostfixModifierPosition,
14314
+ isExternal
14617
14315
  });
14618
- var CLASS_PART_SEPARATOR = "-";
14619
- var EMPTY_CONFLICTS = [];
14620
- var ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
14621
- var createClassGroupUtils = (config3) => {
14622
- const classMap = createClassMap(config3);
14316
+ var createParseClassName = (config3) => {
14623
14317
  const {
14624
- conflictingClassGroups,
14625
- conflictingClassGroupModifiers
14318
+ prefix,
14319
+ experimentalParseClassName
14626
14320
  } = config3;
14627
- const getClassGroupId = (className) => {
14628
- if (className.startsWith("[") && className.endsWith("]")) {
14629
- return getGroupIdForArbitraryProperty(className);
14630
- }
14631
- const classParts = className.split(CLASS_PART_SEPARATOR);
14632
- const startIndex = classParts[0] === "" && classParts.length > 1 ? 1 : 0;
14633
- return getGroupRecursive(classParts, startIndex, classMap);
14634
- };
14635
- const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
14636
- if (hasPostfixModifier) {
14637
- const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
14638
- const baseConflicts = conflictingClassGroups[classGroupId];
14639
- if (modifierConflicts) {
14640
- if (baseConflicts) {
14641
- return concatArrays(baseConflicts, modifierConflicts);
14321
+ let parseClassName = (className) => {
14322
+ const modifiers = [];
14323
+ let bracketDepth = 0;
14324
+ let parenDepth = 0;
14325
+ let modifierStart = 0;
14326
+ let postfixModifierPosition;
14327
+ const len = className.length;
14328
+ for (let index2 = 0; index2 < len; index2++) {
14329
+ const currentCharacter = className[index2];
14330
+ if (bracketDepth === 0 && parenDepth === 0) {
14331
+ if (currentCharacter === MODIFIER_SEPARATOR) {
14332
+ modifiers.push(className.slice(modifierStart, index2));
14333
+ modifierStart = index2 + 1;
14334
+ continue;
14335
+ }
14336
+ if (currentCharacter === "/") {
14337
+ postfixModifierPosition = index2;
14338
+ continue;
14642
14339
  }
14643
- return modifierConflicts;
14644
14340
  }
14645
- return baseConflicts || EMPTY_CONFLICTS;
14646
- }
14647
- return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
14648
- };
14649
- return {
14650
- getClassGroupId,
14651
- getConflictingClassGroupIds
14652
- };
14653
- };
14654
- var getGroupRecursive = (classParts, startIndex, classPartObject) => {
14655
- const classPathsLength = classParts.length - startIndex;
14656
- if (classPathsLength === 0) {
14657
- return classPartObject.classGroupId;
14658
- }
14659
- const currentClassPart = classParts[startIndex];
14660
- const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
14661
- if (nextClassPartObject) {
14662
- const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
14663
- if (result) return result;
14664
- }
14665
- const validators3 = classPartObject.validators;
14666
- if (validators3 === null) {
14667
- return void 0;
14668
- }
14669
- const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
14670
- const validatorsLength = validators3.length;
14671
- for (let i = 0; i < validatorsLength; i++) {
14672
- const validatorObj = validators3[i];
14673
- if (validatorObj.validator(classRest)) {
14674
- return validatorObj.classGroupId;
14675
- }
14676
- }
14677
- return void 0;
14678
- };
14679
- var getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
14680
- const content = className.slice(1, -1);
14681
- const colonIndex = content.indexOf(":");
14682
- const property = content.slice(0, colonIndex);
14683
- return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
14684
- })();
14685
- var createClassMap = (config3) => {
14686
- const {
14687
- theme,
14688
- classGroups
14689
- } = config3;
14690
- return processClassGroups(classGroups, theme);
14691
- };
14692
- var processClassGroups = (classGroups, theme) => {
14693
- const classMap = createClassPartObject();
14694
- for (const classGroupId in classGroups) {
14695
- const group = classGroups[classGroupId];
14696
- processClassesRecursively(group, classMap, classGroupId, theme);
14697
- }
14698
- return classMap;
14699
- };
14700
- var processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
14701
- const len = classGroup.length;
14702
- for (let i = 0; i < len; i++) {
14703
- const classDefinition = classGroup[i];
14704
- processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
14705
- }
14706
- };
14707
- var processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14708
- if (typeof classDefinition === "string") {
14709
- processStringDefinition(classDefinition, classPartObject, classGroupId);
14710
- return;
14711
- }
14712
- if (typeof classDefinition === "function") {
14713
- processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
14714
- return;
14715
- }
14716
- processObjectDefinition(classDefinition, classPartObject, classGroupId, theme);
14717
- };
14718
- var processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
14719
- const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
14720
- classPartObjectToEdit.classGroupId = classGroupId;
14721
- };
14722
- var processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14723
- if (isThemeGetter(classDefinition)) {
14724
- processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
14725
- return;
14726
- }
14727
- if (classPartObject.validators === null) {
14728
- classPartObject.validators = [];
14729
- }
14730
- classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
14731
- };
14732
- var processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14733
- const entries = Object.entries(classDefinition);
14734
- const len = entries.length;
14735
- for (let i = 0; i < len; i++) {
14736
- const [key, value] = entries[i];
14737
- processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
14738
- }
14739
- };
14740
- var getPart = (classPartObject, path) => {
14741
- let current = classPartObject;
14742
- const parts = path.split(CLASS_PART_SEPARATOR);
14743
- const len = parts.length;
14744
- for (let i = 0; i < len; i++) {
14745
- const part = parts[i];
14746
- let next = current.nextPart.get(part);
14747
- if (!next) {
14748
- next = createClassPartObject();
14749
- current.nextPart.set(part, next);
14750
- }
14751
- current = next;
14752
- }
14753
- return current;
14754
- };
14755
- var isThemeGetter = (func) => "isThemeGetter" in func && func.isThemeGetter === true;
14756
- var createLruCache = (maxCacheSize) => {
14757
- if (maxCacheSize < 1) {
14758
- return {
14759
- get: () => void 0,
14760
- set: () => {
14761
- }
14762
- };
14763
- }
14764
- let cacheSize = 0;
14765
- let cache = /* @__PURE__ */ Object.create(null);
14766
- let previousCache = /* @__PURE__ */ Object.create(null);
14767
- const update = (key, value) => {
14768
- cache[key] = value;
14769
- cacheSize++;
14770
- if (cacheSize > maxCacheSize) {
14771
- cacheSize = 0;
14772
- previousCache = cache;
14773
- cache = /* @__PURE__ */ Object.create(null);
14774
- }
14775
- };
14776
- return {
14777
- get(key) {
14778
- let value = cache[key];
14779
- if (value !== void 0) {
14780
- return value;
14781
- }
14782
- if ((value = previousCache[key]) !== void 0) {
14783
- update(key, value);
14784
- return value;
14785
- }
14786
- },
14787
- set(key, value) {
14788
- if (key in cache) {
14789
- cache[key] = value;
14790
- } else {
14791
- update(key, value);
14792
- }
14793
- }
14794
- };
14795
- };
14796
- var IMPORTANT_MODIFIER = "!";
14797
- var MODIFIER_SEPARATOR = ":";
14798
- var EMPTY_MODIFIERS = [];
14799
- var createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
14800
- modifiers,
14801
- hasImportantModifier,
14802
- baseClassName,
14803
- maybePostfixModifierPosition,
14804
- isExternal
14805
- });
14806
- var createParseClassName = (config3) => {
14807
- const {
14808
- prefix,
14809
- experimentalParseClassName
14810
- } = config3;
14811
- let parseClassName = (className) => {
14812
- const modifiers = [];
14813
- let bracketDepth = 0;
14814
- let parenDepth = 0;
14815
- let modifierStart = 0;
14816
- let postfixModifierPosition;
14817
- const len = className.length;
14818
- for (let index2 = 0; index2 < len; index2++) {
14819
- const currentCharacter = className[index2];
14820
- if (bracketDepth === 0 && parenDepth === 0) {
14821
- if (currentCharacter === MODIFIER_SEPARATOR) {
14822
- modifiers.push(className.slice(modifierStart, index2));
14823
- modifierStart = index2 + 1;
14824
- continue;
14825
- }
14826
- if (currentCharacter === "/") {
14827
- postfixModifierPosition = index2;
14828
- continue;
14829
- }
14830
- }
14831
- if (currentCharacter === "[") bracketDepth++;
14832
- else if (currentCharacter === "]") bracketDepth--;
14833
- else if (currentCharacter === "(") parenDepth++;
14834
- else if (currentCharacter === ")") parenDepth--;
14341
+ if (currentCharacter === "[") bracketDepth++;
14342
+ else if (currentCharacter === "]") bracketDepth--;
14343
+ else if (currentCharacter === "(") parenDepth++;
14344
+ else if (currentCharacter === ")") parenDepth--;
14835
14345
  }
14836
14346
  const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
14837
14347
  let baseClassName = baseClassNameWithImportantModifier;
@@ -17546,67 +17056,577 @@ var getDefaultConfig = () => {
17546
17056
  "forced-color-adjust": ["auto", "none"]
17547
17057
  }]
17548
17058
  },
17549
- conflictingClassGroups: {
17550
- overflow: ["overflow-x", "overflow-y"],
17551
- overscroll: ["overscroll-x", "overscroll-y"],
17552
- inset: ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"],
17553
- "inset-x": ["right", "left"],
17554
- "inset-y": ["top", "bottom"],
17555
- flex: ["basis", "grow", "shrink"],
17556
- gap: ["gap-x", "gap-y"],
17557
- p: ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"],
17558
- px: ["pr", "pl"],
17559
- py: ["pt", "pb"],
17560
- m: ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"],
17561
- mx: ["mr", "ml"],
17562
- my: ["mt", "mb"],
17563
- size: ["w", "h"],
17564
- "font-size": ["leading"],
17565
- "fvn-normal": ["fvn-ordinal", "fvn-slashed-zero", "fvn-figure", "fvn-spacing", "fvn-fraction"],
17566
- "fvn-ordinal": ["fvn-normal"],
17567
- "fvn-slashed-zero": ["fvn-normal"],
17568
- "fvn-figure": ["fvn-normal"],
17569
- "fvn-spacing": ["fvn-normal"],
17570
- "fvn-fraction": ["fvn-normal"],
17571
- "line-clamp": ["display", "overflow"],
17572
- rounded: ["rounded-s", "rounded-e", "rounded-t", "rounded-r", "rounded-b", "rounded-l", "rounded-ss", "rounded-se", "rounded-ee", "rounded-es", "rounded-tl", "rounded-tr", "rounded-br", "rounded-bl"],
17573
- "rounded-s": ["rounded-ss", "rounded-es"],
17574
- "rounded-e": ["rounded-se", "rounded-ee"],
17575
- "rounded-t": ["rounded-tl", "rounded-tr"],
17576
- "rounded-r": ["rounded-tr", "rounded-br"],
17577
- "rounded-b": ["rounded-br", "rounded-bl"],
17578
- "rounded-l": ["rounded-tl", "rounded-bl"],
17579
- "border-spacing": ["border-spacing-x", "border-spacing-y"],
17580
- "border-w": ["border-w-x", "border-w-y", "border-w-s", "border-w-e", "border-w-t", "border-w-r", "border-w-b", "border-w-l"],
17581
- "border-w-x": ["border-w-r", "border-w-l"],
17582
- "border-w-y": ["border-w-t", "border-w-b"],
17583
- "border-color": ["border-color-x", "border-color-y", "border-color-s", "border-color-e", "border-color-t", "border-color-r", "border-color-b", "border-color-l"],
17584
- "border-color-x": ["border-color-r", "border-color-l"],
17585
- "border-color-y": ["border-color-t", "border-color-b"],
17586
- translate: ["translate-x", "translate-y", "translate-none"],
17587
- "translate-none": ["translate", "translate-x", "translate-y", "translate-z"],
17588
- "scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"],
17589
- "scroll-mx": ["scroll-mr", "scroll-ml"],
17590
- "scroll-my": ["scroll-mt", "scroll-mb"],
17591
- "scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"],
17592
- "scroll-px": ["scroll-pr", "scroll-pl"],
17593
- "scroll-py": ["scroll-pt", "scroll-pb"],
17594
- touch: ["touch-x", "touch-y", "touch-pz"],
17595
- "touch-x": ["touch"],
17596
- "touch-y": ["touch"],
17597
- "touch-pz": ["touch"]
17059
+ conflictingClassGroups: {
17060
+ overflow: ["overflow-x", "overflow-y"],
17061
+ overscroll: ["overscroll-x", "overscroll-y"],
17062
+ inset: ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"],
17063
+ "inset-x": ["right", "left"],
17064
+ "inset-y": ["top", "bottom"],
17065
+ flex: ["basis", "grow", "shrink"],
17066
+ gap: ["gap-x", "gap-y"],
17067
+ p: ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"],
17068
+ px: ["pr", "pl"],
17069
+ py: ["pt", "pb"],
17070
+ m: ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"],
17071
+ mx: ["mr", "ml"],
17072
+ my: ["mt", "mb"],
17073
+ size: ["w", "h"],
17074
+ "font-size": ["leading"],
17075
+ "fvn-normal": ["fvn-ordinal", "fvn-slashed-zero", "fvn-figure", "fvn-spacing", "fvn-fraction"],
17076
+ "fvn-ordinal": ["fvn-normal"],
17077
+ "fvn-slashed-zero": ["fvn-normal"],
17078
+ "fvn-figure": ["fvn-normal"],
17079
+ "fvn-spacing": ["fvn-normal"],
17080
+ "fvn-fraction": ["fvn-normal"],
17081
+ "line-clamp": ["display", "overflow"],
17082
+ rounded: ["rounded-s", "rounded-e", "rounded-t", "rounded-r", "rounded-b", "rounded-l", "rounded-ss", "rounded-se", "rounded-ee", "rounded-es", "rounded-tl", "rounded-tr", "rounded-br", "rounded-bl"],
17083
+ "rounded-s": ["rounded-ss", "rounded-es"],
17084
+ "rounded-e": ["rounded-se", "rounded-ee"],
17085
+ "rounded-t": ["rounded-tl", "rounded-tr"],
17086
+ "rounded-r": ["rounded-tr", "rounded-br"],
17087
+ "rounded-b": ["rounded-br", "rounded-bl"],
17088
+ "rounded-l": ["rounded-tl", "rounded-bl"],
17089
+ "border-spacing": ["border-spacing-x", "border-spacing-y"],
17090
+ "border-w": ["border-w-x", "border-w-y", "border-w-s", "border-w-e", "border-w-t", "border-w-r", "border-w-b", "border-w-l"],
17091
+ "border-w-x": ["border-w-r", "border-w-l"],
17092
+ "border-w-y": ["border-w-t", "border-w-b"],
17093
+ "border-color": ["border-color-x", "border-color-y", "border-color-s", "border-color-e", "border-color-t", "border-color-r", "border-color-b", "border-color-l"],
17094
+ "border-color-x": ["border-color-r", "border-color-l"],
17095
+ "border-color-y": ["border-color-t", "border-color-b"],
17096
+ translate: ["translate-x", "translate-y", "translate-none"],
17097
+ "translate-none": ["translate", "translate-x", "translate-y", "translate-z"],
17098
+ "scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"],
17099
+ "scroll-mx": ["scroll-mr", "scroll-ml"],
17100
+ "scroll-my": ["scroll-mt", "scroll-mb"],
17101
+ "scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"],
17102
+ "scroll-px": ["scroll-pr", "scroll-pl"],
17103
+ "scroll-py": ["scroll-pt", "scroll-pb"],
17104
+ touch: ["touch-x", "touch-y", "touch-pz"],
17105
+ "touch-x": ["touch"],
17106
+ "touch-y": ["touch"],
17107
+ "touch-pz": ["touch"]
17108
+ },
17109
+ conflictingClassGroupModifiers: {
17110
+ "font-size": ["leading"]
17111
+ },
17112
+ orderSensitiveModifiers: ["*", "**", "after", "backdrop", "before", "details-content", "file", "first-letter", "first-line", "marker", "placeholder", "selection"]
17113
+ };
17114
+ };
17115
+ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
17116
+
17117
+ // src/lib/utils.ts
17118
+ function cn(...inputs) {
17119
+ return twMerge(clsx(inputs));
17120
+ }
17121
+ function CoreShell(props) {
17122
+ if (props.wrapped) {
17123
+ const {
17124
+ formProps: formProps2,
17125
+ children: children2,
17126
+ wrapped,
17127
+ // eslint-disable-line @typescript-eslint/no-unused-vars
17128
+ gap,
17129
+ contentClassName,
17130
+ ...coreProps2
17131
+ } = props;
17132
+ const content = /* @__PURE__ */ jsxRuntime.jsx(
17133
+ "div",
17134
+ {
17135
+ className: cn("flex flex-col", contentClassName),
17136
+ style: gap !== void 0 ? { gap } : void 0,
17137
+ children: children2
17138
+ }
17139
+ );
17140
+ return /* @__PURE__ */ jsxRuntime.jsx(CoreProvider, { ...coreProps2, children: /* @__PURE__ */ jsxRuntime.jsx(CoreRoot, { ...formProps2 != null ? formProps2 : {}, children: content }) });
17141
+ }
17142
+ const { formProps, children, ...coreProps } = props;
17143
+ return /* @__PURE__ */ jsxRuntime.jsx(CoreProvider, { ...coreProps, children: /* @__PURE__ */ jsxRuntime.jsx(CoreRoot, { ...formProps != null ? formProps : {}, children }) });
17144
+ }
17145
+ function useButton(options) {
17146
+ const form = useCoreContext();
17147
+ const { name, submit, disabled: disabledProp = false, onClick } = options;
17148
+ const [loading, setLoadingState] = React54__namespace.useState(false);
17149
+ const [disabled, setDisabledState] = React54__namespace.useState(
17150
+ Boolean(disabledProp)
17151
+ );
17152
+ const ref = React54__namespace.useRef(null);
17153
+ const optsRef = React54__namespace.useRef(options);
17154
+ React54__namespace.useEffect(() => {
17155
+ optsRef.current = options;
17156
+ }, [options]);
17157
+ const buttonRef = React54__namespace.useRef(null);
17158
+ if (!buttonRef.current) {
17159
+ const btn = {
17160
+ name,
17161
+ // Accessor for "loading" as required by ButtonRef
17162
+ set loading(v) {
17163
+ setLoadingState(v);
17164
+ },
17165
+ // Accessor for "disable" (note: interface uses `disable`, not `disabled`)
17166
+ //@ts-ignore
17167
+ set disable(v) {
17168
+ setDisabledState(v);
17169
+ },
17170
+ // Extra properties used by CoreProvider via any-casts
17171
+ get loading() {
17172
+ return loading;
17173
+ },
17174
+ setDisabled(v) {
17175
+ setDisabledState(v);
17176
+ },
17177
+ get disabled() {
17178
+ return disabled;
17179
+ },
17180
+ ref
17181
+ };
17182
+ btn.setLoading = (v) => {
17183
+ setLoadingState(v);
17184
+ };
17185
+ buttonRef.current = btn;
17186
+ }
17187
+ React54__namespace.useEffect(() => {
17188
+ if (!buttonRef.current) return;
17189
+ buttonRef.current.name = name;
17190
+ }, [name]);
17191
+ React54__namespace.useEffect(() => {
17192
+ if (!buttonRef.current) return;
17193
+ form.button = buttonRef.current;
17194
+ return () => {
17195
+ const anyForm = form;
17196
+ if (anyForm.button === buttonRef.current) {
17197
+ anyForm.button = null;
17198
+ }
17199
+ };
17200
+ }, [form]);
17201
+ const handleClick = (event) => {
17202
+ const currentOpts = optsRef.current;
17203
+ const shouldSubmit = !!currentOpts.submit;
17204
+ if (currentOpts.onClick) {
17205
+ currentOpts.onClick(event, form);
17206
+ }
17207
+ if (event.defaultPrevented) {
17208
+ return;
17209
+ }
17210
+ if (shouldSubmit) {
17211
+ form.setActiveButton(currentOpts.name);
17212
+ form.go();
17213
+ }
17214
+ };
17215
+ const setLoading = (v) => {
17216
+ setLoadingState(v);
17217
+ };
17218
+ const setDisabled = (v) => {
17219
+ setDisabledState(v);
17220
+ };
17221
+ return {
17222
+ loading,
17223
+ setLoading,
17224
+ disabled,
17225
+ setDisabled,
17226
+ ref,
17227
+ onClick: handleClick,
17228
+ buttonProps: {
17229
+ ref,
17230
+ disabled: disabled || loading,
17231
+ "data-loading": loading ? "true" : "false",
17232
+ onClick: handleClick
17233
+ }
17234
+ };
17235
+ }
17236
+ function useField(options) {
17237
+ var _a;
17238
+ const form = useCoreContext();
17239
+ const {
17240
+ name: rawName,
17241
+ bindId: rawBindId,
17242
+ bind: bind2,
17243
+ shared,
17244
+ groupId,
17245
+ alias,
17246
+ main,
17247
+ ignore,
17248
+ required: requiredProp = false,
17249
+ defaultValue,
17250
+ disabled: disabledProp = false,
17251
+ readOnly: readOnlyProp = false,
17252
+ validate,
17253
+ getOriginalValue,
17254
+ onValueChange
17255
+ } = options;
17256
+ const ref = React54__namespace.useRef(null);
17257
+ const stateRef = React54__namespace.useRef({
17258
+ value: defaultValue,
17259
+ error: "",
17260
+ loading: false,
17261
+ original: getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
17262
+ });
17263
+ const [value, setValueState] = React54__namespace.useState(
17264
+ stateRef.current.value
17265
+ );
17266
+ const [error, setErrorState] = React54__namespace.useState(
17267
+ stateRef.current.error
17268
+ );
17269
+ const [loading, setLoadingState] = React54__namespace.useState(
17270
+ stateRef.current.loading
17271
+ );
17272
+ const [required, setRequired] = React54__namespace.useState(
17273
+ Boolean(requiredProp)
17274
+ );
17275
+ const [disabled, setDisabled] = React54__namespace.useState(
17276
+ Boolean(disabledProp)
17277
+ );
17278
+ const [readOnly, setReadOnly] = React54__namespace.useState(
17279
+ Boolean(readOnlyProp)
17280
+ );
17281
+ const id = React54__namespace.useId();
17282
+ const keyRef = React54__namespace.useRef((() => {
17283
+ if (rawName && rawName.trim()) return `${rawName.trim()}-${id}`;
17284
+ if (rawBindId && rawBindId.trim()) return `${rawBindId.trim()}-${id}`;
17285
+ return `field-${Math.random().toString(36).slice(2)}-${id}`;
17286
+ })());
17287
+ const bindIdRef = React54__namespace.useRef(
17288
+ rawBindId && rawBindId.trim() || keyRef.current
17289
+ );
17290
+ const fieldRef = React54__namespace.useRef(null);
17291
+ if (!fieldRef.current) {
17292
+ const key = keyRef.current;
17293
+ const bindId = bindIdRef.current;
17294
+ const trimmedName = (_a = rawName == null ? void 0 : rawName.trim()) != null ? _a : "";
17295
+ const validateFn = (report) => {
17296
+ const curDisabled = disabled || readOnly;
17297
+ if (curDisabled && !report) {
17298
+ return true;
17299
+ }
17300
+ const current = stateRef.current.value;
17301
+ let ok = true;
17302
+ let message2 = "";
17303
+ if (required && (current === void 0 || current === null || typeof current === "string" && current.trim() === "" || Array.isArray(current) && current.length === 0)) {
17304
+ ok = false;
17305
+ message2 = "This field is required.";
17306
+ } else if (validate) {
17307
+ const result = validate(current, !!report);
17308
+ if (typeof result === "string") {
17309
+ ok = false;
17310
+ message2 = result;
17311
+ } else if (result === false) {
17312
+ ok = false;
17313
+ }
17314
+ }
17315
+ if (!report) {
17316
+ return ok;
17317
+ }
17318
+ stateRef.current.error = ok ? "" : message2;
17319
+ setErrorState(ok ? "" : message2);
17320
+ return ok;
17321
+ };
17322
+ const f = {
17323
+ key,
17324
+ bindId,
17325
+ bind: bind2,
17326
+ name: trimmedName,
17327
+ shared,
17328
+ groupId,
17329
+ alias,
17330
+ main,
17331
+ ignore,
17332
+ required,
17333
+ ref,
17334
+ get defaultValue() {
17335
+ return stateRef.current.original;
17336
+ },
17337
+ get value() {
17338
+ return stateRef.current.value;
17339
+ },
17340
+ set value(v) {
17341
+ stateRef.current.value = v;
17342
+ setValueState(v);
17343
+ },
17344
+ get originalValue() {
17345
+ return stateRef.current.original;
17346
+ },
17347
+ get error() {
17348
+ return stateRef.current.error;
17349
+ },
17350
+ set error(msg) {
17351
+ stateRef.current.error = msg;
17352
+ setErrorState(msg);
17353
+ },
17354
+ get loading() {
17355
+ return stateRef.current.loading;
17356
+ },
17357
+ set loading(v) {
17358
+ stateRef.current.loading = v;
17359
+ setLoadingState(v);
17360
+ },
17361
+ validate: validateFn,
17362
+ onChange(value2, old, variant) {
17363
+ if (onValueChange) {
17364
+ onValueChange(value2, old, variant);
17365
+ }
17366
+ }
17367
+ // Flags not directly on the Field interface but used via `as any`
17368
+ // in core-provider (getValue/setValue/reset).
17369
+ };
17370
+ f.getValue = () => stateRef.current.value;
17371
+ f.setValue = (next) => {
17372
+ stateRef.current.value = next;
17373
+ setValueState(next);
17374
+ };
17375
+ f.reset = () => {
17376
+ stateRef.current.value = defaultValue;
17377
+ stateRef.current.error = "";
17378
+ stateRef.current.loading = false;
17379
+ setValueState(defaultValue);
17380
+ setErrorState("");
17381
+ setLoadingState(false);
17382
+ };
17383
+ fieldRef.current = f;
17384
+ }
17385
+ const field = fieldRef.current;
17386
+ React54__namespace.useEffect(() => {
17387
+ setRequired(!!requiredProp);
17388
+ if (field) {
17389
+ field.required = !!requiredProp;
17390
+ }
17391
+ }, [requiredProp, field]);
17392
+ React54__namespace.useEffect(() => {
17393
+ setDisabled(!!disabledProp);
17394
+ }, [disabledProp]);
17395
+ React54__namespace.useEffect(() => {
17396
+ setReadOnly(!!readOnlyProp);
17397
+ }, [readOnlyProp]);
17398
+ React54__namespace.useEffect(() => {
17399
+ if (!field) return;
17400
+ form.addField(field);
17401
+ return () => {
17402
+ const registry3 = form.inputs;
17403
+ if (registry3 && typeof registry3.remove === "function") {
17404
+ registry3.remove(field.key);
17405
+ }
17406
+ };
17407
+ }, [form, field]);
17408
+ function setValue(next, variant = "direct") {
17409
+ var _a2;
17410
+ const prev = stateRef.current.value;
17411
+ if (Object.is(prev, next)) return;
17412
+ const runFormOnChange = () => {
17413
+ var _a3;
17414
+ const props2 = (_a3 = form.props) != null ? _a3 : {};
17415
+ const fn = props2.onChange;
17416
+ if (!fn) return;
17417
+ fn(form, field, {
17418
+ variant,
17419
+ value: next,
17420
+ previous: prev
17421
+ });
17422
+ };
17423
+ const props = (_a2 = form.props) != null ? _a2 : {};
17424
+ const changeBefore = !!props.changeBefore;
17425
+ if (changeBefore) {
17426
+ runFormOnChange();
17427
+ }
17428
+ stateRef.current.value = next;
17429
+ setValueState(next);
17430
+ if (field.onChange) {
17431
+ field.onChange(next, prev, variant);
17432
+ }
17433
+ if (!changeBefore) {
17434
+ runFormOnChange();
17435
+ }
17436
+ form.controlButton();
17437
+ }
17438
+ function setError(message2) {
17439
+ stateRef.current.error = message2;
17440
+ setErrorState(message2);
17441
+ }
17442
+ function setLoading(loading2) {
17443
+ stateRef.current.loading = loading2;
17444
+ setLoadingState(loading2);
17445
+ }
17446
+ return {
17447
+ ref,
17448
+ get key() {
17449
+ return keyRef.current;
17450
+ },
17451
+ value,
17452
+ setValue,
17453
+ error,
17454
+ setError,
17455
+ loading,
17456
+ setLoading,
17457
+ required,
17458
+ setRequired,
17459
+ disabled,
17460
+ setDisabled,
17461
+ readOnly,
17462
+ setReadOnly,
17463
+ name: field.name,
17464
+ bindId: field.bindId,
17465
+ bind: field.bind,
17466
+ shared: field.shared,
17467
+ groupId: field.groupId,
17468
+ alias: field.alias,
17469
+ main: field.main,
17470
+ ignore: field.ignore,
17471
+ get defaultValue() {
17472
+ return stateRef.current.original;
17473
+ },
17474
+ get originalValue() {
17475
+ return stateRef.current.original;
17476
+ },
17477
+ form,
17478
+ validate(report) {
17479
+ var _a2;
17480
+ return (_a2 = field.validate) == null ? void 0 : _a2.call(field, report);
17481
+ }
17482
+ };
17483
+ }
17484
+ function useOptionalField(options) {
17485
+ var _a;
17486
+ try {
17487
+ return useField(options);
17488
+ } catch {
17489
+ }
17490
+ {
17491
+ console.warn(
17492
+ "[FormPalette] useOptionalField: No CoreProvider found. Running in self-managed mode."
17493
+ );
17494
+ }
17495
+ const {
17496
+ name: rawName,
17497
+ bindId: rawBindId,
17498
+ bind: bind2,
17499
+ shared,
17500
+ groupId,
17501
+ alias,
17502
+ main,
17503
+ ignore,
17504
+ required: requiredProp = false,
17505
+ defaultValue,
17506
+ disabled: disabledProp = false,
17507
+ readOnly: readOnlyProp = false,
17508
+ validate,
17509
+ getOriginalValue,
17510
+ onValueChange
17511
+ } = options;
17512
+ const ref = React54__namespace.useRef(null);
17513
+ const [value, setValueState] = React54__namespace.useState(defaultValue);
17514
+ const [error, setErrorState] = React54__namespace.useState("");
17515
+ const [loading, setLoadingState] = React54__namespace.useState(false);
17516
+ const [required, setRequired] = React54__namespace.useState(!!requiredProp);
17517
+ const [disabled, setDisabled] = React54__namespace.useState(!!disabledProp);
17518
+ const [readOnly, setReadOnly] = React54__namespace.useState(!!readOnlyProp);
17519
+ const originalRef = React54__namespace.useRef(
17520
+ getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
17521
+ );
17522
+ const id = React54__namespace.useId();
17523
+ const keyRef = React54__namespace.useRef("");
17524
+ if (!keyRef.current) {
17525
+ if (rawName && rawName.trim()) {
17526
+ keyRef.current = `${rawName.trim()}-${id}`;
17527
+ } else if (rawBindId && rawBindId.trim()) {
17528
+ keyRef.current = `${rawBindId.trim()}-${id}`;
17529
+ } else {
17530
+ keyRef.current = `field-${Math.random().toString(36).slice(2)}-${id}`;
17531
+ }
17532
+ }
17533
+ const bindIdRef = React54__namespace.useRef("");
17534
+ if (!bindIdRef.current) {
17535
+ bindIdRef.current = rawBindId && rawBindId.trim() || keyRef.current;
17536
+ }
17537
+ React54__namespace.useEffect(() => {
17538
+ setRequired(!!requiredProp);
17539
+ }, [requiredProp]);
17540
+ React54__namespace.useEffect(() => {
17541
+ setDisabled(!!disabledProp);
17542
+ }, [disabledProp]);
17543
+ React54__namespace.useEffect(() => {
17544
+ setReadOnly(!!readOnlyProp);
17545
+ }, [readOnlyProp]);
17546
+ function setValue(next, variant = "direct") {
17547
+ const prev = value;
17548
+ if (Object.is(prev, next)) return;
17549
+ setValueState(next);
17550
+ if (onValueChange) {
17551
+ onValueChange(next, prev, variant);
17552
+ }
17553
+ }
17554
+ function setError(message2) {
17555
+ setErrorState(message2);
17556
+ }
17557
+ function setLoading(next) {
17558
+ setLoadingState(next);
17559
+ }
17560
+ function runValidate(report) {
17561
+ const current = value;
17562
+ let ok = true;
17563
+ let message2 = "";
17564
+ if (required && (current === void 0 || current === null || typeof current === "string" && current.trim() === "" || Array.isArray(current) && current.length === 0)) {
17565
+ ok = false;
17566
+ message2 = "This field is required.";
17567
+ } else if (validate) {
17568
+ const result = validate(current, !!report);
17569
+ if (typeof result === "string") {
17570
+ ok = false;
17571
+ message2 = result;
17572
+ } else if (result === false) {
17573
+ ok = false;
17574
+ }
17575
+ }
17576
+ if (report) {
17577
+ setErrorState(ok ? "" : message2);
17578
+ }
17579
+ return ok;
17580
+ }
17581
+ const dummyForm = {};
17582
+ return {
17583
+ ref,
17584
+ get key() {
17585
+ return keyRef.current;
17598
17586
  },
17599
- conflictingClassGroupModifiers: {
17600
- "font-size": ["leading"]
17587
+ value,
17588
+ setValue,
17589
+ error,
17590
+ setError,
17591
+ loading,
17592
+ setLoading,
17593
+ required,
17594
+ setRequired,
17595
+ disabled,
17596
+ setDisabled,
17597
+ readOnly,
17598
+ setReadOnly,
17599
+ name: (_a = rawName == null ? void 0 : rawName.trim()) != null ? _a : "",
17600
+ bindId: bindIdRef.current,
17601
+ bind: bind2,
17602
+ shared,
17603
+ groupId,
17604
+ alias,
17605
+ main,
17606
+ ignore,
17607
+ get defaultValue() {
17608
+ return originalRef.current;
17601
17609
  },
17602
- orderSensitiveModifiers: ["*", "**", "after", "backdrop", "before", "details-content", "file", "first-letter", "first-line", "marker", "placeholder", "selection"]
17610
+ get originalValue() {
17611
+ return originalRef.current;
17612
+ },
17613
+ form: dummyForm,
17614
+ validate(report) {
17615
+ return runValidate(report);
17616
+ }
17603
17617
  };
17604
- };
17605
- var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
17618
+ }
17606
17619
 
17607
- // src/lib/utils.ts
17608
- function cn(...inputs) {
17609
- return twMerge(clsx(inputs));
17620
+ // src/variants/registry.ts
17621
+ var registry2 = /* @__PURE__ */ new Map();
17622
+ function registerVariant(module2) {
17623
+ registry2.set(module2.variant, module2);
17624
+ }
17625
+ function getVariant(key) {
17626
+ return registry2.get(key);
17627
+ }
17628
+ function listVariants() {
17629
+ return Array.from(registry2.values());
17610
17630
  }
17611
17631
  var isEmpty = (val) => val === null || val === void 0 || val === "";
17612
17632
  var isAndroid = () => typeof navigator !== "undefined" && /android/i.test(navigator.userAgent || "");
@@ -41602,32 +41622,77 @@ var ShadcnFileVariant = React54__namespace.forwardRef(
41602
41622
  };
41603
41623
  const FileChip = ({ item, condensed = false }) => {
41604
41624
  const name = formatFileName ? formatFileName(item) : item.name;
41605
- return /* @__PURE__ */ jsxRuntime.jsxs(
41606
- "div",
41607
- {
41608
- className: cn(
41609
- "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",
41610
- condensed ? "max-w-[120px]" : "max-w-[200px]"
41611
- ),
41612
- onClick: (e) => e.stopPropagation(),
41613
- children: [
41614
- /* @__PURE__ */ jsxRuntime.jsx(File2, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
41615
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium", children: name }),
41616
- /* @__PURE__ */ jsxRuntime.jsx(
41617
- "button",
41618
- {
41619
- type: "button",
41620
- onClick: (e) => {
41621
- e.stopPropagation();
41622
- handleRemove(item.id);
41623
- },
41624
- className: "ml-auto rounded-full text-muted-foreground/70 hover:text-destructive",
41625
- children: /* @__PURE__ */ jsxRuntime.jsx(X, { className: "h-3 w-3" })
41626
- }
41627
- )
41628
- ]
41625
+ const [preview, setPreview] = React54__namespace.useState(null);
41626
+ const [isOpen, setIsOpen] = React54__namespace.useState(false);
41627
+ React54__namespace.useEffect(() => {
41628
+ var _a;
41629
+ const isImage2 = ((_a = item.type) == null ? void 0 : _a.startsWith("image/")) || item.name.match(/\.(jpg|jpeg|png|gif|webp)$/i);
41630
+ if (!isImage2) {
41631
+ setPreview(null);
41632
+ return;
41629
41633
  }
41630
- );
41634
+ if (item.file) {
41635
+ const url = URL.createObjectURL(item.file);
41636
+ setPreview(url);
41637
+ return () => URL.revokeObjectURL(url);
41638
+ }
41639
+ if (item.url || item.path) {
41640
+ setPreview(item.url || item.path || null);
41641
+ }
41642
+ }, [item]);
41643
+ return /* @__PURE__ */ jsxRuntime.jsxs(Popover2, { open: isOpen, onOpenChange: setIsOpen, children: [
41644
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
41645
+ "div",
41646
+ {
41647
+ role: "button",
41648
+ tabIndex: 0,
41649
+ className: cn(
41650
+ "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",
41651
+ condensed ? "max-w-[120px]" : "max-w-[200px]"
41652
+ ),
41653
+ onClick: (e) => {
41654
+ e.stopPropagation();
41655
+ setIsOpen(true);
41656
+ },
41657
+ onKeyDown: (e) => {
41658
+ if (e.key === "Enter" || e.key === " ") {
41659
+ e.stopPropagation();
41660
+ setIsOpen(true);
41661
+ }
41662
+ },
41663
+ children: [
41664
+ /* @__PURE__ */ jsxRuntime.jsx(File2, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
41665
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium", children: name }),
41666
+ /* @__PURE__ */ jsxRuntime.jsx(
41667
+ "button",
41668
+ {
41669
+ type: "button",
41670
+ onClick: (e) => {
41671
+ e.stopPropagation();
41672
+ handleRemove(item.id);
41673
+ },
41674
+ 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",
41675
+ "aria-label": "Remove file",
41676
+ children: /* @__PURE__ */ jsxRuntime.jsx(X, { className: "h-3 w-3" })
41677
+ }
41678
+ )
41679
+ ]
41680
+ }
41681
+ ) }),
41682
+ /* @__PURE__ */ jsxRuntime.jsxs(PopoverContent2, { className: "w-64 p-0", align: "start", side: "bottom", children: [
41683
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative aspect-video w-full flex items-center justify-center bg-muted/30 border-b", children: preview ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: preview, alt: item.name, className: "h-full w-full object-contain" }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2 text-muted-foreground/50", children: [
41684
+ /* @__PURE__ */ jsxRuntime.jsx(File2, { className: "h-10 w-10" }),
41685
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] uppercase", children: "No Preview" })
41686
+ ] }) }),
41687
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-3", children: [
41688
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium text-sm truncate", title: item.name, children: name }),
41689
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1 flex items-center justify-between text-xs text-muted-foreground", children: [
41690
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: formatFileSize(item.size) }),
41691
+ item.type && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "uppercase opacity-70", children: item.type.split("/").pop() })
41692
+ ] })
41693
+ ] })
41694
+ ] })
41695
+ ] });
41631
41696
  };
41632
41697
  const TriggerRegion = React54__namespace.useMemo(() => {
41633
41698
  if (showDropArea) {
@@ -41647,7 +41712,7 @@ var ShadcnFileVariant = React54__namespace.forwardRef(
41647
41712
  dropAreaClassName
41648
41713
  ),
41649
41714
  children: [
41650
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-full bg-background p-3 shadow-sm", children: dropIcon != null ? dropIcon : /* @__PURE__ */ jsxRuntime.jsx(CloudUpload, { className: "h-5 w-5 text-muted-foreground" }) }),
41715
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-full bg-surfaces-input p-3 shadow-sm", children: dropIcon != null ? dropIcon : /* @__PURE__ */ jsxRuntime.jsx(CloudUpload, { className: "h-5 w-5 text-muted-foreground" }) }),
41651
41716
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
41652
41717
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-foreground", children: dropTitle != null ? dropTitle : "Click or drag to select" }),
41653
41718
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: dropDescription != null ? dropDescription : multiple ? "Select files" : "Select a file" })
@@ -41668,7 +41733,7 @@ var ShadcnFileVariant = React54__namespace.forwardRef(
41668
41733
  className: cn(
41669
41734
  "relative flex w-full cursor-pointer items-center gap-2 px-3 transition-all",
41670
41735
  heightCls,
41671
- (!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",
41736
+ (!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",
41672
41737
  dragOver && "border-primary ring-2 ring-primary/20",
41673
41738
  isDisabled && "cursor-not-allowed opacity-50",
41674
41739
  error && "border-destructive text-destructive",
@@ -41708,7 +41773,7 @@ var ShadcnFileVariant = React54__namespace.forwardRef(
41708
41773
  /* @__PURE__ */ jsxRuntime.jsx(
41709
41774
  PopoverContent2,
41710
41775
  {
41711
- className: "w-[--radix-popover-trigger-width] p-0",
41776
+ className: "w-(--radix-popover-trigger-width) p-0",
41712
41777
  align: "start",
41713
41778
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
41714
41779
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between border-b px-3 py-2 text-xs font-medium text-muted-foreground", children: [
@@ -41780,7 +41845,7 @@ var ShadcnFileVariant = React54__namespace.forwardRef(
41780
41845
  },
41781
41846
  children: [
41782
41847
  /* @__PURE__ */ jsxRuntime.jsx(Plus, { className: "mr-2 h-3 w-3" }),
41783
- "Add files..."
41848
+ multiple ? "Add files..." : items.length ? "Replace file" : "Add file"
41784
41849
  ]
41785
41850
  }
41786
41851
  ) })
@@ -41871,7 +41936,7 @@ var ShadcnFileVariant = React54__namespace.forwardRef(
41871
41936
  children: [
41872
41937
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(
41873
41938
  "flex w-full",
41874
- 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"
41939
+ 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"
41875
41940
  ), children: [
41876
41941
  leadingControl && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(
41877
41942
  "flex items-center",
@@ -42732,7 +42797,7 @@ function InputField(props) {
42732
42797
  ].filter(Boolean).join(" ");
42733
42798
  const hasStackedLabelBlock = lp !== "hidden" && hasAnyLabelBlockContent;
42734
42799
  const stackedGroupClassName = [
42735
- hasStackedLabelBlock && hasLabelRowContent ? "mt-1" : null,
42800
+ hasStackedLabelBlock && hasLabelRowContent ? "mt-0.5" : null,
42736
42801
  classes == null ? void 0 : classes.group
42737
42802
  ].filter(Boolean).join(" ");
42738
42803
  const Element2 = contain ? "div" : React54__namespace.Fragment;