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