@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.mjs CHANGED
@@ -14068,749 +14068,259 @@ function CoreRoot(props) {
14068
14068
  children
14069
14069
  ] });
14070
14070
  }
14071
- function CoreShell(props) {
14072
- const { formProps, children, ...coreProps } = props;
14073
- return /* @__PURE__ */ jsx(CoreProvider, { ...coreProps, children: /* @__PURE__ */ jsx(CoreRoot, { ...formProps != null ? formProps : {}, children }) });
14071
+
14072
+ // ../../node_modules/clsx/dist/clsx.mjs
14073
+ function r(e) {
14074
+ var t, f, n = "";
14075
+ if ("string" == typeof e || "number" == typeof e) n += e;
14076
+ else if ("object" == typeof e) if (Array.isArray(e)) {
14077
+ var o = e.length;
14078
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
14079
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
14080
+ return n;
14074
14081
  }
14075
- function useButton(options) {
14076
- const form = useCoreContext();
14077
- const { name, submit, disabled: disabledProp = false, onClick } = options;
14078
- const [loading, setLoadingState] = React54.useState(false);
14079
- const [disabled, setDisabledState] = React54.useState(
14080
- Boolean(disabledProp)
14081
- );
14082
- const ref = React54.useRef(null);
14083
- const optsRef = React54.useRef(options);
14084
- React54.useEffect(() => {
14085
- optsRef.current = options;
14086
- }, [options]);
14087
- const buttonRef = React54.useRef(null);
14088
- if (!buttonRef.current) {
14089
- const btn = {
14090
- name,
14091
- // Accessor for "loading" as required by ButtonRef
14092
- set loading(v) {
14093
- setLoadingState(v);
14094
- },
14095
- // Accessor for "disable" (note: interface uses `disable`, not `disabled`)
14096
- //@ts-ignore
14097
- set disable(v) {
14098
- setDisabledState(v);
14099
- },
14100
- // Extra properties used by CoreProvider via any-casts
14101
- get loading() {
14102
- return loading;
14103
- },
14104
- setDisabled(v) {
14105
- setDisabledState(v);
14106
- },
14107
- get disabled() {
14108
- return disabled;
14109
- },
14110
- ref
14111
- };
14112
- btn.setLoading = (v) => {
14113
- setLoadingState(v);
14114
- };
14115
- buttonRef.current = btn;
14082
+ function clsx() {
14083
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
14084
+ return n;
14085
+ }
14086
+
14087
+ // ../../node_modules/tailwind-merge/dist/bundle-mjs.mjs
14088
+ var concatArrays = (array1, array2) => {
14089
+ const combinedArray = new Array(array1.length + array2.length);
14090
+ for (let i = 0; i < array1.length; i++) {
14091
+ combinedArray[i] = array1[i];
14116
14092
  }
14117
- React54.useEffect(() => {
14118
- if (!buttonRef.current) return;
14119
- buttonRef.current.name = name;
14120
- }, [name]);
14121
- React54.useEffect(() => {
14122
- if (!buttonRef.current) return;
14123
- form.button = buttonRef.current;
14124
- return () => {
14125
- const anyForm = form;
14126
- if (anyForm.button === buttonRef.current) {
14127
- anyForm.button = null;
14128
- }
14129
- };
14130
- }, [form]);
14131
- const handleClick = (event) => {
14132
- const currentOpts = optsRef.current;
14133
- const shouldSubmit = !!currentOpts.submit;
14134
- if (currentOpts.onClick) {
14135
- currentOpts.onClick(event, form);
14136
- }
14137
- if (event.defaultPrevented) {
14138
- return;
14139
- }
14140
- if (shouldSubmit) {
14141
- form.setActiveButton(currentOpts.name);
14142
- form.go();
14093
+ for (let i = 0; i < array2.length; i++) {
14094
+ combinedArray[array1.length + i] = array2[i];
14095
+ }
14096
+ return combinedArray;
14097
+ };
14098
+ var createClassValidatorObject = (classGroupId, validator) => ({
14099
+ classGroupId,
14100
+ validator
14101
+ });
14102
+ var createClassPartObject = (nextPart = /* @__PURE__ */ new Map(), validators3 = null, classGroupId) => ({
14103
+ nextPart,
14104
+ validators: validators3,
14105
+ classGroupId
14106
+ });
14107
+ var CLASS_PART_SEPARATOR = "-";
14108
+ var EMPTY_CONFLICTS = [];
14109
+ var ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
14110
+ var createClassGroupUtils = (config3) => {
14111
+ const classMap = createClassMap(config3);
14112
+ const {
14113
+ conflictingClassGroups,
14114
+ conflictingClassGroupModifiers
14115
+ } = config3;
14116
+ const getClassGroupId = (className) => {
14117
+ if (className.startsWith("[") && className.endsWith("]")) {
14118
+ return getGroupIdForArbitraryProperty(className);
14143
14119
  }
14120
+ const classParts = className.split(CLASS_PART_SEPARATOR);
14121
+ const startIndex = classParts[0] === "" && classParts.length > 1 ? 1 : 0;
14122
+ return getGroupRecursive(classParts, startIndex, classMap);
14144
14123
  };
14145
- const setLoading = (v) => {
14146
- setLoadingState(v);
14147
- };
14148
- const setDisabled = (v) => {
14149
- setDisabledState(v);
14124
+ const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
14125
+ if (hasPostfixModifier) {
14126
+ const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
14127
+ const baseConflicts = conflictingClassGroups[classGroupId];
14128
+ if (modifierConflicts) {
14129
+ if (baseConflicts) {
14130
+ return concatArrays(baseConflicts, modifierConflicts);
14131
+ }
14132
+ return modifierConflicts;
14133
+ }
14134
+ return baseConflicts || EMPTY_CONFLICTS;
14135
+ }
14136
+ return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
14150
14137
  };
14151
14138
  return {
14152
- loading,
14153
- setLoading,
14154
- disabled,
14155
- setDisabled,
14156
- ref,
14157
- onClick: handleClick,
14158
- buttonProps: {
14159
- ref,
14160
- disabled: disabled || loading,
14161
- "data-loading": loading ? "true" : "false",
14162
- onClick: handleClick
14163
- }
14139
+ getClassGroupId,
14140
+ getConflictingClassGroupIds
14164
14141
  };
14165
- }
14166
- function useField(options) {
14167
- var _a;
14168
- const form = useCoreContext();
14142
+ };
14143
+ var getGroupRecursive = (classParts, startIndex, classPartObject) => {
14144
+ const classPathsLength = classParts.length - startIndex;
14145
+ if (classPathsLength === 0) {
14146
+ return classPartObject.classGroupId;
14147
+ }
14148
+ const currentClassPart = classParts[startIndex];
14149
+ const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
14150
+ if (nextClassPartObject) {
14151
+ const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
14152
+ if (result) return result;
14153
+ }
14154
+ const validators3 = classPartObject.validators;
14155
+ if (validators3 === null) {
14156
+ return void 0;
14157
+ }
14158
+ const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
14159
+ const validatorsLength = validators3.length;
14160
+ for (let i = 0; i < validatorsLength; i++) {
14161
+ const validatorObj = validators3[i];
14162
+ if (validatorObj.validator(classRest)) {
14163
+ return validatorObj.classGroupId;
14164
+ }
14165
+ }
14166
+ return void 0;
14167
+ };
14168
+ var getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
14169
+ const content = className.slice(1, -1);
14170
+ const colonIndex = content.indexOf(":");
14171
+ const property = content.slice(0, colonIndex);
14172
+ return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
14173
+ })();
14174
+ var createClassMap = (config3) => {
14169
14175
  const {
14170
- name: rawName,
14171
- bindId: rawBindId,
14172
- bind: bind2,
14173
- shared,
14174
- groupId,
14175
- alias,
14176
- main,
14177
- ignore,
14178
- required: requiredProp = false,
14179
- defaultValue,
14180
- disabled: disabledProp = false,
14181
- readOnly: readOnlyProp = false,
14182
- validate,
14183
- getOriginalValue,
14184
- onValueChange
14185
- } = options;
14186
- const ref = React54.useRef(null);
14187
- const stateRef = React54.useRef({
14188
- value: defaultValue,
14189
- error: "",
14190
- loading: false,
14191
- original: getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
14192
- });
14193
- const [value, setValueState] = React54.useState(
14194
- stateRef.current.value
14195
- );
14196
- const [error, setErrorState] = React54.useState(
14197
- stateRef.current.error
14198
- );
14199
- const [loading, setLoadingState] = React54.useState(
14200
- stateRef.current.loading
14201
- );
14202
- const [required, setRequired] = React54.useState(
14203
- Boolean(requiredProp)
14204
- );
14205
- const [disabled, setDisabled] = React54.useState(
14206
- Boolean(disabledProp)
14207
- );
14208
- const [readOnly, setReadOnly] = React54.useState(
14209
- Boolean(readOnlyProp)
14210
- );
14211
- const id = React54.useId();
14212
- const keyRef = React54.useRef((() => {
14213
- if (rawName && rawName.trim()) return `${rawName.trim()}-${id}`;
14214
- if (rawBindId && rawBindId.trim()) return `${rawBindId.trim()}-${id}`;
14215
- return `field-${Math.random().toString(36).slice(2)}-${id}`;
14216
- })());
14217
- const bindIdRef = React54.useRef(
14218
- rawBindId && rawBindId.trim() || keyRef.current
14219
- );
14220
- const fieldRef = React54.useRef(null);
14221
- if (!fieldRef.current) {
14222
- const key = keyRef.current;
14223
- const bindId = bindIdRef.current;
14224
- const trimmedName = (_a = rawName == null ? void 0 : rawName.trim()) != null ? _a : "";
14225
- const validateFn = (report) => {
14226
- const curDisabled = disabled || readOnly;
14227
- if (curDisabled && !report) {
14228
- return true;
14229
- }
14230
- const current = stateRef.current.value;
14231
- let ok = true;
14232
- let message2 = "";
14233
- if (required && (current === void 0 || current === null || typeof current === "string" && current.trim() === "" || Array.isArray(current) && current.length === 0)) {
14234
- ok = false;
14235
- message2 = "This field is required.";
14236
- } else if (validate) {
14237
- const result = validate(current, !!report);
14238
- if (typeof result === "string") {
14239
- ok = false;
14240
- message2 = result;
14241
- } else if (result === false) {
14242
- ok = false;
14243
- }
14244
- }
14245
- if (!report) {
14246
- return ok;
14247
- }
14248
- stateRef.current.error = ok ? "" : message2;
14249
- setErrorState(ok ? "" : message2);
14250
- return ok;
14251
- };
14252
- const f = {
14253
- key,
14254
- bindId,
14255
- bind: bind2,
14256
- name: trimmedName,
14257
- shared,
14258
- groupId,
14259
- alias,
14260
- main,
14261
- ignore,
14262
- required,
14263
- ref,
14264
- get defaultValue() {
14265
- return stateRef.current.original;
14266
- },
14267
- get value() {
14268
- return stateRef.current.value;
14269
- },
14270
- set value(v) {
14271
- stateRef.current.value = v;
14272
- setValueState(v);
14273
- },
14274
- get originalValue() {
14275
- return stateRef.current.original;
14276
- },
14277
- get error() {
14278
- return stateRef.current.error;
14279
- },
14280
- set error(msg) {
14281
- stateRef.current.error = msg;
14282
- setErrorState(msg);
14283
- },
14284
- get loading() {
14285
- return stateRef.current.loading;
14286
- },
14287
- set loading(v) {
14288
- stateRef.current.loading = v;
14289
- setLoadingState(v);
14290
- },
14291
- validate: validateFn,
14292
- onChange(value2, old, variant) {
14293
- if (onValueChange) {
14294
- onValueChange(value2, old, variant);
14295
- }
14296
- }
14297
- // Flags not directly on the Field interface but used via `as any`
14298
- // in core-provider (getValue/setValue/reset).
14299
- };
14300
- f.getValue = () => stateRef.current.value;
14301
- f.setValue = (next) => {
14302
- stateRef.current.value = next;
14303
- setValueState(next);
14304
- };
14305
- f.reset = () => {
14306
- stateRef.current.value = defaultValue;
14307
- stateRef.current.error = "";
14308
- stateRef.current.loading = false;
14309
- setValueState(defaultValue);
14310
- setErrorState("");
14311
- setLoadingState(false);
14312
- };
14313
- fieldRef.current = f;
14176
+ theme,
14177
+ classGroups
14178
+ } = config3;
14179
+ return processClassGroups(classGroups, theme);
14180
+ };
14181
+ var processClassGroups = (classGroups, theme) => {
14182
+ const classMap = createClassPartObject();
14183
+ for (const classGroupId in classGroups) {
14184
+ const group = classGroups[classGroupId];
14185
+ processClassesRecursively(group, classMap, classGroupId, theme);
14314
14186
  }
14315
- const field = fieldRef.current;
14316
- React54.useEffect(() => {
14317
- setRequired(!!requiredProp);
14318
- if (field) {
14319
- field.required = !!requiredProp;
14320
- }
14321
- }, [requiredProp, field]);
14322
- React54.useEffect(() => {
14323
- setDisabled(!!disabledProp);
14324
- }, [disabledProp]);
14325
- React54.useEffect(() => {
14326
- setReadOnly(!!readOnlyProp);
14327
- }, [readOnlyProp]);
14328
- React54.useEffect(() => {
14329
- if (!field) return;
14330
- form.addField(field);
14331
- return () => {
14332
- const registry3 = form.inputs;
14333
- if (registry3 && typeof registry3.remove === "function") {
14334
- registry3.remove(field.key);
14335
- }
14336
- };
14337
- }, [form, field]);
14338
- function setValue(next, variant = "direct") {
14339
- var _a2;
14340
- const prev = stateRef.current.value;
14341
- if (Object.is(prev, next)) return;
14342
- const runFormOnChange = () => {
14343
- var _a3;
14344
- const props2 = (_a3 = form.props) != null ? _a3 : {};
14345
- const fn = props2.onChange;
14346
- if (!fn) return;
14347
- fn(form, field, {
14348
- variant,
14349
- value: next,
14350
- previous: prev
14351
- });
14352
- };
14353
- const props = (_a2 = form.props) != null ? _a2 : {};
14354
- const changeBefore = !!props.changeBefore;
14355
- if (changeBefore) {
14356
- runFormOnChange();
14357
- }
14358
- stateRef.current.value = next;
14359
- setValueState(next);
14360
- if (field.onChange) {
14361
- field.onChange(next, prev, variant);
14362
- }
14363
- if (!changeBefore) {
14364
- runFormOnChange();
14365
- }
14366
- form.controlButton();
14187
+ return classMap;
14188
+ };
14189
+ var processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
14190
+ const len = classGroup.length;
14191
+ for (let i = 0; i < len; i++) {
14192
+ const classDefinition = classGroup[i];
14193
+ processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
14367
14194
  }
14368
- function setError(message2) {
14369
- stateRef.current.error = message2;
14370
- setErrorState(message2);
14195
+ };
14196
+ var processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14197
+ if (typeof classDefinition === "string") {
14198
+ processStringDefinition(classDefinition, classPartObject, classGroupId);
14199
+ return;
14371
14200
  }
14372
- function setLoading(loading2) {
14373
- stateRef.current.loading = loading2;
14374
- setLoadingState(loading2);
14201
+ if (typeof classDefinition === "function") {
14202
+ processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
14203
+ return;
14375
14204
  }
14376
- return {
14377
- ref,
14378
- get key() {
14379
- return keyRef.current;
14380
- },
14381
- value,
14382
- setValue,
14383
- error,
14384
- setError,
14385
- loading,
14386
- setLoading,
14387
- required,
14388
- setRequired,
14389
- disabled,
14390
- setDisabled,
14391
- readOnly,
14392
- setReadOnly,
14393
- name: field.name,
14394
- bindId: field.bindId,
14395
- bind: field.bind,
14396
- shared: field.shared,
14397
- groupId: field.groupId,
14398
- alias: field.alias,
14399
- main: field.main,
14400
- ignore: field.ignore,
14401
- get defaultValue() {
14402
- return stateRef.current.original;
14403
- },
14404
- get originalValue() {
14405
- return stateRef.current.original;
14406
- },
14407
- form,
14408
- validate(report) {
14409
- var _a2;
14410
- return (_a2 = field.validate) == null ? void 0 : _a2.call(field, report);
14205
+ processObjectDefinition(classDefinition, classPartObject, classGroupId, theme);
14206
+ };
14207
+ var processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
14208
+ const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
14209
+ classPartObjectToEdit.classGroupId = classGroupId;
14210
+ };
14211
+ var processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14212
+ if (isThemeGetter(classDefinition)) {
14213
+ processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
14214
+ return;
14215
+ }
14216
+ if (classPartObject.validators === null) {
14217
+ classPartObject.validators = [];
14218
+ }
14219
+ classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
14220
+ };
14221
+ var processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14222
+ const entries = Object.entries(classDefinition);
14223
+ const len = entries.length;
14224
+ for (let i = 0; i < len; i++) {
14225
+ const [key, value] = entries[i];
14226
+ processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
14227
+ }
14228
+ };
14229
+ var getPart = (classPartObject, path) => {
14230
+ let current = classPartObject;
14231
+ const parts = path.split(CLASS_PART_SEPARATOR);
14232
+ const len = parts.length;
14233
+ for (let i = 0; i < len; i++) {
14234
+ const part = parts[i];
14235
+ let next = current.nextPart.get(part);
14236
+ if (!next) {
14237
+ next = createClassPartObject();
14238
+ current.nextPart.set(part, next);
14411
14239
  }
14412
- };
14413
- }
14414
- function useOptionalField(options) {
14415
- var _a;
14416
- try {
14417
- return useField(options);
14418
- } catch {
14240
+ current = next;
14419
14241
  }
14420
- {
14421
- console.warn(
14422
- "[FormPalette] useOptionalField: No CoreProvider found. Running in self-managed mode."
14423
- );
14242
+ return current;
14243
+ };
14244
+ var isThemeGetter = (func) => "isThemeGetter" in func && func.isThemeGetter === true;
14245
+ var createLruCache = (maxCacheSize) => {
14246
+ if (maxCacheSize < 1) {
14247
+ return {
14248
+ get: () => void 0,
14249
+ set: () => {
14250
+ }
14251
+ };
14424
14252
  }
14425
- const {
14426
- name: rawName,
14427
- bindId: rawBindId,
14428
- bind: bind2,
14429
- shared,
14430
- groupId,
14431
- alias,
14432
- main,
14433
- ignore,
14434
- required: requiredProp = false,
14435
- defaultValue,
14436
- disabled: disabledProp = false,
14437
- readOnly: readOnlyProp = false,
14438
- validate,
14439
- getOriginalValue,
14440
- onValueChange
14441
- } = options;
14442
- const ref = React54.useRef(null);
14443
- const [value, setValueState] = React54.useState(defaultValue);
14444
- const [error, setErrorState] = React54.useState("");
14445
- const [loading, setLoadingState] = React54.useState(false);
14446
- const [required, setRequired] = React54.useState(!!requiredProp);
14447
- const [disabled, setDisabled] = React54.useState(!!disabledProp);
14448
- const [readOnly, setReadOnly] = React54.useState(!!readOnlyProp);
14449
- const originalRef = React54.useRef(
14450
- getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
14451
- );
14452
- const id = React54.useId();
14453
- const keyRef = React54.useRef("");
14454
- if (!keyRef.current) {
14455
- if (rawName && rawName.trim()) {
14456
- keyRef.current = `${rawName.trim()}-${id}`;
14457
- } else if (rawBindId && rawBindId.trim()) {
14458
- keyRef.current = `${rawBindId.trim()}-${id}`;
14459
- } else {
14460
- keyRef.current = `field-${Math.random().toString(36).slice(2)}-${id}`;
14461
- }
14462
- }
14463
- const bindIdRef = React54.useRef("");
14464
- if (!bindIdRef.current) {
14465
- bindIdRef.current = rawBindId && rawBindId.trim() || keyRef.current;
14466
- }
14467
- React54.useEffect(() => {
14468
- setRequired(!!requiredProp);
14469
- }, [requiredProp]);
14470
- React54.useEffect(() => {
14471
- setDisabled(!!disabledProp);
14472
- }, [disabledProp]);
14473
- React54.useEffect(() => {
14474
- setReadOnly(!!readOnlyProp);
14475
- }, [readOnlyProp]);
14476
- function setValue(next, variant = "direct") {
14477
- const prev = value;
14478
- if (Object.is(prev, next)) return;
14479
- setValueState(next);
14480
- if (onValueChange) {
14481
- onValueChange(next, prev, variant);
14482
- }
14483
- }
14484
- function setError(message2) {
14485
- setErrorState(message2);
14486
- }
14487
- function setLoading(next) {
14488
- setLoadingState(next);
14489
- }
14490
- function runValidate(report) {
14491
- const current = value;
14492
- let ok = true;
14493
- let message2 = "";
14494
- if (required && (current === void 0 || current === null || typeof current === "string" && current.trim() === "" || Array.isArray(current) && current.length === 0)) {
14495
- ok = false;
14496
- message2 = "This field is required.";
14497
- } else if (validate) {
14498
- const result = validate(current, !!report);
14499
- if (typeof result === "string") {
14500
- ok = false;
14501
- message2 = result;
14502
- } else if (result === false) {
14503
- ok = false;
14504
- }
14505
- }
14506
- if (report) {
14507
- setErrorState(ok ? "" : message2);
14253
+ let cacheSize = 0;
14254
+ let cache = /* @__PURE__ */ Object.create(null);
14255
+ let previousCache = /* @__PURE__ */ Object.create(null);
14256
+ const update = (key, value) => {
14257
+ cache[key] = value;
14258
+ cacheSize++;
14259
+ if (cacheSize > maxCacheSize) {
14260
+ cacheSize = 0;
14261
+ previousCache = cache;
14262
+ cache = /* @__PURE__ */ Object.create(null);
14508
14263
  }
14509
- return ok;
14510
- }
14511
- const dummyForm = {};
14264
+ };
14512
14265
  return {
14513
- ref,
14514
- get key() {
14515
- return keyRef.current;
14516
- },
14517
- value,
14518
- setValue,
14519
- error,
14520
- setError,
14521
- loading,
14522
- setLoading,
14523
- required,
14524
- setRequired,
14525
- disabled,
14526
- setDisabled,
14527
- readOnly,
14528
- setReadOnly,
14529
- name: (_a = rawName == null ? void 0 : rawName.trim()) != null ? _a : "",
14530
- bindId: bindIdRef.current,
14531
- bind: bind2,
14532
- shared,
14533
- groupId,
14534
- alias,
14535
- main,
14536
- ignore,
14537
- get defaultValue() {
14538
- return originalRef.current;
14539
- },
14540
- get originalValue() {
14541
- return originalRef.current;
14266
+ get(key) {
14267
+ let value = cache[key];
14268
+ if (value !== void 0) {
14269
+ return value;
14270
+ }
14271
+ if ((value = previousCache[key]) !== void 0) {
14272
+ update(key, value);
14273
+ return value;
14274
+ }
14542
14275
  },
14543
- form: dummyForm,
14544
- validate(report) {
14545
- return runValidate(report);
14276
+ set(key, value) {
14277
+ if (key in cache) {
14278
+ cache[key] = value;
14279
+ } else {
14280
+ update(key, value);
14281
+ }
14546
14282
  }
14547
14283
  };
14548
- }
14549
-
14550
- // src/variants/registry.ts
14551
- var registry2 = /* @__PURE__ */ new Map();
14552
- function registerVariant(module2) {
14553
- registry2.set(module2.variant, module2);
14554
- }
14555
- function getVariant(key) {
14556
- return registry2.get(key);
14557
- }
14558
- function listVariants() {
14559
- return Array.from(registry2.values());
14560
- }
14561
-
14562
- // ../../node_modules/clsx/dist/clsx.mjs
14563
- function r(e) {
14564
- var t, f, n = "";
14565
- if ("string" == typeof e || "number" == typeof e) n += e;
14566
- else if ("object" == typeof e) if (Array.isArray(e)) {
14567
- var o = e.length;
14568
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
14569
- } else for (f in e) e[f] && (n && (n += " "), n += f);
14570
- return n;
14571
- }
14572
- function clsx() {
14573
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
14574
- return n;
14575
- }
14576
-
14577
- // ../../node_modules/tailwind-merge/dist/bundle-mjs.mjs
14578
- var concatArrays = (array1, array2) => {
14579
- const combinedArray = new Array(array1.length + array2.length);
14580
- for (let i = 0; i < array1.length; i++) {
14581
- combinedArray[i] = array1[i];
14582
- }
14583
- for (let i = 0; i < array2.length; i++) {
14584
- combinedArray[array1.length + i] = array2[i];
14585
- }
14586
- return combinedArray;
14587
14284
  };
14588
- var createClassValidatorObject = (classGroupId, validator) => ({
14589
- classGroupId,
14590
- validator
14591
- });
14592
- var createClassPartObject = (nextPart = /* @__PURE__ */ new Map(), validators3 = null, classGroupId) => ({
14593
- nextPart,
14594
- validators: validators3,
14595
- classGroupId
14285
+ var IMPORTANT_MODIFIER = "!";
14286
+ var MODIFIER_SEPARATOR = ":";
14287
+ var EMPTY_MODIFIERS = [];
14288
+ var createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
14289
+ modifiers,
14290
+ hasImportantModifier,
14291
+ baseClassName,
14292
+ maybePostfixModifierPosition,
14293
+ isExternal
14596
14294
  });
14597
- var CLASS_PART_SEPARATOR = "-";
14598
- var EMPTY_CONFLICTS = [];
14599
- var ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
14600
- var createClassGroupUtils = (config3) => {
14601
- const classMap = createClassMap(config3);
14295
+ var createParseClassName = (config3) => {
14602
14296
  const {
14603
- conflictingClassGroups,
14604
- conflictingClassGroupModifiers
14297
+ prefix,
14298
+ experimentalParseClassName
14605
14299
  } = config3;
14606
- const getClassGroupId = (className) => {
14607
- if (className.startsWith("[") && className.endsWith("]")) {
14608
- return getGroupIdForArbitraryProperty(className);
14609
- }
14610
- const classParts = className.split(CLASS_PART_SEPARATOR);
14611
- const startIndex = classParts[0] === "" && classParts.length > 1 ? 1 : 0;
14612
- return getGroupRecursive(classParts, startIndex, classMap);
14613
- };
14614
- const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
14615
- if (hasPostfixModifier) {
14616
- const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
14617
- const baseConflicts = conflictingClassGroups[classGroupId];
14618
- if (modifierConflicts) {
14619
- if (baseConflicts) {
14620
- return concatArrays(baseConflicts, modifierConflicts);
14300
+ let parseClassName = (className) => {
14301
+ const modifiers = [];
14302
+ let bracketDepth = 0;
14303
+ let parenDepth = 0;
14304
+ let modifierStart = 0;
14305
+ let postfixModifierPosition;
14306
+ const len = className.length;
14307
+ for (let index2 = 0; index2 < len; index2++) {
14308
+ const currentCharacter = className[index2];
14309
+ if (bracketDepth === 0 && parenDepth === 0) {
14310
+ if (currentCharacter === MODIFIER_SEPARATOR) {
14311
+ modifiers.push(className.slice(modifierStart, index2));
14312
+ modifierStart = index2 + 1;
14313
+ continue;
14314
+ }
14315
+ if (currentCharacter === "/") {
14316
+ postfixModifierPosition = index2;
14317
+ continue;
14621
14318
  }
14622
- return modifierConflicts;
14623
14319
  }
14624
- return baseConflicts || EMPTY_CONFLICTS;
14625
- }
14626
- return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
14627
- };
14628
- return {
14629
- getClassGroupId,
14630
- getConflictingClassGroupIds
14631
- };
14632
- };
14633
- var getGroupRecursive = (classParts, startIndex, classPartObject) => {
14634
- const classPathsLength = classParts.length - startIndex;
14635
- if (classPathsLength === 0) {
14636
- return classPartObject.classGroupId;
14637
- }
14638
- const currentClassPart = classParts[startIndex];
14639
- const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
14640
- if (nextClassPartObject) {
14641
- const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
14642
- if (result) return result;
14643
- }
14644
- const validators3 = classPartObject.validators;
14645
- if (validators3 === null) {
14646
- return void 0;
14647
- }
14648
- const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
14649
- const validatorsLength = validators3.length;
14650
- for (let i = 0; i < validatorsLength; i++) {
14651
- const validatorObj = validators3[i];
14652
- if (validatorObj.validator(classRest)) {
14653
- return validatorObj.classGroupId;
14654
- }
14655
- }
14656
- return void 0;
14657
- };
14658
- var getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
14659
- const content = className.slice(1, -1);
14660
- const colonIndex = content.indexOf(":");
14661
- const property = content.slice(0, colonIndex);
14662
- return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
14663
- })();
14664
- var createClassMap = (config3) => {
14665
- const {
14666
- theme,
14667
- classGroups
14668
- } = config3;
14669
- return processClassGroups(classGroups, theme);
14670
- };
14671
- var processClassGroups = (classGroups, theme) => {
14672
- const classMap = createClassPartObject();
14673
- for (const classGroupId in classGroups) {
14674
- const group = classGroups[classGroupId];
14675
- processClassesRecursively(group, classMap, classGroupId, theme);
14676
- }
14677
- return classMap;
14678
- };
14679
- var processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
14680
- const len = classGroup.length;
14681
- for (let i = 0; i < len; i++) {
14682
- const classDefinition = classGroup[i];
14683
- processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
14684
- }
14685
- };
14686
- var processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14687
- if (typeof classDefinition === "string") {
14688
- processStringDefinition(classDefinition, classPartObject, classGroupId);
14689
- return;
14690
- }
14691
- if (typeof classDefinition === "function") {
14692
- processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
14693
- return;
14694
- }
14695
- processObjectDefinition(classDefinition, classPartObject, classGroupId, theme);
14696
- };
14697
- var processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
14698
- const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
14699
- classPartObjectToEdit.classGroupId = classGroupId;
14700
- };
14701
- var processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14702
- if (isThemeGetter(classDefinition)) {
14703
- processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
14704
- return;
14705
- }
14706
- if (classPartObject.validators === null) {
14707
- classPartObject.validators = [];
14708
- }
14709
- classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
14710
- };
14711
- var processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14712
- const entries = Object.entries(classDefinition);
14713
- const len = entries.length;
14714
- for (let i = 0; i < len; i++) {
14715
- const [key, value] = entries[i];
14716
- processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
14717
- }
14718
- };
14719
- var getPart = (classPartObject, path) => {
14720
- let current = classPartObject;
14721
- const parts = path.split(CLASS_PART_SEPARATOR);
14722
- const len = parts.length;
14723
- for (let i = 0; i < len; i++) {
14724
- const part = parts[i];
14725
- let next = current.nextPart.get(part);
14726
- if (!next) {
14727
- next = createClassPartObject();
14728
- current.nextPart.set(part, next);
14729
- }
14730
- current = next;
14731
- }
14732
- return current;
14733
- };
14734
- var isThemeGetter = (func) => "isThemeGetter" in func && func.isThemeGetter === true;
14735
- var createLruCache = (maxCacheSize) => {
14736
- if (maxCacheSize < 1) {
14737
- return {
14738
- get: () => void 0,
14739
- set: () => {
14740
- }
14741
- };
14742
- }
14743
- let cacheSize = 0;
14744
- let cache = /* @__PURE__ */ Object.create(null);
14745
- let previousCache = /* @__PURE__ */ Object.create(null);
14746
- const update = (key, value) => {
14747
- cache[key] = value;
14748
- cacheSize++;
14749
- if (cacheSize > maxCacheSize) {
14750
- cacheSize = 0;
14751
- previousCache = cache;
14752
- cache = /* @__PURE__ */ Object.create(null);
14753
- }
14754
- };
14755
- return {
14756
- get(key) {
14757
- let value = cache[key];
14758
- if (value !== void 0) {
14759
- return value;
14760
- }
14761
- if ((value = previousCache[key]) !== void 0) {
14762
- update(key, value);
14763
- return value;
14764
- }
14765
- },
14766
- set(key, value) {
14767
- if (key in cache) {
14768
- cache[key] = value;
14769
- } else {
14770
- update(key, value);
14771
- }
14772
- }
14773
- };
14774
- };
14775
- var IMPORTANT_MODIFIER = "!";
14776
- var MODIFIER_SEPARATOR = ":";
14777
- var EMPTY_MODIFIERS = [];
14778
- var createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
14779
- modifiers,
14780
- hasImportantModifier,
14781
- baseClassName,
14782
- maybePostfixModifierPosition,
14783
- isExternal
14784
- });
14785
- var createParseClassName = (config3) => {
14786
- const {
14787
- prefix,
14788
- experimentalParseClassName
14789
- } = config3;
14790
- let parseClassName = (className) => {
14791
- const modifiers = [];
14792
- let bracketDepth = 0;
14793
- let parenDepth = 0;
14794
- let modifierStart = 0;
14795
- let postfixModifierPosition;
14796
- const len = className.length;
14797
- for (let index2 = 0; index2 < len; index2++) {
14798
- const currentCharacter = className[index2];
14799
- if (bracketDepth === 0 && parenDepth === 0) {
14800
- if (currentCharacter === MODIFIER_SEPARATOR) {
14801
- modifiers.push(className.slice(modifierStart, index2));
14802
- modifierStart = index2 + 1;
14803
- continue;
14804
- }
14805
- if (currentCharacter === "/") {
14806
- postfixModifierPosition = index2;
14807
- continue;
14808
- }
14809
- }
14810
- if (currentCharacter === "[") bracketDepth++;
14811
- else if (currentCharacter === "]") bracketDepth--;
14812
- else if (currentCharacter === "(") parenDepth++;
14813
- else if (currentCharacter === ")") parenDepth--;
14320
+ if (currentCharacter === "[") bracketDepth++;
14321
+ else if (currentCharacter === "]") bracketDepth--;
14322
+ else if (currentCharacter === "(") parenDepth++;
14323
+ else if (currentCharacter === ")") parenDepth--;
14814
14324
  }
14815
14325
  const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
14816
14326
  let baseClassName = baseClassNameWithImportantModifier;
@@ -17525,67 +17035,577 @@ var getDefaultConfig = () => {
17525
17035
  "forced-color-adjust": ["auto", "none"]
17526
17036
  }]
17527
17037
  },
17528
- conflictingClassGroups: {
17529
- overflow: ["overflow-x", "overflow-y"],
17530
- overscroll: ["overscroll-x", "overscroll-y"],
17531
- inset: ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"],
17532
- "inset-x": ["right", "left"],
17533
- "inset-y": ["top", "bottom"],
17534
- flex: ["basis", "grow", "shrink"],
17535
- gap: ["gap-x", "gap-y"],
17536
- p: ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"],
17537
- px: ["pr", "pl"],
17538
- py: ["pt", "pb"],
17539
- m: ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"],
17540
- mx: ["mr", "ml"],
17541
- my: ["mt", "mb"],
17542
- size: ["w", "h"],
17543
- "font-size": ["leading"],
17544
- "fvn-normal": ["fvn-ordinal", "fvn-slashed-zero", "fvn-figure", "fvn-spacing", "fvn-fraction"],
17545
- "fvn-ordinal": ["fvn-normal"],
17546
- "fvn-slashed-zero": ["fvn-normal"],
17547
- "fvn-figure": ["fvn-normal"],
17548
- "fvn-spacing": ["fvn-normal"],
17549
- "fvn-fraction": ["fvn-normal"],
17550
- "line-clamp": ["display", "overflow"],
17551
- 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"],
17552
- "rounded-s": ["rounded-ss", "rounded-es"],
17553
- "rounded-e": ["rounded-se", "rounded-ee"],
17554
- "rounded-t": ["rounded-tl", "rounded-tr"],
17555
- "rounded-r": ["rounded-tr", "rounded-br"],
17556
- "rounded-b": ["rounded-br", "rounded-bl"],
17557
- "rounded-l": ["rounded-tl", "rounded-bl"],
17558
- "border-spacing": ["border-spacing-x", "border-spacing-y"],
17559
- "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"],
17560
- "border-w-x": ["border-w-r", "border-w-l"],
17561
- "border-w-y": ["border-w-t", "border-w-b"],
17562
- "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"],
17563
- "border-color-x": ["border-color-r", "border-color-l"],
17564
- "border-color-y": ["border-color-t", "border-color-b"],
17565
- translate: ["translate-x", "translate-y", "translate-none"],
17566
- "translate-none": ["translate", "translate-x", "translate-y", "translate-z"],
17567
- "scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"],
17568
- "scroll-mx": ["scroll-mr", "scroll-ml"],
17569
- "scroll-my": ["scroll-mt", "scroll-mb"],
17570
- "scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"],
17571
- "scroll-px": ["scroll-pr", "scroll-pl"],
17572
- "scroll-py": ["scroll-pt", "scroll-pb"],
17573
- touch: ["touch-x", "touch-y", "touch-pz"],
17574
- "touch-x": ["touch"],
17575
- "touch-y": ["touch"],
17576
- "touch-pz": ["touch"]
17038
+ conflictingClassGroups: {
17039
+ overflow: ["overflow-x", "overflow-y"],
17040
+ overscroll: ["overscroll-x", "overscroll-y"],
17041
+ inset: ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"],
17042
+ "inset-x": ["right", "left"],
17043
+ "inset-y": ["top", "bottom"],
17044
+ flex: ["basis", "grow", "shrink"],
17045
+ gap: ["gap-x", "gap-y"],
17046
+ p: ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"],
17047
+ px: ["pr", "pl"],
17048
+ py: ["pt", "pb"],
17049
+ m: ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"],
17050
+ mx: ["mr", "ml"],
17051
+ my: ["mt", "mb"],
17052
+ size: ["w", "h"],
17053
+ "font-size": ["leading"],
17054
+ "fvn-normal": ["fvn-ordinal", "fvn-slashed-zero", "fvn-figure", "fvn-spacing", "fvn-fraction"],
17055
+ "fvn-ordinal": ["fvn-normal"],
17056
+ "fvn-slashed-zero": ["fvn-normal"],
17057
+ "fvn-figure": ["fvn-normal"],
17058
+ "fvn-spacing": ["fvn-normal"],
17059
+ "fvn-fraction": ["fvn-normal"],
17060
+ "line-clamp": ["display", "overflow"],
17061
+ 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"],
17062
+ "rounded-s": ["rounded-ss", "rounded-es"],
17063
+ "rounded-e": ["rounded-se", "rounded-ee"],
17064
+ "rounded-t": ["rounded-tl", "rounded-tr"],
17065
+ "rounded-r": ["rounded-tr", "rounded-br"],
17066
+ "rounded-b": ["rounded-br", "rounded-bl"],
17067
+ "rounded-l": ["rounded-tl", "rounded-bl"],
17068
+ "border-spacing": ["border-spacing-x", "border-spacing-y"],
17069
+ "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"],
17070
+ "border-w-x": ["border-w-r", "border-w-l"],
17071
+ "border-w-y": ["border-w-t", "border-w-b"],
17072
+ "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"],
17073
+ "border-color-x": ["border-color-r", "border-color-l"],
17074
+ "border-color-y": ["border-color-t", "border-color-b"],
17075
+ translate: ["translate-x", "translate-y", "translate-none"],
17076
+ "translate-none": ["translate", "translate-x", "translate-y", "translate-z"],
17077
+ "scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"],
17078
+ "scroll-mx": ["scroll-mr", "scroll-ml"],
17079
+ "scroll-my": ["scroll-mt", "scroll-mb"],
17080
+ "scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"],
17081
+ "scroll-px": ["scroll-pr", "scroll-pl"],
17082
+ "scroll-py": ["scroll-pt", "scroll-pb"],
17083
+ touch: ["touch-x", "touch-y", "touch-pz"],
17084
+ "touch-x": ["touch"],
17085
+ "touch-y": ["touch"],
17086
+ "touch-pz": ["touch"]
17087
+ },
17088
+ conflictingClassGroupModifiers: {
17089
+ "font-size": ["leading"]
17090
+ },
17091
+ orderSensitiveModifiers: ["*", "**", "after", "backdrop", "before", "details-content", "file", "first-letter", "first-line", "marker", "placeholder", "selection"]
17092
+ };
17093
+ };
17094
+ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
17095
+
17096
+ // src/lib/utils.ts
17097
+ function cn(...inputs) {
17098
+ return twMerge(clsx(inputs));
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;
17577
17565
  },
17578
- conflictingClassGroupModifiers: {
17579
- "font-size": ["leading"]
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;
17580
17588
  },
17581
- orderSensitiveModifiers: ["*", "**", "after", "backdrop", "before", "details-content", "file", "first-letter", "first-line", "marker", "placeholder", "selection"]
17589
+ get originalValue() {
17590
+ return originalRef.current;
17591
+ },
17592
+ form: dummyForm,
17593
+ validate(report) {
17594
+ return runValidate(report);
17595
+ }
17582
17596
  };
17583
- };
17584
- var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
17597
+ }
17585
17598
 
17586
- // src/lib/utils.ts
17587
- function cn(...inputs) {
17588
- return twMerge(clsx(inputs));
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());
17589
17609
  }
17590
17610
  var isEmpty = (val) => val === null || val === void 0 || val === "";
17591
17611
  var isAndroid = () => typeof navigator !== "undefined" && /android/i.test(navigator.userAgent || "");
@@ -41581,32 +41601,77 @@ var ShadcnFileVariant = React54.forwardRef(
41581
41601
  };
41582
41602
  const FileChip = ({ item, condensed = false }) => {
41583
41603
  const name = formatFileName ? formatFileName(item) : item.name;
41584
- return /* @__PURE__ */ jsxs(
41585
- "div",
41586
- {
41587
- className: cn(
41588
- "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",
41589
- condensed ? "max-w-[120px]" : "max-w-[200px]"
41590
- ),
41591
- onClick: (e) => e.stopPropagation(),
41592
- children: [
41593
- /* @__PURE__ */ jsx(File2, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
41594
- /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: name }),
41595
- /* @__PURE__ */ jsx(
41596
- "button",
41597
- {
41598
- type: "button",
41599
- onClick: (e) => {
41600
- e.stopPropagation();
41601
- handleRemove(item.id);
41602
- },
41603
- className: "ml-auto rounded-full text-muted-foreground/70 hover:text-destructive",
41604
- children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
41605
- }
41606
- )
41607
- ]
41604
+ const [preview, setPreview] = React54.useState(null);
41605
+ const [isOpen, setIsOpen] = React54.useState(false);
41606
+ React54.useEffect(() => {
41607
+ var _a;
41608
+ const isImage2 = ((_a = item.type) == null ? void 0 : _a.startsWith("image/")) || item.name.match(/\.(jpg|jpeg|png|gif|webp)$/i);
41609
+ if (!isImage2) {
41610
+ setPreview(null);
41611
+ return;
41608
41612
  }
41609
- );
41613
+ if (item.file) {
41614
+ const url = URL.createObjectURL(item.file);
41615
+ setPreview(url);
41616
+ return () => URL.revokeObjectURL(url);
41617
+ }
41618
+ if (item.url || item.path) {
41619
+ setPreview(item.url || item.path || null);
41620
+ }
41621
+ }, [item]);
41622
+ return /* @__PURE__ */ jsxs(Popover2, { open: isOpen, onOpenChange: setIsOpen, children: [
41623
+ /* @__PURE__ */ jsx(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs(
41624
+ "div",
41625
+ {
41626
+ role: "button",
41627
+ tabIndex: 0,
41628
+ className: cn(
41629
+ "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",
41630
+ condensed ? "max-w-[120px]" : "max-w-[200px]"
41631
+ ),
41632
+ onClick: (e) => {
41633
+ e.stopPropagation();
41634
+ setIsOpen(true);
41635
+ },
41636
+ onKeyDown: (e) => {
41637
+ if (e.key === "Enter" || e.key === " ") {
41638
+ e.stopPropagation();
41639
+ setIsOpen(true);
41640
+ }
41641
+ },
41642
+ children: [
41643
+ /* @__PURE__ */ jsx(File2, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
41644
+ /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: name }),
41645
+ /* @__PURE__ */ jsx(
41646
+ "button",
41647
+ {
41648
+ type: "button",
41649
+ onClick: (e) => {
41650
+ e.stopPropagation();
41651
+ handleRemove(item.id);
41652
+ },
41653
+ 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",
41654
+ "aria-label": "Remove file",
41655
+ children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
41656
+ }
41657
+ )
41658
+ ]
41659
+ }
41660
+ ) }),
41661
+ /* @__PURE__ */ jsxs(PopoverContent2, { className: "w-64 p-0", align: "start", side: "bottom", children: [
41662
+ /* @__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: [
41663
+ /* @__PURE__ */ jsx(File2, { className: "h-10 w-10" }),
41664
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] uppercase", children: "No Preview" })
41665
+ ] }) }),
41666
+ /* @__PURE__ */ jsxs("div", { className: "p-3", children: [
41667
+ /* @__PURE__ */ jsx("div", { className: "font-medium text-sm truncate", title: item.name, children: name }),
41668
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center justify-between text-xs text-muted-foreground", children: [
41669
+ /* @__PURE__ */ jsx("span", { children: formatFileSize(item.size) }),
41670
+ item.type && /* @__PURE__ */ jsx("span", { className: "uppercase opacity-70", children: item.type.split("/").pop() })
41671
+ ] })
41672
+ ] })
41673
+ ] })
41674
+ ] });
41610
41675
  };
41611
41676
  const TriggerRegion = React54.useMemo(() => {
41612
41677
  if (showDropArea) {
@@ -41626,7 +41691,7 @@ var ShadcnFileVariant = React54.forwardRef(
41626
41691
  dropAreaClassName
41627
41692
  ),
41628
41693
  children: [
41629
- /* @__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" }) }),
41694
+ /* @__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" }) }),
41630
41695
  /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
41631
41696
  /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: dropTitle != null ? dropTitle : "Click or drag to select" }),
41632
41697
  /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: dropDescription != null ? dropDescription : multiple ? "Select files" : "Select a file" })
@@ -41647,7 +41712,7 @@ var ShadcnFileVariant = React54.forwardRef(
41647
41712
  className: cn(
41648
41713
  "relative flex w-full cursor-pointer items-center gap-2 px-3 transition-all",
41649
41714
  heightCls,
41650
- (!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",
41715
+ (!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",
41651
41716
  dragOver && "border-primary ring-2 ring-primary/20",
41652
41717
  isDisabled && "cursor-not-allowed opacity-50",
41653
41718
  error && "border-destructive text-destructive",
@@ -41687,7 +41752,7 @@ var ShadcnFileVariant = React54.forwardRef(
41687
41752
  /* @__PURE__ */ jsx(
41688
41753
  PopoverContent2,
41689
41754
  {
41690
- className: "w-[--radix-popover-trigger-width] p-0",
41755
+ className: "w-(--radix-popover-trigger-width) p-0",
41691
41756
  align: "start",
41692
41757
  children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
41693
41758
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b px-3 py-2 text-xs font-medium text-muted-foreground", children: [
@@ -41759,7 +41824,7 @@ var ShadcnFileVariant = React54.forwardRef(
41759
41824
  },
41760
41825
  children: [
41761
41826
  /* @__PURE__ */ jsx(Plus, { className: "mr-2 h-3 w-3" }),
41762
- "Add files..."
41827
+ multiple ? "Add files..." : items.length ? "Replace file" : "Add file"
41763
41828
  ]
41764
41829
  }
41765
41830
  ) })
@@ -41850,7 +41915,7 @@ var ShadcnFileVariant = React54.forwardRef(
41850
41915
  children: [
41851
41916
  /* @__PURE__ */ jsxs("div", { className: cn(
41852
41917
  "flex w-full",
41853
- 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"
41918
+ 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"
41854
41919
  ), children: [
41855
41920
  leadingControl && /* @__PURE__ */ jsx("div", { className: cn(
41856
41921
  "flex items-center",
@@ -42711,7 +42776,7 @@ function InputField(props) {
42711
42776
  ].filter(Boolean).join(" ");
42712
42777
  const hasStackedLabelBlock = lp !== "hidden" && hasAnyLabelBlockContent;
42713
42778
  const stackedGroupClassName = [
42714
- hasStackedLabelBlock && hasLabelRowContent ? "mt-1" : null,
42779
+ hasStackedLabelBlock && hasLabelRowContent ? "mt-0.5" : null,
42715
42780
  classes == null ? void 0 : classes.group
42716
42781
  ].filter(Boolean).join(" ");
42717
42782
  const Element2 = contain ? "div" : React54.Fragment;