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