@abcagency/hc-ui-components 1.7.1 → 1.7.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/_virtual/_rollupPluginBabelHelpers.js +306 -130
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/dist/apis/hcApi.js.map +1 -1
- package/dist/clientToken.js.map +1 -1
- package/dist/components/HireControlMap.js +39 -43
- package/dist/components/HireControlMap.js.map +1 -1
- package/dist/components/containers/accordions/filter-container.js.map +1 -1
- package/dist/components/containers/accordions/filter-item-container.js.map +1 -1
- package/dist/components/containers/accordions/map-accordion-item-container.js.map +1 -1
- package/dist/components/containers/filter/commute-container.js +22 -21
- package/dist/components/containers/filter/commute-container.js.map +1 -1
- package/dist/components/containers/filter/filter-container.js.map +1 -1
- package/dist/components/containers/filter/filter-item-container.js.map +1 -1
- package/dist/components/containers/filter/location-container.js.map +1 -1
- package/dist/components/containers/filter/points-of-interest-container.js.map +1 -1
- package/dist/components/containers/filter/points-of-interest-radio-item-container.js.map +1 -1
- package/dist/components/containers/filter/search-container.js.map +1 -1
- package/dist/components/containers/jobListing/listing-details-container.js.map +1 -1
- package/dist/components/containers/list/item-list-container.js.map +1 -1
- package/dist/components/containers/list/list-item/list-item-container.js.map +1 -1
- package/dist/components/containers/maps/info-window-content-container.js.map +1 -1
- package/dist/components/containers/maps/map-container.js +1 -1
- package/dist/components/containers/maps/map-container.js.map +1 -1
- package/dist/components/containers/maps/map-list-container.js.map +1 -1
- package/dist/components/containers/maps/map-marker-container.js.map +1 -1
- package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -1
- package/dist/components/modules/accordions/default.js.map +1 -1
- package/dist/components/modules/accordions/filterItem.js.map +1 -1
- package/dist/components/modules/accordions/filters.js.map +1 -1
- package/dist/components/modules/buttons/button-group-apply.js.map +1 -1
- package/dist/components/modules/buttons/default.js.map +1 -1
- package/dist/components/modules/buttons/items-pill.js.map +1 -1
- package/dist/components/modules/buttons/pill-wrapper.js.map +1 -1
- package/dist/components/modules/buttons/show-all-button.js.map +1 -1
- package/dist/components/modules/cards/default.js.map +1 -1
- package/dist/components/modules/cards/filter.js.map +1 -1
- package/dist/components/modules/dialogs/apply-dialog.js.map +1 -1
- package/dist/components/modules/filter/commute.js.map +1 -1
- package/dist/components/modules/filter/index.js.map +1 -1
- package/dist/components/modules/filter/item.js.map +1 -1
- package/dist/components/modules/filter/location.js.map +1 -1
- package/dist/components/modules/filter/radio-item.js.map +1 -1
- package/dist/components/modules/filter/search.js.map +1 -1
- package/dist/components/modules/filter/sort.js.map +1 -1
- package/dist/components/modules/grid.js.map +1 -1
- package/dist/components/modules/icon.js.map +1 -1
- package/dist/components/modules/jobListing/listing-details.js.map +1 -1
- package/dist/components/modules/list/field-mapper-desktop.js.map +1 -1
- package/dist/components/modules/list/field-mapper-mobile.js.map +1 -1
- package/dist/components/modules/list/header-item.js.map +1 -1
- package/dist/components/modules/list/header.js.map +1 -1
- package/dist/components/modules/list/item-expand-card/index.js.map +1 -1
- package/dist/components/modules/list/item-list.js.map +1 -1
- package/dist/components/modules/list/list-item/list-item.js.map +1 -1
- package/dist/components/modules/maps/info-window-card.js.map +1 -1
- package/dist/components/modules/maps/info-window-content.js.map +1 -1
- package/dist/components/modules/maps/map-list.js.map +1 -1
- package/dist/components/modules/maps/map-marker.js.map +1 -1
- package/dist/components/modules/maps/map.js +8 -3
- package/dist/components/modules/maps/map.js.map +1 -1
- package/dist/components/modules/maps/place-marker.js.map +1 -1
- package/dist/components/modules/maps/tabs.js.map +1 -1
- package/dist/components/modules/skeleton/map-skeleton.js +14 -161
- package/dist/components/modules/skeleton/map-skeleton.js.map +1 -1
- package/dist/constants/eventTypes.js.map +1 -1
- package/dist/constants/placeTypes.js.map +1 -1
- package/dist/contexts/mapContext.js +1 -1
- package/dist/contexts/mapContext.js.map +1 -1
- package/dist/contexts/mapListContext.js +1 -1
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/contexts/placesContext.js +21 -20
- package/dist/contexts/placesContext.js.map +1 -1
- package/dist/contexts/themeContext.js.map +1 -1
- package/dist/contexts/trackEventContext.js +1 -1
- package/dist/contexts/trackEventContext.js.map +1 -1
- package/dist/hooks/useList.js.map +1 -1
- package/dist/node_modules/@algolia/client-common/dist/common.js +6 -3
- package/dist/node_modules/@algolia/client-common/dist/common.js.map +1 -1
- package/dist/node_modules/@algolia/requester-browser-xhr/dist/requester.xhr.js +1 -1
- package/dist/node_modules/@algolia/requester-browser-xhr/dist/requester.xhr.js.map +1 -1
- package/dist/node_modules/algoliasearch/dist/lite/builds/browser.js +2 -2
- package/dist/node_modules/algoliasearch/dist/lite/builds/browser.js.map +1 -1
- package/dist/node_modules/fuse.js/dist/fuse.js +20 -29
- package/dist/node_modules/fuse.js/dist/fuse.js.map +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +162 -124
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
- package/dist/services/configService.js.map +1 -1
- package/dist/services/googlePlacesNearbyService.js.map +1 -1
- package/dist/services/listingAggregatorService.js.map +1 -1
- package/dist/services/listingEntityService.js.map +1 -1
- package/dist/services/listingService.js.map +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/util/algoliaSearchUtil.js +42 -38
- package/dist/util/algoliaSearchUtil.js.map +1 -1
- package/dist/util/filterUtil.js +52 -48
- package/dist/util/filterUtil.js.map +1 -1
- package/dist/util/loading.js.map +1 -1
- package/dist/util/localStorageUtil.js.map +1 -1
- package/dist/util/mapIconUtil.js.map +1 -1
- package/dist/util/mapUtil.js.map +1 -1
- package/dist/util/sortUtil.js.map +1 -1
- package/dist/util/stringUtils.js.map +1 -1
- package/dist/util/twMerge.js.map +1 -1
- package/dist/util/urlFilterUtil.js +1 -1
- package/dist/util/urlFilterUtil.js.map +1 -1
- package/package.json +1 -1
- package/src/components/HireControlMap.js +13 -18
- package/src/components/modules/maps/map.js +10 -5
- package/src/components/modules/skeleton/map-skeleton.js +20 -130
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
const CLASS_PART_SEPARATOR = '-';
|
|
2
|
-
|
|
2
|
+
function createClassGroupUtils(config) {
|
|
3
3
|
const classMap = createClassMap(config);
|
|
4
4
|
const {
|
|
5
5
|
conflictingClassGroups,
|
|
6
6
|
conflictingClassGroupModifiers
|
|
7
7
|
} = config;
|
|
8
|
-
|
|
8
|
+
function getClassGroupId(className) {
|
|
9
9
|
const classParts = className.split(CLASS_PART_SEPARATOR);
|
|
10
10
|
// Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and remove it from classParts.
|
|
11
11
|
if (classParts[0] === '' && classParts.length !== 1) {
|
|
12
12
|
classParts.shift();
|
|
13
13
|
}
|
|
14
14
|
return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
|
|
15
|
-
}
|
|
16
|
-
|
|
15
|
+
}
|
|
16
|
+
function getConflictingClassGroupIds(classGroupId, hasPostfixModifier) {
|
|
17
17
|
const conflicts = conflictingClassGroups[classGroupId] || [];
|
|
18
18
|
if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
|
|
19
19
|
return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
|
|
20
20
|
}
|
|
21
21
|
return conflicts;
|
|
22
|
-
}
|
|
22
|
+
}
|
|
23
23
|
return {
|
|
24
24
|
getClassGroupId,
|
|
25
25
|
getConflictingClassGroupIds
|
|
26
26
|
};
|
|
27
|
-
}
|
|
28
|
-
|
|
27
|
+
}
|
|
28
|
+
function getGroupRecursive(classParts, classPartObject) {
|
|
29
29
|
if (classParts.length === 0) {
|
|
30
30
|
return classPartObject.classGroupId;
|
|
31
31
|
}
|
|
@@ -42,9 +42,9 @@ const getGroupRecursive = (classParts, classPartObject) => {
|
|
|
42
42
|
return classPartObject.validators.find(({
|
|
43
43
|
validator
|
|
44
44
|
}) => validator(classRest))?.classGroupId;
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
const arbitraryPropertyRegex = /^\[(.+)\]$/;
|
|
47
|
-
|
|
47
|
+
function getGroupIdForArbitraryProperty(className) {
|
|
48
48
|
if (arbitraryPropertyRegex.test(className)) {
|
|
49
49
|
const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
|
|
50
50
|
const property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(':'));
|
|
@@ -53,11 +53,11 @@ const getGroupIdForArbitraryProperty = className => {
|
|
|
53
53
|
return 'arbitrary..' + property;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
}
|
|
56
|
+
}
|
|
57
57
|
/**
|
|
58
58
|
* Exported for testing only
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
function createClassMap(config) {
|
|
61
61
|
const {
|
|
62
62
|
theme,
|
|
63
63
|
prefix
|
|
@@ -71,8 +71,8 @@ const createClassMap = config => {
|
|
|
71
71
|
processClassesRecursively(classGroup, classMap, classGroupId, theme);
|
|
72
72
|
});
|
|
73
73
|
return classMap;
|
|
74
|
-
}
|
|
75
|
-
|
|
74
|
+
}
|
|
75
|
+
function processClassesRecursively(classGroup, classPartObject, classGroupId, theme) {
|
|
76
76
|
classGroup.forEach(classDefinition => {
|
|
77
77
|
if (typeof classDefinition === 'string') {
|
|
78
78
|
const classPartObjectToEdit = classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition);
|
|
@@ -94,8 +94,8 @@ const processClassesRecursively = (classGroup, classPartObject, classGroupId, th
|
|
|
94
94
|
processClassesRecursively(classGroup, getPart(classPartObject, key), classGroupId, theme);
|
|
95
95
|
});
|
|
96
96
|
});
|
|
97
|
-
}
|
|
98
|
-
|
|
97
|
+
}
|
|
98
|
+
function getPart(classPartObject, path) {
|
|
99
99
|
let currentClassPartObject = classPartObject;
|
|
100
100
|
path.split(CLASS_PART_SEPARATOR).forEach(pathPart => {
|
|
101
101
|
if (!currentClassPartObject.nextPart.has(pathPart)) {
|
|
@@ -107,9 +107,11 @@ const getPart = (classPartObject, path) => {
|
|
|
107
107
|
currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
|
|
108
108
|
});
|
|
109
109
|
return currentClassPartObject;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
}
|
|
111
|
+
function isThemeGetter(func) {
|
|
112
|
+
return func.isThemeGetter;
|
|
113
|
+
}
|
|
114
|
+
function getPrefixedClassGroupEntries(classGroupEntries, prefix) {
|
|
113
115
|
if (!prefix) {
|
|
114
116
|
return classGroupEntries;
|
|
115
117
|
}
|
|
@@ -125,10 +127,10 @@ const getPrefixedClassGroupEntries = (classGroupEntries, prefix) => {
|
|
|
125
127
|
});
|
|
126
128
|
return [classGroupId, prefixedClassGroup];
|
|
127
129
|
});
|
|
128
|
-
}
|
|
130
|
+
}
|
|
129
131
|
|
|
130
132
|
// LRU cache inspired from hashlru (https://github.com/dominictarr/hashlru/blob/v1.0.4/index.js) but object replaced with Map to improve performance
|
|
131
|
-
|
|
133
|
+
function createLruCache(maxCacheSize) {
|
|
132
134
|
if (maxCacheSize < 1) {
|
|
133
135
|
return {
|
|
134
136
|
get: () => undefined,
|
|
@@ -138,7 +140,7 @@ const createLruCache = maxCacheSize => {
|
|
|
138
140
|
let cacheSize = 0;
|
|
139
141
|
let cache = new Map();
|
|
140
142
|
let previousCache = new Map();
|
|
141
|
-
|
|
143
|
+
function update(key, value) {
|
|
142
144
|
cache.set(key, value);
|
|
143
145
|
cacheSize++;
|
|
144
146
|
if (cacheSize > maxCacheSize) {
|
|
@@ -146,7 +148,7 @@ const createLruCache = maxCacheSize => {
|
|
|
146
148
|
previousCache = cache;
|
|
147
149
|
cache = new Map();
|
|
148
150
|
}
|
|
149
|
-
}
|
|
151
|
+
}
|
|
150
152
|
return {
|
|
151
153
|
get(key) {
|
|
152
154
|
let value = cache.get(key);
|
|
@@ -166,9 +168,9 @@ const createLruCache = maxCacheSize => {
|
|
|
166
168
|
}
|
|
167
169
|
}
|
|
168
170
|
};
|
|
169
|
-
}
|
|
171
|
+
}
|
|
170
172
|
const IMPORTANT_MODIFIER = '!';
|
|
171
|
-
|
|
173
|
+
function createParseClassName(config) {
|
|
172
174
|
const {
|
|
173
175
|
separator,
|
|
174
176
|
experimentalParseClassName
|
|
@@ -177,7 +179,7 @@ const createParseClassName = config => {
|
|
|
177
179
|
const firstSeparatorCharacter = separator[0];
|
|
178
180
|
const separatorLength = separator.length;
|
|
179
181
|
// parseClassName inspired by https://github.com/tailwindlabs/tailwindcss/blob/v3.2.2/src/util/splitAtTopLevelOnly.js
|
|
180
|
-
|
|
182
|
+
function parseClassName(className) {
|
|
181
183
|
const modifiers = [];
|
|
182
184
|
let bracketDepth = 0;
|
|
183
185
|
let modifierStart = 0;
|
|
@@ -211,21 +213,23 @@ const createParseClassName = config => {
|
|
|
211
213
|
baseClassName,
|
|
212
214
|
maybePostfixModifierPosition
|
|
213
215
|
};
|
|
214
|
-
}
|
|
216
|
+
}
|
|
215
217
|
if (experimentalParseClassName) {
|
|
216
|
-
return className
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
return function parseClassNameExperimental(className) {
|
|
219
|
+
return experimentalParseClassName({
|
|
220
|
+
className,
|
|
221
|
+
parseClassName
|
|
222
|
+
});
|
|
223
|
+
};
|
|
220
224
|
}
|
|
221
225
|
return parseClassName;
|
|
222
|
-
}
|
|
226
|
+
}
|
|
223
227
|
/**
|
|
224
228
|
* Sorts modifiers according to following schema:
|
|
225
229
|
* - Predefined modifiers are sorted alphabetically
|
|
226
230
|
* - When an arbitrary variant appears, it must be preserved which modifiers are before and after it
|
|
227
231
|
*/
|
|
228
|
-
|
|
232
|
+
function sortModifiers(modifiers) {
|
|
229
233
|
if (modifiers.length <= 1) {
|
|
230
234
|
return modifiers;
|
|
231
235
|
}
|
|
@@ -242,14 +246,16 @@ const sortModifiers = modifiers => {
|
|
|
242
246
|
});
|
|
243
247
|
sortedModifiers.push(...unsortedModifiers.sort());
|
|
244
248
|
return sortedModifiers;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
}
|
|
250
|
+
function createConfigUtils(config) {
|
|
251
|
+
return {
|
|
252
|
+
cache: createLruCache(config.cacheSize),
|
|
253
|
+
parseClassName: createParseClassName(config),
|
|
254
|
+
...createClassGroupUtils(config)
|
|
255
|
+
};
|
|
256
|
+
}
|
|
251
257
|
const SPLIT_CLASSES_REGEX = /\s+/;
|
|
252
|
-
|
|
258
|
+
function mergeClassList(classList, configUtils) {
|
|
253
259
|
const {
|
|
254
260
|
parseClassName,
|
|
255
261
|
getClassGroupId,
|
|
@@ -262,11 +268,8 @@ const mergeClassList = (classList, configUtils) => {
|
|
|
262
268
|
* @example 'hover:focus:bg-color'
|
|
263
269
|
* @example 'md:!pr'
|
|
264
270
|
*/
|
|
265
|
-
const classGroupsInConflict =
|
|
266
|
-
|
|
267
|
-
let result = '';
|
|
268
|
-
for (let index = classNames.length - 1; index >= 0; index -= 1) {
|
|
269
|
-
const originalClassName = classNames[index];
|
|
271
|
+
const classGroupsInConflict = new Set();
|
|
272
|
+
return classList.trim().split(SPLIT_CLASSES_REGEX).map(originalClassName => {
|
|
270
273
|
const {
|
|
271
274
|
modifiers,
|
|
272
275
|
hasImportantModifier,
|
|
@@ -277,36 +280,49 @@ const mergeClassList = (classList, configUtils) => {
|
|
|
277
280
|
let classGroupId = getClassGroupId(hasPostfixModifier ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);
|
|
278
281
|
if (!classGroupId) {
|
|
279
282
|
if (!hasPostfixModifier) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
+
return {
|
|
284
|
+
isTailwindClass: false,
|
|
285
|
+
originalClassName
|
|
286
|
+
};
|
|
283
287
|
}
|
|
284
288
|
classGroupId = getClassGroupId(baseClassName);
|
|
285
289
|
if (!classGroupId) {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
290
|
+
return {
|
|
291
|
+
isTailwindClass: false,
|
|
292
|
+
originalClassName
|
|
293
|
+
};
|
|
289
294
|
}
|
|
290
295
|
hasPostfixModifier = false;
|
|
291
296
|
}
|
|
292
297
|
const variantModifier = sortModifiers(modifiers).join(':');
|
|
293
298
|
const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
299
|
+
return {
|
|
300
|
+
isTailwindClass: true,
|
|
301
|
+
modifierId,
|
|
302
|
+
classGroupId,
|
|
303
|
+
originalClassName,
|
|
304
|
+
hasPostfixModifier
|
|
305
|
+
};
|
|
306
|
+
}).reverse()
|
|
307
|
+
// Last class in conflict wins, so we need to filter conflicting classes in reverse order.
|
|
308
|
+
.filter(parsed => {
|
|
309
|
+
if (!parsed.isTailwindClass) {
|
|
310
|
+
return true;
|
|
298
311
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
312
|
+
const {
|
|
313
|
+
modifierId,
|
|
314
|
+
classGroupId,
|
|
315
|
+
hasPostfixModifier
|
|
316
|
+
} = parsed;
|
|
317
|
+
const classId = modifierId + classGroupId;
|
|
318
|
+
if (classGroupsInConflict.has(classId)) {
|
|
319
|
+
return false;
|
|
304
320
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
321
|
+
classGroupsInConflict.add(classId);
|
|
322
|
+
getConflictingClassGroupIds(classGroupId, hasPostfixModifier).forEach(group => classGroupsInConflict.add(modifierId + group));
|
|
323
|
+
return true;
|
|
324
|
+
}).reverse().map(parsed => parsed.originalClassName).join(' ');
|
|
325
|
+
}
|
|
310
326
|
|
|
311
327
|
/**
|
|
312
328
|
* The code in this file is copied from https://github.com/lukeed/clsx and modified to suit the needs of tailwind-merge better.
|
|
@@ -332,7 +348,7 @@ function twJoin() {
|
|
|
332
348
|
}
|
|
333
349
|
return string;
|
|
334
350
|
}
|
|
335
|
-
|
|
351
|
+
function toValue(mix) {
|
|
336
352
|
if (typeof mix === 'string') {
|
|
337
353
|
return mix;
|
|
338
354
|
}
|
|
@@ -347,7 +363,7 @@ const toValue = mix => {
|
|
|
347
363
|
}
|
|
348
364
|
}
|
|
349
365
|
return string;
|
|
350
|
-
}
|
|
366
|
+
}
|
|
351
367
|
function createTailwindMerge(createConfigFirst, ...createConfigRest) {
|
|
352
368
|
let configUtils;
|
|
353
369
|
let cacheGet;
|
|
@@ -374,11 +390,11 @@ function createTailwindMerge(createConfigFirst, ...createConfigRest) {
|
|
|
374
390
|
return functionToCall(twJoin.apply(null, arguments));
|
|
375
391
|
};
|
|
376
392
|
}
|
|
377
|
-
|
|
393
|
+
function fromTheme(key) {
|
|
378
394
|
const themeGetter = theme => theme[key] || [];
|
|
379
395
|
themeGetter.isThemeGetter = true;
|
|
380
396
|
return themeGetter;
|
|
381
|
-
}
|
|
397
|
+
}
|
|
382
398
|
const arbitraryValueRegex = /^\[(?:([a-z-]+):)?(.+)\]$/i;
|
|
383
399
|
const fractionRegex = /^\d+\/\d+$/;
|
|
384
400
|
const stringLengths = /*#__PURE__*/new Set(['px', 'full', 'screen']);
|
|
@@ -388,22 +404,48 @@ const colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/;
|
|
|
388
404
|
// Shadow always begins with x and y offset separated by underscore optionally prepended by inset
|
|
389
405
|
const shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
|
|
390
406
|
const imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
407
|
+
function isLength(value) {
|
|
408
|
+
return isNumber(value) || stringLengths.has(value) || fractionRegex.test(value);
|
|
409
|
+
}
|
|
410
|
+
function isArbitraryLength(value) {
|
|
411
|
+
return getIsArbitraryValue(value, 'length', isLengthOnly);
|
|
412
|
+
}
|
|
413
|
+
function isNumber(value) {
|
|
414
|
+
return Boolean(value) && !Number.isNaN(Number(value));
|
|
415
|
+
}
|
|
416
|
+
function isArbitraryNumber(value) {
|
|
417
|
+
return getIsArbitraryValue(value, 'number', isNumber);
|
|
418
|
+
}
|
|
419
|
+
function isInteger(value) {
|
|
420
|
+
return Boolean(value) && Number.isInteger(Number(value));
|
|
421
|
+
}
|
|
422
|
+
function isPercent(value) {
|
|
423
|
+
return value.endsWith('%') && isNumber(value.slice(0, -1));
|
|
424
|
+
}
|
|
425
|
+
function isArbitraryValue(value) {
|
|
426
|
+
return arbitraryValueRegex.test(value);
|
|
427
|
+
}
|
|
428
|
+
function isTshirtSize(value) {
|
|
429
|
+
return tshirtUnitRegex.test(value);
|
|
430
|
+
}
|
|
399
431
|
const sizeLabels = /*#__PURE__*/new Set(['length', 'size', 'percentage']);
|
|
400
|
-
|
|
401
|
-
|
|
432
|
+
function isArbitrarySize(value) {
|
|
433
|
+
return getIsArbitraryValue(value, sizeLabels, isNever);
|
|
434
|
+
}
|
|
435
|
+
function isArbitraryPosition(value) {
|
|
436
|
+
return getIsArbitraryValue(value, 'position', isNever);
|
|
437
|
+
}
|
|
402
438
|
const imageLabels = /*#__PURE__*/new Set(['image', 'url']);
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
439
|
+
function isArbitraryImage(value) {
|
|
440
|
+
return getIsArbitraryValue(value, imageLabels, isImage);
|
|
441
|
+
}
|
|
442
|
+
function isArbitraryShadow(value) {
|
|
443
|
+
return getIsArbitraryValue(value, '', isShadow);
|
|
444
|
+
}
|
|
445
|
+
function isAny() {
|
|
446
|
+
return true;
|
|
447
|
+
}
|
|
448
|
+
function getIsArbitraryValue(value, label, testValue) {
|
|
407
449
|
const result = arbitraryValueRegex.exec(value);
|
|
408
450
|
if (result) {
|
|
409
451
|
if (result[1]) {
|
|
@@ -412,16 +454,23 @@ const getIsArbitraryValue = (value, label, testValue) => {
|
|
|
412
454
|
return testValue(result[2]);
|
|
413
455
|
}
|
|
414
456
|
return false;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
|
|
418
|
-
// For example, `hsl(0 0% 0%)` would be classified as a length without this check.
|
|
419
|
-
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
|
|
420
|
-
lengthUnitRegex.test(value) && !colorFunctionRegex.test(value);
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
457
|
+
}
|
|
458
|
+
function isLengthOnly(value) {
|
|
459
|
+
// `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
|
|
460
|
+
// For example, `hsl(0 0% 0%)` would be classified as a length without this check.
|
|
461
|
+
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
|
|
462
|
+
return lengthUnitRegex.test(value) && !colorFunctionRegex.test(value);
|
|
463
|
+
}
|
|
464
|
+
function isNever() {
|
|
465
|
+
return false;
|
|
466
|
+
}
|
|
467
|
+
function isShadow(value) {
|
|
468
|
+
return shadowRegex.test(value);
|
|
469
|
+
}
|
|
470
|
+
function isImage(value) {
|
|
471
|
+
return imageRegex.test(value);
|
|
472
|
+
}
|
|
473
|
+
function getDefaultConfig() {
|
|
425
474
|
const colors = fromTheme('colors');
|
|
426
475
|
const spacing = fromTheme('spacing');
|
|
427
476
|
const blur = fromTheme('blur');
|
|
@@ -459,6 +508,7 @@ const getDefaultConfig = () => {
|
|
|
459
508
|
const getAlign = () => ['start', 'end', 'center', 'between', 'around', 'evenly', 'stretch'];
|
|
460
509
|
const getZeroAndEmpty = () => ['', '0', isArbitraryValue];
|
|
461
510
|
const getBreaks = () => ['auto', 'avoid', 'all', 'avoid-page', 'page', 'left', 'right', 'column'];
|
|
511
|
+
const getNumber = () => [isNumber, isArbitraryNumber];
|
|
462
512
|
const getNumberAndArbitrary = () => [isNumber, isArbitraryValue];
|
|
463
513
|
return {
|
|
464
514
|
cacheSize: 500,
|
|
@@ -467,12 +517,12 @@ const getDefaultConfig = () => {
|
|
|
467
517
|
colors: [isAny],
|
|
468
518
|
spacing: [isLength, isArbitraryLength],
|
|
469
519
|
blur: ['none', '', isTshirtSize, isArbitraryValue],
|
|
470
|
-
brightness:
|
|
520
|
+
brightness: getNumber(),
|
|
471
521
|
borderColor: [colors],
|
|
472
522
|
borderRadius: ['none', '', 'full', isTshirtSize, isArbitraryValue],
|
|
473
523
|
borderSpacing: getSpacingWithArbitrary(),
|
|
474
524
|
borderWidth: getLengthWithEmptyAndArbitrary(),
|
|
475
|
-
contrast:
|
|
525
|
+
contrast: getNumber(),
|
|
476
526
|
grayscale: getZeroAndEmpty(),
|
|
477
527
|
hueRotate: getNumberAndArbitrary(),
|
|
478
528
|
invert: getZeroAndEmpty(),
|
|
@@ -481,10 +531,10 @@ const getDefaultConfig = () => {
|
|
|
481
531
|
gradientColorStopPositions: [isPercent, isArbitraryLength],
|
|
482
532
|
inset: getSpacingWithAutoAndArbitrary(),
|
|
483
533
|
margin: getSpacingWithAutoAndArbitrary(),
|
|
484
|
-
opacity:
|
|
534
|
+
opacity: getNumber(),
|
|
485
535
|
padding: getSpacingWithArbitrary(),
|
|
486
|
-
saturate:
|
|
487
|
-
scale:
|
|
536
|
+
saturate: getNumber(),
|
|
537
|
+
scale: getNumber(),
|
|
488
538
|
sepia: getZeroAndEmpty(),
|
|
489
539
|
skew: getNumberAndArbitrary(),
|
|
490
540
|
space: getSpacingWithArbitrary(),
|
|
@@ -1185,7 +1235,7 @@ const getDefaultConfig = () => {
|
|
|
1185
1235
|
* Font Variant Numeric
|
|
1186
1236
|
* @see https://tailwindcss.com/docs/font-variant-numeric
|
|
1187
1237
|
*/
|
|
1188
|
-
'fvn-fraction': ['diagonal-fractions', 'stacked-
|
|
1238
|
+
'fvn-fraction': ['diagonal-fractions', 'stacked-fractons'],
|
|
1189
1239
|
/**
|
|
1190
1240
|
* Letter Spacing
|
|
1191
1241
|
* @see https://tailwindcss.com/docs/letter-spacing
|
|
@@ -1709,20 +1759,6 @@ const getDefaultConfig = () => {
|
|
|
1709
1759
|
'border-color-y': [{
|
|
1710
1760
|
'border-y': [borderColor]
|
|
1711
1761
|
}],
|
|
1712
|
-
/**
|
|
1713
|
-
* Border Color S
|
|
1714
|
-
* @see https://tailwindcss.com/docs/border-color
|
|
1715
|
-
*/
|
|
1716
|
-
'border-color-s': [{
|
|
1717
|
-
'border-s': [borderColor]
|
|
1718
|
-
}],
|
|
1719
|
-
/**
|
|
1720
|
-
* Border Color E
|
|
1721
|
-
* @see https://tailwindcss.com/docs/border-color
|
|
1722
|
-
*/
|
|
1723
|
-
'border-color-e': [{
|
|
1724
|
-
'border-e': [borderColor]
|
|
1725
|
-
}],
|
|
1726
1762
|
/**
|
|
1727
1763
|
* Border Color Top
|
|
1728
1764
|
* @see https://tailwindcss.com/docs/border-color
|
|
@@ -2469,7 +2505,7 @@ const getDefaultConfig = () => {
|
|
|
2469
2505
|
'border-w': ['border-w-s', 'border-w-e', 'border-w-t', 'border-w-r', 'border-w-b', 'border-w-l'],
|
|
2470
2506
|
'border-w-x': ['border-w-r', 'border-w-l'],
|
|
2471
2507
|
'border-w-y': ['border-w-t', 'border-w-b'],
|
|
2472
|
-
'border-color': ['border-color-
|
|
2508
|
+
'border-color': ['border-color-t', 'border-color-r', 'border-color-b', 'border-color-l'],
|
|
2473
2509
|
'border-color-x': ['border-color-r', 'border-color-l'],
|
|
2474
2510
|
'border-color-y': ['border-color-t', 'border-color-b'],
|
|
2475
2511
|
'scroll-m': ['scroll-mx', 'scroll-my', 'scroll-ms', 'scroll-me', 'scroll-mt', 'scroll-mr', 'scroll-mb', 'scroll-ml'],
|
|
@@ -2487,20 +2523,20 @@ const getDefaultConfig = () => {
|
|
|
2487
2523
|
'font-size': ['leading']
|
|
2488
2524
|
}
|
|
2489
2525
|
};
|
|
2490
|
-
}
|
|
2526
|
+
}
|
|
2491
2527
|
|
|
2492
2528
|
/**
|
|
2493
2529
|
* @param baseConfig Config where other config will be merged into. This object will be mutated.
|
|
2494
2530
|
* @param configExtension Partial config to merge into the `baseConfig`.
|
|
2495
2531
|
*/
|
|
2496
|
-
|
|
2532
|
+
function mergeConfigs(baseConfig, {
|
|
2497
2533
|
cacheSize,
|
|
2498
2534
|
prefix,
|
|
2499
2535
|
separator,
|
|
2500
2536
|
experimentalParseClassName,
|
|
2501
2537
|
extend = {},
|
|
2502
2538
|
override = {}
|
|
2503
|
-
})
|
|
2539
|
+
}) {
|
|
2504
2540
|
overrideProperty(baseConfig, 'cacheSize', cacheSize);
|
|
2505
2541
|
overrideProperty(baseConfig, 'prefix', prefix);
|
|
2506
2542
|
overrideProperty(baseConfig, 'separator', separator);
|
|
@@ -2512,20 +2548,20 @@ const mergeConfigs = (baseConfig, {
|
|
|
2512
2548
|
mergeConfigProperties(baseConfig[key], extend[key]);
|
|
2513
2549
|
}
|
|
2514
2550
|
return baseConfig;
|
|
2515
|
-
}
|
|
2516
|
-
|
|
2551
|
+
}
|
|
2552
|
+
function overrideProperty(baseObject, overrideKey, overrideValue) {
|
|
2517
2553
|
if (overrideValue !== undefined) {
|
|
2518
2554
|
baseObject[overrideKey] = overrideValue;
|
|
2519
2555
|
}
|
|
2520
|
-
}
|
|
2521
|
-
|
|
2556
|
+
}
|
|
2557
|
+
function overrideConfigProperties(baseObject, overrideObject) {
|
|
2522
2558
|
if (overrideObject) {
|
|
2523
2559
|
for (const key in overrideObject) {
|
|
2524
2560
|
overrideProperty(baseObject, key, overrideObject[key]);
|
|
2525
2561
|
}
|
|
2526
2562
|
}
|
|
2527
|
-
}
|
|
2528
|
-
|
|
2563
|
+
}
|
|
2564
|
+
function mergeConfigProperties(baseObject, mergeObject) {
|
|
2529
2565
|
if (mergeObject) {
|
|
2530
2566
|
for (const key in mergeObject) {
|
|
2531
2567
|
const mergeValue = mergeObject[key];
|
|
@@ -2534,8 +2570,10 @@ const mergeConfigProperties = (baseObject, mergeObject) => {
|
|
|
2534
2570
|
}
|
|
2535
2571
|
}
|
|
2536
2572
|
}
|
|
2537
|
-
}
|
|
2538
|
-
|
|
2573
|
+
}
|
|
2574
|
+
function extendTailwindMerge(configExtension, ...createConfig) {
|
|
2575
|
+
return typeof configExtension === 'function' ? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig) : createTailwindMerge(() => mergeConfigs(getDefaultConfig(), configExtension), ...createConfig);
|
|
2576
|
+
}
|
|
2539
2577
|
const twMerge = /*#__PURE__*/createTailwindMerge(getDefaultConfig);
|
|
2540
2578
|
|
|
2541
2579
|
export { createTailwindMerge, extendTailwindMerge, fromTheme, getDefaultConfig, mergeConfigs, twJoin, twMerge };
|