@marigold/components 0.7.0 → 1.0.0-beta.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 (4) hide show
  1. package/dist/index.d.ts +390 -232
  2. package/dist/index.js +1967 -1095
  3. package/dist/index.mjs +2024 -1088
  4. package/package.json +28 -10
package/dist/index.mjs CHANGED
@@ -30,83 +30,13 @@ var __objRest = (source, exclude) => {
30
30
  return target;
31
31
  };
32
32
 
33
- // src/ActionGroup/ActionGroup.tsx
34
- import React3 from "react";
35
-
36
- // src/Inline/Inline.tsx
33
+ // src/Aside/Aside.tsx
37
34
  import React from "react";
38
35
 
39
36
  // src/Box.ts
40
37
  import { Box } from "@marigold/system";
41
38
 
42
- // src/Inline/Inline.tsx
43
- var ALIGNMENT = {
44
- top: "flex-start",
45
- center: "center",
46
- bottom: "flex-end"
47
- };
48
- var Inline = (_a) => {
49
- var _b = _a, {
50
- space = "none",
51
- align = "center",
52
- children
53
- } = _b, props = __objRest(_b, [
54
- "space",
55
- "align",
56
- "children"
57
- ]);
58
- return /* @__PURE__ */ React.createElement(Box, __spreadValues({
59
- __baseCSS: { gap: space, flexWrap: "wrap" },
60
- display: "inline-flex",
61
- alignItems: ALIGNMENT[align]
62
- }, props), children);
63
- };
64
-
65
- // src/Stack/Stack.tsx
66
- import React2 from "react";
67
- var ALIGNMENT2 = {
68
- left: "flex-start",
69
- center: "center",
70
- right: "flex-end"
71
- };
72
- var Stack = (_a) => {
73
- var _b = _a, {
74
- space = "none",
75
- align = "left",
76
- children
77
- } = _b, props = __objRest(_b, [
78
- "space",
79
- "align",
80
- "children"
81
- ]);
82
- return /* @__PURE__ */ React2.createElement(Box, __spreadProps(__spreadValues({}, props), {
83
- __baseCSS: { gap: space },
84
- display: "flex",
85
- flexDirection: "column",
86
- alignItems: ALIGNMENT2[align]
87
- }), children);
88
- };
89
-
90
- // src/ActionGroup/ActionGroup.tsx
91
- var ActionGroup = (_a) => {
92
- var _b = _a, {
93
- space = "none",
94
- verticalAlignment = false,
95
- children
96
- } = _b, props = __objRest(_b, [
97
- "space",
98
- "verticalAlignment",
99
- "children"
100
- ]);
101
- return verticalAlignment ? /* @__PURE__ */ React3.createElement(Stack, __spreadValues({
102
- space
103
- }, props), children) : /* @__PURE__ */ React3.createElement(Inline, __spreadValues({
104
- space
105
- }, props), children);
106
- };
107
-
108
39
  // src/Aside/Aside.tsx
109
- import React4 from "react";
110
40
  var SIDE_MAP = {
111
41
  left: [":not(style):first-of-type", ":last-child"],
112
42
  right: [":last-child", ":not(style):first-of-type"]
@@ -120,7 +50,7 @@ var Aside = ({
120
50
  wrap = "50%"
121
51
  }) => {
122
52
  const [aside, content] = SIDE_MAP[side];
123
- return /* @__PURE__ */ React4.createElement(Box, {
53
+ return /* @__PURE__ */ React.createElement(Box, {
124
54
  css: {
125
55
  display: "flex",
126
56
  flexWrap: "wrap",
@@ -140,1179 +70,2227 @@ var Aside = ({
140
70
  };
141
71
 
142
72
  // src/Aspect/Aspect.tsx
143
- import React5 from "react";
73
+ import React2 from "react";
144
74
  import { aspect } from "@marigold/tokens";
145
- var Aspect = React5.forwardRef(function AspectRatio(_a, ref) {
146
- var _b = _a, { ratio = "square", maxWidth = "100%", children } = _b, props = __objRest(_b, ["ratio", "maxWidth", "children"]);
147
- return /* @__PURE__ */ React5.createElement(Box, {
148
- ref,
149
- __baseCSS: {
150
- position: "relative",
151
- overflow: "hidden",
152
- maxWidth
153
- }
154
- }, /* @__PURE__ */ React5.createElement(Box, {
155
- __baseCSS: {
156
- aspectRatio: aspect[ratio]
157
- }
158
- }), /* @__PURE__ */ React5.createElement(Box, __spreadProps(__spreadValues({}, props), {
159
- __baseCSS: {
160
- position: "absolute",
161
- top: 0,
162
- right: 0,
163
- bottom: 0,
164
- left: 0
165
- }
166
- }), children));
167
- });
75
+ var Aspect = ({
76
+ ratio = "square",
77
+ maxWidth,
78
+ children
79
+ }) => /* @__PURE__ */ React2.createElement(Box, {
80
+ css: {
81
+ aspectRatio: aspect[ratio],
82
+ overflow: "hidden",
83
+ maxWidth
84
+ }
85
+ }, children);
168
86
 
169
87
  // src/Badge/Badge.tsx
170
- import React6 from "react";
88
+ import React3 from "react";
89
+ import { useComponentStyles } from "@marigold/system";
171
90
  var Badge = (_a) => {
91
+ var _b = _a, { variant, size, children } = _b, props = __objRest(_b, ["variant", "size", "children"]);
92
+ const styles = useComponentStyles("Badge", { variant, size });
93
+ return /* @__PURE__ */ React3.createElement(Box, __spreadProps(__spreadValues({}, props), {
94
+ css: styles
95
+ }), children);
96
+ };
97
+
98
+ // src/Breakout/Breakout.tsx
99
+ import React4 from "react";
100
+ var useAlignment = (direction) => {
101
+ switch (direction) {
102
+ case "right":
103
+ return "flex-end";
104
+ case "bottom":
105
+ return "flex-end";
106
+ case "center":
107
+ return "center";
108
+ }
109
+ return "flex-start";
110
+ };
111
+ var Breakout = (_a) => {
172
112
  var _b = _a, {
173
- variant = "",
174
- bgColor = "transparent",
175
- borderColor = "transparent",
113
+ horizontalAlign,
114
+ verticalAlign,
176
115
  children
177
116
  } = _b, props = __objRest(_b, [
178
- "variant",
179
- "bgColor",
180
- "borderColor",
117
+ "horizontalAlign",
118
+ "verticalAlign",
181
119
  "children"
182
120
  ]);
183
- return /* @__PURE__ */ React6.createElement(Box, __spreadValues({
184
- css: { bg: bgColor, borderColor },
185
- variant: `badge.${variant}`
121
+ const alignItems = useAlignment(horizontalAlign);
122
+ const justifyContent = useAlignment(verticalAlign);
123
+ return /* @__PURE__ */ React4.createElement(Box, __spreadValues({
124
+ alignItems,
125
+ justifyContent,
126
+ width: "100%",
127
+ display: verticalAlign || horizontalAlign ? "flex" : "block",
128
+ css: {
129
+ gridColumn: "1 / -1"
130
+ }
186
131
  }, props), children);
187
132
  };
188
133
 
189
134
  // src/Button/Button.tsx
190
- import React7, { forwardRef } from "react";
135
+ import React5, {
136
+ forwardRef,
137
+ useImperativeHandle,
138
+ useRef
139
+ } from "react";
191
140
  import { useButton } from "@react-aria/button";
141
+ import { useFocusRing } from "@react-aria/focus";
142
+ import { mergeProps } from "@react-aria/utils";
143
+ import {
144
+ Box as Box2,
145
+ useComponentStyles as useComponentStyles2,
146
+ useStateProps
147
+ } from "@marigold/system";
192
148
  var Button = forwardRef((_a, ref) => {
193
149
  var _b = _a, {
194
150
  as = "button",
195
- variant = "primary",
196
- size = "large",
197
- space = "none",
198
- disabled,
199
151
  children,
200
- className
152
+ variant,
153
+ size,
154
+ disabled
201
155
  } = _b, props = __objRest(_b, [
202
156
  "as",
157
+ "children",
203
158
  "variant",
204
159
  "size",
205
- "space",
206
- "disabled",
207
- "children",
208
- "className"
160
+ "disabled"
209
161
  ]);
210
- const { buttonProps } = useButton(__spreadProps(__spreadValues({}, props), {
162
+ const buttonRef = useRef(null);
163
+ useImperativeHandle(ref, () => buttonRef.current);
164
+ const { buttonProps, isPressed } = useButton(__spreadProps(__spreadValues({}, props), {
211
165
  elementType: typeof as === "string" ? as : "span",
212
166
  isDisabled: disabled
213
- }), ref);
214
- return /* @__PURE__ */ React7.createElement(Box, __spreadProps(__spreadValues(__spreadValues({}, buttonProps), props), {
167
+ }), buttonRef);
168
+ const { isFocusVisible, focusProps } = useFocusRing();
169
+ const styles = useComponentStyles2("Button", { variant, size });
170
+ const stateProps = useStateProps({
171
+ active: isPressed,
172
+ focus: isFocusVisible
173
+ });
174
+ return /* @__PURE__ */ React5.createElement(Box2, __spreadProps(__spreadValues(__spreadValues({}, mergeProps(buttonProps, focusProps)), stateProps), {
215
175
  as,
216
- display: "inline-flex",
217
- alignItems: "center",
218
- variant: [`button.${variant}`, `button.${size}`],
219
- className,
220
- ref,
221
- css: { columnGap: space }
176
+ ref: buttonRef,
177
+ __baseCSS: {
178
+ display: "inline-flex",
179
+ alignItems: "center",
180
+ gap: "0.5ch",
181
+ cursor: disabled ? "not-allowed" : "pointer"
182
+ },
183
+ css: styles
222
184
  }), children);
223
185
  });
224
186
 
225
187
  // src/Card/Card.tsx
226
- import React8 from "react";
188
+ import React6 from "react";
189
+ import {
190
+ Box as Box3,
191
+ useComponentStyles as useComponentStyles3
192
+ } from "@marigold/system";
227
193
  var Card = (_a) => {
194
+ var _b = _a, { children, variant, size } = _b, props = __objRest(_b, ["children", "variant", "size"]);
195
+ const styles = useComponentStyles3("Card", { variant, size });
196
+ return /* @__PURE__ */ React6.createElement(Box3, __spreadProps(__spreadValues({}, props), {
197
+ css: styles
198
+ }), children);
199
+ };
200
+
201
+ // src/Center/Center.tsx
202
+ import React7 from "react";
203
+ var Center = (_a) => {
228
204
  var _b = _a, {
229
- variant = "",
230
- title,
231
- width,
232
- className,
205
+ maxWidth,
206
+ space = "none",
233
207
  children
234
208
  } = _b, props = __objRest(_b, [
235
- "variant",
236
- "title",
237
- "width",
238
- "className",
209
+ "maxWidth",
210
+ "space",
239
211
  "children"
240
212
  ]);
241
- return /* @__PURE__ */ React8.createElement(Box, __spreadProps(__spreadValues({}, props), {
242
- variant: `card.${variant}`,
243
- maxWidth: width,
244
- className
245
- }), title && /* @__PURE__ */ React8.createElement(Box, {
246
- as: "h2",
247
- variant: "text.h2",
248
- pb: "small"
249
- }, title), children);
213
+ return /* @__PURE__ */ React7.createElement(Box, __spreadValues({
214
+ css: {
215
+ boxSizing: "content-box",
216
+ display: "flex",
217
+ flexDirection: "column",
218
+ alignItems: "center",
219
+ justifyContent: "center",
220
+ marginInline: "auto",
221
+ maxInlineSize: maxWidth,
222
+ gap: space
223
+ }
224
+ }, props), children);
250
225
  };
251
226
 
252
227
  // src/Checkbox/Checkbox.tsx
253
- import React12 from "react";
254
- import { useFocusRing } from "@react-aria/focus";
255
- import { VisuallyHidden } from "@react-aria/visually-hidden";
256
- import { useCheckbox } from "@react-aria/checkbox";
228
+ import React10 from "react";
229
+ import { useCheckbox, useCheckboxGroupItem } from "@react-aria/checkbox";
230
+ import { useFocusRing as useFocusRing2 } from "@react-aria/focus";
231
+ import { useHover } from "@react-aria/interactions";
257
232
  import { useToggleState } from "@react-stately/toggle";
258
- import { Exclamation } from "@marigold/icons";
259
-
260
- // src/Checkbox/CheckboxIcon.tsx
261
- import React9 from "react";
262
- import { conditional, SVG } from "@marigold/system";
263
- var CheckboxIcon = ({
264
- variant = "",
265
- checked = false,
266
- disabled = false,
267
- indeterminated,
268
- error = false
269
- }) => {
270
- const conditionalStates = disabled ? {
271
- disabled
272
- } : {
273
- checked,
274
- error
275
- };
276
- return /* @__PURE__ */ React9.createElement(SVG, {
277
- width: "16",
278
- height: "32",
279
- viewBox: "0 0 16 32",
280
- fill: "none",
281
- "aria-hidden": "true"
282
- }, /* @__PURE__ */ React9.createElement(Box, {
283
- as: "rect",
284
- x: "0.5",
285
- y: "8.5",
286
- width: "15px",
287
- height: "15px",
288
- rx: "1.5",
289
- variant: conditional(`checkbox.${variant}`, conditionalStates)
290
- }), checked && indeterminated && /* @__PURE__ */ React9.createElement(Box, {
291
- __baseCSS: { fill: "gray00" },
292
- as: "path",
293
- fillRule: "evenodd",
294
- clipRule: "evenodd",
295
- d: "M13.5 17.0402H2.5V15.4688H13.5V17.0402V17.0402Z"
296
- }), checked && !indeterminated && /* @__PURE__ */ React9.createElement(Box, {
297
- __baseCSS: { fill: "gray00" },
298
- as: "path",
299
- fillRule: "evenodd",
300
- clipRule: "evenodd",
301
- d: "M13.9571 12.8338L12.4085 11.2852L6.08699 17.6007L3.59887 15.1126L2.04163 16.6588L6.08682 20.704L13.9571 12.8338Z"
302
- }));
303
- };
233
+ import {
234
+ Box as Box6,
235
+ useComponentStyles as useComponentStyles6,
236
+ useStateProps as useStateProps2
237
+ } from "@marigold/system";
238
+
239
+ // src/Checkbox/CheckboxGroup.tsx
240
+ import React9, { createContext, useContext } from "react";
241
+ import { useCheckboxGroup } from "@react-aria/checkbox";
242
+ import {
243
+ useCheckboxGroupState
244
+ } from "@react-stately/checkbox";
245
+ import {
246
+ Box as Box5,
247
+ useComponentStyles as useComponentStyles5
248
+ } from "@marigold/system";
304
249
 
305
250
  // src/Label/Label.tsx
306
- import React10 from "react";
251
+ import React8 from "react";
307
252
  import { Required } from "@marigold/icons";
308
- var LabelBase = (_a) => {
309
- var _b = _a, {
310
- variant = "above",
311
- required,
312
- color = "text",
313
- children
314
- } = _b, props = __objRest(_b, [
315
- "variant",
316
- "required",
317
- "color",
318
- "children"
319
- ]);
320
- return /* @__PURE__ */ React10.createElement(Box, __spreadProps(__spreadValues({}, props), {
321
- as: "label",
322
- __baseCSS: { color },
323
- variant: `label.${variant}`
324
- }), children);
325
- };
253
+ import { Box as Box4, useComponentStyles as useComponentStyles4 } from "@marigold/system";
326
254
  var Label = (_a) => {
327
255
  var _b = _a, {
256
+ as = "label",
328
257
  required,
329
- children
258
+ children,
259
+ variant,
260
+ size
330
261
  } = _b, props = __objRest(_b, [
262
+ "as",
331
263
  "required",
332
- "children"
264
+ "children",
265
+ "variant",
266
+ "size"
333
267
  ]);
334
- return required ? /* @__PURE__ */ React10.createElement(Box, {
335
- as: "span",
336
- display: "inline-flex",
337
- alignItems: "center"
338
- }, /* @__PURE__ */ React10.createElement(LabelBase, __spreadValues({}, props), children), required && /* @__PURE__ */ React10.createElement(Required, {
268
+ const styles = useComponentStyles4("Label", { size, variant });
269
+ return /* @__PURE__ */ React8.createElement(Box4, __spreadProps(__spreadValues({}, props), {
270
+ as,
271
+ __baseCSS: { display: "flex", alignItems: "center", gap: 4 },
272
+ css: styles
273
+ }), children, required && /* @__PURE__ */ React8.createElement(Required, {
274
+ role: "presentation",
339
275
  size: 16,
340
276
  fill: "error"
341
- })) : /* @__PURE__ */ React10.createElement(LabelBase, __spreadValues({}, props), children);
277
+ }));
342
278
  };
343
279
 
344
- // src/ValidationMessage/ValidationMessage.tsx
345
- import React11 from "react";
346
- var ValidationMessage = (_a) => {
280
+ // src/Checkbox/CheckboxGroup.tsx
281
+ var CheckboxGroupContext = createContext(null);
282
+ var useCheckboxGroupContext = () => useContext(CheckboxGroupContext);
283
+ var CheckboxGroup = (_a) => {
347
284
  var _b = _a, {
348
- variant = "error",
349
285
  children,
350
- className
351
- } = _b, props = __objRest(_b, [
352
- "variant",
286
+ variant,
287
+ size,
288
+ required,
289
+ disabled,
290
+ readOnly,
291
+ error
292
+ } = _b, rest = __objRest(_b, [
353
293
  "children",
354
- "className"
294
+ "variant",
295
+ "size",
296
+ "required",
297
+ "disabled",
298
+ "readOnly",
299
+ "error"
355
300
  ]);
356
- return /* @__PURE__ */ React11.createElement(Box, __spreadValues({
301
+ const props = __spreadValues({
302
+ isRequired: required,
303
+ isDisabled: disabled,
304
+ isReadOnly: readOnly,
305
+ validationState: error ? "invalid" : "valid"
306
+ }, rest);
307
+ const state = useCheckboxGroupState(props);
308
+ const { groupProps, labelProps } = useCheckboxGroup(props, state);
309
+ const styles = useComponentStyles5("CheckboxGroup", { variant, size }, { parts: ["container", "group"] });
310
+ return /* @__PURE__ */ React9.createElement(Box5, __spreadProps(__spreadValues({}, groupProps), {
311
+ css: styles.container
312
+ }), props.label && /* @__PURE__ */ React9.createElement(Label, __spreadValues({
357
313
  as: "span",
358
- display: "flex",
359
- alignItems: "center",
360
- variant: `validation.${variant}`,
361
- className
362
- }, props), children);
314
+ required
315
+ }, labelProps), props.label), /* @__PURE__ */ React9.createElement(Box5, {
316
+ role: "presentation",
317
+ __baseCSS: {
318
+ display: "flex",
319
+ flexDirection: "column",
320
+ alignItems: "start"
321
+ },
322
+ css: styles.group
323
+ }, /* @__PURE__ */ React9.createElement(CheckboxGroupContext.Provider, {
324
+ value: __spreadValues({ variant, size, error }, state)
325
+ }, children)));
363
326
  };
364
327
 
365
328
  // src/Checkbox/Checkbox.tsx
366
- var CheckboxInput = (_a) => {
367
- var _b = _a, {
368
- error,
369
- indeterminated = false
370
- } = _b, props = __objRest(_b, [
371
- "error",
372
- "indeterminated"
373
- ]);
374
- const state = useToggleState(props);
375
- const ref = React12.useRef(null);
376
- const { inputProps } = useCheckbox(props, state, ref);
377
- const { focusProps } = useFocusRing();
378
- const _a2 = props, { children } = _a2, restProps = __objRest(_a2, ["children"]);
379
- return /* @__PURE__ */ React12.createElement(Box, {
380
- pr: "xsmall"
381
- }, /* @__PURE__ */ React12.createElement(VisuallyHidden, null, /* @__PURE__ */ React12.createElement("input", __spreadValues(__spreadProps(__spreadValues(__spreadValues({}, inputProps), focusProps), {
382
- ref
383
- }), restProps))), /* @__PURE__ */ React12.createElement(CheckboxIcon, {
384
- checked: props.checked,
385
- variant: props.variant,
386
- disabled: props.disabled,
387
- indeterminated,
388
- error
389
- }));
329
+ var CheckMark = () => /* @__PURE__ */ React10.createElement("svg", {
330
+ viewBox: "0 0 12 10"
331
+ }, /* @__PURE__ */ React10.createElement("path", {
332
+ fill: "currentColor",
333
+ stroke: "none",
334
+ d: "M11.915 1.548 10.367 0 4.045 6.315 1.557 3.827 0 5.373l4.045 4.046 7.87-7.871Z"
335
+ }));
336
+ var IndeterminateMark = () => /* @__PURE__ */ React10.createElement("svg", {
337
+ width: "12",
338
+ height: "3",
339
+ viewBox: "0 0 12 3"
340
+ }, /* @__PURE__ */ React10.createElement("path", {
341
+ fill: "currentColor",
342
+ stroke: "none",
343
+ d: "M11.5 2.04018H0.5V0.46875H11.5V2.04018Z"
344
+ }));
345
+ var Icon = (_a) => {
346
+ var _b = _a, { css, checked, indeterminate } = _b, props = __objRest(_b, ["css", "checked", "indeterminate"]);
347
+ const icon = indeterminate ? /* @__PURE__ */ React10.createElement(IndeterminateMark, null) : /* @__PURE__ */ React10.createElement(CheckMark, null);
348
+ return /* @__PURE__ */ React10.createElement(Box6, __spreadValues({
349
+ "aria-hidden": "true",
350
+ __baseCSS: {
351
+ width: 16,
352
+ height: 16,
353
+ bg: "#fff",
354
+ border: "1px solid #000",
355
+ borderRadius: 3,
356
+ display: "flex",
357
+ alignItems: "center",
358
+ justifyContent: "center",
359
+ p: 1
360
+ },
361
+ css
362
+ }, props), checked ? icon : null);
390
363
  };
391
364
  var Checkbox = (_a) => {
392
365
  var _b = _a, {
366
+ size,
367
+ variant,
368
+ disabled,
369
+ checked,
370
+ defaultChecked,
371
+ indeterminate,
372
+ readOnly,
393
373
  required,
394
- labelVariant = "inline",
395
- errorMessage
374
+ error
396
375
  } = _b, props = __objRest(_b, [
376
+ "size",
377
+ "variant",
378
+ "disabled",
379
+ "checked",
380
+ "defaultChecked",
381
+ "indeterminate",
382
+ "readOnly",
397
383
  "required",
398
- "labelVariant",
399
- "errorMessage"
384
+ "error"
400
385
  ]);
401
- return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(Box, {
402
- as: Label,
386
+ const ref = React10.useRef(null);
387
+ const checkboxProps = {
388
+ isIndeterminate: indeterminate,
389
+ isDisabled: disabled,
390
+ isReadOnly: readOnly,
391
+ isRequired: required,
392
+ validationState: error ? "invalid" : "valid"
393
+ };
394
+ const groupState = useCheckboxGroupContext();
395
+ const { inputProps } = groupState ? useCheckboxGroupItem(__spreadProps(__spreadValues(__spreadValues({}, props), checkboxProps), {
396
+ value: props.value
397
+ }), groupState, ref) : useCheckbox(__spreadValues(__spreadValues({
398
+ isSelected: checked,
399
+ defaultSelected: defaultChecked
400
+ }, checkboxProps), props), useToggleState(__spreadValues({
401
+ isSelected: checked,
402
+ defaultSelected: defaultChecked
403
+ }, props)), ref);
404
+ const styles = useComponentStyles6("Checkbox", { variant: (groupState == null ? void 0 : groupState.variant) || variant, size: (groupState == null ? void 0 : groupState.size) || size }, { parts: ["container", "label", "checkbox"] });
405
+ const { hoverProps, isHovered } = useHover({});
406
+ const { isFocusVisible, focusProps } = useFocusRing2();
407
+ const stateProps = useStateProps2({
408
+ hover: isHovered,
409
+ focus: isFocusVisible,
410
+ checked: inputProps.checked,
411
+ disabled: inputProps.disabled,
412
+ error: (groupState == null ? void 0 : groupState.error) || error,
413
+ readOnly,
414
+ indeterminate
415
+ });
416
+ return /* @__PURE__ */ React10.createElement(Box6, __spreadValues(__spreadValues({
417
+ as: "label",
403
418
  __baseCSS: {
404
- ":hover": { cursor: props.disabled ? "not-allowed" : "pointer" }
419
+ display: "flex",
420
+ alignItems: "center",
421
+ gap: "1ch",
422
+ position: "relative"
405
423
  },
406
- htmlFor: props.id,
407
- required,
408
- variant: `label.${labelVariant}`,
409
- color: props.disabled ? "disabled" : "text"
410
- }, /* @__PURE__ */ React12.createElement(CheckboxInput, __spreadValues({
411
- error: props.error
412
- }, props)), props.children), props.error && errorMessage && /* @__PURE__ */ React12.createElement(ValidationMessage, null, /* @__PURE__ */ React12.createElement(Exclamation, {
413
- size: 16
414
- }), errorMessage));
424
+ css: styles.container
425
+ }, hoverProps), stateProps), /* @__PURE__ */ React10.createElement(Box6, __spreadValues(__spreadValues({
426
+ as: "input",
427
+ ref,
428
+ css: {
429
+ position: "absolute",
430
+ width: "100%",
431
+ height: "100%",
432
+ top: 0,
433
+ left: 0,
434
+ zIndex: 1,
435
+ opacity: 1e-4,
436
+ cursor: inputProps.disabled ? "not-allowed" : "pointer"
437
+ }
438
+ }, inputProps), focusProps)), /* @__PURE__ */ React10.createElement(Icon, __spreadValues({
439
+ checked: inputProps.checked,
440
+ indeterminate,
441
+ css: styles.checkbox
442
+ }, stateProps)), /* @__PURE__ */ React10.createElement(Box6, __spreadValues({
443
+ css: styles.label
444
+ }, stateProps), props.children));
415
445
  };
416
446
 
417
- // src/Column/Column.tsx
418
- import React13 from "react";
419
- var transform = (width) => {
420
- if (Array.isArray(width)) {
421
- return width.map((v) => `${v / 12 * 100}%`);
422
- }
423
- return `${width / 12 * 100}%`;
424
- };
425
- var Column = (_a) => {
447
+ // src/Columns/Columns.tsx
448
+ import React11, { Children } from "react";
449
+ var Columns = (_a) => {
426
450
  var _b = _a, {
427
- width = 12,
451
+ space = "none",
452
+ columns,
453
+ collapseAt = "40em",
428
454
  children
429
455
  } = _b, props = __objRest(_b, [
430
- "width",
456
+ "space",
457
+ "columns",
458
+ "collapseAt",
431
459
  "children"
432
460
  ]);
433
- return /* @__PURE__ */ React13.createElement(Box, __spreadProps(__spreadValues({}, props), {
434
- width: transform(width)
435
- }), children);
436
- };
437
-
438
- // src/Columns/Columns.tsx
439
- import React14, { Children as Children2 } from "react";
440
- import { useTheme } from "@marigold/system";
441
-
442
- // src/utils/flatten-children.ts
443
- import {
444
- Children,
445
- isValidElement,
446
- cloneElement
447
- } from "react";
448
- import { isFragment } from "react-is";
449
- var flattenChildren = (children, depth = 0, keys = []) => Children.toArray(children).reduce((acc, node) => {
450
- if (isFragment(node)) {
451
- acc.push.apply(acc, flattenChildren(node.props.children, depth + 1, keys.concat(node.key)));
452
- } else {
453
- if (isValidElement(node)) {
454
- acc.push(cloneElement(node, {
455
- key: keys.concat(String(node.key)).join(".")
456
- }));
457
- } else if (typeof node === "string" || typeof node === "number") {
458
- acc.push(node);
459
- }
461
+ if (Children.count(children) !== columns.length) {
462
+ throw new Error(`Columns: expected ${columns.length} children, got ${Children.count(children)}`);
460
463
  }
461
- return acc;
462
- }, []);
464
+ const getColumnWidths = columns.map((column, index) => {
465
+ return {
466
+ [`> :nth-of-type(${index + 1})`]: {
467
+ flexGrow: column
468
+ }
469
+ };
470
+ });
471
+ return /* @__PURE__ */ React11.createElement(Box, __spreadValues({
472
+ display: "flex",
473
+ css: Object.assign({
474
+ flexWrap: "wrap",
475
+ gap: space,
476
+ "> *": {
477
+ flexBasis: `calc(( ${collapseAt} - 100%) * 999)`
478
+ }
479
+ }, ...getColumnWidths)
480
+ }, props), children);
481
+ };
463
482
 
464
- // src/Columns/Columns.tsx
465
- var useAlignment = (direction) => {
466
- switch (direction) {
467
- case "right":
468
- return "flex-end";
469
- case "bottom":
470
- return "flex-end";
471
- case "center":
472
- return "center";
473
- }
474
- return "flex-start";
483
+ // src/Container/Container.tsx
484
+ import React12 from "react";
485
+ import { size as tokenSize } from "@marigold/tokens";
486
+ var ALIGNMENT = {
487
+ left: "flex-start",
488
+ center: "center",
489
+ right: "flex-end"
475
490
  };
476
- var Columns = (_a) => {
491
+ var Container = (_a) => {
477
492
  var _b = _a, {
478
- space = "none",
479
- horizontalAlign = "left",
480
- verticalAlign = "top",
481
- className,
493
+ contentType = "content",
494
+ size = "medium",
495
+ align = "left",
496
+ alignContainer = "left",
482
497
  children
483
498
  } = _b, props = __objRest(_b, [
484
- "space",
485
- "horizontalAlign",
486
- "verticalAlign",
487
- "className",
499
+ "contentType",
500
+ "size",
501
+ "align",
502
+ "alignContainer",
488
503
  "children"
489
504
  ]);
490
- const justifyContent = useAlignment(horizontalAlign);
491
- const alignItems = useAlignment(verticalAlign);
492
- const { css } = useTheme();
493
- const spaceObject = css({ space });
494
- const spaceValue = Object.values(spaceObject)[0];
495
- return /* @__PURE__ */ React14.createElement(Box, {
496
- p: space,
497
- display: "flex",
498
- className
499
- }, /* @__PURE__ */ React14.createElement(Box, __spreadValues({
500
- width: `calc(100% + ${spaceValue}px)`,
501
- m: `${-spaceValue / 2}px`,
502
- display: "flex",
503
- flexWrap: "wrap",
504
- alignItems,
505
- justifyContent
506
- }, props), Children2.map(flattenChildren(children), (child) => {
507
- return React14.cloneElement(child, {}, /* @__PURE__ */ React14.createElement(Box, {
508
- css: { p: `${spaceValue / 2}px` }
509
- }, child.props.children));
510
- })));
505
+ const maxWidth = tokenSize[contentType][size];
506
+ let gridTemplateColumns = `${maxWidth} 1fr 1fr`;
507
+ let gridColumn = 1;
508
+ if (alignContainer === "center") {
509
+ gridTemplateColumns = `1fr ${maxWidth} 1fr`;
510
+ gridColumn = 2;
511
+ }
512
+ if (alignContainer === "right") {
513
+ gridTemplateColumns = `1fr 1fr ${maxWidth}`;
514
+ gridColumn = 3;
515
+ }
516
+ return /* @__PURE__ */ React12.createElement(Box, __spreadValues({
517
+ display: "grid",
518
+ css: {
519
+ gridTemplateColumns,
520
+ placeItems: ALIGNMENT[align],
521
+ "> *": {
522
+ gridColumn
523
+ }
524
+ }
525
+ }, props), children);
511
526
  };
512
527
 
513
- // src/Dialog/Dialog.tsx
514
- import React17 from "react";
515
- import { useOverlayTriggerState } from "@react-stately/overlays";
516
- import { OverlayContainer } from "@react-aria/overlays";
517
- import { useButton as useButton2 } from "@react-aria/button";
518
- import { Close } from "@marigold/icons";
519
-
520
- // src/Text/Text.tsx
521
- import React15, { forwardRef as forwardRef2 } from "react";
522
- var Text = forwardRef2((_a, ref) => {
528
+ // src/Content/Content.tsx
529
+ import React13 from "react";
530
+ import {
531
+ Box as Box7,
532
+ useComponentStyles as useComponentStyles7
533
+ } from "@marigold/system";
534
+ var Content = (_a) => {
523
535
  var _b = _a, {
524
- as = "span",
525
- variant = "body",
526
536
  children,
527
- align,
528
- color,
529
- cursor,
530
- size,
531
- outline,
532
- userSelect
537
+ variant,
538
+ size
533
539
  } = _b, props = __objRest(_b, [
534
- "as",
535
- "variant",
536
540
  "children",
537
- "align",
538
- "color",
539
- "cursor",
540
- "size",
541
- "outline",
542
- "userSelect"
541
+ "variant",
542
+ "size"
543
543
  ]);
544
- return /* @__PURE__ */ React15.createElement(Box, __spreadProps(__spreadValues({}, props), {
545
- as,
546
- variant: `text.${variant}`,
547
- css: {
548
- textAlign: align,
549
- fontSize: size,
550
- color,
551
- cursor,
552
- outline,
553
- userSelect
554
- },
555
- ref
544
+ const styles = useComponentStyles7("Content", { variant, size });
545
+ return /* @__PURE__ */ React13.createElement(Box7, __spreadProps(__spreadValues({
546
+ as: "section"
547
+ }, props), {
548
+ css: styles
556
549
  }), children);
557
- });
550
+ };
558
551
 
559
- // src/Dialog/ModalDialog.tsx
560
- import React16 from "react";
561
- import {
562
- useOverlay,
563
- usePreventScroll,
564
- useModal
565
- } from "@react-aria/overlays";
552
+ // src/Dialog/Dialog.tsx
553
+ import React21, { useRef as useRef4 } from "react";
554
+ import { useButton as useButton2 } from "@react-aria/button";
566
555
  import { useDialog } from "@react-aria/dialog";
567
- import { FocusScope } from "@react-aria/focus";
568
- var ModalDialog = (_a) => {
556
+ import {
557
+ Box as Box10,
558
+ useComponentStyles as useComponentStyles11
559
+ } from "@marigold/system";
560
+
561
+ // src/Header/Header.tsx
562
+ import React14 from "react";
563
+ import {
564
+ useComponentStyles as useComponentStyles8
565
+ } from "@marigold/system";
566
+ var Header = (_a) => {
567
+ var _b = _a, { children, variant, size } = _b, props = __objRest(_b, ["children", "variant", "size"]);
568
+ const styles = useComponentStyles8("Header", { variant, size });
569
+ return /* @__PURE__ */ React14.createElement(Box, __spreadProps(__spreadValues({
570
+ as: "header"
571
+ }, props), {
572
+ css: styles
573
+ }), children);
574
+ };
575
+
576
+ // src/Headline/Headline.tsx
577
+ import React15 from "react";
578
+ import {
579
+ Box as Box8,
580
+ useComponentStyles as useComponentStyles9
581
+ } from "@marigold/system";
582
+ var Headline = (_a) => {
569
583
  var _b = _a, {
584
+ children,
570
585
  variant,
571
- backdropVariant = "backdrop",
572
- children
586
+ size,
587
+ level = "1"
573
588
  } = _b, props = __objRest(_b, [
589
+ "children",
574
590
  "variant",
575
- "backdropVariant",
576
- "children"
591
+ "size",
592
+ "level"
577
593
  ]);
578
- const _a2 = props, { isDismissable, isOpen, onClose } = _a2, restProps = __objRest(_a2, ["isDismissable", "isOpen", "onClose"]);
579
- const ref = React16.useRef();
580
- const { overlayProps, underlayProps } = useOverlay({ isDismissable, isOpen, onClose }, ref);
581
- usePreventScroll();
582
- const { modalProps } = useModal();
583
- const { dialogProps } = useDialog(props, ref);
584
- return /* @__PURE__ */ React16.createElement(Box, __spreadValues({
594
+ const styles = useComponentStyles9("Headline", {
595
+ variant,
596
+ size: size != null ? size : `level-${level}`
597
+ });
598
+ return /* @__PURE__ */ React15.createElement(Box8, __spreadProps(__spreadValues({
599
+ as: `h${level}`
600
+ }, props), {
601
+ css: styles
602
+ }), children);
603
+ };
604
+
605
+ // src/Dialog/Context.ts
606
+ import { createContext as createContext2, useContext as useContext2 } from "react";
607
+ var DialogContext = createContext2({});
608
+ var useDialogContext = () => useContext2(DialogContext);
609
+
610
+ // src/Dialog/DialogTrigger.tsx
611
+ import React20, { useRef as useRef3 } from "react";
612
+ import { PressResponder } from "@react-aria/interactions";
613
+ import { useOverlayTriggerState } from "@react-stately/overlays";
614
+
615
+ // src/Overlay/Modal.tsx
616
+ import React17, { forwardRef as forwardRef2 } from "react";
617
+ import { FocusScope } from "@react-aria/focus";
618
+ import { useModal, useOverlay, usePreventScroll } from "@react-aria/overlays";
619
+ import { mergeProps as mergeProps2, useObjectRef } from "@react-aria/utils";
620
+
621
+ // src/Overlay/Underlay.tsx
622
+ import React16 from "react";
623
+ import { Box as Box9, useComponentStyles as useComponentStyles10 } from "@marigold/system";
624
+ var Underlay = (_a) => {
625
+ var _b = _a, { size, variant } = _b, props = __objRest(_b, ["size", "variant"]);
626
+ const styles = useComponentStyles10("Underlay", { size, variant });
627
+ return /* @__PURE__ */ React16.createElement(Box9, __spreadValues({
585
628
  __baseCSS: {
586
- display: "grid",
587
- placeItems: "center",
588
629
  position: "fixed",
589
- zIndex: 100,
590
- top: 0,
591
- left: 0,
592
- bottom: 0,
593
- right: 0
630
+ inset: 0,
631
+ zIndex: 1
594
632
  },
595
- variant: `dialog.${backdropVariant}`
596
- }, underlayProps), /* @__PURE__ */ React16.createElement(FocusScope, {
633
+ css: styles
634
+ }, props));
635
+ };
636
+
637
+ // src/Overlay/Modal.tsx
638
+ var Modal = forwardRef2((_a, ref) => {
639
+ var _b = _a, { children, open, dismissable, keyboardDismissable, onClose } = _b, props = __objRest(_b, ["children", "open", "dismissable", "keyboardDismissable", "onClose"]);
640
+ const modalRef = useObjectRef(ref);
641
+ const { overlayProps, underlayProps } = useOverlay({
642
+ isOpen: open,
643
+ onClose,
644
+ isDismissable: dismissable,
645
+ isKeyboardDismissDisabled: !keyboardDismissable
646
+ }, modalRef);
647
+ usePreventScroll();
648
+ const { modalProps } = useModal({});
649
+ return /* @__PURE__ */ React17.createElement(FocusScope, {
597
650
  contain: true,
598
651
  restoreFocus: true,
599
652
  autoFocus: true
600
- }, /* @__PURE__ */ React16.createElement(Box, __spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, overlayProps), dialogProps), modalProps), {
601
- ref,
602
- variant: variant ? `dialog.${variant}` : `dialog`
603
- }), restProps), children)));
653
+ }, /* @__PURE__ */ React17.createElement(Underlay, __spreadValues({}, underlayProps)), /* @__PURE__ */ React17.createElement("div", __spreadValues({
654
+ style: {
655
+ display: "flex",
656
+ alignItems: "center",
657
+ justifyContent: "center",
658
+ position: "fixed",
659
+ inset: 0,
660
+ zIndex: 2,
661
+ pointerEvents: "none"
662
+ },
663
+ ref: modalRef
664
+ }, mergeProps2(props, overlayProps, modalProps)), /* @__PURE__ */ React17.createElement("div", {
665
+ style: { pointerEvents: "auto" }
666
+ }, children)));
667
+ });
668
+
669
+ // src/Overlay/Overlay.tsx
670
+ import React18 from "react";
671
+ import { OverlayContainer } from "@react-aria/overlays";
672
+ var Overlay = (_a) => {
673
+ var _b = _a, {
674
+ children,
675
+ open = false,
676
+ container = document.body
677
+ } = _b, props = __objRest(_b, [
678
+ "children",
679
+ "open",
680
+ "container"
681
+ ]);
682
+ if (!open) {
683
+ return null;
684
+ }
685
+ return /* @__PURE__ */ React18.createElement(OverlayContainer, {
686
+ portalContainer: container
687
+ }, /* @__PURE__ */ React18.createElement(Box, __spreadValues({}, props), children));
604
688
  };
605
689
 
606
- // src/Dialog/Dialog.tsx
607
- var Dialog = (_a) => {
690
+ // src/Overlay/Popover.tsx
691
+ import React19, { forwardRef as forwardRef3, useRef as useRef2 } from "react";
692
+ import { useModal as useModal2, useOverlay as useOverlay2 } from "@react-aria/overlays";
693
+ import { mergeProps as mergeProps3 } from "@react-aria/utils";
694
+ var Popover = forwardRef3((_a, ref) => {
608
695
  var _b = _a, {
609
- backdropVariant,
610
696
  children,
611
- className,
612
- close,
613
- isOpen,
614
- title,
615
- variant
697
+ open,
698
+ dismissable,
699
+ keyboardDismissDisabled,
700
+ shouldCloseOnBlur,
701
+ minWidth = 0
616
702
  } = _b, props = __objRest(_b, [
617
- "backdropVariant",
618
703
  "children",
619
- "className",
620
- "close",
621
- "isOpen",
622
- "title",
623
- "variant"
704
+ "open",
705
+ "dismissable",
706
+ "keyboardDismissDisabled",
707
+ "shouldCloseOnBlur",
708
+ "minWidth"
624
709
  ]);
625
- const closeButtonRef = React17.useRef();
626
- const { buttonProps: closeButtonProps } = useButton2({
627
- onPress: () => close()
628
- }, closeButtonRef);
629
- return /* @__PURE__ */ React17.createElement(OverlayContainer, null, /* @__PURE__ */ React17.createElement(ModalDialog, __spreadValues({
630
- variant,
631
- backdropVariant,
632
- isOpen,
633
- onClose: close,
634
- isDismissable: true
635
- }, props), /* @__PURE__ */ React17.createElement(Box, {
710
+ const fallbackRef = useRef2(null);
711
+ const popoverRef = ref || fallbackRef;
712
+ const { overlayProps } = useOverlay2(__spreadValues({
713
+ isOpen: open,
714
+ isDismissable: dismissable,
715
+ isKeyboardDismissDisabled: keyboardDismissDisabled,
716
+ shouldCloseOnBlur
717
+ }, props), popoverRef);
718
+ const { modalProps } = useModal2({});
719
+ const style = { minWidth };
720
+ return /* @__PURE__ */ React19.createElement(Overlay, {
721
+ open
722
+ }, /* @__PURE__ */ React19.createElement(Box, __spreadValues({
723
+ ref: popoverRef,
724
+ role: "presentation"
725
+ }, mergeProps3(props, overlayProps, modalProps, style)), children));
726
+ });
727
+
728
+ // src/Dialog/DialogTrigger.tsx
729
+ var DialogTrigger = ({
730
+ children,
731
+ dismissable = true,
732
+ keyboardDismissable = true
733
+ }) => {
734
+ const [dialogTrigger, dialog] = React20.Children.toArray(children);
735
+ const dialogTriggerRef = useRef3(null);
736
+ const state = useOverlayTriggerState({});
737
+ const ctx = { open: state.isOpen, close: state.close };
738
+ return /* @__PURE__ */ React20.createElement(DialogContext.Provider, {
739
+ value: ctx
740
+ }, /* @__PURE__ */ React20.createElement(PressResponder, {
741
+ ref: dialogTriggerRef,
742
+ isPressed: state.isOpen,
743
+ onPress: state.toggle
744
+ }, dialogTrigger), /* @__PURE__ */ React20.createElement(Overlay, {
745
+ open: state.isOpen
746
+ }, /* @__PURE__ */ React20.createElement(Modal, {
747
+ open: state.isOpen,
748
+ onClose: state.close,
749
+ dismissable,
750
+ keyboardDismissable
751
+ }, dialog)));
752
+ };
753
+
754
+ // src/Dialog/Dialog.tsx
755
+ var CloseButton = ({ css }) => {
756
+ const ref = useRef4(null);
757
+ const { close } = useDialogContext();
758
+ const { buttonProps } = useButton2({
759
+ onPress: () => close == null ? void 0 : close()
760
+ }, ref);
761
+ return /* @__PURE__ */ React21.createElement(Box10, {
762
+ css: { display: "flex", justifyContent: "flex-end" }
763
+ }, /* @__PURE__ */ React21.createElement(Box10, __spreadValues({
764
+ as: "button",
636
765
  __baseCSS: {
637
- display: "flex",
638
- justifyContent: "space-between",
639
- borderRadius: "small",
640
- pl: "large",
641
- pb: "large"
766
+ outline: "none",
767
+ border: "none",
768
+ cursor: "pointer",
769
+ height: 16,
770
+ width: 16,
771
+ lineHeight: 1,
772
+ p: 0
642
773
  },
643
- className
644
- }, /* @__PURE__ */ React17.createElement(Box, {
645
- pt: "medium"
646
- }, title && /* @__PURE__ */ React17.createElement(Text, {
647
- as: "h4",
648
- variant: "headline4"
649
- }, title), children), /* @__PURE__ */ React17.createElement(Box, {
650
- __baseCSS: {
651
- display: "flex",
652
- justifyContent: "flex-end",
653
- alignItems: "start",
654
- paddingTop: "xsmall",
655
- paddingX: "xsmall"
656
- }
657
- }, /* @__PURE__ */ React17.createElement(Box, __spreadProps(__spreadValues({
658
- as: Button,
659
- __baseCSS: {
660
- color: "text",
661
- bg: "transparent",
662
- lineHeight: "xsmall",
663
- px: "xxsmall",
664
- ":hover": {
665
- color: "text",
666
- bg: "transparent",
667
- cursor: "pointer"
668
- },
669
- ":focus": {
670
- outline: 0
671
- }
672
- }
673
- }, closeButtonProps), {
674
- ref: closeButtonRef
675
- }), /* @__PURE__ */ React17.createElement(Close, {
676
- size: 16
677
- }))))));
774
+ css,
775
+ ref
776
+ }, buttonProps), /* @__PURE__ */ React21.createElement("svg", {
777
+ viewBox: "0 0 20 20",
778
+ fill: "currentColor"
779
+ }, /* @__PURE__ */ React21.createElement("path", {
780
+ fillRule: "evenodd",
781
+ clipRule: "evenodd",
782
+ d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
783
+ }))));
678
784
  };
679
- var useDialogButtonProps = () => {
680
- const state = useOverlayTriggerState({});
681
- const openButtonRef = React17.useRef();
682
- const { buttonProps: openButtonProps } = useButton2({
683
- onPress: () => state.open()
684
- }, openButtonRef);
685
- return {
686
- state,
687
- openButtonProps,
688
- openButtonRef
689
- };
785
+ var addTitleProps = (children, titleProps) => {
786
+ const childs = React21.Children.toArray(children);
787
+ const titleIndex = childs.findIndex((child) => React21.isValidElement(child) && (child.type === Header || child.type === Headline));
788
+ if (titleIndex < 0) {
789
+ console.warn("No child in <Dialog> found that can act as title for accessibility. Please add a <Header> or <Headline> as direct child.");
790
+ return children;
791
+ }
792
+ const titleChild = React21.cloneElement(childs[titleIndex], titleProps);
793
+ childs.splice(titleIndex, 1, titleChild);
794
+ return childs;
795
+ };
796
+ var Dialog = (_a) => {
797
+ var _b = _a, {
798
+ children,
799
+ variant,
800
+ size,
801
+ closeButton
802
+ } = _b, props = __objRest(_b, [
803
+ "children",
804
+ "variant",
805
+ "size",
806
+ "closeButton"
807
+ ]);
808
+ const ref = useRef4(null);
809
+ const { close } = useDialogContext();
810
+ const { dialogProps, titleProps } = useDialog(props, ref);
811
+ const styles = useComponentStyles11("Dialog", { variant, size }, { parts: ["container", "closeButton"] });
812
+ return /* @__PURE__ */ React21.createElement(Box10, __spreadValues({
813
+ __baseCSS: { bg: "#fff" },
814
+ css: styles.container
815
+ }, dialogProps), closeButton && /* @__PURE__ */ React21.createElement(CloseButton, {
816
+ css: styles.closeButton
817
+ }), typeof children === "function" ? children({ close, titleProps }) : props["aria-labelledby"] ? children : addTitleProps(children, titleProps));
690
818
  };
819
+ Dialog.Trigger = DialogTrigger;
691
820
 
692
821
  // src/Divider/Divider.tsx
693
- import React18 from "react";
822
+ import React22 from "react";
694
823
  import { useSeparator } from "@react-aria/separator";
824
+ import { useComponentStyles as useComponentStyles12 } from "@marigold/system";
695
825
  var Divider = (_a) => {
696
- var _b = _a, { variant = "" } = _b, props = __objRest(_b, ["variant"]);
826
+ var _b = _a, { variant } = _b, props = __objRest(_b, ["variant"]);
697
827
  const { separatorProps } = useSeparator(props);
698
- return /* @__PURE__ */ React18.createElement(Box, __spreadValues(__spreadValues({
699
- __baseCSS: { width: "100%", height: "1px", m: "none", bg: "text" },
700
- variant: `divider.${variant}`
828
+ const styles = useComponentStyles12("Divider", { variant });
829
+ return /* @__PURE__ */ React22.createElement(Box, __spreadValues(__spreadValues({
830
+ css: styles
701
831
  }, props), separatorProps));
702
832
  };
703
833
 
704
- // src/Field/Field.tsx
705
- import React19, { useRef } from "react";
706
- import { useTextField } from "@react-aria/textfield";
707
- import { Exclamation as Exclamation2 } from "@marigold/icons";
708
- var Field = (_a) => {
709
- var _b = _a, {
710
- type = "text",
711
- variant = "",
712
- labelVariant = "above",
713
- htmlFor,
714
- required,
715
- error,
716
- errorMessage
717
- } = _b, props = __objRest(_b, [
718
- "type",
719
- "variant",
720
- "labelVariant",
721
- "htmlFor",
722
- "required",
723
- "error",
724
- "errorMessage"
725
- ]);
726
- const ref = useRef(null);
727
- const { labelProps, inputProps, errorMessageProps } = useTextField(props, ref);
728
- return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(Label, __spreadValues({
729
- variant: labelVariant,
730
- htmlFor,
731
- required
732
- }, labelProps), props.label), /* @__PURE__ */ React19.createElement(Box, __spreadValues(__spreadProps(__spreadValues({
733
- as: "input",
734
- type,
735
- id: htmlFor,
736
- variant: `input.${variant}`
737
- }, inputProps), {
738
- ref
739
- }), props)), error && errorMessage && /* @__PURE__ */ React19.createElement(ValidationMessage, __spreadValues({}, errorMessageProps), /* @__PURE__ */ React19.createElement(Exclamation2, {
740
- size: 16
741
- }), errorMessage));
834
+ // src/Footer/Footer.tsx
835
+ import React23 from "react";
836
+ import {
837
+ useComponentStyles as useComponentStyles13
838
+ } from "@marigold/system";
839
+ var Footer = (_a) => {
840
+ var _b = _a, { children, variant, size } = _b, props = __objRest(_b, ["children", "variant", "size"]);
841
+ const styles = useComponentStyles13("Footer", { variant, size });
842
+ return /* @__PURE__ */ React23.createElement(Box, __spreadProps(__spreadValues({
843
+ as: "footer"
844
+ }, props), {
845
+ css: styles
846
+ }), children);
742
847
  };
743
848
 
744
- // src/VisuallyHidden/VisuallyHidden.tsx
745
- import { VisuallyHidden as VisuallyHidden2 } from "@react-aria/visually-hidden";
746
-
747
849
  // src/Image/Image.tsx
748
- import React20 from "react";
850
+ import React24 from "react";
851
+ import { useComponentStyles as useComponentStyles14 } from "@marigold/system";
749
852
  var Image = (_a) => {
853
+ var _b = _a, { variant } = _b, props = __objRest(_b, ["variant"]);
854
+ const styles = useComponentStyles14("Image", { variant });
855
+ return /* @__PURE__ */ React24.createElement(Box, __spreadProps(__spreadValues({}, props), {
856
+ as: "img",
857
+ css: styles
858
+ }));
859
+ };
860
+
861
+ // src/Inline/Inline.tsx
862
+ import React25 from "react";
863
+ var ALIGNMENT2 = {
864
+ top: "flex-start",
865
+ center: "center",
866
+ bottom: "flex-end"
867
+ };
868
+ var Inline = (_a) => {
750
869
  var _b = _a, {
751
- variant = "fullWidth"
870
+ space = "none",
871
+ align = "center",
872
+ children
752
873
  } = _b, props = __objRest(_b, [
753
- "variant"
874
+ "space",
875
+ "align",
876
+ "children"
754
877
  ]);
755
- return /* @__PURE__ */ React20.createElement(Box, __spreadProps(__spreadValues({}, props), {
756
- as: "img",
757
- variant: `image.${variant}`
758
- }));
878
+ return /* @__PURE__ */ React25.createElement(Box, __spreadValues({
879
+ __baseCSS: { gap: space, flexWrap: "wrap" },
880
+ display: "inline-flex",
881
+ alignItems: ALIGNMENT2[align]
882
+ }, props), children);
759
883
  };
760
884
 
885
+ // src/Input/Input.tsx
886
+ import React26, { forwardRef as forwardRef4 } from "react";
887
+ import { Box as Box11, useComponentStyles as useComponentStyles15 } from "@marigold/system";
888
+ var Input = forwardRef4((_a, ref) => {
889
+ var _b = _a, { variant, size, type = "text" } = _b, props = __objRest(_b, ["variant", "size", "type"]);
890
+ const styles = useComponentStyles15("Input", { variant, size });
891
+ return /* @__PURE__ */ React26.createElement(Box11, __spreadProps(__spreadValues({}, props), {
892
+ ref,
893
+ as: "input",
894
+ type,
895
+ css: styles
896
+ }));
897
+ });
898
+
761
899
  // src/Link/Link.tsx
762
- import React21, { useRef as useRef2 } from "react";
900
+ import React27, { useRef as useRef5 } from "react";
763
901
  import { useLink } from "@react-aria/link";
902
+ import { useComponentStyles as useComponentStyles16 } from "@marigold/system";
764
903
  var Link = (_a) => {
765
904
  var _b = _a, {
766
905
  as = "a",
767
- variant = "link",
906
+ variant,
907
+ size,
768
908
  children,
769
909
  disabled
770
910
  } = _b, props = __objRest(_b, [
771
911
  "as",
772
912
  "variant",
913
+ "size",
773
914
  "children",
774
915
  "disabled"
775
916
  ]);
776
- const ref = useRef2();
917
+ const ref = useRef5(null);
777
918
  const { linkProps } = useLink(__spreadProps(__spreadValues({}, props), {
778
919
  elementType: typeof as === "string" ? as : "span",
779
920
  isDisabled: disabled
780
921
  }), ref);
781
- return /* @__PURE__ */ React21.createElement(Text, __spreadProps(__spreadValues(__spreadValues({}, props), linkProps), {
922
+ const styles = useComponentStyles16("Link", { variant, size });
923
+ return /* @__PURE__ */ React27.createElement(Box, __spreadValues(__spreadValues({
782
924
  as,
783
- variant,
925
+ css: styles,
784
926
  ref
785
- }), children);
927
+ }, props), linkProps), children);
786
928
  };
787
929
 
788
930
  // src/Menu/Menu.tsx
789
- import React22 from "react";
790
- var Menu = (_a) => {
791
- var _b = _a, {
792
- variant = "default",
793
- label = "Menu",
794
- onClick,
795
- show = false,
796
- children
797
- } = _b, props = __objRest(_b, [
798
- "variant",
799
- "label",
800
- "onClick",
801
- "show",
802
- "children"
803
- ]);
804
- return /* @__PURE__ */ React22.createElement(Box, __spreadValues({
805
- variant: `menu.${variant}`
806
- }, props), /* @__PURE__ */ React22.createElement(Button, {
807
- onClick,
808
- variant: "menu"
809
- }, label), show ? /* @__PURE__ */ React22.createElement(Box, {
810
- display: "block",
811
- position: "absolute",
812
- minWidth: "120px",
813
- borderRadius: "2px"
814
- }, children) : null);
815
- };
931
+ import React30, { useRef as useRef8 } from "react";
932
+ import { FocusScope as FocusScope2 } from "@react-aria/focus";
933
+ import { useMenu } from "@react-aria/menu";
934
+ import { DismissButton } from "@react-aria/overlays";
935
+ import { Item } from "@react-stately/collections";
936
+ import { useTreeState } from "@react-stately/tree";
937
+ import {
938
+ Box as Box13,
939
+ useComponentStyles as useComponentStyles17
940
+ } from "@marigold/system";
816
941
 
817
- // src/MenuItem/MenuItem.tsx
818
- import React23 from "react";
819
- var MenuItem = (_a) => {
820
- var _b = _a, {
821
- variant = "default",
822
- children
823
- } = _b, props = __objRest(_b, [
824
- "variant",
825
- "children"
826
- ]);
827
- return /* @__PURE__ */ React23.createElement(Box, {
828
- variant: `menuItem.${variant}`
829
- }, /* @__PURE__ */ React23.createElement(Link, __spreadValues({
830
- variant: "menuItemLink"
831
- }, props), children));
942
+ // src/Menu/Context.ts
943
+ import { createContext as createContext3, useContext as useContext3 } from "react";
944
+ var MenuContext = createContext3({});
945
+ var useMenuContext = () => useContext3(MenuContext);
946
+
947
+ // src/Menu/MenuTrigger.tsx
948
+ import React28, { useRef as useRef6 } from "react";
949
+ import { useMenuTriggerState } from "@react-stately/menu";
950
+ import { useMenuTrigger } from "@react-aria/menu";
951
+ import { useOverlayPosition } from "@react-aria/overlays";
952
+ import { PressResponder as PressResponder2 } from "@react-aria/interactions";
953
+ var MenuTrigger = ({ disabled, children }) => {
954
+ const [menuTrigger, menu] = React28.Children.toArray(children);
955
+ const menuTriggerRef = useRef6(null);
956
+ const overlayRef = useRef6(null);
957
+ const state = useMenuTriggerState({});
958
+ const { menuTriggerProps, menuProps } = useMenuTrigger({ trigger: "press", isDisabled: disabled }, state, menuTriggerRef);
959
+ const { overlayProps: positionProps } = useOverlayPosition({
960
+ targetRef: menuTriggerRef,
961
+ overlayRef,
962
+ isOpen: state.isOpen
963
+ });
964
+ const menuContext = __spreadProps(__spreadValues({}, menuProps), {
965
+ open: state.isOpen,
966
+ onClose: state.close,
967
+ autoFocus: state.focusStrategy,
968
+ triggerWidth: menuTriggerRef.current ? menuTriggerRef.current.offsetWidth : void 0
969
+ });
970
+ return /* @__PURE__ */ React28.createElement(MenuContext.Provider, {
971
+ value: menuContext
972
+ }, /* @__PURE__ */ React28.createElement(PressResponder2, __spreadProps(__spreadValues({}, menuTriggerProps), {
973
+ ref: menuTriggerRef,
974
+ isPressed: state.isOpen
975
+ }), menuTrigger), /* @__PURE__ */ React28.createElement(Popover, __spreadValues({
976
+ open: state.isOpen,
977
+ onClose: state.close,
978
+ dismissable: true,
979
+ shouldCloseOnBlur: true,
980
+ ref: overlayRef
981
+ }, positionProps), menu));
832
982
  };
833
983
 
984
+ // src/Menu/MenuItem.tsx
985
+ import React29, { useRef as useRef7 } from "react";
986
+ import { useFocusRing as useFocusRing3 } from "@react-aria/focus";
987
+ import { useMenuItem } from "@react-aria/menu";
988
+ import { mergeProps as mergeProps4 } from "@react-aria/utils";
989
+ import { Box as Box12, useStateProps as useStateProps3 } from "@marigold/system";
990
+ var MenuItem = ({ item, state, onAction, css }) => {
991
+ const ref = useRef7(null);
992
+ const { onClose } = useMenuContext();
993
+ const { menuItemProps } = useMenuItem({
994
+ key: item.key,
995
+ onAction,
996
+ onClose
997
+ }, state, ref);
998
+ const { isFocusVisible, focusProps } = useFocusRing3();
999
+ const stateProps = useStateProps3({
1000
+ focus: isFocusVisible
1001
+ });
1002
+ return /* @__PURE__ */ React29.createElement(Box12, __spreadValues(__spreadValues({
1003
+ as: "li",
1004
+ ref,
1005
+ __baseCSS: {
1006
+ "&:focus": {
1007
+ outline: 0
1008
+ }
1009
+ },
1010
+ css
1011
+ }, mergeProps4(menuItemProps, focusProps)), stateProps), item.rendered);
1012
+ };
1013
+
1014
+ // src/Menu/Menu.tsx
1015
+ var Menu = (_a) => {
1016
+ var _b = _a, { variant, size } = _b, props = __objRest(_b, ["variant", "size"]);
1017
+ const _a2 = useMenuContext(), { triggerWidth } = _a2, menuContext = __objRest(_a2, ["triggerWidth"]);
1018
+ const ownProps = __spreadValues(__spreadValues({}, props), menuContext);
1019
+ const ref = useRef8(null);
1020
+ const state = useTreeState(__spreadProps(__spreadValues({}, ownProps), { selectionMode: "none" }));
1021
+ const { menuProps } = useMenu(ownProps, state, ref);
1022
+ const styles = useComponentStyles17("Menu", { variant, size }, { parts: ["container", "item"] });
1023
+ return /* @__PURE__ */ React30.createElement(FocusScope2, {
1024
+ restoreFocus: true
1025
+ }, /* @__PURE__ */ React30.createElement("div", null, /* @__PURE__ */ React30.createElement(DismissButton, {
1026
+ onDismiss: ownProps.onClose
1027
+ }), /* @__PURE__ */ React30.createElement(Box13, __spreadValues({
1028
+ as: "ul",
1029
+ ref,
1030
+ style: { width: triggerWidth },
1031
+ __baseCSS: {
1032
+ listStyle: "none",
1033
+ p: 0,
1034
+ overflowWrap: "break-word"
1035
+ },
1036
+ css: styles.container
1037
+ }, menuProps), [...state.collection].map((item) => /* @__PURE__ */ React30.createElement(MenuItem, {
1038
+ key: item.key,
1039
+ item,
1040
+ state,
1041
+ onAction: props.onSelect,
1042
+ css: styles.item
1043
+ }))), /* @__PURE__ */ React30.createElement(DismissButton, {
1044
+ onDismiss: ownProps.onClose
1045
+ })));
1046
+ };
1047
+ Menu.Trigger = MenuTrigger;
1048
+ Menu.Item = Item;
1049
+
834
1050
  // src/Message/Message.tsx
835
- import React24 from "react";
836
- import { Exclamation as Exclamation3, Info, Notification } from "@marigold/icons";
1051
+ import React31 from "react";
1052
+ import { Exclamation, Info, Notification } from "@marigold/icons";
1053
+ import { useComponentStyles as useComponentStyles18 } from "@marigold/system";
837
1054
  var Message = (_a) => {
838
1055
  var _b = _a, {
839
1056
  messageTitle,
840
1057
  variant = "info",
841
- className,
1058
+ size,
842
1059
  children
843
1060
  } = _b, props = __objRest(_b, [
844
1061
  "messageTitle",
845
1062
  "variant",
846
- "className",
1063
+ "size",
847
1064
  "children"
848
1065
  ]);
849
- var icon = /* @__PURE__ */ React24.createElement(Info, null);
1066
+ const styles = useComponentStyles18("Message", {
1067
+ variant,
1068
+ size
1069
+ }, { parts: ["container", "icon", "title", "content"] });
1070
+ var icon = /* @__PURE__ */ React31.createElement(Info, null);
850
1071
  if (variant === "warning") {
851
- icon = /* @__PURE__ */ React24.createElement(Notification, null);
1072
+ icon = /* @__PURE__ */ React31.createElement(Notification, null);
852
1073
  }
853
1074
  if (variant === "error") {
854
- icon = /* @__PURE__ */ React24.createElement(Exclamation3, null);
1075
+ icon = /* @__PURE__ */ React31.createElement(Exclamation, null);
855
1076
  }
856
- return /* @__PURE__ */ React24.createElement(Box, __spreadValues({
857
- display: "inline-block",
858
- variant: `message.${variant}`,
859
- className
860
- }, props), /* @__PURE__ */ React24.createElement(Box, {
861
- display: "flex",
862
- alignItems: "center",
863
- variant: "message.title"
864
- }, icon, /* @__PURE__ */ React24.createElement(Text, {
865
- as: "h4",
866
- variant: "headline4"
867
- }, messageTitle)), /* @__PURE__ */ React24.createElement(Box, {
868
- css: { color: "black" }
1077
+ return /* @__PURE__ */ React31.createElement(Box, __spreadValues({
1078
+ css: styles.container
1079
+ }, props), /* @__PURE__ */ React31.createElement(Box, {
1080
+ __baseCSS: { display: "flex", alignItems: "center", gap: 4 }
1081
+ }, /* @__PURE__ */ React31.createElement(Box, {
1082
+ role: "presentation",
1083
+ css: styles.icon
1084
+ }, icon), /* @__PURE__ */ React31.createElement(Box, {
1085
+ css: styles.title
1086
+ }, messageTitle)), /* @__PURE__ */ React31.createElement(Box, {
1087
+ css: styles.content
869
1088
  }, children));
870
1089
  };
871
1090
 
1091
+ // src/NumberField/NumberField.tsx
1092
+ import React35, { forwardRef as forwardRef5 } from "react";
1093
+ import { useFocusRing as useFocusRing4 } from "@react-aria/focus";
1094
+ import { useHover as useHover3 } from "@react-aria/interactions";
1095
+ import { useLocale } from "@react-aria/i18n";
1096
+ import { useNumberField } from "@react-aria/numberfield";
1097
+ import { mergeProps as mergeProps6, useObjectRef as useObjectRef2 } from "@react-aria/utils";
1098
+ import { useNumberFieldState } from "@react-stately/numberfield";
1099
+ import {
1100
+ Box as Box17,
1101
+ useComponentStyles as useComponentStyles20,
1102
+ useStateProps as useStateProps5
1103
+ } from "@marigold/system";
1104
+
1105
+ // src/FieldBase/FieldBase.tsx
1106
+ import React33 from "react";
1107
+ import { Box as Box15 } from "@marigold/system";
1108
+
1109
+ // src/HelpText/HelpText.tsx
1110
+ import React32 from "react";
1111
+ import { Exclamation as Exclamation2 } from "@marigold/icons";
1112
+ import {
1113
+ Box as Box14,
1114
+ useComponentStyles as useComponentStyles19
1115
+ } from "@marigold/system";
1116
+ var HelpText = (_a) => {
1117
+ var _b = _a, {
1118
+ variant,
1119
+ size,
1120
+ disabled,
1121
+ description,
1122
+ descriptionProps,
1123
+ error,
1124
+ errorMessage,
1125
+ errorMessageProps
1126
+ } = _b, props = __objRest(_b, [
1127
+ "variant",
1128
+ "size",
1129
+ "disabled",
1130
+ "description",
1131
+ "descriptionProps",
1132
+ "error",
1133
+ "errorMessage",
1134
+ "errorMessageProps"
1135
+ ]);
1136
+ var _a2;
1137
+ const hasErrorMessage = errorMessage && error;
1138
+ const styles = useComponentStyles19("HelpText", { variant, size }, { parts: ["container", "icon"] });
1139
+ return /* @__PURE__ */ React32.createElement(Box14, __spreadProps(__spreadValues(__spreadValues({}, hasErrorMessage ? errorMessageProps : descriptionProps), props), {
1140
+ __baseCSS: { display: "flex", alignItems: "center", gap: 4 },
1141
+ css: styles.container
1142
+ }), hasErrorMessage ? /* @__PURE__ */ React32.createElement(React32.Fragment, null, /* @__PURE__ */ React32.createElement(Exclamation2, {
1143
+ role: "presentation",
1144
+ size: ((_a2 = styles == null ? void 0 : styles.icon) == null ? void 0 : _a2.size) || 16
1145
+ }), errorMessage) : /* @__PURE__ */ React32.createElement(React32.Fragment, null, description));
1146
+ };
1147
+
1148
+ // src/FieldBase/FieldBase.tsx
1149
+ var FieldBase = ({
1150
+ variant,
1151
+ size,
1152
+ children,
1153
+ disabled,
1154
+ required,
1155
+ label,
1156
+ labelProps,
1157
+ description,
1158
+ descriptionProps,
1159
+ error,
1160
+ errorMessage,
1161
+ errorMessageProps,
1162
+ stateProps
1163
+ }) => {
1164
+ const hasHelpText = !!description || errorMessage && error;
1165
+ return /* @__PURE__ */ React33.createElement(Box15, {
1166
+ css: { display: "flex", flexDirection: "column", width: "100%" }
1167
+ }, label && /* @__PURE__ */ React33.createElement(Label, __spreadValues(__spreadValues({
1168
+ required,
1169
+ variant,
1170
+ size
1171
+ }, labelProps), stateProps), label), children, hasHelpText && /* @__PURE__ */ React33.createElement(HelpText, __spreadProps(__spreadValues({}, stateProps), {
1172
+ variant,
1173
+ size,
1174
+ disabled,
1175
+ description,
1176
+ descriptionProps,
1177
+ error,
1178
+ errorMessage,
1179
+ errorMessageProps
1180
+ })));
1181
+ };
1182
+
1183
+ // src/NumberField/StepButton.tsx
1184
+ import React34, { useRef as useRef9 } from "react";
1185
+ import { useButton as useButton3 } from "@react-aria/button";
1186
+ import { useHover as useHover2 } from "@react-aria/interactions";
1187
+ import { mergeProps as mergeProps5 } from "@react-aria/utils";
1188
+ import { Box as Box16, useStateProps as useStateProps4 } from "@marigold/system";
1189
+ var Plus = () => /* @__PURE__ */ React34.createElement(Box16, {
1190
+ as: "svg",
1191
+ __baseCSS: { width: 16, height: 16 },
1192
+ viewBox: "0 0 20 20",
1193
+ fill: "currentColor"
1194
+ }, /* @__PURE__ */ React34.createElement("path", {
1195
+ fillRule: "evenodd",
1196
+ clipRule: "evenodd",
1197
+ d: "M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z"
1198
+ }));
1199
+ var Minus = () => /* @__PURE__ */ React34.createElement(Box16, {
1200
+ as: "svg",
1201
+ __baseCSS: { width: 16, height: 16 },
1202
+ viewBox: "0 0 20 20",
1203
+ fill: "currentColor"
1204
+ }, /* @__PURE__ */ React34.createElement("path", {
1205
+ fillRule: "evenodd",
1206
+ clipRule: "evenodd",
1207
+ d: "M3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
1208
+ }));
1209
+ var StepButton = (_a) => {
1210
+ var _b = _a, { direction, css } = _b, props = __objRest(_b, ["direction", "css"]);
1211
+ const ref = useRef9(null);
1212
+ const { buttonProps, isPressed } = useButton3(__spreadProps(__spreadValues({}, props), { elementType: "div" }), ref);
1213
+ const { hoverProps, isHovered } = useHover2(props);
1214
+ const stateProps = useStateProps4({
1215
+ active: isPressed,
1216
+ hover: isHovered,
1217
+ disabled: props.isDisabled
1218
+ });
1219
+ const Icon3 = direction === "up" ? Plus : Minus;
1220
+ return /* @__PURE__ */ React34.createElement(Box16, __spreadValues(__spreadValues({
1221
+ __baseCSS: {
1222
+ display: "flex",
1223
+ alignItems: "center",
1224
+ justifyContent: "center",
1225
+ cursor: props.isDisabled ? "not-allowed" : "pointer"
1226
+ },
1227
+ css
1228
+ }, mergeProps5(buttonProps, hoverProps)), stateProps), /* @__PURE__ */ React34.createElement(Icon3, null));
1229
+ };
1230
+
1231
+ // src/NumberField/NumberField.tsx
1232
+ var NumberField = forwardRef5((_a, ref) => {
1233
+ var _b = _a, {
1234
+ disabled,
1235
+ required,
1236
+ readOnly,
1237
+ error,
1238
+ variant,
1239
+ size,
1240
+ hideStepper
1241
+ } = _b, rest = __objRest(_b, [
1242
+ "disabled",
1243
+ "required",
1244
+ "readOnly",
1245
+ "error",
1246
+ "variant",
1247
+ "size",
1248
+ "hideStepper"
1249
+ ]);
1250
+ const props = __spreadValues({
1251
+ isDisabled: disabled,
1252
+ isRequired: required,
1253
+ isReadOnly: readOnly,
1254
+ validationState: error ? "invalid" : "valid"
1255
+ }, rest);
1256
+ const showStepper = !hideStepper;
1257
+ const { locale } = useLocale();
1258
+ const inputRef = useObjectRef2(ref);
1259
+ const state = useNumberFieldState(__spreadProps(__spreadValues({}, props), { locale }));
1260
+ const {
1261
+ labelProps,
1262
+ groupProps,
1263
+ inputProps,
1264
+ descriptionProps,
1265
+ errorMessageProps,
1266
+ incrementButtonProps,
1267
+ decrementButtonProps
1268
+ } = useNumberField(props, state, inputRef);
1269
+ const { hoverProps, isHovered } = useHover3({ isDisabled: disabled });
1270
+ const { focusProps, isFocused } = useFocusRing4({
1271
+ within: true,
1272
+ isTextInput: true,
1273
+ autoFocus: props.autoFocus
1274
+ });
1275
+ const styles = useComponentStyles20("NumberField", { variant, size }, { parts: ["group", "stepper"] });
1276
+ const stateProps = useStateProps5({
1277
+ hover: isHovered,
1278
+ focus: isFocused,
1279
+ disabled,
1280
+ readOnly,
1281
+ error
1282
+ });
1283
+ return /* @__PURE__ */ React35.createElement(FieldBase, {
1284
+ label: props.label,
1285
+ labelProps,
1286
+ required,
1287
+ description: props.description,
1288
+ descriptionProps,
1289
+ error,
1290
+ errorMessage: props.errorMessage,
1291
+ errorMessageProps,
1292
+ stateProps,
1293
+ variant,
1294
+ size
1295
+ }, /* @__PURE__ */ React35.createElement(Box17, __spreadValues(__spreadValues({
1296
+ "data-group": true,
1297
+ __baseCSS: {
1298
+ display: "flex",
1299
+ alignItems: "stretch",
1300
+ "> input": {
1301
+ flexGrow: 1
1302
+ }
1303
+ },
1304
+ css: styles.group
1305
+ }, mergeProps6(groupProps, focusProps, hoverProps)), stateProps), showStepper && /* @__PURE__ */ React35.createElement(StepButton, __spreadValues({
1306
+ direction: "down",
1307
+ css: styles.stepper
1308
+ }, decrementButtonProps)), /* @__PURE__ */ React35.createElement(Input, __spreadValues(__spreadValues({
1309
+ ref: inputRef,
1310
+ variant,
1311
+ size
1312
+ }, inputProps), stateProps)), showStepper && /* @__PURE__ */ React35.createElement(StepButton, __spreadValues({
1313
+ direction: "up",
1314
+ css: styles.stepper
1315
+ }, incrementButtonProps))));
1316
+ });
1317
+
872
1318
  // src/Provider/index.ts
873
- import { useTheme as useTheme3, ThemeProvider as ThemeProvider2 } from "@marigold/system";
1319
+ import { useTheme as useTheme2, ThemeProvider as ThemeProvider2 } from "@marigold/system";
874
1320
  import { SSRProvider } from "@react-aria/ssr";
875
1321
 
876
1322
  // src/Provider/MarigoldProvider.tsx
877
- import React25 from "react";
1323
+ import React36 from "react";
878
1324
  import { OverlayProvider } from "@react-aria/overlays";
879
1325
  import {
880
- Global,
881
- ThemeProvider,
882
- useTheme as useTheme2,
883
- __defaultTheme
884
- } from "@marigold/system";
885
- function MarigoldProvider({
886
- theme,
887
- children
888
- }) {
889
- const outer = useTheme2();
890
- const isTopLevel = outer.theme === __defaultTheme;
891
- return /* @__PURE__ */ React25.createElement(ThemeProvider, {
892
- theme
893
- }, isTopLevel ? /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(Global, null), /* @__PURE__ */ React25.createElement(OverlayProvider, null, children)) : children);
894
- }
1326
+ Global,
1327
+ ThemeProvider,
1328
+ useTheme,
1329
+ __defaultTheme
1330
+ } from "@marigold/system";
1331
+ function MarigoldProvider({
1332
+ theme,
1333
+ children
1334
+ }) {
1335
+ const outer = useTheme();
1336
+ const isTopLevel = outer.theme === __defaultTheme;
1337
+ return /* @__PURE__ */ React36.createElement(ThemeProvider, {
1338
+ theme
1339
+ }, isTopLevel ? /* @__PURE__ */ React36.createElement(React36.Fragment, null, /* @__PURE__ */ React36.createElement(Global, null), /* @__PURE__ */ React36.createElement(OverlayProvider, null, children)) : children);
1340
+ }
1341
+
1342
+ // src/Radio/Radio.tsx
1343
+ import React38, { useRef as useRef10 } from "react";
1344
+ import { useRadio } from "@react-aria/radio";
1345
+ import {
1346
+ Box as Box19,
1347
+ useComponentStyles as useComponentStyles22,
1348
+ useStateProps as useStateProps6
1349
+ } from "@marigold/system";
1350
+
1351
+ // src/Radio/RadioGroup.tsx
1352
+ import React37, { useContext as useContext4 } from "react";
1353
+ import { useRadioGroup } from "@react-aria/radio";
1354
+ import { useRadioGroupState } from "@react-stately/radio";
1355
+ import {
1356
+ Box as Box18,
1357
+ useComponentStyles as useComponentStyles21
1358
+ } from "@marigold/system";
1359
+ var RadioGroupContext = React37.createContext(null);
1360
+ var useRadioGroupContext = () => useContext4(RadioGroupContext);
1361
+ var RadioGroup = (_a) => {
1362
+ var _b = _a, {
1363
+ children,
1364
+ orientation = "vertical",
1365
+ size,
1366
+ variant,
1367
+ required,
1368
+ disabled,
1369
+ readOnly,
1370
+ error
1371
+ } = _b, rest = __objRest(_b, [
1372
+ "children",
1373
+ "orientation",
1374
+ "size",
1375
+ "variant",
1376
+ "required",
1377
+ "disabled",
1378
+ "readOnly",
1379
+ "error"
1380
+ ]);
1381
+ const props = __spreadValues({
1382
+ isRequired: required,
1383
+ isDisabled: disabled,
1384
+ isReadOnly: readOnly,
1385
+ validationState: error ? "invalid" : "valid"
1386
+ }, rest);
1387
+ const state = useRadioGroupState(props);
1388
+ const { radioGroupProps, labelProps } = useRadioGroup(props, state);
1389
+ const styles = useComponentStyles21("RadioGroup", { variant, size }, { parts: ["container", "group"] });
1390
+ return /* @__PURE__ */ React37.createElement(Box18, __spreadProps(__spreadValues({}, radioGroupProps), {
1391
+ css: styles.container
1392
+ }), props.label && /* @__PURE__ */ React37.createElement(Label, __spreadValues({
1393
+ as: "span",
1394
+ required
1395
+ }, labelProps), props.label), /* @__PURE__ */ React37.createElement(Box18, {
1396
+ role: "presentation",
1397
+ "data-orientation": orientation,
1398
+ __baseCSS: {
1399
+ display: "flex",
1400
+ flexDirection: orientation === "vertical" ? "column" : "row",
1401
+ alignItems: "start",
1402
+ gap: orientation === "vertical" ? "0.5ch" : "1.5ch"
1403
+ },
1404
+ css: styles.group
1405
+ }, /* @__PURE__ */ React37.createElement(RadioGroupContext.Provider, {
1406
+ value: __spreadValues({ variant, size, error }, state)
1407
+ }, children)));
1408
+ };
1409
+
1410
+ // src/Radio/Radio.tsx
1411
+ import { useHover as useHover4 } from "@react-aria/interactions";
1412
+ import { useFocusRing as useFocusRing5 } from "@react-aria/focus";
1413
+ var Dot = () => /* @__PURE__ */ React38.createElement("svg", {
1414
+ viewBox: "0 0 6 6"
1415
+ }, /* @__PURE__ */ React38.createElement("circle", {
1416
+ fill: "currentColor",
1417
+ cx: "3",
1418
+ cy: "3",
1419
+ r: "3"
1420
+ }));
1421
+ var Icon2 = (_a) => {
1422
+ var _b = _a, { checked, css } = _b, props = __objRest(_b, ["checked", "css"]);
1423
+ return /* @__PURE__ */ React38.createElement(Box19, __spreadValues({
1424
+ "aria-hidden": "true",
1425
+ __baseCSS: {
1426
+ width: 16,
1427
+ height: 16,
1428
+ bg: "#fff",
1429
+ border: "1px solid #000",
1430
+ borderRadius: "50%",
1431
+ display: "flex",
1432
+ alignItems: "center",
1433
+ justifyContent: "center",
1434
+ p: 4
1435
+ },
1436
+ css
1437
+ }, props), checked ? /* @__PURE__ */ React38.createElement(Dot, null) : null);
1438
+ };
1439
+ var Radio = (_a) => {
1440
+ var _b = _a, { disabled } = _b, props = __objRest(_b, ["disabled"]);
1441
+ const _a2 = useRadioGroupContext(), { variant, size, error } = _a2, state = __objRest(_a2, ["variant", "size", "error"]);
1442
+ const ref = useRef10(null);
1443
+ const { inputProps } = useRadio(__spreadValues({ isDisabled: disabled }, props), state, ref);
1444
+ const styles = useComponentStyles22("Radio", { variant: variant || props.variant, size: size || props.size }, { parts: ["container", "label", "radio"] });
1445
+ const { hoverProps, isHovered } = useHover4({});
1446
+ const { isFocusVisible, focusProps } = useFocusRing5();
1447
+ const stateProps = useStateProps6({
1448
+ hover: isHovered,
1449
+ focus: isFocusVisible,
1450
+ checked: inputProps.checked,
1451
+ disabled: inputProps.disabled,
1452
+ readOnly: props.readOnly,
1453
+ error
1454
+ });
1455
+ return /* @__PURE__ */ React38.createElement(Box19, __spreadValues(__spreadValues({
1456
+ as: "label",
1457
+ __baseCSS: {
1458
+ display: "flex",
1459
+ alignItems: "center",
1460
+ gap: "1ch",
1461
+ position: "relative"
1462
+ },
1463
+ css: styles.container
1464
+ }, hoverProps), stateProps), /* @__PURE__ */ React38.createElement(Box19, __spreadValues(__spreadValues({
1465
+ as: "input",
1466
+ ref,
1467
+ css: {
1468
+ position: "absolute",
1469
+ width: "100%",
1470
+ height: "100%",
1471
+ top: 0,
1472
+ left: 0,
1473
+ zIndex: 1,
1474
+ opacity: 1e-4,
1475
+ cursor: inputProps.disabled ? "not-allowed" : "pointer"
1476
+ }
1477
+ }, inputProps), focusProps)), /* @__PURE__ */ React38.createElement(Icon2, __spreadValues({
1478
+ checked: inputProps.checked,
1479
+ css: styles.radio
1480
+ }, stateProps)), /* @__PURE__ */ React38.createElement(Box19, __spreadValues({
1481
+ css: styles.label
1482
+ }, stateProps), props.children));
1483
+ };
1484
+ Radio.Group = RadioGroup;
1485
+
1486
+ // src/Select/Select.tsx
1487
+ import React42, { useRef as useRef12 } from "react";
1488
+ import { useButton as useButton4 } from "@react-aria/button";
1489
+ import { FocusScope as FocusScope3, useFocusRing as useFocusRing6 } from "@react-aria/focus";
1490
+ import { useMessageFormatter } from "@react-aria/i18n";
1491
+ import { DismissButton as DismissButton2, useOverlayPosition as useOverlayPosition2 } from "@react-aria/overlays";
1492
+ import { HiddenSelect, useSelect } from "@react-aria/select";
1493
+ import { useSelectState } from "@react-stately/select";
1494
+ import { Item as Item2, Section } from "@react-stately/collections";
1495
+ import { mergeProps as mergeProps7 } from "@react-aria/utils";
1496
+ import {
1497
+ Box as Box23,
1498
+ useComponentStyles as useComponentStyles24,
1499
+ useStateProps as useStateProps8
1500
+ } from "@marigold/system";
1501
+
1502
+ // src/ListBox/ListBox.tsx
1503
+ import React41, { forwardRef as forwardRef6 } from "react";
1504
+ import { useObjectRef as useObjectRef3 } from "@react-aria/utils";
1505
+ import {
1506
+ Box as Box22,
1507
+ useComponentStyles as useComponentStyles23
1508
+ } from "@marigold/system";
1509
+ import { useListBox } from "@react-aria/listbox";
1510
+
1511
+ // src/ListBox/Context.ts
1512
+ import { createContext as createContext4, useContext as useContext5 } from "react";
1513
+ var ListBoxContext = createContext4({});
1514
+ var useListBoxContext = () => useContext5(ListBoxContext);
1515
+
1516
+ // src/ListBox/ListBoxSection.tsx
1517
+ import React40 from "react";
1518
+ import { useListBoxSection } from "@react-aria/listbox";
1519
+ import { Box as Box21 } from "@marigold/system";
1520
+
1521
+ // src/ListBox/ListBoxOption.tsx
1522
+ import React39, { useRef as useRef11 } from "react";
1523
+ import { useOption } from "@react-aria/listbox";
1524
+ import { Box as Box20, useStateProps as useStateProps7 } from "@marigold/system";
1525
+ var ListBoxOption = ({ item, state }) => {
1526
+ const ref = useRef11(null);
1527
+ const { optionProps, isSelected, isDisabled, isFocused } = useOption({
1528
+ key: item.key
1529
+ }, state, ref);
1530
+ const { styles } = useListBoxContext();
1531
+ const stateProps = useStateProps7({
1532
+ selected: isSelected,
1533
+ disabled: isDisabled,
1534
+ focusVisible: isFocused
1535
+ });
1536
+ return /* @__PURE__ */ React39.createElement(Box20, __spreadValues(__spreadValues({
1537
+ as: "li",
1538
+ ref,
1539
+ css: styles.option
1540
+ }, optionProps), stateProps), item.rendered);
1541
+ };
1542
+
1543
+ // src/ListBox/ListBoxSection.tsx
1544
+ var ListBoxSection = ({ section, state }) => {
1545
+ const { itemProps, headingProps, groupProps } = useListBoxSection({
1546
+ heading: section.rendered,
1547
+ "aria-label": section["aria-label"]
1548
+ });
1549
+ const { styles } = useListBoxContext();
1550
+ return /* @__PURE__ */ React40.createElement(Box21, __spreadValues({
1551
+ as: "li",
1552
+ css: styles.section
1553
+ }, itemProps), section.rendered && /* @__PURE__ */ React40.createElement(Box21, __spreadValues({
1554
+ css: styles.sectionTitle
1555
+ }, headingProps), section.rendered), /* @__PURE__ */ React40.createElement(Box21, __spreadValues({
1556
+ as: "ul",
1557
+ __baseCSS: { listStyle: "none", p: 0 },
1558
+ css: styles.list
1559
+ }, groupProps), [...section.childNodes].map((node) => /* @__PURE__ */ React40.createElement(ListBoxOption, {
1560
+ key: node.key,
1561
+ item: node,
1562
+ state
1563
+ }))));
1564
+ };
1565
+
1566
+ // src/ListBox/ListBox.tsx
1567
+ var ListBox = forwardRef6((_a, ref) => {
1568
+ var _b = _a, { state, variant, size } = _b, props = __objRest(_b, ["state", "variant", "size"]);
1569
+ const innerRef = useObjectRef3(ref);
1570
+ const { listBoxProps } = useListBox(props, state, innerRef);
1571
+ const styles = useComponentStyles23("ListBox", { variant, size }, { parts: ["container", "list", "option", "section", "sectionTitle"] });
1572
+ return /* @__PURE__ */ React41.createElement(ListBoxContext.Provider, {
1573
+ value: { styles }
1574
+ }, /* @__PURE__ */ React41.createElement(Box22, {
1575
+ css: styles.container
1576
+ }, /* @__PURE__ */ React41.createElement(Box22, __spreadValues({
1577
+ as: "ul",
1578
+ ref: innerRef,
1579
+ __baseCSS: { listStyle: "none", p: 0 },
1580
+ css: styles.list
1581
+ }, listBoxProps), [...state.collection].map((item) => item.type === "section" ? /* @__PURE__ */ React41.createElement(ListBoxSection, {
1582
+ key: item.key,
1583
+ section: item,
1584
+ state
1585
+ }) : /* @__PURE__ */ React41.createElement(ListBoxOption, {
1586
+ key: item.key,
1587
+ item,
1588
+ state
1589
+ })))));
1590
+ });
1591
+
1592
+ // src/Select/intl.ts
1593
+ var messages = {
1594
+ "en-US": {
1595
+ placeholder: "Select an option\u2026"
1596
+ },
1597
+ "de-DE": {
1598
+ placeholder: "Option ausw\xE4hlen\u2026"
1599
+ }
1600
+ };
1601
+
1602
+ // src/Select/Select.tsx
1603
+ var Chevron = ({ css }) => /* @__PURE__ */ React42.createElement(Box23, {
1604
+ as: "svg",
1605
+ __baseCSS: { width: 16, height: 16 },
1606
+ css,
1607
+ fill: "none",
1608
+ viewBox: "0 0 24 24",
1609
+ stroke: "currentColor",
1610
+ strokeWidth: 2
1611
+ }, /* @__PURE__ */ React42.createElement("path", {
1612
+ strokeLinecap: "round",
1613
+ strokeLinejoin: "round",
1614
+ d: "M19 9l-7 7-7-7"
1615
+ }));
1616
+ var Select = (_a) => {
1617
+ var _b = _a, {
1618
+ open,
1619
+ disabled,
1620
+ required,
1621
+ error,
1622
+ variant,
1623
+ size,
1624
+ css
1625
+ } = _b, rest = __objRest(_b, [
1626
+ "open",
1627
+ "disabled",
1628
+ "required",
1629
+ "error",
1630
+ "variant",
1631
+ "size",
1632
+ "css"
1633
+ ]);
1634
+ const formatMessage = useMessageFormatter(messages);
1635
+ const props = __spreadValues({
1636
+ isOpen: open,
1637
+ isDisabled: disabled,
1638
+ isRequired: required,
1639
+ validationState: error ? "invalid" : "valid",
1640
+ placeholder: rest.placeholder || formatMessage("placeholder")
1641
+ }, rest);
1642
+ const state = useSelectState(props);
1643
+ const buttonRef = useRef12(null);
1644
+ const {
1645
+ labelProps,
1646
+ triggerProps,
1647
+ valueProps,
1648
+ menuProps,
1649
+ descriptionProps,
1650
+ errorMessageProps
1651
+ } = useSelect(props, state, buttonRef);
1652
+ const { buttonProps } = useButton4(__spreadValues({ isDisabled: disabled }, triggerProps), buttonRef);
1653
+ const { focusProps, isFocusVisible } = useFocusRing6();
1654
+ const overlayRef = useRef12(null);
1655
+ const { overlayProps: positionProps } = useOverlayPosition2({
1656
+ targetRef: buttonRef,
1657
+ overlayRef,
1658
+ isOpen: state.isOpen,
1659
+ placement: "bottom left"
1660
+ });
1661
+ const styles = useComponentStyles24("Select", { variant, size }, { parts: ["container", "button", "icon"] });
1662
+ const stateProps = useStateProps8({
1663
+ disabled,
1664
+ error,
1665
+ focusVisible: isFocusVisible,
1666
+ expanded: state.isOpen
1667
+ });
1668
+ return /* @__PURE__ */ React42.createElement(FieldBase, {
1669
+ variant,
1670
+ size,
1671
+ label: props.label,
1672
+ labelProps: __spreadValues({ as: "span" }, labelProps),
1673
+ description: props.description,
1674
+ descriptionProps,
1675
+ error,
1676
+ errorMessage: props.errorMessage,
1677
+ errorMessageProps,
1678
+ stateProps,
1679
+ disabled,
1680
+ required
1681
+ }, /* @__PURE__ */ React42.createElement(HiddenSelect, {
1682
+ state,
1683
+ triggerRef: buttonRef,
1684
+ label: props.label,
1685
+ name: props.name,
1686
+ isDisabled: disabled
1687
+ }), /* @__PURE__ */ React42.createElement(Box23, __spreadValues(__spreadValues({
1688
+ as: "button",
1689
+ __baseCSS: {
1690
+ display: "flex",
1691
+ position: "relative",
1692
+ alignItems: "center",
1693
+ justifyContent: "space-between",
1694
+ width: "100%"
1695
+ },
1696
+ css: styles.button,
1697
+ ref: buttonRef
1698
+ }, mergeProps7(buttonProps, focusProps)), stateProps), /* @__PURE__ */ React42.createElement(Box23, __spreadValues({
1699
+ css: {
1700
+ overflow: "hidden",
1701
+ whiteSpace: "nowrap"
1702
+ }
1703
+ }, valueProps), state.selectedItem ? state.selectedItem.rendered : props.placeholder), /* @__PURE__ */ React42.createElement(Chevron, {
1704
+ css: styles.icon
1705
+ })), /* @__PURE__ */ React42.createElement(Popover, __spreadValues({
1706
+ open: state.isOpen,
1707
+ onClose: state.close,
1708
+ dismissable: true,
1709
+ shouldCloseOnBlur: true,
1710
+ minWidth: buttonRef.current ? buttonRef.current.offsetWidth : void 0,
1711
+ ref: overlayRef
1712
+ }, positionProps), /* @__PURE__ */ React42.createElement(FocusScope3, {
1713
+ restoreFocus: true
1714
+ }, /* @__PURE__ */ React42.createElement(DismissButton2, {
1715
+ onDismiss: state.close
1716
+ }), /* @__PURE__ */ React42.createElement(ListBox, __spreadValues({
1717
+ state,
1718
+ variant,
1719
+ size
1720
+ }, menuProps)), /* @__PURE__ */ React42.createElement(DismissButton2, {
1721
+ onDismiss: state.close
1722
+ }))));
1723
+ };
1724
+ Select.Option = Item2;
1725
+ Select.Section = Section;
1726
+
1727
+ // src/Slider/Slider.tsx
1728
+ import React44, { useRef as useRef13 } from "react";
1729
+ import { useSlider } from "@react-aria/slider";
1730
+ import { useSliderState } from "@react-stately/slider";
1731
+ import { useNumberFormatter } from "@react-aria/i18n";
1732
+ import { useComponentStyles as useComponentStyles25 } from "@marigold/system";
1733
+
1734
+ // src/Slider/Thumb.tsx
1735
+ import React43, { useEffect } from "react";
1736
+ import { useSliderThumb } from "@react-aria/slider";
1737
+ import { mergeProps as mergeProps8 } from "@react-aria/utils";
1738
+ import { useStateProps as useStateProps9 } from "@marigold/system";
1739
+
1740
+ // src/VisuallyHidden/VisuallyHidden.tsx
1741
+ import { VisuallyHidden } from "@react-aria/visually-hidden";
1742
+
1743
+ // src/Slider/Thumb.tsx
1744
+ import { useFocusRing as useFocusRing7 } from "@react-aria/focus";
1745
+ var Thumb = (_a) => {
1746
+ var _b = _a, { state, trackRef, styles } = _b, props = __objRest(_b, ["state", "trackRef", "styles"]);
1747
+ const { disabled } = props;
1748
+ const inputRef = React43.useRef(null);
1749
+ const { isFocusVisible, focusProps, isFocused } = useFocusRing7();
1750
+ const focused = isFocused || isFocusVisible || state.isThumbDragging(0);
1751
+ const stateProps = useStateProps9({
1752
+ focus: focused,
1753
+ disabled
1754
+ });
1755
+ const { thumbProps, inputProps } = useSliderThumb({
1756
+ index: 0,
1757
+ trackRef,
1758
+ inputRef,
1759
+ isDisabled: disabled
1760
+ }, state);
1761
+ useEffect(() => {
1762
+ state.setThumbEditable(0, !disabled);
1763
+ }, [disabled, state]);
1764
+ return /* @__PURE__ */ React43.createElement(Box, {
1765
+ __baseCSS: {
1766
+ position: "absolute",
1767
+ top: 16,
1768
+ transform: "translateX(-50%)",
1769
+ left: `${state.getThumbPercent(0) * 100}%`
1770
+ }
1771
+ }, /* @__PURE__ */ React43.createElement(Box, __spreadValues(__spreadProps(__spreadValues({}, thumbProps), {
1772
+ __baseCSS: styles
1773
+ }), stateProps), /* @__PURE__ */ React43.createElement(VisuallyHidden, null, /* @__PURE__ */ React43.createElement(Box, __spreadValues({
1774
+ as: "input",
1775
+ type: "range",
1776
+ ref: inputRef
1777
+ }, mergeProps8(inputProps, focusProps))))));
1778
+ };
1779
+
1780
+ // src/Slider/Slider.tsx
1781
+ var Slider = (_a) => {
1782
+ var _b = _a, { variant, size } = _b, props = __objRest(_b, ["variant", "size"]);
1783
+ const { formatOptions } = props;
1784
+ const trackRef = useRef13(null);
1785
+ const numberFormatter = useNumberFormatter(formatOptions);
1786
+ const state = useSliderState(__spreadProps(__spreadValues({}, props), { numberFormatter }));
1787
+ const { groupProps, trackProps, labelProps, outputProps } = useSlider(__spreadValues({
1788
+ label: props.children
1789
+ }, props), state, trackRef);
1790
+ const styles = useComponentStyles25("Slider", { variant, size }, { parts: ["track", "thumb", "label", "output"] });
1791
+ return /* @__PURE__ */ React44.createElement(Box, __spreadValues({
1792
+ __baseCSS: {
1793
+ display: "flex",
1794
+ flexDirection: "column",
1795
+ touchAction: "none"
1796
+ }
1797
+ }, groupProps), /* @__PURE__ */ React44.createElement(Box, {
1798
+ __baseCSS: { display: "flex", alignSelf: "stretch" }
1799
+ }, props.children && /* @__PURE__ */ React44.createElement(Box, __spreadValues({
1800
+ as: "label",
1801
+ __baseCSS: styles.label
1802
+ }, labelProps), props.children), /* @__PURE__ */ React44.createElement(Box, __spreadProps(__spreadValues({
1803
+ as: "output"
1804
+ }, outputProps), {
1805
+ __baseCSS: { flex: "1 0 auto", textAlign: "end" },
1806
+ css: styles.output
1807
+ }), state.getThumbValueLabel(0))), /* @__PURE__ */ React44.createElement(Box, __spreadProps(__spreadValues({}, trackProps), {
1808
+ ref: trackRef,
1809
+ __baseCSS: {
1810
+ position: "relative",
1811
+ height: 32,
1812
+ width: "100%",
1813
+ cursor: props.disabled ? "not-allowed" : "pointer"
1814
+ }
1815
+ }), /* @__PURE__ */ React44.createElement(Box, {
1816
+ __baseCSS: styles.track
1817
+ }), /* @__PURE__ */ React44.createElement(Thumb, {
1818
+ state,
1819
+ trackRef,
1820
+ disabled: props.disabled,
1821
+ styles: styles.thumb
1822
+ })));
1823
+ };
1824
+
1825
+ // src/Stack/Stack.tsx
1826
+ import React45 from "react";
1827
+ var ALIGNMENT3 = {
1828
+ left: "flex-start",
1829
+ center: "center",
1830
+ right: "flex-end"
1831
+ };
1832
+ var Stack = (_a) => {
1833
+ var _b = _a, {
1834
+ space = "none",
1835
+ align = "left",
1836
+ children
1837
+ } = _b, props = __objRest(_b, [
1838
+ "space",
1839
+ "align",
1840
+ "children"
1841
+ ]);
1842
+ return /* @__PURE__ */ React45.createElement(Box, __spreadProps(__spreadValues({}, props), {
1843
+ display: "flex",
1844
+ flexDirection: "column",
1845
+ alignItems: ALIGNMENT3[align],
1846
+ p: "0",
1847
+ css: { gap: space }
1848
+ }), children);
1849
+ };
1850
+
1851
+ // src/Switch/Switch.tsx
1852
+ import React46, { useRef as useRef14 } from "react";
1853
+ import { useFocusRing as useFocusRing8 } from "@react-aria/focus";
1854
+ import { useSwitch } from "@react-aria/switch";
1855
+ import { useToggleState as useToggleState2 } from "@react-stately/toggle";
1856
+ import {
1857
+ useComponentStyles as useComponentStyles26,
1858
+ useStateProps as useStateProps10
1859
+ } from "@marigold/system";
1860
+ var Switch = (_a) => {
1861
+ var _b = _a, {
1862
+ variant,
1863
+ size,
1864
+ checked,
1865
+ disabled,
1866
+ readOnly,
1867
+ defaultChecked
1868
+ } = _b, rest = __objRest(_b, [
1869
+ "variant",
1870
+ "size",
1871
+ "checked",
1872
+ "disabled",
1873
+ "readOnly",
1874
+ "defaultChecked"
1875
+ ]);
1876
+ const ref = useRef14(null);
1877
+ const props = __spreadValues({
1878
+ isSelected: checked,
1879
+ isDisabled: disabled,
1880
+ isReadOnly: readOnly,
1881
+ defaultSelected: defaultChecked
1882
+ }, rest);
1883
+ const state = useToggleState2(props);
1884
+ const { inputProps } = useSwitch(props, state, ref);
1885
+ const { isFocusVisible, focusProps } = useFocusRing8();
1886
+ const stateProps = useStateProps10({
1887
+ checked: state.isSelected,
1888
+ disabled,
1889
+ readOnly,
1890
+ focus: isFocusVisible
1891
+ });
1892
+ const styles = useComponentStyles26("Switch", { variant, size }, { parts: ["container", "label", "track", "thumb"] });
1893
+ return /* @__PURE__ */ React46.createElement(Box, {
1894
+ as: "label",
1895
+ __baseCSS: {
1896
+ display: "flex",
1897
+ alignItems: "center",
1898
+ justifyContent: "space-between",
1899
+ gap: "1ch",
1900
+ position: "relative"
1901
+ },
1902
+ css: styles.container
1903
+ }, /* @__PURE__ */ React46.createElement(Box, __spreadValues(__spreadValues({
1904
+ as: "input",
1905
+ ref,
1906
+ css: {
1907
+ position: "absolute",
1908
+ width: "100%",
1909
+ height: "100%",
1910
+ top: 0,
1911
+ left: 0,
1912
+ zIndex: 1,
1913
+ opacity: 1e-4,
1914
+ cursor: inputProps.disabled ? "not-allowed" : "pointer"
1915
+ }
1916
+ }, inputProps), focusProps)), props.children && /* @__PURE__ */ React46.createElement(Box, {
1917
+ css: styles.label
1918
+ }, props.children), /* @__PURE__ */ React46.createElement(Box, __spreadValues({
1919
+ __baseCSS: {
1920
+ position: "relative",
1921
+ width: 48,
1922
+ height: 24,
1923
+ bg: "#dee2e6",
1924
+ borderRadius: 20
1925
+ },
1926
+ css: styles.track
1927
+ }, stateProps), /* @__PURE__ */ React46.createElement(Box, __spreadValues({
1928
+ __baseCSS: {
1929
+ display: "block",
1930
+ position: "absolute",
1931
+ top: 1,
1932
+ left: 0,
1933
+ willChange: "transform",
1934
+ transform: "translateX(1px)",
1935
+ transition: "all 0.1s cubic-bezier(.7, 0, .3, 1)",
1936
+ height: 22,
1937
+ width: 22,
1938
+ borderRadius: 9999,
1939
+ bg: "#fff",
1940
+ "&:checked": {
1941
+ transform: "translateX(calc(47px - 100%))"
1942
+ }
1943
+ },
1944
+ css: styles.thumb
1945
+ }, stateProps))));
1946
+ };
1947
+
1948
+ // src/Table/Table.tsx
1949
+ import React53, { useRef as useRef19 } from "react";
1950
+ import { useTable } from "@react-aria/table";
1951
+ import {
1952
+ Cell,
1953
+ Column,
1954
+ Row,
1955
+ TableBody,
1956
+ TableHeader,
1957
+ useTableState
1958
+ } from "@react-stately/table";
1959
+ import { useComponentStyles as useComponentStyles28 } from "@marigold/system";
895
1960
 
896
- // src/Radio/Radio.tsx
897
- import React27 from "react";
898
- import { Exclamation as Exclamation4 } from "@marigold/icons";
899
- import { useFocusRing as useFocusRing2 } from "@react-aria/focus";
900
- import { VisuallyHidden as VisuallyHidden3 } from "@react-aria/visually-hidden";
901
-
902
- // src/Radio/RadioIcon.tsx
903
- import React26 from "react";
904
- import { conditional as conditional2, SVG as SVG2 } from "@marigold/system";
905
- var RadioIcon = ({
906
- variant = "",
907
- checked = false,
908
- disabled = false,
909
- error = false
1961
+ // src/Table/TableCell.tsx
1962
+ import React47, { useRef as useRef15 } from "react";
1963
+ import { useCheckbox as useCheckbox2 } from "@react-aria/checkbox";
1964
+ import { useFocusRing as useFocusRing9 } from "@react-aria/focus";
1965
+ import { useTableCell, useTableSelectionCheckbox } from "@react-aria/table";
1966
+ import { mergeProps as mergeProps9 } from "@react-aria/utils";
1967
+ import { useToggleState as useToggleState3 } from "@react-stately/toggle";
1968
+ import { useStateProps as useStateProps11 } from "@marigold/system";
1969
+ var TableCell = ({
1970
+ item: cell,
1971
+ state,
1972
+ isSelectionCell,
1973
+ css
910
1974
  }) => {
911
- const conditionalStates = disabled ? {
912
- disabled
913
- } : {
914
- checked,
915
- error
916
- };
917
- return /* @__PURE__ */ React26.createElement(SVG2, {
918
- width: "16",
919
- height: "32",
920
- viewBox: "0 0 16 32",
921
- fill: "none",
922
- "aria-hidden": "true"
923
- }, /* @__PURE__ */ React26.createElement(Box, {
924
- variant: conditional2(`radio.${variant}`, conditionalStates),
925
- as: "circle",
926
- cx: "8",
927
- cy: "16",
928
- r: "7.5"
929
- }), checked && /* @__PURE__ */ React26.createElement("circle", {
930
- fill: "white",
931
- cx: "8",
932
- cy: "16",
933
- r: "3"
934
- }));
1975
+ const cellRef = useRef15(null);
1976
+ const { gridCellProps } = useTableCell({ node: cell }, state, cellRef);
1977
+ const { checkboxProps } = useTableSelectionCheckbox({ key: cell.parentKey }, state);
1978
+ const inputRef = useRef15(null);
1979
+ const { inputProps } = useCheckbox2(checkboxProps, useToggleState3(checkboxProps), inputRef);
1980
+ const { focusProps, isFocusVisible } = useFocusRing9();
1981
+ const stateProps = useStateProps11({ focus: isFocusVisible });
1982
+ return /* @__PURE__ */ React47.createElement(Box, __spreadValues(__spreadValues({
1983
+ as: "td",
1984
+ ref: cellRef,
1985
+ __baseCSS: {
1986
+ textAlign: isSelectionCell ? "center" : "left"
1987
+ },
1988
+ css
1989
+ }, mergeProps9(gridCellProps, focusProps)), stateProps), isSelectionCell ? /* @__PURE__ */ React47.createElement("input", __spreadValues({}, inputProps)) : /* @__PURE__ */ React47.createElement(React47.Fragment, null, cell.rendered));
935
1990
  };
936
1991
 
937
- // src/Radio/Radio.tsx
938
- var RadioInput = (_a) => {
939
- var _b = _a, { error } = _b, props = __objRest(_b, ["error"]);
940
- const { focusProps } = useFocusRing2();
941
- const _a2 = props, { children } = _a2, restProps = __objRest(_a2, ["children"]);
942
- return /* @__PURE__ */ React27.createElement(Box, {
943
- pr: "xsmall"
944
- }, /* @__PURE__ */ React27.createElement(VisuallyHidden3, null, /* @__PURE__ */ React27.createElement("input", __spreadValues(__spreadValues({
945
- type: "radio",
946
- disabled: props.disabled
947
- }, focusProps), restProps))), /* @__PURE__ */ React27.createElement(RadioIcon, {
948
- variant: props.variant,
949
- disabled: props.disabled,
950
- checked: props.checked,
951
- error
952
- }));
953
- };
954
- var Radio = (_a) => {
1992
+ // src/Table/TableColumnHeader.tsx
1993
+ import React49, { useRef as useRef16 } from "react";
1994
+ import { useCheckbox as useCheckbox3 } from "@react-aria/checkbox";
1995
+ import { useFocusRing as useFocusRing10 } from "@react-aria/focus";
1996
+ import {
1997
+ useTableSelectAllCheckbox,
1998
+ useTableColumnHeader
1999
+ } from "@react-aria/table";
2000
+ import { mergeProps as mergeProps10 } from "@react-aria/utils";
2001
+ import { useToggleState as useToggleState4 } from "@react-stately/toggle";
2002
+ import { useStateProps as useStateProps12 } from "@marigold/system";
2003
+
2004
+ // src/Text/Text.tsx
2005
+ import React48 from "react";
2006
+ import {
2007
+ useComponentStyles as useComponentStyles27
2008
+ } from "@marigold/system";
2009
+ import { Box as Box24 } from "@marigold/system";
2010
+ var Text = (_a) => {
955
2011
  var _b = _a, {
956
- required,
957
- labelVariant = "inline",
958
- errorMessage
2012
+ variant,
2013
+ size,
2014
+ align,
2015
+ color,
2016
+ fontSize,
2017
+ cursor,
2018
+ outline,
2019
+ children
959
2020
  } = _b, props = __objRest(_b, [
960
- "required",
961
- "labelVariant",
962
- "errorMessage"
2021
+ "variant",
2022
+ "size",
2023
+ "align",
2024
+ "color",
2025
+ "fontSize",
2026
+ "cursor",
2027
+ "outline",
2028
+ "children"
963
2029
  ]);
964
- return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(Box, {
965
- as: Label,
966
- htmlFor: props.id,
967
- required,
968
- variant: `label.${labelVariant}`,
969
- css: props.disabled ? { color: "disabled", ":hover": { cursor: "not-allowed" } } : { color: "text", ":hover": { cursor: "pointer" } }
970
- }, /* @__PURE__ */ React27.createElement(Box, __spreadValues({
971
- as: RadioInput,
972
- error: props.error
973
- }, props)), props.children), props.error && errorMessage && /* @__PURE__ */ React27.createElement(ValidationMessage, null, /* @__PURE__ */ React27.createElement(Exclamation4, {
974
- size: 16
975
- }), errorMessage));
2030
+ const styles = useComponentStyles27("Text", {
2031
+ variant,
2032
+ size
2033
+ });
2034
+ return /* @__PURE__ */ React48.createElement(Box24, __spreadProps(__spreadValues({
2035
+ as: "p"
2036
+ }, props), {
2037
+ css: __spreadValues({ color, cursor, outline, fontSize, textAlign: align }, styles)
2038
+ }), children);
976
2039
  };
977
2040
 
978
- // src/Select/Select.tsx
979
- import React32, { useRef as useRef5 } from "react";
980
- import { useSelectState } from "@react-stately/select";
981
- import { useButton as useButton3 } from "@react-aria/button";
982
- import { mergeProps as mergeProps2 } from "@react-aria/utils";
983
- import { useFocusRing as useFocusRing3 } from "@react-aria/focus";
984
- import { HiddenSelect, useSelect } from "@react-aria/select";
985
- import { useOverlayTriggerState as useOverlayTriggerState2 } from "@react-stately/overlays";
986
- import { useOverlayTrigger, useOverlayPosition } from "@react-aria/overlays";
987
- import { ArrowDown, ArrowUp, Exclamation as Exclamation5, Required as Required2 } from "@marigold/icons";
2041
+ // src/Table/TableColumnHeader.tsx
2042
+ var TableColumnHeader = ({
2043
+ item: column,
2044
+ state,
2045
+ isSelectionColumn,
2046
+ css
2047
+ }) => {
2048
+ const ref = useRef16(null);
2049
+ const { columnHeaderProps } = useTableColumnHeader({ node: column }, state, ref);
2050
+ const { checkboxProps } = useTableSelectAllCheckbox(state);
2051
+ const inputRef = useRef16(null);
2052
+ const { inputProps } = useCheckbox3(checkboxProps, useToggleState4(checkboxProps), inputRef);
2053
+ const { focusProps, isFocusVisible } = useFocusRing10();
2054
+ const stateProps = useStateProps12({ focus: isFocusVisible });
2055
+ return /* @__PURE__ */ React49.createElement(Box, __spreadValues(__spreadValues({
2056
+ as: "th",
2057
+ ref,
2058
+ __baseCSS: { textAlign: isSelectionColumn ? "center" : "left" },
2059
+ css
2060
+ }, mergeProps10(columnHeaderProps, focusProps)), stateProps), isSelectionColumn ? /* @__PURE__ */ React49.createElement("input", __spreadProps(__spreadValues({}, inputProps), {
2061
+ ref: inputRef
2062
+ })) : /* @__PURE__ */ React49.createElement(Text, {
2063
+ size: "xxsmall"
2064
+ }, column.rendered));
2065
+ };
988
2066
 
989
- // src/Select/ListBox.tsx
990
- import React30, { useRef as useRef4 } from "react";
991
- import { useListBox } from "@react-aria/listbox";
2067
+ // src/Table/TableHeaderRow.tsx
2068
+ import React50, { useRef as useRef17 } from "react";
2069
+ import { useTableHeaderRow } from "@react-aria/table";
2070
+ var TableHeaderRow = ({
2071
+ item,
2072
+ state,
2073
+ children
2074
+ }) => {
2075
+ const ref = useRef17(null);
2076
+ const { rowProps } = useTableHeaderRow({ node: item }, state, ref);
2077
+ return /* @__PURE__ */ React50.createElement("tr", __spreadProps(__spreadValues({}, rowProps), {
2078
+ ref
2079
+ }), children);
2080
+ };
992
2081
 
993
- // src/Select/Option.tsx
994
- import React28, { useEffect, useRef as useRef3, useState } from "react";
995
- import { useOption } from "@react-aria/listbox";
996
- var Option = ({ item, state }) => {
997
- const ref = useRef3(null);
998
- const [disabled, setDisabled] = useState(false);
999
- const { optionProps, isSelected } = useOption({
1000
- key: item.key
2082
+ // src/Table/TableRow.tsx
2083
+ import React51, { useRef as useRef18 } from "react";
2084
+ import { useFocusRing as useFocusRing11 } from "@react-aria/focus";
2085
+ import { useTableRow } from "@react-aria/table";
2086
+ import { mergeProps as mergeProps11 } from "@react-aria/utils";
2087
+ import { useStateProps as useStateProps13 } from "@marigold/system";
2088
+ var TableRow = ({ item, state, children, css }) => {
2089
+ const ref = useRef18(null);
2090
+ const isSelected = state.selectionManager.isSelected(item.key);
2091
+ const { rowProps } = useTableRow({
2092
+ node: item
1001
2093
  }, state, ref);
1002
- useEffect(() => {
1003
- for (const key of state.disabledKeys.values()) {
1004
- if (key === item.key) {
1005
- setDisabled(true);
1006
- }
1007
- }
1008
- }, [state.disabledKeys, item.key]);
1009
- return /* @__PURE__ */ React28.createElement(Box, __spreadProps(__spreadValues({
1010
- as: "li"
1011
- }, optionProps), {
2094
+ const { focusProps, isFocusVisible } = useFocusRing11();
2095
+ const stateProps = useStateProps13({
2096
+ focus: isFocusVisible,
2097
+ checked: isSelected
2098
+ });
2099
+ return /* @__PURE__ */ React51.createElement(Box, __spreadValues(__spreadValues({
2100
+ as: "tr",
1012
2101
  ref,
1013
- variant: isSelected ? "select.option.selected" : disabled ? "select.option.disabled" : "select.option"
1014
- }), item.rendered);
2102
+ css
2103
+ }, mergeProps11(rowProps, focusProps)), stateProps), children);
1015
2104
  };
1016
2105
 
1017
- // src/Select/ListBoxSection.tsx
1018
- import React29 from "react";
1019
- import { useListBoxSection } from "@react-aria/listbox";
1020
- var ListBoxSection = ({ section, state }) => {
1021
- const { itemProps, headingProps, groupProps } = useListBoxSection({
1022
- heading: section.rendered,
1023
- "aria-label": section["aria-label"]
1024
- });
1025
- return /* @__PURE__ */ React29.createElement(Box, __spreadProps(__spreadValues({
1026
- as: "li"
1027
- }, itemProps), {
1028
- css: {
1029
- cursor: "not-allowed"
1030
- }
1031
- }), section.rendered && /* @__PURE__ */ React29.createElement(Box, __spreadProps(__spreadValues({
1032
- as: "span"
1033
- }, headingProps), {
1034
- variant: "select.section"
1035
- }), section.rendered), /* @__PURE__ */ React29.createElement(Box, __spreadValues({
1036
- as: "ul"
1037
- }, groupProps), [...section.childNodes].map((node) => /* @__PURE__ */ React29.createElement(Option, {
1038
- key: node.key,
1039
- item: node,
1040
- state
1041
- }))));
2106
+ // src/Table/TableRowGroup.tsx
2107
+ import React52 from "react";
2108
+ import { useTableRowGroup } from "@react-aria/table";
2109
+ var TableRowGroup = ({
2110
+ as: Element,
2111
+ children
2112
+ }) => {
2113
+ const { rowGroupProps } = useTableRowGroup();
2114
+ return /* @__PURE__ */ React52.createElement(Element, __spreadValues({}, rowGroupProps), children);
1042
2115
  };
1043
2116
 
1044
- // src/Select/ListBox.tsx
1045
- var ListBox = (props) => {
1046
- const ref = useRef4(null);
1047
- const { state, error } = props;
1048
- const { listBoxProps } = useListBox(props, state, ref);
1049
- return /* @__PURE__ */ React30.createElement(Box, __spreadProps(__spreadValues({
1050
- as: "ul",
1051
- p: "none",
1052
- css: {
1053
- listStyle: "none"
1054
- }
1055
- }, listBoxProps), {
1056
- variant: error ? "select.listbox.error" : "select.listbox",
1057
- ref
1058
- }), [...state.collection].map((item) => item.type === "section" ? /* @__PURE__ */ React30.createElement(ListBoxSection, {
1059
- key: item.key,
1060
- section: item,
2117
+ // src/Table/Table.tsx
2118
+ var Table = (_a) => {
2119
+ var _b = _a, { variant, size } = _b, props = __objRest(_b, ["variant", "size"]);
2120
+ const showSelectionCheckboxes = props.selectionMode === "multiple" && props.selectionBehavior !== "replace";
2121
+ const state = useTableState(__spreadProps(__spreadValues({}, props), {
2122
+ showSelectionCheckboxes
2123
+ }));
2124
+ const ref = useRef19(null);
2125
+ const { gridProps } = useTable(props, state, ref);
2126
+ const styles = useComponentStyles28("Table", { variant, size }, { parts: ["table", "header", "row", "cell"] });
2127
+ return /* @__PURE__ */ React53.createElement(Box, __spreadValues({
2128
+ as: "table",
2129
+ ref,
2130
+ __baseCSS: styles.table
2131
+ }, gridProps), /* @__PURE__ */ React53.createElement(TableRowGroup, {
2132
+ as: "thead"
2133
+ }, state.collection.headerRows.map((headerRow) => /* @__PURE__ */ React53.createElement(TableHeaderRow, {
2134
+ key: headerRow.key,
2135
+ item: headerRow,
1061
2136
  state
1062
- }) : /* @__PURE__ */ React30.createElement(Option, {
1063
- key: item.key,
1064
- item,
2137
+ }, [...headerRow.childNodes].map((column) => /* @__PURE__ */ React53.createElement(TableColumnHeader, {
2138
+ key: column.key,
2139
+ item: column,
2140
+ state,
2141
+ isSelectionColumn: column.props.isSelectionCell,
2142
+ css: styles.header
2143
+ }))))), /* @__PURE__ */ React53.createElement(TableRowGroup, {
2144
+ as: "tbody"
2145
+ }, [...state.collection.body.childNodes].map((row) => /* @__PURE__ */ React53.createElement(TableRow, {
2146
+ css: styles.row,
2147
+ key: row.key,
2148
+ item: row,
1065
2149
  state
1066
- })));
2150
+ }, [...row.childNodes].map((cell) => /* @__PURE__ */ React53.createElement(TableCell, {
2151
+ key: cell.key,
2152
+ item: cell,
2153
+ state,
2154
+ isSelectionCell: cell.props.isSelectionCell,
2155
+ css: styles.cell
2156
+ }))))));
1067
2157
  };
2158
+ Table.Body = TableBody;
2159
+ Table.Cell = Cell;
2160
+ Table.Column = Column;
2161
+ Table.Header = TableHeader;
2162
+ Table.Row = Row;
1068
2163
 
1069
- // src/Select/Popover.tsx
1070
- import React31, { forwardRef as forwardRef3 } from "react";
1071
- import { FocusScope as FocusScope2 } from "@react-aria/focus";
2164
+ // src/TextArea/TextArea.tsx
2165
+ import React54, { useRef as useRef20 } from "react";
2166
+ import { useTextField } from "@react-aria/textfield";
1072
2167
  import {
1073
- DismissButton,
1074
- OverlayContainer as OverlayContainer2,
1075
- useModal as useModal2,
1076
- useOverlay as useOverlay2
1077
- } from "@react-aria/overlays";
1078
- import { mergeProps } from "@react-aria/utils";
1079
- var Popover = forwardRef3((_a, ref) => {
1080
- var _b = _a, { children, className, isOpen, onClose } = _b, otherProps = __objRest(_b, ["children", "className", "isOpen", "onClose"]);
1081
- const { overlayProps } = useOverlay2({
1082
- isOpen,
1083
- onClose,
1084
- shouldCloseOnBlur: true,
1085
- isDismissable: true
1086
- }, ref);
1087
- const { modalProps } = useModal2();
1088
- return /* @__PURE__ */ React31.createElement(OverlayContainer2, null, /* @__PURE__ */ React31.createElement(FocusScope2, {
1089
- restoreFocus: true
1090
- }, /* @__PURE__ */ React31.createElement(Box, __spreadProps(__spreadValues({}, mergeProps(overlayProps, otherProps, modalProps)), {
1091
- className,
1092
- ref
1093
- }), children, /* @__PURE__ */ React31.createElement(DismissButton, {
1094
- onDismiss: onClose
1095
- }))));
1096
- });
1097
-
1098
- // src/Select/Select.tsx
1099
- var Select = (_a) => {
2168
+ Box as Box25,
2169
+ useComponentStyles as useComponentStyles29,
2170
+ useStateProps as useStateProps14
2171
+ } from "@marigold/system";
2172
+ import { useHover as useHover5 } from "@react-aria/interactions";
2173
+ import { useFocusRing as useFocusRing12 } from "@react-aria/focus";
2174
+ var TextArea = (_a) => {
1100
2175
  var _b = _a, {
1101
- labelVariant = "above",
1102
- placeholder = "Select an option",
1103
2176
  disabled,
1104
2177
  required,
2178
+ readOnly,
1105
2179
  error,
1106
- errorMessage,
1107
- width,
1108
- className
2180
+ variant,
2181
+ size
1109
2182
  } = _b, props = __objRest(_b, [
1110
- "labelVariant",
1111
- "placeholder",
1112
2183
  "disabled",
1113
2184
  "required",
2185
+ "readOnly",
1114
2186
  "error",
1115
- "errorMessage",
1116
- "width",
1117
- "className"
1118
- ]);
1119
- const state = useSelectState(props);
1120
- const overlayTriggerState = useOverlayTriggerState2({});
1121
- const triggerRef = useRef5();
1122
- const overlayRef = useRef5();
1123
- const { overlayProps } = useOverlayTrigger({ type: "listbox" }, overlayTriggerState, triggerRef);
1124
- const { overlayProps: positionProps } = useOverlayPosition({
1125
- targetRef: triggerRef,
1126
- overlayRef,
1127
- placement: "bottom",
1128
- shouldFlip: false,
1129
- isOpen: state.isOpen,
1130
- onClose: state.close
1131
- });
1132
- const { labelProps, triggerProps, valueProps, menuProps } = useSelect(props, state, triggerRef);
1133
- const { buttonProps } = useButton3(triggerProps, triggerRef);
1134
- const { focusProps } = useFocusRing3();
1135
- return /* @__PURE__ */ React32.createElement(Box, {
1136
- position: "relative",
1137
- display: "inline-block",
1138
- width: width && width
1139
- }, props.label && /* @__PURE__ */ React32.createElement(Box, null, /* @__PURE__ */ React32.createElement(Label, __spreadProps(__spreadValues({}, labelProps), {
1140
- htmlFor: labelProps.id,
1141
- variant: labelVariant
1142
- }), required ? /* @__PURE__ */ React32.createElement(Box, {
1143
- as: "span",
1144
- display: "inline-flex",
1145
- alignItems: "center"
1146
- }, props.label, /* @__PURE__ */ React32.createElement(Required2, {
1147
- size: 16,
1148
- fill: "error"
1149
- })) : props.label)), /* @__PURE__ */ React32.createElement(HiddenSelect, {
1150
- state,
1151
- triggerRef,
1152
- label: props.label,
1153
- name: props.name,
1154
- isDisabled: disabled
1155
- }), /* @__PURE__ */ React32.createElement(Box, __spreadProps(__spreadValues({
1156
- as: "button"
1157
- }, mergeProps2(buttonProps, focusProps)), {
1158
- ref: triggerRef,
1159
- variant: error && state.isOpen && !disabled ? "button.select.errorOpened" : error ? "button.select.error" : state.isOpen && !disabled ? "button.select.open" : "button.select",
1160
- disabled,
1161
- className
1162
- }), /* @__PURE__ */ React32.createElement(Box, __spreadProps(__spreadValues({
1163
- as: "span"
1164
- }, valueProps), {
1165
- variant: disabled ? "select.disabled" : "select"
1166
- }), state.selectedItem ? state.selectedItem.rendered : placeholder), state.isOpen && !disabled ? /* @__PURE__ */ React32.createElement(ArrowUp, {
1167
- size: 16,
1168
- fill: "text"
1169
- }) : /* @__PURE__ */ React32.createElement(ArrowDown, {
1170
- size: 16,
1171
- fill: disabled ? "disabled" : "text"
1172
- })), state.isOpen && !disabled && /* @__PURE__ */ React32.createElement(Box, __spreadProps(__spreadValues(__spreadValues({
1173
- as: Popover
1174
- }, overlayProps), positionProps), {
1175
- css: {
1176
- width: triggerRef.current && triggerRef.current.offsetWidth + "px"
1177
- },
1178
- ref: overlayRef,
1179
- isOpen: state.isOpen,
1180
- onClose: state.close
1181
- }), /* @__PURE__ */ React32.createElement(ListBox, __spreadProps(__spreadValues({
1182
- error
1183
- }, menuProps), {
1184
- state
1185
- }))), error && errorMessage && /* @__PURE__ */ React32.createElement(Box, {
1186
- as: "span",
1187
- display: "inline-flex",
1188
- alignItems: "center"
1189
- }, /* @__PURE__ */ React32.createElement(Box, {
1190
- as: Exclamation5,
1191
- size: 16,
1192
- css: { color: "error" }
1193
- }), /* @__PURE__ */ React32.createElement(ValidationMessage, null, errorMessage)));
1194
- };
1195
-
1196
- // src/Slider/Slider.tsx
1197
- import React33 from "react";
1198
- var Slider = (_a) => {
1199
- var _b = _a, { variant = "" } = _b, props = __objRest(_b, ["variant"]);
1200
- return /* @__PURE__ */ React33.createElement(Box, __spreadValues({
1201
- as: "input",
1202
- type: "range",
1203
- css: { verticalAlign: "middle" },
1204
- variant: `slider.${variant}`
1205
- }, props));
1206
- };
1207
-
1208
- // src/Switch/Switch.tsx
1209
- import React34, { useRef as useRef6 } from "react";
1210
- import { useFocusRing as useFocusRing4 } from "@react-aria/focus";
1211
- import { useSwitch } from "@react-aria/switch";
1212
- import { VisuallyHidden as VisuallyHidden4 } from "@react-aria/visually-hidden";
1213
- import { useToggleState as useToggleState2 } from "@react-stately/toggle";
1214
- import { conditional as conditional3 } from "@marigold/system";
1215
- var Switch = (_a) => {
1216
- var _b = _a, {
1217
- variant = "",
1218
- labelVariant = "above",
1219
- disabled
1220
- } = _b, props = __objRest(_b, [
1221
2187
  "variant",
1222
- "labelVariant",
1223
- "disabled"
2188
+ "size"
1224
2189
  ]);
1225
- const state = useToggleState2(props);
1226
- const ref = useRef6();
1227
- const { inputProps } = useSwitch(props, state, ref);
1228
- const { focusProps } = useFocusRing4();
1229
- return /* @__PURE__ */ React34.createElement(Box, {
1230
- as: Label,
1231
- __baseCSS: {
1232
- userSelect: "none"
1233
- },
1234
- variant: labelVariant
1235
- }, props.children, /* @__PURE__ */ React34.createElement(VisuallyHidden4, null, /* @__PURE__ */ React34.createElement("input", __spreadProps(__spreadValues(__spreadValues({}, inputProps), focusProps), {
2190
+ const { label, description, errorMessage } = props;
2191
+ const ref = useRef20(null);
2192
+ const { labelProps, inputProps, descriptionProps, errorMessageProps } = useTextField(__spreadValues({
2193
+ inputElementType: "textarea",
2194
+ isDisabled: disabled,
2195
+ isRequired: required,
2196
+ isReadOnly: readOnly,
2197
+ validationState: error ? "invalid" : "valid"
2198
+ }, props), ref);
2199
+ const { hoverProps, isHovered } = useHover5({});
2200
+ const { focusProps, isFocusVisible } = useFocusRing12();
2201
+ const stateProps = useStateProps14({
2202
+ hover: isHovered,
2203
+ focus: isFocusVisible,
1236
2204
  disabled,
2205
+ readOnly,
2206
+ error
2207
+ });
2208
+ const styles = useComponentStyles29("TextArea", { variant, size });
2209
+ return /* @__PURE__ */ React54.createElement(FieldBase, {
2210
+ label,
2211
+ labelProps,
2212
+ required,
2213
+ description,
2214
+ descriptionProps,
2215
+ error,
2216
+ errorMessage,
2217
+ errorMessageProps,
2218
+ stateProps,
2219
+ variant,
2220
+ size
2221
+ }, /* @__PURE__ */ React54.createElement(Box25, __spreadValues(__spreadValues(__spreadValues(__spreadValues({
2222
+ as: "textarea",
2223
+ css: styles,
1237
2224
  ref
1238
- }))), /* @__PURE__ */ React34.createElement(Box, {
1239
- as: "svg",
1240
- __baseCSS: {
1241
- cursor: disabled ? "not-allowed" : "pointer",
1242
- width: 56,
1243
- height: 32
1244
- },
1245
- "aria-hidden": "true"
1246
- }, /* @__PURE__ */ React34.createElement(Box, {
1247
- as: "rect",
1248
- __baseCSS: {
1249
- x: 4,
1250
- y: 4,
1251
- rx: 12,
1252
- width: 48,
1253
- height: 24
1254
- },
1255
- variant: conditional3(`switch.${variant}`, {
1256
- checked: state.isSelected,
1257
- disabled
1258
- })
1259
- }), /* @__PURE__ */ React34.createElement(Box, {
1260
- as: "circle",
1261
- __baseCSS: {
1262
- boxShadow: "1px 1px 4px rgba(0, 0, 0, 0.25)",
1263
- cx: state.isSelected ? 40 : 16,
1264
- cy: 16,
1265
- r: 11,
1266
- fill: disabled ? "gray20" : "gray00"
1267
- }
1268
- })));
2225
+ }, inputProps), focusProps), hoverProps), stateProps)));
1269
2226
  };
1270
2227
 
1271
- // src/Textarea/Textarea.tsx
1272
- import React35, { useRef as useRef7 } from "react";
2228
+ // src/TextField/TextField.tsx
2229
+ import React55, { useRef as useRef21 } from "react";
2230
+ import { useHover as useHover6 } from "@react-aria/interactions";
2231
+ import { useFocusRing as useFocusRing13 } from "@react-aria/focus";
1273
2232
  import { useTextField as useTextField2 } from "@react-aria/textfield";
1274
- import { Exclamation as Exclamation6 } from "@marigold/icons";
1275
- var Textarea = (_a) => {
2233
+ import { useStateProps as useStateProps15 } from "@marigold/system";
2234
+ var TextField = (_a) => {
1276
2235
  var _b = _a, {
1277
- variant = "",
1278
- htmlFor,
1279
- error,
1280
- errorMessage,
2236
+ disabled,
1281
2237
  required,
1282
- children
2238
+ readOnly,
2239
+ error,
2240
+ variant,
2241
+ size
1283
2242
  } = _b, props = __objRest(_b, [
1284
- "variant",
1285
- "htmlFor",
1286
- "error",
1287
- "errorMessage",
2243
+ "disabled",
1288
2244
  "required",
1289
- "children"
2245
+ "readOnly",
2246
+ "error",
2247
+ "variant",
2248
+ "size"
1290
2249
  ]);
1291
- const ref = useRef7(null);
1292
- const { labelProps, inputProps, errorMessageProps } = useTextField2(__spreadProps(__spreadValues({}, props), {
1293
- inputElementType: "textarea"
1294
- }), ref);
1295
- return /* @__PURE__ */ React35.createElement(Box, null, /* @__PURE__ */ React35.createElement(Label, __spreadValues({
1296
- htmlFor,
1297
- required
1298
- }, labelProps), props.label), /* @__PURE__ */ React35.createElement(Box, __spreadValues(__spreadProps(__spreadValues({
1299
- as: "textarea",
1300
- variant: `textarea.${variant}`,
1301
- css: {
1302
- outlineColor: error && "error"
1303
- }
1304
- }, inputProps), {
1305
- ref
1306
- }), props)), error && errorMessage && /* @__PURE__ */ React35.createElement(ValidationMessage, __spreadValues({}, errorMessageProps), /* @__PURE__ */ React35.createElement(Exclamation6, {
1307
- size: 16
1308
- }), errorMessage));
2250
+ const { label, description, errorMessage, autoFocus } = props;
2251
+ const ref = useRef21(null);
2252
+ const { labelProps, inputProps, descriptionProps, errorMessageProps } = useTextField2(__spreadValues({
2253
+ isDisabled: disabled,
2254
+ isRequired: required,
2255
+ isReadOnly: readOnly,
2256
+ validationState: error ? "invalid" : "valid"
2257
+ }, props), ref);
2258
+ const { hoverProps, isHovered } = useHover6({});
2259
+ const { focusProps, isFocusVisible } = useFocusRing13({
2260
+ isTextInput: true,
2261
+ autoFocus
2262
+ });
2263
+ const stateProps = useStateProps15({
2264
+ hover: isHovered,
2265
+ focus: isFocusVisible,
2266
+ disabled,
2267
+ readOnly,
2268
+ error
2269
+ });
2270
+ return /* @__PURE__ */ React55.createElement(FieldBase, {
2271
+ label,
2272
+ labelProps,
2273
+ required,
2274
+ description,
2275
+ descriptionProps,
2276
+ error,
2277
+ errorMessage,
2278
+ errorMessageProps,
2279
+ stateProps,
2280
+ variant,
2281
+ size
2282
+ }, /* @__PURE__ */ React55.createElement(Input, __spreadValues(__spreadValues(__spreadValues(__spreadValues({
2283
+ ref,
2284
+ variant,
2285
+ size
2286
+ }, inputProps), focusProps), hoverProps), stateProps)));
1309
2287
  };
1310
2288
 
1311
2289
  // src/Tiles/Tiles.tsx
1312
- import React36 from "react";
1313
- var Tiles = React36.forwardRef(function Tiles2(_a, ref) {
2290
+ import React56 from "react";
2291
+ var Tiles = React56.forwardRef(function Tiles2(_a, ref) {
1314
2292
  var _b = _a, { space = "none", itemMinWidth = "250px", children } = _b, props = __objRest(_b, ["space", "itemMinWidth", "children"]);
1315
- return /* @__PURE__ */ React36.createElement(Box, __spreadValues({
2293
+ return /* @__PURE__ */ React56.createElement(Box, __spreadValues({
1316
2294
  ref,
1317
2295
  display: "grid",
1318
2296
  __baseCSS: {
@@ -1323,27 +2301,27 @@ var Tiles = React36.forwardRef(function Tiles2(_a, ref) {
1323
2301
  });
1324
2302
 
1325
2303
  // src/Tooltip/Tooltip.tsx
1326
- import React38, { useContext } from "react";
2304
+ import React58, { useContext as useContext6 } from "react";
1327
2305
  import { useTooltip } from "@react-aria/tooltip";
1328
- import { mergeProps as mergeProps3 } from "@react-aria/utils";
2306
+ import { mergeProps as mergeProps12 } from "@react-aria/utils";
1329
2307
 
1330
2308
  // src/Tooltip/TooltipTrigger.tsx
1331
- import React37, { useRef as useRef8 } from "react";
2309
+ import React57, { useRef as useRef22 } from "react";
1332
2310
  import { FocusableProvider } from "@react-aria/focus";
1333
2311
  import { useTooltipTrigger } from "@react-aria/tooltip";
1334
2312
  import {
1335
2313
  useTooltipTriggerState
1336
2314
  } from "@react-stately/tooltip";
1337
- var TooltipContext = React37.createContext({});
2315
+ var TooltipContext = React57.createContext({});
1338
2316
  var TooltipTrigger = (_a) => {
1339
2317
  var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
1340
- const [trigger, tooltip] = React37.Children.toArray(children);
2318
+ const [trigger, tooltip] = React57.Children.toArray(children);
1341
2319
  const state = useTooltipTriggerState(props);
1342
- const tooltipTriggerRef = useRef8();
2320
+ const tooltipTriggerRef = useRef22();
1343
2321
  const { triggerProps, tooltipProps } = useTooltipTrigger({}, state, tooltipTriggerRef);
1344
- return /* @__PURE__ */ React37.createElement(FocusableProvider, __spreadProps(__spreadValues({}, triggerProps), {
2322
+ return /* @__PURE__ */ React57.createElement(FocusableProvider, __spreadProps(__spreadValues({}, triggerProps), {
1345
2323
  ref: tooltipTriggerRef
1346
- }), trigger, state.isOpen && /* @__PURE__ */ React37.createElement(TooltipContext.Provider, {
2324
+ }), trigger, state.isOpen && /* @__PURE__ */ React57.createElement(TooltipContext.Provider, {
1347
2325
  value: __spreadValues({
1348
2326
  state
1349
2327
  }, tooltipProps)
@@ -1359,106 +2337,64 @@ var Tooltip = (_a) => {
1359
2337
  "variant",
1360
2338
  "children"
1361
2339
  ]);
1362
- const _a2 = useContext(TooltipContext), { state } = _a2, tooltipProviderProps = __objRest(_a2, ["state"]);
1363
- const mergedProps = mergeProps3(props, tooltipProviderProps);
2340
+ const _a2 = useContext6(TooltipContext), { state } = _a2, tooltipProviderProps = __objRest(_a2, ["state"]);
2341
+ const mergedProps = mergeProps12(props, tooltipProviderProps);
1364
2342
  const { tooltipProps } = useTooltip(mergedProps, state);
1365
- return /* @__PURE__ */ React38.createElement(Box, __spreadValues({
2343
+ return /* @__PURE__ */ React58.createElement(Box, __spreadValues({
1366
2344
  position: "relative"
1367
- }, tooltipProps), /* @__PURE__ */ React38.createElement(Box, __spreadValues({
2345
+ }, tooltipProps), /* @__PURE__ */ React58.createElement(Box, __spreadValues({
1368
2346
  position: "absolute",
1369
2347
  variant: `tooltip.${variant}`
1370
2348
  }, mergedProps), children));
1371
2349
  };
1372
-
1373
- // src/Input/Input.tsx
1374
- import React39 from "react";
1375
- var Input = (_a) => {
1376
- var _b = _a, {
1377
- variant = "",
1378
- type = "text"
1379
- } = _b, props = __objRest(_b, [
1380
- "variant",
1381
- "type"
1382
- ]);
1383
- return /* @__PURE__ */ React39.createElement(Box, __spreadProps(__spreadValues({}, props), {
1384
- as: "input",
1385
- type,
1386
- variant: `input.${variant}`
1387
- }));
1388
- };
1389
-
1390
- // src/Container/Container.tsx
1391
- import React40 from "react";
1392
- import { size as tokenSize } from "@marigold/tokens";
1393
- var ALIGNMENT3 = {
1394
- left: "flex-start",
1395
- center: "center",
1396
- right: "flex-end"
1397
- };
1398
- var Container = (_a) => {
1399
- var _b = _a, {
1400
- contentType = "content",
1401
- size = "medium",
1402
- align = "left",
1403
- children
1404
- } = _b, props = __objRest(_b, [
1405
- "contentType",
1406
- "size",
1407
- "align",
1408
- "children"
1409
- ]);
1410
- return /* @__PURE__ */ React40.createElement(Box, __spreadValues({
1411
- display: "flex",
1412
- flexDirection: "column",
1413
- maxWidth: tokenSize[contentType][size],
1414
- alignItems: ALIGNMENT3[align]
1415
- }, props), children);
1416
- };
1417
-
1418
- // src/index.ts
1419
- import { Item, Section } from "@react-stately/collections";
1420
2350
  export {
1421
- ActionGroup,
1422
2351
  Aside,
1423
2352
  Aspect,
1424
2353
  Badge,
1425
2354
  Box,
2355
+ Breakout,
1426
2356
  Button,
1427
2357
  Card,
2358
+ Center,
1428
2359
  Checkbox,
1429
- Column,
2360
+ CheckboxGroup,
2361
+ CheckboxGroupContext,
1430
2362
  Columns,
1431
2363
  Container,
2364
+ Content,
1432
2365
  Dialog,
1433
2366
  Divider,
1434
- Field,
2367
+ Footer,
2368
+ Header,
2369
+ Headline,
1435
2370
  Image,
1436
2371
  Inline,
1437
2372
  Input,
1438
- Item,
1439
2373
  Label,
1440
- LabelBase,
1441
2374
  Link,
1442
2375
  MarigoldProvider,
1443
2376
  Menu,
1444
- MenuItem,
1445
2377
  Message,
2378
+ NumberField,
2379
+ Overlay,
2380
+ Popover,
1446
2381
  Radio,
1447
2382
  SSRProvider,
1448
- Section,
1449
2383
  Select,
1450
2384
  Slider,
1451
2385
  Stack,
1452
2386
  Switch,
2387
+ Table,
1453
2388
  Text,
1454
- Textarea,
2389
+ TextArea,
2390
+ TextField,
1455
2391
  ThemeProvider2 as ThemeProvider,
1456
2392
  Tiles,
1457
2393
  Tooltip,
1458
2394
  TooltipContext,
1459
2395
  TooltipTrigger,
1460
- ValidationMessage,
1461
- VisuallyHidden2 as VisuallyHidden,
1462
- useDialogButtonProps,
1463
- useTheme3 as useTheme
2396
+ Underlay,
2397
+ VisuallyHidden,
2398
+ useCheckboxGroupContext,
2399
+ useTheme2 as useTheme
1464
2400
  };