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