@marigold/components 0.3.0 → 0.4.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 (232) hide show
  1. package/CHANGELOG.md +66 -161
  2. package/dist/index.d.ts +364 -32
  3. package/dist/index.js +1421 -5
  4. package/dist/index.mjs +1369 -0
  5. package/package.json +31 -11
  6. package/dist/ActionGroup/ActionGroup.d.ts +0 -8
  7. package/dist/ActionGroup/ActionGroup.stories.d.ts +0 -5
  8. package/dist/ActionGroup/index.d.ts +0 -1
  9. package/dist/Alert/Alert.d.ts +0 -18
  10. package/dist/Alert/Alert.stories.d.ts +0 -5
  11. package/dist/Alert/index.d.ts +0 -1
  12. package/dist/Badge/Badge.d.ts +0 -13
  13. package/dist/Badge/Badge.stories.d.ts +0 -5
  14. package/dist/Badge/index.d.ts +0 -1
  15. package/dist/Box.d.ts +0 -2
  16. package/dist/Button/Button.d.ts +0 -9
  17. package/dist/Button/Button.stories.d.ts +0 -5
  18. package/dist/Button/index.d.ts +0 -1
  19. package/dist/Card/Card.d.ts +0 -14
  20. package/dist/Card/Card.stories.d.ts +0 -5
  21. package/dist/Card/index.d.ts +0 -1
  22. package/dist/Checkbox/Checkbox.d.ts +0 -20
  23. package/dist/Checkbox/Checkbox.stories.d.ts +0 -5
  24. package/dist/Checkbox/CheckboxIcons.d.ts +0 -9
  25. package/dist/Checkbox/index.d.ts +0 -1
  26. package/dist/Column/Column.d.ts +0 -8
  27. package/dist/Column/Column.stories.d.ts +0 -5
  28. package/dist/Column/index.d.ts +0 -1
  29. package/dist/Columns/Columns.d.ts +0 -10
  30. package/dist/Columns/Columns.stories.d.ts +0 -5
  31. package/dist/Columns/index.d.ts +0 -1
  32. package/dist/Container/Container.d.ts +0 -6
  33. package/dist/Container/Container.stories.d.ts +0 -5
  34. package/dist/Container/index.d.ts +0 -1
  35. package/dist/Dialog/Dialog.d.ts +0 -17
  36. package/dist/Dialog/Dialog.stories.d.ts +0 -5
  37. package/dist/Dialog/ModalDialog.d.ts +0 -8
  38. package/dist/Dialog/index.d.ts +0 -1
  39. package/dist/Divider/Divider.d.ts +0 -12
  40. package/dist/Divider/Divider.stories.d.ts +0 -5
  41. package/dist/Divider/index.d.ts +0 -1
  42. package/dist/Field/Field.d.ts +0 -13
  43. package/dist/Field/Field.stories.d.ts +0 -5
  44. package/dist/Field/index.d.ts +0 -1
  45. package/dist/Image/Image.d.ts +0 -12
  46. package/dist/Image/Image.stories.d.ts +0 -5
  47. package/dist/Image/index.d.ts +0 -1
  48. package/dist/Inline/Inline.d.ts +0 -7
  49. package/dist/Inline/Inline.stories.d.ts +0 -5
  50. package/dist/Inline/index.d.ts +0 -1
  51. package/dist/Input/Input.d.ts +0 -11
  52. package/dist/Input/Input.stories.d.ts +0 -5
  53. package/dist/Input/index.d.ts +0 -1
  54. package/dist/Label/Label.d.ts +0 -19
  55. package/dist/Label/Label.stories.d.ts +0 -5
  56. package/dist/Label/index.d.ts +0 -1
  57. package/dist/Link/Link.d.ts +0 -10
  58. package/dist/Link/Link.stories.d.ts +0 -5
  59. package/dist/Link/index.d.ts +0 -1
  60. package/dist/Menu/Menu.d.ts +0 -15
  61. package/dist/Menu/Menu.stories.d.ts +0 -5
  62. package/dist/Menu/index.d.ts +0 -1
  63. package/dist/MenuItem/MenuItem.d.ts +0 -12
  64. package/dist/MenuItem/MenuItem.stories.d.ts +0 -5
  65. package/dist/MenuItem/index.d.ts +0 -1
  66. package/dist/Message/Message.d.ts +0 -12
  67. package/dist/Message/Message.stories.d.ts +0 -5
  68. package/dist/Message/index.d.ts +0 -1
  69. package/dist/Provider/MarigoldProvider.d.ts +0 -11
  70. package/dist/Provider/index.d.ts +0 -3
  71. package/dist/Radio/Radio.d.ts +0 -21
  72. package/dist/Radio/RadioIcons.d.ts +0 -10
  73. package/dist/Radio/index.d.ts +0 -1
  74. package/dist/Select/ListBox.d.ts +0 -9
  75. package/dist/Select/ListBoxSection.d.ts +0 -9
  76. package/dist/Select/Option.d.ts +0 -9
  77. package/dist/Select/Popover.d.ts +0 -9
  78. package/dist/Select/Select.d.ts +0 -27
  79. package/dist/Select/Select.stories.d.ts +0 -5
  80. package/dist/Select/index.d.ts +0 -1
  81. package/dist/Slider/Slider.d.ts +0 -11
  82. package/dist/Slider/Slider.stories.d.ts +0 -5
  83. package/dist/Slider/index.d.ts +0 -1
  84. package/dist/Stack/Stack.d.ts +0 -7
  85. package/dist/Stack/Stack.stories.d.ts +0 -5
  86. package/dist/Stack/index.d.ts +0 -1
  87. package/dist/Text/Text.d.ts +0 -17
  88. package/dist/Text/Text.stories.d.ts +0 -5
  89. package/dist/Text/index.d.ts +0 -1
  90. package/dist/Textarea/Textarea.d.ts +0 -16
  91. package/dist/Textarea/Textarea.stories.d.ts +0 -5
  92. package/dist/Textarea/index.d.ts +0 -1
  93. package/dist/ValidationMessage/ValidationMessage.d.ts +0 -11
  94. package/dist/ValidationMessage/ValidationMessage.stories.d.ts +0 -5
  95. package/dist/ValidationMessage/index.d.ts +0 -1
  96. package/dist/VisuallyHidden/VisuallyHidden.d.ts +0 -1
  97. package/dist/VisuallyHidden/VisuallyHidden.stories.d.ts +0 -5
  98. package/dist/VisuallyHidden/index.d.ts +0 -1
  99. package/dist/components.cjs.development.js +0 -1422
  100. package/dist/components.cjs.development.js.map +0 -1
  101. package/dist/components.cjs.production.min.js +0 -2
  102. package/dist/components.cjs.production.min.js.map +0 -1
  103. package/dist/components.esm.js +0 -1348
  104. package/dist/components.esm.js.map +0 -1
  105. package/dist/theme.d.ts +0 -23
  106. package/src/ActionGroup/ActionGroup.stories.tsx +0 -47
  107. package/src/ActionGroup/ActionGroup.test.tsx +0 -83
  108. package/src/ActionGroup/ActionGroup.tsx +0 -32
  109. package/src/ActionGroup/index.ts +0 -1
  110. package/src/Alert/Alert.stories.tsx +0 -32
  111. package/src/Alert/Alert.test.tsx +0 -82
  112. package/src/Alert/Alert.tsx +0 -52
  113. package/src/Alert/index.ts +0 -1
  114. package/src/Badge/Badge.stories.tsx +0 -38
  115. package/src/Badge/Badge.test.tsx +0 -65
  116. package/src/Badge/Badge.tsx +0 -37
  117. package/src/Badge/index.ts +0 -1
  118. package/src/Box.ts +0 -2
  119. package/src/Button/Button.stories.tsx +0 -57
  120. package/src/Button/Button.test.tsx +0 -149
  121. package/src/Button/Button.tsx +0 -64
  122. package/src/Button/index.ts +0 -1
  123. package/src/Card/Card.stories.tsx +0 -41
  124. package/src/Card/Card.test.tsx +0 -71
  125. package/src/Card/Card.tsx +0 -48
  126. package/src/Card/index.ts +0 -1
  127. package/src/Checkbox/Checkbox.stories.mdx +0 -97
  128. package/src/Checkbox/Checkbox.stories.tsx +0 -78
  129. package/src/Checkbox/Checkbox.test.tsx +0 -166
  130. package/src/Checkbox/Checkbox.tsx +0 -101
  131. package/src/Checkbox/CheckboxIcons.tsx +0 -59
  132. package/src/Checkbox/index.ts +0 -1
  133. package/src/Column/Column.stories.tsx +0 -33
  134. package/src/Column/Column.test.tsx +0 -32
  135. package/src/Column/Column.tsx +0 -27
  136. package/src/Column/index.ts +0 -1
  137. package/src/Columns/Columns.stories.tsx +0 -75
  138. package/src/Columns/Columns.test.tsx +0 -113
  139. package/src/Columns/Columns.tsx +0 -69
  140. package/src/Columns/index.ts +0 -1
  141. package/src/Container/Container.stories.tsx +0 -14
  142. package/src/Container/Container.test.tsx +0 -26
  143. package/src/Container/Container.tsx +0 -13
  144. package/src/Container/index.ts +0 -1
  145. package/src/Dialog/Dialog.stories.tsx +0 -88
  146. package/src/Dialog/Dialog.test.tsx +0 -158
  147. package/src/Dialog/Dialog.tsx +0 -130
  148. package/src/Dialog/ModalDialog.tsx +0 -76
  149. package/src/Dialog/index.ts +0 -1
  150. package/src/Divider/Divider.stories.tsx +0 -30
  151. package/src/Divider/Divider.test.tsx +0 -71
  152. package/src/Divider/Divider.tsx +0 -25
  153. package/src/Divider/index.ts +0 -1
  154. package/src/Field/Field.stories.tsx +0 -110
  155. package/src/Field/Field.test.tsx +0 -130
  156. package/src/Field/Field.tsx +0 -56
  157. package/src/Field/index.ts +0 -1
  158. package/src/Image/Image.stories.tsx +0 -34
  159. package/src/Image/Image.test.tsx +0 -73
  160. package/src/Image/Image.tsx +0 -25
  161. package/src/Image/index.ts +0 -1
  162. package/src/Inline/Inline.stories.tsx +0 -39
  163. package/src/Inline/Inline.test.tsx +0 -99
  164. package/src/Inline/Inline.tsx +0 -38
  165. package/src/Inline/index.ts +0 -1
  166. package/src/Input/Input.stories.tsx +0 -54
  167. package/src/Input/Input.test.tsx +0 -74
  168. package/src/Input/Input.tsx +0 -25
  169. package/src/Input/index.ts +0 -1
  170. package/src/Label/Label.stories.tsx +0 -41
  171. package/src/Label/Label.test.tsx +0 -109
  172. package/src/Label/Label.tsx +0 -64
  173. package/src/Label/index.ts +0 -1
  174. package/src/Link/Link.stories.tsx +0 -35
  175. package/src/Link/Link.test.tsx +0 -97
  176. package/src/Link/Link.tsx +0 -42
  177. package/src/Link/index.ts +0 -1
  178. package/src/Menu/Menu.stories.tsx +0 -62
  179. package/src/Menu/Menu.test.tsx +0 -84
  180. package/src/Menu/Menu.tsx +0 -51
  181. package/src/Menu/index.ts +0 -1
  182. package/src/MenuItem/MenuItem.stories.tsx +0 -30
  183. package/src/MenuItem/MenuItem.test.tsx +0 -68
  184. package/src/MenuItem/MenuItem.tsx +0 -35
  185. package/src/MenuItem/index.ts +0 -1
  186. package/src/Message/Message.stories.tsx +0 -30
  187. package/src/Message/Message.test.tsx +0 -90
  188. package/src/Message/Message.tsx +0 -55
  189. package/src/Message/index.ts +0 -1
  190. package/src/Provider/MarigoldProvider.test.tsx +0 -136
  191. package/src/Provider/MarigoldProvider.tsx +0 -47
  192. package/src/Provider/index.ts +0 -4
  193. package/src/Radio/Radio.stories.mdx +0 -97
  194. package/src/Radio/Radio.test.tsx +0 -119
  195. package/src/Radio/Radio.tsx +0 -128
  196. package/src/Radio/RadioIcons.tsx +0 -39
  197. package/src/Radio/index.ts +0 -1
  198. package/src/Select/ListBox.tsx +0 -40
  199. package/src/Select/ListBoxSection.tsx +0 -40
  200. package/src/Select/Option.tsx +0 -48
  201. package/src/Select/Popover.tsx +0 -50
  202. package/src/Select/Select.stories.tsx +0 -81
  203. package/src/Select/Select.test.tsx +0 -349
  204. package/src/Select/Select.tsx +0 -174
  205. package/src/Select/index.ts +0 -1
  206. package/src/Slider/Slider.stories.tsx +0 -24
  207. package/src/Slider/Slider.test.tsx +0 -63
  208. package/src/Slider/Slider.tsx +0 -35
  209. package/src/Slider/index.ts +0 -1
  210. package/src/Stack/Stack.stories.tsx +0 -57
  211. package/src/Stack/Stack.test.tsx +0 -138
  212. package/src/Stack/Stack.tsx +0 -39
  213. package/src/Stack/index.ts +0 -1
  214. package/src/Text/Text.stories.tsx +0 -61
  215. package/src/Text/Text.test.tsx +0 -99
  216. package/src/Text/Text.tsx +0 -60
  217. package/src/Text/index.ts +0 -1
  218. package/src/Textarea/Textarea.stories.tsx +0 -64
  219. package/src/Textarea/Textarea.test.tsx +0 -95
  220. package/src/Textarea/Textarea.tsx +0 -62
  221. package/src/Textarea/index.ts +0 -1
  222. package/src/ValidationMessage/ValidationMessage.stories.tsx +0 -27
  223. package/src/ValidationMessage/ValidationMessage.test.tsx +0 -68
  224. package/src/ValidationMessage/ValidationMessage.tsx +0 -40
  225. package/src/ValidationMessage/index.ts +0 -1
  226. package/src/VisuallyHidden/VisuallyHidden.stories.tsx +0 -19
  227. package/src/VisuallyHidden/VisuallyHidden.test.tsx +0 -10
  228. package/src/VisuallyHidden/VisuallyHidden.tsx +0 -1
  229. package/src/VisuallyHidden/index.ts +0 -1
  230. package/src/index.ts +0 -34
  231. package/src/theme.ts +0 -50
  232. package/tsconfig.build.json +0 -3
package/dist/index.mjs ADDED
@@ -0,0 +1,1369 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+
33
+ // src/ActionGroup/ActionGroup.tsx
34
+ import React3 from "react";
35
+
36
+ // src/Inline/Inline.tsx
37
+ import React, { Children } from "react";
38
+ import flattenChildren from "react-keyed-flatten-children";
39
+
40
+ // src/Box.ts
41
+ import { Box } from "@marigold/system";
42
+
43
+ // src/Inline/Inline.tsx
44
+ var ALIGNMENT = {
45
+ top: "flex-start",
46
+ center: "center",
47
+ bottom: "flex-end"
48
+ };
49
+ var Inline = (_a) => {
50
+ var _b = _a, {
51
+ space = "none",
52
+ align = "center",
53
+ children
54
+ } = _b, props = __objRest(_b, [
55
+ "space",
56
+ "align",
57
+ "children"
58
+ ]);
59
+ return /* @__PURE__ */ React.createElement(Box, __spreadValues({
60
+ display: "inline-flex",
61
+ css: { "> * + *": { pl: space } },
62
+ alignItems: ALIGNMENT[align]
63
+ }, props), Children.map(flattenChildren(children), (child) => /* @__PURE__ */ React.createElement(Box, null, React.cloneElement(child, {}, child.props.children))));
64
+ };
65
+
66
+ // src/Stack/Stack.tsx
67
+ import React2, { Children as Children2 } from "react";
68
+ import flattenChildren2 from "react-keyed-flatten-children";
69
+ var ALIGNMENT2 = {
70
+ left: "flex-start",
71
+ center: "center",
72
+ right: "flex-end"
73
+ };
74
+ var Stack = (_a) => {
75
+ var _b = _a, {
76
+ space = "none",
77
+ align = "left",
78
+ children
79
+ } = _b, props = __objRest(_b, [
80
+ "space",
81
+ "align",
82
+ "children"
83
+ ]);
84
+ return /* @__PURE__ */ React2.createElement(Box, __spreadProps(__spreadValues({}, props), {
85
+ display: "flex",
86
+ flexDirection: "column",
87
+ alignItems: ALIGNMENT2[align],
88
+ css: { "> * + *": { pt: space } }
89
+ }), Children2.map(flattenChildren2(children), (child) => /* @__PURE__ */ React2.createElement(Box, null, React2.cloneElement(child, {}, child.props.children))));
90
+ };
91
+
92
+ // src/ActionGroup/ActionGroup.tsx
93
+ var ActionGroup = (_a) => {
94
+ var _b = _a, {
95
+ space = "none",
96
+ verticalAlignment = false,
97
+ children
98
+ } = _b, props = __objRest(_b, [
99
+ "space",
100
+ "verticalAlignment",
101
+ "children"
102
+ ]);
103
+ return verticalAlignment ? /* @__PURE__ */ React3.createElement(Stack, __spreadValues({
104
+ space
105
+ }, props), children) : /* @__PURE__ */ React3.createElement(Inline, __spreadValues({
106
+ space
107
+ }, props), children);
108
+ };
109
+
110
+ // src/Alert/Alert.tsx
111
+ import React4 from "react";
112
+ import { Exclamation, Check, Notification } from "@marigold/icons";
113
+ var ICON_MAP = {
114
+ success: Check,
115
+ warning: Notification,
116
+ error: Exclamation
117
+ };
118
+ var Alert = (_a) => {
119
+ var _b = _a, {
120
+ variant = "success",
121
+ children
122
+ } = _b, props = __objRest(_b, [
123
+ "variant",
124
+ "children"
125
+ ]);
126
+ const Icon = ICON_MAP[variant];
127
+ return /* @__PURE__ */ React4.createElement(Box, __spreadProps(__spreadValues({}, props), {
128
+ display: "flex",
129
+ variant: `alert.${variant}`
130
+ }), /* @__PURE__ */ React4.createElement(Box, {
131
+ display: "inline-block",
132
+ alignItems: "center",
133
+ width: "32px",
134
+ height: "32px",
135
+ bg: variant
136
+ }, /* @__PURE__ */ React4.createElement(Box, {
137
+ as: Icon,
138
+ size: 12,
139
+ color: "#fff",
140
+ bg: variant,
141
+ m: 10
142
+ })), /* @__PURE__ */ React4.createElement(Box, {
143
+ mx: "16px"
144
+ }, children));
145
+ };
146
+
147
+ // src/Badge/Badge.tsx
148
+ import React5 from "react";
149
+ var Badge = (_a) => {
150
+ var _b = _a, {
151
+ variant = "",
152
+ bgColor = "transparent",
153
+ borderColor = "transparent",
154
+ children
155
+ } = _b, props = __objRest(_b, [
156
+ "variant",
157
+ "bgColor",
158
+ "borderColor",
159
+ "children"
160
+ ]);
161
+ return /* @__PURE__ */ React5.createElement(Box, __spreadValues({
162
+ css: { bg: bgColor, borderColor },
163
+ variant: `badge.${variant}`
164
+ }, props), children);
165
+ };
166
+
167
+ // src/Button/Button.tsx
168
+ import React6, { forwardRef } from "react";
169
+ import { useButton } from "@react-aria/button";
170
+ var Button = forwardRef((_a, ref) => {
171
+ var _b = _a, {
172
+ as = "button",
173
+ variant = "primary",
174
+ size = "large",
175
+ space = "none",
176
+ disabled,
177
+ children,
178
+ className
179
+ } = _b, props = __objRest(_b, [
180
+ "as",
181
+ "variant",
182
+ "size",
183
+ "space",
184
+ "disabled",
185
+ "children",
186
+ "className"
187
+ ]);
188
+ const { buttonProps } = useButton(__spreadProps(__spreadValues({}, props), {
189
+ elementType: typeof as === "string" ? as : "span",
190
+ isDisabled: disabled
191
+ }), ref);
192
+ return /* @__PURE__ */ React6.createElement(Box, __spreadProps(__spreadValues(__spreadValues({}, buttonProps), props), {
193
+ as,
194
+ display: "inline-flex",
195
+ alignItems: "center",
196
+ variant: [`button.${variant}`, `button.${size}`],
197
+ className,
198
+ ref,
199
+ css: { columnGap: space }
200
+ }), children);
201
+ });
202
+
203
+ // src/Card/Card.tsx
204
+ import React7 from "react";
205
+ var Card = (_a) => {
206
+ var _b = _a, {
207
+ variant = "",
208
+ title,
209
+ width,
210
+ className,
211
+ children
212
+ } = _b, props = __objRest(_b, [
213
+ "variant",
214
+ "title",
215
+ "width",
216
+ "className",
217
+ "children"
218
+ ]);
219
+ return /* @__PURE__ */ React7.createElement(Box, __spreadProps(__spreadValues({}, props), {
220
+ variant: `card.${variant}`,
221
+ maxWidth: width,
222
+ className
223
+ }), title && /* @__PURE__ */ React7.createElement(Box, {
224
+ as: "h2",
225
+ variant: "text.h2",
226
+ pb: "small"
227
+ }, title), children);
228
+ };
229
+
230
+ // src/Checkbox/Checkbox.tsx
231
+ import React11 from "react";
232
+ import { useFocusRing } from "@react-aria/focus";
233
+ import { VisuallyHidden } from "@react-aria/visually-hidden";
234
+ import { useCheckbox } from "@react-aria/checkbox";
235
+
236
+ // ../../node_modules/@react-stately/utils/dist/module.js
237
+ import { useCallback, useRef, useState } from "react";
238
+ function useControlledState(value, defaultValue, onChange) {
239
+ let [stateValue, setStateValue] = useState(value || defaultValue);
240
+ let ref = useRef(value !== void 0);
241
+ let wasControlled = ref.current;
242
+ let isControlled = value !== void 0;
243
+ let stateRef = useRef(stateValue);
244
+ if (wasControlled !== isControlled) {
245
+ console.warn("WARN: A component changed from " + (wasControlled ? "controlled" : "uncontrolled") + " to " + (isControlled ? "controlled" : "uncontrolled") + ".");
246
+ }
247
+ ref.current = isControlled;
248
+ let setValue = useCallback(function(value2) {
249
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
250
+ args[_key - 1] = arguments[_key];
251
+ }
252
+ let onChangeCaller = function onChangeCaller2(value3) {
253
+ if (onChange) {
254
+ if (!Object.is(stateRef.current, value3)) {
255
+ for (var _len2 = arguments.length, onChangeArgs = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
256
+ onChangeArgs[_key2 - 1] = arguments[_key2];
257
+ }
258
+ onChange(value3, ...onChangeArgs);
259
+ }
260
+ }
261
+ if (!isControlled) {
262
+ stateRef.current = value3;
263
+ }
264
+ };
265
+ if (typeof value2 === "function") {
266
+ let updateFunction = function updateFunction2(oldValue) {
267
+ for (var _len3 = arguments.length, functionArgs = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
268
+ functionArgs[_key3 - 1] = arguments[_key3];
269
+ }
270
+ let interceptedValue = value2(isControlled ? stateRef.current : oldValue, ...functionArgs);
271
+ onChangeCaller(interceptedValue, ...args);
272
+ if (!isControlled) {
273
+ return interceptedValue;
274
+ }
275
+ return oldValue;
276
+ };
277
+ setStateValue(updateFunction);
278
+ } else {
279
+ if (!isControlled) {
280
+ setStateValue(value2);
281
+ }
282
+ onChangeCaller(value2, ...args);
283
+ }
284
+ }, [isControlled, onChange]);
285
+ if (isControlled) {
286
+ stateRef.current = value;
287
+ } else {
288
+ value = stateValue;
289
+ }
290
+ return [value, setValue];
291
+ }
292
+
293
+ // ../../node_modules/@react-stately/toggle/dist/module.js
294
+ function useToggleState(props) {
295
+ if (props === void 0) {
296
+ props = {};
297
+ }
298
+ let {
299
+ isReadOnly,
300
+ onChange
301
+ } = props;
302
+ let [isSelected, setSelected] = useControlledState(props.isSelected, props.defaultSelected || false, () => {
303
+ });
304
+ function updateSelected(value) {
305
+ if (!isReadOnly) {
306
+ setSelected(value);
307
+ if (onChange) {
308
+ onChange(value);
309
+ }
310
+ }
311
+ }
312
+ function toggleState() {
313
+ if (!isReadOnly) {
314
+ setSelected((prev) => {
315
+ let newVal = !prev;
316
+ if (onChange) {
317
+ onChange(newVal);
318
+ }
319
+ return newVal;
320
+ });
321
+ }
322
+ }
323
+ return {
324
+ isSelected,
325
+ setSelected: updateSelected,
326
+ toggle: toggleState
327
+ };
328
+ }
329
+
330
+ // src/Checkbox/Checkbox.tsx
331
+ import { Exclamation as Exclamation2 } from "@marigold/icons";
332
+
333
+ // src/Checkbox/CheckboxIcons.tsx
334
+ import React8 from "react";
335
+ import { conditional, SVG } from "@marigold/system";
336
+ var CheckboxIcon = ({
337
+ variant = "",
338
+ checked = false,
339
+ disabled = false,
340
+ error = false
341
+ }) => {
342
+ const conditionalStates = disabled ? {
343
+ disabled
344
+ } : {
345
+ checked,
346
+ error
347
+ };
348
+ return /* @__PURE__ */ React8.createElement(SVG, {
349
+ width: "16",
350
+ height: "32",
351
+ viewBox: "0 0 16 32",
352
+ fill: "none",
353
+ "aria-hidden": "true"
354
+ }, /* @__PURE__ */ React8.createElement(Box, {
355
+ as: "rect",
356
+ x: "0.5",
357
+ y: "8.5",
358
+ width: "15px",
359
+ height: "15px",
360
+ rx: "1.5",
361
+ variant: conditional(`checkbox.${variant}`, conditionalStates)
362
+ }), checked && /* @__PURE__ */ React8.createElement(Box, {
363
+ __baseCSS: { fill: "gray00" },
364
+ as: "path",
365
+ fillRule: "evenodd",
366
+ clipRule: "evenodd",
367
+ d: "M13.9571 12.8338L12.4085 11.2852L6.08699 17.6007L3.59887 15.1126L2.04163 16.6588L6.08682 20.704L13.9571 12.8338Z"
368
+ }));
369
+ };
370
+
371
+ // src/Label/Label.tsx
372
+ import React9 from "react";
373
+ import { Required } from "@marigold/icons";
374
+ var LabelBase = (_a) => {
375
+ var _b = _a, {
376
+ variant = "above",
377
+ required,
378
+ color = "text",
379
+ children
380
+ } = _b, props = __objRest(_b, [
381
+ "variant",
382
+ "required",
383
+ "color",
384
+ "children"
385
+ ]);
386
+ return /* @__PURE__ */ React9.createElement(Box, __spreadProps(__spreadValues({}, props), {
387
+ as: "label",
388
+ __baseCSS: { color },
389
+ variant: `label.${variant}`
390
+ }), children);
391
+ };
392
+ var Label = (_a) => {
393
+ var _b = _a, {
394
+ required,
395
+ children
396
+ } = _b, props = __objRest(_b, [
397
+ "required",
398
+ "children"
399
+ ]);
400
+ return required ? /* @__PURE__ */ React9.createElement(Box, {
401
+ as: "span",
402
+ display: "inline-flex",
403
+ alignItems: "center"
404
+ }, /* @__PURE__ */ React9.createElement(LabelBase, __spreadValues({}, props), children), required && /* @__PURE__ */ React9.createElement(Box, {
405
+ as: Required,
406
+ size: 16,
407
+ css: { color: "error" }
408
+ })) : /* @__PURE__ */ React9.createElement(LabelBase, __spreadValues({}, props), children);
409
+ };
410
+
411
+ // src/ValidationMessage/ValidationMessage.tsx
412
+ import React10 from "react";
413
+ var ValidationMessage = (_a) => {
414
+ var _b = _a, {
415
+ variant = "error",
416
+ children,
417
+ className
418
+ } = _b, props = __objRest(_b, [
419
+ "variant",
420
+ "children",
421
+ "className"
422
+ ]);
423
+ return /* @__PURE__ */ React10.createElement(Box, __spreadValues({
424
+ as: "span",
425
+ display: "flex",
426
+ alignItems: "center",
427
+ variant: `validation.${variant}`,
428
+ className
429
+ }, props), children);
430
+ };
431
+
432
+ // src/Checkbox/Checkbox.tsx
433
+ var CheckboxInput = (_a) => {
434
+ var _b = _a, { error } = _b, props = __objRest(_b, ["error"]);
435
+ const state = useToggleState(props);
436
+ const ref = React11.useRef(null);
437
+ const { inputProps } = useCheckbox(props, state, ref);
438
+ const { focusProps } = useFocusRing();
439
+ return /* @__PURE__ */ React11.createElement(Box, {
440
+ pr: "xsmall"
441
+ }, /* @__PURE__ */ React11.createElement(VisuallyHidden, null, /* @__PURE__ */ React11.createElement(Box, __spreadValues(__spreadProps(__spreadValues(__spreadValues({
442
+ as: "input",
443
+ type: "checkbox",
444
+ disabled: props.disabled
445
+ }, inputProps), focusProps), {
446
+ ref
447
+ }), props))), /* @__PURE__ */ React11.createElement(CheckboxIcon, {
448
+ checked: props.checked,
449
+ variant: props.variant,
450
+ disabled: props.disabled,
451
+ error
452
+ }));
453
+ };
454
+ var Checkbox = (_a) => {
455
+ var _b = _a, {
456
+ label,
457
+ required,
458
+ labelVariant = "inline",
459
+ error,
460
+ errorMessage
461
+ } = _b, props = __objRest(_b, [
462
+ "label",
463
+ "required",
464
+ "labelVariant",
465
+ "error",
466
+ "errorMessage"
467
+ ]);
468
+ return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(Box, {
469
+ as: Label,
470
+ __baseCSS: {
471
+ ":hover": { cursor: props.disabled ? "not-allowed" : "pointer" }
472
+ },
473
+ htmlFor: props.id,
474
+ required,
475
+ variant: `label.${labelVariant}`,
476
+ color: props.disabled ? "disabled" : "text"
477
+ }, /* @__PURE__ */ React11.createElement(Box, __spreadValues({
478
+ as: CheckboxInput,
479
+ error
480
+ }, props)), label), error && errorMessage && /* @__PURE__ */ React11.createElement(ValidationMessage, null, /* @__PURE__ */ React11.createElement(Exclamation2, {
481
+ size: 16
482
+ }), errorMessage));
483
+ };
484
+
485
+ // src/Column/Column.tsx
486
+ import React12 from "react";
487
+ var transform = (width) => {
488
+ if (Array.isArray(width)) {
489
+ return width.map((v) => `${v / 12 * 100}%`);
490
+ }
491
+ return `${width / 12 * 100}%`;
492
+ };
493
+ var Column = (_a) => {
494
+ var _b = _a, {
495
+ width = 12,
496
+ children
497
+ } = _b, props = __objRest(_b, [
498
+ "width",
499
+ "children"
500
+ ]);
501
+ return /* @__PURE__ */ React12.createElement(Box, __spreadProps(__spreadValues({}, props), {
502
+ width: transform(width)
503
+ }), children);
504
+ };
505
+
506
+ // src/Columns/Columns.tsx
507
+ import React13, { Children as Children3 } from "react";
508
+ import flattenChildren3 from "react-keyed-flatten-children";
509
+ import { useTheme } from "@marigold/system";
510
+ var useAlignment = (direction) => {
511
+ switch (direction) {
512
+ case "right":
513
+ return "flex-end";
514
+ case "bottom":
515
+ return "flex-end";
516
+ case "center":
517
+ return "center";
518
+ }
519
+ return "flex-start";
520
+ };
521
+ var Columns = (_a) => {
522
+ var _b = _a, {
523
+ space = "none",
524
+ horizontalAlign = "left",
525
+ verticalAlign = "top",
526
+ className,
527
+ children
528
+ } = _b, props = __objRest(_b, [
529
+ "space",
530
+ "horizontalAlign",
531
+ "verticalAlign",
532
+ "className",
533
+ "children"
534
+ ]);
535
+ const justifyContent = useAlignment(horizontalAlign);
536
+ const alignItems = useAlignment(verticalAlign);
537
+ const { css } = useTheme();
538
+ const spaceObject = css({ space });
539
+ const spaceValue = Object.values(spaceObject)[0];
540
+ return /* @__PURE__ */ React13.createElement(Box, {
541
+ p: space,
542
+ display: "flex",
543
+ className
544
+ }, /* @__PURE__ */ React13.createElement(Box, __spreadValues({
545
+ width: `calc(100% + ${spaceValue}px)`,
546
+ m: `${-spaceValue / 2}px`,
547
+ display: "flex",
548
+ flexWrap: "wrap",
549
+ alignItems,
550
+ justifyContent
551
+ }, props), Children3.map(flattenChildren3(children), (child) => {
552
+ return React13.cloneElement(child, {}, /* @__PURE__ */ React13.createElement(Box, {
553
+ css: { p: `${spaceValue / 2}px` }
554
+ }, child.props.children));
555
+ })));
556
+ };
557
+
558
+ // src/Dialog/Dialog.tsx
559
+ import React16 from "react";
560
+ import { useOverlayTriggerState } from "@react-stately/overlays";
561
+ import { OverlayContainer } from "@react-aria/overlays";
562
+ import { useButton as useButton2 } from "@react-aria/button";
563
+ import { Close } from "@marigold/icons";
564
+
565
+ // src/Text/Text.tsx
566
+ import React14, { forwardRef as forwardRef2 } from "react";
567
+ var Text = forwardRef2((_a, ref) => {
568
+ var _b = _a, {
569
+ as = "span",
570
+ variant = "body",
571
+ children,
572
+ className,
573
+ align,
574
+ color,
575
+ cursor,
576
+ outline,
577
+ userSelect
578
+ } = _b, props = __objRest(_b, [
579
+ "as",
580
+ "variant",
581
+ "children",
582
+ "className",
583
+ "align",
584
+ "color",
585
+ "cursor",
586
+ "outline",
587
+ "userSelect"
588
+ ]);
589
+ return /* @__PURE__ */ React14.createElement(Box, __spreadProps(__spreadValues({}, props), {
590
+ as,
591
+ variant: `text.${variant}`,
592
+ css: { textAlign: align, color, cursor, outline, userSelect },
593
+ className,
594
+ ref
595
+ }), children);
596
+ });
597
+
598
+ // src/Dialog/ModalDialog.tsx
599
+ import React15 from "react";
600
+ import {
601
+ useOverlay,
602
+ usePreventScroll,
603
+ useModal
604
+ } from "@react-aria/overlays";
605
+ import { useDialog } from "@react-aria/dialog";
606
+ import { FocusScope } from "@react-aria/focus";
607
+ var ModalDialog = (_a) => {
608
+ var _b = _a, {
609
+ variant,
610
+ backdropVariant = "backdrop",
611
+ children
612
+ } = _b, props = __objRest(_b, [
613
+ "variant",
614
+ "backdropVariant",
615
+ "children"
616
+ ]);
617
+ const _a2 = props, { isDismissable, isOpen, onClose } = _a2, restProps = __objRest(_a2, ["isDismissable", "isOpen", "onClose"]);
618
+ const ref = React15.useRef();
619
+ const { overlayProps, underlayProps } = useOverlay({ isDismissable, isOpen, onClose }, ref);
620
+ usePreventScroll();
621
+ const { modalProps } = useModal();
622
+ const { dialogProps } = useDialog(props, ref);
623
+ return /* @__PURE__ */ React15.createElement(Box, __spreadValues({
624
+ __baseCSS: {
625
+ display: "grid",
626
+ placeItems: "center",
627
+ position: "fixed",
628
+ zIndex: 100,
629
+ top: 0,
630
+ left: 0,
631
+ bottom: 0,
632
+ right: 0
633
+ },
634
+ variant: `dialog.${backdropVariant}`
635
+ }, underlayProps), /* @__PURE__ */ React15.createElement(FocusScope, {
636
+ contain: true,
637
+ restoreFocus: true,
638
+ autoFocus: true
639
+ }, /* @__PURE__ */ React15.createElement(Box, __spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, overlayProps), dialogProps), modalProps), {
640
+ ref,
641
+ variant: variant ? `dialog.${variant}` : `dialog`
642
+ }), restProps), children)));
643
+ };
644
+
645
+ // src/Dialog/Dialog.tsx
646
+ var Dialog = (_a) => {
647
+ var _b = _a, {
648
+ backdropVariant,
649
+ children,
650
+ className,
651
+ close,
652
+ isOpen,
653
+ title,
654
+ variant
655
+ } = _b, props = __objRest(_b, [
656
+ "backdropVariant",
657
+ "children",
658
+ "className",
659
+ "close",
660
+ "isOpen",
661
+ "title",
662
+ "variant"
663
+ ]);
664
+ const closeButtonRef = React16.useRef();
665
+ const { buttonProps: closeButtonProps } = useButton2({
666
+ onPress: () => close()
667
+ }, closeButtonRef);
668
+ return /* @__PURE__ */ React16.createElement(OverlayContainer, null, /* @__PURE__ */ React16.createElement(ModalDialog, __spreadValues({
669
+ variant,
670
+ backdropVariant,
671
+ isOpen,
672
+ onClose: close,
673
+ isDismissable: true
674
+ }, props), /* @__PURE__ */ React16.createElement(Box, {
675
+ __baseCSS: {
676
+ display: "flex",
677
+ justifyContent: "space-between",
678
+ borderRadius: "small",
679
+ pl: "large",
680
+ pb: "large"
681
+ },
682
+ className
683
+ }, /* @__PURE__ */ React16.createElement(Box, {
684
+ pt: "medium"
685
+ }, title && /* @__PURE__ */ React16.createElement(Text, {
686
+ as: "h4",
687
+ variant: "headline4"
688
+ }, title), children), /* @__PURE__ */ React16.createElement(Box, {
689
+ __baseCSS: {
690
+ display: "flex",
691
+ justifyContent: "flex-end",
692
+ alignItems: "start",
693
+ paddingTop: "xsmall",
694
+ paddingX: "xsmall"
695
+ }
696
+ }, /* @__PURE__ */ React16.createElement(Box, __spreadProps(__spreadValues({
697
+ as: Button,
698
+ __baseCSS: {
699
+ color: "text",
700
+ bg: "transparent",
701
+ lineHeight: "xsmall",
702
+ px: "xxsmall",
703
+ ":hover": {
704
+ color: "text",
705
+ bg: "transparent",
706
+ cursor: "pointer"
707
+ },
708
+ ":focus": {
709
+ outline: 0
710
+ }
711
+ }
712
+ }, closeButtonProps), {
713
+ ref: closeButtonRef
714
+ }), /* @__PURE__ */ React16.createElement(Close, {
715
+ size: 16
716
+ }))))));
717
+ };
718
+ var useDialogButtonProps = () => {
719
+ const state = useOverlayTriggerState({});
720
+ const openButtonRef = React16.useRef();
721
+ const { buttonProps: openButtonProps } = useButton2({
722
+ onPress: () => state.open()
723
+ }, openButtonRef);
724
+ return {
725
+ state,
726
+ openButtonProps,
727
+ openButtonRef
728
+ };
729
+ };
730
+
731
+ // src/Divider/Divider.tsx
732
+ import React17 from "react";
733
+ import { useSeparator } from "@react-aria/separator";
734
+ var Divider = (_a) => {
735
+ var _b = _a, { variant = "" } = _b, props = __objRest(_b, ["variant"]);
736
+ const { separatorProps } = useSeparator(props);
737
+ return /* @__PURE__ */ React17.createElement(Box, __spreadValues(__spreadValues({
738
+ __baseCSS: { width: "100%", height: "1px", m: "none", bg: "text" },
739
+ variant: `divider.${variant}`
740
+ }, props), separatorProps));
741
+ };
742
+
743
+ // src/Field/Field.tsx
744
+ import React18, { useRef as useRef2 } from "react";
745
+ import { useTextField } from "@react-aria/textfield";
746
+ import { Exclamation as Exclamation3 } from "@marigold/icons";
747
+ var Field = (_a) => {
748
+ var _b = _a, {
749
+ type = "text",
750
+ variant = "",
751
+ labelVariant = "above",
752
+ htmlFor,
753
+ required,
754
+ error,
755
+ errorMessage
756
+ } = _b, props = __objRest(_b, [
757
+ "type",
758
+ "variant",
759
+ "labelVariant",
760
+ "htmlFor",
761
+ "required",
762
+ "error",
763
+ "errorMessage"
764
+ ]);
765
+ const ref = useRef2(null);
766
+ const { labelProps, inputProps, errorMessageProps } = useTextField(props, ref);
767
+ return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(Label, __spreadValues({
768
+ variant: labelVariant,
769
+ htmlFor,
770
+ required
771
+ }, labelProps), props.label), /* @__PURE__ */ React18.createElement(Box, __spreadValues(__spreadProps(__spreadValues({
772
+ as: "input",
773
+ type,
774
+ id: htmlFor,
775
+ variant: `input.${variant}`
776
+ }, inputProps), {
777
+ ref
778
+ }), props)), error && errorMessage && /* @__PURE__ */ React18.createElement(ValidationMessage, __spreadValues({}, errorMessageProps), /* @__PURE__ */ React18.createElement(Exclamation3, {
779
+ size: 16
780
+ }), errorMessage));
781
+ };
782
+
783
+ // src/VisuallyHidden/VisuallyHidden.tsx
784
+ import { VisuallyHidden as VisuallyHidden2 } from "@react-aria/visually-hidden";
785
+
786
+ // src/Image/Image.tsx
787
+ import React19 from "react";
788
+ var Image = (_a) => {
789
+ var _b = _a, {
790
+ variant = "fullWidth"
791
+ } = _b, props = __objRest(_b, [
792
+ "variant"
793
+ ]);
794
+ return /* @__PURE__ */ React19.createElement(Box, __spreadProps(__spreadValues({}, props), {
795
+ as: "img",
796
+ variant: `image.${variant}`
797
+ }));
798
+ };
799
+
800
+ // src/Link/Link.tsx
801
+ import React20, { useRef as useRef3 } from "react";
802
+ import { useLink } from "@react-aria/link";
803
+ var Link = (_a) => {
804
+ var _b = _a, {
805
+ as = "a",
806
+ variant = "link",
807
+ children,
808
+ disabled
809
+ } = _b, props = __objRest(_b, [
810
+ "as",
811
+ "variant",
812
+ "children",
813
+ "disabled"
814
+ ]);
815
+ const ref = useRef3();
816
+ const { linkProps } = useLink(__spreadProps(__spreadValues({}, props), {
817
+ elementType: typeof as === "string" ? as : "span",
818
+ isDisabled: disabled
819
+ }), ref);
820
+ return /* @__PURE__ */ React20.createElement(Text, __spreadProps(__spreadValues(__spreadValues({}, props), linkProps), {
821
+ as,
822
+ variant,
823
+ ref
824
+ }), children);
825
+ };
826
+
827
+ // src/Menu/Menu.tsx
828
+ import React21 from "react";
829
+ var Menu = (_a) => {
830
+ var _b = _a, {
831
+ variant = "default",
832
+ label = "Menu",
833
+ onClick,
834
+ show = false,
835
+ children
836
+ } = _b, props = __objRest(_b, [
837
+ "variant",
838
+ "label",
839
+ "onClick",
840
+ "show",
841
+ "children"
842
+ ]);
843
+ return /* @__PURE__ */ React21.createElement(Box, __spreadValues({
844
+ variant: `menu.${variant}`
845
+ }, props), /* @__PURE__ */ React21.createElement(Button, {
846
+ onClick,
847
+ variant: "menu"
848
+ }, label), show ? /* @__PURE__ */ React21.createElement(Box, {
849
+ display: "block",
850
+ position: "absolute",
851
+ minWidth: "120px",
852
+ borderRadius: "2px"
853
+ }, children) : null);
854
+ };
855
+
856
+ // src/MenuItem/MenuItem.tsx
857
+ import React22 from "react";
858
+ var MenuItem = (_a) => {
859
+ var _b = _a, {
860
+ variant = "default",
861
+ className,
862
+ children
863
+ } = _b, props = __objRest(_b, [
864
+ "variant",
865
+ "className",
866
+ "children"
867
+ ]);
868
+ return /* @__PURE__ */ React22.createElement(Box, {
869
+ variant: `menuItem.${variant}`,
870
+ className
871
+ }, /* @__PURE__ */ React22.createElement(Link, __spreadValues({
872
+ variant: "menuItemLink"
873
+ }, props), children));
874
+ };
875
+
876
+ // src/Message/Message.tsx
877
+ import React23 from "react";
878
+ import { Exclamation as Exclamation4, Info, Notification as Notification2 } from "@marigold/icons";
879
+ var Message = (_a) => {
880
+ var _b = _a, {
881
+ messageTitle,
882
+ variant = "info",
883
+ className,
884
+ children
885
+ } = _b, props = __objRest(_b, [
886
+ "messageTitle",
887
+ "variant",
888
+ "className",
889
+ "children"
890
+ ]);
891
+ var icon = /* @__PURE__ */ React23.createElement(Info, null);
892
+ if (variant === "warning") {
893
+ icon = /* @__PURE__ */ React23.createElement(Notification2, null);
894
+ }
895
+ if (variant === "error") {
896
+ icon = /* @__PURE__ */ React23.createElement(Exclamation4, null);
897
+ }
898
+ return /* @__PURE__ */ React23.createElement(Box, __spreadValues({
899
+ display: "inline-block",
900
+ variant: `message.${variant}`,
901
+ className
902
+ }, props), /* @__PURE__ */ React23.createElement(Box, {
903
+ display: "flex",
904
+ alignItems: "center",
905
+ variant: "message.title"
906
+ }, icon, /* @__PURE__ */ React23.createElement(Text, {
907
+ as: "h4",
908
+ variant: "headline4"
909
+ }, messageTitle)), /* @__PURE__ */ React23.createElement(Box, {
910
+ css: { color: "black" }
911
+ }, children));
912
+ };
913
+
914
+ // src/Provider/index.ts
915
+ import { useTheme as useTheme3, ThemeProvider as ThemeProvider2 } from "@marigold/system";
916
+ import { SSRProvider } from "@react-aria/ssr";
917
+
918
+ // src/Provider/MarigoldProvider.tsx
919
+ import React24 from "react";
920
+ import { OverlayProvider } from "@react-aria/overlays";
921
+ import {
922
+ Global,
923
+ ThemeProvider,
924
+ useTheme as useTheme2,
925
+ __defaultTheme
926
+ } from "@marigold/system";
927
+ function MarigoldProvider({
928
+ theme,
929
+ children
930
+ }) {
931
+ const outer = useTheme2();
932
+ const isTopLevel = outer.theme === __defaultTheme;
933
+ return /* @__PURE__ */ React24.createElement(ThemeProvider, {
934
+ theme
935
+ }, isTopLevel ? /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(Global, null), /* @__PURE__ */ React24.createElement(OverlayProvider, null, children)) : children);
936
+ }
937
+
938
+ // src/Radio/Radio.tsx
939
+ import React26 from "react";
940
+ import { Exclamation as Exclamation5 } from "@marigold/icons";
941
+ import { useFocusRing as useFocusRing2 } from "@react-aria/focus";
942
+ import { VisuallyHidden as VisuallyHidden3 } from "@react-aria/visually-hidden";
943
+
944
+ // src/Radio/RadioIcon.tsx
945
+ import React25 from "react";
946
+ import { conditional as conditional2, SVG as SVG2 } from "@marigold/system";
947
+ var RadioIcon = ({
948
+ variant = "",
949
+ checked = false,
950
+ disabled = false,
951
+ error = false
952
+ }) => {
953
+ const conditionalStates = disabled ? {
954
+ disabled
955
+ } : {
956
+ checked,
957
+ error
958
+ };
959
+ return /* @__PURE__ */ React25.createElement(SVG2, {
960
+ width: "16",
961
+ height: "32",
962
+ viewBox: "0 0 16 32",
963
+ fill: "none",
964
+ "aria-hidden": "true"
965
+ }, /* @__PURE__ */ React25.createElement(Box, {
966
+ variant: conditional2(`radio.${variant}`, conditionalStates),
967
+ as: "circle",
968
+ cx: "8",
969
+ cy: "16",
970
+ r: "7.5"
971
+ }), checked && /* @__PURE__ */ React25.createElement("circle", {
972
+ fill: "white",
973
+ cx: "8",
974
+ cy: "16",
975
+ r: "3"
976
+ }));
977
+ };
978
+
979
+ // src/Radio/Radio.tsx
980
+ var RadioInput = (_a) => {
981
+ var _b = _a, { error } = _b, props = __objRest(_b, ["error"]);
982
+ const { focusProps } = useFocusRing2();
983
+ return /* @__PURE__ */ React26.createElement(Box, {
984
+ pr: "xsmall"
985
+ }, /* @__PURE__ */ React26.createElement(VisuallyHidden3, null, /* @__PURE__ */ React26.createElement("input", __spreadValues(__spreadValues({
986
+ type: "radio",
987
+ disabled: props.disabled
988
+ }, focusProps), props))), /* @__PURE__ */ React26.createElement(RadioIcon, {
989
+ variant: props.variant,
990
+ disabled: props.disabled,
991
+ checked: props.checked,
992
+ error
993
+ }));
994
+ };
995
+ var Radio = (_a) => {
996
+ var _b = _a, {
997
+ label,
998
+ required,
999
+ labelVariant = "inline",
1000
+ error,
1001
+ errorMessage
1002
+ } = _b, props = __objRest(_b, [
1003
+ "label",
1004
+ "required",
1005
+ "labelVariant",
1006
+ "error",
1007
+ "errorMessage"
1008
+ ]);
1009
+ return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(Box, {
1010
+ as: Label,
1011
+ htmlFor: props.id,
1012
+ required,
1013
+ variant: `label.${labelVariant}`,
1014
+ css: props.disabled ? { color: "disabled", ":hover": { cursor: "not-allowed" } } : { color: "text", ":hover": { cursor: "pointer" } }
1015
+ }, /* @__PURE__ */ React26.createElement(Box, __spreadValues({
1016
+ as: RadioInput,
1017
+ error
1018
+ }, props)), label), error && errorMessage && /* @__PURE__ */ React26.createElement(ValidationMessage, null, /* @__PURE__ */ React26.createElement(Exclamation5, {
1019
+ size: 16
1020
+ }), errorMessage));
1021
+ };
1022
+
1023
+ // src/Slider/Slider.tsx
1024
+ import React27 from "react";
1025
+ var Slider = (_a) => {
1026
+ var _b = _a, {
1027
+ variant = "",
1028
+ className
1029
+ } = _b, props = __objRest(_b, [
1030
+ "variant",
1031
+ "className"
1032
+ ]);
1033
+ return /* @__PURE__ */ React27.createElement(Box, __spreadValues({
1034
+ as: "input",
1035
+ type: "range",
1036
+ css: { verticalAlign: "middle" },
1037
+ variant: `slider.${variant}`,
1038
+ className
1039
+ }, props));
1040
+ };
1041
+
1042
+ // src/Select/Select.tsx
1043
+ import React32, { useRef as useRef6 } from "react";
1044
+ import { useSelectState } from "@react-stately/select";
1045
+ import { useButton as useButton3 } from "@react-aria/button";
1046
+ import { mergeProps as mergeProps2 } from "@react-aria/utils";
1047
+ import { useFocusRing as useFocusRing3 } from "@react-aria/focus";
1048
+ import { HiddenSelect, useSelect } from "@react-aria/select";
1049
+ import { useOverlayTriggerState as useOverlayTriggerState2 } from "@react-stately/overlays";
1050
+ import { useOverlayTrigger, useOverlayPosition } from "@react-aria/overlays";
1051
+ import { ArrowDown, ArrowUp, Exclamation as Exclamation6, Required as Required2 } from "@marigold/icons";
1052
+
1053
+ // src/Select/ListBox.tsx
1054
+ import React30, { useRef as useRef5 } from "react";
1055
+ import { useListBox } from "@react-aria/listbox";
1056
+
1057
+ // src/Select/Option.tsx
1058
+ import React28, { useEffect, useRef as useRef4, useState as useState2 } from "react";
1059
+ import { useOption } from "@react-aria/listbox";
1060
+ var Option = ({ item, state }) => {
1061
+ const ref = useRef4(null);
1062
+ const [disabled, setDisabled] = useState2(false);
1063
+ const { optionProps, isSelected } = useOption({
1064
+ key: item.key
1065
+ }, state, ref);
1066
+ useEffect(() => {
1067
+ for (const key of state.disabledKeys.values()) {
1068
+ if (key === item.key) {
1069
+ setDisabled(true);
1070
+ }
1071
+ }
1072
+ }, [state.disabledKeys, item.key]);
1073
+ return /* @__PURE__ */ React28.createElement(Box, __spreadProps(__spreadValues({
1074
+ as: "li"
1075
+ }, optionProps), {
1076
+ ref,
1077
+ variant: isSelected ? "select.option.selected" : disabled ? "select.option.disabled" : "select.option"
1078
+ }), item.rendered);
1079
+ };
1080
+
1081
+ // src/Select/ListBoxSection.tsx
1082
+ import React29 from "react";
1083
+ import { useListBoxSection } from "@react-aria/listbox";
1084
+ var ListBoxSection = ({ section, state }) => {
1085
+ const { itemProps, headingProps, groupProps } = useListBoxSection({
1086
+ heading: section.rendered,
1087
+ "aria-label": section["aria-label"]
1088
+ });
1089
+ return /* @__PURE__ */ React29.createElement(Box, __spreadProps(__spreadValues({
1090
+ as: "li"
1091
+ }, itemProps), {
1092
+ css: {
1093
+ cursor: "not-allowed"
1094
+ }
1095
+ }), section.rendered && /* @__PURE__ */ React29.createElement(Box, __spreadProps(__spreadValues({
1096
+ as: "span"
1097
+ }, headingProps), {
1098
+ variant: "select.section"
1099
+ }), section.rendered), /* @__PURE__ */ React29.createElement(Box, __spreadValues({
1100
+ as: "ul"
1101
+ }, groupProps), [...section.childNodes].map((node) => /* @__PURE__ */ React29.createElement(Option, {
1102
+ key: node.key,
1103
+ item: node,
1104
+ state
1105
+ }))));
1106
+ };
1107
+
1108
+ // src/Select/ListBox.tsx
1109
+ var ListBox = (props) => {
1110
+ const ref = useRef5(null);
1111
+ const { state, error } = props;
1112
+ const { listBoxProps } = useListBox(props, state, ref);
1113
+ return /* @__PURE__ */ React30.createElement(Box, __spreadProps(__spreadValues({
1114
+ as: "ul",
1115
+ p: "none",
1116
+ css: {
1117
+ listStyle: "none"
1118
+ }
1119
+ }, listBoxProps), {
1120
+ variant: error ? "select.listbox.error" : "select.listbox",
1121
+ ref
1122
+ }), [...state.collection].map((item) => item.type === "section" ? /* @__PURE__ */ React30.createElement(ListBoxSection, {
1123
+ key: item.key,
1124
+ section: item,
1125
+ state
1126
+ }) : /* @__PURE__ */ React30.createElement(Option, {
1127
+ key: item.key,
1128
+ item,
1129
+ state
1130
+ })));
1131
+ };
1132
+
1133
+ // src/Select/Popover.tsx
1134
+ import React31, { forwardRef as forwardRef3 } from "react";
1135
+ import { FocusScope as FocusScope2 } from "@react-aria/focus";
1136
+ import {
1137
+ DismissButton,
1138
+ OverlayContainer as OverlayContainer2,
1139
+ useModal as useModal2,
1140
+ useOverlay as useOverlay2
1141
+ } from "@react-aria/overlays";
1142
+ import { mergeProps } from "@react-aria/utils";
1143
+ var Popover = forwardRef3((_a, ref) => {
1144
+ var _b = _a, { children, className, isOpen, onClose } = _b, otherProps = __objRest(_b, ["children", "className", "isOpen", "onClose"]);
1145
+ const { overlayProps } = useOverlay2({
1146
+ isOpen,
1147
+ onClose,
1148
+ shouldCloseOnBlur: true,
1149
+ isDismissable: true
1150
+ }, ref);
1151
+ const { modalProps } = useModal2();
1152
+ return /* @__PURE__ */ React31.createElement(OverlayContainer2, null, /* @__PURE__ */ React31.createElement(FocusScope2, {
1153
+ restoreFocus: true
1154
+ }, /* @__PURE__ */ React31.createElement(Box, __spreadProps(__spreadValues({}, mergeProps(overlayProps, otherProps, modalProps)), {
1155
+ className,
1156
+ ref
1157
+ }), children, /* @__PURE__ */ React31.createElement(DismissButton, {
1158
+ onDismiss: onClose
1159
+ }))));
1160
+ });
1161
+
1162
+ // src/Select/Select.tsx
1163
+ var Select = (_a) => {
1164
+ var _b = _a, {
1165
+ labelVariant = "above",
1166
+ placeholder = "Select an option",
1167
+ disabled,
1168
+ required,
1169
+ error,
1170
+ errorMessage,
1171
+ width,
1172
+ className
1173
+ } = _b, props = __objRest(_b, [
1174
+ "labelVariant",
1175
+ "placeholder",
1176
+ "disabled",
1177
+ "required",
1178
+ "error",
1179
+ "errorMessage",
1180
+ "width",
1181
+ "className"
1182
+ ]);
1183
+ const state = useSelectState(props);
1184
+ const overlayTriggerState = useOverlayTriggerState2({});
1185
+ const triggerRef = useRef6();
1186
+ const overlayRef = useRef6();
1187
+ const { overlayProps } = useOverlayTrigger({ type: "listbox" }, overlayTriggerState, triggerRef);
1188
+ const { overlayProps: positionProps } = useOverlayPosition({
1189
+ targetRef: triggerRef,
1190
+ overlayRef,
1191
+ placement: "bottom",
1192
+ shouldFlip: false,
1193
+ isOpen: state.isOpen,
1194
+ onClose: state.close
1195
+ });
1196
+ const { labelProps, triggerProps, valueProps, menuProps } = useSelect(props, state, triggerRef);
1197
+ const { buttonProps } = useButton3(triggerProps, triggerRef);
1198
+ const { focusProps } = useFocusRing3();
1199
+ return /* @__PURE__ */ React32.createElement(Box, {
1200
+ position: "relative",
1201
+ display: "inline-block",
1202
+ width: width && width
1203
+ }, props.label && /* @__PURE__ */ React32.createElement(Box, null, /* @__PURE__ */ React32.createElement(Label, __spreadProps(__spreadValues({}, labelProps), {
1204
+ htmlFor: labelProps.id,
1205
+ variant: labelVariant
1206
+ }), required ? /* @__PURE__ */ React32.createElement(Box, {
1207
+ as: "span",
1208
+ display: "inline-flex",
1209
+ alignItems: "center"
1210
+ }, props.label, /* @__PURE__ */ React32.createElement(Box, {
1211
+ as: Required2,
1212
+ size: 16,
1213
+ css: { color: "error" }
1214
+ })) : props.label)), /* @__PURE__ */ React32.createElement(HiddenSelect, {
1215
+ state,
1216
+ triggerRef,
1217
+ label: props.label,
1218
+ name: props.name,
1219
+ isDisabled: disabled
1220
+ }), /* @__PURE__ */ React32.createElement(Box, __spreadProps(__spreadValues({
1221
+ as: "button"
1222
+ }, mergeProps2(buttonProps, focusProps)), {
1223
+ ref: triggerRef,
1224
+ variant: error && state.isOpen && !disabled ? "button.select.errorOpened" : error ? "button.select.error" : state.isOpen && !disabled ? "button.select.open" : "button.select",
1225
+ disabled,
1226
+ className
1227
+ }), /* @__PURE__ */ React32.createElement(Box, __spreadProps(__spreadValues({
1228
+ as: "span"
1229
+ }, valueProps), {
1230
+ variant: disabled ? "select.disabled" : "select"
1231
+ }), state.selectedItem ? state.selectedItem.rendered : placeholder), state.isOpen && !disabled ? /* @__PURE__ */ React32.createElement(Box, {
1232
+ as: ArrowUp,
1233
+ size: 16,
1234
+ css: { fill: "text" }
1235
+ }) : /* @__PURE__ */ React32.createElement(Box, {
1236
+ as: ArrowDown,
1237
+ size: 16,
1238
+ css: { fill: disabled ? "disabled" : "text" }
1239
+ })), state.isOpen && !disabled && /* @__PURE__ */ React32.createElement(Box, __spreadProps(__spreadValues(__spreadValues({
1240
+ as: Popover
1241
+ }, overlayProps), positionProps), {
1242
+ css: {
1243
+ width: triggerRef.current && triggerRef.current.offsetWidth + "px"
1244
+ },
1245
+ ref: overlayRef,
1246
+ isOpen: state.isOpen,
1247
+ onClose: state.close
1248
+ }), /* @__PURE__ */ React32.createElement(ListBox, __spreadProps(__spreadValues({
1249
+ error
1250
+ }, menuProps), {
1251
+ state
1252
+ }))), error && errorMessage && /* @__PURE__ */ React32.createElement(Box, {
1253
+ as: "span",
1254
+ display: "inline-flex",
1255
+ alignItems: "center"
1256
+ }, /* @__PURE__ */ React32.createElement(Box, {
1257
+ as: Exclamation6,
1258
+ size: 16,
1259
+ css: { color: "error" }
1260
+ }), /* @__PURE__ */ React32.createElement(ValidationMessage, null, errorMessage)));
1261
+ };
1262
+
1263
+ // src/Textarea/Textarea.tsx
1264
+ import React33, { useRef as useRef7 } from "react";
1265
+ import { useTextField as useTextField2 } from "@react-aria/textfield";
1266
+ import { Exclamation as Exclamation7 } from "@marigold/icons";
1267
+ var Textarea = (_a) => {
1268
+ var _b = _a, {
1269
+ variant = "",
1270
+ htmlFor,
1271
+ error,
1272
+ errorMessage,
1273
+ required,
1274
+ children
1275
+ } = _b, props = __objRest(_b, [
1276
+ "variant",
1277
+ "htmlFor",
1278
+ "error",
1279
+ "errorMessage",
1280
+ "required",
1281
+ "children"
1282
+ ]);
1283
+ const ref = useRef7(null);
1284
+ const { labelProps, inputProps, errorMessageProps } = useTextField2(__spreadProps(__spreadValues({}, props), {
1285
+ inputElementType: "textarea"
1286
+ }), ref);
1287
+ return /* @__PURE__ */ React33.createElement(Box, null, /* @__PURE__ */ React33.createElement(Label, __spreadValues({
1288
+ htmlFor,
1289
+ required
1290
+ }, labelProps), props.label), /* @__PURE__ */ React33.createElement(Box, __spreadValues(__spreadProps(__spreadValues({
1291
+ as: "textarea",
1292
+ variant: `textarea.${variant}`,
1293
+ css: {
1294
+ outlineColor: error && "error"
1295
+ }
1296
+ }, inputProps), {
1297
+ ref
1298
+ }), props)), error && errorMessage && /* @__PURE__ */ React33.createElement(ValidationMessage, __spreadValues({}, errorMessageProps), /* @__PURE__ */ React33.createElement(Exclamation7, {
1299
+ size: 16
1300
+ }), errorMessage));
1301
+ };
1302
+
1303
+ // src/Input/Input.tsx
1304
+ import React34 from "react";
1305
+ var Input = (_a) => {
1306
+ var _b = _a, {
1307
+ variant = "",
1308
+ type = "text"
1309
+ } = _b, props = __objRest(_b, [
1310
+ "variant",
1311
+ "type"
1312
+ ]);
1313
+ return /* @__PURE__ */ React34.createElement(Box, __spreadProps(__spreadValues({}, props), {
1314
+ as: "input",
1315
+ type,
1316
+ variant: `input.${variant}`
1317
+ }));
1318
+ };
1319
+
1320
+ // src/Container/Container.tsx
1321
+ import React35 from "react";
1322
+ var Container = (_a) => {
1323
+ var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
1324
+ return /* @__PURE__ */ React35.createElement(Box, __spreadProps(__spreadValues({}, props), {
1325
+ width: "100%"
1326
+ }), children);
1327
+ };
1328
+
1329
+ // src/index.ts
1330
+ import { Item, Section } from "@react-stately/collections";
1331
+ export {
1332
+ ActionGroup,
1333
+ Alert,
1334
+ Badge,
1335
+ Box,
1336
+ Button,
1337
+ Card,
1338
+ Checkbox,
1339
+ Column,
1340
+ Columns,
1341
+ Container,
1342
+ Dialog,
1343
+ Divider,
1344
+ Field,
1345
+ Image,
1346
+ Inline,
1347
+ Input,
1348
+ Item,
1349
+ Label,
1350
+ LabelBase,
1351
+ Link,
1352
+ MarigoldProvider,
1353
+ Menu,
1354
+ MenuItem,
1355
+ Message,
1356
+ Radio,
1357
+ SSRProvider,
1358
+ Section,
1359
+ Select,
1360
+ Slider,
1361
+ Stack,
1362
+ Text,
1363
+ Textarea,
1364
+ ThemeProvider2 as ThemeProvider,
1365
+ ValidationMessage,
1366
+ VisuallyHidden2 as VisuallyHidden,
1367
+ useDialogButtonProps,
1368
+ useTheme3 as useTheme
1369
+ };