@marigold/components 0.4.0 → 0.6.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.
- package/CHANGELOG.md +56 -0
- package/dist/index.d.ts +93 -89
- package/dist/index.js +263 -176
- package/dist/index.mjs +321 -231
- package/package.json +9 -5
package/dist/index.mjs
CHANGED
|
@@ -34,8 +34,29 @@ var __objRest = (source, exclude) => {
|
|
|
34
34
|
import React3 from "react";
|
|
35
35
|
|
|
36
36
|
// src/Inline/Inline.tsx
|
|
37
|
-
import React, { Children } from "react";
|
|
38
|
-
|
|
37
|
+
import React, { Children as Children2 } from "react";
|
|
38
|
+
|
|
39
|
+
// src/utils/flatten-children.ts
|
|
40
|
+
import {
|
|
41
|
+
Children,
|
|
42
|
+
isValidElement,
|
|
43
|
+
cloneElement
|
|
44
|
+
} from "react";
|
|
45
|
+
import { isFragment } from "react-is";
|
|
46
|
+
var flattenChildren = (children, depth = 0, keys = []) => Children.toArray(children).reduce((acc, node) => {
|
|
47
|
+
if (isFragment(node)) {
|
|
48
|
+
acc.push.apply(acc, flattenChildren(node.props.children, depth + 1, keys.concat(node.key)));
|
|
49
|
+
} else {
|
|
50
|
+
if (isValidElement(node)) {
|
|
51
|
+
acc.push(cloneElement(node, {
|
|
52
|
+
key: keys.concat(String(node.key)).join(".")
|
|
53
|
+
}));
|
|
54
|
+
} else if (typeof node === "string" || typeof node === "number") {
|
|
55
|
+
acc.push(node);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return acc;
|
|
59
|
+
}, []);
|
|
39
60
|
|
|
40
61
|
// src/Box.ts
|
|
41
62
|
import { Box } from "@marigold/system";
|
|
@@ -57,15 +78,14 @@ var Inline = (_a) => {
|
|
|
57
78
|
"children"
|
|
58
79
|
]);
|
|
59
80
|
return /* @__PURE__ */ React.createElement(Box, __spreadValues({
|
|
81
|
+
__baseCSS: { gap: space, flexWrap: "wrap" },
|
|
60
82
|
display: "inline-flex",
|
|
61
|
-
css: { "> * + *": { pl: space } },
|
|
62
83
|
alignItems: ALIGNMENT[align]
|
|
63
|
-
}, props),
|
|
84
|
+
}, props), Children2.map(flattenChildren(children), (child) => child));
|
|
64
85
|
};
|
|
65
86
|
|
|
66
87
|
// src/Stack/Stack.tsx
|
|
67
|
-
import React2, { Children as
|
|
68
|
-
import flattenChildren2 from "react-keyed-flatten-children";
|
|
88
|
+
import React2, { Children as Children3 } from "react";
|
|
69
89
|
var ALIGNMENT2 = {
|
|
70
90
|
left: "flex-start",
|
|
71
91
|
center: "center",
|
|
@@ -86,7 +106,7 @@ var Stack = (_a) => {
|
|
|
86
106
|
flexDirection: "column",
|
|
87
107
|
alignItems: ALIGNMENT2[align],
|
|
88
108
|
css: { "> * + *": { pt: space } }
|
|
89
|
-
}),
|
|
109
|
+
}), Children3.map(flattenChildren(children), (child) => /* @__PURE__ */ React2.createElement(Box, null, React2.cloneElement(child, {}, child.props.children))));
|
|
90
110
|
};
|
|
91
111
|
|
|
92
112
|
// src/ActionGroup/ActionGroup.tsx
|
|
@@ -107,45 +127,8 @@ var ActionGroup = (_a) => {
|
|
|
107
127
|
}, props), children);
|
|
108
128
|
};
|
|
109
129
|
|
|
110
|
-
// src/Alert/Alert.tsx
|
|
111
|
-
import React4 from "react";
|
|
112
|
-
import { Exclamation, Check, Notification } from "@marigold/icons";
|
|
113
|
-
var ICON_MAP = {
|
|
114
|
-
success: Check,
|
|
115
|
-
warning: Notification,
|
|
116
|
-
error: Exclamation
|
|
117
|
-
};
|
|
118
|
-
var Alert = (_a) => {
|
|
119
|
-
var _b = _a, {
|
|
120
|
-
variant = "success",
|
|
121
|
-
children
|
|
122
|
-
} = _b, props = __objRest(_b, [
|
|
123
|
-
"variant",
|
|
124
|
-
"children"
|
|
125
|
-
]);
|
|
126
|
-
const Icon = ICON_MAP[variant];
|
|
127
|
-
return /* @__PURE__ */ React4.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
128
|
-
display: "flex",
|
|
129
|
-
variant: `alert.${variant}`
|
|
130
|
-
}), /* @__PURE__ */ React4.createElement(Box, {
|
|
131
|
-
display: "inline-block",
|
|
132
|
-
alignItems: "center",
|
|
133
|
-
width: "32px",
|
|
134
|
-
height: "32px",
|
|
135
|
-
bg: variant
|
|
136
|
-
}, /* @__PURE__ */ React4.createElement(Box, {
|
|
137
|
-
as: Icon,
|
|
138
|
-
size: 12,
|
|
139
|
-
color: "#fff",
|
|
140
|
-
bg: variant,
|
|
141
|
-
m: 10
|
|
142
|
-
})), /* @__PURE__ */ React4.createElement(Box, {
|
|
143
|
-
mx: "16px"
|
|
144
|
-
}, children));
|
|
145
|
-
};
|
|
146
|
-
|
|
147
130
|
// src/Badge/Badge.tsx
|
|
148
|
-
import
|
|
131
|
+
import React4 from "react";
|
|
149
132
|
var Badge = (_a) => {
|
|
150
133
|
var _b = _a, {
|
|
151
134
|
variant = "",
|
|
@@ -158,14 +141,14 @@ var Badge = (_a) => {
|
|
|
158
141
|
"borderColor",
|
|
159
142
|
"children"
|
|
160
143
|
]);
|
|
161
|
-
return /* @__PURE__ */
|
|
144
|
+
return /* @__PURE__ */ React4.createElement(Box, __spreadValues({
|
|
162
145
|
css: { bg: bgColor, borderColor },
|
|
163
146
|
variant: `badge.${variant}`
|
|
164
147
|
}, props), children);
|
|
165
148
|
};
|
|
166
149
|
|
|
167
150
|
// src/Button/Button.tsx
|
|
168
|
-
import
|
|
151
|
+
import React5, { forwardRef } from "react";
|
|
169
152
|
import { useButton } from "@react-aria/button";
|
|
170
153
|
var Button = forwardRef((_a, ref) => {
|
|
171
154
|
var _b = _a, {
|
|
@@ -189,7 +172,7 @@ var Button = forwardRef((_a, ref) => {
|
|
|
189
172
|
elementType: typeof as === "string" ? as : "span",
|
|
190
173
|
isDisabled: disabled
|
|
191
174
|
}), ref);
|
|
192
|
-
return /* @__PURE__ */
|
|
175
|
+
return /* @__PURE__ */ React5.createElement(Box, __spreadProps(__spreadValues(__spreadValues({}, buttonProps), props), {
|
|
193
176
|
as,
|
|
194
177
|
display: "inline-flex",
|
|
195
178
|
alignItems: "center",
|
|
@@ -201,7 +184,7 @@ var Button = forwardRef((_a, ref) => {
|
|
|
201
184
|
});
|
|
202
185
|
|
|
203
186
|
// src/Card/Card.tsx
|
|
204
|
-
import
|
|
187
|
+
import React6 from "react";
|
|
205
188
|
var Card = (_a) => {
|
|
206
189
|
var _b = _a, {
|
|
207
190
|
variant = "",
|
|
@@ -216,11 +199,11 @@ var Card = (_a) => {
|
|
|
216
199
|
"className",
|
|
217
200
|
"children"
|
|
218
201
|
]);
|
|
219
|
-
return /* @__PURE__ */
|
|
202
|
+
return /* @__PURE__ */ React6.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
220
203
|
variant: `card.${variant}`,
|
|
221
204
|
maxWidth: width,
|
|
222
205
|
className
|
|
223
|
-
}), title && /* @__PURE__ */
|
|
206
|
+
}), title && /* @__PURE__ */ React6.createElement(Box, {
|
|
224
207
|
as: "h2",
|
|
225
208
|
variant: "text.h2",
|
|
226
209
|
pb: "small"
|
|
@@ -228,7 +211,7 @@ var Card = (_a) => {
|
|
|
228
211
|
};
|
|
229
212
|
|
|
230
213
|
// src/Checkbox/Checkbox.tsx
|
|
231
|
-
import
|
|
214
|
+
import React10 from "react";
|
|
232
215
|
import { useFocusRing } from "@react-aria/focus";
|
|
233
216
|
import { VisuallyHidden } from "@react-aria/visually-hidden";
|
|
234
217
|
import { useCheckbox } from "@react-aria/checkbox";
|
|
@@ -328,15 +311,16 @@ function useToggleState(props) {
|
|
|
328
311
|
}
|
|
329
312
|
|
|
330
313
|
// src/Checkbox/Checkbox.tsx
|
|
331
|
-
import { Exclamation
|
|
314
|
+
import { Exclamation } from "@marigold/icons";
|
|
332
315
|
|
|
333
|
-
// src/Checkbox/
|
|
334
|
-
import
|
|
316
|
+
// src/Checkbox/CheckboxIcon.tsx
|
|
317
|
+
import React7 from "react";
|
|
335
318
|
import { conditional, SVG } from "@marigold/system";
|
|
336
319
|
var CheckboxIcon = ({
|
|
337
320
|
variant = "",
|
|
338
321
|
checked = false,
|
|
339
322
|
disabled = false,
|
|
323
|
+
indeterminated,
|
|
340
324
|
error = false
|
|
341
325
|
}) => {
|
|
342
326
|
const conditionalStates = disabled ? {
|
|
@@ -345,13 +329,13 @@ var CheckboxIcon = ({
|
|
|
345
329
|
checked,
|
|
346
330
|
error
|
|
347
331
|
};
|
|
348
|
-
return /* @__PURE__ */
|
|
332
|
+
return /* @__PURE__ */ React7.createElement(SVG, {
|
|
349
333
|
width: "16",
|
|
350
334
|
height: "32",
|
|
351
335
|
viewBox: "0 0 16 32",
|
|
352
336
|
fill: "none",
|
|
353
337
|
"aria-hidden": "true"
|
|
354
|
-
}, /* @__PURE__ */
|
|
338
|
+
}, /* @__PURE__ */ React7.createElement(Box, {
|
|
355
339
|
as: "rect",
|
|
356
340
|
x: "0.5",
|
|
357
341
|
y: "8.5",
|
|
@@ -359,7 +343,13 @@ var CheckboxIcon = ({
|
|
|
359
343
|
height: "15px",
|
|
360
344
|
rx: "1.5",
|
|
361
345
|
variant: conditional(`checkbox.${variant}`, conditionalStates)
|
|
362
|
-
}), checked && /* @__PURE__ */
|
|
346
|
+
}), checked && indeterminated && /* @__PURE__ */ React7.createElement(Box, {
|
|
347
|
+
__baseCSS: { fill: "gray00" },
|
|
348
|
+
as: "path",
|
|
349
|
+
fillRule: "evenodd",
|
|
350
|
+
clipRule: "evenodd",
|
|
351
|
+
d: "M13.5 17.0402H2.5V15.4688H13.5V17.0402V17.0402Z"
|
|
352
|
+
}), checked && !indeterminated && /* @__PURE__ */ React7.createElement(Box, {
|
|
363
353
|
__baseCSS: { fill: "gray00" },
|
|
364
354
|
as: "path",
|
|
365
355
|
fillRule: "evenodd",
|
|
@@ -369,7 +359,7 @@ var CheckboxIcon = ({
|
|
|
369
359
|
};
|
|
370
360
|
|
|
371
361
|
// src/Label/Label.tsx
|
|
372
|
-
import
|
|
362
|
+
import React8 from "react";
|
|
373
363
|
import { Required } from "@marigold/icons";
|
|
374
364
|
var LabelBase = (_a) => {
|
|
375
365
|
var _b = _a, {
|
|
@@ -383,7 +373,7 @@ var LabelBase = (_a) => {
|
|
|
383
373
|
"color",
|
|
384
374
|
"children"
|
|
385
375
|
]);
|
|
386
|
-
return /* @__PURE__ */
|
|
376
|
+
return /* @__PURE__ */ React8.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
387
377
|
as: "label",
|
|
388
378
|
__baseCSS: { color },
|
|
389
379
|
variant: `label.${variant}`
|
|
@@ -397,19 +387,18 @@ var Label = (_a) => {
|
|
|
397
387
|
"required",
|
|
398
388
|
"children"
|
|
399
389
|
]);
|
|
400
|
-
return required ? /* @__PURE__ */
|
|
390
|
+
return required ? /* @__PURE__ */ React8.createElement(Box, {
|
|
401
391
|
as: "span",
|
|
402
392
|
display: "inline-flex",
|
|
403
393
|
alignItems: "center"
|
|
404
|
-
}, /* @__PURE__ */
|
|
405
|
-
as: Required,
|
|
394
|
+
}, /* @__PURE__ */ React8.createElement(LabelBase, __spreadValues({}, props), children), required && /* @__PURE__ */ React8.createElement(Required, {
|
|
406
395
|
size: 16,
|
|
407
|
-
|
|
408
|
-
})) : /* @__PURE__ */
|
|
396
|
+
fill: "error"
|
|
397
|
+
})) : /* @__PURE__ */ React8.createElement(LabelBase, __spreadValues({}, props), children);
|
|
409
398
|
};
|
|
410
399
|
|
|
411
400
|
// src/ValidationMessage/ValidationMessage.tsx
|
|
412
|
-
import
|
|
401
|
+
import React9 from "react";
|
|
413
402
|
var ValidationMessage = (_a) => {
|
|
414
403
|
var _b = _a, {
|
|
415
404
|
variant = "error",
|
|
@@ -420,7 +409,7 @@ var ValidationMessage = (_a) => {
|
|
|
420
409
|
"children",
|
|
421
410
|
"className"
|
|
422
411
|
]);
|
|
423
|
-
return /* @__PURE__ */
|
|
412
|
+
return /* @__PURE__ */ React9.createElement(Box, __spreadValues({
|
|
424
413
|
as: "span",
|
|
425
414
|
display: "flex",
|
|
426
415
|
alignItems: "center",
|
|
@@ -431,41 +420,41 @@ var ValidationMessage = (_a) => {
|
|
|
431
420
|
|
|
432
421
|
// src/Checkbox/Checkbox.tsx
|
|
433
422
|
var CheckboxInput = (_a) => {
|
|
434
|
-
var _b = _a, {
|
|
423
|
+
var _b = _a, {
|
|
424
|
+
error,
|
|
425
|
+
indeterminated = false
|
|
426
|
+
} = _b, props = __objRest(_b, [
|
|
427
|
+
"error",
|
|
428
|
+
"indeterminated"
|
|
429
|
+
]);
|
|
435
430
|
const state = useToggleState(props);
|
|
436
|
-
const ref =
|
|
431
|
+
const ref = React10.useRef(null);
|
|
437
432
|
const { inputProps } = useCheckbox(props, state, ref);
|
|
438
433
|
const { focusProps } = useFocusRing();
|
|
439
|
-
|
|
434
|
+
const _a2 = props, { children } = _a2, restProps = __objRest(_a2, ["children"]);
|
|
435
|
+
return /* @__PURE__ */ React10.createElement(Box, {
|
|
440
436
|
pr: "xsmall"
|
|
441
|
-
}, /* @__PURE__ */
|
|
442
|
-
as: "input",
|
|
443
|
-
type: "checkbox",
|
|
444
|
-
disabled: props.disabled
|
|
445
|
-
}, inputProps), focusProps), {
|
|
437
|
+
}, /* @__PURE__ */ React10.createElement(VisuallyHidden, null, /* @__PURE__ */ React10.createElement("input", __spreadValues(__spreadProps(__spreadValues(__spreadValues({}, inputProps), focusProps), {
|
|
446
438
|
ref
|
|
447
|
-
}),
|
|
439
|
+
}), restProps))), /* @__PURE__ */ React10.createElement(CheckboxIcon, {
|
|
448
440
|
checked: props.checked,
|
|
449
441
|
variant: props.variant,
|
|
450
442
|
disabled: props.disabled,
|
|
443
|
+
indeterminated,
|
|
451
444
|
error
|
|
452
445
|
}));
|
|
453
446
|
};
|
|
454
447
|
var Checkbox = (_a) => {
|
|
455
448
|
var _b = _a, {
|
|
456
|
-
label,
|
|
457
449
|
required,
|
|
458
450
|
labelVariant = "inline",
|
|
459
|
-
error,
|
|
460
451
|
errorMessage
|
|
461
452
|
} = _b, props = __objRest(_b, [
|
|
462
|
-
"label",
|
|
463
453
|
"required",
|
|
464
454
|
"labelVariant",
|
|
465
|
-
"error",
|
|
466
455
|
"errorMessage"
|
|
467
456
|
]);
|
|
468
|
-
return /* @__PURE__ */
|
|
457
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(Box, {
|
|
469
458
|
as: Label,
|
|
470
459
|
__baseCSS: {
|
|
471
460
|
":hover": { cursor: props.disabled ? "not-allowed" : "pointer" }
|
|
@@ -474,16 +463,15 @@ var Checkbox = (_a) => {
|
|
|
474
463
|
required,
|
|
475
464
|
variant: `label.${labelVariant}`,
|
|
476
465
|
color: props.disabled ? "disabled" : "text"
|
|
477
|
-
}, /* @__PURE__ */
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
}, props)), label), error && errorMessage && /* @__PURE__ */ React11.createElement(ValidationMessage, null, /* @__PURE__ */ React11.createElement(Exclamation2, {
|
|
466
|
+
}, /* @__PURE__ */ React10.createElement(CheckboxInput, __spreadValues({
|
|
467
|
+
error: props.error
|
|
468
|
+
}, props)), props.children), props.error && errorMessage && /* @__PURE__ */ React10.createElement(ValidationMessage, null, /* @__PURE__ */ React10.createElement(Exclamation, {
|
|
481
469
|
size: 16
|
|
482
470
|
}), errorMessage));
|
|
483
471
|
};
|
|
484
472
|
|
|
485
473
|
// src/Column/Column.tsx
|
|
486
|
-
import
|
|
474
|
+
import React11 from "react";
|
|
487
475
|
var transform = (width) => {
|
|
488
476
|
if (Array.isArray(width)) {
|
|
489
477
|
return width.map((v) => `${v / 12 * 100}%`);
|
|
@@ -498,14 +486,13 @@ var Column = (_a) => {
|
|
|
498
486
|
"width",
|
|
499
487
|
"children"
|
|
500
488
|
]);
|
|
501
|
-
return /* @__PURE__ */
|
|
489
|
+
return /* @__PURE__ */ React11.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
502
490
|
width: transform(width)
|
|
503
491
|
}), children);
|
|
504
492
|
};
|
|
505
493
|
|
|
506
494
|
// src/Columns/Columns.tsx
|
|
507
|
-
import
|
|
508
|
-
import flattenChildren3 from "react-keyed-flatten-children";
|
|
495
|
+
import React12, { Children as Children4 } from "react";
|
|
509
496
|
import { useTheme } from "@marigold/system";
|
|
510
497
|
var useAlignment = (direction) => {
|
|
511
498
|
switch (direction) {
|
|
@@ -537,66 +524,72 @@ var Columns = (_a) => {
|
|
|
537
524
|
const { css } = useTheme();
|
|
538
525
|
const spaceObject = css({ space });
|
|
539
526
|
const spaceValue = Object.values(spaceObject)[0];
|
|
540
|
-
return /* @__PURE__ */
|
|
527
|
+
return /* @__PURE__ */ React12.createElement(Box, {
|
|
541
528
|
p: space,
|
|
542
529
|
display: "flex",
|
|
543
530
|
className
|
|
544
|
-
}, /* @__PURE__ */
|
|
531
|
+
}, /* @__PURE__ */ React12.createElement(Box, __spreadValues({
|
|
545
532
|
width: `calc(100% + ${spaceValue}px)`,
|
|
546
533
|
m: `${-spaceValue / 2}px`,
|
|
547
534
|
display: "flex",
|
|
548
535
|
flexWrap: "wrap",
|
|
549
536
|
alignItems,
|
|
550
537
|
justifyContent
|
|
551
|
-
}, props),
|
|
552
|
-
return
|
|
538
|
+
}, props), Children4.map(flattenChildren(children), (child) => {
|
|
539
|
+
return React12.cloneElement(child, {}, /* @__PURE__ */ React12.createElement(Box, {
|
|
553
540
|
css: { p: `${spaceValue / 2}px` }
|
|
554
541
|
}, child.props.children));
|
|
555
542
|
})));
|
|
556
543
|
};
|
|
557
544
|
|
|
558
545
|
// src/Dialog/Dialog.tsx
|
|
559
|
-
import
|
|
546
|
+
import React15 from "react";
|
|
560
547
|
import { useOverlayTriggerState } from "@react-stately/overlays";
|
|
561
548
|
import { OverlayContainer } from "@react-aria/overlays";
|
|
562
549
|
import { useButton as useButton2 } from "@react-aria/button";
|
|
563
550
|
import { Close } from "@marigold/icons";
|
|
564
551
|
|
|
565
552
|
// src/Text/Text.tsx
|
|
566
|
-
import
|
|
553
|
+
import React13, { forwardRef as forwardRef2 } from "react";
|
|
567
554
|
var Text = forwardRef2((_a, ref) => {
|
|
568
555
|
var _b = _a, {
|
|
569
556
|
as = "span",
|
|
570
557
|
variant = "body",
|
|
571
558
|
children,
|
|
572
|
-
className,
|
|
573
559
|
align,
|
|
574
560
|
color,
|
|
575
561
|
cursor,
|
|
562
|
+
size,
|
|
576
563
|
outline,
|
|
577
564
|
userSelect
|
|
578
565
|
} = _b, props = __objRest(_b, [
|
|
579
566
|
"as",
|
|
580
567
|
"variant",
|
|
581
568
|
"children",
|
|
582
|
-
"className",
|
|
583
569
|
"align",
|
|
584
570
|
"color",
|
|
585
571
|
"cursor",
|
|
572
|
+
"size",
|
|
586
573
|
"outline",
|
|
587
574
|
"userSelect"
|
|
588
575
|
]);
|
|
589
|
-
return /* @__PURE__ */
|
|
576
|
+
return /* @__PURE__ */ React13.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
590
577
|
as,
|
|
591
578
|
variant: `text.${variant}`,
|
|
592
|
-
css: {
|
|
593
|
-
|
|
579
|
+
css: {
|
|
580
|
+
textAlign: align,
|
|
581
|
+
fontSize: size,
|
|
582
|
+
color,
|
|
583
|
+
cursor,
|
|
584
|
+
outline,
|
|
585
|
+
userSelect
|
|
586
|
+
},
|
|
594
587
|
ref
|
|
595
588
|
}), children);
|
|
596
589
|
});
|
|
597
590
|
|
|
598
591
|
// src/Dialog/ModalDialog.tsx
|
|
599
|
-
import
|
|
592
|
+
import React14 from "react";
|
|
600
593
|
import {
|
|
601
594
|
useOverlay,
|
|
602
595
|
usePreventScroll,
|
|
@@ -615,12 +608,12 @@ var ModalDialog = (_a) => {
|
|
|
615
608
|
"children"
|
|
616
609
|
]);
|
|
617
610
|
const _a2 = props, { isDismissable, isOpen, onClose } = _a2, restProps = __objRest(_a2, ["isDismissable", "isOpen", "onClose"]);
|
|
618
|
-
const ref =
|
|
611
|
+
const ref = React14.useRef();
|
|
619
612
|
const { overlayProps, underlayProps } = useOverlay({ isDismissable, isOpen, onClose }, ref);
|
|
620
613
|
usePreventScroll();
|
|
621
614
|
const { modalProps } = useModal();
|
|
622
615
|
const { dialogProps } = useDialog(props, ref);
|
|
623
|
-
return /* @__PURE__ */
|
|
616
|
+
return /* @__PURE__ */ React14.createElement(Box, __spreadValues({
|
|
624
617
|
__baseCSS: {
|
|
625
618
|
display: "grid",
|
|
626
619
|
placeItems: "center",
|
|
@@ -632,11 +625,11 @@ var ModalDialog = (_a) => {
|
|
|
632
625
|
right: 0
|
|
633
626
|
},
|
|
634
627
|
variant: `dialog.${backdropVariant}`
|
|
635
|
-
}, underlayProps), /* @__PURE__ */
|
|
628
|
+
}, underlayProps), /* @__PURE__ */ React14.createElement(FocusScope, {
|
|
636
629
|
contain: true,
|
|
637
630
|
restoreFocus: true,
|
|
638
631
|
autoFocus: true
|
|
639
|
-
}, /* @__PURE__ */
|
|
632
|
+
}, /* @__PURE__ */ React14.createElement(Box, __spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, overlayProps), dialogProps), modalProps), {
|
|
640
633
|
ref,
|
|
641
634
|
variant: variant ? `dialog.${variant}` : `dialog`
|
|
642
635
|
}), restProps), children)));
|
|
@@ -661,17 +654,17 @@ var Dialog = (_a) => {
|
|
|
661
654
|
"title",
|
|
662
655
|
"variant"
|
|
663
656
|
]);
|
|
664
|
-
const closeButtonRef =
|
|
657
|
+
const closeButtonRef = React15.useRef();
|
|
665
658
|
const { buttonProps: closeButtonProps } = useButton2({
|
|
666
659
|
onPress: () => close()
|
|
667
660
|
}, closeButtonRef);
|
|
668
|
-
return /* @__PURE__ */
|
|
661
|
+
return /* @__PURE__ */ React15.createElement(OverlayContainer, null, /* @__PURE__ */ React15.createElement(ModalDialog, __spreadValues({
|
|
669
662
|
variant,
|
|
670
663
|
backdropVariant,
|
|
671
664
|
isOpen,
|
|
672
665
|
onClose: close,
|
|
673
666
|
isDismissable: true
|
|
674
|
-
}, props), /* @__PURE__ */
|
|
667
|
+
}, props), /* @__PURE__ */ React15.createElement(Box, {
|
|
675
668
|
__baseCSS: {
|
|
676
669
|
display: "flex",
|
|
677
670
|
justifyContent: "space-between",
|
|
@@ -680,12 +673,12 @@ var Dialog = (_a) => {
|
|
|
680
673
|
pb: "large"
|
|
681
674
|
},
|
|
682
675
|
className
|
|
683
|
-
}, /* @__PURE__ */
|
|
676
|
+
}, /* @__PURE__ */ React15.createElement(Box, {
|
|
684
677
|
pt: "medium"
|
|
685
|
-
}, title && /* @__PURE__ */
|
|
678
|
+
}, title && /* @__PURE__ */ React15.createElement(Text, {
|
|
686
679
|
as: "h4",
|
|
687
680
|
variant: "headline4"
|
|
688
|
-
}, title), children), /* @__PURE__ */
|
|
681
|
+
}, title), children), /* @__PURE__ */ React15.createElement(Box, {
|
|
689
682
|
__baseCSS: {
|
|
690
683
|
display: "flex",
|
|
691
684
|
justifyContent: "flex-end",
|
|
@@ -693,7 +686,7 @@ var Dialog = (_a) => {
|
|
|
693
686
|
paddingTop: "xsmall",
|
|
694
687
|
paddingX: "xsmall"
|
|
695
688
|
}
|
|
696
|
-
}, /* @__PURE__ */
|
|
689
|
+
}, /* @__PURE__ */ React15.createElement(Box, __spreadProps(__spreadValues({
|
|
697
690
|
as: Button,
|
|
698
691
|
__baseCSS: {
|
|
699
692
|
color: "text",
|
|
@@ -711,13 +704,13 @@ var Dialog = (_a) => {
|
|
|
711
704
|
}
|
|
712
705
|
}, closeButtonProps), {
|
|
713
706
|
ref: closeButtonRef
|
|
714
|
-
}), /* @__PURE__ */
|
|
707
|
+
}), /* @__PURE__ */ React15.createElement(Close, {
|
|
715
708
|
size: 16
|
|
716
709
|
}))))));
|
|
717
710
|
};
|
|
718
711
|
var useDialogButtonProps = () => {
|
|
719
712
|
const state = useOverlayTriggerState({});
|
|
720
|
-
const openButtonRef =
|
|
713
|
+
const openButtonRef = React15.useRef();
|
|
721
714
|
const { buttonProps: openButtonProps } = useButton2({
|
|
722
715
|
onPress: () => state.open()
|
|
723
716
|
}, openButtonRef);
|
|
@@ -729,21 +722,21 @@ var useDialogButtonProps = () => {
|
|
|
729
722
|
};
|
|
730
723
|
|
|
731
724
|
// src/Divider/Divider.tsx
|
|
732
|
-
import
|
|
725
|
+
import React16 from "react";
|
|
733
726
|
import { useSeparator } from "@react-aria/separator";
|
|
734
727
|
var Divider = (_a) => {
|
|
735
728
|
var _b = _a, { variant = "" } = _b, props = __objRest(_b, ["variant"]);
|
|
736
729
|
const { separatorProps } = useSeparator(props);
|
|
737
|
-
return /* @__PURE__ */
|
|
730
|
+
return /* @__PURE__ */ React16.createElement(Box, __spreadValues(__spreadValues({
|
|
738
731
|
__baseCSS: { width: "100%", height: "1px", m: "none", bg: "text" },
|
|
739
732
|
variant: `divider.${variant}`
|
|
740
733
|
}, props), separatorProps));
|
|
741
734
|
};
|
|
742
735
|
|
|
743
736
|
// src/Field/Field.tsx
|
|
744
|
-
import
|
|
737
|
+
import React17, { useRef as useRef2 } from "react";
|
|
745
738
|
import { useTextField } from "@react-aria/textfield";
|
|
746
|
-
import { Exclamation as
|
|
739
|
+
import { Exclamation as Exclamation2 } from "@marigold/icons";
|
|
747
740
|
var Field = (_a) => {
|
|
748
741
|
var _b = _a, {
|
|
749
742
|
type = "text",
|
|
@@ -764,18 +757,18 @@ var Field = (_a) => {
|
|
|
764
757
|
]);
|
|
765
758
|
const ref = useRef2(null);
|
|
766
759
|
const { labelProps, inputProps, errorMessageProps } = useTextField(props, ref);
|
|
767
|
-
return /* @__PURE__ */
|
|
760
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(Label, __spreadValues({
|
|
768
761
|
variant: labelVariant,
|
|
769
762
|
htmlFor,
|
|
770
763
|
required
|
|
771
|
-
}, labelProps), props.label), /* @__PURE__ */
|
|
764
|
+
}, labelProps), props.label), /* @__PURE__ */ React17.createElement(Box, __spreadValues(__spreadProps(__spreadValues({
|
|
772
765
|
as: "input",
|
|
773
766
|
type,
|
|
774
767
|
id: htmlFor,
|
|
775
768
|
variant: `input.${variant}`
|
|
776
769
|
}, inputProps), {
|
|
777
770
|
ref
|
|
778
|
-
}), props)), error && errorMessage && /* @__PURE__ */
|
|
771
|
+
}), props)), error && errorMessage && /* @__PURE__ */ React17.createElement(ValidationMessage, __spreadValues({}, errorMessageProps), /* @__PURE__ */ React17.createElement(Exclamation2, {
|
|
779
772
|
size: 16
|
|
780
773
|
}), errorMessage));
|
|
781
774
|
};
|
|
@@ -784,21 +777,21 @@ var Field = (_a) => {
|
|
|
784
777
|
import { VisuallyHidden as VisuallyHidden2 } from "@react-aria/visually-hidden";
|
|
785
778
|
|
|
786
779
|
// src/Image/Image.tsx
|
|
787
|
-
import
|
|
780
|
+
import React18 from "react";
|
|
788
781
|
var Image = (_a) => {
|
|
789
782
|
var _b = _a, {
|
|
790
783
|
variant = "fullWidth"
|
|
791
784
|
} = _b, props = __objRest(_b, [
|
|
792
785
|
"variant"
|
|
793
786
|
]);
|
|
794
|
-
return /* @__PURE__ */
|
|
787
|
+
return /* @__PURE__ */ React18.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
795
788
|
as: "img",
|
|
796
789
|
variant: `image.${variant}`
|
|
797
790
|
}));
|
|
798
791
|
};
|
|
799
792
|
|
|
800
793
|
// src/Link/Link.tsx
|
|
801
|
-
import
|
|
794
|
+
import React19, { useRef as useRef3 } from "react";
|
|
802
795
|
import { useLink } from "@react-aria/link";
|
|
803
796
|
var Link = (_a) => {
|
|
804
797
|
var _b = _a, {
|
|
@@ -817,7 +810,7 @@ var Link = (_a) => {
|
|
|
817
810
|
elementType: typeof as === "string" ? as : "span",
|
|
818
811
|
isDisabled: disabled
|
|
819
812
|
}), ref);
|
|
820
|
-
return /* @__PURE__ */
|
|
813
|
+
return /* @__PURE__ */ React19.createElement(Text, __spreadProps(__spreadValues(__spreadValues({}, props), linkProps), {
|
|
821
814
|
as,
|
|
822
815
|
variant,
|
|
823
816
|
ref
|
|
@@ -825,7 +818,7 @@ var Link = (_a) => {
|
|
|
825
818
|
};
|
|
826
819
|
|
|
827
820
|
// src/Menu/Menu.tsx
|
|
828
|
-
import
|
|
821
|
+
import React20 from "react";
|
|
829
822
|
var Menu = (_a) => {
|
|
830
823
|
var _b = _a, {
|
|
831
824
|
variant = "default",
|
|
@@ -840,12 +833,12 @@ var Menu = (_a) => {
|
|
|
840
833
|
"show",
|
|
841
834
|
"children"
|
|
842
835
|
]);
|
|
843
|
-
return /* @__PURE__ */
|
|
836
|
+
return /* @__PURE__ */ React20.createElement(Box, __spreadValues({
|
|
844
837
|
variant: `menu.${variant}`
|
|
845
|
-
}, props), /* @__PURE__ */
|
|
838
|
+
}, props), /* @__PURE__ */ React20.createElement(Button, {
|
|
846
839
|
onClick,
|
|
847
840
|
variant: "menu"
|
|
848
|
-
}, label), show ? /* @__PURE__ */
|
|
841
|
+
}, label), show ? /* @__PURE__ */ React20.createElement(Box, {
|
|
849
842
|
display: "block",
|
|
850
843
|
position: "absolute",
|
|
851
844
|
minWidth: "120px",
|
|
@@ -854,28 +847,25 @@ var Menu = (_a) => {
|
|
|
854
847
|
};
|
|
855
848
|
|
|
856
849
|
// src/MenuItem/MenuItem.tsx
|
|
857
|
-
import
|
|
850
|
+
import React21 from "react";
|
|
858
851
|
var MenuItem = (_a) => {
|
|
859
852
|
var _b = _a, {
|
|
860
853
|
variant = "default",
|
|
861
|
-
className,
|
|
862
854
|
children
|
|
863
855
|
} = _b, props = __objRest(_b, [
|
|
864
856
|
"variant",
|
|
865
|
-
"className",
|
|
866
857
|
"children"
|
|
867
858
|
]);
|
|
868
|
-
return /* @__PURE__ */
|
|
869
|
-
variant: `menuItem.${variant}
|
|
870
|
-
|
|
871
|
-
}, /* @__PURE__ */ React22.createElement(Link, __spreadValues({
|
|
859
|
+
return /* @__PURE__ */ React21.createElement(Box, {
|
|
860
|
+
variant: `menuItem.${variant}`
|
|
861
|
+
}, /* @__PURE__ */ React21.createElement(Link, __spreadValues({
|
|
872
862
|
variant: "menuItemLink"
|
|
873
863
|
}, props), children));
|
|
874
864
|
};
|
|
875
865
|
|
|
876
866
|
// src/Message/Message.tsx
|
|
877
|
-
import
|
|
878
|
-
import { Exclamation as
|
|
867
|
+
import React22 from "react";
|
|
868
|
+
import { Exclamation as Exclamation3, Info, Notification } from "@marigold/icons";
|
|
879
869
|
var Message = (_a) => {
|
|
880
870
|
var _b = _a, {
|
|
881
871
|
messageTitle,
|
|
@@ -888,25 +878,25 @@ var Message = (_a) => {
|
|
|
888
878
|
"className",
|
|
889
879
|
"children"
|
|
890
880
|
]);
|
|
891
|
-
var icon = /* @__PURE__ */
|
|
881
|
+
var icon = /* @__PURE__ */ React22.createElement(Info, null);
|
|
892
882
|
if (variant === "warning") {
|
|
893
|
-
icon = /* @__PURE__ */
|
|
883
|
+
icon = /* @__PURE__ */ React22.createElement(Notification, null);
|
|
894
884
|
}
|
|
895
885
|
if (variant === "error") {
|
|
896
|
-
icon = /* @__PURE__ */
|
|
886
|
+
icon = /* @__PURE__ */ React22.createElement(Exclamation3, null);
|
|
897
887
|
}
|
|
898
|
-
return /* @__PURE__ */
|
|
888
|
+
return /* @__PURE__ */ React22.createElement(Box, __spreadValues({
|
|
899
889
|
display: "inline-block",
|
|
900
890
|
variant: `message.${variant}`,
|
|
901
891
|
className
|
|
902
|
-
}, props), /* @__PURE__ */
|
|
892
|
+
}, props), /* @__PURE__ */ React22.createElement(Box, {
|
|
903
893
|
display: "flex",
|
|
904
894
|
alignItems: "center",
|
|
905
895
|
variant: "message.title"
|
|
906
|
-
}, icon, /* @__PURE__ */
|
|
896
|
+
}, icon, /* @__PURE__ */ React22.createElement(Text, {
|
|
907
897
|
as: "h4",
|
|
908
898
|
variant: "headline4"
|
|
909
|
-
}, messageTitle)), /* @__PURE__ */
|
|
899
|
+
}, messageTitle)), /* @__PURE__ */ React22.createElement(Box, {
|
|
910
900
|
css: { color: "black" }
|
|
911
901
|
}, children));
|
|
912
902
|
};
|
|
@@ -916,7 +906,7 @@ import { useTheme as useTheme3, ThemeProvider as ThemeProvider2 } from "@marigol
|
|
|
916
906
|
import { SSRProvider } from "@react-aria/ssr";
|
|
917
907
|
|
|
918
908
|
// src/Provider/MarigoldProvider.tsx
|
|
919
|
-
import
|
|
909
|
+
import React23 from "react";
|
|
920
910
|
import { OverlayProvider } from "@react-aria/overlays";
|
|
921
911
|
import {
|
|
922
912
|
Global,
|
|
@@ -930,19 +920,19 @@ function MarigoldProvider({
|
|
|
930
920
|
}) {
|
|
931
921
|
const outer = useTheme2();
|
|
932
922
|
const isTopLevel = outer.theme === __defaultTheme;
|
|
933
|
-
return /* @__PURE__ */
|
|
923
|
+
return /* @__PURE__ */ React23.createElement(ThemeProvider, {
|
|
934
924
|
theme
|
|
935
|
-
}, isTopLevel ? /* @__PURE__ */
|
|
925
|
+
}, isTopLevel ? /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(Global, null), /* @__PURE__ */ React23.createElement(OverlayProvider, null, children)) : children);
|
|
936
926
|
}
|
|
937
927
|
|
|
938
928
|
// src/Radio/Radio.tsx
|
|
939
|
-
import
|
|
940
|
-
import { Exclamation as
|
|
929
|
+
import React25 from "react";
|
|
930
|
+
import { Exclamation as Exclamation4 } from "@marigold/icons";
|
|
941
931
|
import { useFocusRing as useFocusRing2 } from "@react-aria/focus";
|
|
942
932
|
import { VisuallyHidden as VisuallyHidden3 } from "@react-aria/visually-hidden";
|
|
943
933
|
|
|
944
934
|
// src/Radio/RadioIcon.tsx
|
|
945
|
-
import
|
|
935
|
+
import React24 from "react";
|
|
946
936
|
import { conditional as conditional2, SVG as SVG2 } from "@marigold/system";
|
|
947
937
|
var RadioIcon = ({
|
|
948
938
|
variant = "",
|
|
@@ -956,19 +946,19 @@ var RadioIcon = ({
|
|
|
956
946
|
checked,
|
|
957
947
|
error
|
|
958
948
|
};
|
|
959
|
-
return /* @__PURE__ */
|
|
949
|
+
return /* @__PURE__ */ React24.createElement(SVG2, {
|
|
960
950
|
width: "16",
|
|
961
951
|
height: "32",
|
|
962
952
|
viewBox: "0 0 16 32",
|
|
963
953
|
fill: "none",
|
|
964
954
|
"aria-hidden": "true"
|
|
965
|
-
}, /* @__PURE__ */
|
|
955
|
+
}, /* @__PURE__ */ React24.createElement(Box, {
|
|
966
956
|
variant: conditional2(`radio.${variant}`, conditionalStates),
|
|
967
957
|
as: "circle",
|
|
968
958
|
cx: "8",
|
|
969
959
|
cy: "16",
|
|
970
960
|
r: "7.5"
|
|
971
|
-
}), checked && /* @__PURE__ */
|
|
961
|
+
}), checked && /* @__PURE__ */ React24.createElement("circle", {
|
|
972
962
|
fill: "white",
|
|
973
963
|
cx: "8",
|
|
974
964
|
cy: "16",
|
|
@@ -980,12 +970,13 @@ var RadioIcon = ({
|
|
|
980
970
|
var RadioInput = (_a) => {
|
|
981
971
|
var _b = _a, { error } = _b, props = __objRest(_b, ["error"]);
|
|
982
972
|
const { focusProps } = useFocusRing2();
|
|
983
|
-
|
|
973
|
+
const _a2 = props, { children } = _a2, restProps = __objRest(_a2, ["children"]);
|
|
974
|
+
return /* @__PURE__ */ React25.createElement(Box, {
|
|
984
975
|
pr: "xsmall"
|
|
985
|
-
}, /* @__PURE__ */
|
|
976
|
+
}, /* @__PURE__ */ React25.createElement(VisuallyHidden3, null, /* @__PURE__ */ React25.createElement("input", __spreadValues(__spreadValues({
|
|
986
977
|
type: "radio",
|
|
987
978
|
disabled: props.disabled
|
|
988
|
-
}, focusProps),
|
|
979
|
+
}, focusProps), restProps))), /* @__PURE__ */ React25.createElement(RadioIcon, {
|
|
989
980
|
variant: props.variant,
|
|
990
981
|
disabled: props.disabled,
|
|
991
982
|
checked: props.checked,
|
|
@@ -994,53 +985,30 @@ var RadioInput = (_a) => {
|
|
|
994
985
|
};
|
|
995
986
|
var Radio = (_a) => {
|
|
996
987
|
var _b = _a, {
|
|
997
|
-
label,
|
|
998
988
|
required,
|
|
999
989
|
labelVariant = "inline",
|
|
1000
|
-
error,
|
|
1001
990
|
errorMessage
|
|
1002
991
|
} = _b, props = __objRest(_b, [
|
|
1003
|
-
"label",
|
|
1004
992
|
"required",
|
|
1005
993
|
"labelVariant",
|
|
1006
|
-
"error",
|
|
1007
994
|
"errorMessage"
|
|
1008
995
|
]);
|
|
1009
|
-
return /* @__PURE__ */
|
|
996
|
+
return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(Box, {
|
|
1010
997
|
as: Label,
|
|
1011
998
|
htmlFor: props.id,
|
|
1012
999
|
required,
|
|
1013
1000
|
variant: `label.${labelVariant}`,
|
|
1014
1001
|
css: props.disabled ? { color: "disabled", ":hover": { cursor: "not-allowed" } } : { color: "text", ":hover": { cursor: "pointer" } }
|
|
1015
|
-
}, /* @__PURE__ */
|
|
1002
|
+
}, /* @__PURE__ */ React25.createElement(Box, __spreadValues({
|
|
1016
1003
|
as: RadioInput,
|
|
1017
|
-
error
|
|
1018
|
-
}, props)),
|
|
1004
|
+
error: props.error
|
|
1005
|
+
}, props)), props.children), props.error && errorMessage && /* @__PURE__ */ React25.createElement(ValidationMessage, null, /* @__PURE__ */ React25.createElement(Exclamation4, {
|
|
1019
1006
|
size: 16
|
|
1020
1007
|
}), errorMessage));
|
|
1021
1008
|
};
|
|
1022
1009
|
|
|
1023
|
-
// src/Slider/Slider.tsx
|
|
1024
|
-
import React27 from "react";
|
|
1025
|
-
var Slider = (_a) => {
|
|
1026
|
-
var _b = _a, {
|
|
1027
|
-
variant = "",
|
|
1028
|
-
className
|
|
1029
|
-
} = _b, props = __objRest(_b, [
|
|
1030
|
-
"variant",
|
|
1031
|
-
"className"
|
|
1032
|
-
]);
|
|
1033
|
-
return /* @__PURE__ */ React27.createElement(Box, __spreadValues({
|
|
1034
|
-
as: "input",
|
|
1035
|
-
type: "range",
|
|
1036
|
-
css: { verticalAlign: "middle" },
|
|
1037
|
-
variant: `slider.${variant}`,
|
|
1038
|
-
className
|
|
1039
|
-
}, props));
|
|
1040
|
-
};
|
|
1041
|
-
|
|
1042
1010
|
// src/Select/Select.tsx
|
|
1043
|
-
import
|
|
1011
|
+
import React30, { useRef as useRef6 } from "react";
|
|
1044
1012
|
import { useSelectState } from "@react-stately/select";
|
|
1045
1013
|
import { useButton as useButton3 } from "@react-aria/button";
|
|
1046
1014
|
import { mergeProps as mergeProps2 } from "@react-aria/utils";
|
|
@@ -1048,14 +1016,14 @@ import { useFocusRing as useFocusRing3 } from "@react-aria/focus";
|
|
|
1048
1016
|
import { HiddenSelect, useSelect } from "@react-aria/select";
|
|
1049
1017
|
import { useOverlayTriggerState as useOverlayTriggerState2 } from "@react-stately/overlays";
|
|
1050
1018
|
import { useOverlayTrigger, useOverlayPosition } from "@react-aria/overlays";
|
|
1051
|
-
import { ArrowDown, ArrowUp, Exclamation as
|
|
1019
|
+
import { ArrowDown, ArrowUp, Exclamation as Exclamation5, Required as Required2 } from "@marigold/icons";
|
|
1052
1020
|
|
|
1053
1021
|
// src/Select/ListBox.tsx
|
|
1054
|
-
import
|
|
1022
|
+
import React28, { useRef as useRef5 } from "react";
|
|
1055
1023
|
import { useListBox } from "@react-aria/listbox";
|
|
1056
1024
|
|
|
1057
1025
|
// src/Select/Option.tsx
|
|
1058
|
-
import
|
|
1026
|
+
import React26, { useEffect, useRef as useRef4, useState as useState2 } from "react";
|
|
1059
1027
|
import { useOption } from "@react-aria/listbox";
|
|
1060
1028
|
var Option = ({ item, state }) => {
|
|
1061
1029
|
const ref = useRef4(null);
|
|
@@ -1070,7 +1038,7 @@ var Option = ({ item, state }) => {
|
|
|
1070
1038
|
}
|
|
1071
1039
|
}
|
|
1072
1040
|
}, [state.disabledKeys, item.key]);
|
|
1073
|
-
return /* @__PURE__ */
|
|
1041
|
+
return /* @__PURE__ */ React26.createElement(Box, __spreadProps(__spreadValues({
|
|
1074
1042
|
as: "li"
|
|
1075
1043
|
}, optionProps), {
|
|
1076
1044
|
ref,
|
|
@@ -1079,26 +1047,26 @@ var Option = ({ item, state }) => {
|
|
|
1079
1047
|
};
|
|
1080
1048
|
|
|
1081
1049
|
// src/Select/ListBoxSection.tsx
|
|
1082
|
-
import
|
|
1050
|
+
import React27 from "react";
|
|
1083
1051
|
import { useListBoxSection } from "@react-aria/listbox";
|
|
1084
1052
|
var ListBoxSection = ({ section, state }) => {
|
|
1085
1053
|
const { itemProps, headingProps, groupProps } = useListBoxSection({
|
|
1086
1054
|
heading: section.rendered,
|
|
1087
1055
|
"aria-label": section["aria-label"]
|
|
1088
1056
|
});
|
|
1089
|
-
return /* @__PURE__ */
|
|
1057
|
+
return /* @__PURE__ */ React27.createElement(Box, __spreadProps(__spreadValues({
|
|
1090
1058
|
as: "li"
|
|
1091
1059
|
}, itemProps), {
|
|
1092
1060
|
css: {
|
|
1093
1061
|
cursor: "not-allowed"
|
|
1094
1062
|
}
|
|
1095
|
-
}), section.rendered && /* @__PURE__ */
|
|
1063
|
+
}), section.rendered && /* @__PURE__ */ React27.createElement(Box, __spreadProps(__spreadValues({
|
|
1096
1064
|
as: "span"
|
|
1097
1065
|
}, headingProps), {
|
|
1098
1066
|
variant: "select.section"
|
|
1099
|
-
}), section.rendered), /* @__PURE__ */
|
|
1067
|
+
}), section.rendered), /* @__PURE__ */ React27.createElement(Box, __spreadValues({
|
|
1100
1068
|
as: "ul"
|
|
1101
|
-
}, groupProps), [...section.childNodes].map((node) => /* @__PURE__ */
|
|
1069
|
+
}, groupProps), [...section.childNodes].map((node) => /* @__PURE__ */ React27.createElement(Option, {
|
|
1102
1070
|
key: node.key,
|
|
1103
1071
|
item: node,
|
|
1104
1072
|
state
|
|
@@ -1110,7 +1078,7 @@ var ListBox = (props) => {
|
|
|
1110
1078
|
const ref = useRef5(null);
|
|
1111
1079
|
const { state, error } = props;
|
|
1112
1080
|
const { listBoxProps } = useListBox(props, state, ref);
|
|
1113
|
-
return /* @__PURE__ */
|
|
1081
|
+
return /* @__PURE__ */ React28.createElement(Box, __spreadProps(__spreadValues({
|
|
1114
1082
|
as: "ul",
|
|
1115
1083
|
p: "none",
|
|
1116
1084
|
css: {
|
|
@@ -1119,11 +1087,11 @@ var ListBox = (props) => {
|
|
|
1119
1087
|
}, listBoxProps), {
|
|
1120
1088
|
variant: error ? "select.listbox.error" : "select.listbox",
|
|
1121
1089
|
ref
|
|
1122
|
-
}), [...state.collection].map((item) => item.type === "section" ? /* @__PURE__ */
|
|
1090
|
+
}), [...state.collection].map((item) => item.type === "section" ? /* @__PURE__ */ React28.createElement(ListBoxSection, {
|
|
1123
1091
|
key: item.key,
|
|
1124
1092
|
section: item,
|
|
1125
1093
|
state
|
|
1126
|
-
}) : /* @__PURE__ */
|
|
1094
|
+
}) : /* @__PURE__ */ React28.createElement(Option, {
|
|
1127
1095
|
key: item.key,
|
|
1128
1096
|
item,
|
|
1129
1097
|
state
|
|
@@ -1131,7 +1099,7 @@ var ListBox = (props) => {
|
|
|
1131
1099
|
};
|
|
1132
1100
|
|
|
1133
1101
|
// src/Select/Popover.tsx
|
|
1134
|
-
import
|
|
1102
|
+
import React29, { forwardRef as forwardRef3 } from "react";
|
|
1135
1103
|
import { FocusScope as FocusScope2 } from "@react-aria/focus";
|
|
1136
1104
|
import {
|
|
1137
1105
|
DismissButton,
|
|
@@ -1149,12 +1117,12 @@ var Popover = forwardRef3((_a, ref) => {
|
|
|
1149
1117
|
isDismissable: true
|
|
1150
1118
|
}, ref);
|
|
1151
1119
|
const { modalProps } = useModal2();
|
|
1152
|
-
return /* @__PURE__ */
|
|
1120
|
+
return /* @__PURE__ */ React29.createElement(OverlayContainer2, null, /* @__PURE__ */ React29.createElement(FocusScope2, {
|
|
1153
1121
|
restoreFocus: true
|
|
1154
|
-
}, /* @__PURE__ */
|
|
1122
|
+
}, /* @__PURE__ */ React29.createElement(Box, __spreadProps(__spreadValues({}, mergeProps(overlayProps, otherProps, modalProps)), {
|
|
1155
1123
|
className,
|
|
1156
1124
|
ref
|
|
1157
|
-
}), children, /* @__PURE__ */
|
|
1125
|
+
}), children, /* @__PURE__ */ React29.createElement(DismissButton, {
|
|
1158
1126
|
onDismiss: onClose
|
|
1159
1127
|
}))));
|
|
1160
1128
|
});
|
|
@@ -1196,47 +1164,44 @@ var Select = (_a) => {
|
|
|
1196
1164
|
const { labelProps, triggerProps, valueProps, menuProps } = useSelect(props, state, triggerRef);
|
|
1197
1165
|
const { buttonProps } = useButton3(triggerProps, triggerRef);
|
|
1198
1166
|
const { focusProps } = useFocusRing3();
|
|
1199
|
-
return /* @__PURE__ */
|
|
1167
|
+
return /* @__PURE__ */ React30.createElement(Box, {
|
|
1200
1168
|
position: "relative",
|
|
1201
1169
|
display: "inline-block",
|
|
1202
1170
|
width: width && width
|
|
1203
|
-
}, props.label && /* @__PURE__ */
|
|
1171
|
+
}, props.label && /* @__PURE__ */ React30.createElement(Box, null, /* @__PURE__ */ React30.createElement(Label, __spreadProps(__spreadValues({}, labelProps), {
|
|
1204
1172
|
htmlFor: labelProps.id,
|
|
1205
1173
|
variant: labelVariant
|
|
1206
|
-
}), required ? /* @__PURE__ */
|
|
1174
|
+
}), required ? /* @__PURE__ */ React30.createElement(Box, {
|
|
1207
1175
|
as: "span",
|
|
1208
1176
|
display: "inline-flex",
|
|
1209
1177
|
alignItems: "center"
|
|
1210
|
-
}, props.label, /* @__PURE__ */
|
|
1211
|
-
as: Required2,
|
|
1178
|
+
}, props.label, /* @__PURE__ */ React30.createElement(Required2, {
|
|
1212
1179
|
size: 16,
|
|
1213
|
-
|
|
1214
|
-
})) : props.label)), /* @__PURE__ */
|
|
1180
|
+
fill: "error"
|
|
1181
|
+
})) : props.label)), /* @__PURE__ */ React30.createElement(HiddenSelect, {
|
|
1215
1182
|
state,
|
|
1216
1183
|
triggerRef,
|
|
1217
1184
|
label: props.label,
|
|
1218
1185
|
name: props.name,
|
|
1219
1186
|
isDisabled: disabled
|
|
1220
|
-
}), /* @__PURE__ */
|
|
1187
|
+
}), /* @__PURE__ */ React30.createElement(Box, __spreadProps(__spreadValues({
|
|
1221
1188
|
as: "button"
|
|
1222
1189
|
}, mergeProps2(buttonProps, focusProps)), {
|
|
1223
1190
|
ref: triggerRef,
|
|
1224
1191
|
variant: error && state.isOpen && !disabled ? "button.select.errorOpened" : error ? "button.select.error" : state.isOpen && !disabled ? "button.select.open" : "button.select",
|
|
1225
1192
|
disabled,
|
|
1226
1193
|
className
|
|
1227
|
-
}), /* @__PURE__ */
|
|
1194
|
+
}), /* @__PURE__ */ React30.createElement(Box, __spreadProps(__spreadValues({
|
|
1228
1195
|
as: "span"
|
|
1229
1196
|
}, valueProps), {
|
|
1230
1197
|
variant: disabled ? "select.disabled" : "select"
|
|
1231
|
-
}), state.selectedItem ? state.selectedItem.rendered : placeholder), state.isOpen && !disabled ? /* @__PURE__ */
|
|
1232
|
-
as: ArrowUp,
|
|
1198
|
+
}), state.selectedItem ? state.selectedItem.rendered : placeholder), state.isOpen && !disabled ? /* @__PURE__ */ React30.createElement(ArrowUp, {
|
|
1233
1199
|
size: 16,
|
|
1234
|
-
|
|
1235
|
-
}) : /* @__PURE__ */
|
|
1236
|
-
as: ArrowDown,
|
|
1200
|
+
fill: "text"
|
|
1201
|
+
}) : /* @__PURE__ */ React30.createElement(ArrowDown, {
|
|
1237
1202
|
size: 16,
|
|
1238
|
-
|
|
1239
|
-
})), state.isOpen && !disabled && /* @__PURE__ */
|
|
1203
|
+
fill: disabled ? "disabled" : "text"
|
|
1204
|
+
})), state.isOpen && !disabled && /* @__PURE__ */ React30.createElement(Box, __spreadProps(__spreadValues(__spreadValues({
|
|
1240
1205
|
as: Popover
|
|
1241
1206
|
}, overlayProps), positionProps), {
|
|
1242
1207
|
css: {
|
|
@@ -1245,25 +1210,99 @@ var Select = (_a) => {
|
|
|
1245
1210
|
ref: overlayRef,
|
|
1246
1211
|
isOpen: state.isOpen,
|
|
1247
1212
|
onClose: state.close
|
|
1248
|
-
}), /* @__PURE__ */
|
|
1213
|
+
}), /* @__PURE__ */ React30.createElement(ListBox, __spreadProps(__spreadValues({
|
|
1249
1214
|
error
|
|
1250
1215
|
}, menuProps), {
|
|
1251
1216
|
state
|
|
1252
|
-
}))), error && errorMessage && /* @__PURE__ */
|
|
1217
|
+
}))), error && errorMessage && /* @__PURE__ */ React30.createElement(Box, {
|
|
1253
1218
|
as: "span",
|
|
1254
1219
|
display: "inline-flex",
|
|
1255
1220
|
alignItems: "center"
|
|
1256
|
-
}, /* @__PURE__ */
|
|
1257
|
-
as:
|
|
1221
|
+
}, /* @__PURE__ */ React30.createElement(Box, {
|
|
1222
|
+
as: Exclamation5,
|
|
1258
1223
|
size: 16,
|
|
1259
1224
|
css: { color: "error" }
|
|
1260
|
-
}), /* @__PURE__ */
|
|
1225
|
+
}), /* @__PURE__ */ React30.createElement(ValidationMessage, null, errorMessage)));
|
|
1226
|
+
};
|
|
1227
|
+
|
|
1228
|
+
// src/Slider/Slider.tsx
|
|
1229
|
+
import React31 from "react";
|
|
1230
|
+
var Slider = (_a) => {
|
|
1231
|
+
var _b = _a, { variant = "" } = _b, props = __objRest(_b, ["variant"]);
|
|
1232
|
+
return /* @__PURE__ */ React31.createElement(Box, __spreadValues({
|
|
1233
|
+
as: "input",
|
|
1234
|
+
type: "range",
|
|
1235
|
+
css: { verticalAlign: "middle" },
|
|
1236
|
+
variant: `slider.${variant}`
|
|
1237
|
+
}, props));
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
// src/Switch/Switch.tsx
|
|
1241
|
+
import React32, { useRef as useRef7 } from "react";
|
|
1242
|
+
import { useFocusRing as useFocusRing4 } from "@react-aria/focus";
|
|
1243
|
+
import { useSwitch } from "@react-aria/switch";
|
|
1244
|
+
import { VisuallyHidden as VisuallyHidden4 } from "@react-aria/visually-hidden";
|
|
1245
|
+
import { conditional as conditional3 } from "@marigold/system";
|
|
1246
|
+
var Switch = (_a) => {
|
|
1247
|
+
var _b = _a, {
|
|
1248
|
+
variant = "",
|
|
1249
|
+
labelVariant = "above",
|
|
1250
|
+
disabled
|
|
1251
|
+
} = _b, props = __objRest(_b, [
|
|
1252
|
+
"variant",
|
|
1253
|
+
"labelVariant",
|
|
1254
|
+
"disabled"
|
|
1255
|
+
]);
|
|
1256
|
+
const state = useToggleState(props);
|
|
1257
|
+
const ref = useRef7();
|
|
1258
|
+
const { inputProps } = useSwitch(props, state, ref);
|
|
1259
|
+
const { focusProps } = useFocusRing4();
|
|
1260
|
+
return /* @__PURE__ */ React32.createElement(Box, {
|
|
1261
|
+
as: Label,
|
|
1262
|
+
__baseCSS: {
|
|
1263
|
+
userSelect: "none"
|
|
1264
|
+
},
|
|
1265
|
+
variant: labelVariant
|
|
1266
|
+
}, props.children, /* @__PURE__ */ React32.createElement(VisuallyHidden4, null, /* @__PURE__ */ React32.createElement("input", __spreadProps(__spreadValues(__spreadValues({}, inputProps), focusProps), {
|
|
1267
|
+
disabled,
|
|
1268
|
+
ref
|
|
1269
|
+
}))), /* @__PURE__ */ React32.createElement(Box, {
|
|
1270
|
+
as: "svg",
|
|
1271
|
+
__baseCSS: {
|
|
1272
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
1273
|
+
width: 56,
|
|
1274
|
+
height: 32
|
|
1275
|
+
},
|
|
1276
|
+
"aria-hidden": "true"
|
|
1277
|
+
}, /* @__PURE__ */ React32.createElement(Box, {
|
|
1278
|
+
as: "rect",
|
|
1279
|
+
__baseCSS: {
|
|
1280
|
+
x: 4,
|
|
1281
|
+
y: 4,
|
|
1282
|
+
rx: 12,
|
|
1283
|
+
width: 48,
|
|
1284
|
+
height: 24
|
|
1285
|
+
},
|
|
1286
|
+
variant: conditional3(`switch.${variant}`, {
|
|
1287
|
+
checked: state.isSelected,
|
|
1288
|
+
disabled
|
|
1289
|
+
})
|
|
1290
|
+
}), /* @__PURE__ */ React32.createElement(Box, {
|
|
1291
|
+
as: "circle",
|
|
1292
|
+
__baseCSS: {
|
|
1293
|
+
boxShadow: "1px 1px 4px rgba(0, 0, 0, 0.25)",
|
|
1294
|
+
cx: state.isSelected ? 40 : 16,
|
|
1295
|
+
cy: 16,
|
|
1296
|
+
r: 11,
|
|
1297
|
+
fill: disabled ? "gray20" : "gray00"
|
|
1298
|
+
}
|
|
1299
|
+
})));
|
|
1261
1300
|
};
|
|
1262
1301
|
|
|
1263
1302
|
// src/Textarea/Textarea.tsx
|
|
1264
|
-
import React33, { useRef as
|
|
1303
|
+
import React33, { useRef as useRef8 } from "react";
|
|
1265
1304
|
import { useTextField as useTextField2 } from "@react-aria/textfield";
|
|
1266
|
-
import { Exclamation as
|
|
1305
|
+
import { Exclamation as Exclamation6 } from "@marigold/icons";
|
|
1267
1306
|
var Textarea = (_a) => {
|
|
1268
1307
|
var _b = _a, {
|
|
1269
1308
|
variant = "",
|
|
@@ -1280,7 +1319,7 @@ var Textarea = (_a) => {
|
|
|
1280
1319
|
"required",
|
|
1281
1320
|
"children"
|
|
1282
1321
|
]);
|
|
1283
|
-
const ref =
|
|
1322
|
+
const ref = useRef8(null);
|
|
1284
1323
|
const { labelProps, inputProps, errorMessageProps } = useTextField2(__spreadProps(__spreadValues({}, props), {
|
|
1285
1324
|
inputElementType: "textarea"
|
|
1286
1325
|
}), ref);
|
|
@@ -1295,13 +1334,61 @@ var Textarea = (_a) => {
|
|
|
1295
1334
|
}
|
|
1296
1335
|
}, inputProps), {
|
|
1297
1336
|
ref
|
|
1298
|
-
}), props)), error && errorMessage && /* @__PURE__ */ React33.createElement(ValidationMessage, __spreadValues({}, errorMessageProps), /* @__PURE__ */ React33.createElement(
|
|
1337
|
+
}), props)), error && errorMessage && /* @__PURE__ */ React33.createElement(ValidationMessage, __spreadValues({}, errorMessageProps), /* @__PURE__ */ React33.createElement(Exclamation6, {
|
|
1299
1338
|
size: 16
|
|
1300
1339
|
}), errorMessage));
|
|
1301
1340
|
};
|
|
1302
1341
|
|
|
1342
|
+
// src/Tooltip/Tooltip.tsx
|
|
1343
|
+
import React35, { useContext } from "react";
|
|
1344
|
+
import { useTooltip } from "@react-aria/tooltip";
|
|
1345
|
+
import { mergeProps as mergeProps3 } from "@react-aria/utils";
|
|
1346
|
+
|
|
1347
|
+
// src/Tooltip/TooltipTrigger.tsx
|
|
1348
|
+
import React34, { useRef as useRef9 } from "react";
|
|
1349
|
+
import { FocusableProvider } from "@react-aria/focus";
|
|
1350
|
+
import { useTooltipTrigger } from "@react-aria/tooltip";
|
|
1351
|
+
import {
|
|
1352
|
+
useTooltipTriggerState
|
|
1353
|
+
} from "@react-stately/tooltip";
|
|
1354
|
+
var TooltipContext = React34.createContext({});
|
|
1355
|
+
var TooltipTrigger = (_a) => {
|
|
1356
|
+
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
1357
|
+
const [trigger, tooltip] = React34.Children.toArray(children);
|
|
1358
|
+
const state = useTooltipTriggerState(props);
|
|
1359
|
+
const tooltipTriggerRef = useRef9();
|
|
1360
|
+
const { triggerProps, tooltipProps } = useTooltipTrigger({}, state, tooltipTriggerRef);
|
|
1361
|
+
return /* @__PURE__ */ React34.createElement(FocusableProvider, __spreadProps(__spreadValues({}, triggerProps), {
|
|
1362
|
+
ref: tooltipTriggerRef
|
|
1363
|
+
}), trigger, state.isOpen && /* @__PURE__ */ React34.createElement(TooltipContext.Provider, {
|
|
1364
|
+
value: __spreadValues({
|
|
1365
|
+
state
|
|
1366
|
+
}, tooltipProps)
|
|
1367
|
+
}, tooltip));
|
|
1368
|
+
};
|
|
1369
|
+
|
|
1370
|
+
// src/Tooltip/Tooltip.tsx
|
|
1371
|
+
var Tooltip = (_a) => {
|
|
1372
|
+
var _b = _a, {
|
|
1373
|
+
variant = "",
|
|
1374
|
+
children
|
|
1375
|
+
} = _b, props = __objRest(_b, [
|
|
1376
|
+
"variant",
|
|
1377
|
+
"children"
|
|
1378
|
+
]);
|
|
1379
|
+
const _a2 = useContext(TooltipContext), { state } = _a2, tooltipProviderProps = __objRest(_a2, ["state"]);
|
|
1380
|
+
const mergedProps = mergeProps3(props, tooltipProviderProps);
|
|
1381
|
+
const { tooltipProps } = useTooltip(mergedProps, state);
|
|
1382
|
+
return /* @__PURE__ */ React35.createElement(Box, __spreadValues({
|
|
1383
|
+
position: "relative"
|
|
1384
|
+
}, tooltipProps), /* @__PURE__ */ React35.createElement(Box, __spreadValues({
|
|
1385
|
+
position: "absolute",
|
|
1386
|
+
variant: `tooltip.${variant}`
|
|
1387
|
+
}, mergedProps), children));
|
|
1388
|
+
};
|
|
1389
|
+
|
|
1303
1390
|
// src/Input/Input.tsx
|
|
1304
|
-
import
|
|
1391
|
+
import React36 from "react";
|
|
1305
1392
|
var Input = (_a) => {
|
|
1306
1393
|
var _b = _a, {
|
|
1307
1394
|
variant = "",
|
|
@@ -1310,7 +1397,7 @@ var Input = (_a) => {
|
|
|
1310
1397
|
"variant",
|
|
1311
1398
|
"type"
|
|
1312
1399
|
]);
|
|
1313
|
-
return /* @__PURE__ */
|
|
1400
|
+
return /* @__PURE__ */ React36.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
1314
1401
|
as: "input",
|
|
1315
1402
|
type,
|
|
1316
1403
|
variant: `input.${variant}`
|
|
@@ -1318,10 +1405,10 @@ var Input = (_a) => {
|
|
|
1318
1405
|
};
|
|
1319
1406
|
|
|
1320
1407
|
// src/Container/Container.tsx
|
|
1321
|
-
import
|
|
1408
|
+
import React37 from "react";
|
|
1322
1409
|
var Container = (_a) => {
|
|
1323
1410
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
1324
|
-
return /* @__PURE__ */
|
|
1411
|
+
return /* @__PURE__ */ React37.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
1325
1412
|
width: "100%"
|
|
1326
1413
|
}), children);
|
|
1327
1414
|
};
|
|
@@ -1330,7 +1417,6 @@ var Container = (_a) => {
|
|
|
1330
1417
|
import { Item, Section } from "@react-stately/collections";
|
|
1331
1418
|
export {
|
|
1332
1419
|
ActionGroup,
|
|
1333
|
-
Alert,
|
|
1334
1420
|
Badge,
|
|
1335
1421
|
Box,
|
|
1336
1422
|
Button,
|
|
@@ -1359,9 +1445,13 @@ export {
|
|
|
1359
1445
|
Select,
|
|
1360
1446
|
Slider,
|
|
1361
1447
|
Stack,
|
|
1448
|
+
Switch,
|
|
1362
1449
|
Text,
|
|
1363
1450
|
Textarea,
|
|
1364
1451
|
ThemeProvider2 as ThemeProvider,
|
|
1452
|
+
Tooltip,
|
|
1453
|
+
TooltipContext,
|
|
1454
|
+
TooltipTrigger,
|
|
1365
1455
|
ValidationMessage,
|
|
1366
1456
|
VisuallyHidden2 as VisuallyHidden,
|
|
1367
1457
|
useDialogButtonProps,
|