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