@marigold/components 0.6.0 → 0.9.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 +293 -139
- package/dist/index.js +1341 -766
- package/dist/index.mjs +1343 -725
- package/package.json +18 -7
- package/CHANGELOG.md +0 -255
package/dist/index.mjs
CHANGED
|
@@ -30,516 +30,480 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
// src/
|
|
34
|
-
import
|
|
35
|
-
|
|
36
|
-
// src/Inline/Inline.tsx
|
|
37
|
-
import React, { Children as Children2 } from "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
|
-
}, []);
|
|
33
|
+
// src/Aside/Aside.tsx
|
|
34
|
+
import React from "react";
|
|
60
35
|
|
|
61
36
|
// src/Box.ts
|
|
62
37
|
import { Box } from "@marigold/system";
|
|
63
38
|
|
|
64
|
-
// src/
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
bottom: "flex-end"
|
|
69
|
-
};
|
|
70
|
-
var Inline = (_a) => {
|
|
71
|
-
var _b = _a, {
|
|
72
|
-
space = "none",
|
|
73
|
-
align = "center",
|
|
74
|
-
children
|
|
75
|
-
} = _b, props = __objRest(_b, [
|
|
76
|
-
"space",
|
|
77
|
-
"align",
|
|
78
|
-
"children"
|
|
79
|
-
]);
|
|
80
|
-
return /* @__PURE__ */ React.createElement(Box, __spreadValues({
|
|
81
|
-
__baseCSS: { gap: space, flexWrap: "wrap" },
|
|
82
|
-
display: "inline-flex",
|
|
83
|
-
alignItems: ALIGNMENT[align]
|
|
84
|
-
}, props), Children2.map(flattenChildren(children), (child) => child));
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
// src/Stack/Stack.tsx
|
|
88
|
-
import React2, { Children as Children3 } from "react";
|
|
89
|
-
var ALIGNMENT2 = {
|
|
90
|
-
left: "flex-start",
|
|
91
|
-
center: "center",
|
|
92
|
-
right: "flex-end"
|
|
39
|
+
// src/Aside/Aside.tsx
|
|
40
|
+
var SIDE_MAP = {
|
|
41
|
+
left: [":not(style):first-of-type", ":last-child"],
|
|
42
|
+
right: [":last-child", ":not(style):first-of-type"]
|
|
93
43
|
};
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
44
|
+
var Aside = ({
|
|
45
|
+
children,
|
|
46
|
+
sideWidth,
|
|
47
|
+
space = "none",
|
|
48
|
+
side = "left",
|
|
49
|
+
stretch = true,
|
|
50
|
+
wrap = "50%"
|
|
51
|
+
}) => {
|
|
52
|
+
const [aside, content] = SIDE_MAP[side];
|
|
53
|
+
return /* @__PURE__ */ React.createElement(Box, {
|
|
54
|
+
css: {
|
|
55
|
+
display: "flex",
|
|
56
|
+
flexWrap: "wrap",
|
|
57
|
+
gap: space,
|
|
58
|
+
alignItems: stretch ? void 0 : "flex-start",
|
|
59
|
+
[`> ${aside}`]: {
|
|
60
|
+
flexBasis: sideWidth,
|
|
61
|
+
flexGrow: 1
|
|
62
|
+
},
|
|
63
|
+
[`> ${content}`]: {
|
|
64
|
+
flexBasis: 0,
|
|
65
|
+
flexGrow: 999,
|
|
66
|
+
minInlineSize: wrap
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, children);
|
|
110
70
|
};
|
|
111
71
|
|
|
112
|
-
// src/
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
space
|
|
127
|
-
}, props), children);
|
|
128
|
-
};
|
|
72
|
+
// src/Aspect/Aspect.tsx
|
|
73
|
+
import React2 from "react";
|
|
74
|
+
import { aspect } from "@marigold/tokens";
|
|
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);
|
|
129
86
|
|
|
130
87
|
// src/Badge/Badge.tsx
|
|
131
|
-
import
|
|
88
|
+
import React3 from "react";
|
|
89
|
+
import { useComponentStyles } from "@marigold/system";
|
|
132
90
|
var Badge = (_a) => {
|
|
133
|
-
var _b = _a, {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
} = _b, props = __objRest(_b, [
|
|
139
|
-
"variant",
|
|
140
|
-
"bgColor",
|
|
141
|
-
"borderColor",
|
|
142
|
-
"children"
|
|
143
|
-
]);
|
|
144
|
-
return /* @__PURE__ */ React4.createElement(Box, __spreadValues({
|
|
145
|
-
css: { bg: bgColor, borderColor },
|
|
146
|
-
variant: `badge.${variant}`
|
|
147
|
-
}, props), children);
|
|
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
|
|
95
|
+
}), children);
|
|
148
96
|
};
|
|
149
97
|
|
|
150
98
|
// src/Button/Button.tsx
|
|
151
|
-
import
|
|
99
|
+
import React4, {
|
|
100
|
+
forwardRef,
|
|
101
|
+
useImperativeHandle,
|
|
102
|
+
useRef
|
|
103
|
+
} from "react";
|
|
152
104
|
import { useButton } from "@react-aria/button";
|
|
105
|
+
import { useFocusRing } from "@react-aria/focus";
|
|
106
|
+
import { mergeProps } from "@react-aria/utils";
|
|
107
|
+
import {
|
|
108
|
+
Box as Box2,
|
|
109
|
+
useComponentStyles as useComponentStyles2,
|
|
110
|
+
useStateProps
|
|
111
|
+
} from "@marigold/system";
|
|
153
112
|
var Button = forwardRef((_a, ref) => {
|
|
154
113
|
var _b = _a, {
|
|
155
114
|
as = "button",
|
|
156
|
-
variant = "primary",
|
|
157
|
-
size = "large",
|
|
158
|
-
space = "none",
|
|
159
|
-
disabled,
|
|
160
115
|
children,
|
|
161
|
-
|
|
116
|
+
variant,
|
|
117
|
+
size,
|
|
118
|
+
disabled
|
|
162
119
|
} = _b, props = __objRest(_b, [
|
|
163
120
|
"as",
|
|
121
|
+
"children",
|
|
164
122
|
"variant",
|
|
165
123
|
"size",
|
|
166
|
-
"
|
|
167
|
-
"disabled",
|
|
168
|
-
"children",
|
|
169
|
-
"className"
|
|
124
|
+
"disabled"
|
|
170
125
|
]);
|
|
171
|
-
const
|
|
126
|
+
const buttonRef = useRef(null);
|
|
127
|
+
useImperativeHandle(ref, () => buttonRef.current);
|
|
128
|
+
const { buttonProps, isPressed } = useButton(__spreadProps(__spreadValues({}, props), {
|
|
172
129
|
elementType: typeof as === "string" ? as : "span",
|
|
173
130
|
isDisabled: disabled
|
|
174
|
-
}),
|
|
175
|
-
|
|
131
|
+
}), buttonRef);
|
|
132
|
+
const { isFocusVisible, focusProps } = useFocusRing();
|
|
133
|
+
const styles = useComponentStyles2("Button", { variant, size });
|
|
134
|
+
const stateProps = useStateProps({
|
|
135
|
+
active: isPressed,
|
|
136
|
+
focus: isFocusVisible
|
|
137
|
+
});
|
|
138
|
+
return /* @__PURE__ */ React4.createElement(Box2, __spreadProps(__spreadValues(__spreadValues({}, mergeProps(buttonProps, focusProps)), stateProps), {
|
|
176
139
|
as,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
140
|
+
ref: buttonRef,
|
|
141
|
+
__baseCSS: {
|
|
142
|
+
display: "inline-flex",
|
|
143
|
+
alignItems: "center",
|
|
144
|
+
gap: "0.5ch",
|
|
145
|
+
cursor: disabled ? "not-allowed" : "pointer"
|
|
146
|
+
},
|
|
147
|
+
css: styles
|
|
183
148
|
}), children);
|
|
184
149
|
});
|
|
185
150
|
|
|
151
|
+
// src/Breakout/Breakout.tsx
|
|
152
|
+
import React5 from "react";
|
|
153
|
+
var useAlignment = (direction) => {
|
|
154
|
+
switch (direction) {
|
|
155
|
+
case "right":
|
|
156
|
+
return "flex-end";
|
|
157
|
+
case "bottom":
|
|
158
|
+
return "flex-end";
|
|
159
|
+
case "center":
|
|
160
|
+
return "center";
|
|
161
|
+
}
|
|
162
|
+
return "flex-start";
|
|
163
|
+
};
|
|
164
|
+
var Breakout = (_a) => {
|
|
165
|
+
var _b = _a, {
|
|
166
|
+
horizontalAlign,
|
|
167
|
+
verticalAlign,
|
|
168
|
+
children
|
|
169
|
+
} = _b, props = __objRest(_b, [
|
|
170
|
+
"horizontalAlign",
|
|
171
|
+
"verticalAlign",
|
|
172
|
+
"children"
|
|
173
|
+
]);
|
|
174
|
+
const alignItems = useAlignment(horizontalAlign);
|
|
175
|
+
const justifyContent = useAlignment(verticalAlign);
|
|
176
|
+
return /* @__PURE__ */ React5.createElement(Box, __spreadValues({
|
|
177
|
+
alignItems,
|
|
178
|
+
justifyContent,
|
|
179
|
+
width: "100%",
|
|
180
|
+
display: verticalAlign || horizontalAlign ? "flex" : "block",
|
|
181
|
+
css: {
|
|
182
|
+
gridColumn: "1 / -1"
|
|
183
|
+
}
|
|
184
|
+
}, props), children);
|
|
185
|
+
};
|
|
186
|
+
|
|
186
187
|
// src/Card/Card.tsx
|
|
187
188
|
import React6 from "react";
|
|
189
|
+
import {
|
|
190
|
+
Box as Box3,
|
|
191
|
+
useComponentStyles as useComponentStyles3
|
|
192
|
+
} from "@marigold/system";
|
|
188
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);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// src/Center/Center.tsx
|
|
202
|
+
import React7 from "react";
|
|
203
|
+
var Center = (_a) => {
|
|
189
204
|
var _b = _a, {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
width,
|
|
193
|
-
className,
|
|
205
|
+
maxWidth,
|
|
206
|
+
space = "none",
|
|
194
207
|
children
|
|
195
208
|
} = _b, props = __objRest(_b, [
|
|
196
|
-
"
|
|
197
|
-
"
|
|
198
|
-
"width",
|
|
199
|
-
"className",
|
|
209
|
+
"maxWidth",
|
|
210
|
+
"space",
|
|
200
211
|
"children"
|
|
201
212
|
]);
|
|
202
|
-
return /* @__PURE__ */
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
213
|
+
return /* @__PURE__ */ React7.createElement(Box, __spreadValues({
|
|
214
|
+
css: {
|
|
215
|
+
boxSizing: "content-box",
|
|
216
|
+
display: "flex",
|
|
217
|
+
flexDirection: "column",
|
|
218
|
+
alignItems: "center",
|
|
219
|
+
justifyContent: "center",
|
|
220
|
+
marginInline: "auto",
|
|
221
|
+
maxInlineSize: maxWidth,
|
|
222
|
+
gap: space
|
|
223
|
+
}
|
|
224
|
+
}, props), children);
|
|
211
225
|
};
|
|
212
226
|
|
|
213
227
|
// src/Checkbox/Checkbox.tsx
|
|
214
228
|
import React10 from "react";
|
|
215
|
-
import {
|
|
216
|
-
import {
|
|
217
|
-
import {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
let wasControlled = ref.current;
|
|
225
|
-
let isControlled = value !== void 0;
|
|
226
|
-
let stateRef = useRef(stateValue);
|
|
227
|
-
if (wasControlled !== isControlled) {
|
|
228
|
-
console.warn("WARN: A component changed from " + (wasControlled ? "controlled" : "uncontrolled") + " to " + (isControlled ? "controlled" : "uncontrolled") + ".");
|
|
229
|
-
}
|
|
230
|
-
ref.current = isControlled;
|
|
231
|
-
let setValue = useCallback(function(value2) {
|
|
232
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
233
|
-
args[_key - 1] = arguments[_key];
|
|
234
|
-
}
|
|
235
|
-
let onChangeCaller = function onChangeCaller2(value3) {
|
|
236
|
-
if (onChange) {
|
|
237
|
-
if (!Object.is(stateRef.current, value3)) {
|
|
238
|
-
for (var _len2 = arguments.length, onChangeArgs = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
239
|
-
onChangeArgs[_key2 - 1] = arguments[_key2];
|
|
240
|
-
}
|
|
241
|
-
onChange(value3, ...onChangeArgs);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
if (!isControlled) {
|
|
245
|
-
stateRef.current = value3;
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
if (typeof value2 === "function") {
|
|
249
|
-
let updateFunction = function updateFunction2(oldValue) {
|
|
250
|
-
for (var _len3 = arguments.length, functionArgs = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
251
|
-
functionArgs[_key3 - 1] = arguments[_key3];
|
|
252
|
-
}
|
|
253
|
-
let interceptedValue = value2(isControlled ? stateRef.current : oldValue, ...functionArgs);
|
|
254
|
-
onChangeCaller(interceptedValue, ...args);
|
|
255
|
-
if (!isControlled) {
|
|
256
|
-
return interceptedValue;
|
|
257
|
-
}
|
|
258
|
-
return oldValue;
|
|
259
|
-
};
|
|
260
|
-
setStateValue(updateFunction);
|
|
261
|
-
} else {
|
|
262
|
-
if (!isControlled) {
|
|
263
|
-
setStateValue(value2);
|
|
264
|
-
}
|
|
265
|
-
onChangeCaller(value2, ...args);
|
|
266
|
-
}
|
|
267
|
-
}, [isControlled, onChange]);
|
|
268
|
-
if (isControlled) {
|
|
269
|
-
stateRef.current = value;
|
|
270
|
-
} else {
|
|
271
|
-
value = stateValue;
|
|
272
|
-
}
|
|
273
|
-
return [value, setValue];
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// ../../node_modules/@react-stately/toggle/dist/module.js
|
|
277
|
-
function useToggleState(props) {
|
|
278
|
-
if (props === void 0) {
|
|
279
|
-
props = {};
|
|
280
|
-
}
|
|
281
|
-
let {
|
|
282
|
-
isReadOnly,
|
|
283
|
-
onChange
|
|
284
|
-
} = props;
|
|
285
|
-
let [isSelected, setSelected] = useControlledState(props.isSelected, props.defaultSelected || false, () => {
|
|
286
|
-
});
|
|
287
|
-
function updateSelected(value) {
|
|
288
|
-
if (!isReadOnly) {
|
|
289
|
-
setSelected(value);
|
|
290
|
-
if (onChange) {
|
|
291
|
-
onChange(value);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
function toggleState() {
|
|
296
|
-
if (!isReadOnly) {
|
|
297
|
-
setSelected((prev) => {
|
|
298
|
-
let newVal = !prev;
|
|
299
|
-
if (onChange) {
|
|
300
|
-
onChange(newVal);
|
|
301
|
-
}
|
|
302
|
-
return newVal;
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
return {
|
|
307
|
-
isSelected,
|
|
308
|
-
setSelected: updateSelected,
|
|
309
|
-
toggle: toggleState
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
// src/Checkbox/Checkbox.tsx
|
|
314
|
-
import { Exclamation } from "@marigold/icons";
|
|
229
|
+
import { useCheckbox, useCheckboxGroupItem } from "@react-aria/checkbox";
|
|
230
|
+
import { useFocusRing as useFocusRing2 } from "@react-aria/focus";
|
|
231
|
+
import { useHover } from "@react-aria/interactions";
|
|
232
|
+
import { useToggleState } from "@react-stately/toggle";
|
|
233
|
+
import {
|
|
234
|
+
Box as Box6,
|
|
235
|
+
useComponentStyles as useComponentStyles6,
|
|
236
|
+
useStateProps as useStateProps2
|
|
237
|
+
} from "@marigold/system";
|
|
315
238
|
|
|
316
|
-
// src/Checkbox/
|
|
317
|
-
import
|
|
318
|
-
import {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
const conditionalStates = disabled ? {
|
|
327
|
-
disabled
|
|
328
|
-
} : {
|
|
329
|
-
checked,
|
|
330
|
-
error
|
|
331
|
-
};
|
|
332
|
-
return /* @__PURE__ */ React7.createElement(SVG, {
|
|
333
|
-
width: "16",
|
|
334
|
-
height: "32",
|
|
335
|
-
viewBox: "0 0 16 32",
|
|
336
|
-
fill: "none",
|
|
337
|
-
"aria-hidden": "true"
|
|
338
|
-
}, /* @__PURE__ */ React7.createElement(Box, {
|
|
339
|
-
as: "rect",
|
|
340
|
-
x: "0.5",
|
|
341
|
-
y: "8.5",
|
|
342
|
-
width: "15px",
|
|
343
|
-
height: "15px",
|
|
344
|
-
rx: "1.5",
|
|
345
|
-
variant: conditional(`checkbox.${variant}`, conditionalStates)
|
|
346
|
-
}), checked && indeterminated && /* @__PURE__ */ React7.createElement(Box, {
|
|
347
|
-
__baseCSS: { fill: "gray00" },
|
|
348
|
-
as: "path",
|
|
349
|
-
fillRule: "evenodd",
|
|
350
|
-
clipRule: "evenodd",
|
|
351
|
-
d: "M13.5 17.0402H2.5V15.4688H13.5V17.0402V17.0402Z"
|
|
352
|
-
}), checked && !indeterminated && /* @__PURE__ */ React7.createElement(Box, {
|
|
353
|
-
__baseCSS: { fill: "gray00" },
|
|
354
|
-
as: "path",
|
|
355
|
-
fillRule: "evenodd",
|
|
356
|
-
clipRule: "evenodd",
|
|
357
|
-
d: "M13.9571 12.8338L12.4085 11.2852L6.08699 17.6007L3.59887 15.1126L2.04163 16.6588L6.08682 20.704L13.9571 12.8338Z"
|
|
358
|
-
}));
|
|
359
|
-
};
|
|
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";
|
|
360
249
|
|
|
361
|
-
// src/
|
|
250
|
+
// src/Field/Label.tsx
|
|
362
251
|
import React8 from "react";
|
|
363
252
|
import { Required } from "@marigold/icons";
|
|
364
|
-
|
|
365
|
-
var _b = _a, {
|
|
366
|
-
variant = "above",
|
|
367
|
-
required,
|
|
368
|
-
color = "text",
|
|
369
|
-
children
|
|
370
|
-
} = _b, props = __objRest(_b, [
|
|
371
|
-
"variant",
|
|
372
|
-
"required",
|
|
373
|
-
"color",
|
|
374
|
-
"children"
|
|
375
|
-
]);
|
|
376
|
-
return /* @__PURE__ */ React8.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
377
|
-
as: "label",
|
|
378
|
-
__baseCSS: { color },
|
|
379
|
-
variant: `label.${variant}`
|
|
380
|
-
}), children);
|
|
381
|
-
};
|
|
253
|
+
import { Box as Box4, useComponentStyles as useComponentStyles4 } from "@marigold/system";
|
|
382
254
|
var Label = (_a) => {
|
|
383
255
|
var _b = _a, {
|
|
256
|
+
as = "label",
|
|
384
257
|
required,
|
|
385
|
-
children
|
|
258
|
+
children,
|
|
259
|
+
variant,
|
|
260
|
+
size
|
|
386
261
|
} = _b, props = __objRest(_b, [
|
|
262
|
+
"as",
|
|
387
263
|
"required",
|
|
388
|
-
"children"
|
|
264
|
+
"children",
|
|
265
|
+
"variant",
|
|
266
|
+
"size"
|
|
389
267
|
]);
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
alignItems: "center"
|
|
394
|
-
|
|
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",
|
|
395
275
|
size: 16,
|
|
396
276
|
fill: "error"
|
|
397
|
-
}))
|
|
277
|
+
}));
|
|
398
278
|
};
|
|
399
279
|
|
|
400
|
-
// src/
|
|
401
|
-
|
|
402
|
-
var
|
|
280
|
+
// src/Checkbox/CheckboxGroup.tsx
|
|
281
|
+
var CheckboxGroupContext = createContext(null);
|
|
282
|
+
var useCheckboxGroupContext = () => useContext(CheckboxGroupContext);
|
|
283
|
+
var CheckboxGroup = (_a) => {
|
|
403
284
|
var _b = _a, {
|
|
404
|
-
variant = "error",
|
|
405
285
|
children,
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
"variant",
|
|
409
|
-
"children",
|
|
410
|
-
"className"
|
|
411
|
-
]);
|
|
412
|
-
return /* @__PURE__ */ React9.createElement(Box, __spreadValues({
|
|
413
|
-
as: "span",
|
|
414
|
-
display: "flex",
|
|
415
|
-
alignItems: "center",
|
|
416
|
-
variant: `validation.${variant}`,
|
|
417
|
-
className
|
|
418
|
-
}, props), children);
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
// src/Checkbox/Checkbox.tsx
|
|
422
|
-
var CheckboxInput = (_a) => {
|
|
423
|
-
var _b = _a, {
|
|
424
|
-
error,
|
|
425
|
-
indeterminated = false
|
|
426
|
-
} = _b, props = __objRest(_b, [
|
|
427
|
-
"error",
|
|
428
|
-
"indeterminated"
|
|
429
|
-
]);
|
|
430
|
-
const state = useToggleState(props);
|
|
431
|
-
const ref = React10.useRef(null);
|
|
432
|
-
const { inputProps } = useCheckbox(props, state, ref);
|
|
433
|
-
const { focusProps } = useFocusRing();
|
|
434
|
-
const _a2 = props, { children } = _a2, restProps = __objRest(_a2, ["children"]);
|
|
435
|
-
return /* @__PURE__ */ React10.createElement(Box, {
|
|
436
|
-
pr: "xsmall"
|
|
437
|
-
}, /* @__PURE__ */ React10.createElement(VisuallyHidden, null, /* @__PURE__ */ React10.createElement("input", __spreadValues(__spreadProps(__spreadValues(__spreadValues({}, inputProps), focusProps), {
|
|
438
|
-
ref
|
|
439
|
-
}), restProps))), /* @__PURE__ */ React10.createElement(CheckboxIcon, {
|
|
440
|
-
checked: props.checked,
|
|
441
|
-
variant: props.variant,
|
|
442
|
-
disabled: props.disabled,
|
|
443
|
-
indeterminated,
|
|
444
|
-
error
|
|
445
|
-
}));
|
|
446
|
-
};
|
|
447
|
-
var Checkbox = (_a) => {
|
|
448
|
-
var _b = _a, {
|
|
286
|
+
variant,
|
|
287
|
+
size,
|
|
449
288
|
required,
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
289
|
+
disabled,
|
|
290
|
+
readOnly,
|
|
291
|
+
error
|
|
292
|
+
} = _b, rest = __objRest(_b, [
|
|
293
|
+
"children",
|
|
294
|
+
"variant",
|
|
295
|
+
"size",
|
|
453
296
|
"required",
|
|
454
|
-
"
|
|
455
|
-
"
|
|
297
|
+
"disabled",
|
|
298
|
+
"readOnly",
|
|
299
|
+
"error"
|
|
456
300
|
]);
|
|
457
|
-
|
|
458
|
-
|
|
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({
|
|
313
|
+
as: "span",
|
|
314
|
+
required
|
|
315
|
+
}, labelProps), props.label), /* @__PURE__ */ React9.createElement(Box5, {
|
|
316
|
+
role: "presentation",
|
|
459
317
|
__baseCSS: {
|
|
460
|
-
|
|
318
|
+
display: "flex",
|
|
319
|
+
flexDirection: "column",
|
|
320
|
+
alignItems: "left"
|
|
461
321
|
},
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
}, /* @__PURE__ */ React10.createElement(CheckboxInput, __spreadValues({
|
|
467
|
-
error: props.error
|
|
468
|
-
}, props)), props.children), props.error && errorMessage && /* @__PURE__ */ React10.createElement(ValidationMessage, null, /* @__PURE__ */ React10.createElement(Exclamation, {
|
|
469
|
-
size: 16
|
|
470
|
-
}), errorMessage));
|
|
322
|
+
css: styles.group
|
|
323
|
+
}, /* @__PURE__ */ React9.createElement(CheckboxGroupContext.Provider, {
|
|
324
|
+
value: __spreadValues({ variant, size, error }, state)
|
|
325
|
+
}, children)));
|
|
471
326
|
};
|
|
472
327
|
|
|
473
|
-
// src/
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
328
|
+
// src/Checkbox/Checkbox.tsx
|
|
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
|
+
const icon = indeterminate ? /* @__PURE__ */ React10.createElement(IndeterminateMark, null) : /* @__PURE__ */ React10.createElement(CheckMark, null);
|
|
348
|
+
return /* @__PURE__ */ React10.createElement(Box6, __spreadValues({
|
|
349
|
+
"aria-hidden": "true",
|
|
350
|
+
__baseCSS: {
|
|
351
|
+
width: 16,
|
|
352
|
+
height: 16,
|
|
353
|
+
bg: "#fff",
|
|
354
|
+
border: "1px solid #000",
|
|
355
|
+
borderRadius: 3,
|
|
356
|
+
display: "flex",
|
|
357
|
+
alignItems: "center",
|
|
358
|
+
justifyContent: "center",
|
|
359
|
+
p: "1px"
|
|
360
|
+
},
|
|
361
|
+
css
|
|
362
|
+
}, props), checked ? icon : null);
|
|
480
363
|
};
|
|
481
|
-
var
|
|
364
|
+
var Checkbox = (_a) => {
|
|
482
365
|
var _b = _a, {
|
|
483
|
-
|
|
484
|
-
|
|
366
|
+
size,
|
|
367
|
+
variant,
|
|
368
|
+
disabled,
|
|
369
|
+
checked,
|
|
370
|
+
defaultChecked,
|
|
371
|
+
indeterminate,
|
|
372
|
+
readOnly,
|
|
373
|
+
required,
|
|
374
|
+
error
|
|
485
375
|
} = _b, props = __objRest(_b, [
|
|
486
|
-
"
|
|
487
|
-
"
|
|
376
|
+
"size",
|
|
377
|
+
"variant",
|
|
378
|
+
"disabled",
|
|
379
|
+
"checked",
|
|
380
|
+
"defaultChecked",
|
|
381
|
+
"indeterminate",
|
|
382
|
+
"readOnly",
|
|
383
|
+
"required",
|
|
384
|
+
"error"
|
|
488
385
|
]);
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
386
|
+
const ref = React10.useRef(null);
|
|
387
|
+
const checkboxProps = {
|
|
388
|
+
isIndeterminate: indeterminate,
|
|
389
|
+
isDisabled: disabled,
|
|
390
|
+
isReadOnly: readOnly,
|
|
391
|
+
isRequired: required,
|
|
392
|
+
validationState: error ? "invalid" : "valid"
|
|
393
|
+
};
|
|
394
|
+
const groupState = useCheckboxGroupContext();
|
|
395
|
+
const { inputProps } = groupState ? useCheckboxGroupItem(__spreadProps(__spreadValues(__spreadValues({}, props), checkboxProps), {
|
|
396
|
+
value: props.value
|
|
397
|
+
}), groupState, ref) : useCheckbox(__spreadValues(__spreadValues({
|
|
398
|
+
isSelected: checked,
|
|
399
|
+
defaultSelected: defaultChecked
|
|
400
|
+
}, checkboxProps), props), useToggleState(__spreadValues({
|
|
401
|
+
isSelected: checked,
|
|
402
|
+
defaultSelected: defaultChecked
|
|
403
|
+
}, props)), ref);
|
|
404
|
+
const styles = useComponentStyles6("Checkbox", { variant: (groupState == null ? void 0 : groupState.variant) || variant, size: (groupState == null ? void 0 : groupState.size) || size }, { parts: ["container", "label", "checkbox"] });
|
|
405
|
+
const { hoverProps, isHovered } = useHover({});
|
|
406
|
+
const { isFocusVisible, focusProps } = useFocusRing2();
|
|
407
|
+
const stateProps = useStateProps2({
|
|
408
|
+
hover: isHovered,
|
|
409
|
+
focus: isFocusVisible,
|
|
410
|
+
checked: inputProps.checked,
|
|
411
|
+
disabled: inputProps.disabled,
|
|
412
|
+
error: (groupState == null ? void 0 : groupState.error) || error,
|
|
413
|
+
readOnly,
|
|
414
|
+
indeterminate
|
|
415
|
+
});
|
|
416
|
+
return /* @__PURE__ */ React10.createElement(Box6, __spreadValues(__spreadValues({
|
|
417
|
+
as: "label",
|
|
418
|
+
variant: "checkbox",
|
|
419
|
+
__baseCSS: {
|
|
420
|
+
display: "flex",
|
|
421
|
+
alignItems: "center",
|
|
422
|
+
gap: "1ch",
|
|
423
|
+
position: "relative"
|
|
424
|
+
},
|
|
425
|
+
css: styles.container
|
|
426
|
+
}, hoverProps), stateProps), /* @__PURE__ */ React10.createElement(Box6, __spreadValues(__spreadValues({
|
|
427
|
+
as: "input",
|
|
428
|
+
type: "checkbox",
|
|
429
|
+
ref,
|
|
430
|
+
css: {
|
|
431
|
+
position: "absolute",
|
|
432
|
+
width: "100%",
|
|
433
|
+
height: "100%",
|
|
434
|
+
top: 0,
|
|
435
|
+
left: 0,
|
|
436
|
+
zIndex: 1,
|
|
437
|
+
opacity: 1e-4,
|
|
438
|
+
cursor: inputProps.disabled ? "not-allowed" : "pointer"
|
|
439
|
+
}
|
|
440
|
+
}, inputProps), focusProps)), /* @__PURE__ */ React10.createElement(Icon, __spreadValues({
|
|
441
|
+
checked: inputProps.checked,
|
|
442
|
+
indeterminate,
|
|
443
|
+
css: styles.checkbox
|
|
444
|
+
}, stateProps)), /* @__PURE__ */ React10.createElement(Box6, __spreadValues({
|
|
445
|
+
css: styles.label
|
|
446
|
+
}, stateProps), props.children));
|
|
492
447
|
};
|
|
493
448
|
|
|
494
449
|
// src/Columns/Columns.tsx
|
|
495
|
-
import
|
|
496
|
-
import { useTheme } from "@marigold/system";
|
|
497
|
-
var useAlignment = (direction) => {
|
|
498
|
-
switch (direction) {
|
|
499
|
-
case "right":
|
|
500
|
-
return "flex-end";
|
|
501
|
-
case "bottom":
|
|
502
|
-
return "flex-end";
|
|
503
|
-
case "center":
|
|
504
|
-
return "center";
|
|
505
|
-
}
|
|
506
|
-
return "flex-start";
|
|
507
|
-
};
|
|
450
|
+
import React11, { Children } from "react";
|
|
508
451
|
var Columns = (_a) => {
|
|
509
452
|
var _b = _a, {
|
|
510
453
|
space = "none",
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
className,
|
|
454
|
+
columns,
|
|
455
|
+
collapseAt = "40em",
|
|
514
456
|
children
|
|
515
457
|
} = _b, props = __objRest(_b, [
|
|
516
458
|
"space",
|
|
517
|
-
"
|
|
518
|
-
"
|
|
519
|
-
"className",
|
|
459
|
+
"columns",
|
|
460
|
+
"collapseAt",
|
|
520
461
|
"children"
|
|
521
462
|
]);
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
const
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
m: `${-spaceValue / 2}px`,
|
|
463
|
+
if (Children.count(children) !== columns.length) {
|
|
464
|
+
throw new Error(`Columns: expected ${columns.length} children, got ${Children.count(children)}`);
|
|
465
|
+
}
|
|
466
|
+
const getColumnWidths = columns.map((column, index) => {
|
|
467
|
+
return {
|
|
468
|
+
[`> :nth-of-type(${index + 1})`]: {
|
|
469
|
+
flexGrow: column
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
});
|
|
473
|
+
return /* @__PURE__ */ React11.createElement(Box, __spreadValues({
|
|
534
474
|
display: "flex",
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
},
|
|
542
|
-
}))
|
|
475
|
+
css: Object.assign({
|
|
476
|
+
flexWrap: "wrap",
|
|
477
|
+
gap: space,
|
|
478
|
+
"> *": {
|
|
479
|
+
flexBasis: `calc(( ${collapseAt} - 100%) * 999)`
|
|
480
|
+
}
|
|
481
|
+
}, ...getColumnWidths)
|
|
482
|
+
}, props), children);
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
// src/Content/Content.tsx
|
|
486
|
+
import React12 from "react";
|
|
487
|
+
import {
|
|
488
|
+
Box as Box7,
|
|
489
|
+
useComponentStyles as useComponentStyles7
|
|
490
|
+
} from "@marigold/system";
|
|
491
|
+
var Content = (_a) => {
|
|
492
|
+
var _b = _a, {
|
|
493
|
+
children,
|
|
494
|
+
variant,
|
|
495
|
+
size
|
|
496
|
+
} = _b, props = __objRest(_b, [
|
|
497
|
+
"children",
|
|
498
|
+
"variant",
|
|
499
|
+
"size"
|
|
500
|
+
]);
|
|
501
|
+
const styles = useComponentStyles7("Content", { variant, size });
|
|
502
|
+
return /* @__PURE__ */ React12.createElement(Box7, __spreadProps(__spreadValues({
|
|
503
|
+
as: "section"
|
|
504
|
+
}, props), {
|
|
505
|
+
css: styles
|
|
506
|
+
}), children);
|
|
543
507
|
};
|
|
544
508
|
|
|
545
509
|
// src/Dialog/Dialog.tsx
|
|
@@ -549,44 +513,34 @@ import { OverlayContainer } from "@react-aria/overlays";
|
|
|
549
513
|
import { useButton as useButton2 } from "@react-aria/button";
|
|
550
514
|
import { Close } from "@marigold/icons";
|
|
551
515
|
|
|
552
|
-
// src/
|
|
553
|
-
import React13
|
|
554
|
-
|
|
516
|
+
// src/Headline/Headline.tsx
|
|
517
|
+
import React13 from "react";
|
|
518
|
+
import {
|
|
519
|
+
Box as Box8,
|
|
520
|
+
useComponentStyles as useComponentStyles8
|
|
521
|
+
} from "@marigold/system";
|
|
522
|
+
var Headline = (_a) => {
|
|
555
523
|
var _b = _a, {
|
|
556
|
-
as = "span",
|
|
557
|
-
variant = "body",
|
|
558
524
|
children,
|
|
559
|
-
|
|
560
|
-
color,
|
|
561
|
-
cursor,
|
|
525
|
+
variant,
|
|
562
526
|
size,
|
|
563
|
-
|
|
564
|
-
userSelect
|
|
527
|
+
level = "1"
|
|
565
528
|
} = _b, props = __objRest(_b, [
|
|
566
|
-
"as",
|
|
567
|
-
"variant",
|
|
568
529
|
"children",
|
|
569
|
-
"
|
|
570
|
-
"color",
|
|
571
|
-
"cursor",
|
|
530
|
+
"variant",
|
|
572
531
|
"size",
|
|
573
|
-
"
|
|
574
|
-
"userSelect"
|
|
532
|
+
"level"
|
|
575
533
|
]);
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
outline,
|
|
585
|
-
userSelect
|
|
586
|
-
},
|
|
587
|
-
ref
|
|
534
|
+
const styles = useComponentStyles8("Headline", {
|
|
535
|
+
variant,
|
|
536
|
+
size: size != null ? size : `level-${level}`
|
|
537
|
+
});
|
|
538
|
+
return /* @__PURE__ */ React13.createElement(Box8, __spreadProps(__spreadValues({
|
|
539
|
+
as: `h${level}`
|
|
540
|
+
}, props), {
|
|
541
|
+
css: styles
|
|
588
542
|
}), children);
|
|
589
|
-
}
|
|
543
|
+
};
|
|
590
544
|
|
|
591
545
|
// src/Dialog/ModalDialog.tsx
|
|
592
546
|
import React14 from "react";
|
|
@@ -675,9 +629,8 @@ var Dialog = (_a) => {
|
|
|
675
629
|
className
|
|
676
630
|
}, /* @__PURE__ */ React15.createElement(Box, {
|
|
677
631
|
pt: "medium"
|
|
678
|
-
}, title && /* @__PURE__ */ React15.createElement(
|
|
679
|
-
|
|
680
|
-
variant: "headline4"
|
|
632
|
+
}, title && /* @__PURE__ */ React15.createElement(Headline, {
|
|
633
|
+
level: "4"
|
|
681
634
|
}, title), children), /* @__PURE__ */ React15.createElement(Box, {
|
|
682
635
|
__baseCSS: {
|
|
683
636
|
display: "flex",
|
|
@@ -724,148 +677,333 @@ var useDialogButtonProps = () => {
|
|
|
724
677
|
// src/Divider/Divider.tsx
|
|
725
678
|
import React16 from "react";
|
|
726
679
|
import { useSeparator } from "@react-aria/separator";
|
|
680
|
+
import { useComponentStyles as useComponentStyles9 } from "@marigold/system";
|
|
727
681
|
var Divider = (_a) => {
|
|
728
|
-
var _b = _a, { variant
|
|
682
|
+
var _b = _a, { variant } = _b, props = __objRest(_b, ["variant"]);
|
|
729
683
|
const { separatorProps } = useSeparator(props);
|
|
684
|
+
const styles = useComponentStyles9("Divider", { variant });
|
|
730
685
|
return /* @__PURE__ */ React16.createElement(Box, __spreadValues(__spreadValues({
|
|
731
|
-
|
|
732
|
-
variant: `divider.${variant}`
|
|
686
|
+
css: styles
|
|
733
687
|
}, props), separatorProps));
|
|
734
688
|
};
|
|
735
689
|
|
|
736
|
-
// src/
|
|
737
|
-
import React17
|
|
738
|
-
import {
|
|
739
|
-
|
|
740
|
-
|
|
690
|
+
// src/Footer/Footer.tsx
|
|
691
|
+
import React17 from "react";
|
|
692
|
+
import {
|
|
693
|
+
useComponentStyles as useComponentStyles10
|
|
694
|
+
} from "@marigold/system";
|
|
695
|
+
var Footer = (_a) => {
|
|
696
|
+
var _b = _a, { children, variant, size } = _b, props = __objRest(_b, ["children", "variant", "size"]);
|
|
697
|
+
const styles = useComponentStyles10("Footer", { variant, size });
|
|
698
|
+
return /* @__PURE__ */ React17.createElement(Box, __spreadProps(__spreadValues({
|
|
699
|
+
as: "footer"
|
|
700
|
+
}, props), {
|
|
701
|
+
css: styles
|
|
702
|
+
}), children);
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
// src/VisuallyHidden/VisuallyHidden.tsx
|
|
706
|
+
import { VisuallyHidden } from "@react-aria/visually-hidden";
|
|
707
|
+
|
|
708
|
+
// src/Header/Header.tsx
|
|
709
|
+
import React18 from "react";
|
|
710
|
+
import {
|
|
711
|
+
useComponentStyles as useComponentStyles11
|
|
712
|
+
} from "@marigold/system";
|
|
713
|
+
var Header = (_a) => {
|
|
714
|
+
var _b = _a, { children, variant, size } = _b, props = __objRest(_b, ["children", "variant", "size"]);
|
|
715
|
+
const styles = useComponentStyles11("Header", { variant, size });
|
|
716
|
+
return /* @__PURE__ */ React18.createElement(Box, __spreadProps(__spreadValues({
|
|
717
|
+
as: "header"
|
|
718
|
+
}, props), {
|
|
719
|
+
css: styles
|
|
720
|
+
}), children);
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
// src/Image/Image.tsx
|
|
724
|
+
import React19 from "react";
|
|
725
|
+
import { useComponentStyles as useComponentStyles12 } from "@marigold/system";
|
|
726
|
+
var Image = (_a) => {
|
|
727
|
+
var _b = _a, { variant } = _b, props = __objRest(_b, ["variant"]);
|
|
728
|
+
const styles = useComponentStyles12("Image", { variant });
|
|
729
|
+
return /* @__PURE__ */ React19.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
730
|
+
as: "img",
|
|
731
|
+
css: styles
|
|
732
|
+
}));
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
// src/Inline/Inline.tsx
|
|
736
|
+
import React20 from "react";
|
|
737
|
+
var ALIGNMENT = {
|
|
738
|
+
top: "flex-start",
|
|
739
|
+
center: "center",
|
|
740
|
+
bottom: "flex-end"
|
|
741
|
+
};
|
|
742
|
+
var Inline = (_a) => {
|
|
741
743
|
var _b = _a, {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
744
|
+
space = "none",
|
|
745
|
+
align = "center",
|
|
746
|
+
children
|
|
747
|
+
} = _b, props = __objRest(_b, [
|
|
748
|
+
"space",
|
|
749
|
+
"align",
|
|
750
|
+
"children"
|
|
751
|
+
]);
|
|
752
|
+
return /* @__PURE__ */ React20.createElement(Box, __spreadValues({
|
|
753
|
+
__baseCSS: { gap: space, flexWrap: "wrap" },
|
|
754
|
+
display: "inline-flex",
|
|
755
|
+
alignItems: ALIGNMENT[align]
|
|
756
|
+
}, props), children);
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
// src/Label/Label.tsx
|
|
760
|
+
import React21 from "react";
|
|
761
|
+
import { Required as Required2 } from "@marigold/icons";
|
|
762
|
+
var LabelBase = (_a) => {
|
|
763
|
+
var _b = _a, {
|
|
764
|
+
variant = "above",
|
|
746
765
|
required,
|
|
747
|
-
|
|
748
|
-
|
|
766
|
+
color = "text",
|
|
767
|
+
children
|
|
749
768
|
} = _b, props = __objRest(_b, [
|
|
750
|
-
"type",
|
|
751
769
|
"variant",
|
|
752
|
-
"labelVariant",
|
|
753
|
-
"htmlFor",
|
|
754
770
|
"required",
|
|
755
|
-
"
|
|
756
|
-
"
|
|
771
|
+
"color",
|
|
772
|
+
"children"
|
|
757
773
|
]);
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
variant:
|
|
762
|
-
|
|
763
|
-
required
|
|
764
|
-
}, labelProps), props.label), /* @__PURE__ */ React17.createElement(Box, __spreadValues(__spreadProps(__spreadValues({
|
|
765
|
-
as: "input",
|
|
766
|
-
type,
|
|
767
|
-
id: htmlFor,
|
|
768
|
-
variant: `input.${variant}`
|
|
769
|
-
}, inputProps), {
|
|
770
|
-
ref
|
|
771
|
-
}), props)), error && errorMessage && /* @__PURE__ */ React17.createElement(ValidationMessage, __spreadValues({}, errorMessageProps), /* @__PURE__ */ React17.createElement(Exclamation2, {
|
|
772
|
-
size: 16
|
|
773
|
-
}), errorMessage));
|
|
774
|
+
return /* @__PURE__ */ React21.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
775
|
+
as: "label",
|
|
776
|
+
__baseCSS: { color },
|
|
777
|
+
variant: `label.${variant}`
|
|
778
|
+
}), children);
|
|
774
779
|
};
|
|
775
|
-
|
|
776
|
-
// src/VisuallyHidden/VisuallyHidden.tsx
|
|
777
|
-
import { VisuallyHidden as VisuallyHidden2 } from "@react-aria/visually-hidden";
|
|
778
|
-
|
|
779
|
-
// src/Image/Image.tsx
|
|
780
|
-
import React18 from "react";
|
|
781
|
-
var Image = (_a) => {
|
|
780
|
+
var Label2 = (_a) => {
|
|
782
781
|
var _b = _a, {
|
|
783
|
-
|
|
782
|
+
required,
|
|
783
|
+
children
|
|
784
784
|
} = _b, props = __objRest(_b, [
|
|
785
|
-
"
|
|
785
|
+
"required",
|
|
786
|
+
"children"
|
|
786
787
|
]);
|
|
787
|
-
return /* @__PURE__ */
|
|
788
|
-
as: "
|
|
789
|
-
|
|
790
|
-
|
|
788
|
+
return required ? /* @__PURE__ */ React21.createElement(Box, {
|
|
789
|
+
as: "span",
|
|
790
|
+
display: "inline-flex",
|
|
791
|
+
alignItems: "center"
|
|
792
|
+
}, /* @__PURE__ */ React21.createElement(LabelBase, __spreadValues({}, props), children), required && /* @__PURE__ */ React21.createElement(Required2, {
|
|
793
|
+
size: 16,
|
|
794
|
+
fill: "error"
|
|
795
|
+
})) : /* @__PURE__ */ React21.createElement(LabelBase, __spreadValues({}, props), children);
|
|
791
796
|
};
|
|
792
797
|
|
|
793
798
|
// src/Link/Link.tsx
|
|
794
|
-
import
|
|
799
|
+
import React22, { useRef as useRef2 } from "react";
|
|
795
800
|
import { useLink } from "@react-aria/link";
|
|
801
|
+
import { useComponentStyles as useComponentStyles13 } from "@marigold/system";
|
|
796
802
|
var Link = (_a) => {
|
|
797
803
|
var _b = _a, {
|
|
798
804
|
as = "a",
|
|
799
|
-
variant
|
|
805
|
+
variant,
|
|
806
|
+
size,
|
|
800
807
|
children,
|
|
801
808
|
disabled
|
|
802
809
|
} = _b, props = __objRest(_b, [
|
|
803
810
|
"as",
|
|
804
811
|
"variant",
|
|
812
|
+
"size",
|
|
805
813
|
"children",
|
|
806
814
|
"disabled"
|
|
807
815
|
]);
|
|
808
|
-
const ref =
|
|
816
|
+
const ref = useRef2(null);
|
|
809
817
|
const { linkProps } = useLink(__spreadProps(__spreadValues({}, props), {
|
|
810
818
|
elementType: typeof as === "string" ? as : "span",
|
|
811
819
|
isDisabled: disabled
|
|
812
820
|
}), ref);
|
|
813
|
-
|
|
821
|
+
const styles = useComponentStyles13("Link", { variant, size });
|
|
822
|
+
return /* @__PURE__ */ React22.createElement(Box, __spreadValues(__spreadValues({
|
|
814
823
|
as,
|
|
815
|
-
|
|
824
|
+
css: styles,
|
|
816
825
|
ref
|
|
817
|
-
}), children);
|
|
826
|
+
}, props), linkProps), children);
|
|
818
827
|
};
|
|
819
828
|
|
|
820
829
|
// src/Menu/Menu.tsx
|
|
821
|
-
import
|
|
822
|
-
|
|
830
|
+
import React27, { useRef as useRef5 } from "react";
|
|
831
|
+
import { FocusScope as FocusScope2 } from "@react-aria/focus";
|
|
832
|
+
import { useMenu } from "@react-aria/menu";
|
|
833
|
+
import { DismissButton } from "@react-aria/overlays";
|
|
834
|
+
import { Item } from "@react-stately/collections";
|
|
835
|
+
import { useTreeState } from "@react-stately/tree";
|
|
836
|
+
import {
|
|
837
|
+
Box as Box10,
|
|
838
|
+
useComponentStyles as useComponentStyles14
|
|
839
|
+
} from "@marigold/system";
|
|
840
|
+
|
|
841
|
+
// src/Menu/Context.ts
|
|
842
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
843
|
+
var MenuContext = createContext2({});
|
|
844
|
+
var useMenuContext = () => useContext2(MenuContext);
|
|
845
|
+
|
|
846
|
+
// src/Menu/MenuTrigger.tsx
|
|
847
|
+
import React25, { useRef as useRef3 } from "react";
|
|
848
|
+
import { useMenuTriggerState } from "@react-stately/menu";
|
|
849
|
+
import { useMenuTrigger } from "@react-aria/menu";
|
|
850
|
+
|
|
851
|
+
// src/Overlay/Overlay.tsx
|
|
852
|
+
import React23 from "react";
|
|
853
|
+
import ReactDOM from "react-dom";
|
|
854
|
+
var Overlay = (_a) => {
|
|
823
855
|
var _b = _a, {
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
show = false,
|
|
828
|
-
children
|
|
856
|
+
children,
|
|
857
|
+
open = false,
|
|
858
|
+
container = document.body
|
|
829
859
|
} = _b, props = __objRest(_b, [
|
|
830
|
-
"
|
|
831
|
-
"
|
|
832
|
-
"
|
|
833
|
-
"show",
|
|
834
|
-
"children"
|
|
860
|
+
"children",
|
|
861
|
+
"open",
|
|
862
|
+
"container"
|
|
835
863
|
]);
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
}, label), show ? /* @__PURE__ */ React20.createElement(Box, {
|
|
842
|
-
display: "block",
|
|
843
|
-
position: "absolute",
|
|
844
|
-
minWidth: "120px",
|
|
845
|
-
borderRadius: "2px"
|
|
846
|
-
}, children) : null);
|
|
864
|
+
if (!open) {
|
|
865
|
+
return null;
|
|
866
|
+
}
|
|
867
|
+
const component = /* @__PURE__ */ React23.createElement(Box, __spreadValues({}, props), children);
|
|
868
|
+
return ReactDOM.createPortal(component, container);
|
|
847
869
|
};
|
|
848
870
|
|
|
849
|
-
// src/
|
|
850
|
-
import
|
|
851
|
-
|
|
871
|
+
// src/Overlay/Popover.tsx
|
|
872
|
+
import React24, { forwardRef as forwardRef2 } from "react";
|
|
873
|
+
import { useModal as useModal2, useOverlay as useOverlay2 } from "@react-aria/overlays";
|
|
874
|
+
import { mergeProps as mergeProps2 } from "@react-aria/utils";
|
|
875
|
+
var Popover = forwardRef2((_a, ref) => {
|
|
852
876
|
var _b = _a, {
|
|
853
|
-
|
|
854
|
-
|
|
877
|
+
children,
|
|
878
|
+
open,
|
|
879
|
+
dismissable,
|
|
880
|
+
keyboardDismissDisabled,
|
|
881
|
+
shouldCloseOnBlur
|
|
855
882
|
} = _b, props = __objRest(_b, [
|
|
856
|
-
"
|
|
857
|
-
"
|
|
883
|
+
"children",
|
|
884
|
+
"open",
|
|
885
|
+
"dismissable",
|
|
886
|
+
"keyboardDismissDisabled",
|
|
887
|
+
"shouldCloseOnBlur"
|
|
858
888
|
]);
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
889
|
+
const { overlayProps } = useOverlay2(__spreadValues({
|
|
890
|
+
isOpen: open,
|
|
891
|
+
isDismissable: dismissable,
|
|
892
|
+
isKeyboardDismissDisabled: keyboardDismissDisabled,
|
|
893
|
+
shouldCloseOnBlur
|
|
894
|
+
}, props), ref);
|
|
895
|
+
const { modalProps } = useModal2({});
|
|
896
|
+
return /* @__PURE__ */ React24.createElement(Overlay, {
|
|
897
|
+
open
|
|
898
|
+
}, /* @__PURE__ */ React24.createElement(Box, __spreadValues({
|
|
899
|
+
ref,
|
|
900
|
+
role: "presentation"
|
|
901
|
+
}, mergeProps2(props, overlayProps, modalProps)), children));
|
|
902
|
+
});
|
|
903
|
+
|
|
904
|
+
// src/Menu/MenuTrigger.tsx
|
|
905
|
+
import { useOverlayPosition } from "@react-aria/overlays";
|
|
906
|
+
import { PressResponder } from "@react-aria/interactions";
|
|
907
|
+
var MenuTrigger = ({ disabled, children }) => {
|
|
908
|
+
const [menuTrigger, menu] = React25.Children.toArray(children);
|
|
909
|
+
const menuTriggerRef = useRef3(null);
|
|
910
|
+
const overlayRef = useRef3(null);
|
|
911
|
+
const state = useMenuTriggerState({});
|
|
912
|
+
const { menuTriggerProps, menuProps } = useMenuTrigger({ trigger: "press", isDisabled: disabled }, state, menuTriggerRef);
|
|
913
|
+
const { overlayProps: positionProps } = useOverlayPosition({
|
|
914
|
+
targetRef: menuTriggerRef,
|
|
915
|
+
overlayRef,
|
|
916
|
+
isOpen: state.isOpen
|
|
917
|
+
});
|
|
918
|
+
const menuContext = __spreadProps(__spreadValues({}, menuProps), {
|
|
919
|
+
open: state.isOpen,
|
|
920
|
+
onClose: state.close,
|
|
921
|
+
autoFocus: state.focusStrategy,
|
|
922
|
+
triggerWidth: menuTriggerRef.current ? menuTriggerRef.current.offsetWidth : void 0
|
|
923
|
+
});
|
|
924
|
+
return /* @__PURE__ */ React25.createElement(MenuContext.Provider, {
|
|
925
|
+
value: menuContext
|
|
926
|
+
}, /* @__PURE__ */ React25.createElement(PressResponder, __spreadProps(__spreadValues({}, menuTriggerProps), {
|
|
927
|
+
ref: menuTriggerRef,
|
|
928
|
+
isPressed: state.isOpen
|
|
929
|
+
}), menuTrigger), /* @__PURE__ */ React25.createElement(Popover, __spreadValues({
|
|
930
|
+
open: state.isOpen,
|
|
931
|
+
onClose: state.close,
|
|
932
|
+
dismissable: true,
|
|
933
|
+
shouldCloseOnBlur: true,
|
|
934
|
+
ref: overlayRef
|
|
935
|
+
}, positionProps), menu));
|
|
936
|
+
};
|
|
937
|
+
|
|
938
|
+
// src/Menu/MenuItem.tsx
|
|
939
|
+
import React26, { useRef as useRef4 } from "react";
|
|
940
|
+
import { useFocusRing as useFocusRing3 } from "@react-aria/focus";
|
|
941
|
+
import { useMenuItem } from "@react-aria/menu";
|
|
942
|
+
import { mergeProps as mergeProps3 } from "@react-aria/utils";
|
|
943
|
+
import { Box as Box9, useStateProps as useStateProps3 } from "@marigold/system";
|
|
944
|
+
var MenuItem = ({ item, state, onAction, css }) => {
|
|
945
|
+
const ref = useRef4(null);
|
|
946
|
+
const { onClose } = useMenuContext();
|
|
947
|
+
const { menuItemProps } = useMenuItem({
|
|
948
|
+
key: item.key,
|
|
949
|
+
onAction,
|
|
950
|
+
onClose
|
|
951
|
+
}, state, ref);
|
|
952
|
+
const { isFocusVisible, focusProps } = useFocusRing3();
|
|
953
|
+
const stateProps = useStateProps3({
|
|
954
|
+
focus: isFocusVisible
|
|
955
|
+
});
|
|
956
|
+
return /* @__PURE__ */ React26.createElement(Box9, __spreadValues(__spreadValues({
|
|
957
|
+
as: "li",
|
|
958
|
+
ref,
|
|
959
|
+
__baseCSS: {
|
|
960
|
+
"&:focus": {
|
|
961
|
+
outline: 0
|
|
962
|
+
}
|
|
963
|
+
},
|
|
964
|
+
css
|
|
965
|
+
}, mergeProps3(menuItemProps, focusProps)), stateProps), item.rendered);
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
// src/Menu/Menu.tsx
|
|
969
|
+
var Menu = (_a) => {
|
|
970
|
+
var _b = _a, { variant, size } = _b, props = __objRest(_b, ["variant", "size"]);
|
|
971
|
+
const _a2 = useMenuContext(), { triggerWidth } = _a2, menuContext = __objRest(_a2, ["triggerWidth"]);
|
|
972
|
+
const ownProps = __spreadValues(__spreadValues({}, props), menuContext);
|
|
973
|
+
const ref = useRef5(null);
|
|
974
|
+
const state = useTreeState(__spreadProps(__spreadValues({}, ownProps), { selectionMode: "none" }));
|
|
975
|
+
const { menuProps } = useMenu(ownProps, state, ref);
|
|
976
|
+
const styles = useComponentStyles14("Menu", { variant, size }, { parts: ["container", "item"] });
|
|
977
|
+
return /* @__PURE__ */ React27.createElement(FocusScope2, {
|
|
978
|
+
restoreFocus: true
|
|
979
|
+
}, /* @__PURE__ */ React27.createElement("div", null, /* @__PURE__ */ React27.createElement(DismissButton, {
|
|
980
|
+
onDismiss: ownProps.onClose
|
|
981
|
+
}), /* @__PURE__ */ React27.createElement(Box10, __spreadValues({
|
|
982
|
+
as: "ul",
|
|
983
|
+
ref,
|
|
984
|
+
style: { width: triggerWidth },
|
|
985
|
+
__baseCSS: {
|
|
986
|
+
listStyle: "none",
|
|
987
|
+
p: 0,
|
|
988
|
+
overflowWrap: "break-word"
|
|
989
|
+
},
|
|
990
|
+
css: styles.container
|
|
991
|
+
}, menuProps), [...state.collection].map((item) => /* @__PURE__ */ React27.createElement(MenuItem, {
|
|
992
|
+
key: item.key,
|
|
993
|
+
item,
|
|
994
|
+
state,
|
|
995
|
+
onAction: props.onSelect,
|
|
996
|
+
css: styles.item
|
|
997
|
+
}))), /* @__PURE__ */ React27.createElement(DismissButton, {
|
|
998
|
+
onDismiss: ownProps.onClose
|
|
999
|
+
})));
|
|
864
1000
|
};
|
|
1001
|
+
Menu.Trigger = MenuTrigger;
|
|
1002
|
+
Menu.Item = Item;
|
|
865
1003
|
|
|
866
1004
|
// src/Message/Message.tsx
|
|
867
|
-
import
|
|
868
|
-
import { Exclamation
|
|
1005
|
+
import React28 from "react";
|
|
1006
|
+
import { Exclamation, Info, Notification } from "@marigold/icons";
|
|
869
1007
|
var Message = (_a) => {
|
|
870
1008
|
var _b = _a, {
|
|
871
1009
|
messageTitle,
|
|
@@ -878,62 +1016,61 @@ var Message = (_a) => {
|
|
|
878
1016
|
"className",
|
|
879
1017
|
"children"
|
|
880
1018
|
]);
|
|
881
|
-
var icon = /* @__PURE__ */
|
|
1019
|
+
var icon = /* @__PURE__ */ React28.createElement(Info, null);
|
|
882
1020
|
if (variant === "warning") {
|
|
883
|
-
icon = /* @__PURE__ */
|
|
1021
|
+
icon = /* @__PURE__ */ React28.createElement(Notification, null);
|
|
884
1022
|
}
|
|
885
1023
|
if (variant === "error") {
|
|
886
|
-
icon = /* @__PURE__ */
|
|
1024
|
+
icon = /* @__PURE__ */ React28.createElement(Exclamation, null);
|
|
887
1025
|
}
|
|
888
|
-
return /* @__PURE__ */
|
|
1026
|
+
return /* @__PURE__ */ React28.createElement(Box, __spreadValues({
|
|
889
1027
|
display: "inline-block",
|
|
890
1028
|
variant: `message.${variant}`,
|
|
891
1029
|
className
|
|
892
|
-
}, props), /* @__PURE__ */
|
|
1030
|
+
}, props), /* @__PURE__ */ React28.createElement(Box, {
|
|
893
1031
|
display: "flex",
|
|
894
1032
|
alignItems: "center",
|
|
895
1033
|
variant: "message.title"
|
|
896
|
-
}, icon, /* @__PURE__ */
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
}, messageTitle)), /* @__PURE__ */ React22.createElement(Box, {
|
|
1034
|
+
}, icon, /* @__PURE__ */ React28.createElement(Headline, {
|
|
1035
|
+
level: "4"
|
|
1036
|
+
}, messageTitle)), /* @__PURE__ */ React28.createElement(Box, {
|
|
900
1037
|
css: { color: "black" }
|
|
901
1038
|
}, children));
|
|
902
1039
|
};
|
|
903
1040
|
|
|
904
1041
|
// src/Provider/index.ts
|
|
905
|
-
import { useTheme as
|
|
1042
|
+
import { useTheme as useTheme2, ThemeProvider as ThemeProvider2 } from "@marigold/system";
|
|
906
1043
|
import { SSRProvider } from "@react-aria/ssr";
|
|
907
1044
|
|
|
908
1045
|
// src/Provider/MarigoldProvider.tsx
|
|
909
|
-
import
|
|
1046
|
+
import React29 from "react";
|
|
910
1047
|
import { OverlayProvider } from "@react-aria/overlays";
|
|
911
1048
|
import {
|
|
912
1049
|
Global,
|
|
913
1050
|
ThemeProvider,
|
|
914
|
-
useTheme
|
|
1051
|
+
useTheme,
|
|
915
1052
|
__defaultTheme
|
|
916
1053
|
} from "@marigold/system";
|
|
917
1054
|
function MarigoldProvider({
|
|
918
1055
|
theme,
|
|
919
1056
|
children
|
|
920
1057
|
}) {
|
|
921
|
-
const outer =
|
|
1058
|
+
const outer = useTheme();
|
|
922
1059
|
const isTopLevel = outer.theme === __defaultTheme;
|
|
923
|
-
return /* @__PURE__ */
|
|
1060
|
+
return /* @__PURE__ */ React29.createElement(ThemeProvider, {
|
|
924
1061
|
theme
|
|
925
|
-
}, isTopLevel ? /* @__PURE__ */
|
|
1062
|
+
}, isTopLevel ? /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(Global, null), /* @__PURE__ */ React29.createElement(OverlayProvider, null, children)) : children);
|
|
926
1063
|
}
|
|
927
1064
|
|
|
928
1065
|
// src/Radio/Radio.tsx
|
|
929
|
-
import
|
|
930
|
-
import { Exclamation as
|
|
931
|
-
import { useFocusRing as
|
|
932
|
-
import { VisuallyHidden as
|
|
1066
|
+
import React32 from "react";
|
|
1067
|
+
import { Exclamation as Exclamation2 } from "@marigold/icons";
|
|
1068
|
+
import { useFocusRing as useFocusRing4 } from "@react-aria/focus";
|
|
1069
|
+
import { VisuallyHidden as VisuallyHidden2 } from "@react-aria/visually-hidden";
|
|
933
1070
|
|
|
934
1071
|
// src/Radio/RadioIcon.tsx
|
|
935
|
-
import
|
|
936
|
-
import { conditional
|
|
1072
|
+
import React30 from "react";
|
|
1073
|
+
import { conditional, SVG } from "@marigold/system";
|
|
937
1074
|
var RadioIcon = ({
|
|
938
1075
|
variant = "",
|
|
939
1076
|
checked = false,
|
|
@@ -946,19 +1083,19 @@ var RadioIcon = ({
|
|
|
946
1083
|
checked,
|
|
947
1084
|
error
|
|
948
1085
|
};
|
|
949
|
-
return /* @__PURE__ */
|
|
1086
|
+
return /* @__PURE__ */ React30.createElement(SVG, {
|
|
950
1087
|
width: "16",
|
|
951
1088
|
height: "32",
|
|
952
1089
|
viewBox: "0 0 16 32",
|
|
953
1090
|
fill: "none",
|
|
954
1091
|
"aria-hidden": "true"
|
|
955
|
-
}, /* @__PURE__ */
|
|
956
|
-
variant:
|
|
1092
|
+
}, /* @__PURE__ */ React30.createElement(Box, {
|
|
1093
|
+
variant: conditional(`radio.${variant}`, conditionalStates),
|
|
957
1094
|
as: "circle",
|
|
958
1095
|
cx: "8",
|
|
959
1096
|
cy: "16",
|
|
960
1097
|
r: "7.5"
|
|
961
|
-
}), checked && /* @__PURE__ */
|
|
1098
|
+
}), checked && /* @__PURE__ */ React30.createElement("circle", {
|
|
962
1099
|
fill: "white",
|
|
963
1100
|
cx: "8",
|
|
964
1101
|
cy: "16",
|
|
@@ -966,17 +1103,38 @@ var RadioIcon = ({
|
|
|
966
1103
|
}));
|
|
967
1104
|
};
|
|
968
1105
|
|
|
1106
|
+
// src/ValidationMessage/ValidationMessage.tsx
|
|
1107
|
+
import React31 from "react";
|
|
1108
|
+
var ValidationMessage = (_a) => {
|
|
1109
|
+
var _b = _a, {
|
|
1110
|
+
variant = "error",
|
|
1111
|
+
children,
|
|
1112
|
+
className
|
|
1113
|
+
} = _b, props = __objRest(_b, [
|
|
1114
|
+
"variant",
|
|
1115
|
+
"children",
|
|
1116
|
+
"className"
|
|
1117
|
+
]);
|
|
1118
|
+
return /* @__PURE__ */ React31.createElement(Box, __spreadValues({
|
|
1119
|
+
as: "span",
|
|
1120
|
+
display: "flex",
|
|
1121
|
+
alignItems: "center",
|
|
1122
|
+
variant: `validation.${variant}`,
|
|
1123
|
+
className
|
|
1124
|
+
}, props), children);
|
|
1125
|
+
};
|
|
1126
|
+
|
|
969
1127
|
// src/Radio/Radio.tsx
|
|
970
1128
|
var RadioInput = (_a) => {
|
|
971
1129
|
var _b = _a, { error } = _b, props = __objRest(_b, ["error"]);
|
|
972
|
-
const { focusProps } =
|
|
1130
|
+
const { focusProps } = useFocusRing4();
|
|
973
1131
|
const _a2 = props, { children } = _a2, restProps = __objRest(_a2, ["children"]);
|
|
974
|
-
return /* @__PURE__ */
|
|
1132
|
+
return /* @__PURE__ */ React32.createElement(Box, {
|
|
975
1133
|
pr: "xsmall"
|
|
976
|
-
}, /* @__PURE__ */
|
|
1134
|
+
}, /* @__PURE__ */ React32.createElement(VisuallyHidden2, null, /* @__PURE__ */ React32.createElement("input", __spreadValues(__spreadValues({
|
|
977
1135
|
type: "radio",
|
|
978
1136
|
disabled: props.disabled
|
|
979
|
-
}, focusProps), restProps))), /* @__PURE__ */
|
|
1137
|
+
}, focusProps), restProps))), /* @__PURE__ */ React32.createElement(RadioIcon, {
|
|
980
1138
|
variant: props.variant,
|
|
981
1139
|
disabled: props.disabled,
|
|
982
1140
|
checked: props.checked,
|
|
@@ -993,41 +1151,41 @@ var Radio = (_a) => {
|
|
|
993
1151
|
"labelVariant",
|
|
994
1152
|
"errorMessage"
|
|
995
1153
|
]);
|
|
996
|
-
return /* @__PURE__ */
|
|
997
|
-
as:
|
|
1154
|
+
return /* @__PURE__ */ React32.createElement(React32.Fragment, null, /* @__PURE__ */ React32.createElement(Box, {
|
|
1155
|
+
as: Label2,
|
|
998
1156
|
htmlFor: props.id,
|
|
999
1157
|
required,
|
|
1000
1158
|
variant: `label.${labelVariant}`,
|
|
1001
1159
|
css: props.disabled ? { color: "disabled", ":hover": { cursor: "not-allowed" } } : { color: "text", ":hover": { cursor: "pointer" } }
|
|
1002
|
-
}, /* @__PURE__ */
|
|
1160
|
+
}, /* @__PURE__ */ React32.createElement(Box, __spreadValues({
|
|
1003
1161
|
as: RadioInput,
|
|
1004
1162
|
error: props.error
|
|
1005
|
-
}, props)), props.children), props.error && errorMessage && /* @__PURE__ */
|
|
1163
|
+
}, props)), props.children), props.error && errorMessage && /* @__PURE__ */ React32.createElement(ValidationMessage, null, /* @__PURE__ */ React32.createElement(Exclamation2, {
|
|
1006
1164
|
size: 16
|
|
1007
1165
|
}), errorMessage));
|
|
1008
1166
|
};
|
|
1009
1167
|
|
|
1010
1168
|
// src/Select/Select.tsx
|
|
1011
|
-
import
|
|
1169
|
+
import React37, { useRef as useRef8 } from "react";
|
|
1012
1170
|
import { useSelectState } from "@react-stately/select";
|
|
1013
1171
|
import { useButton as useButton3 } from "@react-aria/button";
|
|
1014
|
-
import { mergeProps as
|
|
1015
|
-
import { useFocusRing as
|
|
1172
|
+
import { mergeProps as mergeProps5 } from "@react-aria/utils";
|
|
1173
|
+
import { useFocusRing as useFocusRing5 } from "@react-aria/focus";
|
|
1016
1174
|
import { HiddenSelect, useSelect } from "@react-aria/select";
|
|
1017
1175
|
import { useOverlayTriggerState as useOverlayTriggerState2 } from "@react-stately/overlays";
|
|
1018
|
-
import { useOverlayTrigger, useOverlayPosition } from "@react-aria/overlays";
|
|
1019
|
-
import { ArrowDown, ArrowUp, Exclamation as
|
|
1176
|
+
import { useOverlayTrigger, useOverlayPosition as useOverlayPosition2 } from "@react-aria/overlays";
|
|
1177
|
+
import { ArrowDown, ArrowUp, Exclamation as Exclamation3, Required as Required3 } from "@marigold/icons";
|
|
1020
1178
|
|
|
1021
1179
|
// src/Select/ListBox.tsx
|
|
1022
|
-
import
|
|
1180
|
+
import React35, { useRef as useRef7 } from "react";
|
|
1023
1181
|
import { useListBox } from "@react-aria/listbox";
|
|
1024
1182
|
|
|
1025
1183
|
// src/Select/Option.tsx
|
|
1026
|
-
import
|
|
1184
|
+
import React33, { useEffect, useRef as useRef6, useState } from "react";
|
|
1027
1185
|
import { useOption } from "@react-aria/listbox";
|
|
1028
1186
|
var Option = ({ item, state }) => {
|
|
1029
|
-
const ref =
|
|
1030
|
-
const [disabled, setDisabled] =
|
|
1187
|
+
const ref = useRef6(null);
|
|
1188
|
+
const [disabled, setDisabled] = useState(false);
|
|
1031
1189
|
const { optionProps, isSelected } = useOption({
|
|
1032
1190
|
key: item.key
|
|
1033
1191
|
}, state, ref);
|
|
@@ -1038,7 +1196,7 @@ var Option = ({ item, state }) => {
|
|
|
1038
1196
|
}
|
|
1039
1197
|
}
|
|
1040
1198
|
}, [state.disabledKeys, item.key]);
|
|
1041
|
-
return /* @__PURE__ */
|
|
1199
|
+
return /* @__PURE__ */ React33.createElement(Box, __spreadProps(__spreadValues({
|
|
1042
1200
|
as: "li"
|
|
1043
1201
|
}, optionProps), {
|
|
1044
1202
|
ref,
|
|
@@ -1047,26 +1205,26 @@ var Option = ({ item, state }) => {
|
|
|
1047
1205
|
};
|
|
1048
1206
|
|
|
1049
1207
|
// src/Select/ListBoxSection.tsx
|
|
1050
|
-
import
|
|
1208
|
+
import React34 from "react";
|
|
1051
1209
|
import { useListBoxSection } from "@react-aria/listbox";
|
|
1052
1210
|
var ListBoxSection = ({ section, state }) => {
|
|
1053
1211
|
const { itemProps, headingProps, groupProps } = useListBoxSection({
|
|
1054
1212
|
heading: section.rendered,
|
|
1055
1213
|
"aria-label": section["aria-label"]
|
|
1056
1214
|
});
|
|
1057
|
-
return /* @__PURE__ */
|
|
1215
|
+
return /* @__PURE__ */ React34.createElement(Box, __spreadProps(__spreadValues({
|
|
1058
1216
|
as: "li"
|
|
1059
1217
|
}, itemProps), {
|
|
1060
1218
|
css: {
|
|
1061
1219
|
cursor: "not-allowed"
|
|
1062
1220
|
}
|
|
1063
|
-
}), section.rendered && /* @__PURE__ */
|
|
1221
|
+
}), section.rendered && /* @__PURE__ */ React34.createElement(Box, __spreadProps(__spreadValues({
|
|
1064
1222
|
as: "span"
|
|
1065
1223
|
}, headingProps), {
|
|
1066
1224
|
variant: "select.section"
|
|
1067
|
-
}), section.rendered), /* @__PURE__ */
|
|
1225
|
+
}), section.rendered), /* @__PURE__ */ React34.createElement(Box, __spreadValues({
|
|
1068
1226
|
as: "ul"
|
|
1069
|
-
}, groupProps), [...section.childNodes].map((node) => /* @__PURE__ */
|
|
1227
|
+
}, groupProps), [...section.childNodes].map((node) => /* @__PURE__ */ React34.createElement(Option, {
|
|
1070
1228
|
key: node.key,
|
|
1071
1229
|
item: node,
|
|
1072
1230
|
state
|
|
@@ -1075,10 +1233,10 @@ var ListBoxSection = ({ section, state }) => {
|
|
|
1075
1233
|
|
|
1076
1234
|
// src/Select/ListBox.tsx
|
|
1077
1235
|
var ListBox = (props) => {
|
|
1078
|
-
const ref =
|
|
1236
|
+
const ref = useRef7(null);
|
|
1079
1237
|
const { state, error } = props;
|
|
1080
1238
|
const { listBoxProps } = useListBox(props, state, ref);
|
|
1081
|
-
return /* @__PURE__ */
|
|
1239
|
+
return /* @__PURE__ */ React35.createElement(Box, __spreadProps(__spreadValues({
|
|
1082
1240
|
as: "ul",
|
|
1083
1241
|
p: "none",
|
|
1084
1242
|
css: {
|
|
@@ -1087,11 +1245,11 @@ var ListBox = (props) => {
|
|
|
1087
1245
|
}, listBoxProps), {
|
|
1088
1246
|
variant: error ? "select.listbox.error" : "select.listbox",
|
|
1089
1247
|
ref
|
|
1090
|
-
}), [...state.collection].map((item) => item.type === "section" ? /* @__PURE__ */
|
|
1248
|
+
}), [...state.collection].map((item) => item.type === "section" ? /* @__PURE__ */ React35.createElement(ListBoxSection, {
|
|
1091
1249
|
key: item.key,
|
|
1092
1250
|
section: item,
|
|
1093
1251
|
state
|
|
1094
|
-
}) : /* @__PURE__ */
|
|
1252
|
+
}) : /* @__PURE__ */ React35.createElement(Option, {
|
|
1095
1253
|
key: item.key,
|
|
1096
1254
|
item,
|
|
1097
1255
|
state
|
|
@@ -1099,30 +1257,30 @@ var ListBox = (props) => {
|
|
|
1099
1257
|
};
|
|
1100
1258
|
|
|
1101
1259
|
// src/Select/Popover.tsx
|
|
1102
|
-
import
|
|
1103
|
-
import { FocusScope as
|
|
1260
|
+
import React36, { forwardRef as forwardRef3 } from "react";
|
|
1261
|
+
import { FocusScope as FocusScope3 } from "@react-aria/focus";
|
|
1104
1262
|
import {
|
|
1105
|
-
DismissButton,
|
|
1263
|
+
DismissButton as DismissButton2,
|
|
1106
1264
|
OverlayContainer as OverlayContainer2,
|
|
1107
|
-
useModal as
|
|
1108
|
-
useOverlay as
|
|
1265
|
+
useModal as useModal3,
|
|
1266
|
+
useOverlay as useOverlay3
|
|
1109
1267
|
} from "@react-aria/overlays";
|
|
1110
|
-
import { mergeProps } from "@react-aria/utils";
|
|
1111
|
-
var
|
|
1268
|
+
import { mergeProps as mergeProps4 } from "@react-aria/utils";
|
|
1269
|
+
var Popover2 = forwardRef3((_a, ref) => {
|
|
1112
1270
|
var _b = _a, { children, className, isOpen, onClose } = _b, otherProps = __objRest(_b, ["children", "className", "isOpen", "onClose"]);
|
|
1113
|
-
const { overlayProps } =
|
|
1271
|
+
const { overlayProps } = useOverlay3({
|
|
1114
1272
|
isOpen,
|
|
1115
1273
|
onClose,
|
|
1116
1274
|
shouldCloseOnBlur: true,
|
|
1117
1275
|
isDismissable: true
|
|
1118
1276
|
}, ref);
|
|
1119
|
-
const { modalProps } =
|
|
1120
|
-
return /* @__PURE__ */
|
|
1277
|
+
const { modalProps } = useModal3();
|
|
1278
|
+
return /* @__PURE__ */ React36.createElement(OverlayContainer2, null, /* @__PURE__ */ React36.createElement(FocusScope3, {
|
|
1121
1279
|
restoreFocus: true
|
|
1122
|
-
}, /* @__PURE__ */
|
|
1280
|
+
}, /* @__PURE__ */ React36.createElement(Box, __spreadProps(__spreadValues({}, mergeProps4(overlayProps, otherProps, modalProps)), {
|
|
1123
1281
|
className,
|
|
1124
1282
|
ref
|
|
1125
|
-
}), children, /* @__PURE__ */
|
|
1283
|
+
}), children, /* @__PURE__ */ React36.createElement(DismissButton2, {
|
|
1126
1284
|
onDismiss: onClose
|
|
1127
1285
|
}))));
|
|
1128
1286
|
});
|
|
@@ -1150,10 +1308,10 @@ var Select = (_a) => {
|
|
|
1150
1308
|
]);
|
|
1151
1309
|
const state = useSelectState(props);
|
|
1152
1310
|
const overlayTriggerState = useOverlayTriggerState2({});
|
|
1153
|
-
const triggerRef =
|
|
1154
|
-
const overlayRef =
|
|
1311
|
+
const triggerRef = useRef8();
|
|
1312
|
+
const overlayRef = useRef8();
|
|
1155
1313
|
const { overlayProps } = useOverlayTrigger({ type: "listbox" }, overlayTriggerState, triggerRef);
|
|
1156
|
-
const { overlayProps: positionProps } =
|
|
1314
|
+
const { overlayProps: positionProps } = useOverlayPosition2({
|
|
1157
1315
|
targetRef: triggerRef,
|
|
1158
1316
|
overlayRef,
|
|
1159
1317
|
placement: "bottom",
|
|
@@ -1163,46 +1321,46 @@ var Select = (_a) => {
|
|
|
1163
1321
|
});
|
|
1164
1322
|
const { labelProps, triggerProps, valueProps, menuProps } = useSelect(props, state, triggerRef);
|
|
1165
1323
|
const { buttonProps } = useButton3(triggerProps, triggerRef);
|
|
1166
|
-
const { focusProps } =
|
|
1167
|
-
return /* @__PURE__ */
|
|
1324
|
+
const { focusProps } = useFocusRing5();
|
|
1325
|
+
return /* @__PURE__ */ React37.createElement(Box, {
|
|
1168
1326
|
position: "relative",
|
|
1169
1327
|
display: "inline-block",
|
|
1170
1328
|
width: width && width
|
|
1171
|
-
}, props.label && /* @__PURE__ */
|
|
1329
|
+
}, props.label && /* @__PURE__ */ React37.createElement(Box, null, /* @__PURE__ */ React37.createElement(Label2, __spreadProps(__spreadValues({}, labelProps), {
|
|
1172
1330
|
htmlFor: labelProps.id,
|
|
1173
1331
|
variant: labelVariant
|
|
1174
|
-
}), required ? /* @__PURE__ */
|
|
1332
|
+
}), required ? /* @__PURE__ */ React37.createElement(Box, {
|
|
1175
1333
|
as: "span",
|
|
1176
1334
|
display: "inline-flex",
|
|
1177
1335
|
alignItems: "center"
|
|
1178
|
-
}, props.label, /* @__PURE__ */
|
|
1336
|
+
}, props.label, /* @__PURE__ */ React37.createElement(Required3, {
|
|
1179
1337
|
size: 16,
|
|
1180
1338
|
fill: "error"
|
|
1181
|
-
})) : props.label)), /* @__PURE__ */
|
|
1339
|
+
})) : props.label)), /* @__PURE__ */ React37.createElement(HiddenSelect, {
|
|
1182
1340
|
state,
|
|
1183
1341
|
triggerRef,
|
|
1184
1342
|
label: props.label,
|
|
1185
1343
|
name: props.name,
|
|
1186
1344
|
isDisabled: disabled
|
|
1187
|
-
}), /* @__PURE__ */
|
|
1345
|
+
}), /* @__PURE__ */ React37.createElement(Box, __spreadProps(__spreadValues({
|
|
1188
1346
|
as: "button"
|
|
1189
|
-
},
|
|
1347
|
+
}, mergeProps5(buttonProps, focusProps)), {
|
|
1190
1348
|
ref: triggerRef,
|
|
1191
1349
|
variant: error && state.isOpen && !disabled ? "button.select.errorOpened" : error ? "button.select.error" : state.isOpen && !disabled ? "button.select.open" : "button.select",
|
|
1192
1350
|
disabled,
|
|
1193
1351
|
className
|
|
1194
|
-
}), /* @__PURE__ */
|
|
1352
|
+
}), /* @__PURE__ */ React37.createElement(Box, __spreadProps(__spreadValues({
|
|
1195
1353
|
as: "span"
|
|
1196
1354
|
}, valueProps), {
|
|
1197
1355
|
variant: disabled ? "select.disabled" : "select"
|
|
1198
|
-
}), state.selectedItem ? state.selectedItem.rendered : placeholder), state.isOpen && !disabled ? /* @__PURE__ */
|
|
1356
|
+
}), state.selectedItem ? state.selectedItem.rendered : placeholder), state.isOpen && !disabled ? /* @__PURE__ */ React37.createElement(ArrowUp, {
|
|
1199
1357
|
size: 16,
|
|
1200
1358
|
fill: "text"
|
|
1201
|
-
}) : /* @__PURE__ */
|
|
1359
|
+
}) : /* @__PURE__ */ React37.createElement(ArrowDown, {
|
|
1202
1360
|
size: 16,
|
|
1203
1361
|
fill: disabled ? "disabled" : "text"
|
|
1204
|
-
})), state.isOpen && !disabled && /* @__PURE__ */
|
|
1205
|
-
as:
|
|
1362
|
+
})), state.isOpen && !disabled && /* @__PURE__ */ React37.createElement(Box, __spreadProps(__spreadValues(__spreadValues({
|
|
1363
|
+
as: Popover2
|
|
1206
1364
|
}, overlayProps), positionProps), {
|
|
1207
1365
|
css: {
|
|
1208
1366
|
width: triggerRef.current && triggerRef.current.offsetWidth + "px"
|
|
@@ -1210,26 +1368,26 @@ var Select = (_a) => {
|
|
|
1210
1368
|
ref: overlayRef,
|
|
1211
1369
|
isOpen: state.isOpen,
|
|
1212
1370
|
onClose: state.close
|
|
1213
|
-
}), /* @__PURE__ */
|
|
1371
|
+
}), /* @__PURE__ */ React37.createElement(ListBox, __spreadProps(__spreadValues({
|
|
1214
1372
|
error
|
|
1215
1373
|
}, menuProps), {
|
|
1216
1374
|
state
|
|
1217
|
-
}))), error && errorMessage && /* @__PURE__ */
|
|
1375
|
+
}))), error && errorMessage && /* @__PURE__ */ React37.createElement(Box, {
|
|
1218
1376
|
as: "span",
|
|
1219
1377
|
display: "inline-flex",
|
|
1220
1378
|
alignItems: "center"
|
|
1221
|
-
}, /* @__PURE__ */
|
|
1222
|
-
as:
|
|
1379
|
+
}, /* @__PURE__ */ React37.createElement(Box, {
|
|
1380
|
+
as: Exclamation3,
|
|
1223
1381
|
size: 16,
|
|
1224
1382
|
css: { color: "error" }
|
|
1225
|
-
}), /* @__PURE__ */
|
|
1383
|
+
}), /* @__PURE__ */ React37.createElement(ValidationMessage, null, errorMessage)));
|
|
1226
1384
|
};
|
|
1227
1385
|
|
|
1228
1386
|
// src/Slider/Slider.tsx
|
|
1229
|
-
import
|
|
1387
|
+
import React38 from "react";
|
|
1230
1388
|
var Slider = (_a) => {
|
|
1231
1389
|
var _b = _a, { variant = "" } = _b, props = __objRest(_b, ["variant"]);
|
|
1232
|
-
return /* @__PURE__ */
|
|
1390
|
+
return /* @__PURE__ */ React38.createElement(Box, __spreadValues({
|
|
1233
1391
|
as: "input",
|
|
1234
1392
|
type: "range",
|
|
1235
1393
|
css: { verticalAlign: "middle" },
|
|
@@ -1238,11 +1396,12 @@ var Slider = (_a) => {
|
|
|
1238
1396
|
};
|
|
1239
1397
|
|
|
1240
1398
|
// src/Switch/Switch.tsx
|
|
1241
|
-
import
|
|
1242
|
-
import { useFocusRing as
|
|
1399
|
+
import React39, { useRef as useRef9 } from "react";
|
|
1400
|
+
import { useFocusRing as useFocusRing6 } from "@react-aria/focus";
|
|
1243
1401
|
import { useSwitch } from "@react-aria/switch";
|
|
1244
|
-
import { VisuallyHidden as
|
|
1245
|
-
import {
|
|
1402
|
+
import { VisuallyHidden as VisuallyHidden3 } from "@react-aria/visually-hidden";
|
|
1403
|
+
import { useToggleState as useToggleState2 } from "@react-stately/toggle";
|
|
1404
|
+
import { conditional as conditional2 } from "@marigold/system";
|
|
1246
1405
|
var Switch = (_a) => {
|
|
1247
1406
|
var _b = _a, {
|
|
1248
1407
|
variant = "",
|
|
@@ -1253,20 +1412,20 @@ var Switch = (_a) => {
|
|
|
1253
1412
|
"labelVariant",
|
|
1254
1413
|
"disabled"
|
|
1255
1414
|
]);
|
|
1256
|
-
const state =
|
|
1257
|
-
const ref =
|
|
1415
|
+
const state = useToggleState2(props);
|
|
1416
|
+
const ref = useRef9();
|
|
1258
1417
|
const { inputProps } = useSwitch(props, state, ref);
|
|
1259
|
-
const { focusProps } =
|
|
1260
|
-
return /* @__PURE__ */
|
|
1261
|
-
as:
|
|
1418
|
+
const { focusProps } = useFocusRing6();
|
|
1419
|
+
return /* @__PURE__ */ React39.createElement(Box, {
|
|
1420
|
+
as: Label2,
|
|
1262
1421
|
__baseCSS: {
|
|
1263
1422
|
userSelect: "none"
|
|
1264
1423
|
},
|
|
1265
1424
|
variant: labelVariant
|
|
1266
|
-
}, props.children, /* @__PURE__ */
|
|
1425
|
+
}, props.children, /* @__PURE__ */ React39.createElement(VisuallyHidden3, null, /* @__PURE__ */ React39.createElement("input", __spreadProps(__spreadValues(__spreadValues({}, inputProps), focusProps), {
|
|
1267
1426
|
disabled,
|
|
1268
1427
|
ref
|
|
1269
|
-
}))), /* @__PURE__ */
|
|
1428
|
+
}))), /* @__PURE__ */ React39.createElement(Box, {
|
|
1270
1429
|
as: "svg",
|
|
1271
1430
|
__baseCSS: {
|
|
1272
1431
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
@@ -1274,7 +1433,7 @@ var Switch = (_a) => {
|
|
|
1274
1433
|
height: 32
|
|
1275
1434
|
},
|
|
1276
1435
|
"aria-hidden": "true"
|
|
1277
|
-
}, /* @__PURE__ */
|
|
1436
|
+
}, /* @__PURE__ */ React39.createElement(Box, {
|
|
1278
1437
|
as: "rect",
|
|
1279
1438
|
__baseCSS: {
|
|
1280
1439
|
x: 4,
|
|
@@ -1283,11 +1442,11 @@ var Switch = (_a) => {
|
|
|
1283
1442
|
width: 48,
|
|
1284
1443
|
height: 24
|
|
1285
1444
|
},
|
|
1286
|
-
variant:
|
|
1445
|
+
variant: conditional2(`switch.${variant}`, {
|
|
1287
1446
|
checked: state.isSelected,
|
|
1288
1447
|
disabled
|
|
1289
1448
|
})
|
|
1290
|
-
}), /* @__PURE__ */
|
|
1449
|
+
}), /* @__PURE__ */ React39.createElement(Box, {
|
|
1291
1450
|
as: "circle",
|
|
1292
1451
|
__baseCSS: {
|
|
1293
1452
|
boxShadow: "1px 1px 4px rgba(0, 0, 0, 0.25)",
|
|
@@ -1299,68 +1458,496 @@ var Switch = (_a) => {
|
|
|
1299
1458
|
})));
|
|
1300
1459
|
};
|
|
1301
1460
|
|
|
1302
|
-
// src/
|
|
1303
|
-
import
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1461
|
+
// src/Stack/Stack.tsx
|
|
1462
|
+
import React40 from "react";
|
|
1463
|
+
var ALIGNMENT2 = {
|
|
1464
|
+
left: "flex-start",
|
|
1465
|
+
center: "center",
|
|
1466
|
+
right: "flex-end"
|
|
1467
|
+
};
|
|
1468
|
+
var Stack = (_a) => {
|
|
1307
1469
|
var _b = _a, {
|
|
1308
|
-
|
|
1309
|
-
|
|
1470
|
+
space = "none",
|
|
1471
|
+
align = "left",
|
|
1472
|
+
children
|
|
1473
|
+
} = _b, props = __objRest(_b, [
|
|
1474
|
+
"space",
|
|
1475
|
+
"align",
|
|
1476
|
+
"children"
|
|
1477
|
+
]);
|
|
1478
|
+
return /* @__PURE__ */ React40.createElement(Box, __spreadProps(__spreadValues({}, props), {
|
|
1479
|
+
display: "flex",
|
|
1480
|
+
flexDirection: "column",
|
|
1481
|
+
alignItems: ALIGNMENT2[align],
|
|
1482
|
+
p: "0",
|
|
1483
|
+
css: { gap: space }
|
|
1484
|
+
}), children);
|
|
1485
|
+
};
|
|
1486
|
+
|
|
1487
|
+
// src/Table/Table.tsx
|
|
1488
|
+
import React47, { useRef as useRef14 } from "react";
|
|
1489
|
+
import { useTable } from "@react-aria/table";
|
|
1490
|
+
import {
|
|
1491
|
+
Cell,
|
|
1492
|
+
Column,
|
|
1493
|
+
Row,
|
|
1494
|
+
TableBody,
|
|
1495
|
+
TableHeader,
|
|
1496
|
+
useTableState
|
|
1497
|
+
} from "@react-stately/table";
|
|
1498
|
+
import { useComponentStyles as useComponentStyles16 } from "@marigold/system";
|
|
1499
|
+
|
|
1500
|
+
// src/Table/TableCell.tsx
|
|
1501
|
+
import React41, { useRef as useRef10 } from "react";
|
|
1502
|
+
import { useCheckbox as useCheckbox2 } from "@react-aria/checkbox";
|
|
1503
|
+
import { useFocusRing as useFocusRing7 } from "@react-aria/focus";
|
|
1504
|
+
import { useTableCell, useTableSelectionCheckbox } from "@react-aria/table";
|
|
1505
|
+
import { mergeProps as mergeProps6 } from "@react-aria/utils";
|
|
1506
|
+
import { useToggleState as useToggleState3 } from "@react-stately/toggle";
|
|
1507
|
+
import { useStateProps as useStateProps4 } from "@marigold/system";
|
|
1508
|
+
var TableCell = ({
|
|
1509
|
+
item: cell,
|
|
1510
|
+
state,
|
|
1511
|
+
isSelectionCell,
|
|
1512
|
+
align = "left",
|
|
1513
|
+
css
|
|
1514
|
+
}) => {
|
|
1515
|
+
const cellRef = useRef10(null);
|
|
1516
|
+
const { gridCellProps } = useTableCell({ node: cell }, state, cellRef);
|
|
1517
|
+
const { checkboxProps } = useTableSelectionCheckbox({ key: cell.parentKey }, state);
|
|
1518
|
+
const inputRef = useRef10(null);
|
|
1519
|
+
const { inputProps } = useCheckbox2(checkboxProps, useToggleState3(checkboxProps), inputRef);
|
|
1520
|
+
const { focusProps, isFocusVisible } = useFocusRing7();
|
|
1521
|
+
const stateProps = useStateProps4({ focus: isFocusVisible });
|
|
1522
|
+
return /* @__PURE__ */ React41.createElement(Box, __spreadValues(__spreadValues({
|
|
1523
|
+
as: "td",
|
|
1524
|
+
ref: cellRef,
|
|
1525
|
+
__baseCSS: {
|
|
1526
|
+
textAlign: isSelectionCell ? "center" : align
|
|
1527
|
+
},
|
|
1528
|
+
css
|
|
1529
|
+
}, mergeProps6(gridCellProps, focusProps)), stateProps), isSelectionCell ? /* @__PURE__ */ React41.createElement("input", __spreadValues({}, inputProps)) : /* @__PURE__ */ React41.createElement(React41.Fragment, null, cell.rendered));
|
|
1530
|
+
};
|
|
1531
|
+
|
|
1532
|
+
// src/Table/TableColumnHeader.tsx
|
|
1533
|
+
import React43, { useRef as useRef11 } from "react";
|
|
1534
|
+
import { useCheckbox as useCheckbox3 } from "@react-aria/checkbox";
|
|
1535
|
+
import { useFocusRing as useFocusRing8 } from "@react-aria/focus";
|
|
1536
|
+
import {
|
|
1537
|
+
useTableSelectAllCheckbox,
|
|
1538
|
+
useTableColumnHeader
|
|
1539
|
+
} from "@react-aria/table";
|
|
1540
|
+
import { mergeProps as mergeProps7 } from "@react-aria/utils";
|
|
1541
|
+
import { useToggleState as useToggleState4 } from "@react-stately/toggle";
|
|
1542
|
+
import { useStateProps as useStateProps5 } from "@marigold/system";
|
|
1543
|
+
|
|
1544
|
+
// src/Text/Text.tsx
|
|
1545
|
+
import React42 from "react";
|
|
1546
|
+
import {
|
|
1547
|
+
useComponentStyles as useComponentStyles15
|
|
1548
|
+
} from "@marigold/system";
|
|
1549
|
+
import { Box as Box11 } from "@marigold/system";
|
|
1550
|
+
var Text = (_a) => {
|
|
1551
|
+
var _b = _a, {
|
|
1552
|
+
variant,
|
|
1553
|
+
size,
|
|
1554
|
+
align,
|
|
1555
|
+
color,
|
|
1556
|
+
fontSize,
|
|
1557
|
+
cursor,
|
|
1558
|
+
outline,
|
|
1559
|
+
children
|
|
1560
|
+
} = _b, props = __objRest(_b, [
|
|
1561
|
+
"variant",
|
|
1562
|
+
"size",
|
|
1563
|
+
"align",
|
|
1564
|
+
"color",
|
|
1565
|
+
"fontSize",
|
|
1566
|
+
"cursor",
|
|
1567
|
+
"outline",
|
|
1568
|
+
"children"
|
|
1569
|
+
]);
|
|
1570
|
+
const styles = useComponentStyles15("Text", {
|
|
1571
|
+
variant,
|
|
1572
|
+
size
|
|
1573
|
+
});
|
|
1574
|
+
return /* @__PURE__ */ React42.createElement(Box11, __spreadProps(__spreadValues({
|
|
1575
|
+
as: "p"
|
|
1576
|
+
}, props), {
|
|
1577
|
+
css: __spreadValues({ color, cursor, outline, fontSize, textAlign: align }, styles)
|
|
1578
|
+
}), children);
|
|
1579
|
+
};
|
|
1580
|
+
|
|
1581
|
+
// src/Table/TableColumnHeader.tsx
|
|
1582
|
+
var TableColumnHeader = ({
|
|
1583
|
+
item: column,
|
|
1584
|
+
state,
|
|
1585
|
+
isSelectionColumn,
|
|
1586
|
+
align = "left",
|
|
1587
|
+
css
|
|
1588
|
+
}) => {
|
|
1589
|
+
const ref = useRef11(null);
|
|
1590
|
+
const { columnHeaderProps } = useTableColumnHeader({ node: column }, state, ref);
|
|
1591
|
+
const { checkboxProps } = useTableSelectAllCheckbox(state);
|
|
1592
|
+
const inputRef = useRef11(null);
|
|
1593
|
+
const { inputProps } = useCheckbox3(checkboxProps, useToggleState4(checkboxProps), inputRef);
|
|
1594
|
+
const { focusProps, isFocusVisible } = useFocusRing8();
|
|
1595
|
+
const stateProps = useStateProps5({ focus: isFocusVisible });
|
|
1596
|
+
return /* @__PURE__ */ React43.createElement(Box, __spreadValues(__spreadValues({
|
|
1597
|
+
as: "th",
|
|
1598
|
+
ref,
|
|
1599
|
+
__baseCSS: { textAlign: isSelectionColumn ? "center" : align },
|
|
1600
|
+
css
|
|
1601
|
+
}, mergeProps7(columnHeaderProps, focusProps)), stateProps), isSelectionColumn ? /* @__PURE__ */ React43.createElement("input", __spreadProps(__spreadValues({}, inputProps), {
|
|
1602
|
+
ref: inputRef
|
|
1603
|
+
})) : /* @__PURE__ */ React43.createElement(Text, {
|
|
1604
|
+
size: "xxsmall"
|
|
1605
|
+
}, column.rendered));
|
|
1606
|
+
};
|
|
1607
|
+
|
|
1608
|
+
// src/Table/TableHeaderRow.tsx
|
|
1609
|
+
import React44, { useRef as useRef12 } from "react";
|
|
1610
|
+
import { useTableHeaderRow } from "@react-aria/table";
|
|
1611
|
+
var TableHeaderRow = ({
|
|
1612
|
+
item,
|
|
1613
|
+
state,
|
|
1614
|
+
children
|
|
1615
|
+
}) => {
|
|
1616
|
+
const ref = useRef12(null);
|
|
1617
|
+
const { rowProps } = useTableHeaderRow({ node: item }, state, ref);
|
|
1618
|
+
return /* @__PURE__ */ React44.createElement("tr", __spreadProps(__spreadValues({}, rowProps), {
|
|
1619
|
+
ref
|
|
1620
|
+
}), children);
|
|
1621
|
+
};
|
|
1622
|
+
|
|
1623
|
+
// src/Table/TableRow.tsx
|
|
1624
|
+
import React45, { useRef as useRef13 } from "react";
|
|
1625
|
+
import { useFocusRing as useFocusRing9 } from "@react-aria/focus";
|
|
1626
|
+
import { useTableRow } from "@react-aria/table";
|
|
1627
|
+
import { mergeProps as mergeProps8 } from "@react-aria/utils";
|
|
1628
|
+
import { useStateProps as useStateProps6 } from "@marigold/system";
|
|
1629
|
+
var TableRow = ({ item, state, children, css }) => {
|
|
1630
|
+
const ref = useRef13(null);
|
|
1631
|
+
const isSelected = state.selectionManager.isSelected(item.key);
|
|
1632
|
+
const { rowProps } = useTableRow({
|
|
1633
|
+
node: item
|
|
1634
|
+
}, state, ref);
|
|
1635
|
+
const { focusProps, isFocusVisible } = useFocusRing9();
|
|
1636
|
+
const stateProps = useStateProps6({
|
|
1637
|
+
focus: isFocusVisible,
|
|
1638
|
+
checked: isSelected
|
|
1639
|
+
});
|
|
1640
|
+
return /* @__PURE__ */ React45.createElement(Box, __spreadValues(__spreadValues({
|
|
1641
|
+
as: "tr",
|
|
1642
|
+
ref,
|
|
1643
|
+
css
|
|
1644
|
+
}, mergeProps8(rowProps, focusProps)), stateProps), children);
|
|
1645
|
+
};
|
|
1646
|
+
|
|
1647
|
+
// src/Table/TableRowGroup.tsx
|
|
1648
|
+
import React46 from "react";
|
|
1649
|
+
import { useTableRowGroup } from "@react-aria/table";
|
|
1650
|
+
var TableRowGroup = ({
|
|
1651
|
+
as: Element,
|
|
1652
|
+
children
|
|
1653
|
+
}) => {
|
|
1654
|
+
const { rowGroupProps } = useTableRowGroup();
|
|
1655
|
+
return /* @__PURE__ */ React46.createElement(Element, __spreadValues({}, rowGroupProps), children);
|
|
1656
|
+
};
|
|
1657
|
+
|
|
1658
|
+
// src/Table/Table.tsx
|
|
1659
|
+
var Table = (_a) => {
|
|
1660
|
+
var _b = _a, {
|
|
1661
|
+
align,
|
|
1662
|
+
alignHeader,
|
|
1663
|
+
variant,
|
|
1664
|
+
size
|
|
1665
|
+
} = _b, props = __objRest(_b, [
|
|
1666
|
+
"align",
|
|
1667
|
+
"alignHeader",
|
|
1668
|
+
"variant",
|
|
1669
|
+
"size"
|
|
1670
|
+
]);
|
|
1671
|
+
const showSelectionCheckboxes = props.selectionMode === "multiple" && props.selectionBehavior !== "replace";
|
|
1672
|
+
const state = useTableState(__spreadProps(__spreadValues({}, props), {
|
|
1673
|
+
showSelectionCheckboxes
|
|
1674
|
+
}));
|
|
1675
|
+
const ref = useRef14(null);
|
|
1676
|
+
const { gridProps } = useTable(props, state, ref);
|
|
1677
|
+
const styles = useComponentStyles16("Table", { variant, size }, { parts: ["table", "header", "row", "cell"] });
|
|
1678
|
+
return /* @__PURE__ */ React47.createElement(Box, __spreadValues({
|
|
1679
|
+
as: "table",
|
|
1680
|
+
ref,
|
|
1681
|
+
__baseCSS: styles.table
|
|
1682
|
+
}, gridProps), /* @__PURE__ */ React47.createElement(TableRowGroup, {
|
|
1683
|
+
as: "thead"
|
|
1684
|
+
}, state.collection.headerRows.map((headerRow) => /* @__PURE__ */ React47.createElement(TableHeaderRow, {
|
|
1685
|
+
key: headerRow.key,
|
|
1686
|
+
item: headerRow,
|
|
1687
|
+
state
|
|
1688
|
+
}, [...headerRow.childNodes].map((column) => /* @__PURE__ */ React47.createElement(TableColumnHeader, {
|
|
1689
|
+
key: column.key,
|
|
1690
|
+
item: column,
|
|
1691
|
+
state,
|
|
1692
|
+
isSelectionColumn: column.props.isSelectionCell,
|
|
1693
|
+
align: alignHeader,
|
|
1694
|
+
css: styles.header
|
|
1695
|
+
}))))), /* @__PURE__ */ React47.createElement(TableRowGroup, {
|
|
1696
|
+
as: "tbody"
|
|
1697
|
+
}, [...state.collection.body.childNodes].map((row) => /* @__PURE__ */ React47.createElement(TableRow, {
|
|
1698
|
+
css: styles.row,
|
|
1699
|
+
key: row.key,
|
|
1700
|
+
item: row,
|
|
1701
|
+
state
|
|
1702
|
+
}, [...row.childNodes].map((cell) => /* @__PURE__ */ React47.createElement(TableCell, {
|
|
1703
|
+
key: cell.key,
|
|
1704
|
+
item: cell,
|
|
1705
|
+
state,
|
|
1706
|
+
isSelectionCell: cell.props.isSelectionCell,
|
|
1707
|
+
align,
|
|
1708
|
+
css: styles.cell
|
|
1709
|
+
}))))));
|
|
1710
|
+
};
|
|
1711
|
+
Table.Body = TableBody;
|
|
1712
|
+
Table.Cell = Cell;
|
|
1713
|
+
Table.Column = Column;
|
|
1714
|
+
Table.Header = TableHeader;
|
|
1715
|
+
Table.Row = Row;
|
|
1716
|
+
|
|
1717
|
+
// src/TextArea/TextArea.tsx
|
|
1718
|
+
import React50, { useRef as useRef15 } from "react";
|
|
1719
|
+
import { useTextField } from "@react-aria/textfield";
|
|
1720
|
+
import {
|
|
1721
|
+
Box as Box13,
|
|
1722
|
+
useComponentStyles as useComponentStyles18,
|
|
1723
|
+
useStateProps as useStateProps7
|
|
1724
|
+
} from "@marigold/system";
|
|
1725
|
+
|
|
1726
|
+
// src/Field/FieldBase.tsx
|
|
1727
|
+
import React49 from "react";
|
|
1728
|
+
|
|
1729
|
+
// src/Field/HelpText.tsx
|
|
1730
|
+
import React48 from "react";
|
|
1731
|
+
import { Exclamation as Exclamation4 } from "@marigold/icons";
|
|
1732
|
+
import {
|
|
1733
|
+
Box as Box12,
|
|
1734
|
+
useComponentStyles as useComponentStyles17
|
|
1735
|
+
} from "@marigold/system";
|
|
1736
|
+
var HelpText = (_a) => {
|
|
1737
|
+
var _b = _a, {
|
|
1738
|
+
variant,
|
|
1739
|
+
size,
|
|
1740
|
+
disabled,
|
|
1741
|
+
description,
|
|
1742
|
+
descriptionProps,
|
|
1310
1743
|
error,
|
|
1311
1744
|
errorMessage,
|
|
1312
|
-
|
|
1313
|
-
children
|
|
1745
|
+
errorMessageProps
|
|
1314
1746
|
} = _b, props = __objRest(_b, [
|
|
1315
1747
|
"variant",
|
|
1316
|
-
"
|
|
1748
|
+
"size",
|
|
1749
|
+
"disabled",
|
|
1750
|
+
"description",
|
|
1751
|
+
"descriptionProps",
|
|
1317
1752
|
"error",
|
|
1318
1753
|
"errorMessage",
|
|
1319
|
-
"
|
|
1320
|
-
"children"
|
|
1754
|
+
"errorMessageProps"
|
|
1321
1755
|
]);
|
|
1322
|
-
|
|
1323
|
-
const
|
|
1324
|
-
|
|
1325
|
-
}),
|
|
1326
|
-
|
|
1327
|
-
|
|
1756
|
+
var _a2;
|
|
1757
|
+
const hasErrorMessage = errorMessage && error;
|
|
1758
|
+
const styles = useComponentStyles17("HelpText", { variant, size }, { parts: ["container", "icon"] });
|
|
1759
|
+
return /* @__PURE__ */ React48.createElement(Box12, __spreadProps(__spreadValues({}, props), {
|
|
1760
|
+
__baseCSS: { display: "flex", alignItems: "center", gap: 4 },
|
|
1761
|
+
css: styles.container
|
|
1762
|
+
}), hasErrorMessage ? /* @__PURE__ */ React48.createElement(React48.Fragment, null, /* @__PURE__ */ React48.createElement(Exclamation4, {
|
|
1763
|
+
role: "presentation",
|
|
1764
|
+
size: ((_a2 = styles == null ? void 0 : styles.icon) == null ? void 0 : _a2.size) || 16
|
|
1765
|
+
}), /* @__PURE__ */ React48.createElement(Box12, __spreadValues({}, errorMessageProps), errorMessage)) : /* @__PURE__ */ React48.createElement(Box12, __spreadValues({}, descriptionProps), description));
|
|
1766
|
+
};
|
|
1767
|
+
|
|
1768
|
+
// src/Field/FieldBase.tsx
|
|
1769
|
+
var FieldBase = ({
|
|
1770
|
+
variant,
|
|
1771
|
+
size,
|
|
1772
|
+
children,
|
|
1773
|
+
disabled,
|
|
1774
|
+
required,
|
|
1775
|
+
label,
|
|
1776
|
+
labelProps,
|
|
1777
|
+
description,
|
|
1778
|
+
descriptionProps,
|
|
1779
|
+
error,
|
|
1780
|
+
errorMessage,
|
|
1781
|
+
errorMessageProps,
|
|
1782
|
+
stateProps
|
|
1783
|
+
}) => {
|
|
1784
|
+
const hasHelpText = !!description || errorMessage && error;
|
|
1785
|
+
return /* @__PURE__ */ React49.createElement(Stack, null, label && /* @__PURE__ */ React49.createElement(Label, __spreadProps(__spreadValues(__spreadValues({}, labelProps), stateProps), {
|
|
1328
1786
|
required
|
|
1329
|
-
}
|
|
1787
|
+
}), label), children, hasHelpText && /* @__PURE__ */ React49.createElement(HelpText, __spreadProps(__spreadValues({}, stateProps), {
|
|
1788
|
+
disabled,
|
|
1789
|
+
description,
|
|
1790
|
+
descriptionProps,
|
|
1791
|
+
error,
|
|
1792
|
+
errorMessage,
|
|
1793
|
+
errorMessageProps
|
|
1794
|
+
})));
|
|
1795
|
+
};
|
|
1796
|
+
|
|
1797
|
+
// src/TextArea/TextArea.tsx
|
|
1798
|
+
import { useHover as useHover2 } from "@react-aria/interactions";
|
|
1799
|
+
import { useFocusRing as useFocusRing10 } from "@react-aria/focus";
|
|
1800
|
+
var TextArea = (_a) => {
|
|
1801
|
+
var _b = _a, {
|
|
1802
|
+
disabled,
|
|
1803
|
+
required,
|
|
1804
|
+
readOnly,
|
|
1805
|
+
error
|
|
1806
|
+
} = _b, props = __objRest(_b, [
|
|
1807
|
+
"disabled",
|
|
1808
|
+
"required",
|
|
1809
|
+
"readOnly",
|
|
1810
|
+
"error"
|
|
1811
|
+
]);
|
|
1812
|
+
const { label, description, errorMessage } = props;
|
|
1813
|
+
const ref = useRef15(null);
|
|
1814
|
+
const { labelProps, inputProps, descriptionProps, errorMessageProps } = useTextField(__spreadValues({
|
|
1815
|
+
inputElementType: "textarea",
|
|
1816
|
+
isDisabled: disabled,
|
|
1817
|
+
isRequired: required,
|
|
1818
|
+
isReadOnly: readOnly,
|
|
1819
|
+
validationState: error ? "invalid" : "valid"
|
|
1820
|
+
}, props), ref);
|
|
1821
|
+
const { hoverProps, isHovered } = useHover2({});
|
|
1822
|
+
const { focusProps, isFocusVisible } = useFocusRing10();
|
|
1823
|
+
const stateProps = useStateProps7({
|
|
1824
|
+
hover: isHovered,
|
|
1825
|
+
focus: isFocusVisible,
|
|
1826
|
+
disabled,
|
|
1827
|
+
readOnly,
|
|
1828
|
+
error
|
|
1829
|
+
});
|
|
1830
|
+
const styles = useComponentStyles18("TextArea", {});
|
|
1831
|
+
return /* @__PURE__ */ React50.createElement(FieldBase, {
|
|
1832
|
+
label,
|
|
1833
|
+
labelProps,
|
|
1834
|
+
required,
|
|
1835
|
+
description,
|
|
1836
|
+
descriptionProps,
|
|
1837
|
+
error,
|
|
1838
|
+
errorMessage,
|
|
1839
|
+
errorMessageProps,
|
|
1840
|
+
stateProps
|
|
1841
|
+
}, /* @__PURE__ */ React50.createElement(Box13, __spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
1330
1842
|
as: "textarea",
|
|
1331
|
-
variant:
|
|
1332
|
-
css:
|
|
1333
|
-
outlineColor: error && "error"
|
|
1334
|
-
}
|
|
1335
|
-
}, inputProps), {
|
|
1843
|
+
variant: "textArea",
|
|
1844
|
+
css: styles,
|
|
1336
1845
|
ref
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
|
|
1846
|
+
}, inputProps), focusProps), hoverProps), stateProps)));
|
|
1847
|
+
};
|
|
1848
|
+
|
|
1849
|
+
// src/TextField/TextField.tsx
|
|
1850
|
+
import React52, { useRef as useRef16 } from "react";
|
|
1851
|
+
import { useHover as useHover3 } from "@react-aria/interactions";
|
|
1852
|
+
import { useFocusRing as useFocusRing11 } from "@react-aria/focus";
|
|
1853
|
+
import { useTextField as useTextField2 } from "@react-aria/textfield";
|
|
1854
|
+
import { useStateProps as useStateProps8 } from "@marigold/system";
|
|
1855
|
+
|
|
1856
|
+
// src/Input/Input.tsx
|
|
1857
|
+
import React51, { forwardRef as forwardRef4 } from "react";
|
|
1858
|
+
import { Box as Box14, useComponentStyles as useComponentStyles19 } from "@marigold/system";
|
|
1859
|
+
var Input = forwardRef4((_a, ref) => {
|
|
1860
|
+
var _b = _a, { variant, size, type = "text" } = _b, props = __objRest(_b, ["variant", "size", "type"]);
|
|
1861
|
+
const styles = useComponentStyles19("Input", { variant, size });
|
|
1862
|
+
return /* @__PURE__ */ React51.createElement(Box14, __spreadProps(__spreadValues({}, props), {
|
|
1863
|
+
ref,
|
|
1864
|
+
as: "input",
|
|
1865
|
+
type,
|
|
1866
|
+
css: styles
|
|
1867
|
+
}));
|
|
1868
|
+
});
|
|
1869
|
+
|
|
1870
|
+
// src/TextField/TextField.tsx
|
|
1871
|
+
var TextField = (_a) => {
|
|
1872
|
+
var _b = _a, {
|
|
1873
|
+
disabled,
|
|
1874
|
+
required,
|
|
1875
|
+
readOnly,
|
|
1876
|
+
error
|
|
1877
|
+
} = _b, props = __objRest(_b, [
|
|
1878
|
+
"disabled",
|
|
1879
|
+
"required",
|
|
1880
|
+
"readOnly",
|
|
1881
|
+
"error"
|
|
1882
|
+
]);
|
|
1883
|
+
const { label, description, errorMessage } = props;
|
|
1884
|
+
const ref = useRef16(null);
|
|
1885
|
+
const { labelProps, inputProps, descriptionProps, errorMessageProps } = useTextField2(__spreadValues({
|
|
1886
|
+
isDisabled: disabled,
|
|
1887
|
+
isRequired: required,
|
|
1888
|
+
isReadOnly: readOnly,
|
|
1889
|
+
validationState: error ? "invalid" : "valid"
|
|
1890
|
+
}, props), ref);
|
|
1891
|
+
const { hoverProps, isHovered } = useHover3({});
|
|
1892
|
+
const { focusProps, isFocusVisible } = useFocusRing11();
|
|
1893
|
+
const stateProps = useStateProps8({
|
|
1894
|
+
hover: isHovered,
|
|
1895
|
+
focus: isFocusVisible,
|
|
1896
|
+
disabled,
|
|
1897
|
+
readOnly,
|
|
1898
|
+
error
|
|
1899
|
+
});
|
|
1900
|
+
return /* @__PURE__ */ React52.createElement(FieldBase, {
|
|
1901
|
+
label,
|
|
1902
|
+
labelProps,
|
|
1903
|
+
required,
|
|
1904
|
+
description,
|
|
1905
|
+
descriptionProps,
|
|
1906
|
+
error,
|
|
1907
|
+
errorMessage,
|
|
1908
|
+
errorMessageProps,
|
|
1909
|
+
stateProps
|
|
1910
|
+
}, /* @__PURE__ */ React52.createElement(Input, __spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
1911
|
+
ref
|
|
1912
|
+
}, inputProps), focusProps), hoverProps), stateProps)));
|
|
1340
1913
|
};
|
|
1341
1914
|
|
|
1915
|
+
// src/Tiles/Tiles.tsx
|
|
1916
|
+
import React53 from "react";
|
|
1917
|
+
var Tiles = React53.forwardRef(function Tiles2(_a, ref) {
|
|
1918
|
+
var _b = _a, { space = "none", itemMinWidth = "250px", children } = _b, props = __objRest(_b, ["space", "itemMinWidth", "children"]);
|
|
1919
|
+
return /* @__PURE__ */ React53.createElement(Box, __spreadValues({
|
|
1920
|
+
ref,
|
|
1921
|
+
display: "grid",
|
|
1922
|
+
__baseCSS: {
|
|
1923
|
+
gap: space,
|
|
1924
|
+
gridTemplateColumns: `repeat(auto-fit, minmax(min(${itemMinWidth}, 100%), 1fr))`
|
|
1925
|
+
}
|
|
1926
|
+
}, props), children);
|
|
1927
|
+
});
|
|
1928
|
+
|
|
1342
1929
|
// src/Tooltip/Tooltip.tsx
|
|
1343
|
-
import
|
|
1930
|
+
import React55, { useContext as useContext3 } from "react";
|
|
1344
1931
|
import { useTooltip } from "@react-aria/tooltip";
|
|
1345
|
-
import { mergeProps as
|
|
1932
|
+
import { mergeProps as mergeProps9 } from "@react-aria/utils";
|
|
1346
1933
|
|
|
1347
1934
|
// src/Tooltip/TooltipTrigger.tsx
|
|
1348
|
-
import
|
|
1935
|
+
import React54, { useRef as useRef17 } from "react";
|
|
1349
1936
|
import { FocusableProvider } from "@react-aria/focus";
|
|
1350
1937
|
import { useTooltipTrigger } from "@react-aria/tooltip";
|
|
1351
1938
|
import {
|
|
1352
1939
|
useTooltipTriggerState
|
|
1353
1940
|
} from "@react-stately/tooltip";
|
|
1354
|
-
var TooltipContext =
|
|
1941
|
+
var TooltipContext = React54.createContext({});
|
|
1355
1942
|
var TooltipTrigger = (_a) => {
|
|
1356
1943
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
1357
|
-
const [trigger, tooltip] =
|
|
1944
|
+
const [trigger, tooltip] = React54.Children.toArray(children);
|
|
1358
1945
|
const state = useTooltipTriggerState(props);
|
|
1359
|
-
const tooltipTriggerRef =
|
|
1946
|
+
const tooltipTriggerRef = useRef17();
|
|
1360
1947
|
const { triggerProps, tooltipProps } = useTooltipTrigger({}, state, tooltipTriggerRef);
|
|
1361
|
-
return /* @__PURE__ */
|
|
1948
|
+
return /* @__PURE__ */ React54.createElement(FocusableProvider, __spreadProps(__spreadValues({}, triggerProps), {
|
|
1362
1949
|
ref: tooltipTriggerRef
|
|
1363
|
-
}), trigger, state.isOpen && /* @__PURE__ */
|
|
1950
|
+
}), trigger, state.isOpen && /* @__PURE__ */ React54.createElement(TooltipContext.Provider, {
|
|
1364
1951
|
value: __spreadValues({
|
|
1365
1952
|
state
|
|
1366
1953
|
}, tooltipProps)
|
|
@@ -1376,69 +1963,96 @@ var Tooltip = (_a) => {
|
|
|
1376
1963
|
"variant",
|
|
1377
1964
|
"children"
|
|
1378
1965
|
]);
|
|
1379
|
-
const _a2 =
|
|
1380
|
-
const mergedProps =
|
|
1966
|
+
const _a2 = useContext3(TooltipContext), { state } = _a2, tooltipProviderProps = __objRest(_a2, ["state"]);
|
|
1967
|
+
const mergedProps = mergeProps9(props, tooltipProviderProps);
|
|
1381
1968
|
const { tooltipProps } = useTooltip(mergedProps, state);
|
|
1382
|
-
return /* @__PURE__ */
|
|
1969
|
+
return /* @__PURE__ */ React55.createElement(Box, __spreadValues({
|
|
1383
1970
|
position: "relative"
|
|
1384
|
-
}, tooltipProps), /* @__PURE__ */
|
|
1971
|
+
}, tooltipProps), /* @__PURE__ */ React55.createElement(Box, __spreadValues({
|
|
1385
1972
|
position: "absolute",
|
|
1386
1973
|
variant: `tooltip.${variant}`
|
|
1387
1974
|
}, mergedProps), children));
|
|
1388
1975
|
};
|
|
1389
1976
|
|
|
1390
|
-
// src/
|
|
1391
|
-
import
|
|
1392
|
-
|
|
1977
|
+
// src/Container/Container.tsx
|
|
1978
|
+
import React56 from "react";
|
|
1979
|
+
import { size as tokenSize } from "@marigold/tokens";
|
|
1980
|
+
var ALIGNMENT3 = {
|
|
1981
|
+
left: "flex-start",
|
|
1982
|
+
center: "center",
|
|
1983
|
+
right: "flex-end"
|
|
1984
|
+
};
|
|
1985
|
+
var Container = (_a) => {
|
|
1393
1986
|
var _b = _a, {
|
|
1394
|
-
|
|
1395
|
-
|
|
1987
|
+
contentType = "content",
|
|
1988
|
+
size = "medium",
|
|
1989
|
+
align = "left",
|
|
1990
|
+
alignContainer = "left",
|
|
1991
|
+
children
|
|
1396
1992
|
} = _b, props = __objRest(_b, [
|
|
1397
|
-
"
|
|
1398
|
-
"
|
|
1993
|
+
"contentType",
|
|
1994
|
+
"size",
|
|
1995
|
+
"align",
|
|
1996
|
+
"alignContainer",
|
|
1997
|
+
"children"
|
|
1399
1998
|
]);
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
return /* @__PURE__ */
|
|
1412
|
-
|
|
1413
|
-
|
|
1999
|
+
const maxWidth = tokenSize[contentType][size];
|
|
2000
|
+
let gridTemplateColumns = `${maxWidth} 1fr 1fr`;
|
|
2001
|
+
let gridColumn = 1;
|
|
2002
|
+
if (alignContainer === "center") {
|
|
2003
|
+
gridTemplateColumns = `1fr ${maxWidth} 1fr`;
|
|
2004
|
+
gridColumn = 2;
|
|
2005
|
+
}
|
|
2006
|
+
if (alignContainer === "right") {
|
|
2007
|
+
gridTemplateColumns = `1fr 1fr ${maxWidth}`;
|
|
2008
|
+
gridColumn = 3;
|
|
2009
|
+
}
|
|
2010
|
+
return /* @__PURE__ */ React56.createElement(Box, __spreadValues({
|
|
2011
|
+
display: "grid",
|
|
2012
|
+
css: {
|
|
2013
|
+
gridTemplateColumns,
|
|
2014
|
+
placeItems: ALIGNMENT3[align],
|
|
2015
|
+
"> *": {
|
|
2016
|
+
gridColumn
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
}, props), children);
|
|
1414
2020
|
};
|
|
1415
2021
|
|
|
1416
2022
|
// src/index.ts
|
|
1417
|
-
import { Item, Section } from "@react-stately/collections";
|
|
2023
|
+
import { Item as Item2, Section } from "@react-stately/collections";
|
|
1418
2024
|
export {
|
|
1419
|
-
|
|
2025
|
+
Aside,
|
|
2026
|
+
Aspect,
|
|
1420
2027
|
Badge,
|
|
1421
2028
|
Box,
|
|
2029
|
+
Breakout,
|
|
1422
2030
|
Button,
|
|
1423
2031
|
Card,
|
|
2032
|
+
Center,
|
|
1424
2033
|
Checkbox,
|
|
1425
|
-
|
|
2034
|
+
CheckboxGroup,
|
|
2035
|
+
CheckboxGroupContext,
|
|
1426
2036
|
Columns,
|
|
1427
2037
|
Container,
|
|
2038
|
+
Content,
|
|
1428
2039
|
Dialog,
|
|
1429
2040
|
Divider,
|
|
1430
|
-
|
|
2041
|
+
Footer,
|
|
2042
|
+
Header,
|
|
2043
|
+
Headline,
|
|
1431
2044
|
Image,
|
|
1432
2045
|
Inline,
|
|
1433
2046
|
Input,
|
|
1434
|
-
Item,
|
|
1435
|
-
Label,
|
|
2047
|
+
Item2 as Item,
|
|
2048
|
+
Label2 as Label,
|
|
1436
2049
|
LabelBase,
|
|
1437
2050
|
Link,
|
|
1438
2051
|
MarigoldProvider,
|
|
1439
2052
|
Menu,
|
|
1440
|
-
MenuItem,
|
|
1441
2053
|
Message,
|
|
2054
|
+
Overlay,
|
|
2055
|
+
Popover,
|
|
1442
2056
|
Radio,
|
|
1443
2057
|
SSRProvider,
|
|
1444
2058
|
Section,
|
|
@@ -1446,14 +2060,18 @@ export {
|
|
|
1446
2060
|
Slider,
|
|
1447
2061
|
Stack,
|
|
1448
2062
|
Switch,
|
|
2063
|
+
Table,
|
|
1449
2064
|
Text,
|
|
1450
|
-
|
|
2065
|
+
TextArea,
|
|
2066
|
+
TextField,
|
|
1451
2067
|
ThemeProvider2 as ThemeProvider,
|
|
2068
|
+
Tiles,
|
|
1452
2069
|
Tooltip,
|
|
1453
2070
|
TooltipContext,
|
|
1454
2071
|
TooltipTrigger,
|
|
1455
2072
|
ValidationMessage,
|
|
1456
|
-
|
|
2073
|
+
VisuallyHidden,
|
|
2074
|
+
useCheckboxGroupContext,
|
|
1457
2075
|
useDialogButtonProps,
|
|
1458
|
-
|
|
2076
|
+
useTheme2 as useTheme
|
|
1459
2077
|
};
|