@marigold/components 1.2.2 → 2.1.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 +37 -15
- package/dist/index.js +1316 -1025
- package/dist/index.mjs +1298 -1014
- package/package.json +48 -48
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// src/hooks.ts
|
|
2
|
+
import { useAsyncList, useListData } from "@react-stately/data";
|
|
3
|
+
|
|
1
4
|
// src/Aside/Aside.tsx
|
|
2
5
|
import React from "react";
|
|
3
6
|
|
|
@@ -97,54 +100,77 @@ var Breakout = ({
|
|
|
97
100
|
};
|
|
98
101
|
|
|
99
102
|
// src/Button/Button.tsx
|
|
100
|
-
import React5, {
|
|
101
|
-
forwardRef,
|
|
102
|
-
useImperativeHandle,
|
|
103
|
-
useRef
|
|
104
|
-
} from "react";
|
|
103
|
+
import React5, { forwardRef } from "react";
|
|
105
104
|
import { useButton } from "@react-aria/button";
|
|
106
105
|
import { useFocusRing } from "@react-aria/focus";
|
|
107
|
-
import {
|
|
106
|
+
import { useHover } from "@react-aria/interactions";
|
|
107
|
+
import { mergeProps, useObjectRef } from "@react-aria/utils";
|
|
108
108
|
import {
|
|
109
109
|
Box as Box2,
|
|
110
110
|
useComponentStyles as useComponentStyles2,
|
|
111
111
|
useStateProps
|
|
112
112
|
} from "@marigold/system";
|
|
113
|
-
var Button = forwardRef(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
113
|
+
var Button = forwardRef(
|
|
114
|
+
({
|
|
115
|
+
as = "button",
|
|
116
|
+
children,
|
|
117
|
+
variant,
|
|
118
|
+
size,
|
|
119
|
+
disabled,
|
|
120
|
+
onClick,
|
|
121
|
+
onPress,
|
|
122
|
+
onPressStart,
|
|
123
|
+
onPressEnd,
|
|
124
|
+
onPressChange,
|
|
125
|
+
onPressUp,
|
|
126
|
+
fullWidth,
|
|
127
|
+
...props
|
|
128
|
+
}, ref) => {
|
|
129
|
+
const buttonRef = useObjectRef(ref);
|
|
130
|
+
const { hoverProps, isHovered } = useHover({ isDisabled: disabled });
|
|
131
|
+
const { isFocusVisible, focusProps } = useFocusRing({
|
|
132
|
+
autoFocus: props.autoFocus
|
|
133
|
+
});
|
|
134
|
+
const { buttonProps, isPressed } = useButton(
|
|
135
|
+
{
|
|
136
|
+
...props,
|
|
137
|
+
onClick,
|
|
138
|
+
onPress,
|
|
139
|
+
onPressStart,
|
|
140
|
+
onPressEnd,
|
|
141
|
+
onPressChange,
|
|
142
|
+
onPressUp,
|
|
143
|
+
elementType: typeof as === "string" ? as : "span",
|
|
144
|
+
isDisabled: disabled
|
|
145
|
+
},
|
|
146
|
+
buttonRef
|
|
147
|
+
);
|
|
148
|
+
const styles = useComponentStyles2("Button", { variant, size });
|
|
149
|
+
const stateProps = useStateProps({
|
|
150
|
+
active: isPressed,
|
|
151
|
+
focusVisible: isFocusVisible,
|
|
152
|
+
hover: isHovered
|
|
153
|
+
});
|
|
154
|
+
return /* @__PURE__ */ React5.createElement(Box2, {
|
|
155
|
+
...mergeProps(buttonProps, focusProps, hoverProps, props),
|
|
156
|
+
...stateProps,
|
|
157
|
+
as,
|
|
158
|
+
ref: buttonRef,
|
|
159
|
+
__baseCSS: {
|
|
160
|
+
display: "inline-flex",
|
|
161
|
+
alignItems: "center",
|
|
162
|
+
justifyContent: "center",
|
|
163
|
+
gap: "0.5ch",
|
|
164
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
165
|
+
width: fullWidth ? "100%" : void 0,
|
|
166
|
+
"&:focus": {
|
|
167
|
+
outline: 0
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
css: styles
|
|
171
|
+
}, children);
|
|
172
|
+
}
|
|
173
|
+
);
|
|
148
174
|
|
|
149
175
|
// src/Card/Card.tsx
|
|
150
176
|
import React6 from "react";
|
|
@@ -185,8 +211,8 @@ var Center = ({
|
|
|
185
211
|
import React10, { forwardRef as forwardRef2 } from "react";
|
|
186
212
|
import { useCheckbox, useCheckboxGroupItem } from "@react-aria/checkbox";
|
|
187
213
|
import { useFocusRing as useFocusRing2 } from "@react-aria/focus";
|
|
188
|
-
import { useHover } from "@react-aria/interactions";
|
|
189
|
-
import { useObjectRef } from "@react-aria/utils";
|
|
214
|
+
import { useHover as useHover2 } from "@react-aria/interactions";
|
|
215
|
+
import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
|
|
190
216
|
import { useToggleState } from "@react-stately/toggle";
|
|
191
217
|
import {
|
|
192
218
|
Box as Box6,
|
|
@@ -231,7 +257,9 @@ var Label = ({
|
|
|
231
257
|
};
|
|
232
258
|
|
|
233
259
|
// src/Checkbox/CheckboxGroup.tsx
|
|
234
|
-
var CheckboxGroupContext = createContext(
|
|
260
|
+
var CheckboxGroupContext = createContext(
|
|
261
|
+
null
|
|
262
|
+
);
|
|
235
263
|
var useCheckboxGroupContext = () => useContext(CheckboxGroupContext);
|
|
236
264
|
var CheckboxGroup = ({
|
|
237
265
|
children,
|
|
@@ -252,7 +280,11 @@ var CheckboxGroup = ({
|
|
|
252
280
|
};
|
|
253
281
|
const state = useCheckboxGroupState(props);
|
|
254
282
|
const { groupProps, labelProps } = useCheckboxGroup(props, state);
|
|
255
|
-
const styles = useComponentStyles5(
|
|
283
|
+
const styles = useComponentStyles5(
|
|
284
|
+
"CheckboxGroup",
|
|
285
|
+
{ variant, size },
|
|
286
|
+
{ parts: ["container", "group"] }
|
|
287
|
+
);
|
|
256
288
|
return /* @__PURE__ */ React9.createElement(Box5, {
|
|
257
289
|
...groupProps,
|
|
258
290
|
css: styles.container
|
|
@@ -306,92 +338,107 @@ var Icon = ({ css, checked, indeterminate, ...props }) => /* @__PURE__ */ React1
|
|
|
306
338
|
css,
|
|
307
339
|
...props
|
|
308
340
|
}, indeterminate ? /* @__PURE__ */ React10.createElement(IndeterminateMark, null) : checked ? /* @__PURE__ */ React10.createElement(CheckMark, null) : null);
|
|
309
|
-
var Checkbox = forwardRef2(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
readOnly,
|
|
317
|
-
required,
|
|
318
|
-
error,
|
|
319
|
-
...props
|
|
320
|
-
}, ref) => {
|
|
321
|
-
const inputRef = useObjectRef(ref);
|
|
322
|
-
const checkboxProps = {
|
|
323
|
-
isIndeterminate: indeterminate,
|
|
324
|
-
isDisabled: disabled,
|
|
325
|
-
isReadOnly: readOnly,
|
|
326
|
-
isRequired: required,
|
|
327
|
-
validationState: error ? "invalid" : "valid"
|
|
328
|
-
};
|
|
329
|
-
const groupState = useCheckboxGroupContext();
|
|
330
|
-
const { inputProps } = groupState ? useCheckboxGroupItem({
|
|
331
|
-
...props,
|
|
332
|
-
...checkboxProps,
|
|
333
|
-
value: props.value
|
|
334
|
-
}, groupState, inputRef) : useCheckbox({
|
|
335
|
-
isSelected: checked,
|
|
336
|
-
defaultSelected: defaultChecked,
|
|
337
|
-
...checkboxProps,
|
|
338
|
-
...props
|
|
339
|
-
}, useToggleState({
|
|
340
|
-
isSelected: checked,
|
|
341
|
-
defaultSelected: defaultChecked,
|
|
342
|
-
...props
|
|
343
|
-
}), inputRef);
|
|
344
|
-
const styles = useComponentStyles6("Checkbox", {
|
|
345
|
-
variant: (groupState == null ? void 0 : groupState.variant) || variant,
|
|
346
|
-
size: (groupState == null ? void 0 : groupState.size) || size
|
|
347
|
-
}, { parts: ["container", "label", "checkbox"] });
|
|
348
|
-
const { hoverProps, isHovered } = useHover({});
|
|
349
|
-
const { isFocusVisible, focusProps } = useFocusRing2();
|
|
350
|
-
const stateProps = useStateProps2({
|
|
351
|
-
hover: isHovered,
|
|
352
|
-
focus: isFocusVisible,
|
|
353
|
-
checked: inputProps.checked,
|
|
354
|
-
disabled: inputProps.disabled,
|
|
355
|
-
error: (groupState == null ? void 0 : groupState.error) || error,
|
|
356
|
-
readOnly,
|
|
357
|
-
indeterminate
|
|
358
|
-
});
|
|
359
|
-
return /* @__PURE__ */ React10.createElement(Box6, {
|
|
360
|
-
as: "label",
|
|
361
|
-
__baseCSS: {
|
|
362
|
-
display: "flex",
|
|
363
|
-
alignItems: "center",
|
|
364
|
-
gap: "1ch",
|
|
365
|
-
position: "relative"
|
|
366
|
-
},
|
|
367
|
-
css: styles.container,
|
|
368
|
-
...hoverProps,
|
|
369
|
-
...stateProps
|
|
370
|
-
}, /* @__PURE__ */ React10.createElement(Box6, {
|
|
371
|
-
as: "input",
|
|
372
|
-
ref: inputRef,
|
|
373
|
-
css: {
|
|
374
|
-
position: "absolute",
|
|
375
|
-
width: "100%",
|
|
376
|
-
height: "100%",
|
|
377
|
-
top: 0,
|
|
378
|
-
left: 0,
|
|
379
|
-
zIndex: 1,
|
|
380
|
-
opacity: 1e-4,
|
|
381
|
-
cursor: inputProps.disabled ? "not-allowed" : "pointer"
|
|
382
|
-
},
|
|
383
|
-
...inputProps,
|
|
384
|
-
...focusProps
|
|
385
|
-
}), /* @__PURE__ */ React10.createElement(Icon, {
|
|
386
|
-
checked: inputProps.checked,
|
|
341
|
+
var Checkbox = forwardRef2(
|
|
342
|
+
({
|
|
343
|
+
size,
|
|
344
|
+
variant,
|
|
345
|
+
disabled,
|
|
346
|
+
checked,
|
|
347
|
+
defaultChecked,
|
|
387
348
|
indeterminate,
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
349
|
+
readOnly,
|
|
350
|
+
required,
|
|
351
|
+
error,
|
|
352
|
+
...props
|
|
353
|
+
}, ref) => {
|
|
354
|
+
const inputRef = useObjectRef2(ref);
|
|
355
|
+
const checkboxProps = {
|
|
356
|
+
isIndeterminate: indeterminate,
|
|
357
|
+
isDisabled: disabled,
|
|
358
|
+
isReadOnly: readOnly,
|
|
359
|
+
isRequired: required,
|
|
360
|
+
validationState: error ? "invalid" : "valid"
|
|
361
|
+
};
|
|
362
|
+
const groupState = useCheckboxGroupContext();
|
|
363
|
+
const { inputProps } = groupState ? useCheckboxGroupItem(
|
|
364
|
+
{
|
|
365
|
+
...props,
|
|
366
|
+
...checkboxProps,
|
|
367
|
+
value: props.value
|
|
368
|
+
},
|
|
369
|
+
groupState,
|
|
370
|
+
inputRef
|
|
371
|
+
) : useCheckbox(
|
|
372
|
+
{
|
|
373
|
+
isSelected: checked,
|
|
374
|
+
defaultSelected: defaultChecked,
|
|
375
|
+
...checkboxProps,
|
|
376
|
+
...props
|
|
377
|
+
},
|
|
378
|
+
useToggleState({
|
|
379
|
+
isSelected: checked,
|
|
380
|
+
defaultSelected: defaultChecked,
|
|
381
|
+
isReadOnly: readOnly,
|
|
382
|
+
...props
|
|
383
|
+
}),
|
|
384
|
+
inputRef
|
|
385
|
+
);
|
|
386
|
+
const styles = useComponentStyles6(
|
|
387
|
+
"Checkbox",
|
|
388
|
+
{
|
|
389
|
+
variant: (groupState == null ? void 0 : groupState.variant) || variant,
|
|
390
|
+
size: (groupState == null ? void 0 : groupState.size) || size
|
|
391
|
+
},
|
|
392
|
+
{ parts: ["container", "label", "checkbox"] }
|
|
393
|
+
);
|
|
394
|
+
const { hoverProps, isHovered } = useHover2({});
|
|
395
|
+
const { isFocusVisible, focusProps } = useFocusRing2();
|
|
396
|
+
const stateProps = useStateProps2({
|
|
397
|
+
hover: isHovered,
|
|
398
|
+
focus: isFocusVisible,
|
|
399
|
+
checked: inputProps.checked,
|
|
400
|
+
disabled: inputProps.disabled,
|
|
401
|
+
error: (groupState == null ? void 0 : groupState.error) || error,
|
|
402
|
+
readOnly,
|
|
403
|
+
indeterminate
|
|
404
|
+
});
|
|
405
|
+
return /* @__PURE__ */ React10.createElement(Box6, {
|
|
406
|
+
as: "label",
|
|
407
|
+
__baseCSS: {
|
|
408
|
+
display: "flex",
|
|
409
|
+
alignItems: "center",
|
|
410
|
+
gap: "1ch",
|
|
411
|
+
position: "relative"
|
|
412
|
+
},
|
|
413
|
+
css: styles.container,
|
|
414
|
+
...hoverProps,
|
|
415
|
+
...stateProps
|
|
416
|
+
}, /* @__PURE__ */ React10.createElement(Box6, {
|
|
417
|
+
as: "input",
|
|
418
|
+
ref: inputRef,
|
|
419
|
+
css: {
|
|
420
|
+
position: "absolute",
|
|
421
|
+
width: "100%",
|
|
422
|
+
height: "100%",
|
|
423
|
+
top: 0,
|
|
424
|
+
left: 0,
|
|
425
|
+
zIndex: 1,
|
|
426
|
+
opacity: 1e-4,
|
|
427
|
+
cursor: inputProps.disabled ? "not-allowed" : "pointer"
|
|
428
|
+
},
|
|
429
|
+
...inputProps,
|
|
430
|
+
...focusProps
|
|
431
|
+
}), /* @__PURE__ */ React10.createElement(Icon, {
|
|
432
|
+
checked: inputProps.checked,
|
|
433
|
+
indeterminate,
|
|
434
|
+
css: styles.checkbox,
|
|
435
|
+
...stateProps
|
|
436
|
+
}), props.children && /* @__PURE__ */ React10.createElement(Box6, {
|
|
437
|
+
css: styles.label,
|
|
438
|
+
...stateProps
|
|
439
|
+
}, props.children));
|
|
440
|
+
}
|
|
441
|
+
);
|
|
395
442
|
|
|
396
443
|
// src/Columns/Columns.tsx
|
|
397
444
|
import React11, { Children } from "react";
|
|
@@ -403,7 +450,11 @@ var Columns = ({
|
|
|
403
450
|
...props
|
|
404
451
|
}) => {
|
|
405
452
|
if (Children.count(children) !== columns.length) {
|
|
406
|
-
throw new Error(
|
|
453
|
+
throw new Error(
|
|
454
|
+
`Columns: expected ${columns.length} children, got ${Children.count(
|
|
455
|
+
children
|
|
456
|
+
)}`
|
|
457
|
+
);
|
|
407
458
|
}
|
|
408
459
|
const getColumnWidths = columns.map((column, index) => {
|
|
409
460
|
return {
|
|
@@ -414,13 +465,16 @@ var Columns = ({
|
|
|
414
465
|
});
|
|
415
466
|
return /* @__PURE__ */ React11.createElement(Box, {
|
|
416
467
|
display: "flex",
|
|
417
|
-
css: Object.assign(
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
468
|
+
css: Object.assign(
|
|
469
|
+
{
|
|
470
|
+
flexWrap: "wrap",
|
|
471
|
+
gap: space,
|
|
472
|
+
"> *": {
|
|
473
|
+
flexBasis: `calc(( ${collapseAt} - 100%) * 999)`
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
...getColumnWidths
|
|
477
|
+
),
|
|
424
478
|
...props
|
|
425
479
|
}, children);
|
|
426
480
|
};
|
|
@@ -486,7 +540,7 @@ var Content = ({
|
|
|
486
540
|
};
|
|
487
541
|
|
|
488
542
|
// src/Dialog/Dialog.tsx
|
|
489
|
-
import React21, { useRef as
|
|
543
|
+
import React21, { useRef as useRef3 } from "react";
|
|
490
544
|
import { useButton as useButton2 } from "@react-aria/button";
|
|
491
545
|
import { useDialog } from "@react-aria/dialog";
|
|
492
546
|
import {
|
|
@@ -538,7 +592,7 @@ var DialogContext = createContext2({});
|
|
|
538
592
|
var useDialogContext = () => useContext2(DialogContext);
|
|
539
593
|
|
|
540
594
|
// src/Dialog/DialogTrigger.tsx
|
|
541
|
-
import React20, { useRef as
|
|
595
|
+
import React20, { useRef as useRef2 } from "react";
|
|
542
596
|
import { PressResponder } from "@react-aria/interactions";
|
|
543
597
|
import { useOverlayTriggerState } from "@react-stately/overlays";
|
|
544
598
|
|
|
@@ -546,7 +600,7 @@ import { useOverlayTriggerState } from "@react-stately/overlays";
|
|
|
546
600
|
import React17, { forwardRef as forwardRef3 } from "react";
|
|
547
601
|
import { FocusScope } from "@react-aria/focus";
|
|
548
602
|
import { useModal, useOverlay, usePreventScroll } from "@react-aria/overlays";
|
|
549
|
-
import { mergeProps as mergeProps2, useObjectRef as
|
|
603
|
+
import { mergeProps as mergeProps2, useObjectRef as useObjectRef3 } from "@react-aria/utils";
|
|
550
604
|
|
|
551
605
|
// src/Overlay/Underlay.tsx
|
|
552
606
|
import React16 from "react";
|
|
@@ -565,38 +619,43 @@ var Underlay = ({ size, variant, ...props }) => {
|
|
|
565
619
|
};
|
|
566
620
|
|
|
567
621
|
// src/Overlay/Modal.tsx
|
|
568
|
-
var Modal = forwardRef3(
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
622
|
+
var Modal = forwardRef3(
|
|
623
|
+
({ children, open, dismissable, keyboardDismissable, onClose, ...props }, ref) => {
|
|
624
|
+
const modalRef = useObjectRef3(ref);
|
|
625
|
+
const { overlayProps, underlayProps } = useOverlay(
|
|
626
|
+
{
|
|
627
|
+
isOpen: open,
|
|
628
|
+
onClose,
|
|
629
|
+
isDismissable: dismissable,
|
|
630
|
+
isKeyboardDismissDisabled: !keyboardDismissable
|
|
631
|
+
},
|
|
632
|
+
modalRef
|
|
633
|
+
);
|
|
634
|
+
usePreventScroll();
|
|
635
|
+
const { modalProps } = useModal({});
|
|
636
|
+
return /* @__PURE__ */ React17.createElement(FocusScope, {
|
|
637
|
+
contain: true,
|
|
638
|
+
restoreFocus: true,
|
|
639
|
+
autoFocus: true
|
|
640
|
+
}, /* @__PURE__ */ React17.createElement(Underlay, {
|
|
641
|
+
...underlayProps
|
|
642
|
+
}), /* @__PURE__ */ React17.createElement("div", {
|
|
643
|
+
style: {
|
|
644
|
+
display: "flex",
|
|
645
|
+
alignItems: "center",
|
|
646
|
+
justifyContent: "center",
|
|
647
|
+
position: "fixed",
|
|
648
|
+
inset: 0,
|
|
649
|
+
zIndex: 2,
|
|
650
|
+
pointerEvents: "none"
|
|
651
|
+
},
|
|
652
|
+
ref: modalRef,
|
|
653
|
+
...mergeProps2(props, overlayProps, modalProps)
|
|
654
|
+
}, /* @__PURE__ */ React17.createElement("div", {
|
|
655
|
+
style: { pointerEvents: "auto" }
|
|
656
|
+
}, children)));
|
|
657
|
+
}
|
|
658
|
+
);
|
|
600
659
|
|
|
601
660
|
// src/Overlay/Overlay.tsx
|
|
602
661
|
import React18 from "react";
|
|
@@ -618,37 +677,42 @@ var Overlay = ({
|
|
|
618
677
|
};
|
|
619
678
|
|
|
620
679
|
// src/Overlay/Popover.tsx
|
|
621
|
-
import React19, { forwardRef as forwardRef4, useRef
|
|
680
|
+
import React19, { forwardRef as forwardRef4, useRef } from "react";
|
|
622
681
|
import { useModal as useModal2, useOverlay as useOverlay2 } from "@react-aria/overlays";
|
|
623
682
|
import { mergeProps as mergeProps3 } from "@react-aria/utils";
|
|
624
|
-
var Popover = forwardRef4(
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
minWidth = 0,
|
|
631
|
-
...props
|
|
632
|
-
}, ref) => {
|
|
633
|
-
const fallbackRef = useRef2(null);
|
|
634
|
-
const popoverRef = ref || fallbackRef;
|
|
635
|
-
const { overlayProps } = useOverlay2({
|
|
636
|
-
isOpen: open,
|
|
637
|
-
isDismissable: dismissable,
|
|
638
|
-
isKeyboardDismissDisabled: keyboardDismissDisabled,
|
|
683
|
+
var Popover = forwardRef4(
|
|
684
|
+
({
|
|
685
|
+
children,
|
|
686
|
+
open,
|
|
687
|
+
dismissable,
|
|
688
|
+
keyboardDismissDisabled,
|
|
639
689
|
shouldCloseOnBlur,
|
|
690
|
+
minWidth = 0,
|
|
640
691
|
...props
|
|
641
|
-
},
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}
|
|
692
|
+
}, ref) => {
|
|
693
|
+
const fallbackRef = useRef(null);
|
|
694
|
+
const popoverRef = ref || fallbackRef;
|
|
695
|
+
const { overlayProps } = useOverlay2(
|
|
696
|
+
{
|
|
697
|
+
isOpen: open,
|
|
698
|
+
isDismissable: dismissable,
|
|
699
|
+
isKeyboardDismissDisabled: keyboardDismissDisabled,
|
|
700
|
+
shouldCloseOnBlur,
|
|
701
|
+
...props
|
|
702
|
+
},
|
|
703
|
+
popoverRef
|
|
704
|
+
);
|
|
705
|
+
const { modalProps } = useModal2({});
|
|
706
|
+
const style = { minWidth };
|
|
707
|
+
return /* @__PURE__ */ React19.createElement(Overlay, {
|
|
708
|
+
open
|
|
709
|
+
}, /* @__PURE__ */ React19.createElement(Box, {
|
|
710
|
+
ref: popoverRef,
|
|
711
|
+
role: "presentation",
|
|
712
|
+
...mergeProps3(props, overlayProps, modalProps, style)
|
|
713
|
+
}, children));
|
|
714
|
+
}
|
|
715
|
+
);
|
|
652
716
|
|
|
653
717
|
// src/Dialog/DialogTrigger.tsx
|
|
654
718
|
var DialogTrigger = ({
|
|
@@ -657,7 +721,7 @@ var DialogTrigger = ({
|
|
|
657
721
|
keyboardDismissable = true
|
|
658
722
|
}) => {
|
|
659
723
|
const [dialogTrigger, dialog] = React20.Children.toArray(children);
|
|
660
|
-
const dialogTriggerRef =
|
|
724
|
+
const dialogTriggerRef = useRef2(null);
|
|
661
725
|
const state = useOverlayTriggerState({});
|
|
662
726
|
const ctx = { open: state.isOpen, close: state.close };
|
|
663
727
|
return /* @__PURE__ */ React20.createElement(DialogContext.Provider, {
|
|
@@ -678,11 +742,14 @@ var DialogTrigger = ({
|
|
|
678
742
|
|
|
679
743
|
// src/Dialog/Dialog.tsx
|
|
680
744
|
var CloseButton = ({ css }) => {
|
|
681
|
-
const ref =
|
|
745
|
+
const ref = useRef3(null);
|
|
682
746
|
const { close } = useDialogContext();
|
|
683
|
-
const { buttonProps } = useButton2(
|
|
684
|
-
|
|
685
|
-
|
|
747
|
+
const { buttonProps } = useButton2(
|
|
748
|
+
{
|
|
749
|
+
onPress: () => close == null ? void 0 : close()
|
|
750
|
+
},
|
|
751
|
+
ref
|
|
752
|
+
);
|
|
686
753
|
return /* @__PURE__ */ React21.createElement(Box10, {
|
|
687
754
|
css: { display: "flex", justifyContent: "flex-end" }
|
|
688
755
|
}, /* @__PURE__ */ React21.createElement(Box10, {
|
|
@@ -710,12 +777,19 @@ var CloseButton = ({ css }) => {
|
|
|
710
777
|
};
|
|
711
778
|
var addTitleProps = (children, titleProps) => {
|
|
712
779
|
const childs = React21.Children.toArray(children);
|
|
713
|
-
const titleIndex = childs.findIndex(
|
|
780
|
+
const titleIndex = childs.findIndex(
|
|
781
|
+
(child) => React21.isValidElement(child) && (child.type === Header || child.type === Headline)
|
|
782
|
+
);
|
|
714
783
|
if (titleIndex < 0) {
|
|
715
|
-
console.warn(
|
|
784
|
+
console.warn(
|
|
785
|
+
"No child in <Dialog> found that can act as title for accessibility. Please add a <Header> or <Headline> as direct child."
|
|
786
|
+
);
|
|
716
787
|
return children;
|
|
717
788
|
}
|
|
718
|
-
const titleChild = React21.cloneElement(
|
|
789
|
+
const titleChild = React21.cloneElement(
|
|
790
|
+
childs[titleIndex],
|
|
791
|
+
titleProps
|
|
792
|
+
);
|
|
719
793
|
childs.splice(titleIndex, 1, titleChild);
|
|
720
794
|
return childs;
|
|
721
795
|
};
|
|
@@ -726,10 +800,14 @@ var Dialog = ({
|
|
|
726
800
|
closeButton,
|
|
727
801
|
...props
|
|
728
802
|
}) => {
|
|
729
|
-
const ref =
|
|
803
|
+
const ref = useRef3(null);
|
|
730
804
|
const { close } = useDialogContext();
|
|
731
805
|
const { dialogProps, titleProps } = useDialog(props, ref);
|
|
732
|
-
const styles = useComponentStyles11(
|
|
806
|
+
const styles = useComponentStyles11(
|
|
807
|
+
"Dialog",
|
|
808
|
+
{ variant, size },
|
|
809
|
+
{ parts: ["container", "closeButton"] }
|
|
810
|
+
);
|
|
733
811
|
return /* @__PURE__ */ React21.createElement(Box10, {
|
|
734
812
|
__baseCSS: { bg: "#fff" },
|
|
735
813
|
css: styles.container,
|
|
@@ -770,13 +848,25 @@ var Footer = ({ children, variant, size, ...props }) => {
|
|
|
770
848
|
|
|
771
849
|
// src/Image/Image.tsx
|
|
772
850
|
import React24 from "react";
|
|
851
|
+
import { Box as Box12 } from "@marigold/system";
|
|
773
852
|
import { useComponentStyles as useComponentStyles14 } from "@marigold/system";
|
|
774
|
-
var Image = ({
|
|
775
|
-
|
|
776
|
-
|
|
853
|
+
var Image = ({
|
|
854
|
+
variant,
|
|
855
|
+
size,
|
|
856
|
+
fit,
|
|
857
|
+
position,
|
|
858
|
+
...props
|
|
859
|
+
}) => {
|
|
860
|
+
const styles = useComponentStyles14("Image", { variant, size });
|
|
861
|
+
const css = {
|
|
862
|
+
...styles,
|
|
863
|
+
objectFit: fit,
|
|
864
|
+
objectPosition: position
|
|
865
|
+
};
|
|
866
|
+
return /* @__PURE__ */ React24.createElement(Box12, {
|
|
777
867
|
...props,
|
|
778
868
|
as: "img",
|
|
779
|
-
css
|
|
869
|
+
css
|
|
780
870
|
});
|
|
781
871
|
};
|
|
782
872
|
|
|
@@ -811,75 +901,136 @@ var Inline = ({
|
|
|
811
901
|
|
|
812
902
|
// src/Input/Input.tsx
|
|
813
903
|
import React26, { forwardRef as forwardRef5 } from "react";
|
|
814
|
-
import { Box as
|
|
815
|
-
var Input = forwardRef5(
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
});
|
|
904
|
+
import { Box as Box13, useComponentStyles as useComponentStyles15 } from "@marigold/system";
|
|
905
|
+
var Input = forwardRef5(
|
|
906
|
+
({ variant, size, type = "text", ...props }, ref) => {
|
|
907
|
+
const styles = useComponentStyles15("Input", { variant, size });
|
|
908
|
+
return /* @__PURE__ */ React26.createElement(Box13, {
|
|
909
|
+
...props,
|
|
910
|
+
ref,
|
|
911
|
+
as: "input",
|
|
912
|
+
type,
|
|
913
|
+
css: styles
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
);
|
|
825
917
|
|
|
826
918
|
// src/Link/Link.tsx
|
|
827
|
-
import React27, {
|
|
919
|
+
import React27, { forwardRef as forwardRef6 } from "react";
|
|
828
920
|
import { useLink } from "@react-aria/link";
|
|
829
921
|
import { useComponentStyles as useComponentStyles16 } from "@marigold/system";
|
|
830
|
-
|
|
831
|
-
|
|
922
|
+
import { useObjectRef as useObjectRef4 } from "@react-aria/utils";
|
|
923
|
+
var Link = forwardRef6(
|
|
924
|
+
({
|
|
925
|
+
as = "a",
|
|
926
|
+
variant,
|
|
927
|
+
size,
|
|
928
|
+
children,
|
|
929
|
+
disabled,
|
|
930
|
+
onPress,
|
|
931
|
+
onPressStart,
|
|
932
|
+
...props
|
|
933
|
+
}, ref) => {
|
|
934
|
+
const linkRef = useObjectRef4(ref);
|
|
935
|
+
const { linkProps } = useLink(
|
|
936
|
+
{
|
|
937
|
+
...props,
|
|
938
|
+
elementType: typeof as === "string" ? as : "span",
|
|
939
|
+
isDisabled: disabled
|
|
940
|
+
},
|
|
941
|
+
linkRef
|
|
942
|
+
);
|
|
943
|
+
const styles = useComponentStyles16("Link", { variant, size });
|
|
944
|
+
return /* @__PURE__ */ React27.createElement(Box, {
|
|
945
|
+
as,
|
|
946
|
+
css: styles,
|
|
947
|
+
ref: linkRef,
|
|
948
|
+
...props,
|
|
949
|
+
...linkProps
|
|
950
|
+
}, children);
|
|
951
|
+
}
|
|
952
|
+
);
|
|
953
|
+
|
|
954
|
+
// src/List/List.tsx
|
|
955
|
+
import React29 from "react";
|
|
956
|
+
import {
|
|
957
|
+
Box as Box15,
|
|
958
|
+
useComponentStyles as useComponentStyles17
|
|
959
|
+
} from "@marigold/system";
|
|
960
|
+
|
|
961
|
+
// src/List/Context.ts
|
|
962
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
963
|
+
var ListContext = createContext3({});
|
|
964
|
+
var useListContext = () => useContext3(ListContext);
|
|
965
|
+
|
|
966
|
+
// src/List/ListItem.tsx
|
|
967
|
+
import React28 from "react";
|
|
968
|
+
import { Box as Box14 } from "@marigold/system";
|
|
969
|
+
var ListItem = ({ children, ...props }) => {
|
|
970
|
+
const { styles } = useListContext();
|
|
971
|
+
return /* @__PURE__ */ React28.createElement(Box14, {
|
|
972
|
+
...props,
|
|
973
|
+
as: "li",
|
|
974
|
+
css: styles
|
|
975
|
+
}, children);
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
// src/List/List.tsx
|
|
979
|
+
var List = ({
|
|
980
|
+
as = "ul",
|
|
981
|
+
children,
|
|
832
982
|
variant,
|
|
833
983
|
size,
|
|
834
|
-
children,
|
|
835
|
-
disabled,
|
|
836
984
|
...props
|
|
837
985
|
}) => {
|
|
838
|
-
const
|
|
839
|
-
|
|
986
|
+
const styles = useComponentStyles17(
|
|
987
|
+
"List",
|
|
988
|
+
{ variant, size },
|
|
989
|
+
{ parts: ["ul", "ol", "item"] }
|
|
990
|
+
);
|
|
991
|
+
return /* @__PURE__ */ React29.createElement(Box15, {
|
|
840
992
|
...props,
|
|
841
|
-
elementType: typeof as === "string" ? as : "span",
|
|
842
|
-
isDisabled: disabled
|
|
843
|
-
}, ref);
|
|
844
|
-
const styles = useComponentStyles16("Link", { variant, size });
|
|
845
|
-
return /* @__PURE__ */ React27.createElement(Box, {
|
|
846
993
|
as,
|
|
847
|
-
css: styles
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
}, children);
|
|
994
|
+
css: styles[as]
|
|
995
|
+
}, /* @__PURE__ */ React29.createElement(ListContext.Provider, {
|
|
996
|
+
value: { styles: styles.item }
|
|
997
|
+
}, children));
|
|
852
998
|
};
|
|
999
|
+
List.Item = ListItem;
|
|
853
1000
|
|
|
854
1001
|
// src/Menu/Menu.tsx
|
|
855
|
-
import
|
|
1002
|
+
import React32, { useRef as useRef6 } from "react";
|
|
856
1003
|
import { FocusScope as FocusScope2 } from "@react-aria/focus";
|
|
857
1004
|
import { useMenu } from "@react-aria/menu";
|
|
858
1005
|
import { DismissButton } from "@react-aria/overlays";
|
|
859
1006
|
import { Item } from "@react-stately/collections";
|
|
860
1007
|
import { useTreeState } from "@react-stately/tree";
|
|
861
1008
|
import {
|
|
862
|
-
Box as
|
|
863
|
-
useComponentStyles as
|
|
1009
|
+
Box as Box17,
|
|
1010
|
+
useComponentStyles as useComponentStyles18
|
|
864
1011
|
} from "@marigold/system";
|
|
865
1012
|
|
|
866
1013
|
// src/Menu/Context.ts
|
|
867
|
-
import { createContext as
|
|
868
|
-
var MenuContext =
|
|
869
|
-
var useMenuContext = () =>
|
|
1014
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
1015
|
+
var MenuContext = createContext4({});
|
|
1016
|
+
var useMenuContext = () => useContext4(MenuContext);
|
|
870
1017
|
|
|
871
1018
|
// src/Menu/MenuTrigger.tsx
|
|
872
|
-
import
|
|
1019
|
+
import React30, { useRef as useRef4 } from "react";
|
|
873
1020
|
import { useMenuTriggerState } from "@react-stately/menu";
|
|
874
1021
|
import { useMenuTrigger } from "@react-aria/menu";
|
|
875
1022
|
import { useOverlayPosition } from "@react-aria/overlays";
|
|
876
1023
|
import { PressResponder as PressResponder2 } from "@react-aria/interactions";
|
|
877
1024
|
var MenuTrigger = ({ disabled, children }) => {
|
|
878
|
-
const [menuTrigger, menu] =
|
|
879
|
-
const menuTriggerRef =
|
|
880
|
-
const overlayRef =
|
|
1025
|
+
const [menuTrigger, menu] = React30.Children.toArray(children);
|
|
1026
|
+
const menuTriggerRef = useRef4(null);
|
|
1027
|
+
const overlayRef = useRef4(null);
|
|
881
1028
|
const state = useMenuTriggerState({});
|
|
882
|
-
const { menuTriggerProps, menuProps } = useMenuTrigger(
|
|
1029
|
+
const { menuTriggerProps, menuProps } = useMenuTrigger(
|
|
1030
|
+
{ trigger: "press", isDisabled: disabled },
|
|
1031
|
+
state,
|
|
1032
|
+
menuTriggerRef
|
|
1033
|
+
);
|
|
883
1034
|
const { overlayProps: positionProps } = useOverlayPosition({
|
|
884
1035
|
targetRef: menuTriggerRef,
|
|
885
1036
|
overlayRef,
|
|
@@ -892,13 +1043,13 @@ var MenuTrigger = ({ disabled, children }) => {
|
|
|
892
1043
|
autoFocus: state.focusStrategy,
|
|
893
1044
|
triggerWidth: menuTriggerRef.current ? menuTriggerRef.current.offsetWidth : void 0
|
|
894
1045
|
};
|
|
895
|
-
return /* @__PURE__ */
|
|
1046
|
+
return /* @__PURE__ */ React30.createElement(MenuContext.Provider, {
|
|
896
1047
|
value: menuContext
|
|
897
|
-
}, /* @__PURE__ */
|
|
1048
|
+
}, /* @__PURE__ */ React30.createElement(PressResponder2, {
|
|
898
1049
|
...menuTriggerProps,
|
|
899
1050
|
ref: menuTriggerRef,
|
|
900
1051
|
isPressed: state.isOpen
|
|
901
|
-
}, menuTrigger), /* @__PURE__ */
|
|
1052
|
+
}, menuTrigger), /* @__PURE__ */ React30.createElement(Popover, {
|
|
902
1053
|
open: state.isOpen,
|
|
903
1054
|
onClose: state.close,
|
|
904
1055
|
dismissable: true,
|
|
@@ -909,24 +1060,28 @@ var MenuTrigger = ({ disabled, children }) => {
|
|
|
909
1060
|
};
|
|
910
1061
|
|
|
911
1062
|
// src/Menu/MenuItem.tsx
|
|
912
|
-
import
|
|
1063
|
+
import React31, { useRef as useRef5 } from "react";
|
|
913
1064
|
import { useFocusRing as useFocusRing3 } from "@react-aria/focus";
|
|
914
1065
|
import { useMenuItem } from "@react-aria/menu";
|
|
915
1066
|
import { mergeProps as mergeProps4 } from "@react-aria/utils";
|
|
916
|
-
import { Box as
|
|
1067
|
+
import { Box as Box16, useStateProps as useStateProps3 } from "@marigold/system";
|
|
917
1068
|
var MenuItem = ({ item, state, onAction, css }) => {
|
|
918
|
-
const ref =
|
|
1069
|
+
const ref = useRef5(null);
|
|
919
1070
|
const { onClose } = useMenuContext();
|
|
920
|
-
const { menuItemProps } = useMenuItem(
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
1071
|
+
const { menuItemProps } = useMenuItem(
|
|
1072
|
+
{
|
|
1073
|
+
key: item.key,
|
|
1074
|
+
onAction,
|
|
1075
|
+
onClose
|
|
1076
|
+
},
|
|
1077
|
+
state,
|
|
1078
|
+
ref
|
|
1079
|
+
);
|
|
925
1080
|
const { isFocusVisible, focusProps } = useFocusRing3();
|
|
926
1081
|
const stateProps = useStateProps3({
|
|
927
1082
|
focus: isFocusVisible
|
|
928
1083
|
});
|
|
929
|
-
return /* @__PURE__ */
|
|
1084
|
+
return /* @__PURE__ */ React31.createElement(Box16, {
|
|
930
1085
|
as: "li",
|
|
931
1086
|
ref,
|
|
932
1087
|
__baseCSS: {
|
|
@@ -944,15 +1099,19 @@ var MenuItem = ({ item, state, onAction, css }) => {
|
|
|
944
1099
|
var Menu = ({ variant, size, ...props }) => {
|
|
945
1100
|
const { triggerWidth, ...menuContext } = useMenuContext();
|
|
946
1101
|
const ownProps = { ...props, ...menuContext };
|
|
947
|
-
const ref =
|
|
1102
|
+
const ref = useRef6(null);
|
|
948
1103
|
const state = useTreeState({ ...ownProps, selectionMode: "none" });
|
|
949
1104
|
const { menuProps } = useMenu(ownProps, state, ref);
|
|
950
|
-
const styles =
|
|
951
|
-
|
|
1105
|
+
const styles = useComponentStyles18(
|
|
1106
|
+
"Menu",
|
|
1107
|
+
{ variant, size },
|
|
1108
|
+
{ parts: ["container", "item"] }
|
|
1109
|
+
);
|
|
1110
|
+
return /* @__PURE__ */ React32.createElement(FocusScope2, {
|
|
952
1111
|
restoreFocus: true
|
|
953
|
-
}, /* @__PURE__ */
|
|
1112
|
+
}, /* @__PURE__ */ React32.createElement("div", null, /* @__PURE__ */ React32.createElement(DismissButton, {
|
|
954
1113
|
onDismiss: ownProps.onClose
|
|
955
|
-
}), /* @__PURE__ */
|
|
1114
|
+
}), /* @__PURE__ */ React32.createElement(Box17, {
|
|
956
1115
|
as: "ul",
|
|
957
1116
|
ref,
|
|
958
1117
|
style: { width: triggerWidth },
|
|
@@ -963,13 +1122,13 @@ var Menu = ({ variant, size, ...props }) => {
|
|
|
963
1122
|
},
|
|
964
1123
|
css: styles.container,
|
|
965
1124
|
...menuProps
|
|
966
|
-
}, [...state.collection].map((item) => /* @__PURE__ */
|
|
1125
|
+
}, [...state.collection].map((item) => /* @__PURE__ */ React32.createElement(MenuItem, {
|
|
967
1126
|
key: item.key,
|
|
968
1127
|
item,
|
|
969
1128
|
state,
|
|
970
1129
|
onAction: props.onSelect,
|
|
971
1130
|
css: styles.item
|
|
972
|
-
}))), /* @__PURE__ */
|
|
1131
|
+
}))), /* @__PURE__ */ React32.createElement(DismissButton, {
|
|
973
1132
|
onDismiss: ownProps.onClose
|
|
974
1133
|
})));
|
|
975
1134
|
};
|
|
@@ -977,9 +1136,9 @@ Menu.Trigger = MenuTrigger;
|
|
|
977
1136
|
Menu.Item = Item;
|
|
978
1137
|
|
|
979
1138
|
// src/Message/Message.tsx
|
|
980
|
-
import
|
|
1139
|
+
import React33 from "react";
|
|
981
1140
|
import { Exclamation, Info, Notification } from "@marigold/icons";
|
|
982
|
-
import { useComponentStyles as
|
|
1141
|
+
import { useComponentStyles as useComponentStyles19 } from "@marigold/system";
|
|
983
1142
|
var Message = ({
|
|
984
1143
|
messageTitle,
|
|
985
1144
|
variant = "info",
|
|
@@ -987,56 +1146,60 @@ var Message = ({
|
|
|
987
1146
|
children,
|
|
988
1147
|
...props
|
|
989
1148
|
}) => {
|
|
990
|
-
const styles =
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1149
|
+
const styles = useComponentStyles19(
|
|
1150
|
+
"Message",
|
|
1151
|
+
{
|
|
1152
|
+
variant,
|
|
1153
|
+
size
|
|
1154
|
+
},
|
|
1155
|
+
{ parts: ["container", "icon", "title", "content"] }
|
|
1156
|
+
);
|
|
1157
|
+
var icon = /* @__PURE__ */ React33.createElement(Info, null);
|
|
995
1158
|
if (variant === "warning") {
|
|
996
|
-
icon = /* @__PURE__ */
|
|
1159
|
+
icon = /* @__PURE__ */ React33.createElement(Notification, null);
|
|
997
1160
|
}
|
|
998
1161
|
if (variant === "error") {
|
|
999
|
-
icon = /* @__PURE__ */
|
|
1162
|
+
icon = /* @__PURE__ */ React33.createElement(Exclamation, null);
|
|
1000
1163
|
}
|
|
1001
|
-
return /* @__PURE__ */
|
|
1164
|
+
return /* @__PURE__ */ React33.createElement(Box, {
|
|
1002
1165
|
css: styles.container,
|
|
1003
1166
|
...props
|
|
1004
|
-
}, /* @__PURE__ */
|
|
1167
|
+
}, /* @__PURE__ */ React33.createElement(Box, {
|
|
1005
1168
|
__baseCSS: { display: "flex", alignItems: "center", gap: 4 }
|
|
1006
|
-
}, /* @__PURE__ */
|
|
1169
|
+
}, /* @__PURE__ */ React33.createElement(Box, {
|
|
1007
1170
|
role: "presentation",
|
|
1008
1171
|
css: styles.icon
|
|
1009
|
-
}, icon), /* @__PURE__ */
|
|
1172
|
+
}, icon), /* @__PURE__ */ React33.createElement(Box, {
|
|
1010
1173
|
css: styles.title
|
|
1011
|
-
}, messageTitle)), /* @__PURE__ */
|
|
1174
|
+
}, messageTitle)), /* @__PURE__ */ React33.createElement(Box, {
|
|
1012
1175
|
css: styles.content
|
|
1013
1176
|
}, children));
|
|
1014
1177
|
};
|
|
1015
1178
|
|
|
1016
1179
|
// src/NumberField/NumberField.tsx
|
|
1017
|
-
import
|
|
1180
|
+
import React37, { forwardRef as forwardRef7 } from "react";
|
|
1018
1181
|
import { useFocusRing as useFocusRing4 } from "@react-aria/focus";
|
|
1019
|
-
import { useHover as
|
|
1182
|
+
import { useHover as useHover4 } from "@react-aria/interactions";
|
|
1020
1183
|
import { useLocale } from "@react-aria/i18n";
|
|
1021
1184
|
import { useNumberField } from "@react-aria/numberfield";
|
|
1022
|
-
import { mergeProps as mergeProps6, useObjectRef as
|
|
1185
|
+
import { mergeProps as mergeProps6, useObjectRef as useObjectRef5 } from "@react-aria/utils";
|
|
1023
1186
|
import { useNumberFieldState } from "@react-stately/numberfield";
|
|
1024
1187
|
import {
|
|
1025
|
-
Box as
|
|
1026
|
-
useComponentStyles as
|
|
1188
|
+
Box as Box21,
|
|
1189
|
+
useComponentStyles as useComponentStyles21,
|
|
1027
1190
|
useStateProps as useStateProps5
|
|
1028
1191
|
} from "@marigold/system";
|
|
1029
1192
|
|
|
1030
1193
|
// src/FieldBase/FieldBase.tsx
|
|
1031
|
-
import
|
|
1032
|
-
import { Box as
|
|
1194
|
+
import React35 from "react";
|
|
1195
|
+
import { Box as Box19 } from "@marigold/system";
|
|
1033
1196
|
|
|
1034
1197
|
// src/HelpText/HelpText.tsx
|
|
1035
|
-
import
|
|
1198
|
+
import React34 from "react";
|
|
1036
1199
|
import { Exclamation as Exclamation2 } from "@marigold/icons";
|
|
1037
1200
|
import {
|
|
1038
|
-
Box as
|
|
1039
|
-
useComponentStyles as
|
|
1201
|
+
Box as Box18,
|
|
1202
|
+
useComponentStyles as useComponentStyles20
|
|
1040
1203
|
} from "@marigold/system";
|
|
1041
1204
|
var HelpText = ({
|
|
1042
1205
|
variant,
|
|
@@ -1051,16 +1214,20 @@ var HelpText = ({
|
|
|
1051
1214
|
}) => {
|
|
1052
1215
|
var _a;
|
|
1053
1216
|
const hasErrorMessage = errorMessage && error;
|
|
1054
|
-
const styles =
|
|
1055
|
-
|
|
1217
|
+
const styles = useComponentStyles20(
|
|
1218
|
+
"HelpText",
|
|
1219
|
+
{ variant, size },
|
|
1220
|
+
{ parts: ["container", "icon"] }
|
|
1221
|
+
);
|
|
1222
|
+
return /* @__PURE__ */ React34.createElement(Box18, {
|
|
1056
1223
|
...hasErrorMessage ? errorMessageProps : descriptionProps,
|
|
1057
1224
|
...props,
|
|
1058
1225
|
__baseCSS: { display: "flex", alignItems: "center", gap: 4 },
|
|
1059
1226
|
css: styles.container
|
|
1060
|
-
}, hasErrorMessage ? /* @__PURE__ */
|
|
1227
|
+
}, hasErrorMessage ? /* @__PURE__ */ React34.createElement(React34.Fragment, null, /* @__PURE__ */ React34.createElement(Exclamation2, {
|
|
1061
1228
|
role: "presentation",
|
|
1062
1229
|
size: ((_a = styles == null ? void 0 : styles.icon) == null ? void 0 : _a.size) || 16
|
|
1063
|
-
}), errorMessage) : /* @__PURE__ */
|
|
1230
|
+
}), errorMessage) : /* @__PURE__ */ React34.createElement(React34.Fragment, null, description));
|
|
1064
1231
|
};
|
|
1065
1232
|
|
|
1066
1233
|
// src/FieldBase/FieldBase.tsx
|
|
@@ -1081,15 +1248,15 @@ var FieldBase = ({
|
|
|
1081
1248
|
stateProps
|
|
1082
1249
|
}) => {
|
|
1083
1250
|
const hasHelpText = !!description || errorMessage && error;
|
|
1084
|
-
return /* @__PURE__ */
|
|
1251
|
+
return /* @__PURE__ */ React35.createElement(Box19, {
|
|
1085
1252
|
css: { display: "flex", flexDirection: "column", width }
|
|
1086
|
-
}, label && /* @__PURE__ */
|
|
1253
|
+
}, label && /* @__PURE__ */ React35.createElement(Label, {
|
|
1087
1254
|
required,
|
|
1088
1255
|
variant,
|
|
1089
1256
|
size,
|
|
1090
1257
|
...labelProps,
|
|
1091
1258
|
...stateProps
|
|
1092
|
-
}, label), children, hasHelpText && /* @__PURE__ */
|
|
1259
|
+
}, label), children, hasHelpText && /* @__PURE__ */ React35.createElement(HelpText, {
|
|
1093
1260
|
...stateProps,
|
|
1094
1261
|
variant,
|
|
1095
1262
|
size,
|
|
@@ -1103,42 +1270,45 @@ var FieldBase = ({
|
|
|
1103
1270
|
};
|
|
1104
1271
|
|
|
1105
1272
|
// src/NumberField/StepButton.tsx
|
|
1106
|
-
import
|
|
1273
|
+
import React36, { useRef as useRef7 } from "react";
|
|
1107
1274
|
import { useButton as useButton3 } from "@react-aria/button";
|
|
1108
|
-
import { useHover as
|
|
1275
|
+
import { useHover as useHover3 } from "@react-aria/interactions";
|
|
1109
1276
|
import { mergeProps as mergeProps5 } from "@react-aria/utils";
|
|
1110
|
-
import { Box as
|
|
1111
|
-
var Plus = () => /* @__PURE__ */
|
|
1277
|
+
import { Box as Box20, useStateProps as useStateProps4 } from "@marigold/system";
|
|
1278
|
+
var Plus = () => /* @__PURE__ */ React36.createElement(Box20, {
|
|
1112
1279
|
as: "svg",
|
|
1113
1280
|
__baseCSS: { width: 16, height: 16 },
|
|
1114
1281
|
viewBox: "0 0 20 20",
|
|
1115
1282
|
fill: "currentColor"
|
|
1116
|
-
}, /* @__PURE__ */
|
|
1283
|
+
}, /* @__PURE__ */ React36.createElement("path", {
|
|
1117
1284
|
fillRule: "evenodd",
|
|
1118
1285
|
clipRule: "evenodd",
|
|
1119
1286
|
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"
|
|
1120
1287
|
}));
|
|
1121
|
-
var Minus = () => /* @__PURE__ */
|
|
1288
|
+
var Minus = () => /* @__PURE__ */ React36.createElement(Box20, {
|
|
1122
1289
|
as: "svg",
|
|
1123
1290
|
__baseCSS: { width: 16, height: 16 },
|
|
1124
1291
|
viewBox: "0 0 20 20",
|
|
1125
1292
|
fill: "currentColor"
|
|
1126
|
-
}, /* @__PURE__ */
|
|
1293
|
+
}, /* @__PURE__ */ React36.createElement("path", {
|
|
1127
1294
|
fillRule: "evenodd",
|
|
1128
1295
|
clipRule: "evenodd",
|
|
1129
1296
|
d: "M3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
|
|
1130
1297
|
}));
|
|
1131
1298
|
var StepButton = ({ direction, css, ...props }) => {
|
|
1132
|
-
const ref =
|
|
1133
|
-
const { buttonProps, isPressed } = useButton3(
|
|
1134
|
-
|
|
1299
|
+
const ref = useRef7(null);
|
|
1300
|
+
const { buttonProps, isPressed } = useButton3(
|
|
1301
|
+
{ ...props, elementType: "div" },
|
|
1302
|
+
ref
|
|
1303
|
+
);
|
|
1304
|
+
const { hoverProps, isHovered } = useHover3(props);
|
|
1135
1305
|
const stateProps = useStateProps4({
|
|
1136
1306
|
active: isPressed,
|
|
1137
1307
|
hover: isHovered,
|
|
1138
1308
|
disabled: props.isDisabled
|
|
1139
1309
|
});
|
|
1140
1310
|
const Icon3 = direction === "up" ? Plus : Minus;
|
|
1141
|
-
return /* @__PURE__ */
|
|
1311
|
+
return /* @__PURE__ */ React36.createElement(Box20, {
|
|
1142
1312
|
__baseCSS: {
|
|
1143
1313
|
display: "flex",
|
|
1144
1314
|
alignItems: "center",
|
|
@@ -1148,103 +1318,109 @@ var StepButton = ({ direction, css, ...props }) => {
|
|
|
1148
1318
|
css,
|
|
1149
1319
|
...mergeProps5(buttonProps, hoverProps),
|
|
1150
1320
|
...stateProps
|
|
1151
|
-
}, /* @__PURE__ */
|
|
1321
|
+
}, /* @__PURE__ */ React36.createElement(Icon3, null));
|
|
1152
1322
|
};
|
|
1153
1323
|
|
|
1154
1324
|
// src/NumberField/NumberField.tsx
|
|
1155
|
-
var NumberField =
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
required,
|
|
1161
|
-
readOnly,
|
|
1162
|
-
error,
|
|
1163
|
-
hideStepper,
|
|
1164
|
-
...rest
|
|
1165
|
-
}, ref) => {
|
|
1166
|
-
const props = {
|
|
1167
|
-
isDisabled: disabled,
|
|
1168
|
-
isRequired: required,
|
|
1169
|
-
isReadOnly: readOnly,
|
|
1170
|
-
validationState: error ? "invalid" : "valid",
|
|
1171
|
-
...rest
|
|
1172
|
-
};
|
|
1173
|
-
const showStepper = !hideStepper;
|
|
1174
|
-
const { locale } = useLocale();
|
|
1175
|
-
const inputRef = useObjectRef3(ref);
|
|
1176
|
-
const state = useNumberFieldState({ ...props, locale });
|
|
1177
|
-
const {
|
|
1178
|
-
labelProps,
|
|
1179
|
-
groupProps,
|
|
1180
|
-
inputProps,
|
|
1181
|
-
descriptionProps,
|
|
1182
|
-
errorMessageProps,
|
|
1183
|
-
incrementButtonProps,
|
|
1184
|
-
decrementButtonProps
|
|
1185
|
-
} = useNumberField(props, state, inputRef);
|
|
1186
|
-
const { hoverProps, isHovered } = useHover3({ isDisabled: disabled });
|
|
1187
|
-
const { focusProps, isFocused } = useFocusRing4({
|
|
1188
|
-
within: true,
|
|
1189
|
-
isTextInput: true,
|
|
1190
|
-
autoFocus: props.autoFocus
|
|
1191
|
-
});
|
|
1192
|
-
const styles = useComponentStyles20("NumberField", { variant, size }, { parts: ["group", "stepper"] });
|
|
1193
|
-
const stateProps = useStateProps5({
|
|
1194
|
-
hover: isHovered,
|
|
1195
|
-
focus: isFocused,
|
|
1325
|
+
var NumberField = forwardRef7(
|
|
1326
|
+
({
|
|
1327
|
+
variant,
|
|
1328
|
+
size,
|
|
1329
|
+
width,
|
|
1196
1330
|
disabled,
|
|
1197
|
-
readOnly,
|
|
1198
|
-
error
|
|
1199
|
-
});
|
|
1200
|
-
return /* @__PURE__ */ React35.createElement(FieldBase, {
|
|
1201
|
-
label: props.label,
|
|
1202
|
-
labelProps,
|
|
1203
1331
|
required,
|
|
1204
|
-
|
|
1205
|
-
descriptionProps,
|
|
1332
|
+
readOnly,
|
|
1206
1333
|
error,
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1334
|
+
hideStepper,
|
|
1335
|
+
...rest
|
|
1336
|
+
}, ref) => {
|
|
1337
|
+
const props = {
|
|
1338
|
+
isDisabled: disabled,
|
|
1339
|
+
isRequired: required,
|
|
1340
|
+
isReadOnly: readOnly,
|
|
1341
|
+
validationState: error ? "invalid" : "valid",
|
|
1342
|
+
...rest
|
|
1343
|
+
};
|
|
1344
|
+
const showStepper = !hideStepper;
|
|
1345
|
+
const { locale } = useLocale();
|
|
1346
|
+
const inputRef = useObjectRef5(ref);
|
|
1347
|
+
const state = useNumberFieldState({ ...props, locale });
|
|
1348
|
+
const {
|
|
1349
|
+
labelProps,
|
|
1350
|
+
groupProps,
|
|
1351
|
+
inputProps,
|
|
1352
|
+
descriptionProps,
|
|
1353
|
+
errorMessageProps,
|
|
1354
|
+
incrementButtonProps,
|
|
1355
|
+
decrementButtonProps
|
|
1356
|
+
} = useNumberField(props, state, inputRef);
|
|
1357
|
+
const { hoverProps, isHovered } = useHover4({ isDisabled: disabled });
|
|
1358
|
+
const { focusProps, isFocused } = useFocusRing4({
|
|
1359
|
+
within: true,
|
|
1360
|
+
isTextInput: true,
|
|
1361
|
+
autoFocus: props.autoFocus
|
|
1362
|
+
});
|
|
1363
|
+
const styles = useComponentStyles21(
|
|
1364
|
+
"NumberField",
|
|
1365
|
+
{ variant, size },
|
|
1366
|
+
{ parts: ["group", "stepper"] }
|
|
1367
|
+
);
|
|
1368
|
+
const stateProps = useStateProps5({
|
|
1369
|
+
hover: isHovered,
|
|
1370
|
+
focus: isFocused,
|
|
1371
|
+
disabled,
|
|
1372
|
+
readOnly,
|
|
1373
|
+
error
|
|
1374
|
+
});
|
|
1375
|
+
return /* @__PURE__ */ React37.createElement(FieldBase, {
|
|
1376
|
+
label: props.label,
|
|
1377
|
+
labelProps,
|
|
1378
|
+
required,
|
|
1379
|
+
description: props.description,
|
|
1380
|
+
descriptionProps,
|
|
1381
|
+
error,
|
|
1382
|
+
errorMessage: props.errorMessage,
|
|
1383
|
+
errorMessageProps,
|
|
1384
|
+
stateProps,
|
|
1385
|
+
variant,
|
|
1386
|
+
size,
|
|
1387
|
+
width
|
|
1388
|
+
}, /* @__PURE__ */ React37.createElement(Box21, {
|
|
1389
|
+
"data-group": true,
|
|
1390
|
+
__baseCSS: {
|
|
1391
|
+
display: "flex",
|
|
1392
|
+
alignItems: "stretch",
|
|
1393
|
+
"> input": {
|
|
1394
|
+
flexGrow: 1
|
|
1395
|
+
}
|
|
1396
|
+
},
|
|
1397
|
+
css: styles.group,
|
|
1398
|
+
...mergeProps6(groupProps, focusProps, hoverProps),
|
|
1399
|
+
...stateProps
|
|
1400
|
+
}, showStepper && /* @__PURE__ */ React37.createElement(StepButton, {
|
|
1401
|
+
direction: "down",
|
|
1402
|
+
css: styles.stepper,
|
|
1403
|
+
...decrementButtonProps
|
|
1404
|
+
}), /* @__PURE__ */ React37.createElement(Input, {
|
|
1405
|
+
ref: inputRef,
|
|
1406
|
+
variant,
|
|
1407
|
+
size,
|
|
1408
|
+
...inputProps,
|
|
1409
|
+
...stateProps
|
|
1410
|
+
}), showStepper && /* @__PURE__ */ React37.createElement(StepButton, {
|
|
1411
|
+
direction: "up",
|
|
1412
|
+
css: styles.stepper,
|
|
1413
|
+
...incrementButtonProps
|
|
1414
|
+
})));
|
|
1415
|
+
}
|
|
1416
|
+
);
|
|
1241
1417
|
|
|
1242
1418
|
// src/Provider/index.ts
|
|
1243
1419
|
import { useTheme as useTheme2, ThemeProvider as ThemeProvider2 } from "@marigold/system";
|
|
1244
1420
|
import { SSRProvider } from "@react-aria/ssr";
|
|
1245
1421
|
|
|
1246
1422
|
// src/Provider/MarigoldProvider.tsx
|
|
1247
|
-
import
|
|
1423
|
+
import React38 from "react";
|
|
1248
1424
|
import { OverlayProvider } from "@react-aria/overlays";
|
|
1249
1425
|
import {
|
|
1250
1426
|
Global,
|
|
@@ -1262,43 +1438,47 @@ function MarigoldProvider({
|
|
|
1262
1438
|
const outer = useTheme();
|
|
1263
1439
|
const isTopLevel = outer.theme === __defaultTheme;
|
|
1264
1440
|
if (((_a = outer.theme) == null ? void 0 : _a.root) && !isTopLevel && !selector) {
|
|
1265
|
-
throw new Error(
|
|
1266
|
-
|
|
1441
|
+
throw new Error(
|
|
1442
|
+
`[MarigoldProvider] You cannot nest a MarigoldProvider inside another MarigoldProvider without a "selector"!
|
|
1443
|
+
Nested themes with a "root" property must specify a "selector" to prevent accidentally overriding global CSS`
|
|
1444
|
+
);
|
|
1267
1445
|
}
|
|
1268
|
-
return /* @__PURE__ */
|
|
1446
|
+
return /* @__PURE__ */ React38.createElement(ThemeProvider, {
|
|
1269
1447
|
theme
|
|
1270
|
-
}, /* @__PURE__ */
|
|
1448
|
+
}, /* @__PURE__ */ React38.createElement(Global, {
|
|
1271
1449
|
normalizeDocument: isTopLevel && normalizeDocument,
|
|
1272
1450
|
selector
|
|
1273
|
-
}), isTopLevel ? /* @__PURE__ */
|
|
1451
|
+
}), isTopLevel ? /* @__PURE__ */ React38.createElement(OverlayProvider, null, children) : children);
|
|
1274
1452
|
}
|
|
1275
1453
|
|
|
1276
1454
|
// src/Radio/Radio.tsx
|
|
1277
|
-
import
|
|
1278
|
-
forwardRef as
|
|
1455
|
+
import React40, {
|
|
1456
|
+
forwardRef as forwardRef8
|
|
1279
1457
|
} from "react";
|
|
1280
|
-
import { useHover as
|
|
1458
|
+
import { useHover as useHover5 } from "@react-aria/interactions";
|
|
1281
1459
|
import { useFocusRing as useFocusRing5 } from "@react-aria/focus";
|
|
1282
1460
|
import { useRadio } from "@react-aria/radio";
|
|
1283
|
-
import { useObjectRef as
|
|
1461
|
+
import { useObjectRef as useObjectRef6 } from "@react-aria/utils";
|
|
1284
1462
|
import {
|
|
1285
|
-
Box as
|
|
1286
|
-
useComponentStyles as
|
|
1463
|
+
Box as Box23,
|
|
1464
|
+
useComponentStyles as useComponentStyles23,
|
|
1287
1465
|
useStateProps as useStateProps6
|
|
1288
1466
|
} from "@marigold/system";
|
|
1289
1467
|
|
|
1290
1468
|
// src/Radio/Context.ts
|
|
1291
|
-
import { createContext as
|
|
1292
|
-
var RadioGroupContext =
|
|
1293
|
-
|
|
1469
|
+
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
1470
|
+
var RadioGroupContext = createContext5(
|
|
1471
|
+
null
|
|
1472
|
+
);
|
|
1473
|
+
var useRadioGroupContext = () => useContext5(RadioGroupContext);
|
|
1294
1474
|
|
|
1295
1475
|
// src/Radio/RadioGroup.tsx
|
|
1296
|
-
import
|
|
1476
|
+
import React39 from "react";
|
|
1297
1477
|
import { useRadioGroup } from "@react-aria/radio";
|
|
1298
1478
|
import { useRadioGroupState } from "@react-stately/radio";
|
|
1299
1479
|
import {
|
|
1300
|
-
Box as
|
|
1301
|
-
useComponentStyles as
|
|
1480
|
+
Box as Box22,
|
|
1481
|
+
useComponentStyles as useComponentStyles22
|
|
1302
1482
|
} from "@marigold/system";
|
|
1303
1483
|
var RadioGroup = ({
|
|
1304
1484
|
children,
|
|
@@ -1321,15 +1501,19 @@ var RadioGroup = ({
|
|
|
1321
1501
|
};
|
|
1322
1502
|
const state = useRadioGroupState(props);
|
|
1323
1503
|
const { radioGroupProps, labelProps } = useRadioGroup(props, state);
|
|
1324
|
-
const styles =
|
|
1325
|
-
|
|
1504
|
+
const styles = useComponentStyles22(
|
|
1505
|
+
"RadioGroup",
|
|
1506
|
+
{ variant, size },
|
|
1507
|
+
{ parts: ["container", "group"] }
|
|
1508
|
+
);
|
|
1509
|
+
return /* @__PURE__ */ React39.createElement(Box22, {
|
|
1326
1510
|
...radioGroupProps,
|
|
1327
1511
|
css: styles.container
|
|
1328
|
-
}, props.label && /* @__PURE__ */
|
|
1512
|
+
}, props.label && /* @__PURE__ */ React39.createElement(Label, {
|
|
1329
1513
|
as: "span",
|
|
1330
1514
|
required,
|
|
1331
1515
|
...labelProps
|
|
1332
|
-
}, props.label), /* @__PURE__ */
|
|
1516
|
+
}, props.label), /* @__PURE__ */ React39.createElement(Box22, {
|
|
1333
1517
|
role: "presentation",
|
|
1334
1518
|
"data-orientation": orientation,
|
|
1335
1519
|
__baseCSS: {
|
|
@@ -1339,21 +1523,21 @@ var RadioGroup = ({
|
|
|
1339
1523
|
gap: orientation === "vertical" ? "0.5ch" : "1.5ch"
|
|
1340
1524
|
},
|
|
1341
1525
|
css: styles.group
|
|
1342
|
-
}, /* @__PURE__ */
|
|
1526
|
+
}, /* @__PURE__ */ React39.createElement(RadioGroupContext.Provider, {
|
|
1343
1527
|
value: { variant, size, width, error, ...state }
|
|
1344
1528
|
}, children)));
|
|
1345
1529
|
};
|
|
1346
1530
|
|
|
1347
1531
|
// src/Radio/Radio.tsx
|
|
1348
|
-
var Dot = () => /* @__PURE__ */
|
|
1532
|
+
var Dot = () => /* @__PURE__ */ React40.createElement("svg", {
|
|
1349
1533
|
viewBox: "0 0 6 6"
|
|
1350
|
-
}, /* @__PURE__ */
|
|
1534
|
+
}, /* @__PURE__ */ React40.createElement("circle", {
|
|
1351
1535
|
fill: "currentColor",
|
|
1352
1536
|
cx: "3",
|
|
1353
1537
|
cy: "3",
|
|
1354
1538
|
r: "3"
|
|
1355
1539
|
}));
|
|
1356
|
-
var Icon2 = ({ checked, css, ...props }) => /* @__PURE__ */
|
|
1540
|
+
var Icon2 = ({ checked, css, ...props }) => /* @__PURE__ */ React40.createElement(Box23, {
|
|
1357
1541
|
"aria-hidden": "true",
|
|
1358
1542
|
__baseCSS: {
|
|
1359
1543
|
width: 16,
|
|
@@ -1368,70 +1552,80 @@ var Icon2 = ({ checked, css, ...props }) => /* @__PURE__ */ React38.createElemen
|
|
|
1368
1552
|
},
|
|
1369
1553
|
css,
|
|
1370
1554
|
...props
|
|
1371
|
-
}, checked ? /* @__PURE__ */
|
|
1372
|
-
var Radio =
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1555
|
+
}, checked ? /* @__PURE__ */ React40.createElement(Dot, null) : null);
|
|
1556
|
+
var Radio = forwardRef8(
|
|
1557
|
+
({ width, disabled, ...props }, ref) => {
|
|
1558
|
+
const {
|
|
1559
|
+
variant,
|
|
1560
|
+
size,
|
|
1561
|
+
error,
|
|
1562
|
+
width: groupWidth,
|
|
1563
|
+
...state
|
|
1564
|
+
} = useRadioGroupContext();
|
|
1565
|
+
const inputRef = useObjectRef6(ref);
|
|
1566
|
+
const { inputProps } = useRadio(
|
|
1567
|
+
{ isDisabled: disabled, ...props },
|
|
1568
|
+
state,
|
|
1569
|
+
inputRef
|
|
1570
|
+
);
|
|
1571
|
+
const styles = useComponentStyles23(
|
|
1572
|
+
"Radio",
|
|
1573
|
+
{ variant: variant || props.variant, size: size || props.size },
|
|
1574
|
+
{ parts: ["container", "label", "radio"] }
|
|
1575
|
+
);
|
|
1576
|
+
const { hoverProps, isHovered } = useHover5({});
|
|
1577
|
+
const { isFocusVisible, focusProps } = useFocusRing5();
|
|
1578
|
+
const stateProps = useStateProps6({
|
|
1579
|
+
hover: isHovered,
|
|
1580
|
+
focus: isFocusVisible,
|
|
1581
|
+
checked: inputProps.checked,
|
|
1582
|
+
disabled: inputProps.disabled,
|
|
1583
|
+
readOnly: props.readOnly,
|
|
1584
|
+
error
|
|
1585
|
+
});
|
|
1586
|
+
return /* @__PURE__ */ React40.createElement(Box23, {
|
|
1587
|
+
as: "label",
|
|
1588
|
+
__baseCSS: {
|
|
1589
|
+
display: "flex",
|
|
1590
|
+
alignItems: "center",
|
|
1591
|
+
gap: "1ch",
|
|
1592
|
+
position: "relative",
|
|
1593
|
+
width: width || groupWidth || "100%"
|
|
1594
|
+
},
|
|
1595
|
+
css: styles.container,
|
|
1596
|
+
...hoverProps,
|
|
1597
|
+
...stateProps
|
|
1598
|
+
}, /* @__PURE__ */ React40.createElement(Box23, {
|
|
1599
|
+
as: "input",
|
|
1600
|
+
ref: inputRef,
|
|
1601
|
+
css: {
|
|
1602
|
+
position: "absolute",
|
|
1603
|
+
width: "100%",
|
|
1604
|
+
height: "100%",
|
|
1605
|
+
top: 0,
|
|
1606
|
+
left: 0,
|
|
1607
|
+
zIndex: 1,
|
|
1608
|
+
opacity: 1e-4,
|
|
1609
|
+
cursor: inputProps.disabled ? "not-allowed" : "pointer"
|
|
1610
|
+
},
|
|
1611
|
+
...inputProps,
|
|
1612
|
+
...focusProps
|
|
1613
|
+
}), /* @__PURE__ */ React40.createElement(Icon2, {
|
|
1614
|
+
checked: inputProps.checked,
|
|
1615
|
+
css: styles.radio,
|
|
1616
|
+
...stateProps
|
|
1617
|
+
}), /* @__PURE__ */ React40.createElement(Box23, {
|
|
1618
|
+
css: styles.label,
|
|
1619
|
+
...stateProps
|
|
1620
|
+
}, props.children));
|
|
1621
|
+
}
|
|
1622
|
+
);
|
|
1429
1623
|
Radio.Group = RadioGroup;
|
|
1430
1624
|
|
|
1431
1625
|
// src/Select/Select.tsx
|
|
1432
|
-
import
|
|
1433
|
-
forwardRef as
|
|
1434
|
-
useRef as
|
|
1626
|
+
import React44, {
|
|
1627
|
+
forwardRef as forwardRef10,
|
|
1628
|
+
useRef as useRef9
|
|
1435
1629
|
} from "react";
|
|
1436
1630
|
import { useButton as useButton4 } from "@react-aria/button";
|
|
1437
1631
|
import { FocusScope as FocusScope3, useFocusRing as useFocusRing6 } from "@react-aria/focus";
|
|
@@ -1440,48 +1634,52 @@ import { DismissButton as DismissButton2, useOverlayPosition as useOverlayPositi
|
|
|
1440
1634
|
import { HiddenSelect, useSelect } from "@react-aria/select";
|
|
1441
1635
|
import { useSelectState } from "@react-stately/select";
|
|
1442
1636
|
import { Item as Item2, Section } from "@react-stately/collections";
|
|
1443
|
-
import { mergeProps as mergeProps7, useObjectRef as
|
|
1637
|
+
import { mergeProps as mergeProps7, useObjectRef as useObjectRef8 } from "@react-aria/utils";
|
|
1444
1638
|
import {
|
|
1445
|
-
Box as
|
|
1446
|
-
useComponentStyles as
|
|
1639
|
+
Box as Box27,
|
|
1640
|
+
useComponentStyles as useComponentStyles25,
|
|
1447
1641
|
useStateProps as useStateProps8
|
|
1448
1642
|
} from "@marigold/system";
|
|
1449
1643
|
|
|
1450
1644
|
// src/ListBox/ListBox.tsx
|
|
1451
|
-
import
|
|
1452
|
-
import { useObjectRef as
|
|
1645
|
+
import React43, { forwardRef as forwardRef9 } from "react";
|
|
1646
|
+
import { useObjectRef as useObjectRef7 } from "@react-aria/utils";
|
|
1453
1647
|
import {
|
|
1454
|
-
Box as
|
|
1455
|
-
useComponentStyles as
|
|
1648
|
+
Box as Box26,
|
|
1649
|
+
useComponentStyles as useComponentStyles24
|
|
1456
1650
|
} from "@marigold/system";
|
|
1457
1651
|
import { useListBox } from "@react-aria/listbox";
|
|
1458
1652
|
|
|
1459
1653
|
// src/ListBox/Context.ts
|
|
1460
|
-
import { createContext as
|
|
1461
|
-
var ListBoxContext =
|
|
1462
|
-
var useListBoxContext = () =>
|
|
1654
|
+
import { createContext as createContext6, useContext as useContext6 } from "react";
|
|
1655
|
+
var ListBoxContext = createContext6({});
|
|
1656
|
+
var useListBoxContext = () => useContext6(ListBoxContext);
|
|
1463
1657
|
|
|
1464
1658
|
// src/ListBox/ListBoxSection.tsx
|
|
1465
|
-
import
|
|
1659
|
+
import React42 from "react";
|
|
1466
1660
|
import { useListBoxSection } from "@react-aria/listbox";
|
|
1467
|
-
import { Box as
|
|
1661
|
+
import { Box as Box25 } from "@marigold/system";
|
|
1468
1662
|
|
|
1469
1663
|
// src/ListBox/ListBoxOption.tsx
|
|
1470
|
-
import
|
|
1664
|
+
import React41, { useRef as useRef8 } from "react";
|
|
1471
1665
|
import { useOption } from "@react-aria/listbox";
|
|
1472
|
-
import { Box as
|
|
1666
|
+
import { Box as Box24, useStateProps as useStateProps7 } from "@marigold/system";
|
|
1473
1667
|
var ListBoxOption = ({ item, state }) => {
|
|
1474
|
-
const ref =
|
|
1475
|
-
const { optionProps, isSelected, isDisabled, isFocused } = useOption(
|
|
1476
|
-
|
|
1477
|
-
|
|
1668
|
+
const ref = useRef8(null);
|
|
1669
|
+
const { optionProps, isSelected, isDisabled, isFocused } = useOption(
|
|
1670
|
+
{
|
|
1671
|
+
key: item.key
|
|
1672
|
+
},
|
|
1673
|
+
state,
|
|
1674
|
+
ref
|
|
1675
|
+
);
|
|
1478
1676
|
const { styles } = useListBoxContext();
|
|
1479
1677
|
const stateProps = useStateProps7({
|
|
1480
1678
|
selected: isSelected,
|
|
1481
1679
|
disabled: isDisabled,
|
|
1482
1680
|
focusVisible: isFocused
|
|
1483
1681
|
});
|
|
1484
|
-
return /* @__PURE__ */
|
|
1682
|
+
return /* @__PURE__ */ React41.createElement(Box24, {
|
|
1485
1683
|
as: "li",
|
|
1486
1684
|
ref,
|
|
1487
1685
|
css: styles.option,
|
|
@@ -1497,19 +1695,19 @@ var ListBoxSection = ({ section, state }) => {
|
|
|
1497
1695
|
"aria-label": section["aria-label"]
|
|
1498
1696
|
});
|
|
1499
1697
|
const { styles } = useListBoxContext();
|
|
1500
|
-
return /* @__PURE__ */
|
|
1698
|
+
return /* @__PURE__ */ React42.createElement(Box25, {
|
|
1501
1699
|
as: "li",
|
|
1502
1700
|
css: styles.section,
|
|
1503
1701
|
...itemProps
|
|
1504
|
-
}, section.rendered && /* @__PURE__ */
|
|
1702
|
+
}, section.rendered && /* @__PURE__ */ React42.createElement(Box25, {
|
|
1505
1703
|
css: styles.sectionTitle,
|
|
1506
1704
|
...headingProps
|
|
1507
|
-
}, section.rendered), /* @__PURE__ */
|
|
1705
|
+
}, section.rendered), /* @__PURE__ */ React42.createElement(Box25, {
|
|
1508
1706
|
as: "ul",
|
|
1509
1707
|
__baseCSS: { listStyle: "none", p: 0 },
|
|
1510
1708
|
css: styles.list,
|
|
1511
1709
|
...groupProps
|
|
1512
|
-
}, [...section.childNodes].map((node) => /* @__PURE__ */
|
|
1710
|
+
}, [...section.childNodes].map((node) => /* @__PURE__ */ React42.createElement(ListBoxOption, {
|
|
1513
1711
|
key: node.key,
|
|
1514
1712
|
item: node,
|
|
1515
1713
|
state
|
|
@@ -1517,30 +1715,38 @@ var ListBoxSection = ({ section, state }) => {
|
|
|
1517
1715
|
};
|
|
1518
1716
|
|
|
1519
1717
|
// src/ListBox/ListBox.tsx
|
|
1520
|
-
var ListBox =
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1718
|
+
var ListBox = forwardRef9(
|
|
1719
|
+
({ state, variant, size, ...props }, ref) => {
|
|
1720
|
+
const innerRef = useObjectRef7(ref);
|
|
1721
|
+
const { listBoxProps } = useListBox(props, state, innerRef);
|
|
1722
|
+
const styles = useComponentStyles24(
|
|
1723
|
+
"ListBox",
|
|
1724
|
+
{ variant, size },
|
|
1725
|
+
{ parts: ["container", "list", "option", "section", "sectionTitle"] }
|
|
1726
|
+
);
|
|
1727
|
+
return /* @__PURE__ */ React43.createElement(ListBoxContext.Provider, {
|
|
1728
|
+
value: { styles }
|
|
1729
|
+
}, /* @__PURE__ */ React43.createElement(Box26, {
|
|
1730
|
+
css: styles.container
|
|
1731
|
+
}, /* @__PURE__ */ React43.createElement(Box26, {
|
|
1732
|
+
as: "ul",
|
|
1733
|
+
ref: innerRef,
|
|
1734
|
+
__baseCSS: { listStyle: "none", p: 0 },
|
|
1735
|
+
css: styles.list,
|
|
1736
|
+
...listBoxProps
|
|
1737
|
+
}, [...state.collection].map(
|
|
1738
|
+
(item) => item.type === "section" ? /* @__PURE__ */ React43.createElement(ListBoxSection, {
|
|
1739
|
+
key: item.key,
|
|
1740
|
+
section: item,
|
|
1741
|
+
state
|
|
1742
|
+
}) : /* @__PURE__ */ React43.createElement(ListBoxOption, {
|
|
1743
|
+
key: item.key,
|
|
1744
|
+
item,
|
|
1745
|
+
state
|
|
1746
|
+
})
|
|
1747
|
+
))));
|
|
1748
|
+
}
|
|
1749
|
+
);
|
|
1544
1750
|
|
|
1545
1751
|
// src/Select/intl.ts
|
|
1546
1752
|
var messages = {
|
|
@@ -1553,7 +1759,7 @@ var messages = {
|
|
|
1553
1759
|
};
|
|
1554
1760
|
|
|
1555
1761
|
// src/Select/Select.tsx
|
|
1556
|
-
var Chevron = ({ css }) => /* @__PURE__ */
|
|
1762
|
+
var Chevron = ({ css }) => /* @__PURE__ */ React44.createElement(Box27, {
|
|
1557
1763
|
as: "svg",
|
|
1558
1764
|
__baseCSS: { width: 16, height: 16 },
|
|
1559
1765
|
css,
|
|
@@ -1561,122 +1767,131 @@ var Chevron = ({ css }) => /* @__PURE__ */ React42.createElement(Box24, {
|
|
|
1561
1767
|
viewBox: "0 0 24 24",
|
|
1562
1768
|
stroke: "currentColor",
|
|
1563
1769
|
strokeWidth: 2
|
|
1564
|
-
}, /* @__PURE__ */
|
|
1770
|
+
}, /* @__PURE__ */ React44.createElement("path", {
|
|
1565
1771
|
strokeLinecap: "round",
|
|
1566
1772
|
strokeLinejoin: "round",
|
|
1567
1773
|
d: "M19 9l-7 7-7-7"
|
|
1568
1774
|
}));
|
|
1569
|
-
var Select =
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
},
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
})
|
|
1775
|
+
var Select = forwardRef10(
|
|
1776
|
+
({ variant, size, width, open, disabled, required, error, ...rest }, ref) => {
|
|
1777
|
+
const formatMessage = useMessageFormatter(messages);
|
|
1778
|
+
const buttonRef = useObjectRef8(ref);
|
|
1779
|
+
const props = {
|
|
1780
|
+
isOpen: open,
|
|
1781
|
+
isDisabled: disabled,
|
|
1782
|
+
isRequired: required,
|
|
1783
|
+
validationState: error ? "invalid" : "valid",
|
|
1784
|
+
placeholder: rest.placeholder || formatMessage("placeholder"),
|
|
1785
|
+
...rest
|
|
1786
|
+
};
|
|
1787
|
+
const state = useSelectState(props);
|
|
1788
|
+
const {
|
|
1789
|
+
labelProps,
|
|
1790
|
+
triggerProps,
|
|
1791
|
+
valueProps,
|
|
1792
|
+
menuProps,
|
|
1793
|
+
descriptionProps,
|
|
1794
|
+
errorMessageProps
|
|
1795
|
+
} = useSelect(props, state, buttonRef);
|
|
1796
|
+
const { buttonProps } = useButton4(
|
|
1797
|
+
{ isDisabled: disabled, ...triggerProps },
|
|
1798
|
+
buttonRef
|
|
1799
|
+
);
|
|
1800
|
+
const { focusProps, isFocusVisible } = useFocusRing6();
|
|
1801
|
+
const overlayRef = useRef9(null);
|
|
1802
|
+
const { overlayProps: positionProps } = useOverlayPosition2({
|
|
1803
|
+
targetRef: buttonRef,
|
|
1804
|
+
overlayRef,
|
|
1805
|
+
isOpen: state.isOpen,
|
|
1806
|
+
placement: "bottom left"
|
|
1807
|
+
});
|
|
1808
|
+
const styles = useComponentStyles25(
|
|
1809
|
+
"Select",
|
|
1810
|
+
{ variant, size },
|
|
1811
|
+
{ parts: ["container", "button", "icon"] }
|
|
1812
|
+
);
|
|
1813
|
+
const stateProps = useStateProps8({
|
|
1814
|
+
disabled,
|
|
1815
|
+
error,
|
|
1816
|
+
focusVisible: isFocusVisible,
|
|
1817
|
+
expanded: state.isOpen
|
|
1818
|
+
});
|
|
1819
|
+
return /* @__PURE__ */ React44.createElement(FieldBase, {
|
|
1820
|
+
variant,
|
|
1821
|
+
size,
|
|
1822
|
+
width,
|
|
1823
|
+
label: props.label,
|
|
1824
|
+
labelProps: { as: "span", ...labelProps },
|
|
1825
|
+
description: props.description,
|
|
1826
|
+
descriptionProps,
|
|
1827
|
+
error,
|
|
1828
|
+
errorMessage: props.errorMessage,
|
|
1829
|
+
errorMessageProps,
|
|
1830
|
+
stateProps,
|
|
1831
|
+
disabled,
|
|
1832
|
+
required
|
|
1833
|
+
}, /* @__PURE__ */ React44.createElement(HiddenSelect, {
|
|
1834
|
+
state,
|
|
1835
|
+
triggerRef: buttonRef,
|
|
1836
|
+
label: props.label,
|
|
1837
|
+
name: props.name,
|
|
1838
|
+
isDisabled: disabled
|
|
1839
|
+
}), /* @__PURE__ */ React44.createElement(Box27, {
|
|
1840
|
+
as: "button",
|
|
1841
|
+
__baseCSS: {
|
|
1842
|
+
display: "flex",
|
|
1843
|
+
position: "relative",
|
|
1844
|
+
alignItems: "center",
|
|
1845
|
+
justifyContent: "space-between",
|
|
1846
|
+
width: "100%"
|
|
1847
|
+
},
|
|
1848
|
+
css: styles.button,
|
|
1849
|
+
ref: buttonRef,
|
|
1850
|
+
...mergeProps7(buttonProps, focusProps),
|
|
1851
|
+
...stateProps
|
|
1852
|
+
}, /* @__PURE__ */ React44.createElement(Box27, {
|
|
1853
|
+
css: {
|
|
1854
|
+
overflow: "hidden",
|
|
1855
|
+
whiteSpace: "nowrap"
|
|
1856
|
+
},
|
|
1857
|
+
...valueProps
|
|
1858
|
+
}, state.selectedItem ? state.selectedItem.rendered : props.placeholder), /* @__PURE__ */ React44.createElement(Chevron, {
|
|
1859
|
+
css: styles.icon
|
|
1860
|
+
})), /* @__PURE__ */ React44.createElement(Popover, {
|
|
1861
|
+
open: state.isOpen,
|
|
1862
|
+
onClose: state.close,
|
|
1863
|
+
dismissable: true,
|
|
1864
|
+
shouldCloseOnBlur: true,
|
|
1865
|
+
minWidth: buttonRef.current ? buttonRef.current.offsetWidth : void 0,
|
|
1866
|
+
ref: overlayRef,
|
|
1867
|
+
...positionProps
|
|
1868
|
+
}, /* @__PURE__ */ React44.createElement(FocusScope3, {
|
|
1869
|
+
restoreFocus: true
|
|
1870
|
+
}, /* @__PURE__ */ React44.createElement(DismissButton2, {
|
|
1871
|
+
onDismiss: state.close
|
|
1872
|
+
}), /* @__PURE__ */ React44.createElement(ListBox, {
|
|
1873
|
+
state,
|
|
1874
|
+
variant,
|
|
1875
|
+
size,
|
|
1876
|
+
...menuProps
|
|
1877
|
+
}), /* @__PURE__ */ React44.createElement(DismissButton2, {
|
|
1878
|
+
onDismiss: state.close
|
|
1879
|
+
}))));
|
|
1880
|
+
}
|
|
1881
|
+
);
|
|
1667
1882
|
Select.Option = Item2;
|
|
1668
1883
|
Select.Section = Section;
|
|
1669
1884
|
|
|
1670
1885
|
// src/Slider/Slider.tsx
|
|
1671
|
-
import
|
|
1886
|
+
import React46, { forwardRef as forwardRef11 } from "react";
|
|
1672
1887
|
import { useSlider } from "@react-aria/slider";
|
|
1673
1888
|
import { useSliderState } from "@react-stately/slider";
|
|
1674
1889
|
import { useNumberFormatter } from "@react-aria/i18n";
|
|
1675
|
-
import { useObjectRef as
|
|
1676
|
-
import { useComponentStyles as
|
|
1890
|
+
import { useObjectRef as useObjectRef9 } from "@react-aria/utils";
|
|
1891
|
+
import { useComponentStyles as useComponentStyles26 } from "@marigold/system";
|
|
1677
1892
|
|
|
1678
1893
|
// src/Slider/Thumb.tsx
|
|
1679
|
-
import
|
|
1894
|
+
import React45, { useEffect } from "react";
|
|
1680
1895
|
import { useSliderThumb } from "@react-aria/slider";
|
|
1681
1896
|
import { mergeProps as mergeProps8 } from "@react-aria/utils";
|
|
1682
1897
|
import { useStateProps as useStateProps9 } from "@marigold/system";
|
|
@@ -1688,101 +1903,111 @@ import { VisuallyHidden } from "@react-aria/visually-hidden";
|
|
|
1688
1903
|
import { useFocusRing as useFocusRing7 } from "@react-aria/focus";
|
|
1689
1904
|
var Thumb = ({ state, trackRef, styles, ...props }) => {
|
|
1690
1905
|
const { disabled } = props;
|
|
1691
|
-
const inputRef =
|
|
1906
|
+
const inputRef = React45.useRef(null);
|
|
1692
1907
|
const { isFocusVisible, focusProps, isFocused } = useFocusRing7();
|
|
1693
1908
|
const focused = isFocused || isFocusVisible || state.isThumbDragging(0);
|
|
1694
1909
|
const stateProps = useStateProps9({
|
|
1695
1910
|
focus: focused,
|
|
1696
1911
|
disabled
|
|
1697
1912
|
});
|
|
1698
|
-
const { thumbProps, inputProps } = useSliderThumb(
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1913
|
+
const { thumbProps, inputProps } = useSliderThumb(
|
|
1914
|
+
{
|
|
1915
|
+
index: 0,
|
|
1916
|
+
trackRef,
|
|
1917
|
+
inputRef,
|
|
1918
|
+
isDisabled: disabled
|
|
1919
|
+
},
|
|
1920
|
+
state
|
|
1921
|
+
);
|
|
1704
1922
|
useEffect(() => {
|
|
1705
1923
|
state.setThumbEditable(0, !disabled);
|
|
1706
1924
|
}, [disabled, state]);
|
|
1707
|
-
return /* @__PURE__ */
|
|
1708
|
-
__baseCSS: {
|
|
1709
|
-
|
|
1710
|
-
top: 16,
|
|
1711
|
-
transform: "translateX(-50%)",
|
|
1712
|
-
left: `${state.getThumbPercent(0) * 100}%`
|
|
1713
|
-
}
|
|
1714
|
-
}, /* @__PURE__ */ React43.createElement(Box, {
|
|
1925
|
+
return /* @__PURE__ */ React45.createElement(Box, {
|
|
1926
|
+
__baseCSS: { top: "50%" },
|
|
1927
|
+
css: styles,
|
|
1715
1928
|
...thumbProps,
|
|
1716
|
-
__baseCSS: styles,
|
|
1717
1929
|
...stateProps
|
|
1718
|
-
}, /* @__PURE__ */
|
|
1930
|
+
}, /* @__PURE__ */ React45.createElement(VisuallyHidden, null, /* @__PURE__ */ React45.createElement(Box, {
|
|
1719
1931
|
as: "input",
|
|
1720
1932
|
type: "range",
|
|
1721
1933
|
ref: inputRef,
|
|
1722
1934
|
...mergeProps8(inputProps, focusProps)
|
|
1723
|
-
})))
|
|
1935
|
+
})));
|
|
1724
1936
|
};
|
|
1725
1937
|
|
|
1726
1938
|
// src/Slider/Slider.tsx
|
|
1727
|
-
var Slider =
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
}
|
|
1939
|
+
var Slider = forwardRef11(
|
|
1940
|
+
({ variant, size, width = "100%", ...props }, ref) => {
|
|
1941
|
+
const { formatOptions } = props;
|
|
1942
|
+
const trackRef = useObjectRef9(ref);
|
|
1943
|
+
const numberFormatter = useNumberFormatter(formatOptions);
|
|
1944
|
+
const state = useSliderState({ ...props, numberFormatter });
|
|
1945
|
+
const { groupProps, trackProps, labelProps, outputProps } = useSlider(
|
|
1946
|
+
{
|
|
1947
|
+
label: props.children,
|
|
1948
|
+
...props
|
|
1949
|
+
},
|
|
1950
|
+
state,
|
|
1951
|
+
trackRef
|
|
1952
|
+
);
|
|
1953
|
+
const styles = useComponentStyles26(
|
|
1954
|
+
"Slider",
|
|
1955
|
+
{ variant, size },
|
|
1956
|
+
{ parts: ["track", "thumb", "label", "output"] }
|
|
1957
|
+
);
|
|
1958
|
+
return /* @__PURE__ */ React46.createElement(Box, {
|
|
1959
|
+
__baseCSS: {
|
|
1960
|
+
display: "flex",
|
|
1961
|
+
flexDirection: "column",
|
|
1962
|
+
touchAction: "none",
|
|
1963
|
+
width
|
|
1964
|
+
},
|
|
1965
|
+
...groupProps
|
|
1966
|
+
}, /* @__PURE__ */ React46.createElement(Box, {
|
|
1967
|
+
__baseCSS: { display: "flex", alignSelf: "stretch" }
|
|
1968
|
+
}, props.children && /* @__PURE__ */ React46.createElement(Box, {
|
|
1969
|
+
as: "label",
|
|
1970
|
+
__baseCSS: styles.label,
|
|
1971
|
+
...labelProps
|
|
1972
|
+
}, props.children), /* @__PURE__ */ React46.createElement(Box, {
|
|
1973
|
+
as: "output",
|
|
1974
|
+
...outputProps,
|
|
1975
|
+
__baseCSS: { flex: "1 0 auto", textAlign: "end" },
|
|
1976
|
+
css: styles.output
|
|
1977
|
+
}, state.getThumbValueLabel(0))), /* @__PURE__ */ React46.createElement(Box, {
|
|
1978
|
+
...trackProps,
|
|
1979
|
+
ref: trackRef,
|
|
1980
|
+
__baseCSS: {
|
|
1981
|
+
height: 32,
|
|
1982
|
+
width: "100%",
|
|
1983
|
+
cursor: props.disabled ? "not-allowed" : "pointer"
|
|
1984
|
+
}
|
|
1985
|
+
}, /* @__PURE__ */ React46.createElement(Box, {
|
|
1986
|
+
__baseCSS: {
|
|
1987
|
+
top: "50%",
|
|
1988
|
+
transform: "translateY(-50%)"
|
|
1989
|
+
},
|
|
1990
|
+
css: styles.track
|
|
1991
|
+
}), /* @__PURE__ */ React46.createElement(Thumb, {
|
|
1992
|
+
state,
|
|
1993
|
+
trackRef,
|
|
1994
|
+
disabled: props.disabled,
|
|
1995
|
+
styles: styles.thumb
|
|
1996
|
+
})));
|
|
1997
|
+
}
|
|
1998
|
+
);
|
|
1774
1999
|
|
|
1775
2000
|
// src/Split/Split.tsx
|
|
1776
|
-
import
|
|
1777
|
-
import { Box as
|
|
1778
|
-
var Split = (props) => /* @__PURE__ */
|
|
2001
|
+
import React47 from "react";
|
|
2002
|
+
import { Box as Box28 } from "@marigold/system";
|
|
2003
|
+
var Split = (props) => /* @__PURE__ */ React47.createElement(Box28, {
|
|
1779
2004
|
...props,
|
|
1780
2005
|
role: "separator",
|
|
1781
2006
|
css: { flexGrow: 1 }
|
|
1782
2007
|
});
|
|
1783
2008
|
|
|
1784
2009
|
// src/Stack/Stack.tsx
|
|
1785
|
-
import
|
|
2010
|
+
import React48 from "react";
|
|
1786
2011
|
var ALIGNMENT_X2 = {
|
|
1787
2012
|
left: "flex-start",
|
|
1788
2013
|
center: "center",
|
|
@@ -1800,7 +2025,7 @@ var Stack = ({
|
|
|
1800
2025
|
alignY = "top",
|
|
1801
2026
|
stretch = false,
|
|
1802
2027
|
...props
|
|
1803
|
-
}) => /* @__PURE__ */
|
|
2028
|
+
}) => /* @__PURE__ */ React48.createElement(Box, {
|
|
1804
2029
|
css: {
|
|
1805
2030
|
display: "flex",
|
|
1806
2031
|
flexDirection: "column",
|
|
@@ -1814,105 +2039,111 @@ var Stack = ({
|
|
|
1814
2039
|
}, children);
|
|
1815
2040
|
|
|
1816
2041
|
// src/Switch/Switch.tsx
|
|
1817
|
-
import
|
|
2042
|
+
import React49, { forwardRef as forwardRef12 } from "react";
|
|
1818
2043
|
import { useFocusRing as useFocusRing8 } from "@react-aria/focus";
|
|
1819
2044
|
import { useSwitch } from "@react-aria/switch";
|
|
1820
|
-
import { useObjectRef as
|
|
2045
|
+
import { useObjectRef as useObjectRef10 } from "@react-aria/utils";
|
|
1821
2046
|
import { useToggleState as useToggleState2 } from "@react-stately/toggle";
|
|
1822
2047
|
import {
|
|
1823
|
-
useComponentStyles as
|
|
2048
|
+
useComponentStyles as useComponentStyles27,
|
|
1824
2049
|
useStateProps as useStateProps10
|
|
1825
2050
|
} from "@marigold/system";
|
|
1826
|
-
var Switch =
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
readOnly,
|
|
1833
|
-
defaultChecked,
|
|
1834
|
-
...rest
|
|
1835
|
-
}, ref) => {
|
|
1836
|
-
const inputRef = useObjectRef8(ref);
|
|
1837
|
-
const props = {
|
|
1838
|
-
isSelected: checked,
|
|
1839
|
-
isDisabled: disabled,
|
|
1840
|
-
isReadOnly: readOnly,
|
|
1841
|
-
defaultSelected: defaultChecked,
|
|
1842
|
-
...rest
|
|
1843
|
-
};
|
|
1844
|
-
const state = useToggleState2(props);
|
|
1845
|
-
const { inputProps } = useSwitch(props, state, inputRef);
|
|
1846
|
-
const { isFocusVisible, focusProps } = useFocusRing8();
|
|
1847
|
-
const stateProps = useStateProps10({
|
|
1848
|
-
checked: state.isSelected,
|
|
2051
|
+
var Switch = forwardRef12(
|
|
2052
|
+
({
|
|
2053
|
+
variant,
|
|
2054
|
+
size,
|
|
2055
|
+
width = "100%",
|
|
2056
|
+
checked,
|
|
1849
2057
|
disabled,
|
|
1850
2058
|
readOnly,
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
},
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
2059
|
+
defaultChecked,
|
|
2060
|
+
...rest
|
|
2061
|
+
}, ref) => {
|
|
2062
|
+
const inputRef = useObjectRef10(ref);
|
|
2063
|
+
const props = {
|
|
2064
|
+
isSelected: checked,
|
|
2065
|
+
isDisabled: disabled,
|
|
2066
|
+
isReadOnly: readOnly,
|
|
2067
|
+
defaultSelected: defaultChecked,
|
|
2068
|
+
...rest
|
|
2069
|
+
};
|
|
2070
|
+
const state = useToggleState2(props);
|
|
2071
|
+
const { inputProps } = useSwitch(props, state, inputRef);
|
|
2072
|
+
const { isFocusVisible, focusProps } = useFocusRing8();
|
|
2073
|
+
const stateProps = useStateProps10({
|
|
2074
|
+
checked: state.isSelected,
|
|
2075
|
+
disabled,
|
|
2076
|
+
readOnly,
|
|
2077
|
+
focus: isFocusVisible
|
|
2078
|
+
});
|
|
2079
|
+
const styles = useComponentStyles27(
|
|
2080
|
+
"Switch",
|
|
2081
|
+
{ variant, size },
|
|
2082
|
+
{ parts: ["container", "label", "track", "thumb"] }
|
|
2083
|
+
);
|
|
2084
|
+
return /* @__PURE__ */ React49.createElement(Box, {
|
|
2085
|
+
as: "label",
|
|
2086
|
+
__baseCSS: {
|
|
2087
|
+
display: "flex",
|
|
2088
|
+
alignItems: "center",
|
|
2089
|
+
justifyContent: "space-between",
|
|
2090
|
+
gap: "1ch",
|
|
2091
|
+
position: "relative",
|
|
2092
|
+
width
|
|
2093
|
+
},
|
|
2094
|
+
css: styles.container
|
|
2095
|
+
}, /* @__PURE__ */ React49.createElement(Box, {
|
|
2096
|
+
as: "input",
|
|
2097
|
+
ref: inputRef,
|
|
2098
|
+
css: {
|
|
2099
|
+
position: "absolute",
|
|
2100
|
+
width: "100%",
|
|
2101
|
+
height: "100%",
|
|
2102
|
+
top: 0,
|
|
2103
|
+
left: 0,
|
|
2104
|
+
zIndex: 1,
|
|
2105
|
+
opacity: 1e-4,
|
|
2106
|
+
cursor: inputProps.disabled ? "not-allowed" : "pointer"
|
|
2107
|
+
},
|
|
2108
|
+
...inputProps,
|
|
2109
|
+
...focusProps
|
|
2110
|
+
}), props.children && /* @__PURE__ */ React49.createElement(Box, {
|
|
2111
|
+
css: styles.label
|
|
2112
|
+
}, props.children), /* @__PURE__ */ React49.createElement(Box, {
|
|
2113
|
+
__baseCSS: {
|
|
2114
|
+
position: "relative",
|
|
2115
|
+
width: 48,
|
|
2116
|
+
height: 24,
|
|
2117
|
+
bg: "#dee2e6",
|
|
2118
|
+
borderRadius: 20
|
|
2119
|
+
},
|
|
2120
|
+
css: styles.track,
|
|
2121
|
+
...stateProps
|
|
2122
|
+
}, /* @__PURE__ */ React49.createElement(Box, {
|
|
2123
|
+
__baseCSS: {
|
|
2124
|
+
display: "block",
|
|
2125
|
+
position: "absolute",
|
|
2126
|
+
top: 1,
|
|
2127
|
+
left: 0,
|
|
2128
|
+
willChange: "transform",
|
|
2129
|
+
transform: "translateX(1px)",
|
|
2130
|
+
transition: "all 0.1s cubic-bezier(.7, 0, .3, 1)",
|
|
2131
|
+
height: 22,
|
|
2132
|
+
width: 22,
|
|
2133
|
+
borderRadius: 9999,
|
|
2134
|
+
bg: "#fff",
|
|
2135
|
+
"&:checked": {
|
|
2136
|
+
transform: "translateX(calc(47px - 100%))"
|
|
2137
|
+
}
|
|
2138
|
+
},
|
|
2139
|
+
css: styles.thumb,
|
|
2140
|
+
...stateProps
|
|
2141
|
+
})));
|
|
2142
|
+
}
|
|
2143
|
+
);
|
|
1913
2144
|
|
|
1914
2145
|
// src/Table/Table.tsx
|
|
1915
|
-
import
|
|
2146
|
+
import React58, { useRef as useRef16 } from "react";
|
|
1916
2147
|
import { useTable } from "@react-aria/table";
|
|
1917
2148
|
import {
|
|
1918
2149
|
Cell,
|
|
@@ -1923,41 +2154,45 @@ import {
|
|
|
1923
2154
|
useTableState
|
|
1924
2155
|
} from "@react-stately/table";
|
|
1925
2156
|
import {
|
|
1926
|
-
Box as
|
|
1927
|
-
useComponentStyles as
|
|
2157
|
+
Box as Box34,
|
|
2158
|
+
useComponentStyles as useComponentStyles28
|
|
1928
2159
|
} from "@marigold/system";
|
|
1929
2160
|
|
|
1930
2161
|
// src/Table/Context.tsx
|
|
1931
|
-
import { createContext as
|
|
1932
|
-
var TableContext =
|
|
1933
|
-
var useTableContext = () =>
|
|
2162
|
+
import { createContext as createContext7, useContext as useContext7 } from "react";
|
|
2163
|
+
var TableContext = createContext7({});
|
|
2164
|
+
var useTableContext = () => useContext7(TableContext);
|
|
1934
2165
|
|
|
1935
2166
|
// src/Table/TableBody.tsx
|
|
1936
|
-
import
|
|
2167
|
+
import React50 from "react";
|
|
1937
2168
|
import { useTableRowGroup } from "@react-aria/table";
|
|
1938
2169
|
var TableBody = ({ children }) => {
|
|
1939
2170
|
const { rowGroupProps } = useTableRowGroup();
|
|
1940
|
-
return /* @__PURE__ */
|
|
2171
|
+
return /* @__PURE__ */ React50.createElement("tbody", {
|
|
1941
2172
|
...rowGroupProps
|
|
1942
2173
|
}, children);
|
|
1943
2174
|
};
|
|
1944
2175
|
|
|
1945
2176
|
// src/Table/TableCell.tsx
|
|
1946
|
-
import
|
|
2177
|
+
import React51, { useRef as useRef10 } from "react";
|
|
1947
2178
|
import { useTableCell } from "@react-aria/table";
|
|
1948
2179
|
import { useFocusRing as useFocusRing9 } from "@react-aria/focus";
|
|
1949
2180
|
import { mergeProps as mergeProps9 } from "@react-aria/utils";
|
|
1950
|
-
import { Box as
|
|
2181
|
+
import { Box as Box29, useStateProps as useStateProps11 } from "@marigold/system";
|
|
1951
2182
|
var TableCell = ({ cell }) => {
|
|
1952
|
-
const ref =
|
|
2183
|
+
const ref = useRef10(null);
|
|
1953
2184
|
const { state, styles } = useTableContext();
|
|
1954
2185
|
const disabled = state.disabledKeys.has(cell.parentKey);
|
|
1955
|
-
const { gridCellProps } = useTableCell(
|
|
1956
|
-
|
|
1957
|
-
|
|
2186
|
+
const { gridCellProps } = useTableCell(
|
|
2187
|
+
{
|
|
2188
|
+
node: cell
|
|
2189
|
+
},
|
|
2190
|
+
state,
|
|
2191
|
+
ref
|
|
2192
|
+
);
|
|
1958
2193
|
const { focusProps, isFocusVisible } = useFocusRing9();
|
|
1959
2194
|
const stateProps = useStateProps11({ disabled, focusVisible: isFocusVisible });
|
|
1960
|
-
return /* @__PURE__ */
|
|
2195
|
+
return /* @__PURE__ */ React51.createElement(Box29, {
|
|
1961
2196
|
as: "td",
|
|
1962
2197
|
ref,
|
|
1963
2198
|
css: styles.cell,
|
|
@@ -1967,11 +2202,11 @@ var TableCell = ({ cell }) => {
|
|
|
1967
2202
|
};
|
|
1968
2203
|
|
|
1969
2204
|
// src/Table/TableCheckboxCell.tsx
|
|
1970
|
-
import
|
|
2205
|
+
import React52, { useRef as useRef11 } from "react";
|
|
1971
2206
|
import { useTableCell as useTableCell2, useTableSelectionCheckbox } from "@react-aria/table";
|
|
1972
2207
|
import { useFocusRing as useFocusRing10 } from "@react-aria/focus";
|
|
1973
2208
|
import { mergeProps as mergeProps10 } from "@react-aria/utils";
|
|
1974
|
-
import { Box as
|
|
2209
|
+
import { Box as Box30, useStateProps as useStateProps12 } from "@marigold/system";
|
|
1975
2210
|
|
|
1976
2211
|
// src/Table/utils.ts
|
|
1977
2212
|
var mapCheckboxProps = ({
|
|
@@ -1995,16 +2230,22 @@ var mapCheckboxProps = ({
|
|
|
1995
2230
|
|
|
1996
2231
|
// src/Table/TableCheckboxCell.tsx
|
|
1997
2232
|
var TableCheckboxCell = ({ cell }) => {
|
|
1998
|
-
const ref =
|
|
2233
|
+
const ref = useRef11(null);
|
|
1999
2234
|
const { state, styles } = useTableContext();
|
|
2000
2235
|
const disabled = state.disabledKeys.has(cell.parentKey);
|
|
2001
|
-
const { gridCellProps } = useTableCell2(
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2236
|
+
const { gridCellProps } = useTableCell2(
|
|
2237
|
+
{
|
|
2238
|
+
node: cell
|
|
2239
|
+
},
|
|
2240
|
+
state,
|
|
2241
|
+
ref
|
|
2242
|
+
);
|
|
2243
|
+
const { checkboxProps } = mapCheckboxProps(
|
|
2244
|
+
useTableSelectionCheckbox({ key: cell.parentKey }, state)
|
|
2245
|
+
);
|
|
2005
2246
|
const { focusProps, isFocusVisible } = useFocusRing10();
|
|
2006
2247
|
const stateProps = useStateProps12({ disabled, focusVisible: isFocusVisible });
|
|
2007
|
-
return /* @__PURE__ */
|
|
2248
|
+
return /* @__PURE__ */ React52.createElement(Box30, {
|
|
2008
2249
|
as: "td",
|
|
2009
2250
|
ref,
|
|
2010
2251
|
__baseCSS: {
|
|
@@ -2015,22 +2256,22 @@ var TableCheckboxCell = ({ cell }) => {
|
|
|
2015
2256
|
css: styles.cell,
|
|
2016
2257
|
...mergeProps10(gridCellProps, focusProps),
|
|
2017
2258
|
...stateProps
|
|
2018
|
-
}, /* @__PURE__ */
|
|
2259
|
+
}, /* @__PURE__ */ React52.createElement(Checkbox, {
|
|
2019
2260
|
...checkboxProps
|
|
2020
2261
|
}));
|
|
2021
2262
|
};
|
|
2022
2263
|
|
|
2023
2264
|
// src/Table/TableColumnHeader.tsx
|
|
2024
|
-
import
|
|
2265
|
+
import React53, { useRef as useRef12 } from "react";
|
|
2025
2266
|
import { useFocusRing as useFocusRing11 } from "@react-aria/focus";
|
|
2026
|
-
import { useHover as
|
|
2267
|
+
import { useHover as useHover6 } from "@react-aria/interactions";
|
|
2027
2268
|
import { useTableColumnHeader } from "@react-aria/table";
|
|
2028
2269
|
import { mergeProps as mergeProps11 } from "@react-aria/utils";
|
|
2029
|
-
import { Box as
|
|
2270
|
+
import { Box as Box31, useStateProps as useStateProps13 } from "@marigold/system";
|
|
2030
2271
|
var SortIndicator = ({
|
|
2031
2272
|
direction = "ascending",
|
|
2032
2273
|
visible
|
|
2033
|
-
}) => /* @__PURE__ */
|
|
2274
|
+
}) => /* @__PURE__ */ React53.createElement(Box31, {
|
|
2034
2275
|
as: "span",
|
|
2035
2276
|
role: "presentation",
|
|
2036
2277
|
"aria-hidden": "true",
|
|
@@ -2042,70 +2283,78 @@ var SortIndicator = ({
|
|
|
2042
2283
|
}, direction === "ascending" ? "\u25B2" : "\u25BC");
|
|
2043
2284
|
var TableColumnHeader = ({ column }) => {
|
|
2044
2285
|
var _a, _b;
|
|
2045
|
-
const ref =
|
|
2286
|
+
const ref = useRef12(null);
|
|
2046
2287
|
const { state, styles } = useTableContext();
|
|
2047
|
-
const { columnHeaderProps } = useTableColumnHeader(
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2288
|
+
const { columnHeaderProps } = useTableColumnHeader(
|
|
2289
|
+
{
|
|
2290
|
+
node: column
|
|
2291
|
+
},
|
|
2292
|
+
state,
|
|
2293
|
+
ref
|
|
2294
|
+
);
|
|
2295
|
+
const { hoverProps, isHovered } = useHover6({});
|
|
2051
2296
|
const { focusProps, isFocusVisible } = useFocusRing11();
|
|
2052
2297
|
const stateProps = useStateProps13({
|
|
2053
2298
|
hover: isHovered,
|
|
2054
2299
|
focusVisible: isFocusVisible
|
|
2055
2300
|
});
|
|
2056
|
-
return /* @__PURE__ */
|
|
2301
|
+
return /* @__PURE__ */ React53.createElement(Box31, {
|
|
2057
2302
|
as: "th",
|
|
2058
2303
|
colSpan: column.colspan,
|
|
2059
2304
|
ref,
|
|
2060
2305
|
css: styles.header,
|
|
2061
2306
|
...mergeProps11(columnHeaderProps, hoverProps, focusProps),
|
|
2062
2307
|
...stateProps
|
|
2063
|
-
}, column.rendered, column.props.allowsSorting && /* @__PURE__ */
|
|
2308
|
+
}, column.rendered, column.props.allowsSorting && /* @__PURE__ */ React53.createElement(SortIndicator, {
|
|
2064
2309
|
direction: (_a = state.sortDescriptor) == null ? void 0 : _a.direction,
|
|
2065
2310
|
visible: ((_b = state.sortDescriptor) == null ? void 0 : _b.column) === column.key
|
|
2066
2311
|
}));
|
|
2067
2312
|
};
|
|
2068
2313
|
|
|
2069
2314
|
// src/Table/TableHeader.tsx
|
|
2070
|
-
import
|
|
2315
|
+
import React54 from "react";
|
|
2071
2316
|
import { useTableRowGroup as useTableRowGroup2 } from "@react-aria/table";
|
|
2072
2317
|
var TableHeader = ({ children }) => {
|
|
2073
2318
|
const { rowGroupProps } = useTableRowGroup2();
|
|
2074
|
-
return /* @__PURE__ */
|
|
2319
|
+
return /* @__PURE__ */ React54.createElement("thead", {
|
|
2075
2320
|
...rowGroupProps
|
|
2076
2321
|
}, children);
|
|
2077
2322
|
};
|
|
2078
2323
|
|
|
2079
2324
|
// src/Table/TableHeaderRow.tsx
|
|
2080
|
-
import
|
|
2325
|
+
import React55, { useRef as useRef13 } from "react";
|
|
2081
2326
|
import { useTableHeaderRow } from "@react-aria/table";
|
|
2082
2327
|
var TableHeaderRow = ({ item, children }) => {
|
|
2083
2328
|
const { state } = useTableContext();
|
|
2084
|
-
const ref =
|
|
2329
|
+
const ref = useRef13(null);
|
|
2085
2330
|
const { rowProps } = useTableHeaderRow({ node: item }, state, ref);
|
|
2086
|
-
return /* @__PURE__ */
|
|
2331
|
+
return /* @__PURE__ */ React55.createElement("tr", {
|
|
2087
2332
|
...rowProps,
|
|
2088
2333
|
ref
|
|
2089
2334
|
}, children);
|
|
2090
2335
|
};
|
|
2091
2336
|
|
|
2092
2337
|
// src/Table/TableRow.tsx
|
|
2093
|
-
import
|
|
2338
|
+
import React56, { useRef as useRef14 } from "react";
|
|
2094
2339
|
import { useFocusRing as useFocusRing12 } from "@react-aria/focus";
|
|
2095
|
-
import { useHover as
|
|
2340
|
+
import { useHover as useHover7 } from "@react-aria/interactions";
|
|
2096
2341
|
import { useTableRow } from "@react-aria/table";
|
|
2097
2342
|
import { mergeProps as mergeProps12 } from "@react-aria/utils";
|
|
2098
|
-
import { Box as
|
|
2343
|
+
import { Box as Box32, useStateProps as useStateProps14 } from "@marigold/system";
|
|
2099
2344
|
var TableRow = ({ children, row }) => {
|
|
2100
|
-
const ref =
|
|
2345
|
+
const ref = useRef14(null);
|
|
2101
2346
|
const { state, styles } = useTableContext();
|
|
2102
|
-
const { rowProps, isPressed } = useTableRow(
|
|
2103
|
-
|
|
2104
|
-
|
|
2347
|
+
const { rowProps, isPressed } = useTableRow(
|
|
2348
|
+
{
|
|
2349
|
+
node: row
|
|
2350
|
+
},
|
|
2351
|
+
state,
|
|
2352
|
+
ref
|
|
2353
|
+
);
|
|
2105
2354
|
const disabled = state.disabledKeys.has(row.key);
|
|
2106
2355
|
const selected = state.selectionManager.isSelected(row.key);
|
|
2107
2356
|
const { focusProps, isFocusVisible } = useFocusRing12({ within: true });
|
|
2108
|
-
const { hoverProps, isHovered } =
|
|
2357
|
+
const { hoverProps, isHovered } = useHover7({ isDisabled: disabled });
|
|
2109
2358
|
const stateProps = useStateProps14({
|
|
2110
2359
|
disabled,
|
|
2111
2360
|
selected,
|
|
@@ -2113,7 +2362,7 @@ var TableRow = ({ children, row }) => {
|
|
|
2113
2362
|
focusVisible: isFocusVisible,
|
|
2114
2363
|
active: isPressed
|
|
2115
2364
|
});
|
|
2116
|
-
return /* @__PURE__ */
|
|
2365
|
+
return /* @__PURE__ */ React56.createElement(Box32, {
|
|
2117
2366
|
as: "tr",
|
|
2118
2367
|
ref,
|
|
2119
2368
|
css: styles.row,
|
|
@@ -2123,29 +2372,33 @@ var TableRow = ({ children, row }) => {
|
|
|
2123
2372
|
};
|
|
2124
2373
|
|
|
2125
2374
|
// src/Table/TableSelectAllCell.tsx
|
|
2126
|
-
import
|
|
2375
|
+
import React57, { useRef as useRef15 } from "react";
|
|
2127
2376
|
import { useFocusRing as useFocusRing13 } from "@react-aria/focus";
|
|
2128
|
-
import { useHover as
|
|
2377
|
+
import { useHover as useHover8 } from "@react-aria/interactions";
|
|
2129
2378
|
import {
|
|
2130
2379
|
useTableColumnHeader as useTableColumnHeader2,
|
|
2131
2380
|
useTableSelectAllCheckbox
|
|
2132
2381
|
} from "@react-aria/table";
|
|
2133
2382
|
import { mergeProps as mergeProps13 } from "@react-aria/utils";
|
|
2134
|
-
import { Box as
|
|
2383
|
+
import { Box as Box33, useStateProps as useStateProps15 } from "@marigold/system";
|
|
2135
2384
|
var TableSelectAllCell = ({ column }) => {
|
|
2136
|
-
const ref =
|
|
2385
|
+
const ref = useRef15(null);
|
|
2137
2386
|
const { state, styles } = useTableContext();
|
|
2138
|
-
const { columnHeaderProps } = useTableColumnHeader2(
|
|
2139
|
-
|
|
2140
|
-
|
|
2387
|
+
const { columnHeaderProps } = useTableColumnHeader2(
|
|
2388
|
+
{
|
|
2389
|
+
node: column
|
|
2390
|
+
},
|
|
2391
|
+
state,
|
|
2392
|
+
ref
|
|
2393
|
+
);
|
|
2141
2394
|
const { checkboxProps } = mapCheckboxProps(useTableSelectAllCheckbox(state));
|
|
2142
|
-
const { hoverProps, isHovered } =
|
|
2395
|
+
const { hoverProps, isHovered } = useHover8({});
|
|
2143
2396
|
const { focusProps, isFocusVisible } = useFocusRing13();
|
|
2144
2397
|
const stateProps = useStateProps15({
|
|
2145
2398
|
hover: isHovered,
|
|
2146
2399
|
focusVisible: isFocusVisible
|
|
2147
2400
|
});
|
|
2148
|
-
return /* @__PURE__ */
|
|
2401
|
+
return /* @__PURE__ */ React57.createElement(Box33, {
|
|
2149
2402
|
as: "th",
|
|
2150
2403
|
ref,
|
|
2151
2404
|
__baseCSS: {
|
|
@@ -2156,7 +2409,7 @@ var TableSelectAllCell = ({ column }) => {
|
|
|
2156
2409
|
css: styles.header,
|
|
2157
2410
|
...mergeProps13(columnHeaderProps, hoverProps, focusProps),
|
|
2158
2411
|
...stateProps
|
|
2159
|
-
}, /* @__PURE__ */
|
|
2412
|
+
}, /* @__PURE__ */ React57.createElement(Checkbox, {
|
|
2160
2413
|
...checkboxProps
|
|
2161
2414
|
}));
|
|
2162
2415
|
};
|
|
@@ -2168,17 +2421,21 @@ var Table = ({
|
|
|
2168
2421
|
stretch,
|
|
2169
2422
|
...props
|
|
2170
2423
|
}) => {
|
|
2171
|
-
const tableRef =
|
|
2424
|
+
const tableRef = useRef16(null);
|
|
2172
2425
|
const state = useTableState({
|
|
2173
2426
|
...props,
|
|
2174
2427
|
showSelectionCheckboxes: props.selectionMode === "multiple" && props.selectionBehavior !== "replace"
|
|
2175
2428
|
});
|
|
2176
2429
|
const { gridProps } = useTable(props, state, tableRef);
|
|
2177
|
-
const styles =
|
|
2430
|
+
const styles = useComponentStyles28(
|
|
2431
|
+
"Table",
|
|
2432
|
+
{ variant, size },
|
|
2433
|
+
{ parts: ["table", "header", "row", "cell"] }
|
|
2434
|
+
);
|
|
2178
2435
|
const { collection } = state;
|
|
2179
|
-
return /* @__PURE__ */
|
|
2436
|
+
return /* @__PURE__ */ React58.createElement(TableContext.Provider, {
|
|
2180
2437
|
value: { state, styles }
|
|
2181
|
-
}, /* @__PURE__ */
|
|
2438
|
+
}, /* @__PURE__ */ React58.createElement(Box34, {
|
|
2182
2439
|
as: "table",
|
|
2183
2440
|
ref: tableRef,
|
|
2184
2441
|
__baseCSS: {
|
|
@@ -2187,31 +2444,35 @@ var Table = ({
|
|
|
2187
2444
|
},
|
|
2188
2445
|
css: styles.table,
|
|
2189
2446
|
...gridProps
|
|
2190
|
-
}, /* @__PURE__ */
|
|
2447
|
+
}, /* @__PURE__ */ React58.createElement(TableHeader, null, collection.headerRows.map((headerRow) => /* @__PURE__ */ React58.createElement(TableHeaderRow, {
|
|
2191
2448
|
key: headerRow.key,
|
|
2192
2449
|
item: headerRow
|
|
2193
|
-
}, [...headerRow.childNodes].map(
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2450
|
+
}, [...headerRow.childNodes].map(
|
|
2451
|
+
(column) => {
|
|
2452
|
+
var _a;
|
|
2453
|
+
return ((_a = column.props) == null ? void 0 : _a.isSelectionCell) ? /* @__PURE__ */ React58.createElement(TableSelectAllCell, {
|
|
2454
|
+
key: column.key,
|
|
2455
|
+
column
|
|
2456
|
+
}) : /* @__PURE__ */ React58.createElement(TableColumnHeader, {
|
|
2457
|
+
key: column.key,
|
|
2458
|
+
column
|
|
2459
|
+
});
|
|
2460
|
+
}
|
|
2461
|
+
)))), /* @__PURE__ */ React58.createElement(TableBody, null, [...collection.body.childNodes].map((row) => /* @__PURE__ */ React58.createElement(TableRow, {
|
|
2203
2462
|
key: row.key,
|
|
2204
2463
|
row
|
|
2205
|
-
}, [...row.childNodes].map(
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2464
|
+
}, [...row.childNodes].map(
|
|
2465
|
+
(cell) => {
|
|
2466
|
+
var _a;
|
|
2467
|
+
return ((_a = cell.props) == null ? void 0 : _a.isSelectionCell) ? /* @__PURE__ */ React58.createElement(TableCheckboxCell, {
|
|
2468
|
+
key: cell.key,
|
|
2469
|
+
cell
|
|
2470
|
+
}) : /* @__PURE__ */ React58.createElement(TableCell, {
|
|
2471
|
+
key: cell.key,
|
|
2472
|
+
cell
|
|
2473
|
+
});
|
|
2474
|
+
}
|
|
2475
|
+
))))));
|
|
2215
2476
|
};
|
|
2216
2477
|
Table.Body = Body;
|
|
2217
2478
|
Table.Cell = Cell;
|
|
@@ -2220,11 +2481,11 @@ Table.Header = Header2;
|
|
|
2220
2481
|
Table.Row = Row;
|
|
2221
2482
|
|
|
2222
2483
|
// src/Text/Text.tsx
|
|
2223
|
-
import
|
|
2484
|
+
import React59 from "react";
|
|
2224
2485
|
import {
|
|
2225
|
-
useComponentStyles as
|
|
2486
|
+
useComponentStyles as useComponentStyles29
|
|
2226
2487
|
} from "@marigold/system";
|
|
2227
|
-
import { Box as
|
|
2488
|
+
import { Box as Box35 } from "@marigold/system";
|
|
2228
2489
|
var Text = ({
|
|
2229
2490
|
variant,
|
|
2230
2491
|
size,
|
|
@@ -2236,11 +2497,11 @@ var Text = ({
|
|
|
2236
2497
|
children,
|
|
2237
2498
|
...props
|
|
2238
2499
|
}) => {
|
|
2239
|
-
const styles =
|
|
2500
|
+
const styles = useComponentStyles29("Text", {
|
|
2240
2501
|
variant,
|
|
2241
2502
|
size
|
|
2242
2503
|
});
|
|
2243
|
-
return /* @__PURE__ */
|
|
2504
|
+
return /* @__PURE__ */ React59.createElement(Box35, {
|
|
2244
2505
|
as: "p",
|
|
2245
2506
|
...props,
|
|
2246
2507
|
css: { color, cursor, outline, fontSize, textAlign: align, ...styles }
|
|
@@ -2248,152 +2509,164 @@ var Text = ({
|
|
|
2248
2509
|
};
|
|
2249
2510
|
|
|
2250
2511
|
// src/TextArea/TextArea.tsx
|
|
2251
|
-
import
|
|
2252
|
-
import { useHover as
|
|
2512
|
+
import React60, { forwardRef as forwardRef13 } from "react";
|
|
2513
|
+
import { useHover as useHover9 } from "@react-aria/interactions";
|
|
2253
2514
|
import { useFocusRing as useFocusRing14 } from "@react-aria/focus";
|
|
2254
2515
|
import { useTextField } from "@react-aria/textfield";
|
|
2255
|
-
import { useObjectRef as
|
|
2516
|
+
import { useObjectRef as useObjectRef11 } from "@react-aria/utils";
|
|
2256
2517
|
import {
|
|
2257
|
-
Box as
|
|
2258
|
-
useComponentStyles as
|
|
2518
|
+
Box as Box36,
|
|
2519
|
+
useComponentStyles as useComponentStyles30,
|
|
2259
2520
|
useStateProps as useStateProps16
|
|
2260
2521
|
} from "@marigold/system";
|
|
2261
|
-
var TextArea =
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
required,
|
|
2267
|
-
readOnly,
|
|
2268
|
-
error,
|
|
2269
|
-
rows,
|
|
2270
|
-
...props
|
|
2271
|
-
}, ref) => {
|
|
2272
|
-
const { label, description, errorMessage } = props;
|
|
2273
|
-
const textAreaRef = useObjectRef9(ref);
|
|
2274
|
-
const { labelProps, inputProps, descriptionProps, errorMessageProps } = useTextField({
|
|
2275
|
-
inputElementType: "textarea",
|
|
2276
|
-
isDisabled: disabled,
|
|
2277
|
-
isRequired: required,
|
|
2278
|
-
isReadOnly: readOnly,
|
|
2279
|
-
validationState: error ? "invalid" : "valid",
|
|
2280
|
-
...props
|
|
2281
|
-
}, textAreaRef);
|
|
2282
|
-
const { hoverProps, isHovered } = useHover8({});
|
|
2283
|
-
const { focusProps, isFocusVisible } = useFocusRing14();
|
|
2284
|
-
const stateProps = useStateProps16({
|
|
2285
|
-
hover: isHovered,
|
|
2286
|
-
focus: isFocusVisible,
|
|
2522
|
+
var TextArea = forwardRef13(
|
|
2523
|
+
({
|
|
2524
|
+
variant,
|
|
2525
|
+
size,
|
|
2526
|
+
width,
|
|
2287
2527
|
disabled,
|
|
2288
|
-
readOnly,
|
|
2289
|
-
error
|
|
2290
|
-
});
|
|
2291
|
-
const styles = useComponentStyles29("TextArea", { variant, size });
|
|
2292
|
-
return /* @__PURE__ */ React58.createElement(FieldBase, {
|
|
2293
|
-
label,
|
|
2294
|
-
labelProps,
|
|
2295
2528
|
required,
|
|
2296
|
-
|
|
2297
|
-
descriptionProps,
|
|
2529
|
+
readOnly,
|
|
2298
2530
|
error,
|
|
2299
|
-
errorMessage,
|
|
2300
|
-
errorMessageProps,
|
|
2301
|
-
stateProps,
|
|
2302
|
-
variant,
|
|
2303
|
-
size,
|
|
2304
|
-
width
|
|
2305
|
-
}, /* @__PURE__ */ React58.createElement(Box33, {
|
|
2306
|
-
as: "textarea",
|
|
2307
|
-
css: styles,
|
|
2308
|
-
ref: textAreaRef,
|
|
2309
2531
|
rows,
|
|
2310
|
-
...
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2532
|
+
...props
|
|
2533
|
+
}, ref) => {
|
|
2534
|
+
const { label, description, errorMessage } = props;
|
|
2535
|
+
const textAreaRef = useObjectRef11(ref);
|
|
2536
|
+
const { labelProps, inputProps, descriptionProps, errorMessageProps } = useTextField(
|
|
2537
|
+
{
|
|
2538
|
+
inputElementType: "textarea",
|
|
2539
|
+
isDisabled: disabled,
|
|
2540
|
+
isRequired: required,
|
|
2541
|
+
isReadOnly: readOnly,
|
|
2542
|
+
validationState: error ? "invalid" : "valid",
|
|
2543
|
+
...props
|
|
2544
|
+
},
|
|
2545
|
+
textAreaRef
|
|
2546
|
+
);
|
|
2547
|
+
const { hoverProps, isHovered } = useHover9({});
|
|
2548
|
+
const { focusProps, isFocusVisible } = useFocusRing14();
|
|
2549
|
+
const stateProps = useStateProps16({
|
|
2550
|
+
hover: isHovered,
|
|
2551
|
+
focus: isFocusVisible,
|
|
2552
|
+
disabled,
|
|
2553
|
+
readOnly,
|
|
2554
|
+
error
|
|
2555
|
+
});
|
|
2556
|
+
const styles = useComponentStyles30("TextArea", { variant, size });
|
|
2557
|
+
return /* @__PURE__ */ React60.createElement(FieldBase, {
|
|
2558
|
+
label,
|
|
2559
|
+
labelProps,
|
|
2560
|
+
required,
|
|
2561
|
+
description,
|
|
2562
|
+
descriptionProps,
|
|
2563
|
+
error,
|
|
2564
|
+
errorMessage,
|
|
2565
|
+
errorMessageProps,
|
|
2566
|
+
stateProps,
|
|
2567
|
+
variant,
|
|
2568
|
+
size,
|
|
2569
|
+
width
|
|
2570
|
+
}, /* @__PURE__ */ React60.createElement(Box36, {
|
|
2571
|
+
as: "textarea",
|
|
2572
|
+
css: styles,
|
|
2573
|
+
ref: textAreaRef,
|
|
2574
|
+
rows,
|
|
2575
|
+
...inputProps,
|
|
2576
|
+
...focusProps,
|
|
2577
|
+
...hoverProps,
|
|
2578
|
+
...stateProps
|
|
2579
|
+
}));
|
|
2580
|
+
}
|
|
2581
|
+
);
|
|
2316
2582
|
|
|
2317
2583
|
// src/TextField/TextField.tsx
|
|
2318
|
-
import
|
|
2319
|
-
import { useHover as
|
|
2584
|
+
import React61, { forwardRef as forwardRef14 } from "react";
|
|
2585
|
+
import { useHover as useHover10 } from "@react-aria/interactions";
|
|
2320
2586
|
import { useFocusRing as useFocusRing15 } from "@react-aria/focus";
|
|
2321
2587
|
import { useTextField as useTextField2 } from "@react-aria/textfield";
|
|
2322
|
-
import { useObjectRef as
|
|
2588
|
+
import { useObjectRef as useObjectRef12 } from "@react-aria/utils";
|
|
2323
2589
|
import { useStateProps as useStateProps17 } from "@marigold/system";
|
|
2324
|
-
var TextField =
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2590
|
+
var TextField = forwardRef14(
|
|
2591
|
+
({ variant, size, width, disabled, required, readOnly, error, ...props }, ref) => {
|
|
2592
|
+
const { label, description, errorMessage, autoFocus } = props;
|
|
2593
|
+
const inputRef = useObjectRef12(ref);
|
|
2594
|
+
const { labelProps, inputProps, descriptionProps, errorMessageProps } = useTextField2(
|
|
2595
|
+
{
|
|
2596
|
+
isDisabled: disabled,
|
|
2597
|
+
isRequired: required,
|
|
2598
|
+
isReadOnly: readOnly,
|
|
2599
|
+
validationState: error ? "invalid" : "valid",
|
|
2600
|
+
...props
|
|
2601
|
+
},
|
|
2602
|
+
inputRef
|
|
2603
|
+
);
|
|
2604
|
+
const { hoverProps, isHovered } = useHover10({});
|
|
2605
|
+
const { focusProps, isFocusVisible } = useFocusRing15({
|
|
2606
|
+
isTextInput: true,
|
|
2607
|
+
autoFocus
|
|
2608
|
+
});
|
|
2609
|
+
const stateProps = useStateProps17({
|
|
2610
|
+
hover: isHovered,
|
|
2611
|
+
focus: isFocusVisible,
|
|
2612
|
+
disabled,
|
|
2613
|
+
readOnly,
|
|
2614
|
+
error
|
|
2615
|
+
});
|
|
2616
|
+
return /* @__PURE__ */ React61.createElement(FieldBase, {
|
|
2617
|
+
label,
|
|
2618
|
+
labelProps,
|
|
2619
|
+
required,
|
|
2620
|
+
description,
|
|
2621
|
+
descriptionProps,
|
|
2622
|
+
error,
|
|
2623
|
+
errorMessage,
|
|
2624
|
+
errorMessageProps,
|
|
2625
|
+
stateProps,
|
|
2626
|
+
variant,
|
|
2627
|
+
size,
|
|
2628
|
+
width
|
|
2629
|
+
}, /* @__PURE__ */ React61.createElement(Input, {
|
|
2630
|
+
ref: inputRef,
|
|
2631
|
+
variant,
|
|
2632
|
+
size,
|
|
2633
|
+
...inputProps,
|
|
2634
|
+
...focusProps,
|
|
2635
|
+
...hoverProps,
|
|
2636
|
+
...stateProps
|
|
2637
|
+
}));
|
|
2638
|
+
}
|
|
2639
|
+
);
|
|
2369
2640
|
|
|
2370
2641
|
// src/Tiles/Tiles.tsx
|
|
2371
|
-
import
|
|
2372
|
-
var Tiles =
|
|
2373
|
-
ref,
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2642
|
+
import React62 from "react";
|
|
2643
|
+
var Tiles = React62.forwardRef(
|
|
2644
|
+
({ space = "none", itemMinWidth = "250px", children, ...props }, ref) => /* @__PURE__ */ React62.createElement(Box, {
|
|
2645
|
+
ref,
|
|
2646
|
+
display: "grid",
|
|
2647
|
+
__baseCSS: {
|
|
2648
|
+
gap: space,
|
|
2649
|
+
gridTemplateColumns: `repeat(auto-fit, minmax(min(${itemMinWidth}, 100%), 1fr))`
|
|
2650
|
+
},
|
|
2651
|
+
...props
|
|
2652
|
+
}, children)
|
|
2653
|
+
);
|
|
2381
2654
|
|
|
2382
2655
|
// src/Tooltip/Tooltip.tsx
|
|
2383
|
-
import
|
|
2656
|
+
import React64 from "react";
|
|
2384
2657
|
import { useTooltip } from "@react-aria/tooltip";
|
|
2385
2658
|
import {
|
|
2386
|
-
Box as
|
|
2387
|
-
useComponentStyles as
|
|
2659
|
+
Box as Box37,
|
|
2660
|
+
useComponentStyles as useComponentStyles31
|
|
2388
2661
|
} from "@marigold/system";
|
|
2389
2662
|
|
|
2390
2663
|
// src/Tooltip/Context.ts
|
|
2391
|
-
import { createContext as
|
|
2392
|
-
var TooltipContext =
|
|
2393
|
-
var useTooltipContext = () =>
|
|
2664
|
+
import { createContext as createContext8, useContext as useContext8 } from "react";
|
|
2665
|
+
var TooltipContext = createContext8({});
|
|
2666
|
+
var useTooltipContext = () => useContext8(TooltipContext);
|
|
2394
2667
|
|
|
2395
2668
|
// src/Tooltip/TooltipTrigger.tsx
|
|
2396
|
-
import
|
|
2669
|
+
import React63, { useRef as useRef17 } from "react";
|
|
2397
2670
|
import { FocusableProvider } from "@react-aria/focus";
|
|
2398
2671
|
import { useOverlayPosition as useOverlayPosition3 } from "@react-aria/overlays";
|
|
2399
2672
|
import { useTooltipTrigger } from "@react-aria/tooltip";
|
|
@@ -2406,7 +2679,7 @@ var TooltipTrigger = ({
|
|
|
2406
2679
|
children,
|
|
2407
2680
|
...rest
|
|
2408
2681
|
}) => {
|
|
2409
|
-
const [tooltipTrigger, tooltip] =
|
|
2682
|
+
const [tooltipTrigger, tooltip] = React63.Children.toArray(children);
|
|
2410
2683
|
const props = {
|
|
2411
2684
|
...rest,
|
|
2412
2685
|
isDisabled: disabled,
|
|
@@ -2414,10 +2687,14 @@ var TooltipTrigger = ({
|
|
|
2414
2687
|
delay,
|
|
2415
2688
|
placement
|
|
2416
2689
|
};
|
|
2417
|
-
const tooltipTriggerRef =
|
|
2418
|
-
const overlayRef =
|
|
2690
|
+
const tooltipTriggerRef = useRef17(null);
|
|
2691
|
+
const overlayRef = useRef17(null);
|
|
2419
2692
|
const state = useTooltipTriggerState(props);
|
|
2420
|
-
const { triggerProps, tooltipProps } = useTooltipTrigger(
|
|
2693
|
+
const { triggerProps, tooltipProps } = useTooltipTrigger(
|
|
2694
|
+
props,
|
|
2695
|
+
state,
|
|
2696
|
+
tooltipTriggerRef
|
|
2697
|
+
);
|
|
2421
2698
|
const {
|
|
2422
2699
|
overlayProps: positionProps,
|
|
2423
2700
|
placement: overlayPlacement,
|
|
@@ -2430,10 +2707,10 @@ var TooltipTrigger = ({
|
|
|
2430
2707
|
isOpen: state.isOpen,
|
|
2431
2708
|
overlayRef
|
|
2432
2709
|
});
|
|
2433
|
-
return /* @__PURE__ */
|
|
2710
|
+
return /* @__PURE__ */ React63.createElement(FocusableProvider, {
|
|
2434
2711
|
ref: tooltipTriggerRef,
|
|
2435
2712
|
...triggerProps
|
|
2436
|
-
}, tooltipTrigger, /* @__PURE__ */
|
|
2713
|
+
}, tooltipTrigger, /* @__PURE__ */ React63.createElement(TooltipContext.Provider, {
|
|
2437
2714
|
value: {
|
|
2438
2715
|
state,
|
|
2439
2716
|
overlayRef,
|
|
@@ -2442,7 +2719,7 @@ var TooltipTrigger = ({
|
|
|
2442
2719
|
...tooltipProps,
|
|
2443
2720
|
...positionProps
|
|
2444
2721
|
}
|
|
2445
|
-
}, /* @__PURE__ */
|
|
2722
|
+
}, /* @__PURE__ */ React63.createElement(Overlay, {
|
|
2446
2723
|
open: state.isOpen
|
|
2447
2724
|
}, tooltip)));
|
|
2448
2725
|
};
|
|
@@ -2451,14 +2728,18 @@ var TooltipTrigger = ({
|
|
|
2451
2728
|
var Tooltip = ({ children, variant, size }) => {
|
|
2452
2729
|
const { arrowProps, state, overlayRef, placement, ...rest } = useTooltipContext();
|
|
2453
2730
|
const { tooltipProps } = useTooltip({}, state);
|
|
2454
|
-
const styles =
|
|
2455
|
-
|
|
2731
|
+
const styles = useComponentStyles31(
|
|
2732
|
+
"Tooltip",
|
|
2733
|
+
{ variant, size },
|
|
2734
|
+
{ parts: ["container", "arrow"] }
|
|
2735
|
+
);
|
|
2736
|
+
return /* @__PURE__ */ React64.createElement(Box37, {
|
|
2456
2737
|
...tooltipProps,
|
|
2457
2738
|
...rest,
|
|
2458
2739
|
ref: overlayRef,
|
|
2459
2740
|
css: styles.container,
|
|
2460
2741
|
"data-placement": placement
|
|
2461
|
-
}, /* @__PURE__ */
|
|
2742
|
+
}, /* @__PURE__ */ React64.createElement("div", null, children), /* @__PURE__ */ React64.createElement(Box37, {
|
|
2462
2743
|
...arrowProps,
|
|
2463
2744
|
__baseCSS: {
|
|
2464
2745
|
position: "absolute",
|
|
@@ -2498,6 +2779,7 @@ export {
|
|
|
2498
2779
|
Input,
|
|
2499
2780
|
Label,
|
|
2500
2781
|
Link,
|
|
2782
|
+
List,
|
|
2501
2783
|
MarigoldProvider,
|
|
2502
2784
|
Menu,
|
|
2503
2785
|
Message,
|
|
@@ -2520,6 +2802,8 @@ export {
|
|
|
2520
2802
|
Tooltip,
|
|
2521
2803
|
Underlay,
|
|
2522
2804
|
VisuallyHidden,
|
|
2805
|
+
useAsyncList,
|
|
2523
2806
|
useCheckboxGroupContext,
|
|
2807
|
+
useListData,
|
|
2524
2808
|
useTheme2 as useTheme
|
|
2525
2809
|
};
|