@marigold/components 0.5.1 → 0.8.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/LICENSE +21 -0
- package/dist/index.d.ts +98 -55
- package/dist/index.js +470 -355
- package/dist/index.mjs +500 -387
- package/package.json +12 -5
- package/CHANGELOG.md +0 -229
package/dist/index.mjs
CHANGED
|
@@ -34,29 +34,7 @@ var __objRest = (source, exclude) => {
|
|
|
34
34
|
import React3 from "react";
|
|
35
35
|
|
|
36
36
|
// src/Inline/Inline.tsx
|
|
37
|
-
import React
|
|
38
|
-
|
|
39
|
-
// src/utils/flatten-children.ts
|
|
40
|
-
import {
|
|
41
|
-
Children,
|
|
42
|
-
isValidElement,
|
|
43
|
-
cloneElement
|
|
44
|
-
} from "react";
|
|
45
|
-
import { isFragment } from "react-is";
|
|
46
|
-
var flattenChildren = (children, depth = 0, keys = []) => Children.toArray(children).reduce((acc, node) => {
|
|
47
|
-
if (isFragment(node)) {
|
|
48
|
-
acc.push.apply(acc, flattenChildren(node.props.children, depth + 1, keys.concat(node.key)));
|
|
49
|
-
} else {
|
|
50
|
-
if (isValidElement(node)) {
|
|
51
|
-
acc.push(cloneElement(node, {
|
|
52
|
-
key: keys.concat(String(node.key)).join(".")
|
|
53
|
-
}));
|
|
54
|
-
} else if (typeof node === "string" || typeof node === "number") {
|
|
55
|
-
acc.push(node);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return acc;
|
|
59
|
-
}, []);
|
|
37
|
+
import React from "react";
|
|
60
38
|
|
|
61
39
|
// src/Box.ts
|
|
62
40
|
import { Box } from "@marigold/system";
|
|
@@ -78,14 +56,14 @@ var Inline = (_a) => {
|
|
|
78
56
|
"children"
|
|
79
57
|
]);
|
|
80
58
|
return /* @__PURE__ */ React.createElement(Box, __spreadValues({
|
|
59
|
+
__baseCSS: { gap: space, flexWrap: "wrap" },
|
|
81
60
|
display: "inline-flex",
|
|
82
|
-
css: { "> * + *": { pl: space } },
|
|
83
61
|
alignItems: ALIGNMENT[align]
|
|
84
|
-
}, props),
|
|
62
|
+
}, props), children);
|
|
85
63
|
};
|
|
86
64
|
|
|
87
65
|
// src/Stack/Stack.tsx
|
|
88
|
-
import React2
|
|
66
|
+
import React2 from "react";
|
|
89
67
|
var ALIGNMENT2 = {
|
|
90
68
|
left: "flex-start",
|
|
91
69
|
center: "center",
|
|
@@ -105,8 +83,9 @@ var Stack = (_a) => {
|
|
|
105
83
|
display: "flex",
|
|
106
84
|
flexDirection: "column",
|
|
107
85
|
alignItems: ALIGNMENT2[align],
|
|
108
|
-
|
|
109
|
-
|
|
86
|
+
p: "0",
|
|
87
|
+
css: { gap: space }
|
|
88
|
+
}), children);
|
|
110
89
|
};
|
|
111
90
|
|
|
112
91
|
// src/ActionGroup/ActionGroup.tsx
|
|
@@ -127,45 +106,69 @@ var ActionGroup = (_a) => {
|
|
|
127
106
|
}, props), children);
|
|
128
107
|
};
|
|
129
108
|
|
|
130
|
-
// src/
|
|
109
|
+
// src/Aside/Aside.tsx
|
|
131
110
|
import React4 from "react";
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
warning: Notification,
|
|
136
|
-
error: Exclamation
|
|
111
|
+
var SIDE_MAP = {
|
|
112
|
+
left: [":not(style):first-of-type", ":last-child"],
|
|
113
|
+
right: [":last-child", ":not(style):first-of-type"]
|
|
137
114
|
};
|
|
138
|
-
var
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
return /* @__PURE__ */ React4.createElement(Box,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}, children));
|
|
115
|
+
var Aside = ({
|
|
116
|
+
children,
|
|
117
|
+
sideWidth,
|
|
118
|
+
space = "none",
|
|
119
|
+
side = "left",
|
|
120
|
+
stretch = true,
|
|
121
|
+
wrap = "50%"
|
|
122
|
+
}) => {
|
|
123
|
+
const [aside, content] = SIDE_MAP[side];
|
|
124
|
+
return /* @__PURE__ */ React4.createElement(Box, {
|
|
125
|
+
css: {
|
|
126
|
+
display: "flex",
|
|
127
|
+
flexWrap: "wrap",
|
|
128
|
+
gap: space,
|
|
129
|
+
alignItems: stretch ? void 0 : "flex-start",
|
|
130
|
+
[`> ${aside}`]: {
|
|
131
|
+
flexBasis: sideWidth,
|
|
132
|
+
flexGrow: 1
|
|
133
|
+
},
|
|
134
|
+
[`> ${content}`]: {
|
|
135
|
+
flexBasis: 0,
|
|
136
|
+
flexGrow: 999,
|
|
137
|
+
minInlineSize: wrap
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, children);
|
|
165
141
|
};
|
|
166
142
|
|
|
167
|
-
// src/
|
|
143
|
+
// src/Aspect/Aspect.tsx
|
|
168
144
|
import React5 from "react";
|
|
145
|
+
import { aspect } from "@marigold/tokens";
|
|
146
|
+
var Aspect = React5.forwardRef(function AspectRatio(_a, ref) {
|
|
147
|
+
var _b = _a, { ratio = "square", maxWidth = "100%", children } = _b, props = __objRest(_b, ["ratio", "maxWidth", "children"]);
|
|
148
|
+
return /* @__PURE__ */ React5.createElement(Box, {
|
|
149
|
+
ref,
|
|
150
|
+
__baseCSS: {
|
|
151
|
+
position: "relative",
|
|
152
|
+
overflow: "hidden",
|
|
153
|
+
maxWidth
|
|
154
|
+
}
|
|
155
|
+
}, /* @__PURE__ */ React5.createElement(Box, {
|
|
156
|
+
__baseCSS: {
|
|
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
|
+
});
|
|
169
|
+
|
|
170
|
+
// src/Badge/Badge.tsx
|
|
171
|
+
import React6 from "react";
|
|
169
172
|
var Badge = (_a) => {
|
|
170
173
|
var _b = _a, {
|
|
171
174
|
variant = "",
|
|
@@ -178,14 +181,14 @@ var Badge = (_a) => {
|
|
|
178
181
|
"borderColor",
|
|
179
182
|
"children"
|
|
180
183
|
]);
|
|
181
|
-
return /* @__PURE__ */
|
|
184
|
+
return /* @__PURE__ */ React6.createElement(Box, __spreadValues({
|
|
182
185
|
css: { bg: bgColor, borderColor },
|
|
183
186
|
variant: `badge.${variant}`
|
|
184
187
|
}, props), children);
|
|
185
188
|
};
|
|
186
189
|
|
|
187
190
|
// src/Button/Button.tsx
|
|
188
|
-
import
|
|
191
|
+
import React7, { forwardRef } from "react";
|
|
189
192
|
import { useButton } from "@react-aria/button";
|
|
190
193
|
var Button = forwardRef((_a, ref) => {
|
|
191
194
|
var _b = _a, {
|
|
@@ -209,7 +212,7 @@ var Button = forwardRef((_a, ref) => {
|
|
|
209
212
|
elementType: typeof as === "string" ? as : "span",
|
|
210
213
|
isDisabled: disabled
|
|
211
214
|
}), ref);
|
|
212
|
-
return /* @__PURE__ */
|
|
215
|
+
return /* @__PURE__ */ React7.createElement(Box, __spreadProps(__spreadValues(__spreadValues({}, buttonProps), props), {
|
|
213
216
|
as,
|
|
214
217
|
display: "inline-flex",
|
|
215
218
|
alignItems: "center",
|
|
@@ -220,8 +223,44 @@ var Button = forwardRef((_a, ref) => {
|
|
|
220
223
|
}), children);
|
|
221
224
|
});
|
|
222
225
|
|
|
226
|
+
// src/Breakout/Breakout.tsx
|
|
227
|
+
import React8 from "react";
|
|
228
|
+
var useAlignment = (direction) => {
|
|
229
|
+
switch (direction) {
|
|
230
|
+
case "right":
|
|
231
|
+
return "flex-end";
|
|
232
|
+
case "bottom":
|
|
233
|
+
return "flex-end";
|
|
234
|
+
case "center":
|
|
235
|
+
return "center";
|
|
236
|
+
}
|
|
237
|
+
return "flex-start";
|
|
238
|
+
};
|
|
239
|
+
var Breakout = (_a) => {
|
|
240
|
+
var _b = _a, {
|
|
241
|
+
horizontalAlign,
|
|
242
|
+
verticalAlign,
|
|
243
|
+
children
|
|
244
|
+
} = _b, props = __objRest(_b, [
|
|
245
|
+
"horizontalAlign",
|
|
246
|
+
"verticalAlign",
|
|
247
|
+
"children"
|
|
248
|
+
]);
|
|
249
|
+
const alignItems = useAlignment(horizontalAlign);
|
|
250
|
+
const justifyContent = useAlignment(verticalAlign);
|
|
251
|
+
return /* @__PURE__ */ React8.createElement(Box, __spreadValues({
|
|
252
|
+
alignItems,
|
|
253
|
+
justifyContent,
|
|
254
|
+
width: "100%",
|
|
255
|
+
display: verticalAlign || horizontalAlign ? "flex" : "block",
|
|
256
|
+
css: {
|
|
257
|
+
gridColumn: "1 / -1"
|
|
258
|
+
}
|
|
259
|
+
}, props), children);
|
|
260
|
+
};
|
|
261
|
+
|
|
223
262
|
// src/Card/Card.tsx
|
|
224
|
-
import
|
|
263
|
+
import React9 from "react";
|
|
225
264
|
var Card = (_a) => {
|
|
226
265
|
var _b = _a, {
|
|
227
266
|
variant = "",
|
|
@@ -236,127 +275,59 @@ var Card = (_a) => {
|
|
|
236
275
|
"className",
|
|
237
276
|
"children"
|
|
238
277
|
]);
|
|
239
|
-
return /* @__PURE__ */
|
|
278
|
+
return /* @__PURE__ */ React9.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
240
279
|
variant: `card.${variant}`,
|
|
241
280
|
maxWidth: width,
|
|
242
281
|
className
|
|
243
|
-
}), title && /* @__PURE__ */
|
|
282
|
+
}), title && /* @__PURE__ */ React9.createElement(Box, {
|
|
244
283
|
as: "h2",
|
|
245
284
|
variant: "text.h2",
|
|
246
285
|
pb: "small"
|
|
247
286
|
}, title), children);
|
|
248
287
|
};
|
|
249
288
|
|
|
289
|
+
// src/Center/Center.tsx
|
|
290
|
+
import React10 from "react";
|
|
291
|
+
var Center = (_a) => {
|
|
292
|
+
var _b = _a, {
|
|
293
|
+
maxWidth,
|
|
294
|
+
space = "none",
|
|
295
|
+
children
|
|
296
|
+
} = _b, props = __objRest(_b, [
|
|
297
|
+
"maxWidth",
|
|
298
|
+
"space",
|
|
299
|
+
"children"
|
|
300
|
+
]);
|
|
301
|
+
return /* @__PURE__ */ React10.createElement(Box, __spreadValues({
|
|
302
|
+
css: {
|
|
303
|
+
boxSizing: "content-box",
|
|
304
|
+
display: "flex",
|
|
305
|
+
flexDirection: "column",
|
|
306
|
+
alignItems: "center",
|
|
307
|
+
justifyContent: "center",
|
|
308
|
+
marginInline: "auto",
|
|
309
|
+
maxInlineSize: maxWidth,
|
|
310
|
+
gap: space
|
|
311
|
+
}
|
|
312
|
+
}, props), children);
|
|
313
|
+
};
|
|
314
|
+
|
|
250
315
|
// src/Checkbox/Checkbox.tsx
|
|
251
|
-
import
|
|
316
|
+
import React14 from "react";
|
|
252
317
|
import { useFocusRing } from "@react-aria/focus";
|
|
253
318
|
import { VisuallyHidden } from "@react-aria/visually-hidden";
|
|
254
319
|
import { useCheckbox } from "@react-aria/checkbox";
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
import { useCallback, useRef, useState } from "react";
|
|
258
|
-
function useControlledState(value, defaultValue, onChange) {
|
|
259
|
-
let [stateValue, setStateValue] = useState(value || defaultValue);
|
|
260
|
-
let ref = useRef(value !== void 0);
|
|
261
|
-
let wasControlled = ref.current;
|
|
262
|
-
let isControlled = value !== void 0;
|
|
263
|
-
let stateRef = useRef(stateValue);
|
|
264
|
-
if (wasControlled !== isControlled) {
|
|
265
|
-
console.warn("WARN: A component changed from " + (wasControlled ? "controlled" : "uncontrolled") + " to " + (isControlled ? "controlled" : "uncontrolled") + ".");
|
|
266
|
-
}
|
|
267
|
-
ref.current = isControlled;
|
|
268
|
-
let setValue = useCallback(function(value2) {
|
|
269
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
270
|
-
args[_key - 1] = arguments[_key];
|
|
271
|
-
}
|
|
272
|
-
let onChangeCaller = function onChangeCaller2(value3) {
|
|
273
|
-
if (onChange) {
|
|
274
|
-
if (!Object.is(stateRef.current, value3)) {
|
|
275
|
-
for (var _len2 = arguments.length, onChangeArgs = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
276
|
-
onChangeArgs[_key2 - 1] = arguments[_key2];
|
|
277
|
-
}
|
|
278
|
-
onChange(value3, ...onChangeArgs);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
if (!isControlled) {
|
|
282
|
-
stateRef.current = value3;
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
if (typeof value2 === "function") {
|
|
286
|
-
let updateFunction = function updateFunction2(oldValue) {
|
|
287
|
-
for (var _len3 = arguments.length, functionArgs = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
288
|
-
functionArgs[_key3 - 1] = arguments[_key3];
|
|
289
|
-
}
|
|
290
|
-
let interceptedValue = value2(isControlled ? stateRef.current : oldValue, ...functionArgs);
|
|
291
|
-
onChangeCaller(interceptedValue, ...args);
|
|
292
|
-
if (!isControlled) {
|
|
293
|
-
return interceptedValue;
|
|
294
|
-
}
|
|
295
|
-
return oldValue;
|
|
296
|
-
};
|
|
297
|
-
setStateValue(updateFunction);
|
|
298
|
-
} else {
|
|
299
|
-
if (!isControlled) {
|
|
300
|
-
setStateValue(value2);
|
|
301
|
-
}
|
|
302
|
-
onChangeCaller(value2, ...args);
|
|
303
|
-
}
|
|
304
|
-
}, [isControlled, onChange]);
|
|
305
|
-
if (isControlled) {
|
|
306
|
-
stateRef.current = value;
|
|
307
|
-
} else {
|
|
308
|
-
value = stateValue;
|
|
309
|
-
}
|
|
310
|
-
return [value, setValue];
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
// ../../node_modules/@react-stately/toggle/dist/module.js
|
|
314
|
-
function useToggleState(props) {
|
|
315
|
-
if (props === void 0) {
|
|
316
|
-
props = {};
|
|
317
|
-
}
|
|
318
|
-
let {
|
|
319
|
-
isReadOnly,
|
|
320
|
-
onChange
|
|
321
|
-
} = props;
|
|
322
|
-
let [isSelected, setSelected] = useControlledState(props.isSelected, props.defaultSelected || false, () => {
|
|
323
|
-
});
|
|
324
|
-
function updateSelected(value) {
|
|
325
|
-
if (!isReadOnly) {
|
|
326
|
-
setSelected(value);
|
|
327
|
-
if (onChange) {
|
|
328
|
-
onChange(value);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
function toggleState() {
|
|
333
|
-
if (!isReadOnly) {
|
|
334
|
-
setSelected((prev) => {
|
|
335
|
-
let newVal = !prev;
|
|
336
|
-
if (onChange) {
|
|
337
|
-
onChange(newVal);
|
|
338
|
-
}
|
|
339
|
-
return newVal;
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
return {
|
|
344
|
-
isSelected,
|
|
345
|
-
setSelected: updateSelected,
|
|
346
|
-
toggle: toggleState
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
// src/Checkbox/Checkbox.tsx
|
|
351
|
-
import { Exclamation as Exclamation2 } from "@marigold/icons";
|
|
320
|
+
import { useToggleState } from "@react-stately/toggle";
|
|
321
|
+
import { Exclamation } from "@marigold/icons";
|
|
352
322
|
|
|
353
323
|
// src/Checkbox/CheckboxIcon.tsx
|
|
354
|
-
import
|
|
324
|
+
import React11 from "react";
|
|
355
325
|
import { conditional, SVG } from "@marigold/system";
|
|
356
326
|
var CheckboxIcon = ({
|
|
357
327
|
variant = "",
|
|
358
328
|
checked = false,
|
|
359
329
|
disabled = false,
|
|
330
|
+
indeterminated,
|
|
360
331
|
error = false
|
|
361
332
|
}) => {
|
|
362
333
|
const conditionalStates = disabled ? {
|
|
@@ -365,13 +336,13 @@ var CheckboxIcon = ({
|
|
|
365
336
|
checked,
|
|
366
337
|
error
|
|
367
338
|
};
|
|
368
|
-
return /* @__PURE__ */
|
|
339
|
+
return /* @__PURE__ */ React11.createElement(SVG, {
|
|
369
340
|
width: "16",
|
|
370
341
|
height: "32",
|
|
371
342
|
viewBox: "0 0 16 32",
|
|
372
343
|
fill: "none",
|
|
373
344
|
"aria-hidden": "true"
|
|
374
|
-
}, /* @__PURE__ */
|
|
345
|
+
}, /* @__PURE__ */ React11.createElement(Box, {
|
|
375
346
|
as: "rect",
|
|
376
347
|
x: "0.5",
|
|
377
348
|
y: "8.5",
|
|
@@ -379,7 +350,13 @@ var CheckboxIcon = ({
|
|
|
379
350
|
height: "15px",
|
|
380
351
|
rx: "1.5",
|
|
381
352
|
variant: conditional(`checkbox.${variant}`, conditionalStates)
|
|
382
|
-
}), checked && /* @__PURE__ */
|
|
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, {
|
|
383
360
|
__baseCSS: { fill: "gray00" },
|
|
384
361
|
as: "path",
|
|
385
362
|
fillRule: "evenodd",
|
|
@@ -389,7 +366,7 @@ var CheckboxIcon = ({
|
|
|
389
366
|
};
|
|
390
367
|
|
|
391
368
|
// src/Label/Label.tsx
|
|
392
|
-
import
|
|
369
|
+
import React12 from "react";
|
|
393
370
|
import { Required } from "@marigold/icons";
|
|
394
371
|
var LabelBase = (_a) => {
|
|
395
372
|
var _b = _a, {
|
|
@@ -403,7 +380,7 @@ var LabelBase = (_a) => {
|
|
|
403
380
|
"color",
|
|
404
381
|
"children"
|
|
405
382
|
]);
|
|
406
|
-
return /* @__PURE__ */
|
|
383
|
+
return /* @__PURE__ */ React12.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
407
384
|
as: "label",
|
|
408
385
|
__baseCSS: { color },
|
|
409
386
|
variant: `label.${variant}`
|
|
@@ -417,19 +394,18 @@ var Label = (_a) => {
|
|
|
417
394
|
"required",
|
|
418
395
|
"children"
|
|
419
396
|
]);
|
|
420
|
-
return required ? /* @__PURE__ */
|
|
397
|
+
return required ? /* @__PURE__ */ React12.createElement(Box, {
|
|
421
398
|
as: "span",
|
|
422
399
|
display: "inline-flex",
|
|
423
400
|
alignItems: "center"
|
|
424
|
-
}, /* @__PURE__ */
|
|
425
|
-
as: Required,
|
|
401
|
+
}, /* @__PURE__ */ React12.createElement(LabelBase, __spreadValues({}, props), children), required && /* @__PURE__ */ React12.createElement(Required, {
|
|
426
402
|
size: 16,
|
|
427
|
-
|
|
428
|
-
})) : /* @__PURE__ */
|
|
403
|
+
fill: "error"
|
|
404
|
+
})) : /* @__PURE__ */ React12.createElement(LabelBase, __spreadValues({}, props), children);
|
|
429
405
|
};
|
|
430
406
|
|
|
431
407
|
// src/ValidationMessage/ValidationMessage.tsx
|
|
432
|
-
import
|
|
408
|
+
import React13 from "react";
|
|
433
409
|
var ValidationMessage = (_a) => {
|
|
434
410
|
var _b = _a, {
|
|
435
411
|
variant = "error",
|
|
@@ -440,7 +416,7 @@ var ValidationMessage = (_a) => {
|
|
|
440
416
|
"children",
|
|
441
417
|
"className"
|
|
442
418
|
]);
|
|
443
|
-
return /* @__PURE__ */
|
|
419
|
+
return /* @__PURE__ */ React13.createElement(Box, __spreadValues({
|
|
444
420
|
as: "span",
|
|
445
421
|
display: "flex",
|
|
446
422
|
alignItems: "center",
|
|
@@ -451,20 +427,27 @@ var ValidationMessage = (_a) => {
|
|
|
451
427
|
|
|
452
428
|
// src/Checkbox/Checkbox.tsx
|
|
453
429
|
var CheckboxInput = (_a) => {
|
|
454
|
-
var _b = _a, {
|
|
430
|
+
var _b = _a, {
|
|
431
|
+
error,
|
|
432
|
+
indeterminated = false
|
|
433
|
+
} = _b, props = __objRest(_b, [
|
|
434
|
+
"error",
|
|
435
|
+
"indeterminated"
|
|
436
|
+
]);
|
|
455
437
|
const state = useToggleState(props);
|
|
456
|
-
const ref =
|
|
438
|
+
const ref = React14.useRef(null);
|
|
457
439
|
const { inputProps } = useCheckbox(props, state, ref);
|
|
458
440
|
const { focusProps } = useFocusRing();
|
|
459
441
|
const _a2 = props, { children } = _a2, restProps = __objRest(_a2, ["children"]);
|
|
460
|
-
return /* @__PURE__ */
|
|
442
|
+
return /* @__PURE__ */ React14.createElement(Box, {
|
|
461
443
|
pr: "xsmall"
|
|
462
|
-
}, /* @__PURE__ */
|
|
444
|
+
}, /* @__PURE__ */ React14.createElement(VisuallyHidden, null, /* @__PURE__ */ React14.createElement("input", __spreadValues(__spreadProps(__spreadValues(__spreadValues({}, inputProps), focusProps), {
|
|
463
445
|
ref
|
|
464
|
-
}), restProps))), /* @__PURE__ */
|
|
446
|
+
}), restProps))), /* @__PURE__ */ React14.createElement(CheckboxIcon, {
|
|
465
447
|
checked: props.checked,
|
|
466
448
|
variant: props.variant,
|
|
467
449
|
disabled: props.disabled,
|
|
450
|
+
indeterminated,
|
|
468
451
|
error
|
|
469
452
|
}));
|
|
470
453
|
};
|
|
@@ -478,7 +461,7 @@ var Checkbox = (_a) => {
|
|
|
478
461
|
"labelVariant",
|
|
479
462
|
"errorMessage"
|
|
480
463
|
]);
|
|
481
|
-
return /* @__PURE__ */
|
|
464
|
+
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(Box, {
|
|
482
465
|
as: Label,
|
|
483
466
|
__baseCSS: {
|
|
484
467
|
":hover": { cursor: props.disabled ? "not-allowed" : "pointer" }
|
|
@@ -487,95 +470,58 @@ var Checkbox = (_a) => {
|
|
|
487
470
|
required,
|
|
488
471
|
variant: `label.${labelVariant}`,
|
|
489
472
|
color: props.disabled ? "disabled" : "text"
|
|
490
|
-
}, /* @__PURE__ */
|
|
491
|
-
as: CheckboxInput,
|
|
473
|
+
}, /* @__PURE__ */ React14.createElement(CheckboxInput, __spreadValues({
|
|
492
474
|
error: props.error
|
|
493
|
-
}, props)), props.children), props.error && errorMessage && /* @__PURE__ */
|
|
475
|
+
}, props)), props.children), props.error && errorMessage && /* @__PURE__ */ React14.createElement(ValidationMessage, null, /* @__PURE__ */ React14.createElement(Exclamation, {
|
|
494
476
|
size: 16
|
|
495
477
|
}), errorMessage));
|
|
496
478
|
};
|
|
497
479
|
|
|
498
|
-
// src/Column/Column.tsx
|
|
499
|
-
import React12 from "react";
|
|
500
|
-
var transform = (width) => {
|
|
501
|
-
if (Array.isArray(width)) {
|
|
502
|
-
return width.map((v) => `${v / 12 * 100}%`);
|
|
503
|
-
}
|
|
504
|
-
return `${width / 12 * 100}%`;
|
|
505
|
-
};
|
|
506
|
-
var Column = (_a) => {
|
|
507
|
-
var _b = _a, {
|
|
508
|
-
width = 12,
|
|
509
|
-
children
|
|
510
|
-
} = _b, props = __objRest(_b, [
|
|
511
|
-
"width",
|
|
512
|
-
"children"
|
|
513
|
-
]);
|
|
514
|
-
return /* @__PURE__ */ React12.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
515
|
-
width: transform(width)
|
|
516
|
-
}), children);
|
|
517
|
-
};
|
|
518
|
-
|
|
519
480
|
// src/Columns/Columns.tsx
|
|
520
|
-
import
|
|
521
|
-
import { useTheme } from "@marigold/system";
|
|
522
|
-
var useAlignment = (direction) => {
|
|
523
|
-
switch (direction) {
|
|
524
|
-
case "right":
|
|
525
|
-
return "flex-end";
|
|
526
|
-
case "bottom":
|
|
527
|
-
return "flex-end";
|
|
528
|
-
case "center":
|
|
529
|
-
return "center";
|
|
530
|
-
}
|
|
531
|
-
return "flex-start";
|
|
532
|
-
};
|
|
481
|
+
import React15, { Children } from "react";
|
|
533
482
|
var Columns = (_a) => {
|
|
534
483
|
var _b = _a, {
|
|
535
484
|
space = "none",
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
className,
|
|
485
|
+
columns,
|
|
486
|
+
collapseAt = "40em",
|
|
539
487
|
children
|
|
540
488
|
} = _b, props = __objRest(_b, [
|
|
541
489
|
"space",
|
|
542
|
-
"
|
|
543
|
-
"
|
|
544
|
-
"className",
|
|
490
|
+
"columns",
|
|
491
|
+
"collapseAt",
|
|
545
492
|
"children"
|
|
546
493
|
]);
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
const
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
m: `${-spaceValue / 2}px`,
|
|
494
|
+
if (Children.count(children) !== columns.length) {
|
|
495
|
+
throw new Error(`Columns: expected ${columns.length} children, got ${Children.count(children)}`);
|
|
496
|
+
}
|
|
497
|
+
const getColumnWidths = columns.map((column, index) => {
|
|
498
|
+
return {
|
|
499
|
+
[`> :nth-of-type(${index + 1})`]: {
|
|
500
|
+
flexGrow: column
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
});
|
|
504
|
+
return /* @__PURE__ */ React15.createElement(Box, __spreadValues({
|
|
559
505
|
display: "flex",
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
},
|
|
567
|
-
}))
|
|
506
|
+
css: Object.assign({
|
|
507
|
+
flexWrap: "wrap",
|
|
508
|
+
gap: space,
|
|
509
|
+
"> *": {
|
|
510
|
+
flexBasis: `calc(( ${collapseAt} - 100%) * 999)`
|
|
511
|
+
}
|
|
512
|
+
}, ...getColumnWidths)
|
|
513
|
+
}, props), children);
|
|
568
514
|
};
|
|
569
515
|
|
|
570
516
|
// src/Dialog/Dialog.tsx
|
|
571
|
-
import
|
|
517
|
+
import React18 from "react";
|
|
572
518
|
import { useOverlayTriggerState } from "@react-stately/overlays";
|
|
573
519
|
import { OverlayContainer } from "@react-aria/overlays";
|
|
574
520
|
import { useButton as useButton2 } from "@react-aria/button";
|
|
575
521
|
import { Close } from "@marigold/icons";
|
|
576
522
|
|
|
577
523
|
// src/Text/Text.tsx
|
|
578
|
-
import
|
|
524
|
+
import React16, { forwardRef as forwardRef2 } from "react";
|
|
579
525
|
var Text = forwardRef2((_a, ref) => {
|
|
580
526
|
var _b = _a, {
|
|
581
527
|
as = "span",
|
|
@@ -598,7 +544,7 @@ var Text = forwardRef2((_a, ref) => {
|
|
|
598
544
|
"outline",
|
|
599
545
|
"userSelect"
|
|
600
546
|
]);
|
|
601
|
-
return /* @__PURE__ */
|
|
547
|
+
return /* @__PURE__ */ React16.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
602
548
|
as,
|
|
603
549
|
variant: `text.${variant}`,
|
|
604
550
|
css: {
|
|
@@ -614,7 +560,7 @@ var Text = forwardRef2((_a, ref) => {
|
|
|
614
560
|
});
|
|
615
561
|
|
|
616
562
|
// src/Dialog/ModalDialog.tsx
|
|
617
|
-
import
|
|
563
|
+
import React17 from "react";
|
|
618
564
|
import {
|
|
619
565
|
useOverlay,
|
|
620
566
|
usePreventScroll,
|
|
@@ -633,12 +579,12 @@ var ModalDialog = (_a) => {
|
|
|
633
579
|
"children"
|
|
634
580
|
]);
|
|
635
581
|
const _a2 = props, { isDismissable, isOpen, onClose } = _a2, restProps = __objRest(_a2, ["isDismissable", "isOpen", "onClose"]);
|
|
636
|
-
const ref =
|
|
582
|
+
const ref = React17.useRef();
|
|
637
583
|
const { overlayProps, underlayProps } = useOverlay({ isDismissable, isOpen, onClose }, ref);
|
|
638
584
|
usePreventScroll();
|
|
639
585
|
const { modalProps } = useModal();
|
|
640
586
|
const { dialogProps } = useDialog(props, ref);
|
|
641
|
-
return /* @__PURE__ */
|
|
587
|
+
return /* @__PURE__ */ React17.createElement(Box, __spreadValues({
|
|
642
588
|
__baseCSS: {
|
|
643
589
|
display: "grid",
|
|
644
590
|
placeItems: "center",
|
|
@@ -650,11 +596,11 @@ var ModalDialog = (_a) => {
|
|
|
650
596
|
right: 0
|
|
651
597
|
},
|
|
652
598
|
variant: `dialog.${backdropVariant}`
|
|
653
|
-
}, underlayProps), /* @__PURE__ */
|
|
599
|
+
}, underlayProps), /* @__PURE__ */ React17.createElement(FocusScope, {
|
|
654
600
|
contain: true,
|
|
655
601
|
restoreFocus: true,
|
|
656
602
|
autoFocus: true
|
|
657
|
-
}, /* @__PURE__ */
|
|
603
|
+
}, /* @__PURE__ */ React17.createElement(Box, __spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, overlayProps), dialogProps), modalProps), {
|
|
658
604
|
ref,
|
|
659
605
|
variant: variant ? `dialog.${variant}` : `dialog`
|
|
660
606
|
}), restProps), children)));
|
|
@@ -679,17 +625,17 @@ var Dialog = (_a) => {
|
|
|
679
625
|
"title",
|
|
680
626
|
"variant"
|
|
681
627
|
]);
|
|
682
|
-
const closeButtonRef =
|
|
628
|
+
const closeButtonRef = React18.useRef();
|
|
683
629
|
const { buttonProps: closeButtonProps } = useButton2({
|
|
684
630
|
onPress: () => close()
|
|
685
631
|
}, closeButtonRef);
|
|
686
|
-
return /* @__PURE__ */
|
|
632
|
+
return /* @__PURE__ */ React18.createElement(OverlayContainer, null, /* @__PURE__ */ React18.createElement(ModalDialog, __spreadValues({
|
|
687
633
|
variant,
|
|
688
634
|
backdropVariant,
|
|
689
635
|
isOpen,
|
|
690
636
|
onClose: close,
|
|
691
637
|
isDismissable: true
|
|
692
|
-
}, props), /* @__PURE__ */
|
|
638
|
+
}, props), /* @__PURE__ */ React18.createElement(Box, {
|
|
693
639
|
__baseCSS: {
|
|
694
640
|
display: "flex",
|
|
695
641
|
justifyContent: "space-between",
|
|
@@ -698,12 +644,12 @@ var Dialog = (_a) => {
|
|
|
698
644
|
pb: "large"
|
|
699
645
|
},
|
|
700
646
|
className
|
|
701
|
-
}, /* @__PURE__ */
|
|
647
|
+
}, /* @__PURE__ */ React18.createElement(Box, {
|
|
702
648
|
pt: "medium"
|
|
703
|
-
}, title && /* @__PURE__ */
|
|
649
|
+
}, title && /* @__PURE__ */ React18.createElement(Text, {
|
|
704
650
|
as: "h4",
|
|
705
651
|
variant: "headline4"
|
|
706
|
-
}, title), children), /* @__PURE__ */
|
|
652
|
+
}, title), children), /* @__PURE__ */ React18.createElement(Box, {
|
|
707
653
|
__baseCSS: {
|
|
708
654
|
display: "flex",
|
|
709
655
|
justifyContent: "flex-end",
|
|
@@ -711,7 +657,7 @@ var Dialog = (_a) => {
|
|
|
711
657
|
paddingTop: "xsmall",
|
|
712
658
|
paddingX: "xsmall"
|
|
713
659
|
}
|
|
714
|
-
}, /* @__PURE__ */
|
|
660
|
+
}, /* @__PURE__ */ React18.createElement(Box, __spreadProps(__spreadValues({
|
|
715
661
|
as: Button,
|
|
716
662
|
__baseCSS: {
|
|
717
663
|
color: "text",
|
|
@@ -729,13 +675,13 @@ var Dialog = (_a) => {
|
|
|
729
675
|
}
|
|
730
676
|
}, closeButtonProps), {
|
|
731
677
|
ref: closeButtonRef
|
|
732
|
-
}), /* @__PURE__ */
|
|
678
|
+
}), /* @__PURE__ */ React18.createElement(Close, {
|
|
733
679
|
size: 16
|
|
734
680
|
}))))));
|
|
735
681
|
};
|
|
736
682
|
var useDialogButtonProps = () => {
|
|
737
683
|
const state = useOverlayTriggerState({});
|
|
738
|
-
const openButtonRef =
|
|
684
|
+
const openButtonRef = React18.useRef();
|
|
739
685
|
const { buttonProps: openButtonProps } = useButton2({
|
|
740
686
|
onPress: () => state.open()
|
|
741
687
|
}, openButtonRef);
|
|
@@ -747,21 +693,21 @@ var useDialogButtonProps = () => {
|
|
|
747
693
|
};
|
|
748
694
|
|
|
749
695
|
// src/Divider/Divider.tsx
|
|
750
|
-
import
|
|
696
|
+
import React19 from "react";
|
|
751
697
|
import { useSeparator } from "@react-aria/separator";
|
|
752
698
|
var Divider = (_a) => {
|
|
753
699
|
var _b = _a, { variant = "" } = _b, props = __objRest(_b, ["variant"]);
|
|
754
700
|
const { separatorProps } = useSeparator(props);
|
|
755
|
-
return /* @__PURE__ */
|
|
701
|
+
return /* @__PURE__ */ React19.createElement(Box, __spreadValues(__spreadValues({
|
|
756
702
|
__baseCSS: { width: "100%", height: "1px", m: "none", bg: "text" },
|
|
757
703
|
variant: `divider.${variant}`
|
|
758
704
|
}, props), separatorProps));
|
|
759
705
|
};
|
|
760
706
|
|
|
761
707
|
// src/Field/Field.tsx
|
|
762
|
-
import
|
|
708
|
+
import React20, { useRef } from "react";
|
|
763
709
|
import { useTextField } from "@react-aria/textfield";
|
|
764
|
-
import { Exclamation as
|
|
710
|
+
import { Exclamation as Exclamation2 } from "@marigold/icons";
|
|
765
711
|
var Field = (_a) => {
|
|
766
712
|
var _b = _a, {
|
|
767
713
|
type = "text",
|
|
@@ -780,20 +726,20 @@ var Field = (_a) => {
|
|
|
780
726
|
"error",
|
|
781
727
|
"errorMessage"
|
|
782
728
|
]);
|
|
783
|
-
const ref =
|
|
729
|
+
const ref = useRef(null);
|
|
784
730
|
const { labelProps, inputProps, errorMessageProps } = useTextField(props, ref);
|
|
785
|
-
return /* @__PURE__ */
|
|
731
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(Label, __spreadValues({
|
|
786
732
|
variant: labelVariant,
|
|
787
733
|
htmlFor,
|
|
788
734
|
required
|
|
789
|
-
}, labelProps), props.label), /* @__PURE__ */
|
|
735
|
+
}, labelProps), props.label), /* @__PURE__ */ React20.createElement(Box, __spreadValues(__spreadProps(__spreadValues({
|
|
790
736
|
as: "input",
|
|
791
737
|
type,
|
|
792
738
|
id: htmlFor,
|
|
793
739
|
variant: `input.${variant}`
|
|
794
740
|
}, inputProps), {
|
|
795
741
|
ref
|
|
796
|
-
}), props)), error && errorMessage && /* @__PURE__ */
|
|
742
|
+
}), props)), error && errorMessage && /* @__PURE__ */ React20.createElement(ValidationMessage, __spreadValues({}, errorMessageProps), /* @__PURE__ */ React20.createElement(Exclamation2, {
|
|
797
743
|
size: 16
|
|
798
744
|
}), errorMessage));
|
|
799
745
|
};
|
|
@@ -802,26 +748,27 @@ var Field = (_a) => {
|
|
|
802
748
|
import { VisuallyHidden as VisuallyHidden2 } from "@react-aria/visually-hidden";
|
|
803
749
|
|
|
804
750
|
// src/Image/Image.tsx
|
|
805
|
-
import
|
|
751
|
+
import React21 from "react";
|
|
806
752
|
var Image = (_a) => {
|
|
807
753
|
var _b = _a, {
|
|
808
754
|
variant = "fullWidth"
|
|
809
755
|
} = _b, props = __objRest(_b, [
|
|
810
756
|
"variant"
|
|
811
757
|
]);
|
|
812
|
-
return /* @__PURE__ */
|
|
758
|
+
return /* @__PURE__ */ React21.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
813
759
|
as: "img",
|
|
814
760
|
variant: `image.${variant}`
|
|
815
761
|
}));
|
|
816
762
|
};
|
|
817
763
|
|
|
818
764
|
// src/Link/Link.tsx
|
|
819
|
-
import
|
|
765
|
+
import React22, { useRef as useRef2 } from "react";
|
|
820
766
|
import { useLink } from "@react-aria/link";
|
|
767
|
+
import { conditional as conditional2 } from "@marigold/system";
|
|
821
768
|
var Link = (_a) => {
|
|
822
769
|
var _b = _a, {
|
|
823
770
|
as = "a",
|
|
824
|
-
variant = "
|
|
771
|
+
variant = "",
|
|
825
772
|
children,
|
|
826
773
|
disabled
|
|
827
774
|
} = _b, props = __objRest(_b, [
|
|
@@ -830,20 +777,21 @@ var Link = (_a) => {
|
|
|
830
777
|
"children",
|
|
831
778
|
"disabled"
|
|
832
779
|
]);
|
|
833
|
-
const ref =
|
|
780
|
+
const ref = useRef2(null);
|
|
834
781
|
const { linkProps } = useLink(__spreadProps(__spreadValues({}, props), {
|
|
835
782
|
elementType: typeof as === "string" ? as : "span",
|
|
836
783
|
isDisabled: disabled
|
|
837
784
|
}), ref);
|
|
838
|
-
return /* @__PURE__ */
|
|
785
|
+
return /* @__PURE__ */ React22.createElement(Box, __spreadValues(__spreadValues({
|
|
839
786
|
as,
|
|
840
|
-
variant,
|
|
787
|
+
variant: conditional2(`link.${variant}`, { disabled }),
|
|
788
|
+
css: { cursor: disabled ? "default" : "pointer" },
|
|
841
789
|
ref
|
|
842
|
-
}), children);
|
|
790
|
+
}, props), linkProps), children);
|
|
843
791
|
};
|
|
844
792
|
|
|
845
793
|
// src/Menu/Menu.tsx
|
|
846
|
-
import
|
|
794
|
+
import React23 from "react";
|
|
847
795
|
var Menu = (_a) => {
|
|
848
796
|
var _b = _a, {
|
|
849
797
|
variant = "default",
|
|
@@ -858,12 +806,12 @@ var Menu = (_a) => {
|
|
|
858
806
|
"show",
|
|
859
807
|
"children"
|
|
860
808
|
]);
|
|
861
|
-
return /* @__PURE__ */
|
|
809
|
+
return /* @__PURE__ */ React23.createElement(Box, __spreadValues({
|
|
862
810
|
variant: `menu.${variant}`
|
|
863
|
-
}, props), /* @__PURE__ */
|
|
811
|
+
}, props), /* @__PURE__ */ React23.createElement(Button, {
|
|
864
812
|
onClick,
|
|
865
813
|
variant: "menu"
|
|
866
|
-
}, label), show ? /* @__PURE__ */
|
|
814
|
+
}, label), show ? /* @__PURE__ */ React23.createElement(Box, {
|
|
867
815
|
display: "block",
|
|
868
816
|
position: "absolute",
|
|
869
817
|
minWidth: "120px",
|
|
@@ -872,7 +820,7 @@ var Menu = (_a) => {
|
|
|
872
820
|
};
|
|
873
821
|
|
|
874
822
|
// src/MenuItem/MenuItem.tsx
|
|
875
|
-
import
|
|
823
|
+
import React24 from "react";
|
|
876
824
|
var MenuItem = (_a) => {
|
|
877
825
|
var _b = _a, {
|
|
878
826
|
variant = "default",
|
|
@@ -881,16 +829,16 @@ var MenuItem = (_a) => {
|
|
|
881
829
|
"variant",
|
|
882
830
|
"children"
|
|
883
831
|
]);
|
|
884
|
-
return /* @__PURE__ */
|
|
832
|
+
return /* @__PURE__ */ React24.createElement(Box, {
|
|
885
833
|
variant: `menuItem.${variant}`
|
|
886
|
-
}, /* @__PURE__ */
|
|
834
|
+
}, /* @__PURE__ */ React24.createElement(Link, __spreadValues({
|
|
887
835
|
variant: "menuItemLink"
|
|
888
836
|
}, props), children));
|
|
889
837
|
};
|
|
890
838
|
|
|
891
839
|
// src/Message/Message.tsx
|
|
892
|
-
import
|
|
893
|
-
import { Exclamation as
|
|
840
|
+
import React25 from "react";
|
|
841
|
+
import { Exclamation as Exclamation3, Info, Notification } from "@marigold/icons";
|
|
894
842
|
var Message = (_a) => {
|
|
895
843
|
var _b = _a, {
|
|
896
844
|
messageTitle,
|
|
@@ -903,62 +851,62 @@ var Message = (_a) => {
|
|
|
903
851
|
"className",
|
|
904
852
|
"children"
|
|
905
853
|
]);
|
|
906
|
-
var icon = /* @__PURE__ */
|
|
854
|
+
var icon = /* @__PURE__ */ React25.createElement(Info, null);
|
|
907
855
|
if (variant === "warning") {
|
|
908
|
-
icon = /* @__PURE__ */
|
|
856
|
+
icon = /* @__PURE__ */ React25.createElement(Notification, null);
|
|
909
857
|
}
|
|
910
858
|
if (variant === "error") {
|
|
911
|
-
icon = /* @__PURE__ */
|
|
859
|
+
icon = /* @__PURE__ */ React25.createElement(Exclamation3, null);
|
|
912
860
|
}
|
|
913
|
-
return /* @__PURE__ */
|
|
861
|
+
return /* @__PURE__ */ React25.createElement(Box, __spreadValues({
|
|
914
862
|
display: "inline-block",
|
|
915
863
|
variant: `message.${variant}`,
|
|
916
864
|
className
|
|
917
|
-
}, props), /* @__PURE__ */
|
|
865
|
+
}, props), /* @__PURE__ */ React25.createElement(Box, {
|
|
918
866
|
display: "flex",
|
|
919
867
|
alignItems: "center",
|
|
920
868
|
variant: "message.title"
|
|
921
|
-
}, icon, /* @__PURE__ */
|
|
869
|
+
}, icon, /* @__PURE__ */ React25.createElement(Text, {
|
|
922
870
|
as: "h4",
|
|
923
871
|
variant: "headline4"
|
|
924
|
-
}, messageTitle)), /* @__PURE__ */
|
|
872
|
+
}, messageTitle)), /* @__PURE__ */ React25.createElement(Box, {
|
|
925
873
|
css: { color: "black" }
|
|
926
874
|
}, children));
|
|
927
875
|
};
|
|
928
876
|
|
|
929
877
|
// src/Provider/index.ts
|
|
930
|
-
import { useTheme as
|
|
878
|
+
import { useTheme as useTheme2, ThemeProvider as ThemeProvider2 } from "@marigold/system";
|
|
931
879
|
import { SSRProvider } from "@react-aria/ssr";
|
|
932
880
|
|
|
933
881
|
// src/Provider/MarigoldProvider.tsx
|
|
934
|
-
import
|
|
882
|
+
import React26 from "react";
|
|
935
883
|
import { OverlayProvider } from "@react-aria/overlays";
|
|
936
884
|
import {
|
|
937
885
|
Global,
|
|
938
886
|
ThemeProvider,
|
|
939
|
-
useTheme
|
|
887
|
+
useTheme,
|
|
940
888
|
__defaultTheme
|
|
941
889
|
} from "@marigold/system";
|
|
942
890
|
function MarigoldProvider({
|
|
943
891
|
theme,
|
|
944
892
|
children
|
|
945
893
|
}) {
|
|
946
|
-
const outer =
|
|
894
|
+
const outer = useTheme();
|
|
947
895
|
const isTopLevel = outer.theme === __defaultTheme;
|
|
948
|
-
return /* @__PURE__ */
|
|
896
|
+
return /* @__PURE__ */ React26.createElement(ThemeProvider, {
|
|
949
897
|
theme
|
|
950
|
-
}, isTopLevel ? /* @__PURE__ */
|
|
898
|
+
}, isTopLevel ? /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(Global, null), /* @__PURE__ */ React26.createElement(OverlayProvider, null, children)) : children);
|
|
951
899
|
}
|
|
952
900
|
|
|
953
901
|
// src/Radio/Radio.tsx
|
|
954
|
-
import
|
|
955
|
-
import { Exclamation as
|
|
902
|
+
import React28 from "react";
|
|
903
|
+
import { Exclamation as Exclamation4 } from "@marigold/icons";
|
|
956
904
|
import { useFocusRing as useFocusRing2 } from "@react-aria/focus";
|
|
957
905
|
import { VisuallyHidden as VisuallyHidden3 } from "@react-aria/visually-hidden";
|
|
958
906
|
|
|
959
907
|
// src/Radio/RadioIcon.tsx
|
|
960
|
-
import
|
|
961
|
-
import { conditional as
|
|
908
|
+
import React27 from "react";
|
|
909
|
+
import { conditional as conditional3, SVG as SVG2 } from "@marigold/system";
|
|
962
910
|
var RadioIcon = ({
|
|
963
911
|
variant = "",
|
|
964
912
|
checked = false,
|
|
@@ -971,19 +919,19 @@ var RadioIcon = ({
|
|
|
971
919
|
checked,
|
|
972
920
|
error
|
|
973
921
|
};
|
|
974
|
-
return /* @__PURE__ */
|
|
922
|
+
return /* @__PURE__ */ React27.createElement(SVG2, {
|
|
975
923
|
width: "16",
|
|
976
924
|
height: "32",
|
|
977
925
|
viewBox: "0 0 16 32",
|
|
978
926
|
fill: "none",
|
|
979
927
|
"aria-hidden": "true"
|
|
980
|
-
}, /* @__PURE__ */
|
|
981
|
-
variant:
|
|
928
|
+
}, /* @__PURE__ */ React27.createElement(Box, {
|
|
929
|
+
variant: conditional3(`radio.${variant}`, conditionalStates),
|
|
982
930
|
as: "circle",
|
|
983
931
|
cx: "8",
|
|
984
932
|
cy: "16",
|
|
985
933
|
r: "7.5"
|
|
986
|
-
}), checked && /* @__PURE__ */
|
|
934
|
+
}), checked && /* @__PURE__ */ React27.createElement("circle", {
|
|
987
935
|
fill: "white",
|
|
988
936
|
cx: "8",
|
|
989
937
|
cy: "16",
|
|
@@ -996,12 +944,12 @@ var RadioInput = (_a) => {
|
|
|
996
944
|
var _b = _a, { error } = _b, props = __objRest(_b, ["error"]);
|
|
997
945
|
const { focusProps } = useFocusRing2();
|
|
998
946
|
const _a2 = props, { children } = _a2, restProps = __objRest(_a2, ["children"]);
|
|
999
|
-
return /* @__PURE__ */
|
|
947
|
+
return /* @__PURE__ */ React28.createElement(Box, {
|
|
1000
948
|
pr: "xsmall"
|
|
1001
|
-
}, /* @__PURE__ */
|
|
949
|
+
}, /* @__PURE__ */ React28.createElement(VisuallyHidden3, null, /* @__PURE__ */ React28.createElement("input", __spreadValues(__spreadValues({
|
|
1002
950
|
type: "radio",
|
|
1003
951
|
disabled: props.disabled
|
|
1004
|
-
}, focusProps), restProps))), /* @__PURE__ */
|
|
952
|
+
}, focusProps), restProps))), /* @__PURE__ */ React28.createElement(RadioIcon, {
|
|
1005
953
|
variant: props.variant,
|
|
1006
954
|
disabled: props.disabled,
|
|
1007
955
|
checked: props.checked,
|
|
@@ -1018,34 +966,22 @@ var Radio = (_a) => {
|
|
|
1018
966
|
"labelVariant",
|
|
1019
967
|
"errorMessage"
|
|
1020
968
|
]);
|
|
1021
|
-
return /* @__PURE__ */
|
|
969
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(Box, {
|
|
1022
970
|
as: Label,
|
|
1023
971
|
htmlFor: props.id,
|
|
1024
972
|
required,
|
|
1025
973
|
variant: `label.${labelVariant}`,
|
|
1026
974
|
css: props.disabled ? { color: "disabled", ":hover": { cursor: "not-allowed" } } : { color: "text", ":hover": { cursor: "pointer" } }
|
|
1027
|
-
}, /* @__PURE__ */
|
|
975
|
+
}, /* @__PURE__ */ React28.createElement(Box, __spreadValues({
|
|
1028
976
|
as: RadioInput,
|
|
1029
977
|
error: props.error
|
|
1030
|
-
}, props)), props.children), props.error && errorMessage && /* @__PURE__ */
|
|
978
|
+
}, props)), props.children), props.error && errorMessage && /* @__PURE__ */ React28.createElement(ValidationMessage, null, /* @__PURE__ */ React28.createElement(Exclamation4, {
|
|
1031
979
|
size: 16
|
|
1032
980
|
}), errorMessage));
|
|
1033
981
|
};
|
|
1034
982
|
|
|
1035
|
-
// src/Slider/Slider.tsx
|
|
1036
|
-
import React27 from "react";
|
|
1037
|
-
var Slider = (_a) => {
|
|
1038
|
-
var _b = _a, { variant = "" } = _b, props = __objRest(_b, ["variant"]);
|
|
1039
|
-
return /* @__PURE__ */ React27.createElement(Box, __spreadValues({
|
|
1040
|
-
as: "input",
|
|
1041
|
-
type: "range",
|
|
1042
|
-
css: { verticalAlign: "middle" },
|
|
1043
|
-
variant: `slider.${variant}`
|
|
1044
|
-
}, props));
|
|
1045
|
-
};
|
|
1046
|
-
|
|
1047
983
|
// src/Select/Select.tsx
|
|
1048
|
-
import
|
|
984
|
+
import React33, { useRef as useRef5 } from "react";
|
|
1049
985
|
import { useSelectState } from "@react-stately/select";
|
|
1050
986
|
import { useButton as useButton3 } from "@react-aria/button";
|
|
1051
987
|
import { mergeProps as mergeProps2 } from "@react-aria/utils";
|
|
@@ -1053,18 +989,18 @@ import { useFocusRing as useFocusRing3 } from "@react-aria/focus";
|
|
|
1053
989
|
import { HiddenSelect, useSelect } from "@react-aria/select";
|
|
1054
990
|
import { useOverlayTriggerState as useOverlayTriggerState2 } from "@react-stately/overlays";
|
|
1055
991
|
import { useOverlayTrigger, useOverlayPosition } from "@react-aria/overlays";
|
|
1056
|
-
import { ArrowDown, ArrowUp, Exclamation as
|
|
992
|
+
import { ArrowDown, ArrowUp, Exclamation as Exclamation5, Required as Required2 } from "@marigold/icons";
|
|
1057
993
|
|
|
1058
994
|
// src/Select/ListBox.tsx
|
|
1059
|
-
import
|
|
995
|
+
import React31, { useRef as useRef4 } from "react";
|
|
1060
996
|
import { useListBox } from "@react-aria/listbox";
|
|
1061
997
|
|
|
1062
998
|
// src/Select/Option.tsx
|
|
1063
|
-
import
|
|
999
|
+
import React29, { useEffect, useRef as useRef3, useState } from "react";
|
|
1064
1000
|
import { useOption } from "@react-aria/listbox";
|
|
1065
1001
|
var Option = ({ item, state }) => {
|
|
1066
|
-
const ref =
|
|
1067
|
-
const [disabled, setDisabled] =
|
|
1002
|
+
const ref = useRef3(null);
|
|
1003
|
+
const [disabled, setDisabled] = useState(false);
|
|
1068
1004
|
const { optionProps, isSelected } = useOption({
|
|
1069
1005
|
key: item.key
|
|
1070
1006
|
}, state, ref);
|
|
@@ -1075,7 +1011,7 @@ var Option = ({ item, state }) => {
|
|
|
1075
1011
|
}
|
|
1076
1012
|
}
|
|
1077
1013
|
}, [state.disabledKeys, item.key]);
|
|
1078
|
-
return /* @__PURE__ */
|
|
1014
|
+
return /* @__PURE__ */ React29.createElement(Box, __spreadProps(__spreadValues({
|
|
1079
1015
|
as: "li"
|
|
1080
1016
|
}, optionProps), {
|
|
1081
1017
|
ref,
|
|
@@ -1084,26 +1020,26 @@ var Option = ({ item, state }) => {
|
|
|
1084
1020
|
};
|
|
1085
1021
|
|
|
1086
1022
|
// src/Select/ListBoxSection.tsx
|
|
1087
|
-
import
|
|
1023
|
+
import React30 from "react";
|
|
1088
1024
|
import { useListBoxSection } from "@react-aria/listbox";
|
|
1089
1025
|
var ListBoxSection = ({ section, state }) => {
|
|
1090
1026
|
const { itemProps, headingProps, groupProps } = useListBoxSection({
|
|
1091
1027
|
heading: section.rendered,
|
|
1092
1028
|
"aria-label": section["aria-label"]
|
|
1093
1029
|
});
|
|
1094
|
-
return /* @__PURE__ */
|
|
1030
|
+
return /* @__PURE__ */ React30.createElement(Box, __spreadProps(__spreadValues({
|
|
1095
1031
|
as: "li"
|
|
1096
1032
|
}, itemProps), {
|
|
1097
1033
|
css: {
|
|
1098
1034
|
cursor: "not-allowed"
|
|
1099
1035
|
}
|
|
1100
|
-
}), section.rendered && /* @__PURE__ */
|
|
1036
|
+
}), section.rendered && /* @__PURE__ */ React30.createElement(Box, __spreadProps(__spreadValues({
|
|
1101
1037
|
as: "span"
|
|
1102
1038
|
}, headingProps), {
|
|
1103
1039
|
variant: "select.section"
|
|
1104
|
-
}), section.rendered), /* @__PURE__ */
|
|
1040
|
+
}), section.rendered), /* @__PURE__ */ React30.createElement(Box, __spreadValues({
|
|
1105
1041
|
as: "ul"
|
|
1106
|
-
}, groupProps), [...section.childNodes].map((node) => /* @__PURE__ */
|
|
1042
|
+
}, groupProps), [...section.childNodes].map((node) => /* @__PURE__ */ React30.createElement(Option, {
|
|
1107
1043
|
key: node.key,
|
|
1108
1044
|
item: node,
|
|
1109
1045
|
state
|
|
@@ -1112,10 +1048,10 @@ var ListBoxSection = ({ section, state }) => {
|
|
|
1112
1048
|
|
|
1113
1049
|
// src/Select/ListBox.tsx
|
|
1114
1050
|
var ListBox = (props) => {
|
|
1115
|
-
const ref =
|
|
1051
|
+
const ref = useRef4(null);
|
|
1116
1052
|
const { state, error } = props;
|
|
1117
1053
|
const { listBoxProps } = useListBox(props, state, ref);
|
|
1118
|
-
return /* @__PURE__ */
|
|
1054
|
+
return /* @__PURE__ */ React31.createElement(Box, __spreadProps(__spreadValues({
|
|
1119
1055
|
as: "ul",
|
|
1120
1056
|
p: "none",
|
|
1121
1057
|
css: {
|
|
@@ -1124,11 +1060,11 @@ var ListBox = (props) => {
|
|
|
1124
1060
|
}, listBoxProps), {
|
|
1125
1061
|
variant: error ? "select.listbox.error" : "select.listbox",
|
|
1126
1062
|
ref
|
|
1127
|
-
}), [...state.collection].map((item) => item.type === "section" ? /* @__PURE__ */
|
|
1063
|
+
}), [...state.collection].map((item) => item.type === "section" ? /* @__PURE__ */ React31.createElement(ListBoxSection, {
|
|
1128
1064
|
key: item.key,
|
|
1129
1065
|
section: item,
|
|
1130
1066
|
state
|
|
1131
|
-
}) : /* @__PURE__ */
|
|
1067
|
+
}) : /* @__PURE__ */ React31.createElement(Option, {
|
|
1132
1068
|
key: item.key,
|
|
1133
1069
|
item,
|
|
1134
1070
|
state
|
|
@@ -1136,7 +1072,7 @@ var ListBox = (props) => {
|
|
|
1136
1072
|
};
|
|
1137
1073
|
|
|
1138
1074
|
// src/Select/Popover.tsx
|
|
1139
|
-
import
|
|
1075
|
+
import React32, { forwardRef as forwardRef3 } from "react";
|
|
1140
1076
|
import { FocusScope as FocusScope2 } from "@react-aria/focus";
|
|
1141
1077
|
import {
|
|
1142
1078
|
DismissButton,
|
|
@@ -1154,12 +1090,12 @@ var Popover = forwardRef3((_a, ref) => {
|
|
|
1154
1090
|
isDismissable: true
|
|
1155
1091
|
}, ref);
|
|
1156
1092
|
const { modalProps } = useModal2();
|
|
1157
|
-
return /* @__PURE__ */
|
|
1093
|
+
return /* @__PURE__ */ React32.createElement(OverlayContainer2, null, /* @__PURE__ */ React32.createElement(FocusScope2, {
|
|
1158
1094
|
restoreFocus: true
|
|
1159
|
-
}, /* @__PURE__ */
|
|
1095
|
+
}, /* @__PURE__ */ React32.createElement(Box, __spreadProps(__spreadValues({}, mergeProps(overlayProps, otherProps, modalProps)), {
|
|
1160
1096
|
className,
|
|
1161
1097
|
ref
|
|
1162
|
-
}), children, /* @__PURE__ */
|
|
1098
|
+
}), children, /* @__PURE__ */ React32.createElement(DismissButton, {
|
|
1163
1099
|
onDismiss: onClose
|
|
1164
1100
|
}))));
|
|
1165
1101
|
});
|
|
@@ -1187,8 +1123,8 @@ var Select = (_a) => {
|
|
|
1187
1123
|
]);
|
|
1188
1124
|
const state = useSelectState(props);
|
|
1189
1125
|
const overlayTriggerState = useOverlayTriggerState2({});
|
|
1190
|
-
const triggerRef =
|
|
1191
|
-
const overlayRef =
|
|
1126
|
+
const triggerRef = useRef5();
|
|
1127
|
+
const overlayRef = useRef5();
|
|
1192
1128
|
const { overlayProps } = useOverlayTrigger({ type: "listbox" }, overlayTriggerState, triggerRef);
|
|
1193
1129
|
const { overlayProps: positionProps } = useOverlayPosition({
|
|
1194
1130
|
targetRef: triggerRef,
|
|
@@ -1201,47 +1137,44 @@ var Select = (_a) => {
|
|
|
1201
1137
|
const { labelProps, triggerProps, valueProps, menuProps } = useSelect(props, state, triggerRef);
|
|
1202
1138
|
const { buttonProps } = useButton3(triggerProps, triggerRef);
|
|
1203
1139
|
const { focusProps } = useFocusRing3();
|
|
1204
|
-
return /* @__PURE__ */
|
|
1140
|
+
return /* @__PURE__ */ React33.createElement(Box, {
|
|
1205
1141
|
position: "relative",
|
|
1206
1142
|
display: "inline-block",
|
|
1207
1143
|
width: width && width
|
|
1208
|
-
}, props.label && /* @__PURE__ */
|
|
1144
|
+
}, props.label && /* @__PURE__ */ React33.createElement(Box, null, /* @__PURE__ */ React33.createElement(Label, __spreadProps(__spreadValues({}, labelProps), {
|
|
1209
1145
|
htmlFor: labelProps.id,
|
|
1210
1146
|
variant: labelVariant
|
|
1211
|
-
}), required ? /* @__PURE__ */
|
|
1147
|
+
}), required ? /* @__PURE__ */ React33.createElement(Box, {
|
|
1212
1148
|
as: "span",
|
|
1213
1149
|
display: "inline-flex",
|
|
1214
1150
|
alignItems: "center"
|
|
1215
|
-
}, props.label, /* @__PURE__ */
|
|
1216
|
-
as: Required2,
|
|
1151
|
+
}, props.label, /* @__PURE__ */ React33.createElement(Required2, {
|
|
1217
1152
|
size: 16,
|
|
1218
|
-
|
|
1219
|
-
})) : props.label)), /* @__PURE__ */
|
|
1153
|
+
fill: "error"
|
|
1154
|
+
})) : props.label)), /* @__PURE__ */ React33.createElement(HiddenSelect, {
|
|
1220
1155
|
state,
|
|
1221
1156
|
triggerRef,
|
|
1222
1157
|
label: props.label,
|
|
1223
1158
|
name: props.name,
|
|
1224
1159
|
isDisabled: disabled
|
|
1225
|
-
}), /* @__PURE__ */
|
|
1160
|
+
}), /* @__PURE__ */ React33.createElement(Box, __spreadProps(__spreadValues({
|
|
1226
1161
|
as: "button"
|
|
1227
1162
|
}, mergeProps2(buttonProps, focusProps)), {
|
|
1228
1163
|
ref: triggerRef,
|
|
1229
1164
|
variant: error && state.isOpen && !disabled ? "button.select.errorOpened" : error ? "button.select.error" : state.isOpen && !disabled ? "button.select.open" : "button.select",
|
|
1230
1165
|
disabled,
|
|
1231
1166
|
className
|
|
1232
|
-
}), /* @__PURE__ */
|
|
1167
|
+
}), /* @__PURE__ */ React33.createElement(Box, __spreadProps(__spreadValues({
|
|
1233
1168
|
as: "span"
|
|
1234
1169
|
}, valueProps), {
|
|
1235
1170
|
variant: disabled ? "select.disabled" : "select"
|
|
1236
|
-
}), state.selectedItem ? state.selectedItem.rendered : placeholder), state.isOpen && !disabled ? /* @__PURE__ */
|
|
1237
|
-
as: ArrowUp,
|
|
1171
|
+
}), state.selectedItem ? state.selectedItem.rendered : placeholder), state.isOpen && !disabled ? /* @__PURE__ */ React33.createElement(ArrowUp, {
|
|
1238
1172
|
size: 16,
|
|
1239
|
-
|
|
1240
|
-
}) : /* @__PURE__ */
|
|
1241
|
-
as: ArrowDown,
|
|
1173
|
+
fill: "text"
|
|
1174
|
+
}) : /* @__PURE__ */ React33.createElement(ArrowDown, {
|
|
1242
1175
|
size: 16,
|
|
1243
|
-
|
|
1244
|
-
})), state.isOpen && !disabled && /* @__PURE__ */
|
|
1176
|
+
fill: disabled ? "disabled" : "text"
|
|
1177
|
+
})), state.isOpen && !disabled && /* @__PURE__ */ React33.createElement(Box, __spreadProps(__spreadValues(__spreadValues({
|
|
1245
1178
|
as: Popover
|
|
1246
1179
|
}, overlayProps), positionProps), {
|
|
1247
1180
|
css: {
|
|
@@ -1250,25 +1183,100 @@ var Select = (_a) => {
|
|
|
1250
1183
|
ref: overlayRef,
|
|
1251
1184
|
isOpen: state.isOpen,
|
|
1252
1185
|
onClose: state.close
|
|
1253
|
-
}), /* @__PURE__ */
|
|
1186
|
+
}), /* @__PURE__ */ React33.createElement(ListBox, __spreadProps(__spreadValues({
|
|
1254
1187
|
error
|
|
1255
1188
|
}, menuProps), {
|
|
1256
1189
|
state
|
|
1257
|
-
}))), error && errorMessage && /* @__PURE__ */
|
|
1190
|
+
}))), error && errorMessage && /* @__PURE__ */ React33.createElement(Box, {
|
|
1258
1191
|
as: "span",
|
|
1259
1192
|
display: "inline-flex",
|
|
1260
1193
|
alignItems: "center"
|
|
1261
|
-
}, /* @__PURE__ */
|
|
1262
|
-
as:
|
|
1194
|
+
}, /* @__PURE__ */ React33.createElement(Box, {
|
|
1195
|
+
as: Exclamation5,
|
|
1263
1196
|
size: 16,
|
|
1264
1197
|
css: { color: "error" }
|
|
1265
|
-
}), /* @__PURE__ */
|
|
1198
|
+
}), /* @__PURE__ */ React33.createElement(ValidationMessage, null, errorMessage)));
|
|
1199
|
+
};
|
|
1200
|
+
|
|
1201
|
+
// src/Slider/Slider.tsx
|
|
1202
|
+
import React34 from "react";
|
|
1203
|
+
var Slider = (_a) => {
|
|
1204
|
+
var _b = _a, { variant = "" } = _b, props = __objRest(_b, ["variant"]);
|
|
1205
|
+
return /* @__PURE__ */ React34.createElement(Box, __spreadValues({
|
|
1206
|
+
as: "input",
|
|
1207
|
+
type: "range",
|
|
1208
|
+
css: { verticalAlign: "middle" },
|
|
1209
|
+
variant: `slider.${variant}`
|
|
1210
|
+
}, props));
|
|
1211
|
+
};
|
|
1212
|
+
|
|
1213
|
+
// src/Switch/Switch.tsx
|
|
1214
|
+
import React35, { useRef as useRef6 } from "react";
|
|
1215
|
+
import { useFocusRing as useFocusRing4 } from "@react-aria/focus";
|
|
1216
|
+
import { useSwitch } from "@react-aria/switch";
|
|
1217
|
+
import { VisuallyHidden as VisuallyHidden4 } from "@react-aria/visually-hidden";
|
|
1218
|
+
import { useToggleState as useToggleState2 } from "@react-stately/toggle";
|
|
1219
|
+
import { conditional as conditional4 } from "@marigold/system";
|
|
1220
|
+
var Switch = (_a) => {
|
|
1221
|
+
var _b = _a, {
|
|
1222
|
+
variant = "",
|
|
1223
|
+
labelVariant = "above",
|
|
1224
|
+
disabled
|
|
1225
|
+
} = _b, props = __objRest(_b, [
|
|
1226
|
+
"variant",
|
|
1227
|
+
"labelVariant",
|
|
1228
|
+
"disabled"
|
|
1229
|
+
]);
|
|
1230
|
+
const state = useToggleState2(props);
|
|
1231
|
+
const ref = useRef6();
|
|
1232
|
+
const { inputProps } = useSwitch(props, state, ref);
|
|
1233
|
+
const { focusProps } = useFocusRing4();
|
|
1234
|
+
return /* @__PURE__ */ React35.createElement(Box, {
|
|
1235
|
+
as: Label,
|
|
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), {
|
|
1241
|
+
disabled,
|
|
1242
|
+
ref
|
|
1243
|
+
}))), /* @__PURE__ */ React35.createElement(Box, {
|
|
1244
|
+
as: "svg",
|
|
1245
|
+
__baseCSS: {
|
|
1246
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
1247
|
+
width: 56,
|
|
1248
|
+
height: 32
|
|
1249
|
+
},
|
|
1250
|
+
"aria-hidden": "true"
|
|
1251
|
+
}, /* @__PURE__ */ React35.createElement(Box, {
|
|
1252
|
+
as: "rect",
|
|
1253
|
+
__baseCSS: {
|
|
1254
|
+
x: 4,
|
|
1255
|
+
y: 4,
|
|
1256
|
+
rx: 12,
|
|
1257
|
+
width: 48,
|
|
1258
|
+
height: 24
|
|
1259
|
+
},
|
|
1260
|
+
variant: conditional4(`switch.${variant}`, {
|
|
1261
|
+
checked: state.isSelected,
|
|
1262
|
+
disabled
|
|
1263
|
+
})
|
|
1264
|
+
}), /* @__PURE__ */ React35.createElement(Box, {
|
|
1265
|
+
as: "circle",
|
|
1266
|
+
__baseCSS: {
|
|
1267
|
+
boxShadow: "1px 1px 4px rgba(0, 0, 0, 0.25)",
|
|
1268
|
+
cx: state.isSelected ? 40 : 16,
|
|
1269
|
+
cy: 16,
|
|
1270
|
+
r: 11,
|
|
1271
|
+
fill: disabled ? "gray20" : "gray00"
|
|
1272
|
+
}
|
|
1273
|
+
})));
|
|
1266
1274
|
};
|
|
1267
1275
|
|
|
1268
1276
|
// src/Textarea/Textarea.tsx
|
|
1269
|
-
import
|
|
1277
|
+
import React36, { useRef as useRef7 } from "react";
|
|
1270
1278
|
import { useTextField as useTextField2 } from "@react-aria/textfield";
|
|
1271
|
-
import { Exclamation as
|
|
1279
|
+
import { Exclamation as Exclamation6 } from "@marigold/icons";
|
|
1272
1280
|
var Textarea = (_a) => {
|
|
1273
1281
|
var _b = _a, {
|
|
1274
1282
|
variant = "",
|
|
@@ -1289,10 +1297,10 @@ var Textarea = (_a) => {
|
|
|
1289
1297
|
const { labelProps, inputProps, errorMessageProps } = useTextField2(__spreadProps(__spreadValues({}, props), {
|
|
1290
1298
|
inputElementType: "textarea"
|
|
1291
1299
|
}), ref);
|
|
1292
|
-
return /* @__PURE__ */
|
|
1300
|
+
return /* @__PURE__ */ React36.createElement(Box, null, /* @__PURE__ */ React36.createElement(Label, __spreadValues({
|
|
1293
1301
|
htmlFor,
|
|
1294
1302
|
required
|
|
1295
|
-
}, labelProps), props.label), /* @__PURE__ */
|
|
1303
|
+
}, labelProps), props.label), /* @__PURE__ */ React36.createElement(Box, __spreadValues(__spreadProps(__spreadValues({
|
|
1296
1304
|
as: "textarea",
|
|
1297
1305
|
variant: `textarea.${variant}`,
|
|
1298
1306
|
css: {
|
|
@@ -1300,13 +1308,75 @@ var Textarea = (_a) => {
|
|
|
1300
1308
|
}
|
|
1301
1309
|
}, inputProps), {
|
|
1302
1310
|
ref
|
|
1303
|
-
}), props)), error && errorMessage && /* @__PURE__ */
|
|
1311
|
+
}), props)), error && errorMessage && /* @__PURE__ */ React36.createElement(ValidationMessage, __spreadValues({}, errorMessageProps), /* @__PURE__ */ React36.createElement(Exclamation6, {
|
|
1304
1312
|
size: 16
|
|
1305
1313
|
}), errorMessage));
|
|
1306
1314
|
};
|
|
1307
1315
|
|
|
1316
|
+
// src/Tiles/Tiles.tsx
|
|
1317
|
+
import React37 from "react";
|
|
1318
|
+
var Tiles = React37.forwardRef(function Tiles2(_a, ref) {
|
|
1319
|
+
var _b = _a, { space = "none", itemMinWidth = "250px", children } = _b, props = __objRest(_b, ["space", "itemMinWidth", "children"]);
|
|
1320
|
+
return /* @__PURE__ */ React37.createElement(Box, __spreadValues({
|
|
1321
|
+
ref,
|
|
1322
|
+
display: "grid",
|
|
1323
|
+
__baseCSS: {
|
|
1324
|
+
gap: space,
|
|
1325
|
+
gridTemplateColumns: `repeat(auto-fit, minmax(min(${itemMinWidth}, 100%), 1fr))`
|
|
1326
|
+
}
|
|
1327
|
+
}, props), children);
|
|
1328
|
+
});
|
|
1329
|
+
|
|
1330
|
+
// src/Tooltip/Tooltip.tsx
|
|
1331
|
+
import React39, { useContext } from "react";
|
|
1332
|
+
import { useTooltip } from "@react-aria/tooltip";
|
|
1333
|
+
import { mergeProps as mergeProps3 } from "@react-aria/utils";
|
|
1334
|
+
|
|
1335
|
+
// src/Tooltip/TooltipTrigger.tsx
|
|
1336
|
+
import React38, { useRef as useRef8 } from "react";
|
|
1337
|
+
import { FocusableProvider } from "@react-aria/focus";
|
|
1338
|
+
import { useTooltipTrigger } from "@react-aria/tooltip";
|
|
1339
|
+
import {
|
|
1340
|
+
useTooltipTriggerState
|
|
1341
|
+
} from "@react-stately/tooltip";
|
|
1342
|
+
var TooltipContext = React38.createContext({});
|
|
1343
|
+
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
|
+
var _b = _a, {
|
|
1361
|
+
variant = "",
|
|
1362
|
+
children
|
|
1363
|
+
} = _b, props = __objRest(_b, [
|
|
1364
|
+
"variant",
|
|
1365
|
+
"children"
|
|
1366
|
+
]);
|
|
1367
|
+
const _a2 = useContext(TooltipContext), { state } = _a2, tooltipProviderProps = __objRest(_a2, ["state"]);
|
|
1368
|
+
const mergedProps = mergeProps3(props, tooltipProviderProps);
|
|
1369
|
+
const { tooltipProps } = useTooltip(mergedProps, state);
|
|
1370
|
+
return /* @__PURE__ */ React39.createElement(Box, __spreadValues({
|
|
1371
|
+
position: "relative"
|
|
1372
|
+
}, tooltipProps), /* @__PURE__ */ React39.createElement(Box, __spreadValues({
|
|
1373
|
+
position: "absolute",
|
|
1374
|
+
variant: `tooltip.${variant}`
|
|
1375
|
+
}, mergedProps), children));
|
|
1376
|
+
};
|
|
1377
|
+
|
|
1308
1378
|
// src/Input/Input.tsx
|
|
1309
|
-
import
|
|
1379
|
+
import React40 from "react";
|
|
1310
1380
|
var Input = (_a) => {
|
|
1311
1381
|
var _b = _a, {
|
|
1312
1382
|
variant = "",
|
|
@@ -1315,7 +1385,7 @@ var Input = (_a) => {
|
|
|
1315
1385
|
"variant",
|
|
1316
1386
|
"type"
|
|
1317
1387
|
]);
|
|
1318
|
-
return /* @__PURE__ */
|
|
1388
|
+
return /* @__PURE__ */ React40.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
1319
1389
|
as: "input",
|
|
1320
1390
|
type,
|
|
1321
1391
|
variant: `input.${variant}`
|
|
@@ -1323,25 +1393,63 @@ var Input = (_a) => {
|
|
|
1323
1393
|
};
|
|
1324
1394
|
|
|
1325
1395
|
// src/Container/Container.tsx
|
|
1326
|
-
import
|
|
1396
|
+
import React41 from "react";
|
|
1397
|
+
import { size as tokenSize } from "@marigold/tokens";
|
|
1398
|
+
var ALIGNMENT3 = {
|
|
1399
|
+
left: "flex-start",
|
|
1400
|
+
center: "center",
|
|
1401
|
+
right: "flex-end"
|
|
1402
|
+
};
|
|
1327
1403
|
var Container = (_a) => {
|
|
1328
|
-
var _b = _a, {
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1404
|
+
var _b = _a, {
|
|
1405
|
+
contentType = "content",
|
|
1406
|
+
size = "medium",
|
|
1407
|
+
align = "left",
|
|
1408
|
+
alignContainer = "left",
|
|
1409
|
+
children
|
|
1410
|
+
} = _b, props = __objRest(_b, [
|
|
1411
|
+
"contentType",
|
|
1412
|
+
"size",
|
|
1413
|
+
"align",
|
|
1414
|
+
"alignContainer",
|
|
1415
|
+
"children"
|
|
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);
|
|
1332
1438
|
};
|
|
1333
1439
|
|
|
1334
1440
|
// src/index.ts
|
|
1335
1441
|
import { Item, Section } from "@react-stately/collections";
|
|
1336
1442
|
export {
|
|
1337
1443
|
ActionGroup,
|
|
1338
|
-
|
|
1444
|
+
Aside,
|
|
1445
|
+
Aspect,
|
|
1339
1446
|
Badge,
|
|
1340
1447
|
Box,
|
|
1448
|
+
Breakout,
|
|
1341
1449
|
Button,
|
|
1342
1450
|
Card,
|
|
1451
|
+
Center,
|
|
1343
1452
|
Checkbox,
|
|
1344
|
-
Column,
|
|
1345
1453
|
Columns,
|
|
1346
1454
|
Container,
|
|
1347
1455
|
Dialog,
|
|
@@ -1364,11 +1472,16 @@ export {
|
|
|
1364
1472
|
Select,
|
|
1365
1473
|
Slider,
|
|
1366
1474
|
Stack,
|
|
1475
|
+
Switch,
|
|
1367
1476
|
Text,
|
|
1368
1477
|
Textarea,
|
|
1369
1478
|
ThemeProvider2 as ThemeProvider,
|
|
1479
|
+
Tiles,
|
|
1480
|
+
Tooltip,
|
|
1481
|
+
TooltipContext,
|
|
1482
|
+
TooltipTrigger,
|
|
1370
1483
|
ValidationMessage,
|
|
1371
1484
|
VisuallyHidden2 as VisuallyHidden,
|
|
1372
1485
|
useDialogButtonProps,
|
|
1373
|
-
|
|
1486
|
+
useTheme2 as useTheme
|
|
1374
1487
|
};
|