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