@timeax/form-palette 0.0.15 → 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,1012 +14089,502 @@ function CoreRoot(props) {
14089
14089
  children
14090
14090
  ] });
14091
14091
  }
14092
- function CoreShell(props) {
14093
- if (props.wrapped) {
14094
- const {
14095
- formProps: formProps2,
14096
- children: children2,
14097
- wrapped,
14098
- // eslint-disable-line @typescript-eslint/no-unused-vars
14099
- gap,
14100
- contentClassName,
14101
- ...coreProps2
14102
- } = props;
14103
- const content = /* @__PURE__ */ jsxRuntime.jsx(
14104
- "div",
14105
- {
14106
- className: contentClassName,
14107
- style: gap !== void 0 ? { gap } : void 0,
14108
- children: children2
14109
- }
14110
- );
14111
- return /* @__PURE__ */ jsxRuntime.jsx(CoreProvider, { ...coreProps2, children: /* @__PURE__ */ jsxRuntime.jsx(CoreRoot, { ...formProps2 != null ? formProps2 : {}, children: content }) });
14112
- }
14113
- const { formProps, children, ...coreProps } = props;
14114
- 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;
14115
14102
  }
14116
- function useButton(options) {
14117
- const form = useCoreContext();
14118
- const { name, submit, disabled: disabledProp = false, onClick } = options;
14119
- const [loading, setLoadingState] = React54__namespace.useState(false);
14120
- const [disabled, setDisabledState] = React54__namespace.useState(
14121
- Boolean(disabledProp)
14122
- );
14123
- const ref = React54__namespace.useRef(null);
14124
- const optsRef = React54__namespace.useRef(options);
14125
- React54__namespace.useEffect(() => {
14126
- optsRef.current = options;
14127
- }, [options]);
14128
- const buttonRef = React54__namespace.useRef(null);
14129
- if (!buttonRef.current) {
14130
- const btn = {
14131
- name,
14132
- // Accessor for "loading" as required by ButtonRef
14133
- set loading(v) {
14134
- setLoadingState(v);
14135
- },
14136
- // Accessor for "disable" (note: interface uses `disable`, not `disabled`)
14137
- //@ts-ignore
14138
- set disable(v) {
14139
- setDisabledState(v);
14140
- },
14141
- // Extra properties used by CoreProvider via any-casts
14142
- get loading() {
14143
- return loading;
14144
- },
14145
- setDisabled(v) {
14146
- setDisabledState(v);
14147
- },
14148
- get disabled() {
14149
- return disabled;
14150
- },
14151
- ref
14152
- };
14153
- btn.setLoading = (v) => {
14154
- setLoadingState(v);
14155
- };
14156
- 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];
14157
14113
  }
14158
- React54__namespace.useEffect(() => {
14159
- if (!buttonRef.current) return;
14160
- buttonRef.current.name = name;
14161
- }, [name]);
14162
- React54__namespace.useEffect(() => {
14163
- if (!buttonRef.current) return;
14164
- form.button = buttonRef.current;
14165
- return () => {
14166
- const anyForm = form;
14167
- if (anyForm.button === buttonRef.current) {
14168
- anyForm.button = null;
14169
- }
14170
- };
14171
- }, [form]);
14172
- const handleClick = (event) => {
14173
- const currentOpts = optsRef.current;
14174
- const shouldSubmit = !!currentOpts.submit;
14175
- if (currentOpts.onClick) {
14176
- currentOpts.onClick(event, form);
14177
- }
14178
- if (event.defaultPrevented) {
14179
- return;
14180
- }
14181
- if (shouldSubmit) {
14182
- form.setActiveButton(currentOpts.name);
14183
- 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);
14184
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);
14185
14144
  };
14186
- const setLoading = (v) => {
14187
- setLoadingState(v);
14188
- };
14189
- const setDisabled = (v) => {
14190
- 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;
14191
14158
  };
14192
14159
  return {
14193
- loading,
14194
- setLoading,
14195
- disabled,
14196
- setDisabled,
14197
- ref,
14198
- onClick: handleClick,
14199
- buttonProps: {
14200
- ref,
14201
- disabled: disabled || loading,
14202
- "data-loading": loading ? "true" : "false",
14203
- onClick: handleClick
14204
- }
14160
+ getClassGroupId,
14161
+ getConflictingClassGroupIds
14205
14162
  };
14206
- }
14207
- function useField(options) {
14208
- var _a;
14209
- 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) => {
14210
14196
  const {
14211
- name: rawName,
14212
- bindId: rawBindId,
14213
- bind: bind2,
14214
- shared,
14215
- groupId,
14216
- alias,
14217
- main,
14218
- ignore,
14219
- required: requiredProp = false,
14220
- defaultValue,
14221
- disabled: disabledProp = false,
14222
- readOnly: readOnlyProp = false,
14223
- validate,
14224
- getOriginalValue,
14225
- onValueChange
14226
- } = options;
14227
- const ref = React54__namespace.useRef(null);
14228
- const stateRef = React54__namespace.useRef({
14229
- value: defaultValue,
14230
- error: "",
14231
- loading: false,
14232
- original: getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
14233
- });
14234
- const [value, setValueState] = React54__namespace.useState(
14235
- stateRef.current.value
14236
- );
14237
- const [error, setErrorState] = React54__namespace.useState(
14238
- stateRef.current.error
14239
- );
14240
- const [loading, setLoadingState] = React54__namespace.useState(
14241
- stateRef.current.loading
14242
- );
14243
- const [required, setRequired] = React54__namespace.useState(
14244
- Boolean(requiredProp)
14245
- );
14246
- const [disabled, setDisabled] = React54__namespace.useState(
14247
- Boolean(disabledProp)
14248
- );
14249
- const [readOnly, setReadOnly] = React54__namespace.useState(
14250
- Boolean(readOnlyProp)
14251
- );
14252
- const id = React54__namespace.useId();
14253
- const keyRef = React54__namespace.useRef((() => {
14254
- if (rawName && rawName.trim()) return `${rawName.trim()}-${id}`;
14255
- if (rawBindId && rawBindId.trim()) return `${rawBindId.trim()}-${id}`;
14256
- return `field-${Math.random().toString(36).slice(2)}-${id}`;
14257
- })());
14258
- const bindIdRef = React54__namespace.useRef(
14259
- rawBindId && rawBindId.trim() || keyRef.current
14260
- );
14261
- const fieldRef = React54__namespace.useRef(null);
14262
- if (!fieldRef.current) {
14263
- const key = keyRef.current;
14264
- const bindId = bindIdRef.current;
14265
- const trimmedName = (_a = rawName == null ? void 0 : rawName.trim()) != null ? _a : "";
14266
- const validateFn = (report) => {
14267
- const curDisabled = disabled || readOnly;
14268
- if (curDisabled && !report) {
14269
- return true;
14270
- }
14271
- const current = stateRef.current.value;
14272
- let ok = true;
14273
- let message2 = "";
14274
- if (required && (current === void 0 || current === null || typeof current === "string" && current.trim() === "" || Array.isArray(current) && current.length === 0)) {
14275
- ok = false;
14276
- message2 = "This field is required.";
14277
- } else if (validate) {
14278
- const result = validate(current, !!report);
14279
- if (typeof result === "string") {
14280
- ok = false;
14281
- message2 = result;
14282
- } else if (result === false) {
14283
- ok = false;
14284
- }
14285
- }
14286
- if (!report) {
14287
- return ok;
14288
- }
14289
- stateRef.current.error = ok ? "" : message2;
14290
- setErrorState(ok ? "" : message2);
14291
- return ok;
14292
- };
14293
- const f = {
14294
- key,
14295
- bindId,
14296
- bind: bind2,
14297
- name: trimmedName,
14298
- shared,
14299
- groupId,
14300
- alias,
14301
- main,
14302
- ignore,
14303
- required,
14304
- ref,
14305
- get defaultValue() {
14306
- return stateRef.current.original;
14307
- },
14308
- get value() {
14309
- return stateRef.current.value;
14310
- },
14311
- set value(v) {
14312
- stateRef.current.value = v;
14313
- setValueState(v);
14314
- },
14315
- get originalValue() {
14316
- return stateRef.current.original;
14317
- },
14318
- get error() {
14319
- return stateRef.current.error;
14320
- },
14321
- set error(msg) {
14322
- stateRef.current.error = msg;
14323
- setErrorState(msg);
14324
- },
14325
- get loading() {
14326
- return stateRef.current.loading;
14327
- },
14328
- set loading(v) {
14329
- stateRef.current.loading = v;
14330
- setLoadingState(v);
14331
- },
14332
- validate: validateFn,
14333
- onChange(value2, old, variant) {
14334
- if (onValueChange) {
14335
- onValueChange(value2, old, variant);
14336
- }
14337
- }
14338
- // Flags not directly on the Field interface but used via `as any`
14339
- // in core-provider (getValue/setValue/reset).
14340
- };
14341
- f.getValue = () => stateRef.current.value;
14342
- f.setValue = (next) => {
14343
- stateRef.current.value = next;
14344
- setValueState(next);
14345
- };
14346
- f.reset = () => {
14347
- stateRef.current.value = defaultValue;
14348
- stateRef.current.error = "";
14349
- stateRef.current.loading = false;
14350
- setValueState(defaultValue);
14351
- setErrorState("");
14352
- setLoadingState(false);
14353
- };
14354
- 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);
14355
14207
  }
14356
- const field = fieldRef.current;
14357
- React54__namespace.useEffect(() => {
14358
- setRequired(!!requiredProp);
14359
- if (field) {
14360
- field.required = !!requiredProp;
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);
14215
+ }
14216
+ };
14217
+ var processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14218
+ if (typeof classDefinition === "string") {
14219
+ processStringDefinition(classDefinition, classPartObject, classGroupId);
14220
+ return;
14221
+ }
14222
+ if (typeof classDefinition === "function") {
14223
+ processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
14224
+ return;
14225
+ }
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);
14361
14260
  }
14362
- }, [requiredProp, field]);
14363
- React54__namespace.useEffect(() => {
14364
- setDisabled(!!disabledProp);
14365
- }, [disabledProp]);
14366
- React54__namespace.useEffect(() => {
14367
- setReadOnly(!!readOnlyProp);
14368
- }, [readOnlyProp]);
14369
- React54__namespace.useEffect(() => {
14370
- if (!field) return;
14371
- form.addField(field);
14372
- return () => {
14373
- const registry3 = form.inputs;
14374
- if (registry3 && typeof registry3.remove === "function") {
14375
- registry3.remove(field.key);
14261
+ current = next;
14262
+ }
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: () => {
14376
14271
  }
14377
14272
  };
14378
- }, [form, field]);
14379
- function setValue(next, variant = "direct") {
14380
- var _a2;
14381
- const prev = stateRef.current.value;
14382
- if (Object.is(prev, next)) return;
14383
- const runFormOnChange = () => {
14384
- var _a3;
14385
- const props2 = (_a3 = form.props) != null ? _a3 : {};
14386
- const fn = props2.onChange;
14387
- if (!fn) return;
14388
- fn(form, field, {
14389
- variant,
14390
- value: next,
14391
- previous: prev
14392
- });
14393
- };
14394
- const props = (_a2 = form.props) != null ? _a2 : {};
14395
- const changeBefore = !!props.changeBefore;
14396
- if (changeBefore) {
14397
- runFormOnChange();
14398
- }
14399
- stateRef.current.value = next;
14400
- setValueState(next);
14401
- if (field.onChange) {
14402
- field.onChange(next, prev, variant);
14403
- }
14404
- if (!changeBefore) {
14405
- runFormOnChange();
14406
- }
14407
- form.controlButton();
14408
- }
14409
- function setError(message2) {
14410
- stateRef.current.error = message2;
14411
- setErrorState(message2);
14412
- }
14413
- function setLoading(loading2) {
14414
- stateRef.current.loading = loading2;
14415
- setLoadingState(loading2);
14416
14273
  }
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);
14284
+ }
14285
+ };
14417
14286
  return {
14418
- ref,
14419
- get key() {
14420
- return keyRef.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
+ }
14421
14296
  },
14422
- value,
14423
- setValue,
14424
- error,
14425
- setError,
14426
- loading,
14427
- setLoading,
14428
- required,
14429
- setRequired,
14430
- disabled,
14431
- setDisabled,
14432
- readOnly,
14433
- setReadOnly,
14434
- name: field.name,
14435
- bindId: field.bindId,
14436
- bind: field.bind,
14437
- shared: field.shared,
14438
- groupId: field.groupId,
14439
- alias: field.alias,
14440
- main: field.main,
14441
- ignore: field.ignore,
14442
- get defaultValue() {
14443
- return stateRef.current.original;
14444
- },
14445
- get originalValue() {
14446
- return stateRef.current.original;
14447
- },
14448
- form,
14449
- validate(report) {
14450
- var _a2;
14451
- return (_a2 = field.validate) == null ? void 0 : _a2.call(field, report);
14297
+ set(key, value) {
14298
+ if (key in cache) {
14299
+ cache[key] = value;
14300
+ } else {
14301
+ update(key, value);
14302
+ }
14452
14303
  }
14453
14304
  };
14454
- }
14455
- function useOptionalField(options) {
14456
- var _a;
14457
- try {
14458
- return useField(options);
14459
- } catch {
14460
- }
14461
- {
14462
- console.warn(
14463
- "[FormPalette] useOptionalField: No CoreProvider found. Running in self-managed mode."
14464
- );
14465
- }
14305
+ };
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
14315
+ });
14316
+ var createParseClassName = (config3) => {
14466
14317
  const {
14467
- name: rawName,
14468
- bindId: rawBindId,
14469
- bind: bind2,
14470
- shared,
14471
- groupId,
14472
- alias,
14473
- main,
14474
- ignore,
14475
- required: requiredProp = false,
14476
- defaultValue,
14477
- disabled: disabledProp = false,
14478
- readOnly: readOnlyProp = false,
14479
- validate,
14480
- getOriginalValue,
14481
- onValueChange
14482
- } = options;
14483
- const ref = React54__namespace.useRef(null);
14484
- const [value, setValueState] = React54__namespace.useState(defaultValue);
14485
- const [error, setErrorState] = React54__namespace.useState("");
14486
- const [loading, setLoadingState] = React54__namespace.useState(false);
14487
- const [required, setRequired] = React54__namespace.useState(!!requiredProp);
14488
- const [disabled, setDisabled] = React54__namespace.useState(!!disabledProp);
14489
- const [readOnly, setReadOnly] = React54__namespace.useState(!!readOnlyProp);
14490
- const originalRef = React54__namespace.useRef(
14491
- getOriginalValue ? getOriginalValue(defaultValue) : defaultValue
14492
- );
14493
- const id = React54__namespace.useId();
14494
- const keyRef = React54__namespace.useRef("");
14495
- if (!keyRef.current) {
14496
- if (rawName && rawName.trim()) {
14497
- keyRef.current = `${rawName.trim()}-${id}`;
14498
- } else if (rawBindId && rawBindId.trim()) {
14499
- keyRef.current = `${rawBindId.trim()}-${id}`;
14500
- } else {
14501
- keyRef.current = `field-${Math.random().toString(36).slice(2)}-${id}`;
14318
+ prefix,
14319
+ experimentalParseClassName
14320
+ } = config3;
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;
14339
+ }
14340
+ }
14341
+ if (currentCharacter === "[") bracketDepth++;
14342
+ else if (currentCharacter === "]") bracketDepth--;
14343
+ else if (currentCharacter === "(") parenDepth++;
14344
+ else if (currentCharacter === ")") parenDepth--;
14502
14345
  }
14503
- }
14504
- const bindIdRef = React54__namespace.useRef("");
14505
- if (!bindIdRef.current) {
14506
- bindIdRef.current = rawBindId && rawBindId.trim() || keyRef.current;
14507
- }
14508
- React54__namespace.useEffect(() => {
14509
- setRequired(!!requiredProp);
14510
- }, [requiredProp]);
14511
- React54__namespace.useEffect(() => {
14512
- setDisabled(!!disabledProp);
14513
- }, [disabledProp]);
14514
- React54__namespace.useEffect(() => {
14515
- setReadOnly(!!readOnlyProp);
14516
- }, [readOnlyProp]);
14517
- function setValue(next, variant = "direct") {
14518
- const prev = value;
14519
- if (Object.is(prev, next)) return;
14520
- setValueState(next);
14521
- if (onValueChange) {
14522
- onValueChange(next, prev, variant);
14346
+ const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
14347
+ let baseClassName = baseClassNameWithImportantModifier;
14348
+ let hasImportantModifier = false;
14349
+ if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {
14350
+ baseClassName = baseClassNameWithImportantModifier.slice(0, -1);
14351
+ hasImportantModifier = true;
14352
+ } else if (
14353
+ /**
14354
+ * In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
14355
+ * @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
14356
+ */
14357
+ baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)
14358
+ ) {
14359
+ baseClassName = baseClassNameWithImportantModifier.slice(1);
14360
+ hasImportantModifier = true;
14523
14361
  }
14362
+ const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
14363
+ return createResultObject(modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition);
14364
+ };
14365
+ if (prefix) {
14366
+ const fullPrefix = prefix + MODIFIER_SEPARATOR;
14367
+ const parseClassNameOriginal = parseClassName;
14368
+ parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.slice(fullPrefix.length)) : createResultObject(EMPTY_MODIFIERS, false, className, void 0, true);
14524
14369
  }
14525
- function setError(message2) {
14526
- setErrorState(message2);
14527
- }
14528
- function setLoading(next) {
14529
- setLoadingState(next);
14370
+ if (experimentalParseClassName) {
14371
+ const parseClassNameOriginal = parseClassName;
14372
+ parseClassName = (className) => experimentalParseClassName({
14373
+ className,
14374
+ parseClassName: parseClassNameOriginal
14375
+ });
14530
14376
  }
14531
- function runValidate(report) {
14532
- const current = value;
14533
- let ok = true;
14534
- let message2 = "";
14535
- if (required && (current === void 0 || current === null || typeof current === "string" && current.trim() === "" || Array.isArray(current) && current.length === 0)) {
14536
- ok = false;
14537
- message2 = "This field is required.";
14538
- } else if (validate) {
14539
- const result = validate(current, !!report);
14540
- if (typeof result === "string") {
14541
- ok = false;
14542
- message2 = result;
14543
- } else if (result === false) {
14544
- ok = false;
14377
+ return parseClassName;
14378
+ };
14379
+ var createSortModifiers = (config3) => {
14380
+ const modifierWeights = /* @__PURE__ */ new Map();
14381
+ config3.orderSensitiveModifiers.forEach((mod, index2) => {
14382
+ modifierWeights.set(mod, 1e6 + index2);
14383
+ });
14384
+ return (modifiers) => {
14385
+ const result = [];
14386
+ let currentSegment = [];
14387
+ for (let i = 0; i < modifiers.length; i++) {
14388
+ const modifier = modifiers[i];
14389
+ const isArbitrary = modifier[0] === "[";
14390
+ const isOrderSensitive = modifierWeights.has(modifier);
14391
+ if (isArbitrary || isOrderSensitive) {
14392
+ if (currentSegment.length > 0) {
14393
+ currentSegment.sort();
14394
+ result.push(...currentSegment);
14395
+ currentSegment = [];
14396
+ }
14397
+ result.push(modifier);
14398
+ } else {
14399
+ currentSegment.push(modifier);
14545
14400
  }
14546
14401
  }
14547
- if (report) {
14548
- setErrorState(ok ? "" : message2);
14549
- }
14550
- return ok;
14551
- }
14552
- const dummyForm = {};
14553
- return {
14554
- ref,
14555
- get key() {
14556
- return keyRef.current;
14557
- },
14558
- value,
14559
- setValue,
14560
- error,
14561
- setError,
14562
- loading,
14563
- setLoading,
14564
- required,
14565
- setRequired,
14566
- disabled,
14567
- setDisabled,
14568
- readOnly,
14569
- setReadOnly,
14570
- name: (_a = rawName == null ? void 0 : rawName.trim()) != null ? _a : "",
14571
- bindId: bindIdRef.current,
14572
- bind: bind2,
14573
- shared,
14574
- groupId,
14575
- alias,
14576
- main,
14577
- ignore,
14578
- get defaultValue() {
14579
- return originalRef.current;
14580
- },
14581
- get originalValue() {
14582
- return originalRef.current;
14583
- },
14584
- form: dummyForm,
14585
- validate(report) {
14586
- return runValidate(report);
14402
+ if (currentSegment.length > 0) {
14403
+ currentSegment.sort();
14404
+ result.push(...currentSegment);
14587
14405
  }
14406
+ return result;
14588
14407
  };
14589
- }
14590
-
14591
- // src/variants/registry.ts
14592
- var registry2 = /* @__PURE__ */ new Map();
14593
- function registerVariant(module2) {
14594
- registry2.set(module2.variant, module2);
14595
- }
14596
- function getVariant(key) {
14597
- return registry2.get(key);
14598
- }
14599
- function listVariants() {
14600
- return Array.from(registry2.values());
14601
- }
14602
-
14603
- // ../../node_modules/clsx/dist/clsx.mjs
14604
- function r(e) {
14605
- var t, f, n = "";
14606
- if ("string" == typeof e || "number" == typeof e) n += e;
14607
- else if ("object" == typeof e) if (Array.isArray(e)) {
14608
- var o = e.length;
14609
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
14610
- } else for (f in e) e[f] && (n && (n += " "), n += f);
14611
- return n;
14612
- }
14613
- function clsx() {
14614
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
14615
- return n;
14616
- }
14617
-
14618
- // ../../node_modules/tailwind-merge/dist/bundle-mjs.mjs
14619
- var concatArrays = (array1, array2) => {
14620
- const combinedArray = new Array(array1.length + array2.length);
14621
- for (let i = 0; i < array1.length; i++) {
14622
- combinedArray[i] = array1[i];
14623
- }
14624
- for (let i = 0; i < array2.length; i++) {
14625
- combinedArray[array1.length + i] = array2[i];
14626
- }
14627
- return combinedArray;
14628
14408
  };
14629
- var createClassValidatorObject = (classGroupId, validator) => ({
14630
- classGroupId,
14631
- validator
14632
- });
14633
- var createClassPartObject = (nextPart = /* @__PURE__ */ new Map(), validators3 = null, classGroupId) => ({
14634
- nextPart,
14635
- validators: validators3,
14636
- classGroupId
14409
+ var createConfigUtils = (config3) => ({
14410
+ cache: createLruCache(config3.cacheSize),
14411
+ parseClassName: createParseClassName(config3),
14412
+ sortModifiers: createSortModifiers(config3),
14413
+ ...createClassGroupUtils(config3)
14637
14414
  });
14638
- var CLASS_PART_SEPARATOR = "-";
14639
- var EMPTY_CONFLICTS = [];
14640
- var ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
14641
- var createClassGroupUtils = (config3) => {
14642
- const classMap = createClassMap(config3);
14415
+ var SPLIT_CLASSES_REGEX = /\s+/;
14416
+ var mergeClassList = (classList, configUtils) => {
14643
14417
  const {
14644
- conflictingClassGroups,
14645
- conflictingClassGroupModifiers
14646
- } = config3;
14647
- const getClassGroupId = (className) => {
14648
- if (className.startsWith("[") && className.endsWith("]")) {
14649
- return getGroupIdForArbitraryProperty(className);
14418
+ parseClassName,
14419
+ getClassGroupId,
14420
+ getConflictingClassGroupIds,
14421
+ sortModifiers
14422
+ } = configUtils;
14423
+ const classGroupsInConflict = [];
14424
+ const classNames = classList.trim().split(SPLIT_CLASSES_REGEX);
14425
+ let result = "";
14426
+ for (let index2 = classNames.length - 1; index2 >= 0; index2 -= 1) {
14427
+ const originalClassName = classNames[index2];
14428
+ const {
14429
+ isExternal,
14430
+ modifiers,
14431
+ hasImportantModifier,
14432
+ baseClassName,
14433
+ maybePostfixModifierPosition
14434
+ } = parseClassName(originalClassName);
14435
+ if (isExternal) {
14436
+ result = originalClassName + (result.length > 0 ? " " + result : result);
14437
+ continue;
14650
14438
  }
14651
- const classParts = className.split(CLASS_PART_SEPARATOR);
14652
- const startIndex = classParts[0] === "" && classParts.length > 1 ? 1 : 0;
14653
- return getGroupRecursive(classParts, startIndex, classMap);
14654
- };
14655
- const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
14656
- if (hasPostfixModifier) {
14657
- const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
14658
- const baseConflicts = conflictingClassGroups[classGroupId];
14659
- if (modifierConflicts) {
14660
- if (baseConflicts) {
14661
- return concatArrays(baseConflicts, modifierConflicts);
14662
- }
14663
- return modifierConflicts;
14439
+ let hasPostfixModifier = !!maybePostfixModifierPosition;
14440
+ let classGroupId = getClassGroupId(hasPostfixModifier ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);
14441
+ if (!classGroupId) {
14442
+ if (!hasPostfixModifier) {
14443
+ result = originalClassName + (result.length > 0 ? " " + result : result);
14444
+ continue;
14664
14445
  }
14665
- return baseConflicts || EMPTY_CONFLICTS;
14446
+ classGroupId = getClassGroupId(baseClassName);
14447
+ if (!classGroupId) {
14448
+ result = originalClassName + (result.length > 0 ? " " + result : result);
14449
+ continue;
14450
+ }
14451
+ hasPostfixModifier = false;
14666
14452
  }
14667
- return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
14668
- };
14669
- return {
14670
- getClassGroupId,
14671
- getConflictingClassGroupIds
14672
- };
14673
- };
14674
- var getGroupRecursive = (classParts, startIndex, classPartObject) => {
14675
- const classPathsLength = classParts.length - startIndex;
14676
- if (classPathsLength === 0) {
14677
- return classPartObject.classGroupId;
14678
- }
14679
- const currentClassPart = classParts[startIndex];
14680
- const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
14681
- if (nextClassPartObject) {
14682
- const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
14683
- if (result) return result;
14684
- }
14685
- const validators3 = classPartObject.validators;
14686
- if (validators3 === null) {
14687
- return void 0;
14688
- }
14689
- const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
14690
- const validatorsLength = validators3.length;
14691
- for (let i = 0; i < validatorsLength; i++) {
14692
- const validatorObj = validators3[i];
14693
- if (validatorObj.validator(classRest)) {
14694
- return validatorObj.classGroupId;
14453
+ const variantModifier = modifiers.length === 0 ? "" : modifiers.length === 1 ? modifiers[0] : sortModifiers(modifiers).join(":");
14454
+ const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
14455
+ const classId = modifierId + classGroupId;
14456
+ if (classGroupsInConflict.indexOf(classId) > -1) {
14457
+ continue;
14695
14458
  }
14459
+ classGroupsInConflict.push(classId);
14460
+ const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
14461
+ for (let i = 0; i < conflictGroups.length; ++i) {
14462
+ const group = conflictGroups[i];
14463
+ classGroupsInConflict.push(modifierId + group);
14464
+ }
14465
+ result = originalClassName + (result.length > 0 ? " " + result : result);
14696
14466
  }
14697
- return void 0;
14698
- };
14699
- var getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
14700
- const content = className.slice(1, -1);
14701
- const colonIndex = content.indexOf(":");
14702
- const property = content.slice(0, colonIndex);
14703
- return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
14704
- })();
14705
- var createClassMap = (config3) => {
14706
- const {
14707
- theme,
14708
- classGroups
14709
- } = config3;
14710
- return processClassGroups(classGroups, theme);
14711
- };
14712
- var processClassGroups = (classGroups, theme) => {
14713
- const classMap = createClassPartObject();
14714
- for (const classGroupId in classGroups) {
14715
- const group = classGroups[classGroupId];
14716
- processClassesRecursively(group, classMap, classGroupId, theme);
14717
- }
14718
- return classMap;
14467
+ return result;
14719
14468
  };
14720
- var processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
14721
- const len = classGroup.length;
14722
- for (let i = 0; i < len; i++) {
14723
- const classDefinition = classGroup[i];
14724
- processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
14469
+ var twJoin = (...classLists) => {
14470
+ let index2 = 0;
14471
+ let argument;
14472
+ let resolvedValue;
14473
+ let string = "";
14474
+ while (index2 < classLists.length) {
14475
+ if (argument = classLists[index2++]) {
14476
+ if (resolvedValue = toValue(argument)) {
14477
+ string && (string += " ");
14478
+ string += resolvedValue;
14479
+ }
14480
+ }
14725
14481
  }
14482
+ return string;
14726
14483
  };
14727
- var processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14728
- if (typeof classDefinition === "string") {
14729
- processStringDefinition(classDefinition, classPartObject, classGroupId);
14730
- return;
14484
+ var toValue = (mix) => {
14485
+ if (typeof mix === "string") {
14486
+ return mix;
14731
14487
  }
14732
- if (typeof classDefinition === "function") {
14733
- processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
14734
- return;
14488
+ let resolvedValue;
14489
+ let string = "";
14490
+ for (let k = 0; k < mix.length; k++) {
14491
+ if (mix[k]) {
14492
+ if (resolvedValue = toValue(mix[k])) {
14493
+ string && (string += " ");
14494
+ string += resolvedValue;
14495
+ }
14496
+ }
14735
14497
  }
14736
- processObjectDefinition(classDefinition, classPartObject, classGroupId, theme);
14737
- };
14738
- var processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
14739
- const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
14740
- classPartObjectToEdit.classGroupId = classGroupId;
14498
+ return string;
14741
14499
  };
14742
- var processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14743
- if (isThemeGetter(classDefinition)) {
14744
- processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
14745
- return;
14746
- }
14747
- if (classPartObject.validators === null) {
14748
- classPartObject.validators = [];
14749
- }
14750
- classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
14500
+ var createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
14501
+ let configUtils;
14502
+ let cacheGet;
14503
+ let cacheSet;
14504
+ let functionToCall;
14505
+ const initTailwindMerge = (classList) => {
14506
+ const config3 = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
14507
+ configUtils = createConfigUtils(config3);
14508
+ cacheGet = configUtils.cache.get;
14509
+ cacheSet = configUtils.cache.set;
14510
+ functionToCall = tailwindMerge;
14511
+ return tailwindMerge(classList);
14512
+ };
14513
+ const tailwindMerge = (classList) => {
14514
+ const cachedResult = cacheGet(classList);
14515
+ if (cachedResult) {
14516
+ return cachedResult;
14517
+ }
14518
+ const result = mergeClassList(classList, configUtils);
14519
+ cacheSet(classList, result);
14520
+ return result;
14521
+ };
14522
+ functionToCall = initTailwindMerge;
14523
+ return (...args) => functionToCall(twJoin(...args));
14751
14524
  };
14752
- var processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
14753
- const entries = Object.entries(classDefinition);
14754
- const len = entries.length;
14755
- for (let i = 0; i < len; i++) {
14756
- const [key, value] = entries[i];
14757
- processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
14758
- }
14525
+ var fallbackThemeArr = [];
14526
+ var fromTheme = (key) => {
14527
+ const themeGetter = (theme) => theme[key] || fallbackThemeArr;
14528
+ themeGetter.isThemeGetter = true;
14529
+ return themeGetter;
14759
14530
  };
14760
- var getPart = (classPartObject, path) => {
14761
- let current = classPartObject;
14762
- const parts = path.split(CLASS_PART_SEPARATOR);
14763
- const len = parts.length;
14764
- for (let i = 0; i < len; i++) {
14765
- const part = parts[i];
14766
- let next = current.nextPart.get(part);
14767
- if (!next) {
14768
- next = createClassPartObject();
14769
- current.nextPart.set(part, next);
14531
+ var arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i;
14532
+ var arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i;
14533
+ var fractionRegex = /^\d+\/\d+$/;
14534
+ var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
14535
+ var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
14536
+ var colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/;
14537
+ var shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
14538
+ var imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
14539
+ var isFraction = (value) => fractionRegex.test(value);
14540
+ var isNumber = (value) => !!value && !Number.isNaN(Number(value));
14541
+ var isInteger = (value) => !!value && Number.isInteger(Number(value));
14542
+ var isPercent = (value) => value.endsWith("%") && isNumber(value.slice(0, -1));
14543
+ var isTshirtSize = (value) => tshirtUnitRegex.test(value);
14544
+ var isAny = () => true;
14545
+ var isLengthOnly = (value) => (
14546
+ // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
14547
+ // For example, `hsl(0 0% 0%)` would be classified as a length without this check.
14548
+ // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
14549
+ lengthUnitRegex.test(value) && !colorFunctionRegex.test(value)
14550
+ );
14551
+ var isNever = () => false;
14552
+ var isShadow = (value) => shadowRegex.test(value);
14553
+ var isImage = (value) => imageRegex.test(value);
14554
+ var isAnyNonArbitrary = (value) => !isArbitraryValue(value) && !isArbitraryVariable(value);
14555
+ var isArbitrarySize = (value) => getIsArbitraryValue(value, isLabelSize, isNever);
14556
+ var isArbitraryValue = (value) => arbitraryValueRegex.test(value);
14557
+ var isArbitraryLength = (value) => getIsArbitraryValue(value, isLabelLength, isLengthOnly);
14558
+ var isArbitraryNumber = (value) => getIsArbitraryValue(value, isLabelNumber, isNumber);
14559
+ var isArbitraryPosition = (value) => getIsArbitraryValue(value, isLabelPosition, isNever);
14560
+ var isArbitraryImage = (value) => getIsArbitraryValue(value, isLabelImage, isImage);
14561
+ var isArbitraryShadow = (value) => getIsArbitraryValue(value, isLabelShadow, isShadow);
14562
+ var isArbitraryVariable = (value) => arbitraryVariableRegex.test(value);
14563
+ var isArbitraryVariableLength = (value) => getIsArbitraryVariable(value, isLabelLength);
14564
+ var isArbitraryVariableFamilyName = (value) => getIsArbitraryVariable(value, isLabelFamilyName);
14565
+ var isArbitraryVariablePosition = (value) => getIsArbitraryVariable(value, isLabelPosition);
14566
+ var isArbitraryVariableSize = (value) => getIsArbitraryVariable(value, isLabelSize);
14567
+ var isArbitraryVariableImage = (value) => getIsArbitraryVariable(value, isLabelImage);
14568
+ var isArbitraryVariableShadow = (value) => getIsArbitraryVariable(value, isLabelShadow, true);
14569
+ var getIsArbitraryValue = (value, testLabel, testValue) => {
14570
+ const result = arbitraryValueRegex.exec(value);
14571
+ if (result) {
14572
+ if (result[1]) {
14573
+ return testLabel(result[1]);
14770
14574
  }
14771
- current = next;
14772
- }
14773
- return current;
14774
- };
14775
- var isThemeGetter = (func) => "isThemeGetter" in func && func.isThemeGetter === true;
14776
- var createLruCache = (maxCacheSize) => {
14777
- if (maxCacheSize < 1) {
14778
- return {
14779
- get: () => void 0,
14780
- set: () => {
14781
- }
14782
- };
14575
+ return testValue(result[2]);
14783
14576
  }
14784
- let cacheSize = 0;
14785
- let cache = /* @__PURE__ */ Object.create(null);
14786
- let previousCache = /* @__PURE__ */ Object.create(null);
14787
- const update = (key, value) => {
14788
- cache[key] = value;
14789
- cacheSize++;
14790
- if (cacheSize > maxCacheSize) {
14791
- cacheSize = 0;
14792
- previousCache = cache;
14793
- cache = /* @__PURE__ */ Object.create(null);
14794
- }
14795
- };
14796
- return {
14797
- get(key) {
14798
- let value = cache[key];
14799
- if (value !== void 0) {
14800
- return value;
14801
- }
14802
- if ((value = previousCache[key]) !== void 0) {
14803
- update(key, value);
14804
- return value;
14805
- }
14806
- },
14807
- set(key, value) {
14808
- if (key in cache) {
14809
- cache[key] = value;
14810
- } else {
14811
- update(key, value);
14812
- }
14813
- }
14814
- };
14577
+ return false;
14815
14578
  };
14816
- var IMPORTANT_MODIFIER = "!";
14817
- var MODIFIER_SEPARATOR = ":";
14818
- var EMPTY_MODIFIERS = [];
14819
- var createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
14820
- modifiers,
14821
- hasImportantModifier,
14822
- baseClassName,
14823
- maybePostfixModifierPosition,
14824
- isExternal
14825
- });
14826
- var createParseClassName = (config3) => {
14827
- const {
14828
- prefix,
14829
- experimentalParseClassName
14830
- } = config3;
14831
- let parseClassName = (className) => {
14832
- const modifiers = [];
14833
- let bracketDepth = 0;
14834
- let parenDepth = 0;
14835
- let modifierStart = 0;
14836
- let postfixModifierPosition;
14837
- const len = className.length;
14838
- for (let index2 = 0; index2 < len; index2++) {
14839
- const currentCharacter = className[index2];
14840
- if (bracketDepth === 0 && parenDepth === 0) {
14841
- if (currentCharacter === MODIFIER_SEPARATOR) {
14842
- modifiers.push(className.slice(modifierStart, index2));
14843
- modifierStart = index2 + 1;
14844
- continue;
14845
- }
14846
- if (currentCharacter === "/") {
14847
- postfixModifierPosition = index2;
14848
- continue;
14849
- }
14850
- }
14851
- if (currentCharacter === "[") bracketDepth++;
14852
- else if (currentCharacter === "]") bracketDepth--;
14853
- else if (currentCharacter === "(") parenDepth++;
14854
- else if (currentCharacter === ")") parenDepth--;
14855
- }
14856
- const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
14857
- let baseClassName = baseClassNameWithImportantModifier;
14858
- let hasImportantModifier = false;
14859
- if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {
14860
- baseClassName = baseClassNameWithImportantModifier.slice(0, -1);
14861
- hasImportantModifier = true;
14862
- } else if (
14863
- /**
14864
- * In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
14865
- * @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
14866
- */
14867
- baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)
14868
- ) {
14869
- baseClassName = baseClassNameWithImportantModifier.slice(1);
14870
- hasImportantModifier = true;
14579
+ var getIsArbitraryVariable = (value, testLabel, shouldMatchNoLabel = false) => {
14580
+ const result = arbitraryVariableRegex.exec(value);
14581
+ if (result) {
14582
+ if (result[1]) {
14583
+ return testLabel(result[1]);
14871
14584
  }
14872
- const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
14873
- return createResultObject(modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition);
14874
- };
14875
- if (prefix) {
14876
- const fullPrefix = prefix + MODIFIER_SEPARATOR;
14877
- const parseClassNameOriginal = parseClassName;
14878
- parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.slice(fullPrefix.length)) : createResultObject(EMPTY_MODIFIERS, false, className, void 0, true);
14879
- }
14880
- if (experimentalParseClassName) {
14881
- const parseClassNameOriginal = parseClassName;
14882
- parseClassName = (className) => experimentalParseClassName({
14883
- className,
14884
- parseClassName: parseClassNameOriginal
14885
- });
14585
+ return shouldMatchNoLabel;
14886
14586
  }
14887
- return parseClassName;
14888
- };
14889
- var createSortModifiers = (config3) => {
14890
- const modifierWeights = /* @__PURE__ */ new Map();
14891
- config3.orderSensitiveModifiers.forEach((mod, index2) => {
14892
- modifierWeights.set(mod, 1e6 + index2);
14893
- });
14894
- return (modifiers) => {
14895
- const result = [];
14896
- let currentSegment = [];
14897
- for (let i = 0; i < modifiers.length; i++) {
14898
- const modifier = modifiers[i];
14899
- const isArbitrary = modifier[0] === "[";
14900
- const isOrderSensitive = modifierWeights.has(modifier);
14901
- if (isArbitrary || isOrderSensitive) {
14902
- if (currentSegment.length > 0) {
14903
- currentSegment.sort();
14904
- result.push(...currentSegment);
14905
- currentSegment = [];
14906
- }
14907
- result.push(modifier);
14908
- } else {
14909
- currentSegment.push(modifier);
14910
- }
14911
- }
14912
- if (currentSegment.length > 0) {
14913
- currentSegment.sort();
14914
- result.push(...currentSegment);
14915
- }
14916
- return result;
14917
- };
14918
- };
14919
- var createConfigUtils = (config3) => ({
14920
- cache: createLruCache(config3.cacheSize),
14921
- parseClassName: createParseClassName(config3),
14922
- sortModifiers: createSortModifiers(config3),
14923
- ...createClassGroupUtils(config3)
14924
- });
14925
- var SPLIT_CLASSES_REGEX = /\s+/;
14926
- var mergeClassList = (classList, configUtils) => {
14927
- const {
14928
- parseClassName,
14929
- getClassGroupId,
14930
- getConflictingClassGroupIds,
14931
- sortModifiers
14932
- } = configUtils;
14933
- const classGroupsInConflict = [];
14934
- const classNames = classList.trim().split(SPLIT_CLASSES_REGEX);
14935
- let result = "";
14936
- for (let index2 = classNames.length - 1; index2 >= 0; index2 -= 1) {
14937
- const originalClassName = classNames[index2];
14938
- const {
14939
- isExternal,
14940
- modifiers,
14941
- hasImportantModifier,
14942
- baseClassName,
14943
- maybePostfixModifierPosition
14944
- } = parseClassName(originalClassName);
14945
- if (isExternal) {
14946
- result = originalClassName + (result.length > 0 ? " " + result : result);
14947
- continue;
14948
- }
14949
- let hasPostfixModifier = !!maybePostfixModifierPosition;
14950
- let classGroupId = getClassGroupId(hasPostfixModifier ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);
14951
- if (!classGroupId) {
14952
- if (!hasPostfixModifier) {
14953
- result = originalClassName + (result.length > 0 ? " " + result : result);
14954
- continue;
14955
- }
14956
- classGroupId = getClassGroupId(baseClassName);
14957
- if (!classGroupId) {
14958
- result = originalClassName + (result.length > 0 ? " " + result : result);
14959
- continue;
14960
- }
14961
- hasPostfixModifier = false;
14962
- }
14963
- const variantModifier = modifiers.length === 0 ? "" : modifiers.length === 1 ? modifiers[0] : sortModifiers(modifiers).join(":");
14964
- const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
14965
- const classId = modifierId + classGroupId;
14966
- if (classGroupsInConflict.indexOf(classId) > -1) {
14967
- continue;
14968
- }
14969
- classGroupsInConflict.push(classId);
14970
- const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
14971
- for (let i = 0; i < conflictGroups.length; ++i) {
14972
- const group = conflictGroups[i];
14973
- classGroupsInConflict.push(modifierId + group);
14974
- }
14975
- result = originalClassName + (result.length > 0 ? " " + result : result);
14976
- }
14977
- return result;
14978
- };
14979
- var twJoin = (...classLists) => {
14980
- let index2 = 0;
14981
- let argument;
14982
- let resolvedValue;
14983
- let string = "";
14984
- while (index2 < classLists.length) {
14985
- if (argument = classLists[index2++]) {
14986
- if (resolvedValue = toValue(argument)) {
14987
- string && (string += " ");
14988
- string += resolvedValue;
14989
- }
14990
- }
14991
- }
14992
- return string;
14993
- };
14994
- var toValue = (mix) => {
14995
- if (typeof mix === "string") {
14996
- return mix;
14997
- }
14998
- let resolvedValue;
14999
- let string = "";
15000
- for (let k = 0; k < mix.length; k++) {
15001
- if (mix[k]) {
15002
- if (resolvedValue = toValue(mix[k])) {
15003
- string && (string += " ");
15004
- string += resolvedValue;
15005
- }
15006
- }
15007
- }
15008
- return string;
15009
- };
15010
- var createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
15011
- let configUtils;
15012
- let cacheGet;
15013
- let cacheSet;
15014
- let functionToCall;
15015
- const initTailwindMerge = (classList) => {
15016
- const config3 = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
15017
- configUtils = createConfigUtils(config3);
15018
- cacheGet = configUtils.cache.get;
15019
- cacheSet = configUtils.cache.set;
15020
- functionToCall = tailwindMerge;
15021
- return tailwindMerge(classList);
15022
- };
15023
- const tailwindMerge = (classList) => {
15024
- const cachedResult = cacheGet(classList);
15025
- if (cachedResult) {
15026
- return cachedResult;
15027
- }
15028
- const result = mergeClassList(classList, configUtils);
15029
- cacheSet(classList, result);
15030
- return result;
15031
- };
15032
- functionToCall = initTailwindMerge;
15033
- return (...args) => functionToCall(twJoin(...args));
15034
- };
15035
- var fallbackThemeArr = [];
15036
- var fromTheme = (key) => {
15037
- const themeGetter = (theme) => theme[key] || fallbackThemeArr;
15038
- themeGetter.isThemeGetter = true;
15039
- return themeGetter;
15040
- };
15041
- var arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i;
15042
- var arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i;
15043
- var fractionRegex = /^\d+\/\d+$/;
15044
- var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
15045
- var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
15046
- var colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/;
15047
- var shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
15048
- var imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
15049
- var isFraction = (value) => fractionRegex.test(value);
15050
- var isNumber = (value) => !!value && !Number.isNaN(Number(value));
15051
- var isInteger = (value) => !!value && Number.isInteger(Number(value));
15052
- var isPercent = (value) => value.endsWith("%") && isNumber(value.slice(0, -1));
15053
- var isTshirtSize = (value) => tshirtUnitRegex.test(value);
15054
- var isAny = () => true;
15055
- var isLengthOnly = (value) => (
15056
- // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
15057
- // For example, `hsl(0 0% 0%)` would be classified as a length without this check.
15058
- // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
15059
- lengthUnitRegex.test(value) && !colorFunctionRegex.test(value)
15060
- );
15061
- var isNever = () => false;
15062
- var isShadow = (value) => shadowRegex.test(value);
15063
- var isImage = (value) => imageRegex.test(value);
15064
- var isAnyNonArbitrary = (value) => !isArbitraryValue(value) && !isArbitraryVariable(value);
15065
- var isArbitrarySize = (value) => getIsArbitraryValue(value, isLabelSize, isNever);
15066
- var isArbitraryValue = (value) => arbitraryValueRegex.test(value);
15067
- var isArbitraryLength = (value) => getIsArbitraryValue(value, isLabelLength, isLengthOnly);
15068
- var isArbitraryNumber = (value) => getIsArbitraryValue(value, isLabelNumber, isNumber);
15069
- var isArbitraryPosition = (value) => getIsArbitraryValue(value, isLabelPosition, isNever);
15070
- var isArbitraryImage = (value) => getIsArbitraryValue(value, isLabelImage, isImage);
15071
- var isArbitraryShadow = (value) => getIsArbitraryValue(value, isLabelShadow, isShadow);
15072
- var isArbitraryVariable = (value) => arbitraryVariableRegex.test(value);
15073
- var isArbitraryVariableLength = (value) => getIsArbitraryVariable(value, isLabelLength);
15074
- var isArbitraryVariableFamilyName = (value) => getIsArbitraryVariable(value, isLabelFamilyName);
15075
- var isArbitraryVariablePosition = (value) => getIsArbitraryVariable(value, isLabelPosition);
15076
- var isArbitraryVariableSize = (value) => getIsArbitraryVariable(value, isLabelSize);
15077
- var isArbitraryVariableImage = (value) => getIsArbitraryVariable(value, isLabelImage);
15078
- var isArbitraryVariableShadow = (value) => getIsArbitraryVariable(value, isLabelShadow, true);
15079
- var getIsArbitraryValue = (value, testLabel, testValue) => {
15080
- const result = arbitraryValueRegex.exec(value);
15081
- if (result) {
15082
- if (result[1]) {
15083
- return testLabel(result[1]);
15084
- }
15085
- return testValue(result[2]);
15086
- }
15087
- return false;
15088
- };
15089
- var getIsArbitraryVariable = (value, testLabel, shouldMatchNoLabel = false) => {
15090
- const result = arbitraryVariableRegex.exec(value);
15091
- if (result) {
15092
- if (result[1]) {
15093
- return testLabel(result[1]);
15094
- }
15095
- return shouldMatchNoLabel;
15096
- }
15097
- return false;
14587
+ return false;
15098
14588
  };
15099
14589
  var isLabelPosition = (label) => label === "position" || label === "percentage";
15100
14590
  var isLabelImage = (label) => label === "image" || label === "url";
@@ -17566,67 +17056,577 @@ var getDefaultConfig = () => {
17566
17056
  "forced-color-adjust": ["auto", "none"]
17567
17057
  }]
17568
17058
  },
17569
- conflictingClassGroups: {
17570
- overflow: ["overflow-x", "overflow-y"],
17571
- overscroll: ["overscroll-x", "overscroll-y"],
17572
- inset: ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"],
17573
- "inset-x": ["right", "left"],
17574
- "inset-y": ["top", "bottom"],
17575
- flex: ["basis", "grow", "shrink"],
17576
- gap: ["gap-x", "gap-y"],
17577
- p: ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"],
17578
- px: ["pr", "pl"],
17579
- py: ["pt", "pb"],
17580
- m: ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"],
17581
- mx: ["mr", "ml"],
17582
- my: ["mt", "mb"],
17583
- size: ["w", "h"],
17584
- "font-size": ["leading"],
17585
- "fvn-normal": ["fvn-ordinal", "fvn-slashed-zero", "fvn-figure", "fvn-spacing", "fvn-fraction"],
17586
- "fvn-ordinal": ["fvn-normal"],
17587
- "fvn-slashed-zero": ["fvn-normal"],
17588
- "fvn-figure": ["fvn-normal"],
17589
- "fvn-spacing": ["fvn-normal"],
17590
- "fvn-fraction": ["fvn-normal"],
17591
- "line-clamp": ["display", "overflow"],
17592
- 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"],
17593
- "rounded-s": ["rounded-ss", "rounded-es"],
17594
- "rounded-e": ["rounded-se", "rounded-ee"],
17595
- "rounded-t": ["rounded-tl", "rounded-tr"],
17596
- "rounded-r": ["rounded-tr", "rounded-br"],
17597
- "rounded-b": ["rounded-br", "rounded-bl"],
17598
- "rounded-l": ["rounded-tl", "rounded-bl"],
17599
- "border-spacing": ["border-spacing-x", "border-spacing-y"],
17600
- "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"],
17601
- "border-w-x": ["border-w-r", "border-w-l"],
17602
- "border-w-y": ["border-w-t", "border-w-b"],
17603
- "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"],
17604
- "border-color-x": ["border-color-r", "border-color-l"],
17605
- "border-color-y": ["border-color-t", "border-color-b"],
17606
- translate: ["translate-x", "translate-y", "translate-none"],
17607
- "translate-none": ["translate", "translate-x", "translate-y", "translate-z"],
17608
- "scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"],
17609
- "scroll-mx": ["scroll-mr", "scroll-ml"],
17610
- "scroll-my": ["scroll-mt", "scroll-mb"],
17611
- "scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"],
17612
- "scroll-px": ["scroll-pr", "scroll-pl"],
17613
- "scroll-py": ["scroll-pt", "scroll-pb"],
17614
- touch: ["touch-x", "touch-y", "touch-pz"],
17615
- "touch-x": ["touch"],
17616
- "touch-y": ["touch"],
17617
- "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;
17618
17586
  },
17619
- conflictingClassGroupModifiers: {
17620
- "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;
17621
17609
  },
17622
- 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
+ }
17623
17617
  };
17624
- };
17625
- var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
17618
+ }
17626
17619
 
17627
- // src/lib/utils.ts
17628
- function cn(...inputs) {
17629
- 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());
17630
17630
  }
17631
17631
  var isEmpty = (val) => val === null || val === void 0 || val === "";
17632
17632
  var isAndroid = () => typeof navigator !== "undefined" && /android/i.test(navigator.userAgent || "");
@@ -41622,32 +41622,77 @@ var ShadcnFileVariant = React54__namespace.forwardRef(
41622
41622
  };
41623
41623
  const FileChip = ({ item, condensed = false }) => {
41624
41624
  const name = formatFileName ? formatFileName(item) : item.name;
41625
- return /* @__PURE__ */ jsxRuntime.jsxs(
41626
- "div",
41627
- {
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",
41630
- condensed ? "max-w-[120px]" : "max-w-[200px]"
41631
- ),
41632
- onClick: (e) => e.stopPropagation(),
41633
- children: [
41634
- /* @__PURE__ */ jsxRuntime.jsx(File2, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
41635
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium", children: name }),
41636
- /* @__PURE__ */ jsxRuntime.jsx(
41637
- "button",
41638
- {
41639
- type: "button",
41640
- onClick: (e) => {
41641
- e.stopPropagation();
41642
- handleRemove(item.id);
41643
- },
41644
- className: "ml-auto rounded-full text-muted-foreground/70 hover:text-destructive",
41645
- children: /* @__PURE__ */ jsxRuntime.jsx(X, { className: "h-3 w-3" })
41646
- }
41647
- )
41648
- ]
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;
41649
41633
  }
41650
- );
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
+ ] });
41651
41696
  };
41652
41697
  const TriggerRegion = React54__namespace.useMemo(() => {
41653
41698
  if (showDropArea) {
@@ -41667,7 +41712,7 @@ var ShadcnFileVariant = React54__namespace.forwardRef(
41667
41712
  dropAreaClassName
41668
41713
  ),
41669
41714
  children: [
41670
- /* @__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" }) }),
41671
41716
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
41672
41717
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-foreground", children: dropTitle != null ? dropTitle : "Click or drag to select" }),
41673
41718
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: dropDescription != null ? dropDescription : multiple ? "Select files" : "Select a file" })
@@ -41688,7 +41733,7 @@ var ShadcnFileVariant = React54__namespace.forwardRef(
41688
41733
  className: cn(
41689
41734
  "relative flex w-full cursor-pointer items-center gap-2 px-3 transition-all",
41690
41735
  heightCls,
41691
- (!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",
41692
41737
  dragOver && "border-primary ring-2 ring-primary/20",
41693
41738
  isDisabled && "cursor-not-allowed opacity-50",
41694
41739
  error && "border-destructive text-destructive",
@@ -41728,7 +41773,7 @@ var ShadcnFileVariant = React54__namespace.forwardRef(
41728
41773
  /* @__PURE__ */ jsxRuntime.jsx(
41729
41774
  PopoverContent2,
41730
41775
  {
41731
- className: "w-[--radix-popover-trigger-width] p-0",
41776
+ className: "w-(--radix-popover-trigger-width) p-0",
41732
41777
  align: "start",
41733
41778
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
41734
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: [
@@ -41800,7 +41845,7 @@ var ShadcnFileVariant = React54__namespace.forwardRef(
41800
41845
  },
41801
41846
  children: [
41802
41847
  /* @__PURE__ */ jsxRuntime.jsx(Plus, { className: "mr-2 h-3 w-3" }),
41803
- "Add files..."
41848
+ multiple ? "Add files..." : items.length ? "Replace file" : "Add file"
41804
41849
  ]
41805
41850
  }
41806
41851
  ) })
@@ -41891,7 +41936,7 @@ var ShadcnFileVariant = React54__namespace.forwardRef(
41891
41936
  children: [
41892
41937
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(
41893
41938
  "flex w-full",
41894
- 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"
41895
41940
  ), children: [
41896
41941
  leadingControl && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(
41897
41942
  "flex items-center",
@@ -42752,7 +42797,7 @@ function InputField(props) {
42752
42797
  ].filter(Boolean).join(" ");
42753
42798
  const hasStackedLabelBlock = lp !== "hidden" && hasAnyLabelBlockContent;
42754
42799
  const stackedGroupClassName = [
42755
- hasStackedLabelBlock && hasLabelRowContent ? "mt-1" : null,
42800
+ hasStackedLabelBlock && hasLabelRowContent ? "mt-0.5" : null,
42756
42801
  classes == null ? void 0 : classes.group
42757
42802
  ].filter(Boolean).join(" ");
42758
42803
  const Element2 = contain ? "div" : React54__namespace.Fragment;