@lukso/web-components 1.51.5 → 1.52.0

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.
Files changed (93) hide show
  1. package/dist/{index-b83c7efa.js → cn-1594f5ba.js} +340 -635
  2. package/dist/{index-619f20e8.cjs → cn-312c6e88.cjs} +342 -637
  3. package/dist/components/index.cjs +7 -6
  4. package/dist/components/index.js +7 -6
  5. package/dist/components/lukso-button/index.cjs +2656 -75
  6. package/dist/components/lukso-button/index.d.ts +3 -12
  7. package/dist/components/lukso-button/index.d.ts.map +1 -1
  8. package/dist/components/lukso-button/index.js +2656 -75
  9. package/dist/components/lukso-button/lukso-button.stories.d.ts +4 -0
  10. package/dist/components/lukso-button/lukso-button.stories.d.ts.map +1 -1
  11. package/dist/components/lukso-card/index.cjs +326 -11
  12. package/dist/components/lukso-card/index.js +330 -6
  13. package/dist/components/lukso-checkbox/index.cjs +1 -1
  14. package/dist/components/lukso-checkbox/index.js +1 -1
  15. package/dist/components/lukso-footer/index.cjs +1 -1
  16. package/dist/components/lukso-footer/index.js +1 -1
  17. package/dist/components/lukso-icon/index.cjs +2 -2
  18. package/dist/components/lukso-icon/index.js +2 -2
  19. package/dist/components/lukso-input/index.cjs +1 -1
  20. package/dist/components/lukso-input/index.js +1 -1
  21. package/dist/components/lukso-modal/index.cjs +1 -1
  22. package/dist/components/lukso-modal/index.js +1 -1
  23. package/dist/components/lukso-navbar/index.cjs +2 -2
  24. package/dist/components/lukso-navbar/index.js +2 -2
  25. package/dist/components/lukso-profile/index.cjs +2 -2
  26. package/dist/components/lukso-profile/index.js +2 -2
  27. package/dist/components/lukso-progress/index.cjs +21 -10
  28. package/dist/components/lukso-progress/index.d.ts +1 -0
  29. package/dist/components/lukso-progress/index.d.ts.map +1 -1
  30. package/dist/components/lukso-progress/index.js +21 -10
  31. package/dist/components/lukso-progress/lukso-progress.stories.d.ts.map +1 -1
  32. package/dist/components/lukso-sanitize/index.cjs +1 -1
  33. package/dist/components/lukso-sanitize/index.js +1 -1
  34. package/dist/components/lukso-search/index.cjs +3 -3
  35. package/dist/components/lukso-search/index.js +3 -3
  36. package/dist/components/lukso-select/index.cjs +3 -3
  37. package/dist/components/lukso-select/index.js +3 -3
  38. package/dist/components/lukso-share/index.cjs +1 -1
  39. package/dist/components/lukso-share/index.js +1 -1
  40. package/dist/components/lukso-switch/index.cjs +2 -2
  41. package/dist/components/lukso-switch/index.js +2 -2
  42. package/dist/components/lukso-tag/index.cjs +2 -2
  43. package/dist/components/lukso-tag/index.js +2 -2
  44. package/dist/components/lukso-terms/index.cjs +2 -2
  45. package/dist/components/lukso-terms/index.js +2 -2
  46. package/dist/components/lukso-test/index.cjs +1 -1
  47. package/dist/components/lukso-test/index.js +1 -1
  48. package/dist/components/lukso-tooltip/index.cjs +1 -1
  49. package/dist/components/lukso-tooltip/index.js +1 -1
  50. package/dist/components/lukso-username/index.cjs +2 -2
  51. package/dist/components/lukso-username/index.js +2 -2
  52. package/dist/components/lukso-wizard/index.cjs +1 -1
  53. package/dist/components/lukso-wizard/index.js +1 -1
  54. package/dist/index-35ca0b42.js +39 -0
  55. package/dist/{index-ee4182e6.js → index-739869da.js} +1 -1
  56. package/dist/{index-beb7703d.cjs → index-ace51f33.cjs} +1 -1
  57. package/dist/index-f426e548.cjs +46 -0
  58. package/dist/index.cjs +8 -7
  59. package/dist/index.js +7 -6
  60. package/dist/shared/tailwind-element/index.cjs +1 -1
  61. package/dist/shared/tailwind-element/index.js +1 -1
  62. package/dist/{style-map-671a0511.cjs → style-map-1175c018.cjs} +1 -1
  63. package/dist/{style-map-5be28c06.js → style-map-17f918a2.js} +1 -1
  64. package/dist/styles/main.css +1 -1
  65. package/dist/{color-palette.js → tailwind-config.cjs} +109 -1
  66. package/dist/tailwind-config.d.ts +136 -0
  67. package/dist/tailwind-config.d.ts.map +1 -0
  68. package/dist/{color-palette.cjs → tailwind-config.js} +95 -8
  69. package/package.json +8 -5
  70. package/tailwind.config.cjs +8 -118
  71. package/tools/cn.cjs +341 -307
  72. package/tools/cn.d.ts.map +1 -1
  73. package/tools/cn.js +341 -307
  74. package/tools/index.cjs +13 -6
  75. package/tools/index.d.ts +1 -1
  76. package/tools/index.d.ts.map +1 -1
  77. package/tools/index.js +1 -1
  78. package/tools/sass/fonts.scss +1 -1
  79. package/tools/styles/main.css +1 -1
  80. package/tools/{color-palette-2786d7c1.js → tailwind-config-0df99c97.js} +95 -1
  81. package/tools/{color-palette-18dd9e2f.cjs → tailwind-config-f8a808f6.cjs} +101 -0
  82. package/tools/tailwind-config.cjs +19 -0
  83. package/tools/tailwind-config.d.ts +136 -0
  84. package/tools/tailwind-config.d.ts.map +1 -0
  85. package/tools/tailwind-config.js +1 -0
  86. package/dist/color-palette.d.ts +0 -42
  87. package/dist/color-palette.d.ts.map +0 -1
  88. package/dist/index-04d11436.js +0 -39
  89. package/dist/index-997f3f0e.cjs +0 -46
  90. package/tools/color-palette.cjs +0 -12
  91. package/tools/color-palette.d.ts +0 -42
  92. package/tools/color-palette.d.ts.map +0 -1
  93. package/tools/color-palette.js +0 -1
@@ -1,11 +1,4 @@
1
- import { T as TailwindStyledElement, x } from './index-04d11436.js';
2
- import { n, e } from './query-assigned-elements-5d94572f.js';
3
- import { o } from './style-map-5be28c06.js';
4
- import './components/lukso-profile/index.js';
5
- import './color-palette.js';
6
- import { c as customStyleMap } from './index-ee4182e6.js';
7
-
8
- const style = ":host {\n display: inline-flex;\n width: 100%;\n}\n\n:host([width]) {\n width: inherit;\n}";
1
+ import { boxShadows, fontSizes, fontWeights, lineHeights, scales, heights, borderRadius, colorPalette } from './tailwind-config.js';
9
2
 
10
3
  import.meta.url.replace(/^file:\/\/|\/\w+\.?[jt]s$/g, "").replace(/\/index\.[a-z]+$/g, "");
11
4
 
@@ -13,55 +6,15 @@ import.meta.url.replace(/^file:\/\/|\/\w+\.?[jt]s$/g, "").replace(/\/index\.[a-z
13
6
 
14
7
  import.meta.url.replace(/^file:\/\/|\/\w+\.?[jt]s$/g, "").replace(/\/index\.[a-z]+$/g, "");
15
8
 
16
- /**
17
- * The code in this file is copied from https://github.com/lukeed/clsx and modified to suit the needs of tailwind-merge better.
18
- *
19
- * Specifically:
20
- * - Runtime code from https://github.com/lukeed/clsx/blob/v1.2.1/src/index.js
21
- * - TypeScript types from https://github.com/lukeed/clsx/blob/v1.2.1/clsx.d.ts
22
- *
23
- * Original code has MIT license: Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
24
- */
25
- function twJoin() {
26
- var index = 0;
27
- var argument;
28
- var resolvedValue;
29
- var string = '';
30
- while (index < arguments.length) {
31
- if (argument = arguments[index++]) {
32
- if (resolvedValue = toValue(argument)) {
33
- string && (string += ' ');
34
- string += resolvedValue;
35
- }
36
- }
37
- }
38
- return string;
39
- }
40
- function toValue(mix) {
41
- if (typeof mix === 'string') {
42
- return mix;
43
- }
44
- var resolvedValue;
45
- var string = '';
46
- for (var k = 0; k < mix.length; k++) {
47
- if (mix[k]) {
48
- if (resolvedValue = toValue(mix[k])) {
49
- string && (string += ' ');
50
- string += resolvedValue;
51
- }
52
- }
53
- }
54
- return string;
55
- }
56
-
57
- var CLASS_PART_SEPARATOR = '-';
9
+ const CLASS_PART_SEPARATOR = '-';
58
10
  function createClassUtils(config) {
59
- var classMap = createClassMap(config);
60
- var conflictingClassGroups = config.conflictingClassGroups,
61
- _config$conflictingCl = config.conflictingClassGroupModifiers,
62
- conflictingClassGroupModifiers = _config$conflictingCl === void 0 ? {} : _config$conflictingCl;
11
+ const classMap = createClassMap(config);
12
+ const {
13
+ conflictingClassGroups,
14
+ conflictingClassGroupModifiers
15
+ } = config;
63
16
  function getClassGroupId(className) {
64
- var classParts = className.split(CLASS_PART_SEPARATOR);
17
+ const classParts = className.split(CLASS_PART_SEPARATOR);
65
18
  // 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.
66
19
  if (classParts[0] === '' && classParts.length !== 1) {
67
20
  classParts.shift();
@@ -69,41 +22,40 @@ function createClassUtils(config) {
69
22
  return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
70
23
  }
71
24
  function getConflictingClassGroupIds(classGroupId, hasPostfixModifier) {
72
- var conflicts = conflictingClassGroups[classGroupId] || [];
25
+ const conflicts = conflictingClassGroups[classGroupId] || [];
73
26
  if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
74
- return [].concat(conflicts, conflictingClassGroupModifiers[classGroupId]);
27
+ return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
75
28
  }
76
29
  return conflicts;
77
30
  }
78
31
  return {
79
- getClassGroupId: getClassGroupId,
80
- getConflictingClassGroupIds: getConflictingClassGroupIds
32
+ getClassGroupId,
33
+ getConflictingClassGroupIds
81
34
  };
82
35
  }
83
36
  function getGroupRecursive(classParts, classPartObject) {
84
37
  if (classParts.length === 0) {
85
38
  return classPartObject.classGroupId;
86
39
  }
87
- var currentClassPart = classParts[0];
88
- var nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
89
- var classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : undefined;
40
+ const currentClassPart = classParts[0];
41
+ const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
42
+ const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : undefined;
90
43
  if (classGroupFromNextClassPart) {
91
44
  return classGroupFromNextClassPart;
92
45
  }
93
46
  if (classPartObject.validators.length === 0) {
94
47
  return undefined;
95
48
  }
96
- var classRest = classParts.join(CLASS_PART_SEPARATOR);
97
- return classPartObject.validators.find(function (_ref) {
98
- var validator = _ref.validator;
99
- return validator(classRest);
100
- })?.classGroupId;
49
+ const classRest = classParts.join(CLASS_PART_SEPARATOR);
50
+ return classPartObject.validators.find(({
51
+ validator
52
+ }) => validator(classRest))?.classGroupId;
101
53
  }
102
- var arbitraryPropertyRegex = /^\[(.+)\]$/;
54
+ const arbitraryPropertyRegex = /^\[(.+)\]$/;
103
55
  function getGroupIdForArbitraryProperty(className) {
104
56
  if (arbitraryPropertyRegex.test(className)) {
105
- var arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
106
- var property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(':'));
57
+ const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
58
+ const property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(':'));
107
59
  if (property) {
108
60
  // I use two dots here because one dot is used as prefix for class groups in plugins
109
61
  return 'arbitrary..' + property;
@@ -114,24 +66,24 @@ function getGroupIdForArbitraryProperty(className) {
114
66
  * Exported for testing only
115
67
  */
116
68
  function createClassMap(config) {
117
- var theme = config.theme,
118
- prefix = config.prefix;
119
- var classMap = {
69
+ const {
70
+ theme,
71
+ prefix
72
+ } = config;
73
+ const classMap = {
120
74
  nextPart: new Map(),
121
75
  validators: []
122
76
  };
123
- var prefixedClassGroupEntries = getPrefixedClassGroupEntries(Object.entries(config.classGroups), prefix);
124
- prefixedClassGroupEntries.forEach(function (_ref2) {
125
- var classGroupId = _ref2[0],
126
- classGroup = _ref2[1];
77
+ const prefixedClassGroupEntries = getPrefixedClassGroupEntries(Object.entries(config.classGroups), prefix);
78
+ prefixedClassGroupEntries.forEach(([classGroupId, classGroup]) => {
127
79
  processClassesRecursively(classGroup, classMap, classGroupId, theme);
128
80
  });
129
81
  return classMap;
130
82
  }
131
83
  function processClassesRecursively(classGroup, classPartObject, classGroupId, theme) {
132
- classGroup.forEach(function (classDefinition) {
84
+ classGroup.forEach(classDefinition => {
133
85
  if (typeof classDefinition === 'string') {
134
- var classPartObjectToEdit = classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition);
86
+ const classPartObjectToEdit = classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition);
135
87
  classPartObjectToEdit.classGroupId = classGroupId;
136
88
  return;
137
89
  }
@@ -142,20 +94,18 @@ function processClassesRecursively(classGroup, classPartObject, classGroupId, th
142
94
  }
143
95
  classPartObject.validators.push({
144
96
  validator: classDefinition,
145
- classGroupId: classGroupId
97
+ classGroupId
146
98
  });
147
99
  return;
148
100
  }
149
- Object.entries(classDefinition).forEach(function (_ref3) {
150
- var key = _ref3[0],
151
- classGroup = _ref3[1];
101
+ Object.entries(classDefinition).forEach(([key, classGroup]) => {
152
102
  processClassesRecursively(classGroup, getPart(classPartObject, key), classGroupId, theme);
153
103
  });
154
104
  });
155
105
  }
156
106
  function getPart(classPartObject, path) {
157
- var currentClassPartObject = classPartObject;
158
- path.split(CLASS_PART_SEPARATOR).forEach(function (pathPart) {
107
+ let currentClassPartObject = classPartObject;
108
+ path.split(CLASS_PART_SEPARATOR).forEach(pathPart => {
159
109
  if (!currentClassPartObject.nextPart.has(pathPart)) {
160
110
  currentClassPartObject.nextPart.set(pathPart, {
161
111
  nextPart: new Map(),
@@ -173,19 +123,13 @@ function getPrefixedClassGroupEntries(classGroupEntries, prefix) {
173
123
  if (!prefix) {
174
124
  return classGroupEntries;
175
125
  }
176
- return classGroupEntries.map(function (_ref4) {
177
- var classGroupId = _ref4[0],
178
- classGroup = _ref4[1];
179
- var prefixedClassGroup = classGroup.map(function (classDefinition) {
126
+ return classGroupEntries.map(([classGroupId, classGroup]) => {
127
+ const prefixedClassGroup = classGroup.map(classDefinition => {
180
128
  if (typeof classDefinition === 'string') {
181
129
  return prefix + classDefinition;
182
130
  }
183
131
  if (typeof classDefinition === 'object') {
184
- return Object.fromEntries(Object.entries(classDefinition).map(function (_ref5) {
185
- var key = _ref5[0],
186
- value = _ref5[1];
187
- return [prefix + key, value];
188
- }));
132
+ return Object.fromEntries(Object.entries(classDefinition).map(([key, value]) => [prefix + key, value]));
189
133
  }
190
134
  return classDefinition;
191
135
  });
@@ -197,15 +141,13 @@ function getPrefixedClassGroupEntries(classGroupEntries, prefix) {
197
141
  function createLruCache(maxCacheSize) {
198
142
  if (maxCacheSize < 1) {
199
143
  return {
200
- get: function get() {
201
- return undefined;
202
- },
203
- set: function set() {}
144
+ get: () => undefined,
145
+ set: () => {}
204
146
  };
205
147
  }
206
- var cacheSize = 0;
207
- var cache = new Map();
208
- var previousCache = new Map();
148
+ let cacheSize = 0;
149
+ let cache = new Map();
150
+ let previousCache = new Map();
209
151
  function update(key, value) {
210
152
  cache.set(key, value);
211
153
  cacheSize++;
@@ -216,8 +158,8 @@ function createLruCache(maxCacheSize) {
216
158
  }
217
159
  }
218
160
  return {
219
- get: function get(key) {
220
- var value = cache.get(key);
161
+ get(key) {
162
+ let value = cache.get(key);
221
163
  if (value !== undefined) {
222
164
  return value;
223
165
  }
@@ -226,7 +168,7 @@ function createLruCache(maxCacheSize) {
226
168
  return value;
227
169
  }
228
170
  },
229
- set: function set(key, value) {
171
+ set(key, value) {
230
172
  if (cache.has(key)) {
231
173
  cache.set(key, value);
232
174
  } else {
@@ -235,21 +177,20 @@ function createLruCache(maxCacheSize) {
235
177
  }
236
178
  };
237
179
  }
238
-
239
- var IMPORTANT_MODIFIER = '!';
180
+ const IMPORTANT_MODIFIER = '!';
240
181
  function createSplitModifiers(config) {
241
- var separator = config.separator || ':';
242
- var isSeparatorSingleCharacter = separator.length === 1;
243
- var firstSeparatorCharacter = separator[0];
244
- var separatorLength = separator.length;
182
+ const separator = config.separator;
183
+ const isSeparatorSingleCharacter = separator.length === 1;
184
+ const firstSeparatorCharacter = separator[0];
185
+ const separatorLength = separator.length;
245
186
  // splitModifiers inspired by https://github.com/tailwindlabs/tailwindcss/blob/v3.2.2/src/util/splitAtTopLevelOnly.js
246
187
  return function splitModifiers(className) {
247
- var modifiers = [];
248
- var bracketDepth = 0;
249
- var modifierStart = 0;
250
- var postfixModifierPosition;
251
- for (var index = 0; index < className.length; index++) {
252
- var currentCharacter = className[index];
188
+ const modifiers = [];
189
+ let bracketDepth = 0;
190
+ let modifierStart = 0;
191
+ let postfixModifierPosition;
192
+ for (let index = 0; index < className.length; index++) {
193
+ let currentCharacter = className[index];
253
194
  if (bracketDepth === 0) {
254
195
  if (currentCharacter === firstSeparatorCharacter && (isSeparatorSingleCharacter || className.slice(index, index + separatorLength) === separator)) {
255
196
  modifiers.push(className.slice(modifierStart, index));
@@ -267,15 +208,15 @@ function createSplitModifiers(config) {
267
208
  bracketDepth--;
268
209
  }
269
210
  }
270
- var baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
271
- var hasImportantModifier = baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER);
272
- var baseClassName = hasImportantModifier ? baseClassNameWithImportantModifier.substring(1) : baseClassNameWithImportantModifier;
273
- var maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : undefined;
211
+ const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
212
+ const hasImportantModifier = baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER);
213
+ const baseClassName = hasImportantModifier ? baseClassNameWithImportantModifier.substring(1) : baseClassNameWithImportantModifier;
214
+ const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : undefined;
274
215
  return {
275
- modifiers: modifiers,
276
- hasImportantModifier: hasImportantModifier,
277
- baseClassName: baseClassName,
278
- maybePostfixModifierPosition: maybePostfixModifierPosition
216
+ modifiers,
217
+ hasImportantModifier,
218
+ baseClassName,
219
+ maybePostfixModifierPosition
279
220
  };
280
221
  };
281
222
  }
@@ -288,21 +229,20 @@ function sortModifiers(modifiers) {
288
229
  if (modifiers.length <= 1) {
289
230
  return modifiers;
290
231
  }
291
- var sortedModifiers = [];
292
- var unsortedModifiers = [];
293
- modifiers.forEach(function (modifier) {
294
- var isArbitraryVariant = modifier[0] === '[';
232
+ const sortedModifiers = [];
233
+ let unsortedModifiers = [];
234
+ modifiers.forEach(modifier => {
235
+ const isArbitraryVariant = modifier[0] === '[';
295
236
  if (isArbitraryVariant) {
296
- sortedModifiers.push.apply(sortedModifiers, unsortedModifiers.sort().concat([modifier]));
237
+ sortedModifiers.push(...unsortedModifiers.sort(), modifier);
297
238
  unsortedModifiers = [];
298
239
  } else {
299
240
  unsortedModifiers.push(modifier);
300
241
  }
301
242
  });
302
- sortedModifiers.push.apply(sortedModifiers, unsortedModifiers.sort());
243
+ sortedModifiers.push(...unsortedModifiers.sort());
303
244
  return sortedModifiers;
304
245
  }
305
-
306
246
  function createConfigUtils(config) {
307
247
  return {
308
248
  cache: createLruCache(config.cacheSize),
@@ -310,12 +250,13 @@ function createConfigUtils(config) {
310
250
  ...createClassUtils(config)
311
251
  };
312
252
  }
313
-
314
- var SPLIT_CLASSES_REGEX = /\s+/;
253
+ const SPLIT_CLASSES_REGEX = /\s+/;
315
254
  function mergeClassList(classList, configUtils) {
316
- var splitModifiers = configUtils.splitModifiers,
317
- getClassGroupId = configUtils.getClassGroupId,
318
- getConflictingClassGroupIds = configUtils.getConflictingClassGroupIds;
255
+ const {
256
+ splitModifiers,
257
+ getClassGroupId,
258
+ getConflictingClassGroupIds
259
+ } = configUtils;
319
260
  /**
320
261
  * Set of classGroupIds in following format:
321
262
  * `{importantModifier}{variantModifiers}{classGroupId}`
@@ -323,77 +264,109 @@ function mergeClassList(classList, configUtils) {
323
264
  * @example 'hover:focus:bg-color'
324
265
  * @example 'md:!pr'
325
266
  */
326
- var classGroupsInConflict = new Set();
327
- return classList.trim().split(SPLIT_CLASSES_REGEX).map(function (originalClassName) {
328
- var _splitModifiers = splitModifiers(originalClassName),
329
- modifiers = _splitModifiers.modifiers,
330
- hasImportantModifier = _splitModifiers.hasImportantModifier,
331
- baseClassName = _splitModifiers.baseClassName,
332
- maybePostfixModifierPosition = _splitModifiers.maybePostfixModifierPosition;
333
- var classGroupId = getClassGroupId(maybePostfixModifierPosition ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);
334
- var hasPostfixModifier = Boolean(maybePostfixModifierPosition);
267
+ const classGroupsInConflict = new Set();
268
+ return classList.trim().split(SPLIT_CLASSES_REGEX).map(originalClassName => {
269
+ const {
270
+ modifiers,
271
+ hasImportantModifier,
272
+ baseClassName,
273
+ maybePostfixModifierPosition
274
+ } = splitModifiers(originalClassName);
275
+ let classGroupId = getClassGroupId(maybePostfixModifierPosition ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);
276
+ let hasPostfixModifier = Boolean(maybePostfixModifierPosition);
335
277
  if (!classGroupId) {
336
278
  if (!maybePostfixModifierPosition) {
337
279
  return {
338
280
  isTailwindClass: false,
339
- originalClassName: originalClassName
281
+ originalClassName
340
282
  };
341
283
  }
342
284
  classGroupId = getClassGroupId(baseClassName);
343
285
  if (!classGroupId) {
344
286
  return {
345
287
  isTailwindClass: false,
346
- originalClassName: originalClassName
288
+ originalClassName
347
289
  };
348
290
  }
349
291
  hasPostfixModifier = false;
350
292
  }
351
- var variantModifier = sortModifiers(modifiers).join(':');
352
- var modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
293
+ const variantModifier = sortModifiers(modifiers).join(':');
294
+ const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
353
295
  return {
354
296
  isTailwindClass: true,
355
- modifierId: modifierId,
356
- classGroupId: classGroupId,
357
- originalClassName: originalClassName,
358
- hasPostfixModifier: hasPostfixModifier
297
+ modifierId,
298
+ classGroupId,
299
+ originalClassName,
300
+ hasPostfixModifier
359
301
  };
360
302
  }).reverse()
361
303
  // Last class in conflict wins, so we need to filter conflicting classes in reverse order.
362
- .filter(function (parsed) {
304
+ .filter(parsed => {
363
305
  if (!parsed.isTailwindClass) {
364
306
  return true;
365
307
  }
366
- var modifierId = parsed.modifierId,
367
- classGroupId = parsed.classGroupId,
368
- hasPostfixModifier = parsed.hasPostfixModifier;
369
- var classId = modifierId + classGroupId;
308
+ const {
309
+ modifierId,
310
+ classGroupId,
311
+ hasPostfixModifier
312
+ } = parsed;
313
+ const classId = modifierId + classGroupId;
370
314
  if (classGroupsInConflict.has(classId)) {
371
315
  return false;
372
316
  }
373
317
  classGroupsInConflict.add(classId);
374
- getConflictingClassGroupIds(classGroupId, hasPostfixModifier).forEach(function (group) {
375
- return classGroupsInConflict.add(modifierId + group);
376
- });
318
+ getConflictingClassGroupIds(classGroupId, hasPostfixModifier).forEach(group => classGroupsInConflict.add(modifierId + group));
377
319
  return true;
378
- }).reverse().map(function (parsed) {
379
- return parsed.originalClassName;
380
- }).join(' ');
320
+ }).reverse().map(parsed => parsed.originalClassName).join(' ');
381
321
  }
382
322
 
383
- function createTailwindMerge() {
384
- for (var _len = arguments.length, createConfig = new Array(_len), _key = 0; _key < _len; _key++) {
385
- createConfig[_key] = arguments[_key];
323
+ /**
324
+ * The code in this file is copied from https://github.com/lukeed/clsx and modified to suit the needs of tailwind-merge better.
325
+ *
326
+ * Specifically:
327
+ * - Runtime code from https://github.com/lukeed/clsx/blob/v1.2.1/src/index.js
328
+ * - TypeScript types from https://github.com/lukeed/clsx/blob/v1.2.1/clsx.d.ts
329
+ *
330
+ * Original code has MIT license: Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
331
+ */
332
+ function twJoin() {
333
+ let index = 0;
334
+ let argument;
335
+ let resolvedValue;
336
+ let string = '';
337
+ while (index < arguments.length) {
338
+ if (argument = arguments[index++]) {
339
+ if (resolvedValue = toValue(argument)) {
340
+ string && (string += ' ');
341
+ string += resolvedValue;
342
+ }
343
+ }
344
+ }
345
+ return string;
346
+ }
347
+ function toValue(mix) {
348
+ if (typeof mix === 'string') {
349
+ return mix;
386
350
  }
387
- var configUtils;
388
- var cacheGet;
389
- var cacheSet;
390
- var functionToCall = initTailwindMerge;
351
+ let resolvedValue;
352
+ let string = '';
353
+ for (let k = 0; k < mix.length; k++) {
354
+ if (mix[k]) {
355
+ if (resolvedValue = toValue(mix[k])) {
356
+ string && (string += ' ');
357
+ string += resolvedValue;
358
+ }
359
+ }
360
+ }
361
+ return string;
362
+ }
363
+ function createTailwindMerge(createConfigFirst, ...createConfigRest) {
364
+ let configUtils;
365
+ let cacheGet;
366
+ let cacheSet;
367
+ let functionToCall = initTailwindMerge;
391
368
  function initTailwindMerge(classList) {
392
- var firstCreateConfig = createConfig[0],
393
- restCreateConfig = createConfig.slice(1);
394
- var config = restCreateConfig.reduce(function (previousConfig, createConfigCurrent) {
395
- return createConfigCurrent(previousConfig);
396
- }, firstCreateConfig());
369
+ const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
397
370
  configUtils = createConfigUtils(config);
398
371
  cacheGet = configUtils.cache.get;
399
372
  cacheSet = configUtils.cache.set;
@@ -401,11 +374,11 @@ function createTailwindMerge() {
401
374
  return tailwindMerge(classList);
402
375
  }
403
376
  function tailwindMerge(classList) {
404
- var cachedResult = cacheGet(classList);
377
+ const cachedResult = cacheGet(classList);
405
378
  if (cachedResult) {
406
379
  return cachedResult;
407
380
  }
408
- var result = mergeClassList(classList, configUtils);
381
+ const result = mergeClassList(classList, configUtils);
409
382
  cacheSet(classList, result);
410
383
  return result;
411
384
  }
@@ -413,66 +386,65 @@ function createTailwindMerge() {
413
386
  return functionToCall(twJoin.apply(null, arguments));
414
387
  };
415
388
  }
416
-
417
389
  function fromTheme(key) {
418
- var themeGetter = function themeGetter(theme) {
419
- return theme[key] || [];
420
- };
390
+ const themeGetter = theme => theme[key] || [];
421
391
  themeGetter.isThemeGetter = true;
422
392
  return themeGetter;
423
393
  }
424
-
425
- var arbitraryValueRegex = /^\[(?:([a-z-]+):)?(.+)\]$/i;
426
- var fractionRegex = /^\d+\/\d+$/;
427
- var stringLengths = /*#__PURE__*/new Set(['px', 'full', 'screen']);
428
- var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
429
- 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$/;
394
+ const arbitraryValueRegex = /^\[(?:([a-z-]+):)?(.+)\]$/i;
395
+ const fractionRegex = /^\d+\/\d+$/;
396
+ const stringLengths = /*#__PURE__*/new Set(['px', 'full', 'screen']);
397
+ const tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
398
+ const 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$/;
430
399
  // Shadow always begins with x and y offset separated by underscore
431
- var shadowRegex = /^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
400
+ const shadowRegex = /^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
401
+ const imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
432
402
  function isLength(value) {
433
- return isNumber(value) || stringLengths.has(value) || fractionRegex.test(value) || isArbitraryLength(value);
403
+ return isNumber(value) || stringLengths.has(value) || fractionRegex.test(value);
434
404
  }
435
405
  function isArbitraryLength(value) {
436
406
  return getIsArbitraryValue(value, 'length', isLengthOnly);
437
407
  }
438
- function isArbitrarySize(value) {
439
- return getIsArbitraryValue(value, 'size', isNever);
440
- }
441
- function isArbitraryPosition(value) {
442
- return getIsArbitraryValue(value, 'position', isNever);
443
- }
444
- function isArbitraryUrl(value) {
445
- return getIsArbitraryValue(value, 'url', isUrl);
408
+ function isNumber(value) {
409
+ return Boolean(value) && !Number.isNaN(Number(value));
446
410
  }
447
411
  function isArbitraryNumber(value) {
448
412
  return getIsArbitraryValue(value, 'number', isNumber);
449
413
  }
450
- function isNumber(value) {
451
- return !Number.isNaN(Number(value));
414
+ function isInteger(value) {
415
+ return Boolean(value) && Number.isInteger(Number(value));
452
416
  }
453
417
  function isPercent(value) {
454
418
  return value.endsWith('%') && isNumber(value.slice(0, -1));
455
419
  }
456
- function isInteger(value) {
457
- return isIntegerOnly(value) || getIsArbitraryValue(value, 'number', isIntegerOnly);
458
- }
459
420
  function isArbitraryValue(value) {
460
421
  return arbitraryValueRegex.test(value);
461
422
  }
462
- function isAny() {
463
- return true;
464
- }
465
423
  function isTshirtSize(value) {
466
424
  return tshirtUnitRegex.test(value);
467
425
  }
426
+ const sizeLabels = /*#__PURE__*/new Set(['length', 'size', 'percentage']);
427
+ function isArbitrarySize(value) {
428
+ return getIsArbitraryValue(value, sizeLabels, isNever);
429
+ }
430
+ function isArbitraryPosition(value) {
431
+ return getIsArbitraryValue(value, 'position', isNever);
432
+ }
433
+ const imageLabels = /*#__PURE__*/new Set(['image', 'url']);
434
+ function isArbitraryImage(value) {
435
+ return getIsArbitraryValue(value, imageLabels, isImage);
436
+ }
468
437
  function isArbitraryShadow(value) {
469
438
  return getIsArbitraryValue(value, '', isShadow);
470
439
  }
440
+ function isAny() {
441
+ return true;
442
+ }
471
443
  function getIsArbitraryValue(value, label, testValue) {
472
- var result = arbitraryValueRegex.exec(value);
444
+ const result = arbitraryValueRegex.exec(value);
473
445
  if (result) {
474
446
  if (result[1]) {
475
- return result[1] === label;
447
+ return typeof label === 'string' ? result[1] === label : label.has(result[1]);
476
448
  }
477
449
  return testValue(result[2]);
478
450
  }
@@ -484,95 +456,64 @@ function isLengthOnly(value) {
484
456
  function isNever() {
485
457
  return false;
486
458
  }
487
- function isUrl(value) {
488
- return value.startsWith('url(');
489
- }
490
- function isIntegerOnly(value) {
491
- return Number.isInteger(Number(value));
492
- }
493
459
  function isShadow(value) {
494
460
  return shadowRegex.test(value);
495
461
  }
496
-
462
+ function isImage(value) {
463
+ return imageRegex.test(value);
464
+ }
497
465
  function getDefaultConfig() {
498
- var colors = fromTheme('colors');
499
- var spacing = fromTheme('spacing');
500
- var blur = fromTheme('blur');
501
- var brightness = fromTheme('brightness');
502
- var borderColor = fromTheme('borderColor');
503
- var borderRadius = fromTheme('borderRadius');
504
- var borderSpacing = fromTheme('borderSpacing');
505
- var borderWidth = fromTheme('borderWidth');
506
- var contrast = fromTheme('contrast');
507
- var grayscale = fromTheme('grayscale');
508
- var hueRotate = fromTheme('hueRotate');
509
- var invert = fromTheme('invert');
510
- var gap = fromTheme('gap');
511
- var gradientColorStops = fromTheme('gradientColorStops');
512
- var gradientColorStopPositions = fromTheme('gradientColorStopPositions');
513
- var inset = fromTheme('inset');
514
- var margin = fromTheme('margin');
515
- var opacity = fromTheme('opacity');
516
- var padding = fromTheme('padding');
517
- var saturate = fromTheme('saturate');
518
- var scale = fromTheme('scale');
519
- var sepia = fromTheme('sepia');
520
- var skew = fromTheme('skew');
521
- var space = fromTheme('space');
522
- var translate = fromTheme('translate');
523
- var getOverscroll = function getOverscroll() {
524
- return ['auto', 'contain', 'none'];
525
- };
526
- var getOverflow = function getOverflow() {
527
- return ['auto', 'hidden', 'clip', 'visible', 'scroll'];
528
- };
529
- var getSpacingWithAutoAndArbitrary = function getSpacingWithAutoAndArbitrary() {
530
- return ['auto', isArbitraryValue, spacing];
531
- };
532
- var getSpacingWithArbitrary = function getSpacingWithArbitrary() {
533
- return [isArbitraryValue, spacing];
534
- };
535
- var getLengthWithEmpty = function getLengthWithEmpty() {
536
- return ['', isLength];
537
- };
538
- var getNumberWithAutoAndArbitrary = function getNumberWithAutoAndArbitrary() {
539
- return ['auto', isNumber, isArbitraryValue];
540
- };
541
- var getPositions = function getPositions() {
542
- return ['bottom', 'center', 'left', 'left-bottom', 'left-top', 'right', 'right-bottom', 'right-top', 'top'];
543
- };
544
- var getLineStyles = function getLineStyles() {
545
- return ['solid', 'dashed', 'dotted', 'double', 'none'];
546
- };
547
- var getBlendModes = function getBlendModes() {
548
- return ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity', 'plus-lighter'];
549
- };
550
- var getAlign = function getAlign() {
551
- return ['start', 'end', 'center', 'between', 'around', 'evenly', 'stretch'];
552
- };
553
- var getZeroAndEmpty = function getZeroAndEmpty() {
554
- return ['', '0', isArbitraryValue];
555
- };
556
- var getBreaks = function getBreaks() {
557
- return ['auto', 'avoid', 'all', 'avoid-page', 'page', 'left', 'right', 'column'];
558
- };
559
- var getNumber = function getNumber() {
560
- return [isNumber, isArbitraryNumber];
561
- };
562
- var getNumberAndArbitrary = function getNumberAndArbitrary() {
563
- return [isNumber, isArbitraryValue];
564
- };
466
+ const colors = fromTheme('colors');
467
+ const spacing = fromTheme('spacing');
468
+ const blur = fromTheme('blur');
469
+ const brightness = fromTheme('brightness');
470
+ const borderColor = fromTheme('borderColor');
471
+ const borderRadius = fromTheme('borderRadius');
472
+ const borderSpacing = fromTheme('borderSpacing');
473
+ const borderWidth = fromTheme('borderWidth');
474
+ const contrast = fromTheme('contrast');
475
+ const grayscale = fromTheme('grayscale');
476
+ const hueRotate = fromTheme('hueRotate');
477
+ const invert = fromTheme('invert');
478
+ const gap = fromTheme('gap');
479
+ const gradientColorStops = fromTheme('gradientColorStops');
480
+ const gradientColorStopPositions = fromTheme('gradientColorStopPositions');
481
+ const inset = fromTheme('inset');
482
+ const margin = fromTheme('margin');
483
+ const opacity = fromTheme('opacity');
484
+ const padding = fromTheme('padding');
485
+ const saturate = fromTheme('saturate');
486
+ const scale = fromTheme('scale');
487
+ const sepia = fromTheme('sepia');
488
+ const skew = fromTheme('skew');
489
+ const space = fromTheme('space');
490
+ const translate = fromTheme('translate');
491
+ const getOverscroll = () => ['auto', 'contain', 'none'];
492
+ const getOverflow = () => ['auto', 'hidden', 'clip', 'visible', 'scroll'];
493
+ const getSpacingWithAutoAndArbitrary = () => ['auto', isArbitraryValue, spacing];
494
+ const getSpacingWithArbitrary = () => [isArbitraryValue, spacing];
495
+ const getLengthWithEmptyAndArbitrary = () => ['', isLength, isArbitraryLength];
496
+ const getNumberWithAutoAndArbitrary = () => ['auto', isNumber, isArbitraryValue];
497
+ const getPositions = () => ['bottom', 'center', 'left', 'left-bottom', 'left-top', 'right', 'right-bottom', 'right-top', 'top'];
498
+ const getLineStyles = () => ['solid', 'dashed', 'dotted', 'double', 'none'];
499
+ const getBlendModes = () => ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity', 'plus-lighter'];
500
+ const getAlign = () => ['start', 'end', 'center', 'between', 'around', 'evenly', 'stretch'];
501
+ const getZeroAndEmpty = () => ['', '0', isArbitraryValue];
502
+ const getBreaks = () => ['auto', 'avoid', 'all', 'avoid-page', 'page', 'left', 'right', 'column'];
503
+ const getNumber = () => [isNumber, isArbitraryNumber];
504
+ const getNumberAndArbitrary = () => [isNumber, isArbitraryValue];
565
505
  return {
566
506
  cacheSize: 500,
507
+ separator: ':',
567
508
  theme: {
568
509
  colors: [isAny],
569
- spacing: [isLength],
510
+ spacing: [isLength, isArbitraryLength],
570
511
  blur: ['none', '', isTshirtSize, isArbitraryValue],
571
512
  brightness: getNumber(),
572
513
  borderColor: [colors],
573
514
  borderRadius: ['none', '', 'full', isTshirtSize, isArbitraryValue],
574
515
  borderSpacing: getSpacingWithArbitrary(),
575
- borderWidth: getLengthWithEmpty(),
516
+ borderWidth: getLengthWithEmptyAndArbitrary(),
576
517
  contrast: getNumber(),
577
518
  grayscale: getZeroAndEmpty(),
578
519
  hueRotate: getNumberAndArbitrary(),
@@ -656,8 +597,8 @@ function getDefaultConfig() {
656
597
  * Floats
657
598
  * @see https://tailwindcss.com/docs/float
658
599
  */
659
- "float": [{
660
- "float": ['right', 'left', 'none']
600
+ float: [{
601
+ float: ['right', 'left', 'none']
661
602
  }],
662
603
  /**
663
604
  * Clear
@@ -683,7 +624,7 @@ function getDefaultConfig() {
683
624
  * @see https://tailwindcss.com/docs/object-position
684
625
  */
685
626
  'object-position': [{
686
- object: [].concat(getPositions(), [isArbitraryValue])
627
+ object: [...getPositions(), isArbitraryValue]
687
628
  }],
688
629
  /**
689
630
  * Overflow
@@ -805,7 +746,7 @@ function getDefaultConfig() {
805
746
  * @see https://tailwindcss.com/docs/z-index
806
747
  */
807
748
  z: [{
808
- z: ['auto', isInteger]
749
+ z: ['auto', isInteger, isArbitraryValue]
809
750
  }],
810
751
  // Flexbox and Grid
811
752
  /**
@@ -855,7 +796,7 @@ function getDefaultConfig() {
855
796
  * @see https://tailwindcss.com/docs/order
856
797
  */
857
798
  order: [{
858
- order: ['first', 'last', 'none', isInteger]
799
+ order: ['first', 'last', 'none', isInteger, isArbitraryValue]
859
800
  }],
860
801
  /**
861
802
  * Grid Template Columns
@@ -870,7 +811,7 @@ function getDefaultConfig() {
870
811
  */
871
812
  'col-start-end': [{
872
813
  col: ['auto', {
873
- span: ['full', isInteger]
814
+ span: ['full', isInteger, isArbitraryValue]
874
815
  }, isArbitraryValue]
875
816
  }],
876
817
  /**
@@ -900,7 +841,7 @@ function getDefaultConfig() {
900
841
  */
901
842
  'row-start-end': [{
902
843
  row: ['auto', {
903
- span: [isInteger]
844
+ span: [isInteger, isArbitraryValue]
904
845
  }, isArbitraryValue]
905
846
  }],
906
847
  /**
@@ -964,7 +905,7 @@ function getDefaultConfig() {
964
905
  * @see https://tailwindcss.com/docs/justify-content
965
906
  */
966
907
  'justify-content': [{
967
- justify: ['normal'].concat(getAlign())
908
+ justify: ['normal', ...getAlign()]
968
909
  }],
969
910
  /**
970
911
  * Justify Items
@@ -985,7 +926,7 @@ function getDefaultConfig() {
985
926
  * @see https://tailwindcss.com/docs/align-content
986
927
  */
987
928
  'align-content': [{
988
- content: ['normal'].concat(getAlign(), ['baseline'])
929
+ content: ['normal', ...getAlign(), 'baseline']
989
930
  }],
990
931
  /**
991
932
  * Align Items
@@ -1006,7 +947,7 @@ function getDefaultConfig() {
1006
947
  * @see https://tailwindcss.com/docs/place-content
1007
948
  */
1008
949
  'place-content': [{
1009
- 'place-content': [].concat(getAlign(), ['baseline'])
950
+ 'place-content': [...getAlign(), 'baseline']
1010
951
  }],
1011
952
  /**
1012
953
  * Place Items
@@ -1209,7 +1150,7 @@ function getDefaultConfig() {
1209
1150
  * @see https://tailwindcss.com/docs/min-height
1210
1151
  */
1211
1152
  'min-h': [{
1212
- 'min-h': ['min', 'max', 'fit', isArbitraryValue, isLength]
1153
+ 'min-h': ['min', 'max', 'fit', isLength, isArbitraryValue]
1213
1154
  }],
1214
1155
  /**
1215
1156
  * Max-Height
@@ -1299,7 +1240,7 @@ function getDefaultConfig() {
1299
1240
  * @see https://tailwindcss.com/docs/line-height
1300
1241
  */
1301
1242
  leading: [{
1302
- leading: ['none', 'tight', 'snug', 'normal', 'relaxed', 'loose', isArbitraryValue, isLength]
1243
+ leading: ['none', 'tight', 'snug', 'normal', 'relaxed', 'loose', isLength, isArbitraryValue]
1303
1244
  }],
1304
1245
  /**
1305
1246
  * List Style Image
@@ -1368,21 +1309,21 @@ function getDefaultConfig() {
1368
1309
  * @see https://tailwindcss.com/docs/text-decoration-style
1369
1310
  */
1370
1311
  'text-decoration-style': [{
1371
- decoration: [].concat(getLineStyles(), ['wavy'])
1312
+ decoration: [...getLineStyles(), 'wavy']
1372
1313
  }],
1373
1314
  /**
1374
1315
  * Text Decoration Thickness
1375
1316
  * @see https://tailwindcss.com/docs/text-decoration-thickness
1376
1317
  */
1377
1318
  'text-decoration-thickness': [{
1378
- decoration: ['auto', 'from-font', isLength]
1319
+ decoration: ['auto', 'from-font', isLength, isArbitraryLength]
1379
1320
  }],
1380
1321
  /**
1381
1322
  * Text Underline Offset
1382
1323
  * @see https://tailwindcss.com/docs/text-underline-offset
1383
1324
  */
1384
1325
  'underline-offset': [{
1385
- 'underline-offset': ['auto', isArbitraryValue, isLength]
1326
+ 'underline-offset': ['auto', isLength, isArbitraryValue]
1386
1327
  }],
1387
1328
  /**
1388
1329
  * Text Decoration Color
@@ -1426,8 +1367,8 @@ function getDefaultConfig() {
1426
1367
  * Word Break
1427
1368
  * @see https://tailwindcss.com/docs/word-break
1428
1369
  */
1429
- "break": [{
1430
- "break": ['normal', 'words', 'all', 'keep']
1370
+ break: [{
1371
+ break: ['normal', 'words', 'all', 'keep']
1431
1372
  }],
1432
1373
  /**
1433
1374
  * Hyphens
@@ -1478,7 +1419,7 @@ function getDefaultConfig() {
1478
1419
  * @see https://tailwindcss.com/docs/background-position
1479
1420
  */
1480
1421
  'bg-position': [{
1481
- bg: [].concat(getPositions(), [isArbitraryPosition])
1422
+ bg: [...getPositions(), isArbitraryPosition]
1482
1423
  }],
1483
1424
  /**
1484
1425
  * Background Repeat
@@ -1503,7 +1444,7 @@ function getDefaultConfig() {
1503
1444
  'bg-image': [{
1504
1445
  bg: ['none', {
1505
1446
  'gradient-to': ['t', 'tr', 'r', 'br', 'b', 'bl', 'l', 'tl']
1506
- }, isArbitraryUrl]
1447
+ }, isArbitraryImage]
1507
1448
  }],
1508
1449
  /**
1509
1450
  * Background Color
@@ -1735,7 +1676,7 @@ function getDefaultConfig() {
1735
1676
  * @see https://tailwindcss.com/docs/border-style
1736
1677
  */
1737
1678
  'border-style': [{
1738
- border: [].concat(getLineStyles(), ['hidden'])
1679
+ border: [...getLineStyles(), 'hidden']
1739
1680
  }],
1740
1681
  /**
1741
1682
  * Divide Width X
@@ -1836,21 +1777,21 @@ function getDefaultConfig() {
1836
1777
  * @see https://tailwindcss.com/docs/outline-style
1837
1778
  */
1838
1779
  'outline-style': [{
1839
- outline: [''].concat(getLineStyles())
1780
+ outline: ['', ...getLineStyles()]
1840
1781
  }],
1841
1782
  /**
1842
1783
  * Outline Offset
1843
1784
  * @see https://tailwindcss.com/docs/outline-offset
1844
1785
  */
1845
1786
  'outline-offset': [{
1846
- 'outline-offset': [isArbitraryValue, isLength]
1787
+ 'outline-offset': [isLength, isArbitraryValue]
1847
1788
  }],
1848
1789
  /**
1849
1790
  * Outline Width
1850
1791
  * @see https://tailwindcss.com/docs/outline-width
1851
1792
  */
1852
1793
  'outline-w': [{
1853
- outline: [isLength]
1794
+ outline: [isLength, isArbitraryLength]
1854
1795
  }],
1855
1796
  /**
1856
1797
  * Outline Color
@@ -1864,7 +1805,7 @@ function getDefaultConfig() {
1864
1805
  * @see https://tailwindcss.com/docs/ring-width
1865
1806
  */
1866
1807
  'ring-w': [{
1867
- ring: getLengthWithEmpty()
1808
+ ring: getLengthWithEmptyAndArbitrary()
1868
1809
  }],
1869
1810
  /**
1870
1811
  * Ring Width Inset
@@ -1890,7 +1831,7 @@ function getDefaultConfig() {
1890
1831
  * @see https://tailwindcss.com/docs/ring-offset-width
1891
1832
  */
1892
1833
  'ring-offset-w': [{
1893
- 'ring-offset': [isLength]
1834
+ 'ring-offset': [isLength, isArbitraryLength]
1894
1835
  }],
1895
1836
  /**
1896
1837
  * Ring Offset Color
@@ -2435,10 +2376,27 @@ function getDefaultConfig() {
2435
2376
  * @see https://tailwindcss.com/docs/touch-action
2436
2377
  */
2437
2378
  touch: [{
2438
- touch: ['auto', 'none', 'pinch-zoom', 'manipulation', {
2439
- pan: ['x', 'left', 'right', 'y', 'up', 'down']
2440
- }]
2379
+ touch: ['auto', 'none', 'manipulation']
2380
+ }],
2381
+ /**
2382
+ * Touch Action X
2383
+ * @see https://tailwindcss.com/docs/touch-action
2384
+ */
2385
+ 'touch-x': [{
2386
+ 'touch-pan': ['x', 'left', 'right']
2441
2387
  }],
2388
+ /**
2389
+ * Touch Action Y
2390
+ * @see https://tailwindcss.com/docs/touch-action
2391
+ */
2392
+ 'touch-y': [{
2393
+ 'touch-pan': ['y', 'up', 'down']
2394
+ }],
2395
+ /**
2396
+ * Touch Action Pinch Zoom
2397
+ * @see https://tailwindcss.com/docs/touch-action
2398
+ */
2399
+ 'touch-pz': ['touch-pinch-zoom'],
2442
2400
  /**
2443
2401
  * User Select
2444
2402
  * @see https://tailwindcss.com/docs/user-select
@@ -2466,7 +2424,7 @@ function getDefaultConfig() {
2466
2424
  * @see https://tailwindcss.com/docs/stroke-width
2467
2425
  */
2468
2426
  'stroke-w': [{
2469
- stroke: [isLength, isArbitraryNumber]
2427
+ stroke: [isLength, isArbitraryLength, isArbitraryNumber]
2470
2428
  }],
2471
2429
  /**
2472
2430
  * Stroke
@@ -2522,7 +2480,11 @@ function getDefaultConfig() {
2522
2480
  'scroll-my': ['scroll-mt', 'scroll-mb'],
2523
2481
  'scroll-p': ['scroll-px', 'scroll-py', 'scroll-ps', 'scroll-pe', 'scroll-pt', 'scroll-pr', 'scroll-pb', 'scroll-pl'],
2524
2482
  'scroll-px': ['scroll-pr', 'scroll-pl'],
2525
- 'scroll-py': ['scroll-pt', 'scroll-pb']
2483
+ 'scroll-py': ['scroll-pt', 'scroll-pb'],
2484
+ touch: ['touch-x', 'touch-y', 'touch-pz'],
2485
+ 'touch-x': ['touch'],
2486
+ 'touch-y': ['touch'],
2487
+ 'touch-pz': ['touch']
2526
2488
  },
2527
2489
  conflictingClassGroupModifiers: {
2528
2490
  'font-size': ['leading']
@@ -2530,332 +2492,75 @@ function getDefaultConfig() {
2530
2492
  };
2531
2493
  }
2532
2494
 
2533
- var twMerge = /*#__PURE__*/createTailwindMerge(getDefaultConfig);
2534
-
2535
- function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
2536
-
2537
- const cn = (...inputs) => {
2538
- return twMerge(clsx(inputs));
2539
- };
2540
-
2541
- var __defProp = Object.defineProperty;
2542
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2543
- var __decorateClass = (decorators, target, key, kind) => {
2544
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
2545
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
2546
- if (decorator = decorators[i])
2547
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2548
- if (kind && result)
2549
- __defProp(target, key, result);
2550
- return result;
2551
- };
2552
- let LuksoCard = class extends TailwindStyledElement(style) {
2553
- constructor() {
2554
- super(...arguments);
2555
- this.variant = "basic";
2556
- this.backgroundUrl = "";
2557
- this.profileUrl = "";
2558
- this.profileAddress = "";
2559
- this.width = void 0;
2560
- this.height = void 0;
2561
- this.customClass = "";
2562
- this.headerClass = "";
2563
- this.size = "medium";
2564
- this.isHoverable = false;
2565
- this.mediumStyles = `rounded-24 shadow-neutral-drop-shadow-2xl`;
2566
- this.smallStyles = `rounded-12 shadow-neutral-drop-shadow`;
2567
- this.smallHoverStyles = `hover:shadow-neutral-drop-shadow-1xl cursor-pointer transition`;
2568
- }
2569
- backgroundImageOrGradient() {
2570
- const opacity = "80";
2571
- const gradientStart = `#${this.profileAddress.slice(2, 8)}${opacity}`;
2572
- const gradientEnd = `#${this.profileAddress.slice(36, 42)}${opacity}`;
2573
- if (this.backgroundUrl) {
2574
- return `url(${this.backgroundUrl})`;
2575
- }
2576
- return `linear-gradient(90deg, ${gradientStart}, ${gradientEnd})`;
2577
- }
2578
- basicTemplate() {
2579
- return x`
2580
- <div
2581
- data-testid="card"
2582
- style=${customStyleMap({
2583
- [`min-height: ${this.height}px`]: !!this.height,
2584
- [`width: ${this.width}px`]: !!this.width
2585
- })}
2586
- class=${cn("bg-neutral-100", {
2587
- [this.mediumStyles]: !this.customClass && this.size === "medium",
2588
- [this.smallStyles]: !this.customClass && this.size === "small",
2589
- [this.smallHoverStyles]: this.isHoverable && this.size === "small",
2590
- [this.customClass]: !!this.customClass,
2591
- "w-full": !this.width
2592
- })}
2593
- >
2594
- <slot name="content"></slot>
2595
- </div>
2596
- `;
2597
- }
2598
- withHeaderTemplate() {
2599
- return x`
2600
- <div
2601
- data-testid="card"
2602
- style=${o({
2603
- minHeight: `${this.height}px`,
2604
- width: `${this.width}px`
2605
- })}
2606
- class=${cn("bg-neutral-100 grid grid-rows-[auto,1fr] overflow-hidden", {
2607
- [this.mediumStyles]: !this.customClass && this.size === "medium",
2608
- [this.smallStyles]: !this.customClass && this.size === "small",
2609
- [this.smallHoverStyles]: this.isHoverable && this.size === "small",
2610
- [this.customClass]: !!this.customClass,
2611
- "w-full": !this.width
2612
- })}
2613
- >
2614
- <div class=${this.headerClass}>
2615
- <slot name="header"></slot>
2616
- </div>
2617
- <div class="bg-neutral-100 shadow-neutral-above-shadow-1xl rounded-24">
2618
- <slot name="content"></slot>
2619
- </div>
2620
- </div>
2621
- `;
2622
- }
2623
- profileTemplate() {
2624
- return x`
2625
- <div
2626
- data-testid="card"
2627
- style=${customStyleMap({
2628
- [`min-height: ${this.height}px`]: !!this.height,
2629
- [`width: ${this.width}px`]: !!this.width
2630
- })}
2631
- class=${cn("bg-neutral-100 grid", {
2632
- [this.mediumStyles]: !this.customClass && this.size === "medium",
2633
- [this.smallStyles]: !this.customClass && this.size === "small",
2634
- [this.smallHoverStyles]: this.isHoverable && this.size === "small",
2635
- [this.customClass]: !!this.customClass,
2636
- "w-full": !this.width
2637
- })}
2638
- >
2639
- <div
2640
- style=${o({
2641
- backgroundImage: this.backgroundImageOrGradient()
2642
- })}
2643
- class=${cn(
2644
- "row-end-1 col-span-1 col-end-1 row-span-1 h-full w-full bg-center bg-cover rounded-24 relative",
2645
- this.headerClass
2646
- )}
2647
- >
2648
- ${this.backgroundUrl && x` <div
2649
- class="h-full full rounded-[24px_24px_0_0] bg-neutral-20/10 absolute"
2650
- ></div>`}
2651
- <div>
2652
- <slot name="header"></slot>
2653
- </div>
2654
- </div>
2655
- <div
2656
- class="grid grid-rows-[1fr,auto] row-end-1 col-span-1 col-end-1 row-span-1"
2657
- >
2658
- <div></div>
2659
- <div class="bg-neutral-100 rounded-24 relative">
2660
- <lukso-profile
2661
- profile-url=${this.profileUrl}
2662
- size="large"
2663
- profile-address=${this.profileAddress}
2664
- has-identicon
2665
- class="absolute -top-[40px] left-[calc(50%_-_40px)] z-10"
2666
- ></lukso-profile>
2667
- <div
2668
- class="overflow-hidden w-[153px] h-[70px] -top-[70px] relative mx-auto flex items-end justify-center -mb-3"
2669
- >
2670
- <div
2671
- class="bg-neutral-100 rounded-[103px_103px_0_0] w-[96px] h-[48px]"
2672
- ></div>
2673
- </div>
2674
- <slot name="content"></slot>
2675
- </div>
2676
- </div>
2677
- </div>
2678
- `;
2495
+ /**
2496
+ * @param baseConfig Config where other config will be merged into. This object will be mutated.
2497
+ * @param configExtension Partial config to merge into the `baseConfig`.
2498
+ */
2499
+ function mergeConfigs(baseConfig, {
2500
+ cacheSize,
2501
+ prefix,
2502
+ separator,
2503
+ extend = {},
2504
+ override = {}
2505
+ }) {
2506
+ overrideProperty(baseConfig, 'cacheSize', cacheSize);
2507
+ overrideProperty(baseConfig, 'prefix', prefix);
2508
+ overrideProperty(baseConfig, 'separator', separator);
2509
+ for (const configKey in override) {
2510
+ overrideConfigProperties(baseConfig[configKey], override[configKey]);
2679
2511
  }
2680
- profile2Template() {
2681
- return x`
2682
- <div
2683
- data-testid="card"
2684
- style=${customStyleMap({
2685
- [`min-height: ${this.height}px`]: !!this.height,
2686
- [`width: ${this.width}px`]: !!this.width
2687
- })}
2688
- class=${cn("bg-neutral-100 grid grid-rows-[auto,1fr]", {
2689
- [this.mediumStyles]: !this.customClass && this.size === "medium",
2690
- [this.smallStyles]: !this.customClass && this.size === "small",
2691
- [this.smallHoverStyles]: this.isHoverable && this.size === "small",
2692
- [this.customClass]: !!this.customClass,
2693
- ["w-full"]: !this.width
2694
- })}
2695
- >
2696
- <div
2697
- style=${o({
2698
- backgroundImage: this.backgroundImageOrGradient()
2699
- })}
2700
- class=${cn(
2701
- "min-h-[129px] -mb-6 bg-center bg-cover rounded-[24px_24px_0_0] relative bg-neutral-100",
2702
- this.headerClass
2703
- )}
2704
- >
2705
- ${this.backgroundUrl && x`<div
2706
- class="min-h-full min-w-full rounded-[24px_24px_0_0] bg-neutral-10/10 absolute"
2707
- ></div>`}
2708
- <div>
2709
- <slot name="header"></slot>
2710
- </div>
2711
- </div>
2712
- <div class="grid grid-rows-[max-content,auto]">
2713
- <div class="bg-neutral-100 relative">
2714
- <lukso-profile
2715
- profile-url=${this.profileUrl}
2716
- size="large"
2717
- profile-address=${this.profileAddress}
2718
- has-identicon
2719
- class="absolute -top-[40px] left-[calc(50%_-_40px)] z-10"
2720
- ></lukso-profile>
2721
- <div
2722
- class="overflow-hidden w-[153px] h-[70px] -top-[70px] relative mx-auto flex items-end justify-center -mb-2"
2723
- >
2724
- <div
2725
- class="bg-neutral-100 rounded-[103px_103px_0_0] w-[96px] h-[48px]"
2726
- ></div>
2727
- </div>
2728
- <slot name="content"></slot>
2729
- </div>
2730
- <div
2731
- class="bg-neutral-97 rounded-b-24 shadow-neutral-inner-shadow-top"
2732
- >
2733
- <slot name="bottom"></slot>
2734
- </div>
2735
- </div>
2736
- </div>
2737
- `;
2512
+ for (const key in extend) {
2513
+ mergeConfigProperties(baseConfig[key], extend[key]);
2738
2514
  }
2739
- heroTemplate() {
2740
- return x`
2741
- <div
2742
- data-testid="card"
2743
- style=${customStyleMap({
2744
- [`min-height: ${this.height}px`]: !!this.height,
2745
- [`width: ${this.width}px`]: !!this.width
2746
- })}
2747
- class=${cn("h-[240px] flex bg-neutral-100", {
2748
- [this.mediumStyles]: !this.customClass && this.size === "medium",
2749
- [this.smallStyles]: !this.customClass && this.size === "small",
2750
- [this.smallHoverStyles]: this.isHoverable && this.size === "small",
2751
- [this.customClass]: !!this.customClass,
2752
- ["w-full"]: !this.width
2753
- })}
2754
- >
2755
- <div
2756
- style=${o({
2757
- backgroundImage: `url(${this.backgroundUrl})`
2758
- })}
2759
- class="h-full w-full -mb-6 bg-center bg-cover rounded-24 relative"
2760
- >
2761
- ${this.backgroundUrl && x`<div
2762
- class="h-full w-full rounded-24 bg-neutral-20/10 absolute"
2763
- ></div>`}
2764
- <div
2765
- class="h-full w-full flex flex-col items-center justify-center absolute"
2766
- >
2767
- <slot name="content"></slot>
2768
- </div>
2769
- </div>
2770
- </div>
2771
- `;
2515
+ return baseConfig;
2516
+ }
2517
+ function overrideProperty(baseObject, overrideKey, overrideValue) {
2518
+ if (overrideValue !== undefined) {
2519
+ baseObject[overrideKey] = overrideValue;
2772
2520
  }
2773
- dappTemplate() {
2774
- return x`
2775
- <div
2776
- data-testid="card"
2777
- style=${customStyleMap({
2778
- [`min-height: ${this.height}px`]: !!this.height,
2779
- [`width: ${this.width}px`]: !!this.width
2780
- })}
2781
- class=${cn("bg-neutral-100 grid grid-rows-[auto,1fr]", {
2782
- [this.mediumStyles]: !this.customClass && this.size === "medium",
2783
- [this.smallStyles]: !this.customClass && this.size === "small",
2784
- [this.smallHoverStyles]: this.isHoverable && this.size === "small",
2785
- [this.customClass]: !!this.customClass,
2786
- ["w-full"]: !this.width
2787
- })}
2788
- >
2789
- <div
2790
- style=${o({
2791
- backgroundImage: this.backgroundImageOrGradient()
2792
- })}
2793
- class=${cn(
2794
- "min-h-[240px] bg-center bg-cover rounded-[24px_24px_0_0] relative",
2795
- this.headerClass
2796
- )}
2797
- >
2798
- <div>
2799
- <slot name="header"></slot>
2800
- </div>
2801
- </div>
2802
- <div
2803
- class="bg-neutral-100 shadow-neutral-above-shadow-1xl rounded-[0_0_24px_24px] relative"
2804
- >
2805
- <slot name="content"></slot>
2806
- </div>
2807
- </div>
2808
- `;
2521
+ }
2522
+ function overrideConfigProperties(baseObject, overrideObject) {
2523
+ if (overrideObject) {
2524
+ for (const key in overrideObject) {
2525
+ overrideProperty(baseObject, key, overrideObject[key]);
2526
+ }
2809
2527
  }
2810
- render() {
2811
- switch (this.variant) {
2812
- case "with-header":
2813
- return this.withHeaderTemplate();
2814
- case "profile":
2815
- return this.profileTemplate();
2816
- case "profile-2":
2817
- return this.profile2Template();
2818
- case "hero":
2819
- return this.heroTemplate();
2820
- case "dapp":
2821
- return this.dappTemplate();
2822
- default:
2823
- return this.basicTemplate();
2528
+ }
2529
+ function mergeConfigProperties(baseObject, mergeObject) {
2530
+ if (mergeObject) {
2531
+ for (const key in mergeObject) {
2532
+ const mergeValue = mergeObject[key];
2533
+ if (mergeValue !== undefined) {
2534
+ baseObject[key] = (baseObject[key] || []).concat(mergeValue);
2535
+ }
2824
2536
  }
2825
2537
  }
2538
+ }
2539
+ function extendTailwindMerge(configExtension, ...createConfig) {
2540
+ return typeof configExtension === 'function' ? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig) : createTailwindMerge(() => mergeConfigs(getDefaultConfig(), configExtension), ...createConfig);
2541
+ }
2542
+
2543
+ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
2544
+
2545
+ const customTwMerge = extendTailwindMerge({
2546
+ classGroups: {
2547
+ shadow: Object.keys(boxShadows).map((s) => `shadow-${s}`),
2548
+ "font-size": Object.keys(fontSizes).map((s) => `text-${s}`),
2549
+ "font-weight": Object.keys(fontWeights).map((s) => `font-${s}`),
2550
+ "line-height": Object.keys(lineHeights).map((s) => `leading-${s}`),
2551
+ scale: Object.keys(scales).map((s) => `scale-${s}`),
2552
+ height: Object.keys(heights).map((s) => `h-${s}`),
2553
+ borderRadius: Object.keys(borderRadius).map((s) => `rounded-${s}`),
2554
+ colors: Object.entries(colorPalette).reduce((acc, currentVal) => {
2555
+ const colors = Object.keys(currentVal[1]).map(
2556
+ (c) => `text-${currentVal[0]}-${c}`
2557
+ );
2558
+ return [...acc, ...colors];
2559
+ }, [])
2560
+ }
2561
+ });
2562
+ const cn = (...inputs) => {
2563
+ return customTwMerge(clsx(inputs));
2826
2564
  };
2827
- __decorateClass([
2828
- n({ type: String })
2829
- ], LuksoCard.prototype, "variant", 2);
2830
- __decorateClass([
2831
- n({ type: String, attribute: "background-url" })
2832
- ], LuksoCard.prototype, "backgroundUrl", 2);
2833
- __decorateClass([
2834
- n({ type: String, attribute: "profile-url" })
2835
- ], LuksoCard.prototype, "profileUrl", 2);
2836
- __decorateClass([
2837
- n({ type: String, attribute: "profile-address" })
2838
- ], LuksoCard.prototype, "profileAddress", 2);
2839
- __decorateClass([
2840
- n({ type: Number })
2841
- ], LuksoCard.prototype, "width", 2);
2842
- __decorateClass([
2843
- n({ type: Number })
2844
- ], LuksoCard.prototype, "height", 2);
2845
- __decorateClass([
2846
- n({ type: String, attribute: "custom-class" })
2847
- ], LuksoCard.prototype, "customClass", 2);
2848
- __decorateClass([
2849
- n({ type: String, attribute: "header-class" })
2850
- ], LuksoCard.prototype, "headerClass", 2);
2851
- __decorateClass([
2852
- n({ type: String })
2853
- ], LuksoCard.prototype, "size", 2);
2854
- __decorateClass([
2855
- n({ type: Boolean, attribute: "is-hoverable" })
2856
- ], LuksoCard.prototype, "isHoverable", 2);
2857
- LuksoCard = __decorateClass([
2858
- e("lukso-card")
2859
- ], LuksoCard);
2860
2565
 
2861
- export { LuksoCard as L, cn as c };
2566
+ export { cn as c };