@bccampus/ui-components 0.4.2 → 0.5.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 (165) hide show
  1. package/dist/_chunks/CompositeDataItem.js +204 -0
  2. package/dist/_chunks/createLucideIcon.js +103 -0
  3. package/dist/_chunks/index.js +125 -0
  4. package/dist/_chunks/index2.js +44 -0
  5. package/dist/_chunks/index3.js +533 -0
  6. package/dist/{utils-CRiPKpXj.js → _chunks/utils.js} +754 -526
  7. package/dist/components/index.d.ts +16 -0
  8. package/dist/components/index.js +84 -0
  9. package/dist/components/ui/banner.d.ts +10 -0
  10. package/dist/components/ui/banner.js +45 -0
  11. package/dist/components/ui/button.d.ts +11 -0
  12. package/dist/{button.js → components/ui/button.js} +11 -10
  13. package/dist/components/ui/card.d.ts +27 -0
  14. package/dist/components/ui/card.js +109 -0
  15. package/dist/components/ui/composite/CompositeData.d.ts +20 -0
  16. package/dist/components/ui/composite/CompositeData.js +89 -0
  17. package/dist/components/ui/composite/CompositeDataItem.d.ts +28 -0
  18. package/dist/components/ui/composite/CompositeDataItem.js +5 -0
  19. package/dist/components/ui/composite/FocusProvider/AbstractFocusProvider.d.ts +41 -0
  20. package/dist/components/ui/composite/FocusProvider/AbstractFocusProvider.js +35 -0
  21. package/dist/components/ui/composite/FocusProvider/ListboxFocusProvider.d.ts +16 -0
  22. package/dist/components/ui/composite/FocusProvider/ListboxFocusProvider.js +67 -0
  23. package/dist/components/ui/composite/FocusProvider/index.d.ts +2 -0
  24. package/dist/components/ui/composite/FocusProvider/index.js +6 -0
  25. package/dist/components/ui/composite/SelectionProvider/AbstractSelectionProvider.d.ts +23 -0
  26. package/dist/components/ui/composite/SelectionProvider/AbstractSelectionProvider.js +20 -0
  27. package/dist/components/ui/composite/SelectionProvider/MultipleSelectionProvider.d.ts +9 -0
  28. package/dist/components/ui/composite/SelectionProvider/MultipleSelectionProvider.js +20 -0
  29. package/dist/components/ui/composite/SelectionProvider/SingleSelectionProvider.d.ts +9 -0
  30. package/dist/components/ui/composite/SelectionProvider/SingleSelectionProvider.js +25 -0
  31. package/dist/components/ui/composite/SelectionProvider/index.d.ts +3 -0
  32. package/dist/components/ui/composite/SelectionProvider/index.js +8 -0
  33. package/dist/components/ui/composite/composite-component-item.d.ts +2 -0
  34. package/dist/components/ui/composite/composite-component-item.js +74 -0
  35. package/dist/components/ui/composite/composite-component.d.ts +2 -0
  36. package/dist/components/ui/composite/composite-component.js +66 -0
  37. package/dist/components/ui/composite/index.d.ts +7 -0
  38. package/dist/components/ui/composite/index.js +22 -0
  39. package/dist/components/ui/composite/listbox.d.ts +2 -0
  40. package/dist/components/ui/composite/listbox.js +58 -0
  41. package/dist/components/ui/composite/types.d.ts +82 -0
  42. package/dist/components/ui/composite/types.js +1 -0
  43. package/dist/components/ui/horizontal-list.d.ts +10 -0
  44. package/dist/components/ui/horizontal-list.js +82 -0
  45. package/dist/components/ui/icon-generator/generate-tiles.d.ts +4 -0
  46. package/dist/components/ui/icon-generator/generate-tiles.js +223 -0
  47. package/dist/components/ui/icon-generator/icon-generator.d.ts +3 -0
  48. package/dist/components/ui/icon-generator/icon-generator.js +82 -0
  49. package/dist/components/ui/icon-generator/index.d.ts +4 -0
  50. package/dist/components/ui/icon-generator/index.js +11 -0
  51. package/dist/components/ui/icon-generator/masked-image-generator.d.ts +3 -0
  52. package/dist/components/ui/icon-generator/masked-image-generator.js +31 -0
  53. package/dist/{masked-image-generator.d.ts → components/ui/icon-generator/types.d.ts} +48 -58
  54. package/dist/components/ui/icon-generator/types.js +30 -0
  55. package/dist/components/ui/input.d.ts +3 -0
  56. package/dist/{input.js → components/ui/input.js} +8 -8
  57. package/dist/components/ui/navigation-menu.d.ts +16 -0
  58. package/dist/components/ui/navigation-menu.js +1041 -0
  59. package/dist/components/ui/overlay.d.ts +7 -0
  60. package/dist/{overlay.js → components/ui/overlay.js} +7 -7
  61. package/dist/components/ui/page-header.d.ts +5 -0
  62. package/dist/{page-header.js → components/ui/page-header.js} +189 -181
  63. package/dist/components/ui/page-section.d.ts +8 -0
  64. package/dist/{page-section.js → components/ui/page-section.js} +7 -7
  65. package/dist/components/ui/page.d.ts +3 -0
  66. package/dist/components/ui/page.js +8 -0
  67. package/dist/components/ui/popover.d.ts +7 -0
  68. package/dist/components/ui/popover.js +3532 -0
  69. package/dist/components/ui/search-input.d.ts +3 -0
  70. package/dist/components/ui/search-input.js +24 -0
  71. package/dist/components/ui/tag.d.ts +10 -0
  72. package/dist/{tag.js → components/ui/tag.js} +10 -9
  73. package/dist/components/ui/typography/caption.d.ts +8 -0
  74. package/dist/components/ui/typography/caption.js +28 -0
  75. package/dist/components/ui/typography/index.d.ts +1 -0
  76. package/dist/components/ui/typography/index.js +5 -0
  77. package/dist/hooks/index.d.ts +3 -0
  78. package/dist/hooks/index.js +9 -0
  79. package/dist/hooks/use-effect-after-mount.d.ts +2 -0
  80. package/dist/hooks/use-effect-after-mount.js +24 -0
  81. package/dist/hooks/use-id.d.ts +1 -0
  82. package/dist/hooks/use-id.js +7 -0
  83. package/dist/hooks/use-keyboard-event.d.ts +59 -0
  84. package/dist/hooks/use-keyboard-event.js +52 -0
  85. package/dist/lib/index.d.ts +3 -0
  86. package/dist/lib/index.js +16 -0
  87. package/dist/lib/object.d.ts +5 -0
  88. package/dist/lib/object.js +38 -0
  89. package/dist/lib/set-operations.d.ts +5 -0
  90. package/dist/lib/set-operations.js +51 -0
  91. package/dist/{utils.d.ts → lib/utils.d.ts} +2 -5
  92. package/dist/lib/utils.js +4 -0
  93. package/package.json +9 -76
  94. package/src/components/index.ts +17 -0
  95. package/src/components/ui/composite/FocusProvider/index.ts +2 -0
  96. package/src/components/ui/composite/SelectionProvider/MultipleSelectionProvider.ts +1 -1
  97. package/src/components/ui/composite/SelectionProvider/index.ts +3 -0
  98. package/src/components/ui/composite/index.ts +5 -5
  99. package/src/components/ui/icon-generator/index.ts +2 -0
  100. package/src/components/ui/typography/index.ts +1 -0
  101. package/src/hooks/index.ts +3 -0
  102. package/src/index.ts +3 -0
  103. package/src/lib/index.ts +3 -0
  104. package/tsconfig.lib.json +44 -0
  105. package/vite.config.ts +28 -31
  106. package/dist/AbstractFocusProvider-CxvlcEki.js +0 -29
  107. package/dist/AbstractSelectionProvider-BtaROstC.js +0 -30
  108. package/dist/CompositeDataItem-DuHOHCWy.js +0 -158
  109. package/dist/ListboxFocusProvider.d.ts +0 -149
  110. package/dist/ListboxFocusProvider.js +0 -53
  111. package/dist/MultipleSelectionProvider.d.ts +0 -141
  112. package/dist/MultipleSelectionProvider.js +0 -19
  113. package/dist/SingleSelectionProvider.d.ts +0 -141
  114. package/dist/SingleSelectionProvider.js +0 -23
  115. package/dist/banner.d.ts +0 -16
  116. package/dist/banner.js +0 -42
  117. package/dist/button.d.ts +0 -17
  118. package/dist/caption.d.ts +0 -13
  119. package/dist/caption.js +0 -27
  120. package/dist/card.d.ts +0 -46
  121. package/dist/card.js +0 -108
  122. package/dist/composite-component-DSUbd1XS.js +0 -122
  123. package/dist/composite.d.ts +0 -208
  124. package/dist/composite.js +0 -82
  125. package/dist/createLucideIcon-CzehbSja.js +0 -94
  126. package/dist/generate-tiles-DuagGD1d.js +0 -244
  127. package/dist/generate-tiles.d.ts +0 -43
  128. package/dist/generate-tiles.js +0 -7
  129. package/dist/horizontal-list.d.ts +0 -16
  130. package/dist/horizontal-list.js +0 -77
  131. package/dist/icon-generator-tuhuqdpL.js +0 -76
  132. package/dist/icon-generator.d.ts +0 -58
  133. package/dist/icon-generator.js +0 -6
  134. package/dist/index-CQhYMnjT.js +0 -34
  135. package/dist/index-U7DVCmS_.js +0 -76
  136. package/dist/input.d.ts +0 -7
  137. package/dist/listbox.d.ts +0 -171
  138. package/dist/listbox.js +0 -76
  139. package/dist/masked-image-generator.js +0 -29
  140. package/dist/navigation-menu.d.ts +0 -27
  141. package/dist/navigation-menu.js +0 -1139
  142. package/dist/overlay.d.ts +0 -13
  143. package/dist/page-header.d.ts +0 -9
  144. package/dist/page-section.d.ts +0 -14
  145. package/dist/page.d.ts +0 -7
  146. package/dist/page.js +0 -8
  147. package/dist/search-input.d.ts +0 -7
  148. package/dist/search-input.js +0 -23
  149. package/dist/tag.d.ts +0 -16
  150. package/dist/ui-components.d.ts +0 -215
  151. package/dist/ui-components.js +0 -54
  152. package/dist/utils.js +0 -4
  153. package/src/assets/icons/icon_01.svg +0 -6
  154. package/src/assets/icons/icon_02.svg +0 -6
  155. package/src/assets/icons/icon_03.svg +0 -6
  156. package/src/assets/icons/icon_04.svg +0 -6
  157. package/src/assets/icons/icon_05.svg +0 -4
  158. package/src/assets/icons/icon_06.svg +0 -4
  159. package/src/assets/images/image_01.jpg +0 -0
  160. package/src/assets/images/image_02.jpg +0 -0
  161. package/src/assets/images/image_03.webp +0 -0
  162. package/src/assets/images/image_04.png +0 -0
  163. package/src/assets/images/image_05.jpg +0 -0
  164. package/src/assets/images/image_06.jpg +0 -0
  165. package/src/components/ui/index.ts +0 -15
@@ -0,0 +1,204 @@
1
+ import { omit } from "../lib/object.js";
2
+ let clean = Symbol("clean");
3
+ let listenerQueue = [];
4
+ let lqIndex = 0;
5
+ const QUEUE_ITEMS_PER_LISTENER = 4;
6
+ let atom = (initialValue) => {
7
+ let listeners = [];
8
+ let $atom = {
9
+ get() {
10
+ if (!$atom.lc) {
11
+ $atom.listen(() => {
12
+ })();
13
+ }
14
+ return $atom.value;
15
+ },
16
+ lc: 0,
17
+ listen(listener) {
18
+ $atom.lc = listeners.push(listener);
19
+ return () => {
20
+ for (let i = lqIndex + QUEUE_ITEMS_PER_LISTENER; i < listenerQueue.length; ) {
21
+ if (listenerQueue[i] === listener) {
22
+ listenerQueue.splice(i, QUEUE_ITEMS_PER_LISTENER);
23
+ } else {
24
+ i += QUEUE_ITEMS_PER_LISTENER;
25
+ }
26
+ }
27
+ let index = listeners.indexOf(listener);
28
+ if (~index) {
29
+ listeners.splice(index, 1);
30
+ if (!--$atom.lc) $atom.off();
31
+ }
32
+ };
33
+ },
34
+ notify(oldValue, changedKey) {
35
+ let runListenerQueue = !listenerQueue.length;
36
+ for (let listener of listeners) {
37
+ listenerQueue.push(listener, $atom.value, oldValue, changedKey);
38
+ }
39
+ if (runListenerQueue) {
40
+ for (lqIndex = 0; lqIndex < listenerQueue.length; lqIndex += QUEUE_ITEMS_PER_LISTENER) {
41
+ listenerQueue[lqIndex](
42
+ listenerQueue[lqIndex + 1],
43
+ listenerQueue[lqIndex + 2],
44
+ listenerQueue[lqIndex + 3]
45
+ );
46
+ }
47
+ listenerQueue.length = 0;
48
+ }
49
+ },
50
+ /* It will be called on last listener unsubscribing.
51
+ We will redefine it in onMount and onStop. */
52
+ off() {
53
+ },
54
+ set(newValue) {
55
+ let oldValue = $atom.value;
56
+ if (oldValue !== newValue) {
57
+ $atom.value = newValue;
58
+ $atom.notify(oldValue);
59
+ }
60
+ },
61
+ subscribe(listener) {
62
+ let unbind = $atom.listen(listener);
63
+ listener($atom.value);
64
+ return unbind;
65
+ },
66
+ value: initialValue
67
+ };
68
+ if (process.env.NODE_ENV !== "production") {
69
+ $atom[clean] = () => {
70
+ listeners = [];
71
+ $atom.lc = 0;
72
+ $atom.off();
73
+ };
74
+ }
75
+ return $atom;
76
+ };
77
+ let map = (initial = {}) => {
78
+ let $map = atom(initial);
79
+ $map.setKey = function(key, value) {
80
+ let oldMap = $map.value;
81
+ if (typeof value === "undefined" && key in $map.value) {
82
+ $map.value = { ...$map.value };
83
+ delete $map.value[key];
84
+ $map.notify(oldMap, key);
85
+ } else if ($map.value[key] !== value) {
86
+ $map.value = {
87
+ ...$map.value,
88
+ [key]: value
89
+ };
90
+ $map.notify(oldMap, key);
91
+ }
92
+ };
93
+ return $map;
94
+ };
95
+ class CompositeDataItem {
96
+ #key;
97
+ parent = null;
98
+ children;
99
+ level;
100
+ data;
101
+ state;
102
+ pointers;
103
+ childrenProp;
104
+ constructor(item, options, parent) {
105
+ this.#key = options.getItemKey(item);
106
+ this.data = map(omit(item, [options.itemChildrenProp]));
107
+ this.state = map({
108
+ focused: false,
109
+ selected: false,
110
+ disabled: false,
111
+ ...options.initialState
112
+ });
113
+ this.pointers = {};
114
+ this.parent = parent;
115
+ this.level = parent ? parent.level + 1 : 0;
116
+ this.childrenProp = options.itemChildrenProp;
117
+ const children = options.getItemChildren(item);
118
+ if (children) {
119
+ this.children = children.map((child) => {
120
+ const childItem = new CompositeDataItem(child, options, this);
121
+ return childItem;
122
+ });
123
+ }
124
+ }
125
+ get key() {
126
+ return this.#key;
127
+ }
128
+ *[Symbol.iterator]() {
129
+ if (this.key !== "ALL") yield this;
130
+ if (this.children)
131
+ for (const child of this.children)
132
+ for (const item of child) yield item;
133
+ }
134
+ toJSON() {
135
+ const json = { ...this.data.get() };
136
+ if (this.children) {
137
+ json[this.childrenProp] = [];
138
+ for (const child of this.children)
139
+ json[this.childrenProp].push(child.toJSON());
140
+ }
141
+ return json;
142
+ }
143
+ descendants() {
144
+ if (!this.children) return [];
145
+ const descendants = [];
146
+ this.children.forEach(
147
+ (child) => {
148
+ descendants.push(child);
149
+ const childDescendants = child.descendants();
150
+ if (childDescendants) descendants.push(...childDescendants);
151
+ }
152
+ );
153
+ return descendants;
154
+ }
155
+ ancestors() {
156
+ const ancestors = [];
157
+ let parent = this.parent;
158
+ while (parent) {
159
+ ancestors.push(parent);
160
+ parent = parent.parent;
161
+ }
162
+ return ancestors;
163
+ }
164
+ toggleSelect(recursive = false) {
165
+ if (this.state.get().selected) this.deselect(recursive);
166
+ else this.select(recursive);
167
+ }
168
+ select(recursive = false) {
169
+ this.state.setKey("selected", true);
170
+ if (recursive && this.children) {
171
+ const selectedChildKeys = this.children.map((child) => child.select(true)).flat();
172
+ return [this.key, ...selectedChildKeys];
173
+ }
174
+ return [this.key];
175
+ }
176
+ deselect(recursive = false) {
177
+ this.state.setKey("selected", false);
178
+ if (recursive && this.children) {
179
+ const deselectedChildKeys = this.children.map((child) => child.deselect(true)).flat();
180
+ return [this.key, ...deselectedChildKeys];
181
+ }
182
+ return [this.key];
183
+ }
184
+ disable(recursive = false) {
185
+ this.state.setKey("disabled", true);
186
+ if (recursive && this.children) {
187
+ const disabledChildKeys = this.children.map((child) => child.disable(true)).flat();
188
+ return [this.key, ...disabledChildKeys];
189
+ }
190
+ return [this.key];
191
+ }
192
+ enable(recursive = false) {
193
+ this.state.setKey("disabled", false);
194
+ if (recursive && this.children) {
195
+ const enabledChildKeys = this.children.map((child) => child.enable(true)).flat();
196
+ return [this.key, ...enabledChildKeys];
197
+ }
198
+ return [this.key];
199
+ }
200
+ }
201
+ export {
202
+ CompositeDataItem as C,
203
+ atom as a
204
+ };
@@ -0,0 +1,103 @@
1
+ import { forwardRef, createElement } from "react";
2
+ /**
3
+ * @license lucide-react v0.544.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */
8
+ const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
9
+ const toCamelCase = (string) => string.replace(
10
+ /^([A-Z])|[\s-_]+(\w)/g,
11
+ (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
12
+ );
13
+ const toPascalCase = (string) => {
14
+ const camelCase = toCamelCase(string);
15
+ return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
16
+ };
17
+ const mergeClasses = (...classes) => classes.filter((className, index, array) => {
18
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
19
+ }).join(" ").trim();
20
+ const hasA11yProp = (props) => {
21
+ for (const prop in props) {
22
+ if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
23
+ return true;
24
+ }
25
+ }
26
+ };
27
+ /**
28
+ * @license lucide-react v0.544.0 - ISC
29
+ *
30
+ * This source code is licensed under the ISC license.
31
+ * See the LICENSE file in the root directory of this source tree.
32
+ */
33
+ var defaultAttributes = {
34
+ xmlns: "http://www.w3.org/2000/svg",
35
+ width: 24,
36
+ height: 24,
37
+ viewBox: "0 0 24 24",
38
+ fill: "none",
39
+ stroke: "currentColor",
40
+ strokeWidth: 2,
41
+ strokeLinecap: "round",
42
+ strokeLinejoin: "round"
43
+ };
44
+ /**
45
+ * @license lucide-react v0.544.0 - ISC
46
+ *
47
+ * This source code is licensed under the ISC license.
48
+ * See the LICENSE file in the root directory of this source tree.
49
+ */
50
+ const Icon = forwardRef(
51
+ ({
52
+ color = "currentColor",
53
+ size = 24,
54
+ strokeWidth = 2,
55
+ absoluteStrokeWidth,
56
+ className = "",
57
+ children,
58
+ iconNode,
59
+ ...rest
60
+ }, ref) => createElement(
61
+ "svg",
62
+ {
63
+ ref,
64
+ ...defaultAttributes,
65
+ width: size,
66
+ height: size,
67
+ stroke: color,
68
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
69
+ className: mergeClasses("lucide", className),
70
+ ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
71
+ ...rest
72
+ },
73
+ [
74
+ ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
75
+ ...Array.isArray(children) ? children : [children]
76
+ ]
77
+ )
78
+ );
79
+ /**
80
+ * @license lucide-react v0.544.0 - ISC
81
+ *
82
+ * This source code is licensed under the ISC license.
83
+ * See the LICENSE file in the root directory of this source tree.
84
+ */
85
+ const createLucideIcon = (iconName, iconNode) => {
86
+ const Component = forwardRef(
87
+ ({ className, ...props }, ref) => createElement(Icon, {
88
+ ref,
89
+ iconNode,
90
+ className: mergeClasses(
91
+ `lucide-${toKebabCase(toPascalCase(iconName))}`,
92
+ `lucide-${iconName}`,
93
+ className
94
+ ),
95
+ ...props
96
+ })
97
+ );
98
+ Component.displayName = toPascalCase(iconName);
99
+ return Component;
100
+ };
101
+ export {
102
+ createLucideIcon as c
103
+ };
@@ -0,0 +1,125 @@
1
+ import * as React from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ function setRef(ref, value) {
4
+ if (typeof ref === "function") {
5
+ return ref(value);
6
+ } else if (ref !== null && ref !== void 0) {
7
+ ref.current = value;
8
+ }
9
+ }
10
+ function composeRefs(...refs) {
11
+ return (node) => {
12
+ let hasCleanup = false;
13
+ const cleanups = refs.map((ref) => {
14
+ const cleanup = setRef(ref, node);
15
+ if (!hasCleanup && typeof cleanup == "function") {
16
+ hasCleanup = true;
17
+ }
18
+ return cleanup;
19
+ });
20
+ if (hasCleanup) {
21
+ return () => {
22
+ for (let i = 0; i < cleanups.length; i++) {
23
+ const cleanup = cleanups[i];
24
+ if (typeof cleanup == "function") {
25
+ cleanup();
26
+ } else {
27
+ setRef(refs[i], null);
28
+ }
29
+ }
30
+ };
31
+ }
32
+ };
33
+ }
34
+ function useComposedRefs(...refs) {
35
+ return React.useCallback(composeRefs(...refs), refs);
36
+ }
37
+ // @__NO_SIDE_EFFECTS__
38
+ function createSlot(ownerName) {
39
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
40
+ const Slot2 = React.forwardRef((props, forwardedRef) => {
41
+ const { children, ...slotProps } = props;
42
+ const childrenArray = React.Children.toArray(children);
43
+ const slottable = childrenArray.find(isSlottable);
44
+ if (slottable) {
45
+ const newElement = slottable.props.children;
46
+ const newChildren = childrenArray.map((child) => {
47
+ if (child === slottable) {
48
+ if (React.Children.count(newElement) > 1) return React.Children.only(null);
49
+ return React.isValidElement(newElement) ? newElement.props.children : null;
50
+ } else {
51
+ return child;
52
+ }
53
+ });
54
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
55
+ }
56
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
57
+ });
58
+ Slot2.displayName = `${ownerName}.Slot`;
59
+ return Slot2;
60
+ }
61
+ var Slot = /* @__PURE__ */ createSlot("Slot");
62
+ // @__NO_SIDE_EFFECTS__
63
+ function createSlotClone(ownerName) {
64
+ const SlotClone = React.forwardRef((props, forwardedRef) => {
65
+ const { children, ...slotProps } = props;
66
+ if (React.isValidElement(children)) {
67
+ const childrenRef = getElementRef(children);
68
+ const props2 = mergeProps(slotProps, children.props);
69
+ if (children.type !== React.Fragment) {
70
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
71
+ }
72
+ return React.cloneElement(children, props2);
73
+ }
74
+ return React.Children.count(children) > 1 ? React.Children.only(null) : null;
75
+ });
76
+ SlotClone.displayName = `${ownerName}.SlotClone`;
77
+ return SlotClone;
78
+ }
79
+ var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
80
+ function isSlottable(child) {
81
+ return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
82
+ }
83
+ function mergeProps(slotProps, childProps) {
84
+ const overrideProps = { ...childProps };
85
+ for (const propName in childProps) {
86
+ const slotPropValue = slotProps[propName];
87
+ const childPropValue = childProps[propName];
88
+ const isHandler = /^on[A-Z]/.test(propName);
89
+ if (isHandler) {
90
+ if (slotPropValue && childPropValue) {
91
+ overrideProps[propName] = (...args) => {
92
+ const result = childPropValue(...args);
93
+ slotPropValue(...args);
94
+ return result;
95
+ };
96
+ } else if (slotPropValue) {
97
+ overrideProps[propName] = slotPropValue;
98
+ }
99
+ } else if (propName === "style") {
100
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
101
+ } else if (propName === "className") {
102
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
103
+ }
104
+ }
105
+ return { ...slotProps, ...overrideProps };
106
+ }
107
+ function getElementRef(element) {
108
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
109
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
110
+ if (mayWarn) {
111
+ return element.ref;
112
+ }
113
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
114
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
115
+ if (mayWarn) {
116
+ return element.props.ref;
117
+ }
118
+ return element.props.ref || element.ref;
119
+ }
120
+ export {
121
+ Slot as S,
122
+ composeRefs as a,
123
+ createSlot as c,
124
+ useComposedRefs as u
125
+ };
@@ -0,0 +1,44 @@
1
+ import { a as clsx } from "./utils.js";
2
+ const falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
3
+ const cx = clsx;
4
+ const cva = (base, config) => (props) => {
5
+ var _config_compoundVariants;
6
+ if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
7
+ const { variants, defaultVariants } = config;
8
+ const getVariantClassNames = Object.keys(variants).map((variant) => {
9
+ const variantProp = props === null || props === void 0 ? void 0 : props[variant];
10
+ const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
11
+ if (variantProp === null) return null;
12
+ const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
13
+ return variants[variant][variantKey];
14
+ });
15
+ const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
16
+ let [key, value] = param;
17
+ if (value === void 0) {
18
+ return acc;
19
+ }
20
+ acc[key] = value;
21
+ return acc;
22
+ }, {});
23
+ const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param) => {
24
+ let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
25
+ return Object.entries(compoundVariantOptions).every((param2) => {
26
+ let [key, value] = param2;
27
+ return Array.isArray(value) ? value.includes({
28
+ ...defaultVariants,
29
+ ...propsWithoutUndefined
30
+ }[key]) : {
31
+ ...defaultVariants,
32
+ ...propsWithoutUndefined
33
+ }[key] === value;
34
+ }) ? [
35
+ ...acc,
36
+ cvClass,
37
+ cvClassName
38
+ ] : acc;
39
+ }, []);
40
+ return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
41
+ };
42
+ export {
43
+ cva as c
44
+ };