@marigold/components 0.7.0 → 0.8.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/dist/index.d.ts +34 -27
- package/dist/index.js +158 -137
- package/dist/index.mjs +262 -239
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -80,10 +80,11 @@ var Stack = (_a) => {
|
|
|
80
80
|
"children"
|
|
81
81
|
]);
|
|
82
82
|
return /* @__PURE__ */ React2.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
83
|
-
__baseCSS: { gap: space },
|
|
84
83
|
display: "flex",
|
|
85
84
|
flexDirection: "column",
|
|
86
|
-
alignItems: ALIGNMENT2[align]
|
|
85
|
+
alignItems: ALIGNMENT2[align],
|
|
86
|
+
p: "0",
|
|
87
|
+
css: { gap: space }
|
|
87
88
|
}), children);
|
|
88
89
|
};
|
|
89
90
|
|
|
@@ -222,8 +223,44 @@ var Button = forwardRef((_a, ref) => {
|
|
|
222
223
|
}), children);
|
|
223
224
|
});
|
|
224
225
|
|
|
225
|
-
// src/
|
|
226
|
+
// src/Breakout/Breakout.tsx
|
|
226
227
|
import React8 from "react";
|
|
228
|
+
var useAlignment = (direction) => {
|
|
229
|
+
switch (direction) {
|
|
230
|
+
case "right":
|
|
231
|
+
return "flex-end";
|
|
232
|
+
case "bottom":
|
|
233
|
+
return "flex-end";
|
|
234
|
+
case "center":
|
|
235
|
+
return "center";
|
|
236
|
+
}
|
|
237
|
+
return "flex-start";
|
|
238
|
+
};
|
|
239
|
+
var Breakout = (_a) => {
|
|
240
|
+
var _b = _a, {
|
|
241
|
+
horizontalAlign,
|
|
242
|
+
verticalAlign,
|
|
243
|
+
children
|
|
244
|
+
} = _b, props = __objRest(_b, [
|
|
245
|
+
"horizontalAlign",
|
|
246
|
+
"verticalAlign",
|
|
247
|
+
"children"
|
|
248
|
+
]);
|
|
249
|
+
const alignItems = useAlignment(horizontalAlign);
|
|
250
|
+
const justifyContent = useAlignment(verticalAlign);
|
|
251
|
+
return /* @__PURE__ */ React8.createElement(Box, __spreadValues({
|
|
252
|
+
alignItems,
|
|
253
|
+
justifyContent,
|
|
254
|
+
width: "100%",
|
|
255
|
+
display: verticalAlign || horizontalAlign ? "flex" : "block",
|
|
256
|
+
css: {
|
|
257
|
+
gridColumn: "1 / -1"
|
|
258
|
+
}
|
|
259
|
+
}, props), children);
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
// src/Card/Card.tsx
|
|
263
|
+
import React9 from "react";
|
|
227
264
|
var Card = (_a) => {
|
|
228
265
|
var _b = _a, {
|
|
229
266
|
variant = "",
|
|
@@ -238,19 +275,45 @@ var Card = (_a) => {
|
|
|
238
275
|
"className",
|
|
239
276
|
"children"
|
|
240
277
|
]);
|
|
241
|
-
return /* @__PURE__ */
|
|
278
|
+
return /* @__PURE__ */ React9.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
242
279
|
variant: `card.${variant}`,
|
|
243
280
|
maxWidth: width,
|
|
244
281
|
className
|
|
245
|
-
}), title && /* @__PURE__ */
|
|
282
|
+
}), title && /* @__PURE__ */ React9.createElement(Box, {
|
|
246
283
|
as: "h2",
|
|
247
284
|
variant: "text.h2",
|
|
248
285
|
pb: "small"
|
|
249
286
|
}, title), children);
|
|
250
287
|
};
|
|
251
288
|
|
|
289
|
+
// src/Center/Center.tsx
|
|
290
|
+
import React10 from "react";
|
|
291
|
+
var Center = (_a) => {
|
|
292
|
+
var _b = _a, {
|
|
293
|
+
maxWidth,
|
|
294
|
+
space = "none",
|
|
295
|
+
children
|
|
296
|
+
} = _b, props = __objRest(_b, [
|
|
297
|
+
"maxWidth",
|
|
298
|
+
"space",
|
|
299
|
+
"children"
|
|
300
|
+
]);
|
|
301
|
+
return /* @__PURE__ */ React10.createElement(Box, __spreadValues({
|
|
302
|
+
css: {
|
|
303
|
+
boxSizing: "content-box",
|
|
304
|
+
display: "flex",
|
|
305
|
+
flexDirection: "column",
|
|
306
|
+
alignItems: "center",
|
|
307
|
+
justifyContent: "center",
|
|
308
|
+
marginInline: "auto",
|
|
309
|
+
maxInlineSize: maxWidth,
|
|
310
|
+
gap: space
|
|
311
|
+
}
|
|
312
|
+
}, props), children);
|
|
313
|
+
};
|
|
314
|
+
|
|
252
315
|
// src/Checkbox/Checkbox.tsx
|
|
253
|
-
import
|
|
316
|
+
import React14 from "react";
|
|
254
317
|
import { useFocusRing } from "@react-aria/focus";
|
|
255
318
|
import { VisuallyHidden } from "@react-aria/visually-hidden";
|
|
256
319
|
import { useCheckbox } from "@react-aria/checkbox";
|
|
@@ -258,7 +321,7 @@ import { useToggleState } from "@react-stately/toggle";
|
|
|
258
321
|
import { Exclamation } from "@marigold/icons";
|
|
259
322
|
|
|
260
323
|
// src/Checkbox/CheckboxIcon.tsx
|
|
261
|
-
import
|
|
324
|
+
import React11 from "react";
|
|
262
325
|
import { conditional, SVG } from "@marigold/system";
|
|
263
326
|
var CheckboxIcon = ({
|
|
264
327
|
variant = "",
|
|
@@ -273,13 +336,13 @@ var CheckboxIcon = ({
|
|
|
273
336
|
checked,
|
|
274
337
|
error
|
|
275
338
|
};
|
|
276
|
-
return /* @__PURE__ */
|
|
339
|
+
return /* @__PURE__ */ React11.createElement(SVG, {
|
|
277
340
|
width: "16",
|
|
278
341
|
height: "32",
|
|
279
342
|
viewBox: "0 0 16 32",
|
|
280
343
|
fill: "none",
|
|
281
344
|
"aria-hidden": "true"
|
|
282
|
-
}, /* @__PURE__ */
|
|
345
|
+
}, /* @__PURE__ */ React11.createElement(Box, {
|
|
283
346
|
as: "rect",
|
|
284
347
|
x: "0.5",
|
|
285
348
|
y: "8.5",
|
|
@@ -287,13 +350,13 @@ var CheckboxIcon = ({
|
|
|
287
350
|
height: "15px",
|
|
288
351
|
rx: "1.5",
|
|
289
352
|
variant: conditional(`checkbox.${variant}`, conditionalStates)
|
|
290
|
-
}), checked && indeterminated && /* @__PURE__ */
|
|
353
|
+
}), checked && indeterminated && /* @__PURE__ */ React11.createElement(Box, {
|
|
291
354
|
__baseCSS: { fill: "gray00" },
|
|
292
355
|
as: "path",
|
|
293
356
|
fillRule: "evenodd",
|
|
294
357
|
clipRule: "evenodd",
|
|
295
358
|
d: "M13.5 17.0402H2.5V15.4688H13.5V17.0402V17.0402Z"
|
|
296
|
-
}), checked && !indeterminated && /* @__PURE__ */
|
|
359
|
+
}), checked && !indeterminated && /* @__PURE__ */ React11.createElement(Box, {
|
|
297
360
|
__baseCSS: { fill: "gray00" },
|
|
298
361
|
as: "path",
|
|
299
362
|
fillRule: "evenodd",
|
|
@@ -303,7 +366,7 @@ var CheckboxIcon = ({
|
|
|
303
366
|
};
|
|
304
367
|
|
|
305
368
|
// src/Label/Label.tsx
|
|
306
|
-
import
|
|
369
|
+
import React12 from "react";
|
|
307
370
|
import { Required } from "@marigold/icons";
|
|
308
371
|
var LabelBase = (_a) => {
|
|
309
372
|
var _b = _a, {
|
|
@@ -317,7 +380,7 @@ var LabelBase = (_a) => {
|
|
|
317
380
|
"color",
|
|
318
381
|
"children"
|
|
319
382
|
]);
|
|
320
|
-
return /* @__PURE__ */
|
|
383
|
+
return /* @__PURE__ */ React12.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
321
384
|
as: "label",
|
|
322
385
|
__baseCSS: { color },
|
|
323
386
|
variant: `label.${variant}`
|
|
@@ -331,18 +394,18 @@ var Label = (_a) => {
|
|
|
331
394
|
"required",
|
|
332
395
|
"children"
|
|
333
396
|
]);
|
|
334
|
-
return required ? /* @__PURE__ */
|
|
397
|
+
return required ? /* @__PURE__ */ React12.createElement(Box, {
|
|
335
398
|
as: "span",
|
|
336
399
|
display: "inline-flex",
|
|
337
400
|
alignItems: "center"
|
|
338
|
-
}, /* @__PURE__ */
|
|
401
|
+
}, /* @__PURE__ */ React12.createElement(LabelBase, __spreadValues({}, props), children), required && /* @__PURE__ */ React12.createElement(Required, {
|
|
339
402
|
size: 16,
|
|
340
403
|
fill: "error"
|
|
341
|
-
})) : /* @__PURE__ */
|
|
404
|
+
})) : /* @__PURE__ */ React12.createElement(LabelBase, __spreadValues({}, props), children);
|
|
342
405
|
};
|
|
343
406
|
|
|
344
407
|
// src/ValidationMessage/ValidationMessage.tsx
|
|
345
|
-
import
|
|
408
|
+
import React13 from "react";
|
|
346
409
|
var ValidationMessage = (_a) => {
|
|
347
410
|
var _b = _a, {
|
|
348
411
|
variant = "error",
|
|
@@ -353,7 +416,7 @@ var ValidationMessage = (_a) => {
|
|
|
353
416
|
"children",
|
|
354
417
|
"className"
|
|
355
418
|
]);
|
|
356
|
-
return /* @__PURE__ */
|
|
419
|
+
return /* @__PURE__ */ React13.createElement(Box, __spreadValues({
|
|
357
420
|
as: "span",
|
|
358
421
|
display: "flex",
|
|
359
422
|
alignItems: "center",
|
|
@@ -372,15 +435,15 @@ var CheckboxInput = (_a) => {
|
|
|
372
435
|
"indeterminated"
|
|
373
436
|
]);
|
|
374
437
|
const state = useToggleState(props);
|
|
375
|
-
const ref =
|
|
438
|
+
const ref = React14.useRef(null);
|
|
376
439
|
const { inputProps } = useCheckbox(props, state, ref);
|
|
377
440
|
const { focusProps } = useFocusRing();
|
|
378
441
|
const _a2 = props, { children } = _a2, restProps = __objRest(_a2, ["children"]);
|
|
379
|
-
return /* @__PURE__ */
|
|
442
|
+
return /* @__PURE__ */ React14.createElement(Box, {
|
|
380
443
|
pr: "xsmall"
|
|
381
|
-
}, /* @__PURE__ */
|
|
444
|
+
}, /* @__PURE__ */ React14.createElement(VisuallyHidden, null, /* @__PURE__ */ React14.createElement("input", __spreadValues(__spreadProps(__spreadValues(__spreadValues({}, inputProps), focusProps), {
|
|
382
445
|
ref
|
|
383
|
-
}), restProps))), /* @__PURE__ */
|
|
446
|
+
}), restProps))), /* @__PURE__ */ React14.createElement(CheckboxIcon, {
|
|
384
447
|
checked: props.checked,
|
|
385
448
|
variant: props.variant,
|
|
386
449
|
disabled: props.disabled,
|
|
@@ -398,7 +461,7 @@ var Checkbox = (_a) => {
|
|
|
398
461
|
"labelVariant",
|
|
399
462
|
"errorMessage"
|
|
400
463
|
]);
|
|
401
|
-
return /* @__PURE__ */
|
|
464
|
+
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(Box, {
|
|
402
465
|
as: Label,
|
|
403
466
|
__baseCSS: {
|
|
404
467
|
":hover": { cursor: props.disabled ? "not-allowed" : "pointer" }
|
|
@@ -407,118 +470,58 @@ var Checkbox = (_a) => {
|
|
|
407
470
|
required,
|
|
408
471
|
variant: `label.${labelVariant}`,
|
|
409
472
|
color: props.disabled ? "disabled" : "text"
|
|
410
|
-
}, /* @__PURE__ */
|
|
473
|
+
}, /* @__PURE__ */ React14.createElement(CheckboxInput, __spreadValues({
|
|
411
474
|
error: props.error
|
|
412
|
-
}, props)), props.children), props.error && errorMessage && /* @__PURE__ */
|
|
475
|
+
}, props)), props.children), props.error && errorMessage && /* @__PURE__ */ React14.createElement(ValidationMessage, null, /* @__PURE__ */ React14.createElement(Exclamation, {
|
|
413
476
|
size: 16
|
|
414
477
|
}), errorMessage));
|
|
415
478
|
};
|
|
416
479
|
|
|
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) => {
|
|
426
|
-
var _b = _a, {
|
|
427
|
-
width = 12,
|
|
428
|
-
children
|
|
429
|
-
} = _b, props = __objRest(_b, [
|
|
430
|
-
"width",
|
|
431
|
-
"children"
|
|
432
|
-
]);
|
|
433
|
-
return /* @__PURE__ */ React13.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
434
|
-
width: transform(width)
|
|
435
|
-
}), children);
|
|
436
|
-
};
|
|
437
|
-
|
|
438
480
|
// src/Columns/Columns.tsx
|
|
439
|
-
import
|
|
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
|
-
}
|
|
460
|
-
}
|
|
461
|
-
return acc;
|
|
462
|
-
}, []);
|
|
463
|
-
|
|
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";
|
|
475
|
-
};
|
|
481
|
+
import React15, { Children } from "react";
|
|
476
482
|
var Columns = (_a) => {
|
|
477
483
|
var _b = _a, {
|
|
478
484
|
space = "none",
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
className,
|
|
485
|
+
columns,
|
|
486
|
+
collapseAt = "40em",
|
|
482
487
|
children
|
|
483
488
|
} = _b, props = __objRest(_b, [
|
|
484
489
|
"space",
|
|
485
|
-
"
|
|
486
|
-
"
|
|
487
|
-
"className",
|
|
490
|
+
"columns",
|
|
491
|
+
"collapseAt",
|
|
488
492
|
"children"
|
|
489
493
|
]);
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
const
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
m: `${-spaceValue / 2}px`,
|
|
494
|
+
if (Children.count(children) !== columns.length) {
|
|
495
|
+
throw new Error(`Columns: expected ${columns.length} children, got ${Children.count(children)}`);
|
|
496
|
+
}
|
|
497
|
+
const getColumnWidths = columns.map((column, index) => {
|
|
498
|
+
return {
|
|
499
|
+
[`> :nth-of-type(${index + 1})`]: {
|
|
500
|
+
flexGrow: column
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
});
|
|
504
|
+
return /* @__PURE__ */ React15.createElement(Box, __spreadValues({
|
|
502
505
|
display: "flex",
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
},
|
|
510
|
-
}))
|
|
506
|
+
css: Object.assign({
|
|
507
|
+
flexWrap: "wrap",
|
|
508
|
+
gap: space,
|
|
509
|
+
"> *": {
|
|
510
|
+
flexBasis: `calc(( ${collapseAt} - 100%) * 999)`
|
|
511
|
+
}
|
|
512
|
+
}, ...getColumnWidths)
|
|
513
|
+
}, props), children);
|
|
511
514
|
};
|
|
512
515
|
|
|
513
516
|
// src/Dialog/Dialog.tsx
|
|
514
|
-
import
|
|
517
|
+
import React18 from "react";
|
|
515
518
|
import { useOverlayTriggerState } from "@react-stately/overlays";
|
|
516
519
|
import { OverlayContainer } from "@react-aria/overlays";
|
|
517
520
|
import { useButton as useButton2 } from "@react-aria/button";
|
|
518
521
|
import { Close } from "@marigold/icons";
|
|
519
522
|
|
|
520
523
|
// src/Text/Text.tsx
|
|
521
|
-
import
|
|
524
|
+
import React16, { forwardRef as forwardRef2 } from "react";
|
|
522
525
|
var Text = forwardRef2((_a, ref) => {
|
|
523
526
|
var _b = _a, {
|
|
524
527
|
as = "span",
|
|
@@ -541,7 +544,7 @@ var Text = forwardRef2((_a, ref) => {
|
|
|
541
544
|
"outline",
|
|
542
545
|
"userSelect"
|
|
543
546
|
]);
|
|
544
|
-
return /* @__PURE__ */
|
|
547
|
+
return /* @__PURE__ */ React16.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
545
548
|
as,
|
|
546
549
|
variant: `text.${variant}`,
|
|
547
550
|
css: {
|
|
@@ -557,7 +560,7 @@ var Text = forwardRef2((_a, ref) => {
|
|
|
557
560
|
});
|
|
558
561
|
|
|
559
562
|
// src/Dialog/ModalDialog.tsx
|
|
560
|
-
import
|
|
563
|
+
import React17 from "react";
|
|
561
564
|
import {
|
|
562
565
|
useOverlay,
|
|
563
566
|
usePreventScroll,
|
|
@@ -576,12 +579,12 @@ var ModalDialog = (_a) => {
|
|
|
576
579
|
"children"
|
|
577
580
|
]);
|
|
578
581
|
const _a2 = props, { isDismissable, isOpen, onClose } = _a2, restProps = __objRest(_a2, ["isDismissable", "isOpen", "onClose"]);
|
|
579
|
-
const ref =
|
|
582
|
+
const ref = React17.useRef();
|
|
580
583
|
const { overlayProps, underlayProps } = useOverlay({ isDismissable, isOpen, onClose }, ref);
|
|
581
584
|
usePreventScroll();
|
|
582
585
|
const { modalProps } = useModal();
|
|
583
586
|
const { dialogProps } = useDialog(props, ref);
|
|
584
|
-
return /* @__PURE__ */
|
|
587
|
+
return /* @__PURE__ */ React17.createElement(Box, __spreadValues({
|
|
585
588
|
__baseCSS: {
|
|
586
589
|
display: "grid",
|
|
587
590
|
placeItems: "center",
|
|
@@ -593,11 +596,11 @@ var ModalDialog = (_a) => {
|
|
|
593
596
|
right: 0
|
|
594
597
|
},
|
|
595
598
|
variant: `dialog.${backdropVariant}`
|
|
596
|
-
}, underlayProps), /* @__PURE__ */
|
|
599
|
+
}, underlayProps), /* @__PURE__ */ React17.createElement(FocusScope, {
|
|
597
600
|
contain: true,
|
|
598
601
|
restoreFocus: true,
|
|
599
602
|
autoFocus: true
|
|
600
|
-
}, /* @__PURE__ */
|
|
603
|
+
}, /* @__PURE__ */ React17.createElement(Box, __spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, overlayProps), dialogProps), modalProps), {
|
|
601
604
|
ref,
|
|
602
605
|
variant: variant ? `dialog.${variant}` : `dialog`
|
|
603
606
|
}), restProps), children)));
|
|
@@ -622,17 +625,17 @@ var Dialog = (_a) => {
|
|
|
622
625
|
"title",
|
|
623
626
|
"variant"
|
|
624
627
|
]);
|
|
625
|
-
const closeButtonRef =
|
|
628
|
+
const closeButtonRef = React18.useRef();
|
|
626
629
|
const { buttonProps: closeButtonProps } = useButton2({
|
|
627
630
|
onPress: () => close()
|
|
628
631
|
}, closeButtonRef);
|
|
629
|
-
return /* @__PURE__ */
|
|
632
|
+
return /* @__PURE__ */ React18.createElement(OverlayContainer, null, /* @__PURE__ */ React18.createElement(ModalDialog, __spreadValues({
|
|
630
633
|
variant,
|
|
631
634
|
backdropVariant,
|
|
632
635
|
isOpen,
|
|
633
636
|
onClose: close,
|
|
634
637
|
isDismissable: true
|
|
635
|
-
}, props), /* @__PURE__ */
|
|
638
|
+
}, props), /* @__PURE__ */ React18.createElement(Box, {
|
|
636
639
|
__baseCSS: {
|
|
637
640
|
display: "flex",
|
|
638
641
|
justifyContent: "space-between",
|
|
@@ -641,12 +644,12 @@ var Dialog = (_a) => {
|
|
|
641
644
|
pb: "large"
|
|
642
645
|
},
|
|
643
646
|
className
|
|
644
|
-
}, /* @__PURE__ */
|
|
647
|
+
}, /* @__PURE__ */ React18.createElement(Box, {
|
|
645
648
|
pt: "medium"
|
|
646
|
-
}, title && /* @__PURE__ */
|
|
649
|
+
}, title && /* @__PURE__ */ React18.createElement(Text, {
|
|
647
650
|
as: "h4",
|
|
648
651
|
variant: "headline4"
|
|
649
|
-
}, title), children), /* @__PURE__ */
|
|
652
|
+
}, title), children), /* @__PURE__ */ React18.createElement(Box, {
|
|
650
653
|
__baseCSS: {
|
|
651
654
|
display: "flex",
|
|
652
655
|
justifyContent: "flex-end",
|
|
@@ -654,7 +657,7 @@ var Dialog = (_a) => {
|
|
|
654
657
|
paddingTop: "xsmall",
|
|
655
658
|
paddingX: "xsmall"
|
|
656
659
|
}
|
|
657
|
-
}, /* @__PURE__ */
|
|
660
|
+
}, /* @__PURE__ */ React18.createElement(Box, __spreadProps(__spreadValues({
|
|
658
661
|
as: Button,
|
|
659
662
|
__baseCSS: {
|
|
660
663
|
color: "text",
|
|
@@ -672,13 +675,13 @@ var Dialog = (_a) => {
|
|
|
672
675
|
}
|
|
673
676
|
}, closeButtonProps), {
|
|
674
677
|
ref: closeButtonRef
|
|
675
|
-
}), /* @__PURE__ */
|
|
678
|
+
}), /* @__PURE__ */ React18.createElement(Close, {
|
|
676
679
|
size: 16
|
|
677
680
|
}))))));
|
|
678
681
|
};
|
|
679
682
|
var useDialogButtonProps = () => {
|
|
680
683
|
const state = useOverlayTriggerState({});
|
|
681
|
-
const openButtonRef =
|
|
684
|
+
const openButtonRef = React18.useRef();
|
|
682
685
|
const { buttonProps: openButtonProps } = useButton2({
|
|
683
686
|
onPress: () => state.open()
|
|
684
687
|
}, openButtonRef);
|
|
@@ -690,19 +693,19 @@ var useDialogButtonProps = () => {
|
|
|
690
693
|
};
|
|
691
694
|
|
|
692
695
|
// src/Divider/Divider.tsx
|
|
693
|
-
import
|
|
696
|
+
import React19 from "react";
|
|
694
697
|
import { useSeparator } from "@react-aria/separator";
|
|
695
698
|
var Divider = (_a) => {
|
|
696
699
|
var _b = _a, { variant = "" } = _b, props = __objRest(_b, ["variant"]);
|
|
697
700
|
const { separatorProps } = useSeparator(props);
|
|
698
|
-
return /* @__PURE__ */
|
|
701
|
+
return /* @__PURE__ */ React19.createElement(Box, __spreadValues(__spreadValues({
|
|
699
702
|
__baseCSS: { width: "100%", height: "1px", m: "none", bg: "text" },
|
|
700
703
|
variant: `divider.${variant}`
|
|
701
704
|
}, props), separatorProps));
|
|
702
705
|
};
|
|
703
706
|
|
|
704
707
|
// src/Field/Field.tsx
|
|
705
|
-
import
|
|
708
|
+
import React20, { useRef } from "react";
|
|
706
709
|
import { useTextField } from "@react-aria/textfield";
|
|
707
710
|
import { Exclamation as Exclamation2 } from "@marigold/icons";
|
|
708
711
|
var Field = (_a) => {
|
|
@@ -725,18 +728,18 @@ var Field = (_a) => {
|
|
|
725
728
|
]);
|
|
726
729
|
const ref = useRef(null);
|
|
727
730
|
const { labelProps, inputProps, errorMessageProps } = useTextField(props, ref);
|
|
728
|
-
return /* @__PURE__ */
|
|
731
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(Label, __spreadValues({
|
|
729
732
|
variant: labelVariant,
|
|
730
733
|
htmlFor,
|
|
731
734
|
required
|
|
732
|
-
}, labelProps), props.label), /* @__PURE__ */
|
|
735
|
+
}, labelProps), props.label), /* @__PURE__ */ React20.createElement(Box, __spreadValues(__spreadProps(__spreadValues({
|
|
733
736
|
as: "input",
|
|
734
737
|
type,
|
|
735
738
|
id: htmlFor,
|
|
736
739
|
variant: `input.${variant}`
|
|
737
740
|
}, inputProps), {
|
|
738
741
|
ref
|
|
739
|
-
}), props)), error && errorMessage && /* @__PURE__ */
|
|
742
|
+
}), props)), error && errorMessage && /* @__PURE__ */ React20.createElement(ValidationMessage, __spreadValues({}, errorMessageProps), /* @__PURE__ */ React20.createElement(Exclamation2, {
|
|
740
743
|
size: 16
|
|
741
744
|
}), errorMessage));
|
|
742
745
|
};
|
|
@@ -745,26 +748,27 @@ var Field = (_a) => {
|
|
|
745
748
|
import { VisuallyHidden as VisuallyHidden2 } from "@react-aria/visually-hidden";
|
|
746
749
|
|
|
747
750
|
// src/Image/Image.tsx
|
|
748
|
-
import
|
|
751
|
+
import React21 from "react";
|
|
749
752
|
var Image = (_a) => {
|
|
750
753
|
var _b = _a, {
|
|
751
754
|
variant = "fullWidth"
|
|
752
755
|
} = _b, props = __objRest(_b, [
|
|
753
756
|
"variant"
|
|
754
757
|
]);
|
|
755
|
-
return /* @__PURE__ */
|
|
758
|
+
return /* @__PURE__ */ React21.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
756
759
|
as: "img",
|
|
757
760
|
variant: `image.${variant}`
|
|
758
761
|
}));
|
|
759
762
|
};
|
|
760
763
|
|
|
761
764
|
// src/Link/Link.tsx
|
|
762
|
-
import
|
|
765
|
+
import React22, { useRef as useRef2 } from "react";
|
|
763
766
|
import { useLink } from "@react-aria/link";
|
|
767
|
+
import { conditional as conditional2 } from "@marigold/system";
|
|
764
768
|
var Link = (_a) => {
|
|
765
769
|
var _b = _a, {
|
|
766
770
|
as = "a",
|
|
767
|
-
variant = "
|
|
771
|
+
variant = "",
|
|
768
772
|
children,
|
|
769
773
|
disabled
|
|
770
774
|
} = _b, props = __objRest(_b, [
|
|
@@ -773,20 +777,21 @@ var Link = (_a) => {
|
|
|
773
777
|
"children",
|
|
774
778
|
"disabled"
|
|
775
779
|
]);
|
|
776
|
-
const ref = useRef2();
|
|
780
|
+
const ref = useRef2(null);
|
|
777
781
|
const { linkProps } = useLink(__spreadProps(__spreadValues({}, props), {
|
|
778
782
|
elementType: typeof as === "string" ? as : "span",
|
|
779
783
|
isDisabled: disabled
|
|
780
784
|
}), ref);
|
|
781
|
-
return /* @__PURE__ */
|
|
785
|
+
return /* @__PURE__ */ React22.createElement(Box, __spreadValues(__spreadValues({
|
|
782
786
|
as,
|
|
783
|
-
variant,
|
|
787
|
+
variant: conditional2(`link.${variant}`, { disabled }),
|
|
788
|
+
css: { cursor: disabled ? "default" : "pointer" },
|
|
784
789
|
ref
|
|
785
|
-
}), children);
|
|
790
|
+
}, props), linkProps), children);
|
|
786
791
|
};
|
|
787
792
|
|
|
788
793
|
// src/Menu/Menu.tsx
|
|
789
|
-
import
|
|
794
|
+
import React23 from "react";
|
|
790
795
|
var Menu = (_a) => {
|
|
791
796
|
var _b = _a, {
|
|
792
797
|
variant = "default",
|
|
@@ -801,12 +806,12 @@ var Menu = (_a) => {
|
|
|
801
806
|
"show",
|
|
802
807
|
"children"
|
|
803
808
|
]);
|
|
804
|
-
return /* @__PURE__ */
|
|
809
|
+
return /* @__PURE__ */ React23.createElement(Box, __spreadValues({
|
|
805
810
|
variant: `menu.${variant}`
|
|
806
|
-
}, props), /* @__PURE__ */
|
|
811
|
+
}, props), /* @__PURE__ */ React23.createElement(Button, {
|
|
807
812
|
onClick,
|
|
808
813
|
variant: "menu"
|
|
809
|
-
}, label), show ? /* @__PURE__ */
|
|
814
|
+
}, label), show ? /* @__PURE__ */ React23.createElement(Box, {
|
|
810
815
|
display: "block",
|
|
811
816
|
position: "absolute",
|
|
812
817
|
minWidth: "120px",
|
|
@@ -815,7 +820,7 @@ var Menu = (_a) => {
|
|
|
815
820
|
};
|
|
816
821
|
|
|
817
822
|
// src/MenuItem/MenuItem.tsx
|
|
818
|
-
import
|
|
823
|
+
import React24 from "react";
|
|
819
824
|
var MenuItem = (_a) => {
|
|
820
825
|
var _b = _a, {
|
|
821
826
|
variant = "default",
|
|
@@ -824,15 +829,15 @@ var MenuItem = (_a) => {
|
|
|
824
829
|
"variant",
|
|
825
830
|
"children"
|
|
826
831
|
]);
|
|
827
|
-
return /* @__PURE__ */
|
|
832
|
+
return /* @__PURE__ */ React24.createElement(Box, {
|
|
828
833
|
variant: `menuItem.${variant}`
|
|
829
|
-
}, /* @__PURE__ */
|
|
834
|
+
}, /* @__PURE__ */ React24.createElement(Link, __spreadValues({
|
|
830
835
|
variant: "menuItemLink"
|
|
831
836
|
}, props), children));
|
|
832
837
|
};
|
|
833
838
|
|
|
834
839
|
// src/Message/Message.tsx
|
|
835
|
-
import
|
|
840
|
+
import React25 from "react";
|
|
836
841
|
import { Exclamation as Exclamation3, Info, Notification } from "@marigold/icons";
|
|
837
842
|
var Message = (_a) => {
|
|
838
843
|
var _b = _a, {
|
|
@@ -846,62 +851,62 @@ var Message = (_a) => {
|
|
|
846
851
|
"className",
|
|
847
852
|
"children"
|
|
848
853
|
]);
|
|
849
|
-
var icon = /* @__PURE__ */
|
|
854
|
+
var icon = /* @__PURE__ */ React25.createElement(Info, null);
|
|
850
855
|
if (variant === "warning") {
|
|
851
|
-
icon = /* @__PURE__ */
|
|
856
|
+
icon = /* @__PURE__ */ React25.createElement(Notification, null);
|
|
852
857
|
}
|
|
853
858
|
if (variant === "error") {
|
|
854
|
-
icon = /* @__PURE__ */
|
|
859
|
+
icon = /* @__PURE__ */ React25.createElement(Exclamation3, null);
|
|
855
860
|
}
|
|
856
|
-
return /* @__PURE__ */
|
|
861
|
+
return /* @__PURE__ */ React25.createElement(Box, __spreadValues({
|
|
857
862
|
display: "inline-block",
|
|
858
863
|
variant: `message.${variant}`,
|
|
859
864
|
className
|
|
860
|
-
}, props), /* @__PURE__ */
|
|
865
|
+
}, props), /* @__PURE__ */ React25.createElement(Box, {
|
|
861
866
|
display: "flex",
|
|
862
867
|
alignItems: "center",
|
|
863
868
|
variant: "message.title"
|
|
864
|
-
}, icon, /* @__PURE__ */
|
|
869
|
+
}, icon, /* @__PURE__ */ React25.createElement(Text, {
|
|
865
870
|
as: "h4",
|
|
866
871
|
variant: "headline4"
|
|
867
|
-
}, messageTitle)), /* @__PURE__ */
|
|
872
|
+
}, messageTitle)), /* @__PURE__ */ React25.createElement(Box, {
|
|
868
873
|
css: { color: "black" }
|
|
869
874
|
}, children));
|
|
870
875
|
};
|
|
871
876
|
|
|
872
877
|
// src/Provider/index.ts
|
|
873
|
-
import { useTheme as
|
|
878
|
+
import { useTheme as useTheme2, ThemeProvider as ThemeProvider2 } from "@marigold/system";
|
|
874
879
|
import { SSRProvider } from "@react-aria/ssr";
|
|
875
880
|
|
|
876
881
|
// src/Provider/MarigoldProvider.tsx
|
|
877
|
-
import
|
|
882
|
+
import React26 from "react";
|
|
878
883
|
import { OverlayProvider } from "@react-aria/overlays";
|
|
879
884
|
import {
|
|
880
885
|
Global,
|
|
881
886
|
ThemeProvider,
|
|
882
|
-
useTheme
|
|
887
|
+
useTheme,
|
|
883
888
|
__defaultTheme
|
|
884
889
|
} from "@marigold/system";
|
|
885
890
|
function MarigoldProvider({
|
|
886
891
|
theme,
|
|
887
892
|
children
|
|
888
893
|
}) {
|
|
889
|
-
const outer =
|
|
894
|
+
const outer = useTheme();
|
|
890
895
|
const isTopLevel = outer.theme === __defaultTheme;
|
|
891
|
-
return /* @__PURE__ */
|
|
896
|
+
return /* @__PURE__ */ React26.createElement(ThemeProvider, {
|
|
892
897
|
theme
|
|
893
|
-
}, isTopLevel ? /* @__PURE__ */
|
|
898
|
+
}, isTopLevel ? /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(Global, null), /* @__PURE__ */ React26.createElement(OverlayProvider, null, children)) : children);
|
|
894
899
|
}
|
|
895
900
|
|
|
896
901
|
// src/Radio/Radio.tsx
|
|
897
|
-
import
|
|
902
|
+
import React28 from "react";
|
|
898
903
|
import { Exclamation as Exclamation4 } from "@marigold/icons";
|
|
899
904
|
import { useFocusRing as useFocusRing2 } from "@react-aria/focus";
|
|
900
905
|
import { VisuallyHidden as VisuallyHidden3 } from "@react-aria/visually-hidden";
|
|
901
906
|
|
|
902
907
|
// src/Radio/RadioIcon.tsx
|
|
903
|
-
import
|
|
904
|
-
import { conditional as
|
|
908
|
+
import React27 from "react";
|
|
909
|
+
import { conditional as conditional3, SVG as SVG2 } from "@marigold/system";
|
|
905
910
|
var RadioIcon = ({
|
|
906
911
|
variant = "",
|
|
907
912
|
checked = false,
|
|
@@ -914,19 +919,19 @@ var RadioIcon = ({
|
|
|
914
919
|
checked,
|
|
915
920
|
error
|
|
916
921
|
};
|
|
917
|
-
return /* @__PURE__ */
|
|
922
|
+
return /* @__PURE__ */ React27.createElement(SVG2, {
|
|
918
923
|
width: "16",
|
|
919
924
|
height: "32",
|
|
920
925
|
viewBox: "0 0 16 32",
|
|
921
926
|
fill: "none",
|
|
922
927
|
"aria-hidden": "true"
|
|
923
|
-
}, /* @__PURE__ */
|
|
924
|
-
variant:
|
|
928
|
+
}, /* @__PURE__ */ React27.createElement(Box, {
|
|
929
|
+
variant: conditional3(`radio.${variant}`, conditionalStates),
|
|
925
930
|
as: "circle",
|
|
926
931
|
cx: "8",
|
|
927
932
|
cy: "16",
|
|
928
933
|
r: "7.5"
|
|
929
|
-
}), checked && /* @__PURE__ */
|
|
934
|
+
}), checked && /* @__PURE__ */ React27.createElement("circle", {
|
|
930
935
|
fill: "white",
|
|
931
936
|
cx: "8",
|
|
932
937
|
cy: "16",
|
|
@@ -939,12 +944,12 @@ var RadioInput = (_a) => {
|
|
|
939
944
|
var _b = _a, { error } = _b, props = __objRest(_b, ["error"]);
|
|
940
945
|
const { focusProps } = useFocusRing2();
|
|
941
946
|
const _a2 = props, { children } = _a2, restProps = __objRest(_a2, ["children"]);
|
|
942
|
-
return /* @__PURE__ */
|
|
947
|
+
return /* @__PURE__ */ React28.createElement(Box, {
|
|
943
948
|
pr: "xsmall"
|
|
944
|
-
}, /* @__PURE__ */
|
|
949
|
+
}, /* @__PURE__ */ React28.createElement(VisuallyHidden3, null, /* @__PURE__ */ React28.createElement("input", __spreadValues(__spreadValues({
|
|
945
950
|
type: "radio",
|
|
946
951
|
disabled: props.disabled
|
|
947
|
-
}, focusProps), restProps))), /* @__PURE__ */
|
|
952
|
+
}, focusProps), restProps))), /* @__PURE__ */ React28.createElement(RadioIcon, {
|
|
948
953
|
variant: props.variant,
|
|
949
954
|
disabled: props.disabled,
|
|
950
955
|
checked: props.checked,
|
|
@@ -961,22 +966,22 @@ var Radio = (_a) => {
|
|
|
961
966
|
"labelVariant",
|
|
962
967
|
"errorMessage"
|
|
963
968
|
]);
|
|
964
|
-
return /* @__PURE__ */
|
|
969
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(Box, {
|
|
965
970
|
as: Label,
|
|
966
971
|
htmlFor: props.id,
|
|
967
972
|
required,
|
|
968
973
|
variant: `label.${labelVariant}`,
|
|
969
974
|
css: props.disabled ? { color: "disabled", ":hover": { cursor: "not-allowed" } } : { color: "text", ":hover": { cursor: "pointer" } }
|
|
970
|
-
}, /* @__PURE__ */
|
|
975
|
+
}, /* @__PURE__ */ React28.createElement(Box, __spreadValues({
|
|
971
976
|
as: RadioInput,
|
|
972
977
|
error: props.error
|
|
973
|
-
}, props)), props.children), props.error && errorMessage && /* @__PURE__ */
|
|
978
|
+
}, props)), props.children), props.error && errorMessage && /* @__PURE__ */ React28.createElement(ValidationMessage, null, /* @__PURE__ */ React28.createElement(Exclamation4, {
|
|
974
979
|
size: 16
|
|
975
980
|
}), errorMessage));
|
|
976
981
|
};
|
|
977
982
|
|
|
978
983
|
// src/Select/Select.tsx
|
|
979
|
-
import
|
|
984
|
+
import React33, { useRef as useRef5 } from "react";
|
|
980
985
|
import { useSelectState } from "@react-stately/select";
|
|
981
986
|
import { useButton as useButton3 } from "@react-aria/button";
|
|
982
987
|
import { mergeProps as mergeProps2 } from "@react-aria/utils";
|
|
@@ -987,11 +992,11 @@ import { useOverlayTrigger, useOverlayPosition } from "@react-aria/overlays";
|
|
|
987
992
|
import { ArrowDown, ArrowUp, Exclamation as Exclamation5, Required as Required2 } from "@marigold/icons";
|
|
988
993
|
|
|
989
994
|
// src/Select/ListBox.tsx
|
|
990
|
-
import
|
|
995
|
+
import React31, { useRef as useRef4 } from "react";
|
|
991
996
|
import { useListBox } from "@react-aria/listbox";
|
|
992
997
|
|
|
993
998
|
// src/Select/Option.tsx
|
|
994
|
-
import
|
|
999
|
+
import React29, { useEffect, useRef as useRef3, useState } from "react";
|
|
995
1000
|
import { useOption } from "@react-aria/listbox";
|
|
996
1001
|
var Option = ({ item, state }) => {
|
|
997
1002
|
const ref = useRef3(null);
|
|
@@ -1006,7 +1011,7 @@ var Option = ({ item, state }) => {
|
|
|
1006
1011
|
}
|
|
1007
1012
|
}
|
|
1008
1013
|
}, [state.disabledKeys, item.key]);
|
|
1009
|
-
return /* @__PURE__ */
|
|
1014
|
+
return /* @__PURE__ */ React29.createElement(Box, __spreadProps(__spreadValues({
|
|
1010
1015
|
as: "li"
|
|
1011
1016
|
}, optionProps), {
|
|
1012
1017
|
ref,
|
|
@@ -1015,26 +1020,26 @@ var Option = ({ item, state }) => {
|
|
|
1015
1020
|
};
|
|
1016
1021
|
|
|
1017
1022
|
// src/Select/ListBoxSection.tsx
|
|
1018
|
-
import
|
|
1023
|
+
import React30 from "react";
|
|
1019
1024
|
import { useListBoxSection } from "@react-aria/listbox";
|
|
1020
1025
|
var ListBoxSection = ({ section, state }) => {
|
|
1021
1026
|
const { itemProps, headingProps, groupProps } = useListBoxSection({
|
|
1022
1027
|
heading: section.rendered,
|
|
1023
1028
|
"aria-label": section["aria-label"]
|
|
1024
1029
|
});
|
|
1025
|
-
return /* @__PURE__ */
|
|
1030
|
+
return /* @__PURE__ */ React30.createElement(Box, __spreadProps(__spreadValues({
|
|
1026
1031
|
as: "li"
|
|
1027
1032
|
}, itemProps), {
|
|
1028
1033
|
css: {
|
|
1029
1034
|
cursor: "not-allowed"
|
|
1030
1035
|
}
|
|
1031
|
-
}), section.rendered && /* @__PURE__ */
|
|
1036
|
+
}), section.rendered && /* @__PURE__ */ React30.createElement(Box, __spreadProps(__spreadValues({
|
|
1032
1037
|
as: "span"
|
|
1033
1038
|
}, headingProps), {
|
|
1034
1039
|
variant: "select.section"
|
|
1035
|
-
}), section.rendered), /* @__PURE__ */
|
|
1040
|
+
}), section.rendered), /* @__PURE__ */ React30.createElement(Box, __spreadValues({
|
|
1036
1041
|
as: "ul"
|
|
1037
|
-
}, groupProps), [...section.childNodes].map((node) => /* @__PURE__ */
|
|
1042
|
+
}, groupProps), [...section.childNodes].map((node) => /* @__PURE__ */ React30.createElement(Option, {
|
|
1038
1043
|
key: node.key,
|
|
1039
1044
|
item: node,
|
|
1040
1045
|
state
|
|
@@ -1046,7 +1051,7 @@ var ListBox = (props) => {
|
|
|
1046
1051
|
const ref = useRef4(null);
|
|
1047
1052
|
const { state, error } = props;
|
|
1048
1053
|
const { listBoxProps } = useListBox(props, state, ref);
|
|
1049
|
-
return /* @__PURE__ */
|
|
1054
|
+
return /* @__PURE__ */ React31.createElement(Box, __spreadProps(__spreadValues({
|
|
1050
1055
|
as: "ul",
|
|
1051
1056
|
p: "none",
|
|
1052
1057
|
css: {
|
|
@@ -1055,11 +1060,11 @@ var ListBox = (props) => {
|
|
|
1055
1060
|
}, listBoxProps), {
|
|
1056
1061
|
variant: error ? "select.listbox.error" : "select.listbox",
|
|
1057
1062
|
ref
|
|
1058
|
-
}), [...state.collection].map((item) => item.type === "section" ? /* @__PURE__ */
|
|
1063
|
+
}), [...state.collection].map((item) => item.type === "section" ? /* @__PURE__ */ React31.createElement(ListBoxSection, {
|
|
1059
1064
|
key: item.key,
|
|
1060
1065
|
section: item,
|
|
1061
1066
|
state
|
|
1062
|
-
}) : /* @__PURE__ */
|
|
1067
|
+
}) : /* @__PURE__ */ React31.createElement(Option, {
|
|
1063
1068
|
key: item.key,
|
|
1064
1069
|
item,
|
|
1065
1070
|
state
|
|
@@ -1067,7 +1072,7 @@ var ListBox = (props) => {
|
|
|
1067
1072
|
};
|
|
1068
1073
|
|
|
1069
1074
|
// src/Select/Popover.tsx
|
|
1070
|
-
import
|
|
1075
|
+
import React32, { forwardRef as forwardRef3 } from "react";
|
|
1071
1076
|
import { FocusScope as FocusScope2 } from "@react-aria/focus";
|
|
1072
1077
|
import {
|
|
1073
1078
|
DismissButton,
|
|
@@ -1085,12 +1090,12 @@ var Popover = forwardRef3((_a, ref) => {
|
|
|
1085
1090
|
isDismissable: true
|
|
1086
1091
|
}, ref);
|
|
1087
1092
|
const { modalProps } = useModal2();
|
|
1088
|
-
return /* @__PURE__ */
|
|
1093
|
+
return /* @__PURE__ */ React32.createElement(OverlayContainer2, null, /* @__PURE__ */ React32.createElement(FocusScope2, {
|
|
1089
1094
|
restoreFocus: true
|
|
1090
|
-
}, /* @__PURE__ */
|
|
1095
|
+
}, /* @__PURE__ */ React32.createElement(Box, __spreadProps(__spreadValues({}, mergeProps(overlayProps, otherProps, modalProps)), {
|
|
1091
1096
|
className,
|
|
1092
1097
|
ref
|
|
1093
|
-
}), children, /* @__PURE__ */
|
|
1098
|
+
}), children, /* @__PURE__ */ React32.createElement(DismissButton, {
|
|
1094
1099
|
onDismiss: onClose
|
|
1095
1100
|
}))));
|
|
1096
1101
|
});
|
|
@@ -1132,44 +1137,44 @@ var Select = (_a) => {
|
|
|
1132
1137
|
const { labelProps, triggerProps, valueProps, menuProps } = useSelect(props, state, triggerRef);
|
|
1133
1138
|
const { buttonProps } = useButton3(triggerProps, triggerRef);
|
|
1134
1139
|
const { focusProps } = useFocusRing3();
|
|
1135
|
-
return /* @__PURE__ */
|
|
1140
|
+
return /* @__PURE__ */ React33.createElement(Box, {
|
|
1136
1141
|
position: "relative",
|
|
1137
1142
|
display: "inline-block",
|
|
1138
1143
|
width: width && width
|
|
1139
|
-
}, props.label && /* @__PURE__ */
|
|
1144
|
+
}, props.label && /* @__PURE__ */ React33.createElement(Box, null, /* @__PURE__ */ React33.createElement(Label, __spreadProps(__spreadValues({}, labelProps), {
|
|
1140
1145
|
htmlFor: labelProps.id,
|
|
1141
1146
|
variant: labelVariant
|
|
1142
|
-
}), required ? /* @__PURE__ */
|
|
1147
|
+
}), required ? /* @__PURE__ */ React33.createElement(Box, {
|
|
1143
1148
|
as: "span",
|
|
1144
1149
|
display: "inline-flex",
|
|
1145
1150
|
alignItems: "center"
|
|
1146
|
-
}, props.label, /* @__PURE__ */
|
|
1151
|
+
}, props.label, /* @__PURE__ */ React33.createElement(Required2, {
|
|
1147
1152
|
size: 16,
|
|
1148
1153
|
fill: "error"
|
|
1149
|
-
})) : props.label)), /* @__PURE__ */
|
|
1154
|
+
})) : props.label)), /* @__PURE__ */ React33.createElement(HiddenSelect, {
|
|
1150
1155
|
state,
|
|
1151
1156
|
triggerRef,
|
|
1152
1157
|
label: props.label,
|
|
1153
1158
|
name: props.name,
|
|
1154
1159
|
isDisabled: disabled
|
|
1155
|
-
}), /* @__PURE__ */
|
|
1160
|
+
}), /* @__PURE__ */ React33.createElement(Box, __spreadProps(__spreadValues({
|
|
1156
1161
|
as: "button"
|
|
1157
1162
|
}, mergeProps2(buttonProps, focusProps)), {
|
|
1158
1163
|
ref: triggerRef,
|
|
1159
1164
|
variant: error && state.isOpen && !disabled ? "button.select.errorOpened" : error ? "button.select.error" : state.isOpen && !disabled ? "button.select.open" : "button.select",
|
|
1160
1165
|
disabled,
|
|
1161
1166
|
className
|
|
1162
|
-
}), /* @__PURE__ */
|
|
1167
|
+
}), /* @__PURE__ */ React33.createElement(Box, __spreadProps(__spreadValues({
|
|
1163
1168
|
as: "span"
|
|
1164
1169
|
}, valueProps), {
|
|
1165
1170
|
variant: disabled ? "select.disabled" : "select"
|
|
1166
|
-
}), state.selectedItem ? state.selectedItem.rendered : placeholder), state.isOpen && !disabled ? /* @__PURE__ */
|
|
1171
|
+
}), state.selectedItem ? state.selectedItem.rendered : placeholder), state.isOpen && !disabled ? /* @__PURE__ */ React33.createElement(ArrowUp, {
|
|
1167
1172
|
size: 16,
|
|
1168
1173
|
fill: "text"
|
|
1169
|
-
}) : /* @__PURE__ */
|
|
1174
|
+
}) : /* @__PURE__ */ React33.createElement(ArrowDown, {
|
|
1170
1175
|
size: 16,
|
|
1171
1176
|
fill: disabled ? "disabled" : "text"
|
|
1172
|
-
})), state.isOpen && !disabled && /* @__PURE__ */
|
|
1177
|
+
})), state.isOpen && !disabled && /* @__PURE__ */ React33.createElement(Box, __spreadProps(__spreadValues(__spreadValues({
|
|
1173
1178
|
as: Popover
|
|
1174
1179
|
}, overlayProps), positionProps), {
|
|
1175
1180
|
css: {
|
|
@@ -1178,26 +1183,26 @@ var Select = (_a) => {
|
|
|
1178
1183
|
ref: overlayRef,
|
|
1179
1184
|
isOpen: state.isOpen,
|
|
1180
1185
|
onClose: state.close
|
|
1181
|
-
}), /* @__PURE__ */
|
|
1186
|
+
}), /* @__PURE__ */ React33.createElement(ListBox, __spreadProps(__spreadValues({
|
|
1182
1187
|
error
|
|
1183
1188
|
}, menuProps), {
|
|
1184
1189
|
state
|
|
1185
|
-
}))), error && errorMessage && /* @__PURE__ */
|
|
1190
|
+
}))), error && errorMessage && /* @__PURE__ */ React33.createElement(Box, {
|
|
1186
1191
|
as: "span",
|
|
1187
1192
|
display: "inline-flex",
|
|
1188
1193
|
alignItems: "center"
|
|
1189
|
-
}, /* @__PURE__ */
|
|
1194
|
+
}, /* @__PURE__ */ React33.createElement(Box, {
|
|
1190
1195
|
as: Exclamation5,
|
|
1191
1196
|
size: 16,
|
|
1192
1197
|
css: { color: "error" }
|
|
1193
|
-
}), /* @__PURE__ */
|
|
1198
|
+
}), /* @__PURE__ */ React33.createElement(ValidationMessage, null, errorMessage)));
|
|
1194
1199
|
};
|
|
1195
1200
|
|
|
1196
1201
|
// src/Slider/Slider.tsx
|
|
1197
|
-
import
|
|
1202
|
+
import React34 from "react";
|
|
1198
1203
|
var Slider = (_a) => {
|
|
1199
1204
|
var _b = _a, { variant = "" } = _b, props = __objRest(_b, ["variant"]);
|
|
1200
|
-
return /* @__PURE__ */
|
|
1205
|
+
return /* @__PURE__ */ React34.createElement(Box, __spreadValues({
|
|
1201
1206
|
as: "input",
|
|
1202
1207
|
type: "range",
|
|
1203
1208
|
css: { verticalAlign: "middle" },
|
|
@@ -1206,12 +1211,12 @@ var Slider = (_a) => {
|
|
|
1206
1211
|
};
|
|
1207
1212
|
|
|
1208
1213
|
// src/Switch/Switch.tsx
|
|
1209
|
-
import
|
|
1214
|
+
import React35, { useRef as useRef6 } from "react";
|
|
1210
1215
|
import { useFocusRing as useFocusRing4 } from "@react-aria/focus";
|
|
1211
1216
|
import { useSwitch } from "@react-aria/switch";
|
|
1212
1217
|
import { VisuallyHidden as VisuallyHidden4 } from "@react-aria/visually-hidden";
|
|
1213
1218
|
import { useToggleState as useToggleState2 } from "@react-stately/toggle";
|
|
1214
|
-
import { conditional as
|
|
1219
|
+
import { conditional as conditional4 } from "@marigold/system";
|
|
1215
1220
|
var Switch = (_a) => {
|
|
1216
1221
|
var _b = _a, {
|
|
1217
1222
|
variant = "",
|
|
@@ -1226,16 +1231,16 @@ var Switch = (_a) => {
|
|
|
1226
1231
|
const ref = useRef6();
|
|
1227
1232
|
const { inputProps } = useSwitch(props, state, ref);
|
|
1228
1233
|
const { focusProps } = useFocusRing4();
|
|
1229
|
-
return /* @__PURE__ */
|
|
1234
|
+
return /* @__PURE__ */ React35.createElement(Box, {
|
|
1230
1235
|
as: Label,
|
|
1231
1236
|
__baseCSS: {
|
|
1232
1237
|
userSelect: "none"
|
|
1233
1238
|
},
|
|
1234
1239
|
variant: labelVariant
|
|
1235
|
-
}, props.children, /* @__PURE__ */
|
|
1240
|
+
}, props.children, /* @__PURE__ */ React35.createElement(VisuallyHidden4, null, /* @__PURE__ */ React35.createElement("input", __spreadProps(__spreadValues(__spreadValues({}, inputProps), focusProps), {
|
|
1236
1241
|
disabled,
|
|
1237
1242
|
ref
|
|
1238
|
-
}))), /* @__PURE__ */
|
|
1243
|
+
}))), /* @__PURE__ */ React35.createElement(Box, {
|
|
1239
1244
|
as: "svg",
|
|
1240
1245
|
__baseCSS: {
|
|
1241
1246
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
@@ -1243,7 +1248,7 @@ var Switch = (_a) => {
|
|
|
1243
1248
|
height: 32
|
|
1244
1249
|
},
|
|
1245
1250
|
"aria-hidden": "true"
|
|
1246
|
-
}, /* @__PURE__ */
|
|
1251
|
+
}, /* @__PURE__ */ React35.createElement(Box, {
|
|
1247
1252
|
as: "rect",
|
|
1248
1253
|
__baseCSS: {
|
|
1249
1254
|
x: 4,
|
|
@@ -1252,11 +1257,11 @@ var Switch = (_a) => {
|
|
|
1252
1257
|
width: 48,
|
|
1253
1258
|
height: 24
|
|
1254
1259
|
},
|
|
1255
|
-
variant:
|
|
1260
|
+
variant: conditional4(`switch.${variant}`, {
|
|
1256
1261
|
checked: state.isSelected,
|
|
1257
1262
|
disabled
|
|
1258
1263
|
})
|
|
1259
|
-
}), /* @__PURE__ */
|
|
1264
|
+
}), /* @__PURE__ */ React35.createElement(Box, {
|
|
1260
1265
|
as: "circle",
|
|
1261
1266
|
__baseCSS: {
|
|
1262
1267
|
boxShadow: "1px 1px 4px rgba(0, 0, 0, 0.25)",
|
|
@@ -1269,7 +1274,7 @@ var Switch = (_a) => {
|
|
|
1269
1274
|
};
|
|
1270
1275
|
|
|
1271
1276
|
// src/Textarea/Textarea.tsx
|
|
1272
|
-
import
|
|
1277
|
+
import React36, { useRef as useRef7 } from "react";
|
|
1273
1278
|
import { useTextField as useTextField2 } from "@react-aria/textfield";
|
|
1274
1279
|
import { Exclamation as Exclamation6 } from "@marigold/icons";
|
|
1275
1280
|
var Textarea = (_a) => {
|
|
@@ -1292,10 +1297,10 @@ var Textarea = (_a) => {
|
|
|
1292
1297
|
const { labelProps, inputProps, errorMessageProps } = useTextField2(__spreadProps(__spreadValues({}, props), {
|
|
1293
1298
|
inputElementType: "textarea"
|
|
1294
1299
|
}), ref);
|
|
1295
|
-
return /* @__PURE__ */
|
|
1300
|
+
return /* @__PURE__ */ React36.createElement(Box, null, /* @__PURE__ */ React36.createElement(Label, __spreadValues({
|
|
1296
1301
|
htmlFor,
|
|
1297
1302
|
required
|
|
1298
|
-
}, labelProps), props.label), /* @__PURE__ */
|
|
1303
|
+
}, labelProps), props.label), /* @__PURE__ */ React36.createElement(Box, __spreadValues(__spreadProps(__spreadValues({
|
|
1299
1304
|
as: "textarea",
|
|
1300
1305
|
variant: `textarea.${variant}`,
|
|
1301
1306
|
css: {
|
|
@@ -1303,16 +1308,16 @@ var Textarea = (_a) => {
|
|
|
1303
1308
|
}
|
|
1304
1309
|
}, inputProps), {
|
|
1305
1310
|
ref
|
|
1306
|
-
}), props)), error && errorMessage && /* @__PURE__ */
|
|
1311
|
+
}), props)), error && errorMessage && /* @__PURE__ */ React36.createElement(ValidationMessage, __spreadValues({}, errorMessageProps), /* @__PURE__ */ React36.createElement(Exclamation6, {
|
|
1307
1312
|
size: 16
|
|
1308
1313
|
}), errorMessage));
|
|
1309
1314
|
};
|
|
1310
1315
|
|
|
1311
1316
|
// src/Tiles/Tiles.tsx
|
|
1312
|
-
import
|
|
1313
|
-
var Tiles =
|
|
1317
|
+
import React37 from "react";
|
|
1318
|
+
var Tiles = React37.forwardRef(function Tiles2(_a, ref) {
|
|
1314
1319
|
var _b = _a, { space = "none", itemMinWidth = "250px", children } = _b, props = __objRest(_b, ["space", "itemMinWidth", "children"]);
|
|
1315
|
-
return /* @__PURE__ */
|
|
1320
|
+
return /* @__PURE__ */ React37.createElement(Box, __spreadValues({
|
|
1316
1321
|
ref,
|
|
1317
1322
|
display: "grid",
|
|
1318
1323
|
__baseCSS: {
|
|
@@ -1323,27 +1328,27 @@ var Tiles = React36.forwardRef(function Tiles2(_a, ref) {
|
|
|
1323
1328
|
});
|
|
1324
1329
|
|
|
1325
1330
|
// src/Tooltip/Tooltip.tsx
|
|
1326
|
-
import
|
|
1331
|
+
import React39, { useContext } from "react";
|
|
1327
1332
|
import { useTooltip } from "@react-aria/tooltip";
|
|
1328
1333
|
import { mergeProps as mergeProps3 } from "@react-aria/utils";
|
|
1329
1334
|
|
|
1330
1335
|
// src/Tooltip/TooltipTrigger.tsx
|
|
1331
|
-
import
|
|
1336
|
+
import React38, { useRef as useRef8 } from "react";
|
|
1332
1337
|
import { FocusableProvider } from "@react-aria/focus";
|
|
1333
1338
|
import { useTooltipTrigger } from "@react-aria/tooltip";
|
|
1334
1339
|
import {
|
|
1335
1340
|
useTooltipTriggerState
|
|
1336
1341
|
} from "@react-stately/tooltip";
|
|
1337
|
-
var TooltipContext =
|
|
1342
|
+
var TooltipContext = React38.createContext({});
|
|
1338
1343
|
var TooltipTrigger = (_a) => {
|
|
1339
1344
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
1340
|
-
const [trigger, tooltip] =
|
|
1345
|
+
const [trigger, tooltip] = React38.Children.toArray(children);
|
|
1341
1346
|
const state = useTooltipTriggerState(props);
|
|
1342
1347
|
const tooltipTriggerRef = useRef8();
|
|
1343
1348
|
const { triggerProps, tooltipProps } = useTooltipTrigger({}, state, tooltipTriggerRef);
|
|
1344
|
-
return /* @__PURE__ */
|
|
1349
|
+
return /* @__PURE__ */ React38.createElement(FocusableProvider, __spreadProps(__spreadValues({}, triggerProps), {
|
|
1345
1350
|
ref: tooltipTriggerRef
|
|
1346
|
-
}), trigger, state.isOpen && /* @__PURE__ */
|
|
1351
|
+
}), trigger, state.isOpen && /* @__PURE__ */ React38.createElement(TooltipContext.Provider, {
|
|
1347
1352
|
value: __spreadValues({
|
|
1348
1353
|
state
|
|
1349
1354
|
}, tooltipProps)
|
|
@@ -1362,16 +1367,16 @@ var Tooltip = (_a) => {
|
|
|
1362
1367
|
const _a2 = useContext(TooltipContext), { state } = _a2, tooltipProviderProps = __objRest(_a2, ["state"]);
|
|
1363
1368
|
const mergedProps = mergeProps3(props, tooltipProviderProps);
|
|
1364
1369
|
const { tooltipProps } = useTooltip(mergedProps, state);
|
|
1365
|
-
return /* @__PURE__ */
|
|
1370
|
+
return /* @__PURE__ */ React39.createElement(Box, __spreadValues({
|
|
1366
1371
|
position: "relative"
|
|
1367
|
-
}, tooltipProps), /* @__PURE__ */
|
|
1372
|
+
}, tooltipProps), /* @__PURE__ */ React39.createElement(Box, __spreadValues({
|
|
1368
1373
|
position: "absolute",
|
|
1369
1374
|
variant: `tooltip.${variant}`
|
|
1370
1375
|
}, mergedProps), children));
|
|
1371
1376
|
};
|
|
1372
1377
|
|
|
1373
1378
|
// src/Input/Input.tsx
|
|
1374
|
-
import
|
|
1379
|
+
import React40 from "react";
|
|
1375
1380
|
var Input = (_a) => {
|
|
1376
1381
|
var _b = _a, {
|
|
1377
1382
|
variant = "",
|
|
@@ -1380,7 +1385,7 @@ var Input = (_a) => {
|
|
|
1380
1385
|
"variant",
|
|
1381
1386
|
"type"
|
|
1382
1387
|
]);
|
|
1383
|
-
return /* @__PURE__ */
|
|
1388
|
+
return /* @__PURE__ */ React40.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
1384
1389
|
as: "input",
|
|
1385
1390
|
type,
|
|
1386
1391
|
variant: `input.${variant}`
|
|
@@ -1388,7 +1393,7 @@ var Input = (_a) => {
|
|
|
1388
1393
|
};
|
|
1389
1394
|
|
|
1390
1395
|
// src/Container/Container.tsx
|
|
1391
|
-
import
|
|
1396
|
+
import React41 from "react";
|
|
1392
1397
|
import { size as tokenSize } from "@marigold/tokens";
|
|
1393
1398
|
var ALIGNMENT3 = {
|
|
1394
1399
|
left: "flex-start",
|
|
@@ -1400,18 +1405,35 @@ var Container = (_a) => {
|
|
|
1400
1405
|
contentType = "content",
|
|
1401
1406
|
size = "medium",
|
|
1402
1407
|
align = "left",
|
|
1408
|
+
alignContainer = "left",
|
|
1403
1409
|
children
|
|
1404
1410
|
} = _b, props = __objRest(_b, [
|
|
1405
1411
|
"contentType",
|
|
1406
1412
|
"size",
|
|
1407
1413
|
"align",
|
|
1414
|
+
"alignContainer",
|
|
1408
1415
|
"children"
|
|
1409
1416
|
]);
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1417
|
+
const maxWidth = tokenSize[contentType][size];
|
|
1418
|
+
let gridTemplateColumns = `${maxWidth} 1fr 1fr`;
|
|
1419
|
+
let gridColumn = 1;
|
|
1420
|
+
if (alignContainer === "center") {
|
|
1421
|
+
gridTemplateColumns = `1fr ${maxWidth} 1fr`;
|
|
1422
|
+
gridColumn = 2;
|
|
1423
|
+
}
|
|
1424
|
+
if (alignContainer === "right") {
|
|
1425
|
+
gridTemplateColumns = `1fr 1fr ${maxWidth}`;
|
|
1426
|
+
gridColumn = 3;
|
|
1427
|
+
}
|
|
1428
|
+
return /* @__PURE__ */ React41.createElement(Box, __spreadValues({
|
|
1429
|
+
display: "grid",
|
|
1430
|
+
css: {
|
|
1431
|
+
gridTemplateColumns,
|
|
1432
|
+
placeItems: ALIGNMENT3[align],
|
|
1433
|
+
"> *": {
|
|
1434
|
+
gridColumn
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1415
1437
|
}, props), children);
|
|
1416
1438
|
};
|
|
1417
1439
|
|
|
@@ -1423,10 +1445,11 @@ export {
|
|
|
1423
1445
|
Aspect,
|
|
1424
1446
|
Badge,
|
|
1425
1447
|
Box,
|
|
1448
|
+
Breakout,
|
|
1426
1449
|
Button,
|
|
1427
1450
|
Card,
|
|
1451
|
+
Center,
|
|
1428
1452
|
Checkbox,
|
|
1429
|
-
Column,
|
|
1430
1453
|
Columns,
|
|
1431
1454
|
Container,
|
|
1432
1455
|
Dialog,
|
|
@@ -1460,5 +1483,5 @@ export {
|
|
|
1460
1483
|
ValidationMessage,
|
|
1461
1484
|
VisuallyHidden2 as VisuallyHidden,
|
|
1462
1485
|
useDialogButtonProps,
|
|
1463
|
-
|
|
1486
|
+
useTheme2 as useTheme
|
|
1464
1487
|
};
|