@bccampus/ui-components 0.5.0 → 0.5.2

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 (31) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/.yarn/releases/yarn-4.10.3.cjs +942 -0
  3. package/.yarnrc.yml +3 -0
  4. package/dist/_chunks/createLucideIcon.js +0 -24
  5. package/dist/_chunks/index.js +16 -38
  6. package/dist/_chunks/index3.js +26 -520
  7. package/dist/_chunks/index4.js +615 -0
  8. package/dist/_chunks/utils.js +199 -143
  9. package/dist/components/index.js +2 -2
  10. package/dist/components/ui/banner.js +0 -6
  11. package/dist/components/ui/composite/CompositeData.js +1 -1
  12. package/dist/components/ui/composite/CompositeDataItem.js +109 -3
  13. package/dist/components/ui/composite/FocusProvider/AbstractFocusProvider.js +2 -1
  14. package/dist/components/ui/composite/SelectionProvider/AbstractSelectionProvider.js +2 -1
  15. package/dist/components/ui/composite/SelectionProvider/MultipleSelectionProvider.js +1 -1
  16. package/dist/components/ui/composite/SelectionProvider/SingleSelectionProvider.js +1 -1
  17. package/dist/components/ui/composite/composite-component-item.js +2 -24
  18. package/dist/components/ui/composite/index.d.ts +1 -0
  19. package/dist/components/ui/composite/index.js +2 -2
  20. package/dist/components/ui/composite/listbox.js +1 -0
  21. package/dist/components/ui/horizontal-list.js +0 -12
  22. package/dist/components/ui/navigation-menu.js +86 -10
  23. package/dist/components/ui/popover.js +85 -3
  24. package/dist/components/ui/search-input.js +0 -6
  25. package/package.json +75 -67
  26. package/src/App.tsx +44 -14
  27. package/src/components/ui/composite/index.ts +2 -1
  28. package/src/components/ui/page-header.tsx +6 -9
  29. package/src/main.tsx +12 -12
  30. package/vite.config.ts +6 -2
  31. package/dist/_chunks/CompositeDataItem.js +0 -204
@@ -11,7 +11,28 @@ function clsx() {
11
11
  for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
12
12
  return n;
13
13
  }
14
+ const concatArrays = (array1, array2) => {
15
+ const combinedArray = new Array(array1.length + array2.length);
16
+ for (let i = 0; i < array1.length; i++) {
17
+ combinedArray[i] = array1[i];
18
+ }
19
+ for (let i = 0; i < array2.length; i++) {
20
+ combinedArray[array1.length + i] = array2[i];
21
+ }
22
+ return combinedArray;
23
+ };
24
+ const createClassValidatorObject = (classGroupId, validator) => ({
25
+ classGroupId,
26
+ validator
27
+ });
28
+ const createClassPartObject = (nextPart = /* @__PURE__ */ new Map(), validators = null, classGroupId) => ({
29
+ nextPart,
30
+ validators,
31
+ classGroupId
32
+ });
14
33
  const CLASS_PART_SEPARATOR = "-";
34
+ const EMPTY_CONFLICTS = [];
35
+ const ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
15
36
  const createClassGroupUtils = (config) => {
16
37
  const classMap = createClassMap(config);
17
38
  const {
@@ -19,103 +40,134 @@ const createClassGroupUtils = (config) => {
19
40
  conflictingClassGroupModifiers
20
41
  } = config;
21
42
  const getClassGroupId = (className) => {
22
- const classParts = className.split(CLASS_PART_SEPARATOR);
23
- if (classParts[0] === "" && classParts.length !== 1) {
24
- classParts.shift();
43
+ if (className.startsWith("[") && className.endsWith("]")) {
44
+ return getGroupIdForArbitraryProperty(className);
25
45
  }
26
- return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
46
+ const classParts = className.split(CLASS_PART_SEPARATOR);
47
+ const startIndex = classParts[0] === "" && classParts.length > 1 ? 1 : 0;
48
+ return getGroupRecursive(classParts, startIndex, classMap);
27
49
  };
28
50
  const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
29
- const conflicts = conflictingClassGroups[classGroupId] || [];
30
- if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
31
- return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
51
+ if (hasPostfixModifier) {
52
+ const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
53
+ const baseConflicts = conflictingClassGroups[classGroupId];
54
+ if (modifierConflicts) {
55
+ if (baseConflicts) {
56
+ return concatArrays(baseConflicts, modifierConflicts);
57
+ }
58
+ return modifierConflicts;
59
+ }
60
+ return baseConflicts || EMPTY_CONFLICTS;
32
61
  }
33
- return conflicts;
62
+ return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
34
63
  };
35
64
  return {
36
65
  getClassGroupId,
37
66
  getConflictingClassGroupIds
38
67
  };
39
68
  };
40
- const getGroupRecursive = (classParts, classPartObject) => {
41
- if (classParts.length === 0) {
69
+ const getGroupRecursive = (classParts, startIndex, classPartObject) => {
70
+ const classPathsLength = classParts.length - startIndex;
71
+ if (classPathsLength === 0) {
42
72
  return classPartObject.classGroupId;
43
73
  }
44
- const currentClassPart = classParts[0];
74
+ const currentClassPart = classParts[startIndex];
45
75
  const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
46
- const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : void 0;
47
- if (classGroupFromNextClassPart) {
48
- return classGroupFromNextClassPart;
76
+ if (nextClassPartObject) {
77
+ const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
78
+ if (result) return result;
49
79
  }
50
- if (classPartObject.validators.length === 0) {
80
+ const validators = classPartObject.validators;
81
+ if (validators === null) {
51
82
  return void 0;
52
83
  }
53
- const classRest = classParts.join(CLASS_PART_SEPARATOR);
54
- return classPartObject.validators.find(({
55
- validator
56
- }) => validator(classRest))?.classGroupId;
57
- };
58
- const arbitraryPropertyRegex = /^\[(.+)\]$/;
59
- const getGroupIdForArbitraryProperty = (className) => {
60
- if (arbitraryPropertyRegex.test(className)) {
61
- const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
62
- const property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(":"));
63
- if (property) {
64
- return "arbitrary.." + property;
84
+ const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
85
+ const validatorsLength = validators.length;
86
+ for (let i = 0; i < validatorsLength; i++) {
87
+ const validatorObj = validators[i];
88
+ if (validatorObj.validator(classRest)) {
89
+ return validatorObj.classGroupId;
65
90
  }
66
91
  }
92
+ return void 0;
67
93
  };
94
+ const getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
95
+ const content = className.slice(1, -1);
96
+ const colonIndex = content.indexOf(":");
97
+ const property = content.slice(0, colonIndex);
98
+ return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
99
+ })();
68
100
  const createClassMap = (config) => {
69
101
  const {
70
102
  theme,
71
103
  classGroups
72
104
  } = config;
73
- const classMap = {
74
- nextPart: /* @__PURE__ */ new Map(),
75
- validators: []
76
- };
105
+ return processClassGroups(classGroups, theme);
106
+ };
107
+ const processClassGroups = (classGroups, theme) => {
108
+ const classMap = createClassPartObject();
77
109
  for (const classGroupId in classGroups) {
78
- processClassesRecursively(classGroups[classGroupId], classMap, classGroupId, theme);
110
+ const group = classGroups[classGroupId];
111
+ processClassesRecursively(group, classMap, classGroupId, theme);
79
112
  }
80
113
  return classMap;
81
114
  };
82
115
  const processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
83
- classGroup.forEach((classDefinition) => {
84
- if (typeof classDefinition === "string") {
85
- const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
86
- classPartObjectToEdit.classGroupId = classGroupId;
87
- return;
88
- }
89
- if (typeof classDefinition === "function") {
90
- if (isThemeGetter(classDefinition)) {
91
- processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
92
- return;
93
- }
94
- classPartObject.validators.push({
95
- validator: classDefinition,
96
- classGroupId
97
- });
98
- return;
99
- }
100
- Object.entries(classDefinition).forEach(([key, classGroup2]) => {
101
- processClassesRecursively(classGroup2, getPart(classPartObject, key), classGroupId, theme);
102
- });
103
- });
116
+ const len = classGroup.length;
117
+ for (let i = 0; i < len; i++) {
118
+ const classDefinition = classGroup[i];
119
+ processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
120
+ }
121
+ };
122
+ const processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
123
+ if (typeof classDefinition === "string") {
124
+ processStringDefinition(classDefinition, classPartObject, classGroupId);
125
+ return;
126
+ }
127
+ if (typeof classDefinition === "function") {
128
+ processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
129
+ return;
130
+ }
131
+ processObjectDefinition(classDefinition, classPartObject, classGroupId, theme);
132
+ };
133
+ const processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
134
+ const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
135
+ classPartObjectToEdit.classGroupId = classGroupId;
136
+ };
137
+ const processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
138
+ if (isThemeGetter(classDefinition)) {
139
+ processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
140
+ return;
141
+ }
142
+ if (classPartObject.validators === null) {
143
+ classPartObject.validators = [];
144
+ }
145
+ classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
146
+ };
147
+ const processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
148
+ const entries = Object.entries(classDefinition);
149
+ const len = entries.length;
150
+ for (let i = 0; i < len; i++) {
151
+ const [key, value] = entries[i];
152
+ processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
153
+ }
104
154
  };
105
155
  const getPart = (classPartObject, path) => {
106
- let currentClassPartObject = classPartObject;
107
- path.split(CLASS_PART_SEPARATOR).forEach((pathPart) => {
108
- if (!currentClassPartObject.nextPart.has(pathPart)) {
109
- currentClassPartObject.nextPart.set(pathPart, {
110
- nextPart: /* @__PURE__ */ new Map(),
111
- validators: []
112
- });
156
+ let current = classPartObject;
157
+ const parts = path.split(CLASS_PART_SEPARATOR);
158
+ const len = parts.length;
159
+ for (let i = 0; i < len; i++) {
160
+ const part = parts[i];
161
+ let next = current.nextPart.get(part);
162
+ if (!next) {
163
+ next = createClassPartObject();
164
+ current.nextPart.set(part, next);
113
165
  }
114
- currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
115
- });
116
- return currentClassPartObject;
166
+ current = next;
167
+ }
168
+ return current;
117
169
  };
118
- const isThemeGetter = (func) => func.isThemeGetter;
170
+ const isThemeGetter = (func) => "isThemeGetter" in func && func.isThemeGetter === true;
119
171
  const createLruCache = (maxCacheSize) => {
120
172
  if (maxCacheSize < 1) {
121
173
  return {
@@ -125,31 +177,31 @@ const createLruCache = (maxCacheSize) => {
125
177
  };
126
178
  }
127
179
  let cacheSize = 0;
128
- let cache = /* @__PURE__ */ new Map();
129
- let previousCache = /* @__PURE__ */ new Map();
180
+ let cache = /* @__PURE__ */ Object.create(null);
181
+ let previousCache = /* @__PURE__ */ Object.create(null);
130
182
  const update = (key, value) => {
131
- cache.set(key, value);
183
+ cache[key] = value;
132
184
  cacheSize++;
133
185
  if (cacheSize > maxCacheSize) {
134
186
  cacheSize = 0;
135
187
  previousCache = cache;
136
- cache = /* @__PURE__ */ new Map();
188
+ cache = /* @__PURE__ */ Object.create(null);
137
189
  }
138
190
  };
139
191
  return {
140
192
  get(key) {
141
- let value = cache.get(key);
193
+ let value = cache[key];
142
194
  if (value !== void 0) {
143
195
  return value;
144
196
  }
145
- if ((value = previousCache.get(key)) !== void 0) {
197
+ if ((value = previousCache[key]) !== void 0) {
146
198
  update(key, value);
147
199
  return value;
148
200
  }
149
201
  },
150
202
  set(key, value) {
151
- if (cache.has(key)) {
152
- cache.set(key, value);
203
+ if (key in cache) {
204
+ cache[key] = value;
153
205
  } else {
154
206
  update(key, value);
155
207
  }
@@ -158,7 +210,14 @@ const createLruCache = (maxCacheSize) => {
158
210
  };
159
211
  const IMPORTANT_MODIFIER = "!";
160
212
  const MODIFIER_SEPARATOR = ":";
161
- const MODIFIER_SEPARATOR_LENGTH = MODIFIER_SEPARATOR.length;
213
+ const EMPTY_MODIFIERS = [];
214
+ const createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
215
+ modifiers,
216
+ hasImportantModifier,
217
+ baseClassName,
218
+ maybePostfixModifierPosition,
219
+ isExternal
220
+ });
162
221
  const createParseClassName = (config) => {
163
222
  const {
164
223
  prefix,
@@ -170,12 +229,13 @@ const createParseClassName = (config) => {
170
229
  let parenDepth = 0;
171
230
  let modifierStart = 0;
172
231
  let postfixModifierPosition;
173
- for (let index = 0; index < className.length; index++) {
174
- let currentCharacter = className[index];
232
+ const len = className.length;
233
+ for (let index = 0; index < len; index++) {
234
+ const currentCharacter = className[index];
175
235
  if (bracketDepth === 0 && parenDepth === 0) {
176
236
  if (currentCharacter === MODIFIER_SEPARATOR) {
177
237
  modifiers.push(className.slice(modifierStart, index));
178
- modifierStart = index + MODIFIER_SEPARATOR_LENGTH;
238
+ modifierStart = index + 1;
179
239
  continue;
180
240
  }
181
241
  if (currentCharacter === "/") {
@@ -183,37 +243,34 @@ const createParseClassName = (config) => {
183
243
  continue;
184
244
  }
185
245
  }
186
- if (currentCharacter === "[") {
187
- bracketDepth++;
188
- } else if (currentCharacter === "]") {
189
- bracketDepth--;
190
- } else if (currentCharacter === "(") {
191
- parenDepth++;
192
- } else if (currentCharacter === ")") {
193
- parenDepth--;
194
- }
246
+ if (currentCharacter === "[") bracketDepth++;
247
+ else if (currentCharacter === "]") bracketDepth--;
248
+ else if (currentCharacter === "(") parenDepth++;
249
+ else if (currentCharacter === ")") parenDepth--;
250
+ }
251
+ const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
252
+ let baseClassName = baseClassNameWithImportantModifier;
253
+ let hasImportantModifier = false;
254
+ if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {
255
+ baseClassName = baseClassNameWithImportantModifier.slice(0, -1);
256
+ hasImportantModifier = true;
257
+ } else if (
258
+ /**
259
+ * In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
260
+ * @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
261
+ */
262
+ baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)
263
+ ) {
264
+ baseClassName = baseClassNameWithImportantModifier.slice(1);
265
+ hasImportantModifier = true;
195
266
  }
196
- const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
197
- const baseClassName = stripImportantModifier(baseClassNameWithImportantModifier);
198
- const hasImportantModifier = baseClassName !== baseClassNameWithImportantModifier;
199
267
  const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
200
- return {
201
- modifiers,
202
- hasImportantModifier,
203
- baseClassName,
204
- maybePostfixModifierPosition
205
- };
268
+ return createResultObject(modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition);
206
269
  };
207
270
  if (prefix) {
208
271
  const fullPrefix = prefix + MODIFIER_SEPARATOR;
209
272
  const parseClassNameOriginal = parseClassName;
210
- parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.substring(fullPrefix.length)) : {
211
- isExternal: true,
212
- modifiers: [],
213
- hasImportantModifier: false,
214
- baseClassName: className,
215
- maybePostfixModifierPosition: void 0
216
- };
273
+ parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.slice(fullPrefix.length)) : createResultObject(EMPTY_MODIFIERS, false, className, void 0, true);
217
274
  }
218
275
  if (experimentalParseClassName) {
219
276
  const parseClassNameOriginal = parseClassName;
@@ -224,36 +281,35 @@ const createParseClassName = (config) => {
224
281
  }
225
282
  return parseClassName;
226
283
  };
227
- const stripImportantModifier = (baseClassName) => {
228
- if (baseClassName.endsWith(IMPORTANT_MODIFIER)) {
229
- return baseClassName.substring(0, baseClassName.length - 1);
230
- }
231
- if (baseClassName.startsWith(IMPORTANT_MODIFIER)) {
232
- return baseClassName.substring(1);
233
- }
234
- return baseClassName;
235
- };
236
284
  const createSortModifiers = (config) => {
237
- const orderSensitiveModifiers = Object.fromEntries(config.orderSensitiveModifiers.map((modifier) => [modifier, true]));
238
- const sortModifiers = (modifiers) => {
239
- if (modifiers.length <= 1) {
240
- return modifiers;
241
- }
242
- const sortedModifiers = [];
243
- let unsortedModifiers = [];
244
- modifiers.forEach((modifier) => {
245
- const isPositionSensitive = modifier[0] === "[" || orderSensitiveModifiers[modifier];
246
- if (isPositionSensitive) {
247
- sortedModifiers.push(...unsortedModifiers.sort(), modifier);
248
- unsortedModifiers = [];
285
+ const modifierWeights = /* @__PURE__ */ new Map();
286
+ config.orderSensitiveModifiers.forEach((mod, index) => {
287
+ modifierWeights.set(mod, 1e6 + index);
288
+ });
289
+ return (modifiers) => {
290
+ const result = [];
291
+ let currentSegment = [];
292
+ for (let i = 0; i < modifiers.length; i++) {
293
+ const modifier = modifiers[i];
294
+ const isArbitrary = modifier[0] === "[";
295
+ const isOrderSensitive = modifierWeights.has(modifier);
296
+ if (isArbitrary || isOrderSensitive) {
297
+ if (currentSegment.length > 0) {
298
+ currentSegment.sort();
299
+ result.push(...currentSegment);
300
+ currentSegment = [];
301
+ }
302
+ result.push(modifier);
249
303
  } else {
250
- unsortedModifiers.push(modifier);
304
+ currentSegment.push(modifier);
251
305
  }
252
- });
253
- sortedModifiers.push(...unsortedModifiers.sort());
254
- return sortedModifiers;
306
+ }
307
+ if (currentSegment.length > 0) {
308
+ currentSegment.sort();
309
+ result.push(...currentSegment);
310
+ }
311
+ return result;
255
312
  };
256
- return sortModifiers;
257
313
  };
258
314
  const createConfigUtils = (config) => ({
259
315
  cache: createLruCache(config.cacheSize),
@@ -299,10 +355,10 @@ const mergeClassList = (classList, configUtils) => {
299
355
  }
300
356
  hasPostfixModifier = false;
301
357
  }
302
- const variantModifier = sortModifiers(modifiers).join(":");
358
+ const variantModifier = modifiers.length === 0 ? "" : modifiers.length === 1 ? modifiers[0] : sortModifiers(modifiers).join(":");
303
359
  const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
304
360
  const classId = modifierId + classGroupId;
305
- if (classGroupsInConflict.includes(classId)) {
361
+ if (classGroupsInConflict.indexOf(classId) > -1) {
306
362
  continue;
307
363
  }
308
364
  classGroupsInConflict.push(classId);
@@ -315,13 +371,13 @@ const mergeClassList = (classList, configUtils) => {
315
371
  }
316
372
  return result;
317
373
  };
318
- function twJoin() {
374
+ const twJoin = (...classLists) => {
319
375
  let index = 0;
320
376
  let argument;
321
377
  let resolvedValue;
322
378
  let string = "";
323
- while (index < arguments.length) {
324
- if (argument = arguments[index++]) {
379
+ while (index < classLists.length) {
380
+ if (argument = classLists[index++]) {
325
381
  if (resolvedValue = toValue(argument)) {
326
382
  string && (string += " ");
327
383
  string += resolvedValue;
@@ -329,7 +385,7 @@ function twJoin() {
329
385
  }
330
386
  }
331
387
  return string;
332
- }
388
+ };
333
389
  const toValue = (mix) => {
334
390
  if (typeof mix === "string") {
335
391
  return mix;
@@ -346,20 +402,20 @@ const toValue = (mix) => {
346
402
  }
347
403
  return string;
348
404
  };
349
- function createTailwindMerge(createConfigFirst, ...createConfigRest) {
405
+ const createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
350
406
  let configUtils;
351
407
  let cacheGet;
352
408
  let cacheSet;
353
- let functionToCall = initTailwindMerge;
354
- function initTailwindMerge(classList) {
409
+ let functionToCall;
410
+ const initTailwindMerge = (classList) => {
355
411
  const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
356
412
  configUtils = createConfigUtils(config);
357
413
  cacheGet = configUtils.cache.get;
358
414
  cacheSet = configUtils.cache.set;
359
415
  functionToCall = tailwindMerge;
360
416
  return tailwindMerge(classList);
361
- }
362
- function tailwindMerge(classList) {
417
+ };
418
+ const tailwindMerge = (classList) => {
363
419
  const cachedResult = cacheGet(classList);
364
420
  if (cachedResult) {
365
421
  return cachedResult;
@@ -367,13 +423,13 @@ function createTailwindMerge(createConfigFirst, ...createConfigRest) {
367
423
  const result = mergeClassList(classList, configUtils);
368
424
  cacheSet(classList, result);
369
425
  return result;
370
- }
371
- return function callTailwindMerge() {
372
- return functionToCall(twJoin.apply(null, arguments));
373
426
  };
374
- }
427
+ functionToCall = initTailwindMerge;
428
+ return (...args) => functionToCall(twJoin(...args));
429
+ };
430
+ const fallbackThemeArr = [];
375
431
  const fromTheme = (key) => {
376
- const themeGetter = (theme) => theme[key] || [];
432
+ const themeGetter = (theme) => theme[key] || fallbackThemeArr;
377
433
  themeGetter.isThemeGetter = true;
378
434
  return themeGetter;
379
435
  };
@@ -1,5 +1,5 @@
1
1
  import { CompositeData } from "./ui/composite/CompositeData.js";
2
- import { C } from "../_chunks/CompositeDataItem.js";
2
+ import { CompositeDataItem } from "./ui/composite/CompositeDataItem.js";
3
3
  import { AbstractFocusProvider } from "./ui/composite/FocusProvider/AbstractFocusProvider.js";
4
4
  import { ListboxFocusProvider } from "./ui/composite/FocusProvider/ListboxFocusProvider.js";
5
5
  import { AbstractSelectionProvider } from "./ui/composite/SelectionProvider/AbstractSelectionProvider.js";
@@ -47,7 +47,7 @@ export {
47
47
  CompositeComponent,
48
48
  CompositeComponentItem,
49
49
  CompositeData,
50
- C as CompositeDataItem,
50
+ CompositeDataItem,
51
51
  HorizontalList,
52
52
  IconGenerator,
53
53
  Input,
@@ -4,12 +4,6 @@ import { c as cn } from "../../_chunks/utils.js";
4
4
  import { useState } from "react";
5
5
  import { Button } from "./button.js";
6
6
  import { c as createLucideIcon } from "../../_chunks/createLucideIcon.js";
7
- /**
8
- * @license lucide-react v0.544.0 - ISC
9
- *
10
- * This source code is licensed under the ISC license.
11
- * See the LICENSE file in the root directory of this source tree.
12
- */
13
7
  const __iconNode = [
14
8
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
15
9
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
@@ -1,4 +1,4 @@
1
- import { C as CompositeDataItem } from "../../../_chunks/CompositeDataItem.js";
1
+ import { CompositeDataItem } from "./CompositeDataItem.js";
2
2
  import { union } from "../../../lib/set-operations.js";
3
3
  class CompositeData {
4
4
  #options;
@@ -1,5 +1,111 @@
1
- import "../../../lib/object.js";
2
- import { C } from "../../../_chunks/CompositeDataItem.js";
1
+ import { omit } from "../../../lib/object.js";
2
+ import { map } from "nanostores";
3
+ class CompositeDataItem {
4
+ #key;
5
+ parent = null;
6
+ children;
7
+ level;
8
+ data;
9
+ state;
10
+ pointers;
11
+ childrenProp;
12
+ constructor(item, options, parent) {
13
+ this.#key = options.getItemKey(item);
14
+ this.data = map(omit(item, [options.itemChildrenProp]));
15
+ this.state = map({
16
+ focused: false,
17
+ selected: false,
18
+ disabled: false,
19
+ ...options.initialState
20
+ });
21
+ this.pointers = {};
22
+ this.parent = parent;
23
+ this.level = parent ? parent.level + 1 : 0;
24
+ this.childrenProp = options.itemChildrenProp;
25
+ const children = options.getItemChildren(item);
26
+ if (children) {
27
+ this.children = children.map((child) => {
28
+ const childItem = new CompositeDataItem(child, options, this);
29
+ return childItem;
30
+ });
31
+ }
32
+ }
33
+ get key() {
34
+ return this.#key;
35
+ }
36
+ *[Symbol.iterator]() {
37
+ if (this.key !== "ALL") yield this;
38
+ if (this.children)
39
+ for (const child of this.children)
40
+ for (const item of child) yield item;
41
+ }
42
+ toJSON() {
43
+ const json = { ...this.data.get() };
44
+ if (this.children) {
45
+ json[this.childrenProp] = [];
46
+ for (const child of this.children)
47
+ json[this.childrenProp].push(child.toJSON());
48
+ }
49
+ return json;
50
+ }
51
+ descendants() {
52
+ if (!this.children) return [];
53
+ const descendants = [];
54
+ this.children.forEach(
55
+ (child) => {
56
+ descendants.push(child);
57
+ const childDescendants = child.descendants();
58
+ if (childDescendants) descendants.push(...childDescendants);
59
+ }
60
+ );
61
+ return descendants;
62
+ }
63
+ ancestors() {
64
+ const ancestors = [];
65
+ let parent = this.parent;
66
+ while (parent) {
67
+ ancestors.push(parent);
68
+ parent = parent.parent;
69
+ }
70
+ return ancestors;
71
+ }
72
+ toggleSelect(recursive = false) {
73
+ if (this.state.get().selected) this.deselect(recursive);
74
+ else this.select(recursive);
75
+ }
76
+ select(recursive = false) {
77
+ this.state.setKey("selected", true);
78
+ if (recursive && this.children) {
79
+ const selectedChildKeys = this.children.map((child) => child.select(true)).flat();
80
+ return [this.key, ...selectedChildKeys];
81
+ }
82
+ return [this.key];
83
+ }
84
+ deselect(recursive = false) {
85
+ this.state.setKey("selected", false);
86
+ if (recursive && this.children) {
87
+ const deselectedChildKeys = this.children.map((child) => child.deselect(true)).flat();
88
+ return [this.key, ...deselectedChildKeys];
89
+ }
90
+ return [this.key];
91
+ }
92
+ disable(recursive = false) {
93
+ this.state.setKey("disabled", true);
94
+ if (recursive && this.children) {
95
+ const disabledChildKeys = this.children.map((child) => child.disable(true)).flat();
96
+ return [this.key, ...disabledChildKeys];
97
+ }
98
+ return [this.key];
99
+ }
100
+ enable(recursive = false) {
101
+ this.state.setKey("disabled", false);
102
+ if (recursive && this.children) {
103
+ const enabledChildKeys = this.children.map((child) => child.enable(true)).flat();
104
+ return [this.key, ...enabledChildKeys];
105
+ }
106
+ return [this.key];
107
+ }
108
+ }
3
109
  export {
4
- C as CompositeDataItem
110
+ CompositeDataItem
5
111
  };
@@ -1,4 +1,5 @@
1
- import { a as atom, C as CompositeDataItem } from "../../../../_chunks/CompositeDataItem.js";
1
+ import { atom } from "nanostores";
2
+ import { CompositeDataItem } from "../CompositeDataItem.js";
2
3
  class AbstractFocusProvider {
3
4
  data;
4
5
  dataOptions;
@@ -1,4 +1,5 @@
1
- import { a as atom, C as CompositeDataItem } from "../../../../_chunks/CompositeDataItem.js";
1
+ import { atom } from "nanostores";
2
+ import { CompositeDataItem } from "../CompositeDataItem.js";
2
3
  class AbstractSelectionProvider {
3
4
  data;
4
5
  dataOptions;