@pequity/squirrel 11.0.1 → 11.0.3
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/cjs/chunks/index.js +374 -216
- package/dist/cjs/chunks/p-btn.js +1 -1
- package/dist/cjs/dateLocale.js +1221 -280
- package/dist/cjs/index.js +19 -8
- package/dist/cjs/inputClasses.js +3 -3
- package/dist/es/chunks/index.js +374 -216
- package/dist/es/chunks/p-btn.js +2 -2
- package/dist/es/dateLocale.js +1221 -280
- package/dist/es/index.js +48 -37
- package/dist/es/inputClasses.js +4 -4
- package/dist/squirrel/components/p-link/p-link.vue.d.ts +2 -2
- package/dist/squirrel/components/p-pagination-info/p-pagination-info.vue.d.ts +2 -2
- package/dist/squirrel/components/p-table/p-table.vue.d.ts +3 -1
- package/dist/squirrel/components/p-table-header-cell/p-table-header-cell.vue.d.ts +2 -2
- package/package.json +31 -31
- package/squirrel/components/p-btn/p-btn.spec.js +15 -5
- package/squirrel/components/p-drawer/p-drawer.spec.js +16 -11
- package/squirrel/components/p-dropdown/p-dropdown.spec.js +15 -10
- package/squirrel/components/p-dropdown-select/p-dropdown-select.spec.js +44 -27
- package/squirrel/components/p-pagination/p-pagination.spec.js +22 -30
- package/squirrel/components/p-select-btn/p-select-btn.spec.js +35 -27
- package/squirrel/components/p-select-list/p-select-list.spec.js +44 -27
- package/squirrel/components/p-select-pill/p-select-pill.spec.js +7 -6
- package/squirrel/components/p-table/p-table.spec.js +50 -43
- package/squirrel/components/p-tabs-pills/p-tabs-pills.spec.js +10 -8
- package/squirrel/locales/de-DE.json +47 -0
- package/squirrel/locales/es-ES.json +47 -0
- package/squirrel/plugin/index.spec.ts +32 -12
- package/squirrel/plugin/index.ts +6 -2
- package/squirrel/utils/dateLocale.spec.ts +9 -5
- package/squirrel/utils/dateLocale.ts +7 -3
- /package/squirrel/locales/{fr-CA.json → fr-FR.json} +0 -0
package/dist/es/chunks/index.js
CHANGED
|
@@ -1,239 +1,373 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var SPACE_REGEX = /\s+/g;
|
|
2
|
+
var removeExtraSpaces = (str) => {
|
|
3
|
+
if (typeof str !== "string" || !str) return str;
|
|
4
|
+
return str.replace(SPACE_REGEX, " ").trim();
|
|
5
|
+
};
|
|
6
|
+
var cx = (...classnames) => {
|
|
7
|
+
const classList = [];
|
|
8
|
+
const buildClassString = (input) => {
|
|
9
|
+
if (!input && input !== 0 && input !== 0n) return;
|
|
10
|
+
if (Array.isArray(input)) {
|
|
11
|
+
for (let i = 0, len = input.length; i < len; i++) buildClassString(input[i]);
|
|
6
12
|
return;
|
|
7
13
|
}
|
|
8
|
-
|
|
9
|
-
if (
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
} else if (
|
|
13
|
-
|
|
14
|
-
for (let
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const type = typeof input;
|
|
15
|
+
if (type === "string" || type === "number" || type === "bigint") {
|
|
16
|
+
if (type === "number" && input !== input) return;
|
|
17
|
+
classList.push(String(input));
|
|
18
|
+
} else if (type === "object") {
|
|
19
|
+
const keys = Object.keys(input);
|
|
20
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
21
|
+
const key = keys[i];
|
|
22
|
+
if (input[key]) classList.push(key);
|
|
17
23
|
}
|
|
18
24
|
}
|
|
19
25
|
};
|
|
20
|
-
for (let
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
for (let i = 0, len = classnames.length; i < len; i++) {
|
|
27
|
+
const c = classnames[i];
|
|
28
|
+
if (c !== null && c !== void 0) buildClassString(c);
|
|
23
29
|
}
|
|
24
|
-
return
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
return classList.length > 0 ? removeExtraSpaces(classList.join(" ")) : void 0;
|
|
31
|
+
};
|
|
32
|
+
var falsyToString = (value) => value === false ? "false" : value === true ? "true" : value === 0 ? "0" : value;
|
|
33
|
+
var isEmptyObject = (obj) => {
|
|
34
|
+
if (!obj || typeof obj !== "object") return true;
|
|
35
|
+
for (const _ in obj) return false;
|
|
28
36
|
return true;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
};
|
|
38
|
+
var isEqual = (obj1, obj2) => {
|
|
39
|
+
if (obj1 === obj2) return true;
|
|
40
|
+
if (!obj1 || !obj2) return false;
|
|
41
|
+
const keys1 = Object.keys(obj1);
|
|
42
|
+
const keys2 = Object.keys(obj2);
|
|
43
|
+
if (keys1.length !== keys2.length) return false;
|
|
44
|
+
for (let i = 0; i < keys1.length; i++) {
|
|
45
|
+
const key = keys1[i];
|
|
46
|
+
if (!keys2.includes(key)) return false;
|
|
47
|
+
if (obj1[key] !== obj2[key]) return false;
|
|
37
48
|
}
|
|
38
49
|
return true;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
};
|
|
51
|
+
var joinObjects = (obj1, obj2) => {
|
|
52
|
+
for (const key in obj2) {
|
|
53
|
+
if (Object.prototype.hasOwnProperty.call(obj2, key)) {
|
|
54
|
+
const val2 = obj2[key];
|
|
55
|
+
if (key in obj1) {
|
|
56
|
+
obj1[key] = cx(obj1[key], val2);
|
|
57
|
+
} else {
|
|
58
|
+
obj1[key] = val2;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
43
61
|
}
|
|
44
|
-
return
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
62
|
+
return obj1;
|
|
63
|
+
};
|
|
64
|
+
var flat = (arr, target) => {
|
|
65
|
+
for (let i = 0; i < arr.length; i++) {
|
|
66
|
+
const el = arr[i];
|
|
67
|
+
if (Array.isArray(el)) flat(el, target);
|
|
68
|
+
else if (el) target.push(el);
|
|
49
69
|
}
|
|
50
70
|
};
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
for (let
|
|
56
|
-
|
|
57
|
-
}, p = (t, r) => {
|
|
58
|
-
let n = {};
|
|
59
|
-
for (let e in t) {
|
|
60
|
-
let f2 = t[e];
|
|
61
|
-
if (e in r) {
|
|
62
|
-
let s = r[e];
|
|
63
|
-
Array.isArray(f2) || Array.isArray(s) ? n[e] = g(s, f2) : typeof f2 == "object" && typeof s == "object" && f2 && s ? n[e] = p(f2, s) : n[e] = s + " " + f2;
|
|
64
|
-
} else n[e] = f2;
|
|
71
|
+
var flatMergeArrays = (...arrays) => {
|
|
72
|
+
const result = [];
|
|
73
|
+
flat(arrays, result);
|
|
74
|
+
const filtered = [];
|
|
75
|
+
for (let i = 0; i < result.length; i++) {
|
|
76
|
+
if (result[i]) filtered.push(result[i]);
|
|
65
77
|
}
|
|
66
|
-
|
|
67
|
-
return n;
|
|
78
|
+
return filtered;
|
|
68
79
|
};
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
var mergeObjects = (obj1, obj2) => {
|
|
81
|
+
const result = {};
|
|
82
|
+
for (const key in obj1) {
|
|
83
|
+
const val1 = obj1[key];
|
|
84
|
+
if (key in obj2) {
|
|
85
|
+
const val2 = obj2[key];
|
|
86
|
+
if (Array.isArray(val1) || Array.isArray(val2)) {
|
|
87
|
+
result[key] = flatMergeArrays(val2, val1);
|
|
88
|
+
} else if (typeof val1 === "object" && typeof val2 === "object" && val1 && val2) {
|
|
89
|
+
result[key] = mergeObjects(val1, val2);
|
|
90
|
+
} else {
|
|
91
|
+
result[key] = val2 + " " + val1;
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
result[key] = val1;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
for (const key in obj2) {
|
|
98
|
+
if (!(key in obj1)) {
|
|
99
|
+
result[key] = obj2[key];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return result;
|
|
103
|
+
};
|
|
104
|
+
var defaultConfig = {
|
|
105
|
+
twMerge: true,
|
|
106
|
+
twMergeConfig: {}
|
|
107
|
+
};
|
|
108
|
+
function createState() {
|
|
109
|
+
let cachedTwMerge = null;
|
|
110
|
+
let cachedTwMergeConfig = {};
|
|
111
|
+
let didTwMergeConfigChange = false;
|
|
112
|
+
return {
|
|
113
|
+
get cachedTwMerge() {
|
|
114
|
+
return cachedTwMerge;
|
|
115
|
+
},
|
|
116
|
+
set cachedTwMerge(value) {
|
|
117
|
+
cachedTwMerge = value;
|
|
118
|
+
},
|
|
119
|
+
get cachedTwMergeConfig() {
|
|
120
|
+
return cachedTwMergeConfig;
|
|
121
|
+
},
|
|
122
|
+
set cachedTwMergeConfig(value) {
|
|
123
|
+
cachedTwMergeConfig = value;
|
|
124
|
+
},
|
|
125
|
+
get didTwMergeConfigChange() {
|
|
126
|
+
return didTwMergeConfigChange;
|
|
127
|
+
},
|
|
128
|
+
set didTwMergeConfigChange(value) {
|
|
129
|
+
didTwMergeConfigChange = value;
|
|
130
|
+
},
|
|
131
|
+
reset() {
|
|
132
|
+
cachedTwMerge = null;
|
|
133
|
+
cachedTwMergeConfig = {};
|
|
134
|
+
didTwMergeConfigChange = false;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
87
137
|
}
|
|
88
|
-
var
|
|
89
|
-
var
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
138
|
+
var state = createState();
|
|
139
|
+
var getTailwindVariants = (cn2) => {
|
|
140
|
+
const tv2 = (options, configProp) => {
|
|
141
|
+
const {
|
|
142
|
+
extend = null,
|
|
143
|
+
slots: slotProps = {},
|
|
144
|
+
variants: variantsProps = {},
|
|
145
|
+
compoundVariants: compoundVariantsProps = [],
|
|
146
|
+
compoundSlots = [],
|
|
147
|
+
defaultVariants: defaultVariantsProps = {}
|
|
148
|
+
} = options;
|
|
149
|
+
const config = { ...defaultConfig, ...configProp };
|
|
150
|
+
const base = extend?.base ? cx(extend.base, options?.base) : options?.base;
|
|
151
|
+
const variants = extend?.variants && !isEmptyObject(extend.variants) ? mergeObjects(variantsProps, extend.variants) : variantsProps;
|
|
152
|
+
const defaultVariants = extend?.defaultVariants && !isEmptyObject(extend.defaultVariants) ? { ...extend.defaultVariants, ...defaultVariantsProps } : defaultVariantsProps;
|
|
153
|
+
if (!isEmptyObject(config.twMergeConfig) && !isEqual(config.twMergeConfig, state.cachedTwMergeConfig)) {
|
|
154
|
+
state.didTwMergeConfigChange = true;
|
|
155
|
+
state.cachedTwMergeConfig = config.twMergeConfig;
|
|
156
|
+
}
|
|
157
|
+
const isExtendedSlotsEmpty = isEmptyObject(extend?.slots);
|
|
158
|
+
const componentSlots = !isEmptyObject(slotProps) ? {
|
|
159
|
+
// add "base" to the slots object
|
|
160
|
+
base: cx(options?.base, isExtendedSlotsEmpty && extend?.base),
|
|
161
|
+
...slotProps
|
|
162
|
+
} : {};
|
|
163
|
+
const slots = isExtendedSlotsEmpty ? componentSlots : joinObjects(
|
|
164
|
+
{ ...extend?.slots },
|
|
165
|
+
isEmptyObject(componentSlots) ? { base: options?.base } : componentSlots
|
|
166
|
+
);
|
|
167
|
+
const compoundVariants = isEmptyObject(extend?.compoundVariants) ? compoundVariantsProps : flatMergeArrays(extend?.compoundVariants, compoundVariantsProps);
|
|
168
|
+
const component = (props) => {
|
|
169
|
+
if (isEmptyObject(variants) && isEmptyObject(slotProps) && isExtendedSlotsEmpty) {
|
|
170
|
+
return cn2(base, props?.class, props?.className)(config);
|
|
171
|
+
}
|
|
172
|
+
if (compoundVariants && !Array.isArray(compoundVariants)) {
|
|
173
|
+
throw new TypeError(
|
|
174
|
+
`The "compoundVariants" prop must be an array. Received: ${typeof compoundVariants}`
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
if (compoundSlots && !Array.isArray(compoundSlots)) {
|
|
178
|
+
throw new TypeError(
|
|
179
|
+
`The "compoundSlots" prop must be an array. Received: ${typeof compoundSlots}`
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
const getVariantValue = (variant, vrs = variants, _slotKey = null, slotProps2 = null) => {
|
|
183
|
+
const variantObj = vrs[variant];
|
|
184
|
+
if (!variantObj || isEmptyObject(variantObj)) {
|
|
185
|
+
return null;
|
|
114
186
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
if (s === null) return null;
|
|
121
|
-
let i2 = h(s), l = Array.isArray(d$1.responsiveVariants) && d$1.responsiveVariants.length > 0 || d$1.responsiveVariants === true, f2 = E?.[t], o = [];
|
|
122
|
-
if (typeof i2 == "object" && l) for (let [C2, H] of Object.entries(i2)) {
|
|
123
|
-
let te = r[H];
|
|
124
|
-
if (C2 === "initial") {
|
|
125
|
-
f2 = H;
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
Array.isArray(d$1.responsiveVariants) && !d$1.responsiveVariants.includes(C2) || (o = Y(C2, te, o, n));
|
|
187
|
+
const variantProp = slotProps2?.[variant] ?? props?.[variant];
|
|
188
|
+
if (variantProp === null) return null;
|
|
189
|
+
const variantKey = falsyToString(variantProp);
|
|
190
|
+
if (typeof variantKey === "object") {
|
|
191
|
+
return null;
|
|
129
192
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
193
|
+
const defaultVariantProp = defaultVariants?.[variant];
|
|
194
|
+
const key = variantKey != null ? variantKey : falsyToString(defaultVariantProp);
|
|
195
|
+
const value = variantObj[key || "false"];
|
|
196
|
+
return value;
|
|
197
|
+
};
|
|
198
|
+
const getVariantClassNames = () => {
|
|
199
|
+
if (!variants) return null;
|
|
200
|
+
const keys = Object.keys(variants);
|
|
201
|
+
const result = [];
|
|
202
|
+
for (let i = 0; i < keys.length; i++) {
|
|
203
|
+
const value = getVariantValue(keys[i], variants);
|
|
204
|
+
if (value) result.push(value);
|
|
138
205
|
}
|
|
139
|
-
return
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
206
|
+
return result;
|
|
207
|
+
};
|
|
208
|
+
const getVariantClassNamesBySlotKey = (slotKey, slotProps2) => {
|
|
209
|
+
if (!variants || typeof variants !== "object") return null;
|
|
210
|
+
const result = [];
|
|
211
|
+
for (const variant in variants) {
|
|
212
|
+
const variantValue = getVariantValue(variant, variants, slotKey, slotProps2);
|
|
213
|
+
const value = slotKey === "base" && typeof variantValue === "string" ? variantValue : variantValue && variantValue[slotKey];
|
|
214
|
+
if (value) result.push(value);
|
|
146
215
|
}
|
|
147
|
-
return
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
216
|
+
return result;
|
|
217
|
+
};
|
|
218
|
+
const propsWithoutUndefined = {};
|
|
219
|
+
for (const prop in props) {
|
|
220
|
+
const value = props[prop];
|
|
221
|
+
if (value !== void 0) propsWithoutUndefined[prop] = value;
|
|
152
222
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
223
|
+
const getCompleteProps = (key, slotProps2) => {
|
|
224
|
+
const initialProp = typeof props?.[key] === "object" ? {
|
|
225
|
+
[key]: props[key]?.initial
|
|
226
|
+
} : {};
|
|
227
|
+
return {
|
|
228
|
+
...defaultVariants,
|
|
229
|
+
...propsWithoutUndefined,
|
|
230
|
+
...initialProp,
|
|
231
|
+
...slotProps2
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
const getCompoundVariantsValue = (cv = [], slotProps2) => {
|
|
235
|
+
const result = [];
|
|
236
|
+
const cvLength = cv.length;
|
|
237
|
+
for (let i = 0; i < cvLength; i++) {
|
|
238
|
+
const { class: tvClass, className: tvClassName, ...compoundVariantOptions } = cv[i];
|
|
239
|
+
let isValid = true;
|
|
240
|
+
const completeProps = getCompleteProps(null, slotProps2);
|
|
241
|
+
for (const key in compoundVariantOptions) {
|
|
242
|
+
const value = compoundVariantOptions[key];
|
|
243
|
+
const completePropsValue = completeProps[key];
|
|
244
|
+
if (Array.isArray(value)) {
|
|
245
|
+
if (!value.includes(completePropsValue)) {
|
|
246
|
+
isValid = false;
|
|
165
247
|
break;
|
|
166
248
|
}
|
|
167
249
|
} else {
|
|
168
|
-
if ((
|
|
169
|
-
|
|
170
|
-
|
|
250
|
+
if ((value == null || value === false) && (completePropsValue == null || completePropsValue === false))
|
|
251
|
+
continue;
|
|
252
|
+
if (completePropsValue !== value) {
|
|
253
|
+
isValid = false;
|
|
171
254
|
break;
|
|
172
255
|
}
|
|
173
256
|
}
|
|
174
257
|
}
|
|
175
|
-
|
|
258
|
+
if (isValid) {
|
|
259
|
+
if (tvClass) result.push(tvClass);
|
|
260
|
+
if (tvClassName) result.push(tvClassName);
|
|
261
|
+
}
|
|
176
262
|
}
|
|
177
|
-
return
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
263
|
+
return result;
|
|
264
|
+
};
|
|
265
|
+
const getCompoundVariantClassNamesBySlot = (slotProps2) => {
|
|
266
|
+
const compoundClassNames = getCompoundVariantsValue(compoundVariants, slotProps2);
|
|
267
|
+
if (!Array.isArray(compoundClassNames)) return compoundClassNames;
|
|
268
|
+
const result = {};
|
|
269
|
+
const cnFn = cn2;
|
|
270
|
+
for (let i = 0; i < compoundClassNames.length; i++) {
|
|
271
|
+
const className = compoundClassNames[i];
|
|
272
|
+
if (typeof className === "string") {
|
|
273
|
+
result.base = cnFn(result.base, className)(config);
|
|
274
|
+
} else if (typeof className === "object") {
|
|
275
|
+
for (const slot in className) {
|
|
276
|
+
result[slot] = cnFn(result[slot], className[slot])(config);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
186
279
|
}
|
|
187
|
-
return
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
280
|
+
return result;
|
|
281
|
+
};
|
|
282
|
+
const getCompoundSlotClassNameBySlot = (slotProps2) => {
|
|
283
|
+
if (compoundSlots.length < 1) return null;
|
|
284
|
+
const result = {};
|
|
285
|
+
const completeProps = getCompleteProps(null, slotProps2);
|
|
286
|
+
for (let i = 0; i < compoundSlots.length; i++) {
|
|
287
|
+
const {
|
|
288
|
+
slots: slots2 = [],
|
|
289
|
+
class: slotClass,
|
|
290
|
+
className: slotClassName,
|
|
291
|
+
...slotVariants
|
|
292
|
+
} = compoundSlots[i];
|
|
293
|
+
if (!isEmptyObject(slotVariants)) {
|
|
294
|
+
let isValid = true;
|
|
295
|
+
for (const key in slotVariants) {
|
|
296
|
+
const completePropsValue = completeProps[key];
|
|
297
|
+
const slotVariantValue = slotVariants[key];
|
|
298
|
+
if (completePropsValue === void 0 || (Array.isArray(slotVariantValue) ? !slotVariantValue.includes(completePropsValue) : slotVariantValue !== completePropsValue)) {
|
|
299
|
+
isValid = false;
|
|
199
300
|
break;
|
|
200
301
|
}
|
|
201
302
|
}
|
|
202
|
-
if (!
|
|
303
|
+
if (!isValid) continue;
|
|
203
304
|
}
|
|
204
|
-
for (let
|
|
205
|
-
|
|
206
|
-
|
|
305
|
+
for (let j = 0; j < slots2.length; j++) {
|
|
306
|
+
const slotName = slots2[j];
|
|
307
|
+
if (!result[slotName]) result[slotName] = [];
|
|
308
|
+
result[slotName].push([slotClass, slotClassName]);
|
|
207
309
|
}
|
|
208
310
|
}
|
|
209
|
-
return
|
|
311
|
+
return result;
|
|
210
312
|
};
|
|
211
|
-
if (!
|
|
212
|
-
|
|
213
|
-
if (typeof
|
|
214
|
-
|
|
215
|
-
for (
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
313
|
+
if (!isEmptyObject(slotProps) || !isExtendedSlotsEmpty) {
|
|
314
|
+
const slotsFns = {};
|
|
315
|
+
if (typeof slots === "object" && !isEmptyObject(slots)) {
|
|
316
|
+
const cnFn = cn2;
|
|
317
|
+
for (const slotKey in slots) {
|
|
318
|
+
slotsFns[slotKey] = (slotProps2) => {
|
|
319
|
+
const compoundVariantClasses = getCompoundVariantClassNamesBySlot(slotProps2);
|
|
320
|
+
const compoundSlotClasses = getCompoundSlotClassNameBySlot(slotProps2);
|
|
321
|
+
return cnFn(
|
|
322
|
+
slots[slotKey],
|
|
323
|
+
getVariantClassNamesBySlotKey(slotKey, slotProps2),
|
|
324
|
+
compoundVariantClasses ? compoundVariantClasses[slotKey] : void 0,
|
|
325
|
+
compoundSlotClasses ? compoundSlotClasses[slotKey] : void 0,
|
|
326
|
+
slotProps2?.class,
|
|
327
|
+
slotProps2?.className
|
|
328
|
+
)(config);
|
|
329
|
+
};
|
|
330
|
+
}
|
|
219
331
|
}
|
|
220
|
-
return
|
|
332
|
+
return slotsFns;
|
|
221
333
|
}
|
|
222
|
-
return
|
|
223
|
-
|
|
224
|
-
|
|
334
|
+
return cn2(
|
|
335
|
+
base,
|
|
336
|
+
getVariantClassNames(),
|
|
337
|
+
getCompoundVariantsValue(compoundVariants),
|
|
338
|
+
props?.class,
|
|
339
|
+
props?.className
|
|
340
|
+
)(config);
|
|
341
|
+
};
|
|
342
|
+
const getVariantKeys = () => {
|
|
343
|
+
if (!variants || typeof variants !== "object") return;
|
|
344
|
+
return Object.keys(variants);
|
|
225
345
|
};
|
|
226
|
-
|
|
346
|
+
component.variantKeys = getVariantKeys();
|
|
347
|
+
component.extend = extend;
|
|
348
|
+
component.base = base;
|
|
349
|
+
component.slots = slots;
|
|
350
|
+
component.variants = variants;
|
|
351
|
+
component.defaultVariants = defaultVariants;
|
|
352
|
+
component.compoundSlots = compoundSlots;
|
|
353
|
+
component.compoundVariants = compoundVariants;
|
|
354
|
+
return component;
|
|
355
|
+
};
|
|
356
|
+
const createTV2 = (configProp) => {
|
|
357
|
+
return (options, config) => tv2(options, config ? mergeObjects(configProp, config) : configProp);
|
|
358
|
+
};
|
|
359
|
+
return {
|
|
360
|
+
tv: tv2,
|
|
361
|
+
createTV: createTV2
|
|
227
362
|
};
|
|
228
|
-
return { tv: w, createTV: (u2) => ($, c2) => w($, c2 ? p(u2, c2) : u2) };
|
|
229
363
|
};
|
|
230
364
|
const concatArrays = (array1, array2) => {
|
|
231
365
|
const combinedArray = new Array(array1.length + array2.length);
|
|
232
|
-
for (let
|
|
233
|
-
combinedArray[
|
|
366
|
+
for (let i = 0; i < array1.length; i++) {
|
|
367
|
+
combinedArray[i] = array1[i];
|
|
234
368
|
}
|
|
235
|
-
for (let
|
|
236
|
-
combinedArray[array1.length +
|
|
369
|
+
for (let i = 0; i < array2.length; i++) {
|
|
370
|
+
combinedArray[array1.length + i] = array2[i];
|
|
237
371
|
}
|
|
238
372
|
return combinedArray;
|
|
239
373
|
};
|
|
@@ -299,8 +433,8 @@ const getGroupRecursive = (classParts, startIndex, classPartObject) => {
|
|
|
299
433
|
}
|
|
300
434
|
const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
|
|
301
435
|
const validatorsLength = validators.length;
|
|
302
|
-
for (let
|
|
303
|
-
const validatorObj = validators[
|
|
436
|
+
for (let i = 0; i < validatorsLength; i++) {
|
|
437
|
+
const validatorObj = validators[i];
|
|
304
438
|
if (validatorObj.validator(classRest)) {
|
|
305
439
|
return validatorObj.classGroupId;
|
|
306
440
|
}
|
|
@@ -330,8 +464,8 @@ const processClassGroups = (classGroups, theme) => {
|
|
|
330
464
|
};
|
|
331
465
|
const processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
|
|
332
466
|
const len = classGroup.length;
|
|
333
|
-
for (let
|
|
334
|
-
const classDefinition = classGroup[
|
|
467
|
+
for (let i = 0; i < len; i++) {
|
|
468
|
+
const classDefinition = classGroup[i];
|
|
335
469
|
processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
|
|
336
470
|
}
|
|
337
471
|
};
|
|
@@ -363,8 +497,8 @@ const processFunctionDefinition = (classDefinition, classPartObject, classGroupI
|
|
|
363
497
|
const processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
|
|
364
498
|
const entries = Object.entries(classDefinition);
|
|
365
499
|
const len = entries.length;
|
|
366
|
-
for (let
|
|
367
|
-
const [key, value] = entries[
|
|
500
|
+
for (let i = 0; i < len; i++) {
|
|
501
|
+
const [key, value] = entries[i];
|
|
368
502
|
processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
|
|
369
503
|
}
|
|
370
504
|
};
|
|
@@ -372,8 +506,8 @@ const getPart = (classPartObject, path) => {
|
|
|
372
506
|
let current = classPartObject;
|
|
373
507
|
const parts = path.split(CLASS_PART_SEPARATOR);
|
|
374
508
|
const len = parts.length;
|
|
375
|
-
for (let
|
|
376
|
-
const part = parts[
|
|
509
|
+
for (let i = 0; i < len; i++) {
|
|
510
|
+
const part = parts[i];
|
|
377
511
|
let next = current.nextPart.get(part);
|
|
378
512
|
if (!next) {
|
|
379
513
|
next = createClassPartObject();
|
|
@@ -505,8 +639,8 @@ const createSortModifiers = (config) => {
|
|
|
505
639
|
return (modifiers) => {
|
|
506
640
|
const result = [];
|
|
507
641
|
let currentSegment = [];
|
|
508
|
-
for (let
|
|
509
|
-
const modifier = modifiers[
|
|
642
|
+
for (let i = 0; i < modifiers.length; i++) {
|
|
643
|
+
const modifier = modifiers[i];
|
|
510
644
|
const isArbitrary = modifier[0] === "[";
|
|
511
645
|
const isOrderSensitive = modifierWeights.has(modifier);
|
|
512
646
|
if (isArbitrary || isOrderSensitive) {
|
|
@@ -579,8 +713,8 @@ const mergeClassList = (classList, configUtils) => {
|
|
|
579
713
|
}
|
|
580
714
|
classGroupsInConflict.push(classId);
|
|
581
715
|
const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
|
|
582
|
-
for (let
|
|
583
|
-
const group = conflictGroups[
|
|
716
|
+
for (let i = 0; i < conflictGroups.length; ++i) {
|
|
717
|
+
const group = conflictGroups[i];
|
|
584
718
|
classGroupsInConflict.push(modifierId + group);
|
|
585
719
|
}
|
|
586
720
|
result = originalClassName + (result.length > 0 ? " " + result : result);
|
|
@@ -608,9 +742,9 @@ const toValue = (mix) => {
|
|
|
608
742
|
}
|
|
609
743
|
let resolvedValue;
|
|
610
744
|
let string = "";
|
|
611
|
-
for (let
|
|
612
|
-
if (mix[
|
|
613
|
-
if (resolvedValue = toValue(mix[
|
|
745
|
+
for (let k = 0; k < mix.length; k++) {
|
|
746
|
+
if (mix[k]) {
|
|
747
|
+
if (resolvedValue = toValue(mix[k])) {
|
|
614
748
|
string && (string += " ");
|
|
615
749
|
string += resolvedValue;
|
|
616
750
|
}
|
|
@@ -3282,15 +3416,39 @@ const mergeArrayProperties = (baseObject, mergeObject, key) => {
|
|
|
3282
3416
|
};
|
|
3283
3417
|
const extendTailwindMerge = (configExtension, ...createConfig) => typeof configExtension === "function" ? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig) : createTailwindMerge(() => mergeConfigs(getDefaultConfig(), configExtension), ...createConfig);
|
|
3284
3418
|
const twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
|
|
3285
|
-
var
|
|
3286
|
-
|
|
3287
|
-
|
|
3419
|
+
var createTwMerge = (cachedTwMergeConfig) => {
|
|
3420
|
+
return isEmptyObject(cachedTwMergeConfig) ? twMerge : extendTailwindMerge({
|
|
3421
|
+
...cachedTwMergeConfig,
|
|
3422
|
+
extend: {
|
|
3423
|
+
theme: cachedTwMergeConfig.theme,
|
|
3424
|
+
classGroups: cachedTwMergeConfig.classGroups,
|
|
3425
|
+
conflictingClassGroupModifiers: cachedTwMergeConfig.conflictingClassGroupModifiers,
|
|
3426
|
+
conflictingClassGroups: cachedTwMergeConfig.conflictingClassGroups,
|
|
3427
|
+
...cachedTwMergeConfig.extend
|
|
3428
|
+
}
|
|
3429
|
+
});
|
|
3430
|
+
};
|
|
3431
|
+
var executeMerge = (classnames, config) => {
|
|
3432
|
+
const base = cx(classnames);
|
|
3433
|
+
if (!base || !(config?.twMerge ?? true)) return base;
|
|
3434
|
+
if (!state.cachedTwMerge || state.didTwMergeConfigChange) {
|
|
3435
|
+
state.didTwMergeConfigChange = false;
|
|
3436
|
+
state.cachedTwMerge = createTwMerge(state.cachedTwMergeConfig);
|
|
3437
|
+
}
|
|
3438
|
+
return state.cachedTwMerge(base) || void 0;
|
|
3439
|
+
};
|
|
3440
|
+
var cn = (...classnames) => {
|
|
3441
|
+
return executeMerge(classnames, {});
|
|
3442
|
+
};
|
|
3443
|
+
var cnMerge = (...classnames) => {
|
|
3444
|
+
return (config) => executeMerge(classnames, config);
|
|
3288
3445
|
};
|
|
3289
|
-
var { createTV
|
|
3446
|
+
var { createTV, tv } = getTailwindVariants(cnMerge);
|
|
3290
3447
|
export {
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3448
|
+
cnMerge as a,
|
|
3449
|
+
createTV as b,
|
|
3450
|
+
cn as c,
|
|
3451
|
+
defaultConfig as d,
|
|
3452
|
+
cx as e,
|
|
3453
|
+
tv as t
|
|
3296
3454
|
};
|