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