@marigold/components 0.3.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 (232) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/index.d.ts +362 -32
  3. package/dist/index.js +1407 -5
  4. package/dist/index.mjs +1355 -0
  5. package/package.json +30 -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 -27
  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 -11
  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 -19
  72. package/dist/Radio/Radio.stories.d.ts +0 -5
  73. package/dist/Radio/RadioIcon.d.ts +0 -9
  74. package/dist/Radio/index.d.ts +0 -1
  75. package/dist/Select/ListBox.d.ts +0 -9
  76. package/dist/Select/ListBoxSection.d.ts +0 -9
  77. package/dist/Select/Option.d.ts +0 -9
  78. package/dist/Select/Popover.d.ts +0 -9
  79. package/dist/Select/Select.d.ts +0 -27
  80. package/dist/Select/Select.stories.d.ts +0 -5
  81. package/dist/Select/index.d.ts +0 -1
  82. package/dist/Slider/Slider.d.ts +0 -11
  83. package/dist/Slider/Slider.stories.d.ts +0 -5
  84. package/dist/Slider/index.d.ts +0 -1
  85. package/dist/Stack/Stack.d.ts +0 -7
  86. package/dist/Stack/Stack.stories.d.ts +0 -5
  87. package/dist/Stack/index.d.ts +0 -1
  88. package/dist/Text/Text.d.ts +0 -17
  89. package/dist/Text/Text.stories.d.ts +0 -5
  90. package/dist/Text/index.d.ts +0 -1
  91. package/dist/Textarea/Textarea.d.ts +0 -16
  92. package/dist/Textarea/Textarea.stories.d.ts +0 -5
  93. package/dist/Textarea/index.d.ts +0 -1
  94. package/dist/ValidationMessage/ValidationMessage.d.ts +0 -11
  95. package/dist/ValidationMessage/ValidationMessage.stories.d.ts +0 -5
  96. package/dist/ValidationMessage/index.d.ts +0 -1
  97. package/dist/VisuallyHidden/VisuallyHidden.d.ts +0 -1
  98. package/dist/VisuallyHidden/VisuallyHidden.stories.d.ts +0 -5
  99. package/dist/VisuallyHidden/index.d.ts +0 -1
  100. package/dist/components.cjs.development.js +0 -1394
  101. package/dist/components.cjs.development.js.map +0 -1
  102. package/dist/components.cjs.production.min.js +0 -2
  103. package/dist/components.cjs.production.min.js.map +0 -1
  104. package/dist/components.esm.js +0 -1320
  105. package/dist/components.esm.js.map +0 -1
  106. package/dist/theme.d.ts +0 -23
  107. package/src/ActionGroup/ActionGroup.stories.tsx +0 -47
  108. package/src/ActionGroup/ActionGroup.test.tsx +0 -83
  109. package/src/ActionGroup/ActionGroup.tsx +0 -32
  110. package/src/ActionGroup/index.ts +0 -1
  111. package/src/Alert/Alert.stories.tsx +0 -32
  112. package/src/Alert/Alert.test.tsx +0 -82
  113. package/src/Alert/Alert.tsx +0 -52
  114. package/src/Alert/index.ts +0 -1
  115. package/src/Badge/Badge.stories.tsx +0 -38
  116. package/src/Badge/Badge.test.tsx +0 -65
  117. package/src/Badge/Badge.tsx +0 -37
  118. package/src/Badge/index.ts +0 -1
  119. package/src/Box.ts +0 -2
  120. package/src/Button/Button.stories.tsx +0 -57
  121. package/src/Button/Button.test.tsx +0 -149
  122. package/src/Button/Button.tsx +0 -64
  123. package/src/Button/index.ts +0 -1
  124. package/src/Card/Card.stories.tsx +0 -41
  125. package/src/Card/Card.test.tsx +0 -71
  126. package/src/Card/Card.tsx +0 -48
  127. package/src/Card/index.ts +0 -1
  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 -72
  152. package/src/Divider/Divider.tsx +0 -33
  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 -43
  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.tsx +0 -78
  194. package/src/Radio/Radio.test.tsx +0 -154
  195. package/src/Radio/Radio.tsx +0 -88
  196. package/src/Radio/RadioIcon.tsx +0 -49
  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,1355 @@
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/CheckboxIcon.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
+ const _a2 = props, { children } = _a2, restProps = __objRest(_a2, ["children"]);
440
+ return /* @__PURE__ */ React11.createElement(Box, {
441
+ pr: "xsmall"
442
+ }, /* @__PURE__ */ React11.createElement(VisuallyHidden, null, /* @__PURE__ */ React11.createElement("input", __spreadValues(__spreadProps(__spreadValues(__spreadValues({}, inputProps), focusProps), {
443
+ ref
444
+ }), restProps))), /* @__PURE__ */ React11.createElement(CheckboxIcon, {
445
+ checked: props.checked,
446
+ variant: props.variant,
447
+ disabled: props.disabled,
448
+ error
449
+ }));
450
+ };
451
+ var Checkbox = (_a) => {
452
+ var _b = _a, {
453
+ required,
454
+ labelVariant = "inline",
455
+ errorMessage
456
+ } = _b, props = __objRest(_b, [
457
+ "required",
458
+ "labelVariant",
459
+ "errorMessage"
460
+ ]);
461
+ return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(Box, {
462
+ as: Label,
463
+ __baseCSS: {
464
+ ":hover": { cursor: props.disabled ? "not-allowed" : "pointer" }
465
+ },
466
+ htmlFor: props.id,
467
+ required,
468
+ variant: `label.${labelVariant}`,
469
+ color: props.disabled ? "disabled" : "text"
470
+ }, /* @__PURE__ */ React11.createElement(Box, __spreadValues({
471
+ as: CheckboxInput,
472
+ error: props.error
473
+ }, props)), props.children), props.error && errorMessage && /* @__PURE__ */ React11.createElement(ValidationMessage, null, /* @__PURE__ */ React11.createElement(Exclamation2, {
474
+ size: 16
475
+ }), errorMessage));
476
+ };
477
+
478
+ // src/Column/Column.tsx
479
+ import React12 from "react";
480
+ var transform = (width) => {
481
+ if (Array.isArray(width)) {
482
+ return width.map((v) => `${v / 12 * 100}%`);
483
+ }
484
+ return `${width / 12 * 100}%`;
485
+ };
486
+ var Column = (_a) => {
487
+ var _b = _a, {
488
+ width = 12,
489
+ children
490
+ } = _b, props = __objRest(_b, [
491
+ "width",
492
+ "children"
493
+ ]);
494
+ return /* @__PURE__ */ React12.createElement(Box, __spreadProps(__spreadValues({}, props), {
495
+ width: transform(width)
496
+ }), children);
497
+ };
498
+
499
+ // src/Columns/Columns.tsx
500
+ import React13, { Children as Children3 } from "react";
501
+ import flattenChildren3 from "react-keyed-flatten-children";
502
+ import { useTheme } from "@marigold/system";
503
+ var useAlignment = (direction) => {
504
+ switch (direction) {
505
+ case "right":
506
+ return "flex-end";
507
+ case "bottom":
508
+ return "flex-end";
509
+ case "center":
510
+ return "center";
511
+ }
512
+ return "flex-start";
513
+ };
514
+ var Columns = (_a) => {
515
+ var _b = _a, {
516
+ space = "none",
517
+ horizontalAlign = "left",
518
+ verticalAlign = "top",
519
+ className,
520
+ children
521
+ } = _b, props = __objRest(_b, [
522
+ "space",
523
+ "horizontalAlign",
524
+ "verticalAlign",
525
+ "className",
526
+ "children"
527
+ ]);
528
+ const justifyContent = useAlignment(horizontalAlign);
529
+ const alignItems = useAlignment(verticalAlign);
530
+ const { css } = useTheme();
531
+ const spaceObject = css({ space });
532
+ const spaceValue = Object.values(spaceObject)[0];
533
+ return /* @__PURE__ */ React13.createElement(Box, {
534
+ p: space,
535
+ display: "flex",
536
+ className
537
+ }, /* @__PURE__ */ React13.createElement(Box, __spreadValues({
538
+ width: `calc(100% + ${spaceValue}px)`,
539
+ m: `${-spaceValue / 2}px`,
540
+ display: "flex",
541
+ flexWrap: "wrap",
542
+ alignItems,
543
+ justifyContent
544
+ }, props), Children3.map(flattenChildren3(children), (child) => {
545
+ return React13.cloneElement(child, {}, /* @__PURE__ */ React13.createElement(Box, {
546
+ css: { p: `${spaceValue / 2}px` }
547
+ }, child.props.children));
548
+ })));
549
+ };
550
+
551
+ // src/Dialog/Dialog.tsx
552
+ import React16 from "react";
553
+ import { useOverlayTriggerState } from "@react-stately/overlays";
554
+ import { OverlayContainer } from "@react-aria/overlays";
555
+ import { useButton as useButton2 } from "@react-aria/button";
556
+ import { Close } from "@marigold/icons";
557
+
558
+ // src/Text/Text.tsx
559
+ import React14, { forwardRef as forwardRef2 } from "react";
560
+ var Text = forwardRef2((_a, ref) => {
561
+ var _b = _a, {
562
+ as = "span",
563
+ variant = "body",
564
+ children,
565
+ align,
566
+ color,
567
+ cursor,
568
+ size,
569
+ outline,
570
+ userSelect
571
+ } = _b, props = __objRest(_b, [
572
+ "as",
573
+ "variant",
574
+ "children",
575
+ "align",
576
+ "color",
577
+ "cursor",
578
+ "size",
579
+ "outline",
580
+ "userSelect"
581
+ ]);
582
+ return /* @__PURE__ */ React14.createElement(Box, __spreadProps(__spreadValues({}, props), {
583
+ as,
584
+ variant: `text.${variant}`,
585
+ css: {
586
+ textAlign: align,
587
+ fontSize: size,
588
+ color,
589
+ cursor,
590
+ outline,
591
+ userSelect
592
+ },
593
+ ref
594
+ }), children);
595
+ });
596
+
597
+ // src/Dialog/ModalDialog.tsx
598
+ import React15 from "react";
599
+ import {
600
+ useOverlay,
601
+ usePreventScroll,
602
+ useModal
603
+ } from "@react-aria/overlays";
604
+ import { useDialog } from "@react-aria/dialog";
605
+ import { FocusScope } from "@react-aria/focus";
606
+ var ModalDialog = (_a) => {
607
+ var _b = _a, {
608
+ variant,
609
+ backdropVariant = "backdrop",
610
+ children
611
+ } = _b, props = __objRest(_b, [
612
+ "variant",
613
+ "backdropVariant",
614
+ "children"
615
+ ]);
616
+ const _a2 = props, { isDismissable, isOpen, onClose } = _a2, restProps = __objRest(_a2, ["isDismissable", "isOpen", "onClose"]);
617
+ const ref = React15.useRef();
618
+ const { overlayProps, underlayProps } = useOverlay({ isDismissable, isOpen, onClose }, ref);
619
+ usePreventScroll();
620
+ const { modalProps } = useModal();
621
+ const { dialogProps } = useDialog(props, ref);
622
+ return /* @__PURE__ */ React15.createElement(Box, __spreadValues({
623
+ __baseCSS: {
624
+ display: "grid",
625
+ placeItems: "center",
626
+ position: "fixed",
627
+ zIndex: 100,
628
+ top: 0,
629
+ left: 0,
630
+ bottom: 0,
631
+ right: 0
632
+ },
633
+ variant: `dialog.${backdropVariant}`
634
+ }, underlayProps), /* @__PURE__ */ React15.createElement(FocusScope, {
635
+ contain: true,
636
+ restoreFocus: true,
637
+ autoFocus: true
638
+ }, /* @__PURE__ */ React15.createElement(Box, __spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, overlayProps), dialogProps), modalProps), {
639
+ ref,
640
+ variant: variant ? `dialog.${variant}` : `dialog`
641
+ }), restProps), children)));
642
+ };
643
+
644
+ // src/Dialog/Dialog.tsx
645
+ var Dialog = (_a) => {
646
+ var _b = _a, {
647
+ backdropVariant,
648
+ children,
649
+ className,
650
+ close,
651
+ isOpen,
652
+ title,
653
+ variant
654
+ } = _b, props = __objRest(_b, [
655
+ "backdropVariant",
656
+ "children",
657
+ "className",
658
+ "close",
659
+ "isOpen",
660
+ "title",
661
+ "variant"
662
+ ]);
663
+ const closeButtonRef = React16.useRef();
664
+ const { buttonProps: closeButtonProps } = useButton2({
665
+ onPress: () => close()
666
+ }, closeButtonRef);
667
+ return /* @__PURE__ */ React16.createElement(OverlayContainer, null, /* @__PURE__ */ React16.createElement(ModalDialog, __spreadValues({
668
+ variant,
669
+ backdropVariant,
670
+ isOpen,
671
+ onClose: close,
672
+ isDismissable: true
673
+ }, props), /* @__PURE__ */ React16.createElement(Box, {
674
+ __baseCSS: {
675
+ display: "flex",
676
+ justifyContent: "space-between",
677
+ borderRadius: "small",
678
+ pl: "large",
679
+ pb: "large"
680
+ },
681
+ className
682
+ }, /* @__PURE__ */ React16.createElement(Box, {
683
+ pt: "medium"
684
+ }, title && /* @__PURE__ */ React16.createElement(Text, {
685
+ as: "h4",
686
+ variant: "headline4"
687
+ }, title), children), /* @__PURE__ */ React16.createElement(Box, {
688
+ __baseCSS: {
689
+ display: "flex",
690
+ justifyContent: "flex-end",
691
+ alignItems: "start",
692
+ paddingTop: "xsmall",
693
+ paddingX: "xsmall"
694
+ }
695
+ }, /* @__PURE__ */ React16.createElement(Box, __spreadProps(__spreadValues({
696
+ as: Button,
697
+ __baseCSS: {
698
+ color: "text",
699
+ bg: "transparent",
700
+ lineHeight: "xsmall",
701
+ px: "xxsmall",
702
+ ":hover": {
703
+ color: "text",
704
+ bg: "transparent",
705
+ cursor: "pointer"
706
+ },
707
+ ":focus": {
708
+ outline: 0
709
+ }
710
+ }
711
+ }, closeButtonProps), {
712
+ ref: closeButtonRef
713
+ }), /* @__PURE__ */ React16.createElement(Close, {
714
+ size: 16
715
+ }))))));
716
+ };
717
+ var useDialogButtonProps = () => {
718
+ const state = useOverlayTriggerState({});
719
+ const openButtonRef = React16.useRef();
720
+ const { buttonProps: openButtonProps } = useButton2({
721
+ onPress: () => state.open()
722
+ }, openButtonRef);
723
+ return {
724
+ state,
725
+ openButtonProps,
726
+ openButtonRef
727
+ };
728
+ };
729
+
730
+ // src/Divider/Divider.tsx
731
+ import React17 from "react";
732
+ import { useSeparator } from "@react-aria/separator";
733
+ var Divider = (_a) => {
734
+ var _b = _a, { variant = "" } = _b, props = __objRest(_b, ["variant"]);
735
+ const { separatorProps } = useSeparator(props);
736
+ return /* @__PURE__ */ React17.createElement(Box, __spreadValues(__spreadValues({
737
+ __baseCSS: { width: "100%", height: "1px", m: "none", bg: "text" },
738
+ variant: `divider.${variant}`
739
+ }, props), separatorProps));
740
+ };
741
+
742
+ // src/Field/Field.tsx
743
+ import React18, { useRef as useRef2 } from "react";
744
+ import { useTextField } from "@react-aria/textfield";
745
+ import { Exclamation as Exclamation3 } from "@marigold/icons";
746
+ var Field = (_a) => {
747
+ var _b = _a, {
748
+ type = "text",
749
+ variant = "",
750
+ labelVariant = "above",
751
+ htmlFor,
752
+ required,
753
+ error,
754
+ errorMessage
755
+ } = _b, props = __objRest(_b, [
756
+ "type",
757
+ "variant",
758
+ "labelVariant",
759
+ "htmlFor",
760
+ "required",
761
+ "error",
762
+ "errorMessage"
763
+ ]);
764
+ const ref = useRef2(null);
765
+ const { labelProps, inputProps, errorMessageProps } = useTextField(props, ref);
766
+ return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(Label, __spreadValues({
767
+ variant: labelVariant,
768
+ htmlFor,
769
+ required
770
+ }, labelProps), props.label), /* @__PURE__ */ React18.createElement(Box, __spreadValues(__spreadProps(__spreadValues({
771
+ as: "input",
772
+ type,
773
+ id: htmlFor,
774
+ variant: `input.${variant}`
775
+ }, inputProps), {
776
+ ref
777
+ }), props)), error && errorMessage && /* @__PURE__ */ React18.createElement(ValidationMessage, __spreadValues({}, errorMessageProps), /* @__PURE__ */ React18.createElement(Exclamation3, {
778
+ size: 16
779
+ }), errorMessage));
780
+ };
781
+
782
+ // src/VisuallyHidden/VisuallyHidden.tsx
783
+ import { VisuallyHidden as VisuallyHidden2 } from "@react-aria/visually-hidden";
784
+
785
+ // src/Image/Image.tsx
786
+ import React19 from "react";
787
+ var Image = (_a) => {
788
+ var _b = _a, {
789
+ variant = "fullWidth"
790
+ } = _b, props = __objRest(_b, [
791
+ "variant"
792
+ ]);
793
+ return /* @__PURE__ */ React19.createElement(Box, __spreadProps(__spreadValues({}, props), {
794
+ as: "img",
795
+ variant: `image.${variant}`
796
+ }));
797
+ };
798
+
799
+ // src/Link/Link.tsx
800
+ import React20, { useRef as useRef3 } from "react";
801
+ import { useLink } from "@react-aria/link";
802
+ var Link = (_a) => {
803
+ var _b = _a, {
804
+ as = "a",
805
+ variant = "link",
806
+ children,
807
+ disabled
808
+ } = _b, props = __objRest(_b, [
809
+ "as",
810
+ "variant",
811
+ "children",
812
+ "disabled"
813
+ ]);
814
+ const ref = useRef3();
815
+ const { linkProps } = useLink(__spreadProps(__spreadValues({}, props), {
816
+ elementType: typeof as === "string" ? as : "span",
817
+ isDisabled: disabled
818
+ }), ref);
819
+ return /* @__PURE__ */ React20.createElement(Text, __spreadProps(__spreadValues(__spreadValues({}, props), linkProps), {
820
+ as,
821
+ variant,
822
+ ref
823
+ }), children);
824
+ };
825
+
826
+ // src/Menu/Menu.tsx
827
+ import React21 from "react";
828
+ var Menu = (_a) => {
829
+ var _b = _a, {
830
+ variant = "default",
831
+ label = "Menu",
832
+ onClick,
833
+ show = false,
834
+ children
835
+ } = _b, props = __objRest(_b, [
836
+ "variant",
837
+ "label",
838
+ "onClick",
839
+ "show",
840
+ "children"
841
+ ]);
842
+ return /* @__PURE__ */ React21.createElement(Box, __spreadValues({
843
+ variant: `menu.${variant}`
844
+ }, props), /* @__PURE__ */ React21.createElement(Button, {
845
+ onClick,
846
+ variant: "menu"
847
+ }, label), show ? /* @__PURE__ */ React21.createElement(Box, {
848
+ display: "block",
849
+ position: "absolute",
850
+ minWidth: "120px",
851
+ borderRadius: "2px"
852
+ }, children) : null);
853
+ };
854
+
855
+ // src/MenuItem/MenuItem.tsx
856
+ import React22 from "react";
857
+ var MenuItem = (_a) => {
858
+ var _b = _a, {
859
+ variant = "default",
860
+ children
861
+ } = _b, props = __objRest(_b, [
862
+ "variant",
863
+ "children"
864
+ ]);
865
+ return /* @__PURE__ */ React22.createElement(Box, {
866
+ variant: `menuItem.${variant}`
867
+ }, /* @__PURE__ */ React22.createElement(Link, __spreadValues({
868
+ variant: "menuItemLink"
869
+ }, props), children));
870
+ };
871
+
872
+ // src/Message/Message.tsx
873
+ import React23 from "react";
874
+ import { Exclamation as Exclamation4, Info, Notification as Notification2 } from "@marigold/icons";
875
+ var Message = (_a) => {
876
+ var _b = _a, {
877
+ messageTitle,
878
+ variant = "info",
879
+ className,
880
+ children
881
+ } = _b, props = __objRest(_b, [
882
+ "messageTitle",
883
+ "variant",
884
+ "className",
885
+ "children"
886
+ ]);
887
+ var icon = /* @__PURE__ */ React23.createElement(Info, null);
888
+ if (variant === "warning") {
889
+ icon = /* @__PURE__ */ React23.createElement(Notification2, null);
890
+ }
891
+ if (variant === "error") {
892
+ icon = /* @__PURE__ */ React23.createElement(Exclamation4, null);
893
+ }
894
+ return /* @__PURE__ */ React23.createElement(Box, __spreadValues({
895
+ display: "inline-block",
896
+ variant: `message.${variant}`,
897
+ className
898
+ }, props), /* @__PURE__ */ React23.createElement(Box, {
899
+ display: "flex",
900
+ alignItems: "center",
901
+ variant: "message.title"
902
+ }, icon, /* @__PURE__ */ React23.createElement(Text, {
903
+ as: "h4",
904
+ variant: "headline4"
905
+ }, messageTitle)), /* @__PURE__ */ React23.createElement(Box, {
906
+ css: { color: "black" }
907
+ }, children));
908
+ };
909
+
910
+ // src/Provider/index.ts
911
+ import { useTheme as useTheme3, ThemeProvider as ThemeProvider2 } from "@marigold/system";
912
+ import { SSRProvider } from "@react-aria/ssr";
913
+
914
+ // src/Provider/MarigoldProvider.tsx
915
+ import React24 from "react";
916
+ import { OverlayProvider } from "@react-aria/overlays";
917
+ import {
918
+ Global,
919
+ ThemeProvider,
920
+ useTheme as useTheme2,
921
+ __defaultTheme
922
+ } from "@marigold/system";
923
+ function MarigoldProvider({
924
+ theme,
925
+ children
926
+ }) {
927
+ const outer = useTheme2();
928
+ const isTopLevel = outer.theme === __defaultTheme;
929
+ return /* @__PURE__ */ React24.createElement(ThemeProvider, {
930
+ theme
931
+ }, isTopLevel ? /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(Global, null), /* @__PURE__ */ React24.createElement(OverlayProvider, null, children)) : children);
932
+ }
933
+
934
+ // src/Radio/Radio.tsx
935
+ import React26 from "react";
936
+ import { Exclamation as Exclamation5 } from "@marigold/icons";
937
+ import { useFocusRing as useFocusRing2 } from "@react-aria/focus";
938
+ import { VisuallyHidden as VisuallyHidden3 } from "@react-aria/visually-hidden";
939
+
940
+ // src/Radio/RadioIcon.tsx
941
+ import React25 from "react";
942
+ import { conditional as conditional2, SVG as SVG2 } from "@marigold/system";
943
+ var RadioIcon = ({
944
+ variant = "",
945
+ checked = false,
946
+ disabled = false,
947
+ error = false
948
+ }) => {
949
+ const conditionalStates = disabled ? {
950
+ disabled
951
+ } : {
952
+ checked,
953
+ error
954
+ };
955
+ return /* @__PURE__ */ React25.createElement(SVG2, {
956
+ width: "16",
957
+ height: "32",
958
+ viewBox: "0 0 16 32",
959
+ fill: "none",
960
+ "aria-hidden": "true"
961
+ }, /* @__PURE__ */ React25.createElement(Box, {
962
+ variant: conditional2(`radio.${variant}`, conditionalStates),
963
+ as: "circle",
964
+ cx: "8",
965
+ cy: "16",
966
+ r: "7.5"
967
+ }), checked && /* @__PURE__ */ React25.createElement("circle", {
968
+ fill: "white",
969
+ cx: "8",
970
+ cy: "16",
971
+ r: "3"
972
+ }));
973
+ };
974
+
975
+ // src/Radio/Radio.tsx
976
+ var RadioInput = (_a) => {
977
+ var _b = _a, { error } = _b, props = __objRest(_b, ["error"]);
978
+ const { focusProps } = useFocusRing2();
979
+ const _a2 = props, { children } = _a2, restProps = __objRest(_a2, ["children"]);
980
+ return /* @__PURE__ */ React26.createElement(Box, {
981
+ pr: "xsmall"
982
+ }, /* @__PURE__ */ React26.createElement(VisuallyHidden3, null, /* @__PURE__ */ React26.createElement("input", __spreadValues(__spreadValues({
983
+ type: "radio",
984
+ disabled: props.disabled
985
+ }, focusProps), restProps))), /* @__PURE__ */ React26.createElement(RadioIcon, {
986
+ variant: props.variant,
987
+ disabled: props.disabled,
988
+ checked: props.checked,
989
+ error
990
+ }));
991
+ };
992
+ var Radio = (_a) => {
993
+ var _b = _a, {
994
+ required,
995
+ labelVariant = "inline",
996
+ errorMessage
997
+ } = _b, props = __objRest(_b, [
998
+ "required",
999
+ "labelVariant",
1000
+ "errorMessage"
1001
+ ]);
1002
+ return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(Box, {
1003
+ as: Label,
1004
+ htmlFor: props.id,
1005
+ required,
1006
+ variant: `label.${labelVariant}`,
1007
+ css: props.disabled ? { color: "disabled", ":hover": { cursor: "not-allowed" } } : { color: "text", ":hover": { cursor: "pointer" } }
1008
+ }, /* @__PURE__ */ React26.createElement(Box, __spreadValues({
1009
+ as: RadioInput,
1010
+ error: props.error
1011
+ }, props)), props.children), props.error && errorMessage && /* @__PURE__ */ React26.createElement(ValidationMessage, null, /* @__PURE__ */ React26.createElement(Exclamation5, {
1012
+ size: 16
1013
+ }), errorMessage));
1014
+ };
1015
+
1016
+ // src/Slider/Slider.tsx
1017
+ import React27 from "react";
1018
+ var Slider = (_a) => {
1019
+ var _b = _a, { variant = "" } = _b, props = __objRest(_b, ["variant"]);
1020
+ return /* @__PURE__ */ React27.createElement(Box, __spreadValues({
1021
+ as: "input",
1022
+ type: "range",
1023
+ css: { verticalAlign: "middle" },
1024
+ variant: `slider.${variant}`
1025
+ }, props));
1026
+ };
1027
+
1028
+ // src/Select/Select.tsx
1029
+ import React32, { useRef as useRef6 } from "react";
1030
+ import { useSelectState } from "@react-stately/select";
1031
+ import { useButton as useButton3 } from "@react-aria/button";
1032
+ import { mergeProps as mergeProps2 } from "@react-aria/utils";
1033
+ import { useFocusRing as useFocusRing3 } from "@react-aria/focus";
1034
+ import { HiddenSelect, useSelect } from "@react-aria/select";
1035
+ import { useOverlayTriggerState as useOverlayTriggerState2 } from "@react-stately/overlays";
1036
+ import { useOverlayTrigger, useOverlayPosition } from "@react-aria/overlays";
1037
+ import { ArrowDown, ArrowUp, Exclamation as Exclamation6, Required as Required2 } from "@marigold/icons";
1038
+
1039
+ // src/Select/ListBox.tsx
1040
+ import React30, { useRef as useRef5 } from "react";
1041
+ import { useListBox } from "@react-aria/listbox";
1042
+
1043
+ // src/Select/Option.tsx
1044
+ import React28, { useEffect, useRef as useRef4, useState as useState2 } from "react";
1045
+ import { useOption } from "@react-aria/listbox";
1046
+ var Option = ({ item, state }) => {
1047
+ const ref = useRef4(null);
1048
+ const [disabled, setDisabled] = useState2(false);
1049
+ const { optionProps, isSelected } = useOption({
1050
+ key: item.key
1051
+ }, state, ref);
1052
+ useEffect(() => {
1053
+ for (const key of state.disabledKeys.values()) {
1054
+ if (key === item.key) {
1055
+ setDisabled(true);
1056
+ }
1057
+ }
1058
+ }, [state.disabledKeys, item.key]);
1059
+ return /* @__PURE__ */ React28.createElement(Box, __spreadProps(__spreadValues({
1060
+ as: "li"
1061
+ }, optionProps), {
1062
+ ref,
1063
+ variant: isSelected ? "select.option.selected" : disabled ? "select.option.disabled" : "select.option"
1064
+ }), item.rendered);
1065
+ };
1066
+
1067
+ // src/Select/ListBoxSection.tsx
1068
+ import React29 from "react";
1069
+ import { useListBoxSection } from "@react-aria/listbox";
1070
+ var ListBoxSection = ({ section, state }) => {
1071
+ const { itemProps, headingProps, groupProps } = useListBoxSection({
1072
+ heading: section.rendered,
1073
+ "aria-label": section["aria-label"]
1074
+ });
1075
+ return /* @__PURE__ */ React29.createElement(Box, __spreadProps(__spreadValues({
1076
+ as: "li"
1077
+ }, itemProps), {
1078
+ css: {
1079
+ cursor: "not-allowed"
1080
+ }
1081
+ }), section.rendered && /* @__PURE__ */ React29.createElement(Box, __spreadProps(__spreadValues({
1082
+ as: "span"
1083
+ }, headingProps), {
1084
+ variant: "select.section"
1085
+ }), section.rendered), /* @__PURE__ */ React29.createElement(Box, __spreadValues({
1086
+ as: "ul"
1087
+ }, groupProps), [...section.childNodes].map((node) => /* @__PURE__ */ React29.createElement(Option, {
1088
+ key: node.key,
1089
+ item: node,
1090
+ state
1091
+ }))));
1092
+ };
1093
+
1094
+ // src/Select/ListBox.tsx
1095
+ var ListBox = (props) => {
1096
+ const ref = useRef5(null);
1097
+ const { state, error } = props;
1098
+ const { listBoxProps } = useListBox(props, state, ref);
1099
+ return /* @__PURE__ */ React30.createElement(Box, __spreadProps(__spreadValues({
1100
+ as: "ul",
1101
+ p: "none",
1102
+ css: {
1103
+ listStyle: "none"
1104
+ }
1105
+ }, listBoxProps), {
1106
+ variant: error ? "select.listbox.error" : "select.listbox",
1107
+ ref
1108
+ }), [...state.collection].map((item) => item.type === "section" ? /* @__PURE__ */ React30.createElement(ListBoxSection, {
1109
+ key: item.key,
1110
+ section: item,
1111
+ state
1112
+ }) : /* @__PURE__ */ React30.createElement(Option, {
1113
+ key: item.key,
1114
+ item,
1115
+ state
1116
+ })));
1117
+ };
1118
+
1119
+ // src/Select/Popover.tsx
1120
+ import React31, { forwardRef as forwardRef3 } from "react";
1121
+ import { FocusScope as FocusScope2 } from "@react-aria/focus";
1122
+ import {
1123
+ DismissButton,
1124
+ OverlayContainer as OverlayContainer2,
1125
+ useModal as useModal2,
1126
+ useOverlay as useOverlay2
1127
+ } from "@react-aria/overlays";
1128
+ import { mergeProps } from "@react-aria/utils";
1129
+ var Popover = forwardRef3((_a, ref) => {
1130
+ var _b = _a, { children, className, isOpen, onClose } = _b, otherProps = __objRest(_b, ["children", "className", "isOpen", "onClose"]);
1131
+ const { overlayProps } = useOverlay2({
1132
+ isOpen,
1133
+ onClose,
1134
+ shouldCloseOnBlur: true,
1135
+ isDismissable: true
1136
+ }, ref);
1137
+ const { modalProps } = useModal2();
1138
+ return /* @__PURE__ */ React31.createElement(OverlayContainer2, null, /* @__PURE__ */ React31.createElement(FocusScope2, {
1139
+ restoreFocus: true
1140
+ }, /* @__PURE__ */ React31.createElement(Box, __spreadProps(__spreadValues({}, mergeProps(overlayProps, otherProps, modalProps)), {
1141
+ className,
1142
+ ref
1143
+ }), children, /* @__PURE__ */ React31.createElement(DismissButton, {
1144
+ onDismiss: onClose
1145
+ }))));
1146
+ });
1147
+
1148
+ // src/Select/Select.tsx
1149
+ var Select = (_a) => {
1150
+ var _b = _a, {
1151
+ labelVariant = "above",
1152
+ placeholder = "Select an option",
1153
+ disabled,
1154
+ required,
1155
+ error,
1156
+ errorMessage,
1157
+ width,
1158
+ className
1159
+ } = _b, props = __objRest(_b, [
1160
+ "labelVariant",
1161
+ "placeholder",
1162
+ "disabled",
1163
+ "required",
1164
+ "error",
1165
+ "errorMessage",
1166
+ "width",
1167
+ "className"
1168
+ ]);
1169
+ const state = useSelectState(props);
1170
+ const overlayTriggerState = useOverlayTriggerState2({});
1171
+ const triggerRef = useRef6();
1172
+ const overlayRef = useRef6();
1173
+ const { overlayProps } = useOverlayTrigger({ type: "listbox" }, overlayTriggerState, triggerRef);
1174
+ const { overlayProps: positionProps } = useOverlayPosition({
1175
+ targetRef: triggerRef,
1176
+ overlayRef,
1177
+ placement: "bottom",
1178
+ shouldFlip: false,
1179
+ isOpen: state.isOpen,
1180
+ onClose: state.close
1181
+ });
1182
+ const { labelProps, triggerProps, valueProps, menuProps } = useSelect(props, state, triggerRef);
1183
+ const { buttonProps } = useButton3(triggerProps, triggerRef);
1184
+ const { focusProps } = useFocusRing3();
1185
+ return /* @__PURE__ */ React32.createElement(Box, {
1186
+ position: "relative",
1187
+ display: "inline-block",
1188
+ width: width && width
1189
+ }, props.label && /* @__PURE__ */ React32.createElement(Box, null, /* @__PURE__ */ React32.createElement(Label, __spreadProps(__spreadValues({}, labelProps), {
1190
+ htmlFor: labelProps.id,
1191
+ variant: labelVariant
1192
+ }), required ? /* @__PURE__ */ React32.createElement(Box, {
1193
+ as: "span",
1194
+ display: "inline-flex",
1195
+ alignItems: "center"
1196
+ }, props.label, /* @__PURE__ */ React32.createElement(Box, {
1197
+ as: Required2,
1198
+ size: 16,
1199
+ css: { color: "error" }
1200
+ })) : props.label)), /* @__PURE__ */ React32.createElement(HiddenSelect, {
1201
+ state,
1202
+ triggerRef,
1203
+ label: props.label,
1204
+ name: props.name,
1205
+ isDisabled: disabled
1206
+ }), /* @__PURE__ */ React32.createElement(Box, __spreadProps(__spreadValues({
1207
+ as: "button"
1208
+ }, mergeProps2(buttonProps, focusProps)), {
1209
+ ref: triggerRef,
1210
+ variant: error && state.isOpen && !disabled ? "button.select.errorOpened" : error ? "button.select.error" : state.isOpen && !disabled ? "button.select.open" : "button.select",
1211
+ disabled,
1212
+ className
1213
+ }), /* @__PURE__ */ React32.createElement(Box, __spreadProps(__spreadValues({
1214
+ as: "span"
1215
+ }, valueProps), {
1216
+ variant: disabled ? "select.disabled" : "select"
1217
+ }), state.selectedItem ? state.selectedItem.rendered : placeholder), state.isOpen && !disabled ? /* @__PURE__ */ React32.createElement(Box, {
1218
+ as: ArrowUp,
1219
+ size: 16,
1220
+ css: { fill: "text" }
1221
+ }) : /* @__PURE__ */ React32.createElement(Box, {
1222
+ as: ArrowDown,
1223
+ size: 16,
1224
+ css: { fill: disabled ? "disabled" : "text" }
1225
+ })), state.isOpen && !disabled && /* @__PURE__ */ React32.createElement(Box, __spreadProps(__spreadValues(__spreadValues({
1226
+ as: Popover
1227
+ }, overlayProps), positionProps), {
1228
+ css: {
1229
+ width: triggerRef.current && triggerRef.current.offsetWidth + "px"
1230
+ },
1231
+ ref: overlayRef,
1232
+ isOpen: state.isOpen,
1233
+ onClose: state.close
1234
+ }), /* @__PURE__ */ React32.createElement(ListBox, __spreadProps(__spreadValues({
1235
+ error
1236
+ }, menuProps), {
1237
+ state
1238
+ }))), error && errorMessage && /* @__PURE__ */ React32.createElement(Box, {
1239
+ as: "span",
1240
+ display: "inline-flex",
1241
+ alignItems: "center"
1242
+ }, /* @__PURE__ */ React32.createElement(Box, {
1243
+ as: Exclamation6,
1244
+ size: 16,
1245
+ css: { color: "error" }
1246
+ }), /* @__PURE__ */ React32.createElement(ValidationMessage, null, errorMessage)));
1247
+ };
1248
+
1249
+ // src/Textarea/Textarea.tsx
1250
+ import React33, { useRef as useRef7 } from "react";
1251
+ import { useTextField as useTextField2 } from "@react-aria/textfield";
1252
+ import { Exclamation as Exclamation7 } from "@marigold/icons";
1253
+ var Textarea = (_a) => {
1254
+ var _b = _a, {
1255
+ variant = "",
1256
+ htmlFor,
1257
+ error,
1258
+ errorMessage,
1259
+ required,
1260
+ children
1261
+ } = _b, props = __objRest(_b, [
1262
+ "variant",
1263
+ "htmlFor",
1264
+ "error",
1265
+ "errorMessage",
1266
+ "required",
1267
+ "children"
1268
+ ]);
1269
+ const ref = useRef7(null);
1270
+ const { labelProps, inputProps, errorMessageProps } = useTextField2(__spreadProps(__spreadValues({}, props), {
1271
+ inputElementType: "textarea"
1272
+ }), ref);
1273
+ return /* @__PURE__ */ React33.createElement(Box, null, /* @__PURE__ */ React33.createElement(Label, __spreadValues({
1274
+ htmlFor,
1275
+ required
1276
+ }, labelProps), props.label), /* @__PURE__ */ React33.createElement(Box, __spreadValues(__spreadProps(__spreadValues({
1277
+ as: "textarea",
1278
+ variant: `textarea.${variant}`,
1279
+ css: {
1280
+ outlineColor: error && "error"
1281
+ }
1282
+ }, inputProps), {
1283
+ ref
1284
+ }), props)), error && errorMessage && /* @__PURE__ */ React33.createElement(ValidationMessage, __spreadValues({}, errorMessageProps), /* @__PURE__ */ React33.createElement(Exclamation7, {
1285
+ size: 16
1286
+ }), errorMessage));
1287
+ };
1288
+
1289
+ // src/Input/Input.tsx
1290
+ import React34 from "react";
1291
+ var Input = (_a) => {
1292
+ var _b = _a, {
1293
+ variant = "",
1294
+ type = "text"
1295
+ } = _b, props = __objRest(_b, [
1296
+ "variant",
1297
+ "type"
1298
+ ]);
1299
+ return /* @__PURE__ */ React34.createElement(Box, __spreadProps(__spreadValues({}, props), {
1300
+ as: "input",
1301
+ type,
1302
+ variant: `input.${variant}`
1303
+ }));
1304
+ };
1305
+
1306
+ // src/Container/Container.tsx
1307
+ import React35 from "react";
1308
+ var Container = (_a) => {
1309
+ var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
1310
+ return /* @__PURE__ */ React35.createElement(Box, __spreadProps(__spreadValues({}, props), {
1311
+ width: "100%"
1312
+ }), children);
1313
+ };
1314
+
1315
+ // src/index.ts
1316
+ import { Item, Section } from "@react-stately/collections";
1317
+ export {
1318
+ ActionGroup,
1319
+ Alert,
1320
+ Badge,
1321
+ Box,
1322
+ Button,
1323
+ Card,
1324
+ Checkbox,
1325
+ Column,
1326
+ Columns,
1327
+ Container,
1328
+ Dialog,
1329
+ Divider,
1330
+ Field,
1331
+ Image,
1332
+ Inline,
1333
+ Input,
1334
+ Item,
1335
+ Label,
1336
+ LabelBase,
1337
+ Link,
1338
+ MarigoldProvider,
1339
+ Menu,
1340
+ MenuItem,
1341
+ Message,
1342
+ Radio,
1343
+ SSRProvider,
1344
+ Section,
1345
+ Select,
1346
+ Slider,
1347
+ Stack,
1348
+ Text,
1349
+ Textarea,
1350
+ ThemeProvider2 as ThemeProvider,
1351
+ ValidationMessage,
1352
+ VisuallyHidden2 as VisuallyHidden,
1353
+ useDialogButtonProps,
1354
+ useTheme3 as useTheme
1355
+ };