@marigold/components 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +34 -27
- package/dist/index.js +158 -137
- package/dist/index.mjs +262 -239
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -131,27 +131,10 @@ interface LabelProps extends LabelBaseProps {
|
|
|
131
131
|
}
|
|
132
132
|
declare const Label: React.FC<LabelProps>;
|
|
133
133
|
|
|
134
|
-
interface TextThemeExtension<Value> {
|
|
135
|
-
text?: {
|
|
136
|
-
[key: string]: Value;
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
interface TextOwnProps extends BoxOwnProps {
|
|
140
|
-
align?: ResponsiveStyleValue<string>;
|
|
141
|
-
color?: ResponsiveStyleValue<string>;
|
|
142
|
-
cursor?: ResponsiveStyleValue<string>;
|
|
143
|
-
size?: ResponsiveStyleValue<keyof Theme$1['fontSizes'] | string>;
|
|
144
|
-
outline?: ResponsiveStyleValue<string>;
|
|
145
|
-
userSelect?: ResponsiveStyleValue<string>;
|
|
146
|
-
}
|
|
147
|
-
interface TextProps extends PolymorphicPropsWithRef<TextOwnProps, 'span'> {
|
|
148
|
-
}
|
|
149
|
-
declare const Text: PolymorphicComponentWithRef<TextOwnProps, 'span'>;
|
|
150
|
-
|
|
151
134
|
interface LinkThemeExtension<Value> {
|
|
152
135
|
link?: Value;
|
|
153
136
|
}
|
|
154
|
-
interface LinkOwnProps extends
|
|
137
|
+
interface LinkOwnProps extends BoxOwnProps {
|
|
155
138
|
disabled?: boolean;
|
|
156
139
|
}
|
|
157
140
|
interface LinkProps extends PolymorphicProps<LinkOwnProps, 'a'> {
|
|
@@ -259,6 +242,23 @@ declare type SwitchProps = {
|
|
|
259
242
|
} & AriaSwitchProps & ToggleProps & ComponentProps<'input'>;
|
|
260
243
|
declare const Switch: React.FC<SwitchProps>;
|
|
261
244
|
|
|
245
|
+
interface TextThemeExtension<Value> {
|
|
246
|
+
text?: {
|
|
247
|
+
[key: string]: Value;
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
interface TextOwnProps extends BoxOwnProps {
|
|
251
|
+
align?: ResponsiveStyleValue<string>;
|
|
252
|
+
color?: ResponsiveStyleValue<string>;
|
|
253
|
+
cursor?: ResponsiveStyleValue<string>;
|
|
254
|
+
size?: ResponsiveStyleValue<keyof Theme$1['fontSizes'] | string>;
|
|
255
|
+
outline?: ResponsiveStyleValue<string>;
|
|
256
|
+
userSelect?: ResponsiveStyleValue<string>;
|
|
257
|
+
}
|
|
258
|
+
interface TextProps extends PolymorphicPropsWithRef<TextOwnProps, 'span'> {
|
|
259
|
+
}
|
|
260
|
+
declare const Text: PolymorphicComponentWithRef<TextOwnProps, 'span'>;
|
|
261
|
+
|
|
262
262
|
interface TextareaThemeExtension<Value> {
|
|
263
263
|
textarea?: {
|
|
264
264
|
[key: string]: Value;
|
|
@@ -326,18 +326,23 @@ interface AspectProps extends ComponentProps<'div'> {
|
|
|
326
326
|
}
|
|
327
327
|
declare const Aspect: React.FC<AspectProps>;
|
|
328
328
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
width?: WidthValues | WidthValues[];
|
|
329
|
+
interface BreakoutProps extends ComponentProps<'div'> {
|
|
330
|
+
horizontalAlign?: 'top' | 'bottom' | 'center';
|
|
331
|
+
verticalAlign?: 'left' | 'right' | 'center';
|
|
333
332
|
}
|
|
334
|
-
declare const
|
|
333
|
+
declare const Breakout: React.FC<BreakoutProps>;
|
|
334
|
+
|
|
335
|
+
interface CenterProps extends ComponentProps<'div'> {
|
|
336
|
+
maxWidth?: string;
|
|
337
|
+
space?: ResponsiveStyleValue<string>;
|
|
338
|
+
}
|
|
339
|
+
declare const Center: React.FC<CenterProps>;
|
|
335
340
|
|
|
336
341
|
interface ColumnsProps {
|
|
337
|
-
|
|
342
|
+
columns: Array<number>;
|
|
338
343
|
space?: ResponsiveStyleValue<string>;
|
|
339
|
-
|
|
340
|
-
|
|
344
|
+
columnLimit?: number;
|
|
345
|
+
collapseAt?: string;
|
|
341
346
|
}
|
|
342
347
|
declare const Columns: React.FC<ColumnsProps>;
|
|
343
348
|
|
|
@@ -377,6 +382,7 @@ interface InlineProps {
|
|
|
377
382
|
declare const Inline: React.FC<InlineProps>;
|
|
378
383
|
|
|
379
384
|
interface StackProps {
|
|
385
|
+
as?: 'div' | 'ul' | 'ol';
|
|
380
386
|
space?: ResponsiveStyleValue<string>;
|
|
381
387
|
align?: 'left' | 'right' | 'center';
|
|
382
388
|
}
|
|
@@ -392,7 +398,8 @@ interface ContainerProps extends ComponentProps<'div'> {
|
|
|
392
398
|
contentType?: 'content' | 'header';
|
|
393
399
|
size?: keyof typeof size.content | keyof typeof size.header;
|
|
394
400
|
align?: 'left' | 'right' | 'center';
|
|
401
|
+
alignContainer?: 'left' | 'right' | 'center';
|
|
395
402
|
}
|
|
396
403
|
declare const Container: React.FC<ContainerProps>;
|
|
397
404
|
|
|
398
|
-
export { ActionGroup, ActionGroupProps, Aside, AsideProps, Aspect, AspectProps, Badge, BadgeProps, BadgeThemeExtension, Button, ButtonProps, ButtonThemeExtension, Card, CardProps, CardThemeExtension,
|
|
405
|
+
export { ActionGroup, ActionGroupProps, Aside, AsideProps, Aspect, AspectProps, Badge, BadgeProps, BadgeThemeExtension, Breakout, BreakoutProps, Button, ButtonProps, ButtonThemeExtension, Card, CardProps, CardThemeExtension, Center, CenterProps, Checkbox, CheckboxProps, CheckboxThemeExtension, Columns, ColumnsProps, Container, ContainerProps, Dialog, DialogProps, Divider, DividerProps, DividerThemeExtension, Field, FieldProps, Image, ImageProps, ImageThemeExtension, Inline, InlineProps, Input, InputProps, InputThemeExtension, Label, LabelBase, LabelBaseProps, LabelProps, LabelThemeExtension, Link, LinkOwnProps, LinkProps, LinkThemeExtension, MarigoldProvider, MarigoldProviderProps, Menu, MenuItem, MenuItemProps, MenuItemThemeExtension, MenuProps, MenuThemeExtension, Message, MessageProps, MessageThemeExtension, Radio, RadioProps, RadioThemeExtension, RootThemeExtension, Select, SelectProps, SelectThemeExtension, Slider, SliderProps, SliderThemeExtension, Stack, StackProps, Switch, SwitchProps, SwitchThemeExtension, Text, TextOwnProps, TextProps, TextThemeExtension, Textarea, TextareaProps, TextareaThemeExtension, Theme, Tiles, TilesProps, Tooltip, TooltipContext, TooltipProps, TooltipThemeExtension, TooltipTrigger, ValidationMessage, ValidationMessageProps, ValidationMessageThemeExtension, useDialogButtonProps };
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,6 @@ var __spreadValues = (a, b) => {
|
|
|
21
21
|
return a;
|
|
22
22
|
};
|
|
23
23
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
24
|
var __objRest = (source, exclude) => {
|
|
26
25
|
var target = {};
|
|
27
26
|
for (var prop in source)
|
|
@@ -38,22 +37,16 @@ var __export = (target, all) => {
|
|
|
38
37
|
for (var name in all)
|
|
39
38
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
39
|
};
|
|
41
|
-
var
|
|
42
|
-
if (
|
|
43
|
-
for (let key of __getOwnPropNames(
|
|
44
|
-
if (!__hasOwnProp.call(
|
|
45
|
-
__defProp(
|
|
40
|
+
var __copyProps = (to, from, except, desc) => {
|
|
41
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
42
|
+
for (let key of __getOwnPropNames(from))
|
|
43
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
44
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
45
|
}
|
|
47
|
-
return
|
|
48
|
-
};
|
|
49
|
-
var __toESM = (module2, isNodeMode) => {
|
|
50
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
46
|
+
return to;
|
|
51
47
|
};
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
55
|
-
};
|
|
56
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
48
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
49
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
57
50
|
|
|
58
51
|
// src/index.ts
|
|
59
52
|
var src_exports = {};
|
|
@@ -63,10 +56,11 @@ __export(src_exports, {
|
|
|
63
56
|
Aspect: () => Aspect,
|
|
64
57
|
Badge: () => Badge,
|
|
65
58
|
Box: () => import_system.Box,
|
|
59
|
+
Breakout: () => Breakout,
|
|
66
60
|
Button: () => Button,
|
|
67
61
|
Card: () => Card,
|
|
62
|
+
Center: () => Center,
|
|
68
63
|
Checkbox: () => Checkbox,
|
|
69
|
-
Column: () => Column,
|
|
70
64
|
Columns: () => Columns,
|
|
71
65
|
Container: () => Container,
|
|
72
66
|
Dialog: () => Dialog,
|
|
@@ -102,6 +96,7 @@ __export(src_exports, {
|
|
|
102
96
|
useDialogButtonProps: () => useDialogButtonProps,
|
|
103
97
|
useTheme: () => import_system5.useTheme
|
|
104
98
|
});
|
|
99
|
+
module.exports = __toCommonJS(src_exports);
|
|
105
100
|
|
|
106
101
|
// src/ActionGroup/ActionGroup.tsx
|
|
107
102
|
var import_react3 = __toESM(require("react"));
|
|
@@ -153,10 +148,11 @@ var Stack = (_a) => {
|
|
|
153
148
|
"children"
|
|
154
149
|
]);
|
|
155
150
|
return /* @__PURE__ */ import_react2.default.createElement(import_system.Box, __spreadProps(__spreadValues({}, props), {
|
|
156
|
-
__baseCSS: { gap: space },
|
|
157
151
|
display: "flex",
|
|
158
152
|
flexDirection: "column",
|
|
159
|
-
alignItems: ALIGNMENT2[align]
|
|
153
|
+
alignItems: ALIGNMENT2[align],
|
|
154
|
+
p: "0",
|
|
155
|
+
css: { gap: space }
|
|
160
156
|
}), children);
|
|
161
157
|
};
|
|
162
158
|
|
|
@@ -295,8 +291,44 @@ var Button = (0, import_react7.forwardRef)((_a, ref) => {
|
|
|
295
291
|
}), children);
|
|
296
292
|
});
|
|
297
293
|
|
|
298
|
-
// src/
|
|
294
|
+
// src/Breakout/Breakout.tsx
|
|
299
295
|
var import_react8 = __toESM(require("react"));
|
|
296
|
+
var useAlignment = (direction) => {
|
|
297
|
+
switch (direction) {
|
|
298
|
+
case "right":
|
|
299
|
+
return "flex-end";
|
|
300
|
+
case "bottom":
|
|
301
|
+
return "flex-end";
|
|
302
|
+
case "center":
|
|
303
|
+
return "center";
|
|
304
|
+
}
|
|
305
|
+
return "flex-start";
|
|
306
|
+
};
|
|
307
|
+
var Breakout = (_a) => {
|
|
308
|
+
var _b = _a, {
|
|
309
|
+
horizontalAlign,
|
|
310
|
+
verticalAlign,
|
|
311
|
+
children
|
|
312
|
+
} = _b, props = __objRest(_b, [
|
|
313
|
+
"horizontalAlign",
|
|
314
|
+
"verticalAlign",
|
|
315
|
+
"children"
|
|
316
|
+
]);
|
|
317
|
+
const alignItems = useAlignment(horizontalAlign);
|
|
318
|
+
const justifyContent = useAlignment(verticalAlign);
|
|
319
|
+
return /* @__PURE__ */ import_react8.default.createElement(import_system.Box, __spreadValues({
|
|
320
|
+
alignItems,
|
|
321
|
+
justifyContent,
|
|
322
|
+
width: "100%",
|
|
323
|
+
display: verticalAlign || horizontalAlign ? "flex" : "block",
|
|
324
|
+
css: {
|
|
325
|
+
gridColumn: "1 / -1"
|
|
326
|
+
}
|
|
327
|
+
}, props), children);
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
// src/Card/Card.tsx
|
|
331
|
+
var import_react9 = __toESM(require("react"));
|
|
300
332
|
var Card = (_a) => {
|
|
301
333
|
var _b = _a, {
|
|
302
334
|
variant = "",
|
|
@@ -311,19 +343,45 @@ var Card = (_a) => {
|
|
|
311
343
|
"className",
|
|
312
344
|
"children"
|
|
313
345
|
]);
|
|
314
|
-
return /* @__PURE__ */
|
|
346
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_system.Box, __spreadProps(__spreadValues({}, props), {
|
|
315
347
|
variant: `card.${variant}`,
|
|
316
348
|
maxWidth: width,
|
|
317
349
|
className
|
|
318
|
-
}), title && /* @__PURE__ */
|
|
350
|
+
}), title && /* @__PURE__ */ import_react9.default.createElement(import_system.Box, {
|
|
319
351
|
as: "h2",
|
|
320
352
|
variant: "text.h2",
|
|
321
353
|
pb: "small"
|
|
322
354
|
}, title), children);
|
|
323
355
|
};
|
|
324
356
|
|
|
357
|
+
// src/Center/Center.tsx
|
|
358
|
+
var import_react10 = __toESM(require("react"));
|
|
359
|
+
var Center = (_a) => {
|
|
360
|
+
var _b = _a, {
|
|
361
|
+
maxWidth,
|
|
362
|
+
space = "none",
|
|
363
|
+
children
|
|
364
|
+
} = _b, props = __objRest(_b, [
|
|
365
|
+
"maxWidth",
|
|
366
|
+
"space",
|
|
367
|
+
"children"
|
|
368
|
+
]);
|
|
369
|
+
return /* @__PURE__ */ import_react10.default.createElement(import_system.Box, __spreadValues({
|
|
370
|
+
css: {
|
|
371
|
+
boxSizing: "content-box",
|
|
372
|
+
display: "flex",
|
|
373
|
+
flexDirection: "column",
|
|
374
|
+
alignItems: "center",
|
|
375
|
+
justifyContent: "center",
|
|
376
|
+
marginInline: "auto",
|
|
377
|
+
maxInlineSize: maxWidth,
|
|
378
|
+
gap: space
|
|
379
|
+
}
|
|
380
|
+
}, props), children);
|
|
381
|
+
};
|
|
382
|
+
|
|
325
383
|
// src/Checkbox/Checkbox.tsx
|
|
326
|
-
var
|
|
384
|
+
var import_react14 = __toESM(require("react"));
|
|
327
385
|
var import_focus = require("@react-aria/focus");
|
|
328
386
|
var import_visually_hidden = require("@react-aria/visually-hidden");
|
|
329
387
|
var import_checkbox = require("@react-aria/checkbox");
|
|
@@ -331,7 +389,7 @@ var import_toggle = require("@react-stately/toggle");
|
|
|
331
389
|
var import_icons2 = require("@marigold/icons");
|
|
332
390
|
|
|
333
391
|
// src/Checkbox/CheckboxIcon.tsx
|
|
334
|
-
var
|
|
392
|
+
var import_react11 = __toESM(require("react"));
|
|
335
393
|
var import_system2 = require("@marigold/system");
|
|
336
394
|
var CheckboxIcon = ({
|
|
337
395
|
variant = "",
|
|
@@ -346,13 +404,13 @@ var CheckboxIcon = ({
|
|
|
346
404
|
checked,
|
|
347
405
|
error
|
|
348
406
|
};
|
|
349
|
-
return /* @__PURE__ */
|
|
407
|
+
return /* @__PURE__ */ import_react11.default.createElement(import_system2.SVG, {
|
|
350
408
|
width: "16",
|
|
351
409
|
height: "32",
|
|
352
410
|
viewBox: "0 0 16 32",
|
|
353
411
|
fill: "none",
|
|
354
412
|
"aria-hidden": "true"
|
|
355
|
-
}, /* @__PURE__ */
|
|
413
|
+
}, /* @__PURE__ */ import_react11.default.createElement(import_system.Box, {
|
|
356
414
|
as: "rect",
|
|
357
415
|
x: "0.5",
|
|
358
416
|
y: "8.5",
|
|
@@ -360,13 +418,13 @@ var CheckboxIcon = ({
|
|
|
360
418
|
height: "15px",
|
|
361
419
|
rx: "1.5",
|
|
362
420
|
variant: (0, import_system2.conditional)(`checkbox.${variant}`, conditionalStates)
|
|
363
|
-
}), checked && indeterminated && /* @__PURE__ */
|
|
421
|
+
}), checked && indeterminated && /* @__PURE__ */ import_react11.default.createElement(import_system.Box, {
|
|
364
422
|
__baseCSS: { fill: "gray00" },
|
|
365
423
|
as: "path",
|
|
366
424
|
fillRule: "evenodd",
|
|
367
425
|
clipRule: "evenodd",
|
|
368
426
|
d: "M13.5 17.0402H2.5V15.4688H13.5V17.0402V17.0402Z"
|
|
369
|
-
}), checked && !indeterminated && /* @__PURE__ */
|
|
427
|
+
}), checked && !indeterminated && /* @__PURE__ */ import_react11.default.createElement(import_system.Box, {
|
|
370
428
|
__baseCSS: { fill: "gray00" },
|
|
371
429
|
as: "path",
|
|
372
430
|
fillRule: "evenodd",
|
|
@@ -376,7 +434,7 @@ var CheckboxIcon = ({
|
|
|
376
434
|
};
|
|
377
435
|
|
|
378
436
|
// src/Label/Label.tsx
|
|
379
|
-
var
|
|
437
|
+
var import_react12 = __toESM(require("react"));
|
|
380
438
|
var import_icons = require("@marigold/icons");
|
|
381
439
|
var LabelBase = (_a) => {
|
|
382
440
|
var _b = _a, {
|
|
@@ -390,7 +448,7 @@ var LabelBase = (_a) => {
|
|
|
390
448
|
"color",
|
|
391
449
|
"children"
|
|
392
450
|
]);
|
|
393
|
-
return /* @__PURE__ */
|
|
451
|
+
return /* @__PURE__ */ import_react12.default.createElement(import_system.Box, __spreadProps(__spreadValues({}, props), {
|
|
394
452
|
as: "label",
|
|
395
453
|
__baseCSS: { color },
|
|
396
454
|
variant: `label.${variant}`
|
|
@@ -404,18 +462,18 @@ var Label = (_a) => {
|
|
|
404
462
|
"required",
|
|
405
463
|
"children"
|
|
406
464
|
]);
|
|
407
|
-
return required ? /* @__PURE__ */
|
|
465
|
+
return required ? /* @__PURE__ */ import_react12.default.createElement(import_system.Box, {
|
|
408
466
|
as: "span",
|
|
409
467
|
display: "inline-flex",
|
|
410
468
|
alignItems: "center"
|
|
411
|
-
}, /* @__PURE__ */
|
|
469
|
+
}, /* @__PURE__ */ import_react12.default.createElement(LabelBase, __spreadValues({}, props), children), required && /* @__PURE__ */ import_react12.default.createElement(import_icons.Required, {
|
|
412
470
|
size: 16,
|
|
413
471
|
fill: "error"
|
|
414
|
-
})) : /* @__PURE__ */
|
|
472
|
+
})) : /* @__PURE__ */ import_react12.default.createElement(LabelBase, __spreadValues({}, props), children);
|
|
415
473
|
};
|
|
416
474
|
|
|
417
475
|
// src/ValidationMessage/ValidationMessage.tsx
|
|
418
|
-
var
|
|
476
|
+
var import_react13 = __toESM(require("react"));
|
|
419
477
|
var ValidationMessage = (_a) => {
|
|
420
478
|
var _b = _a, {
|
|
421
479
|
variant = "error",
|
|
@@ -426,7 +484,7 @@ var ValidationMessage = (_a) => {
|
|
|
426
484
|
"children",
|
|
427
485
|
"className"
|
|
428
486
|
]);
|
|
429
|
-
return /* @__PURE__ */
|
|
487
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_system.Box, __spreadValues({
|
|
430
488
|
as: "span",
|
|
431
489
|
display: "flex",
|
|
432
490
|
alignItems: "center",
|
|
@@ -445,15 +503,15 @@ var CheckboxInput = (_a) => {
|
|
|
445
503
|
"indeterminated"
|
|
446
504
|
]);
|
|
447
505
|
const state = (0, import_toggle.useToggleState)(props);
|
|
448
|
-
const ref =
|
|
506
|
+
const ref = import_react14.default.useRef(null);
|
|
449
507
|
const { inputProps } = (0, import_checkbox.useCheckbox)(props, state, ref);
|
|
450
508
|
const { focusProps } = (0, import_focus.useFocusRing)();
|
|
451
509
|
const _a2 = props, { children } = _a2, restProps = __objRest(_a2, ["children"]);
|
|
452
|
-
return /* @__PURE__ */
|
|
510
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_system.Box, {
|
|
453
511
|
pr: "xsmall"
|
|
454
|
-
}, /* @__PURE__ */
|
|
512
|
+
}, /* @__PURE__ */ import_react14.default.createElement(import_visually_hidden.VisuallyHidden, null, /* @__PURE__ */ import_react14.default.createElement("input", __spreadValues(__spreadProps(__spreadValues(__spreadValues({}, inputProps), focusProps), {
|
|
455
513
|
ref
|
|
456
|
-
}), restProps))), /* @__PURE__ */
|
|
514
|
+
}), restProps))), /* @__PURE__ */ import_react14.default.createElement(CheckboxIcon, {
|
|
457
515
|
checked: props.checked,
|
|
458
516
|
variant: props.variant,
|
|
459
517
|
disabled: props.disabled,
|
|
@@ -471,7 +529,7 @@ var Checkbox = (_a) => {
|
|
|
471
529
|
"labelVariant",
|
|
472
530
|
"errorMessage"
|
|
473
531
|
]);
|
|
474
|
-
return /* @__PURE__ */
|
|
532
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, /* @__PURE__ */ import_react14.default.createElement(import_system.Box, {
|
|
475
533
|
as: Label,
|
|
476
534
|
__baseCSS: {
|
|
477
535
|
":hover": { cursor: props.disabled ? "not-allowed" : "pointer" }
|
|
@@ -480,103 +538,47 @@ var Checkbox = (_a) => {
|
|
|
480
538
|
required,
|
|
481
539
|
variant: `label.${labelVariant}`,
|
|
482
540
|
color: props.disabled ? "disabled" : "text"
|
|
483
|
-
}, /* @__PURE__ */
|
|
541
|
+
}, /* @__PURE__ */ import_react14.default.createElement(CheckboxInput, __spreadValues({
|
|
484
542
|
error: props.error
|
|
485
|
-
}, props)), props.children), props.error && errorMessage && /* @__PURE__ */
|
|
543
|
+
}, props)), props.children), props.error && errorMessage && /* @__PURE__ */ import_react14.default.createElement(ValidationMessage, null, /* @__PURE__ */ import_react14.default.createElement(import_icons2.Exclamation, {
|
|
486
544
|
size: 16
|
|
487
545
|
}), errorMessage));
|
|
488
546
|
};
|
|
489
547
|
|
|
490
|
-
// src/Column/Column.tsx
|
|
491
|
-
var import_react13 = __toESM(require("react"));
|
|
492
|
-
var transform = (width) => {
|
|
493
|
-
if (Array.isArray(width)) {
|
|
494
|
-
return width.map((v) => `${v / 12 * 100}%`);
|
|
495
|
-
}
|
|
496
|
-
return `${width / 12 * 100}%`;
|
|
497
|
-
};
|
|
498
|
-
var Column = (_a) => {
|
|
499
|
-
var _b = _a, {
|
|
500
|
-
width = 12,
|
|
501
|
-
children
|
|
502
|
-
} = _b, props = __objRest(_b, [
|
|
503
|
-
"width",
|
|
504
|
-
"children"
|
|
505
|
-
]);
|
|
506
|
-
return /* @__PURE__ */ import_react13.default.createElement(import_system.Box, __spreadProps(__spreadValues({}, props), {
|
|
507
|
-
width: transform(width)
|
|
508
|
-
}), children);
|
|
509
|
-
};
|
|
510
|
-
|
|
511
548
|
// src/Columns/Columns.tsx
|
|
512
549
|
var import_react15 = __toESM(require("react"));
|
|
513
|
-
var import_system3 = require("@marigold/system");
|
|
514
|
-
|
|
515
|
-
// src/utils/flatten-children.ts
|
|
516
|
-
var import_react14 = require("react");
|
|
517
|
-
var import_react_is = require("react-is");
|
|
518
|
-
var flattenChildren = (children, depth = 0, keys = []) => import_react14.Children.toArray(children).reduce((acc, node) => {
|
|
519
|
-
if ((0, import_react_is.isFragment)(node)) {
|
|
520
|
-
acc.push.apply(acc, flattenChildren(node.props.children, depth + 1, keys.concat(node.key)));
|
|
521
|
-
} else {
|
|
522
|
-
if ((0, import_react14.isValidElement)(node)) {
|
|
523
|
-
acc.push((0, import_react14.cloneElement)(node, {
|
|
524
|
-
key: keys.concat(String(node.key)).join(".")
|
|
525
|
-
}));
|
|
526
|
-
} else if (typeof node === "string" || typeof node === "number") {
|
|
527
|
-
acc.push(node);
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
return acc;
|
|
531
|
-
}, []);
|
|
532
|
-
|
|
533
|
-
// src/Columns/Columns.tsx
|
|
534
|
-
var useAlignment = (direction) => {
|
|
535
|
-
switch (direction) {
|
|
536
|
-
case "right":
|
|
537
|
-
return "flex-end";
|
|
538
|
-
case "bottom":
|
|
539
|
-
return "flex-end";
|
|
540
|
-
case "center":
|
|
541
|
-
return "center";
|
|
542
|
-
}
|
|
543
|
-
return "flex-start";
|
|
544
|
-
};
|
|
545
550
|
var Columns = (_a) => {
|
|
546
551
|
var _b = _a, {
|
|
547
552
|
space = "none",
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
className,
|
|
553
|
+
columns,
|
|
554
|
+
collapseAt = "40em",
|
|
551
555
|
children
|
|
552
556
|
} = _b, props = __objRest(_b, [
|
|
553
557
|
"space",
|
|
554
|
-
"
|
|
555
|
-
"
|
|
556
|
-
"className",
|
|
558
|
+
"columns",
|
|
559
|
+
"collapseAt",
|
|
557
560
|
"children"
|
|
558
561
|
]);
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
const
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
m: `${-spaceValue / 2}px`,
|
|
562
|
+
if (import_react15.Children.count(children) !== columns.length) {
|
|
563
|
+
throw new Error(`Columns: expected ${columns.length} children, got ${import_react15.Children.count(children)}`);
|
|
564
|
+
}
|
|
565
|
+
const getColumnWidths = columns.map((column, index) => {
|
|
566
|
+
return {
|
|
567
|
+
[`> :nth-of-type(${index + 1})`]: {
|
|
568
|
+
flexGrow: column
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
});
|
|
572
|
+
return /* @__PURE__ */ import_react15.default.createElement(import_system.Box, __spreadValues({
|
|
571
573
|
display: "flex",
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
},
|
|
579
|
-
}))
|
|
574
|
+
css: Object.assign({
|
|
575
|
+
flexWrap: "wrap",
|
|
576
|
+
gap: space,
|
|
577
|
+
"> *": {
|
|
578
|
+
flexBasis: `calc(( ${collapseAt} - 100%) * 999)`
|
|
579
|
+
}
|
|
580
|
+
}, ...getColumnWidths)
|
|
581
|
+
}, props), children);
|
|
580
582
|
};
|
|
581
583
|
|
|
582
584
|
// src/Dialog/Dialog.tsx
|
|
@@ -826,10 +828,11 @@ var Image = (_a) => {
|
|
|
826
828
|
// src/Link/Link.tsx
|
|
827
829
|
var import_react22 = __toESM(require("react"));
|
|
828
830
|
var import_link = require("@react-aria/link");
|
|
831
|
+
var import_system3 = require("@marigold/system");
|
|
829
832
|
var Link = (_a) => {
|
|
830
833
|
var _b = _a, {
|
|
831
834
|
as = "a",
|
|
832
|
-
variant = "
|
|
835
|
+
variant = "",
|
|
833
836
|
children,
|
|
834
837
|
disabled
|
|
835
838
|
} = _b, props = __objRest(_b, [
|
|
@@ -838,16 +841,17 @@ var Link = (_a) => {
|
|
|
838
841
|
"children",
|
|
839
842
|
"disabled"
|
|
840
843
|
]);
|
|
841
|
-
const ref = (0, import_react22.useRef)();
|
|
844
|
+
const ref = (0, import_react22.useRef)(null);
|
|
842
845
|
const { linkProps } = (0, import_link.useLink)(__spreadProps(__spreadValues({}, props), {
|
|
843
846
|
elementType: typeof as === "string" ? as : "span",
|
|
844
847
|
isDisabled: disabled
|
|
845
848
|
}), ref);
|
|
846
|
-
return /* @__PURE__ */ import_react22.default.createElement(
|
|
849
|
+
return /* @__PURE__ */ import_react22.default.createElement(import_system.Box, __spreadValues(__spreadValues({
|
|
847
850
|
as,
|
|
848
|
-
variant,
|
|
851
|
+
variant: (0, import_system3.conditional)(`link.${variant}`, { disabled }),
|
|
852
|
+
css: { cursor: disabled ? "default" : "pointer" },
|
|
849
853
|
ref
|
|
850
|
-
}), children);
|
|
854
|
+
}, props), linkProps), children);
|
|
851
855
|
};
|
|
852
856
|
|
|
853
857
|
// src/Menu/Menu.tsx
|
|
@@ -1039,7 +1043,7 @@ var Radio = (_a) => {
|
|
|
1039
1043
|
var import_react33 = __toESM(require("react"));
|
|
1040
1044
|
var import_select = require("@react-stately/select");
|
|
1041
1045
|
var import_button3 = require("@react-aria/button");
|
|
1042
|
-
var
|
|
1046
|
+
var import_utils2 = require("@react-aria/utils");
|
|
1043
1047
|
var import_focus5 = require("@react-aria/focus");
|
|
1044
1048
|
var import_select2 = require("@react-aria/select");
|
|
1045
1049
|
var import_overlays6 = require("@react-stately/overlays");
|
|
@@ -1130,7 +1134,7 @@ var ListBox = (props) => {
|
|
|
1130
1134
|
var import_react32 = __toESM(require("react"));
|
|
1131
1135
|
var import_focus4 = require("@react-aria/focus");
|
|
1132
1136
|
var import_overlays5 = require("@react-aria/overlays");
|
|
1133
|
-
var
|
|
1137
|
+
var import_utils = require("@react-aria/utils");
|
|
1134
1138
|
var Popover = (0, import_react32.forwardRef)((_a, ref) => {
|
|
1135
1139
|
var _b = _a, { children, className, isOpen, onClose } = _b, otherProps = __objRest(_b, ["children", "className", "isOpen", "onClose"]);
|
|
1136
1140
|
const { overlayProps } = (0, import_overlays5.useOverlay)({
|
|
@@ -1142,7 +1146,7 @@ var Popover = (0, import_react32.forwardRef)((_a, ref) => {
|
|
|
1142
1146
|
const { modalProps } = (0, import_overlays5.useModal)();
|
|
1143
1147
|
return /* @__PURE__ */ import_react32.default.createElement(import_overlays5.OverlayContainer, null, /* @__PURE__ */ import_react32.default.createElement(import_focus4.FocusScope, {
|
|
1144
1148
|
restoreFocus: true
|
|
1145
|
-
}, /* @__PURE__ */ import_react32.default.createElement(import_system.Box, __spreadProps(__spreadValues({}, (0,
|
|
1149
|
+
}, /* @__PURE__ */ import_react32.default.createElement(import_system.Box, __spreadProps(__spreadValues({}, (0, import_utils.mergeProps)(overlayProps, otherProps, modalProps)), {
|
|
1146
1150
|
className,
|
|
1147
1151
|
ref
|
|
1148
1152
|
}), children, /* @__PURE__ */ import_react32.default.createElement(import_overlays5.DismissButton, {
|
|
@@ -1209,7 +1213,7 @@ var Select = (_a) => {
|
|
|
1209
1213
|
isDisabled: disabled
|
|
1210
1214
|
}), /* @__PURE__ */ import_react33.default.createElement(import_system.Box, __spreadProps(__spreadValues({
|
|
1211
1215
|
as: "button"
|
|
1212
|
-
}, (0,
|
|
1216
|
+
}, (0, import_utils2.mergeProps)(buttonProps, focusProps)), {
|
|
1213
1217
|
ref: triggerRef,
|
|
1214
1218
|
variant: error && state.isOpen && !disabled ? "button.select.errorOpened" : error ? "button.select.error" : state.isOpen && !disabled ? "button.select.open" : "button.select",
|
|
1215
1219
|
disabled,
|
|
@@ -1380,7 +1384,7 @@ var Tiles = import_react37.default.forwardRef(function Tiles2(_a, ref) {
|
|
|
1380
1384
|
// src/Tooltip/Tooltip.tsx
|
|
1381
1385
|
var import_react39 = __toESM(require("react"));
|
|
1382
1386
|
var import_tooltip3 = require("@react-aria/tooltip");
|
|
1383
|
-
var
|
|
1387
|
+
var import_utils3 = require("@react-aria/utils");
|
|
1384
1388
|
|
|
1385
1389
|
// src/Tooltip/TooltipTrigger.tsx
|
|
1386
1390
|
var import_react38 = __toESM(require("react"));
|
|
@@ -1413,7 +1417,7 @@ var Tooltip = (_a) => {
|
|
|
1413
1417
|
"children"
|
|
1414
1418
|
]);
|
|
1415
1419
|
const _a2 = (0, import_react39.useContext)(TooltipContext), { state } = _a2, tooltipProviderProps = __objRest(_a2, ["state"]);
|
|
1416
|
-
const mergedProps = (0,
|
|
1420
|
+
const mergedProps = (0, import_utils3.mergeProps)(props, tooltipProviderProps);
|
|
1417
1421
|
const { tooltipProps } = (0, import_tooltip3.useTooltip)(mergedProps, state);
|
|
1418
1422
|
return /* @__PURE__ */ import_react39.default.createElement(import_system.Box, __spreadValues({
|
|
1419
1423
|
position: "relative"
|
|
@@ -1453,24 +1457,40 @@ var Container = (_a) => {
|
|
|
1453
1457
|
contentType = "content",
|
|
1454
1458
|
size = "medium",
|
|
1455
1459
|
align = "left",
|
|
1460
|
+
alignContainer = "left",
|
|
1456
1461
|
children
|
|
1457
1462
|
} = _b, props = __objRest(_b, [
|
|
1458
1463
|
"contentType",
|
|
1459
1464
|
"size",
|
|
1460
1465
|
"align",
|
|
1466
|
+
"alignContainer",
|
|
1461
1467
|
"children"
|
|
1462
1468
|
]);
|
|
1469
|
+
const maxWidth = import_tokens2.size[contentType][size];
|
|
1470
|
+
let gridTemplateColumns = `${maxWidth} 1fr 1fr`;
|
|
1471
|
+
let gridColumn = 1;
|
|
1472
|
+
if (alignContainer === "center") {
|
|
1473
|
+
gridTemplateColumns = `1fr ${maxWidth} 1fr`;
|
|
1474
|
+
gridColumn = 2;
|
|
1475
|
+
}
|
|
1476
|
+
if (alignContainer === "right") {
|
|
1477
|
+
gridTemplateColumns = `1fr 1fr ${maxWidth}`;
|
|
1478
|
+
gridColumn = 3;
|
|
1479
|
+
}
|
|
1463
1480
|
return /* @__PURE__ */ import_react41.default.createElement(import_system.Box, __spreadValues({
|
|
1464
|
-
display: "
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1481
|
+
display: "grid",
|
|
1482
|
+
css: {
|
|
1483
|
+
gridTemplateColumns,
|
|
1484
|
+
placeItems: ALIGNMENT3[align],
|
|
1485
|
+
"> *": {
|
|
1486
|
+
gridColumn
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1468
1489
|
}, props), children);
|
|
1469
1490
|
};
|
|
1470
1491
|
|
|
1471
1492
|
// src/index.ts
|
|
1472
1493
|
var import_collections = require("@react-stately/collections");
|
|
1473
|
-
module.exports = __toCommonJS(src_exports);
|
|
1474
1494
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1475
1495
|
0 && (module.exports = {
|
|
1476
1496
|
ActionGroup,
|
|
@@ -1478,10 +1498,11 @@ module.exports = __toCommonJS(src_exports);
|
|
|
1478
1498
|
Aspect,
|
|
1479
1499
|
Badge,
|
|
1480
1500
|
Box,
|
|
1501
|
+
Breakout,
|
|
1481
1502
|
Button,
|
|
1482
1503
|
Card,
|
|
1504
|
+
Center,
|
|
1483
1505
|
Checkbox,
|
|
1484
|
-
Column,
|
|
1485
1506
|
Columns,
|
|
1486
1507
|
Container,
|
|
1487
1508
|
Dialog,
|