@marigold/components 2.1.1 → 2.2.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 +22 -10
- package/dist/index.js +76 -47
- package/dist/index.mjs +82 -49
- package/package.json +44 -44
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { useAsyncList, useListData } from '@react-stately/data';
|
|
2
|
-
import { ThemeExtension, ThemeComponentProps, ThemeExtensionsWithParts, CSSObject, BoxOwnProps, StateAttrProps, Theme as Theme$1,
|
|
2
|
+
import { ThemeExtension, ThemeComponentProps, ResponsiveStyleValue, ThemeExtensionsWithParts, CSSObject, BoxOwnProps, StateAttrProps, Theme as Theme$1, ThemeProviderProps, GlobalProps } from '@marigold/system';
|
|
3
3
|
export { Box, BoxOwnProps, BoxProps, StyleProps, ThemeProvider, useTheme } from '@marigold/system';
|
|
4
4
|
import React, { ReactNode, HTMLAttributes, Key, LabelHTMLAttributes, ForwardRefExoticComponent, RefAttributes, ReactElement } from 'react';
|
|
5
5
|
import { ComponentProps, PolymorphicPropsWithRef, PolymorphicComponentWithRef, NonZeroPercentage } from '@marigold/types';
|
|
@@ -50,8 +50,15 @@ interface CardThemeExtension extends ThemeExtension<'Card'> {
|
|
|
50
50
|
}
|
|
51
51
|
interface CardProps extends ThemeComponentProps, ComponentProps<'div'> {
|
|
52
52
|
children?: ReactNode;
|
|
53
|
+
p?: ResponsiveStyleValue<string>;
|
|
54
|
+
px?: ResponsiveStyleValue<string>;
|
|
55
|
+
py?: ResponsiveStyleValue<string>;
|
|
56
|
+
pt?: ResponsiveStyleValue<string>;
|
|
57
|
+
pb?: ResponsiveStyleValue<string>;
|
|
58
|
+
pl?: ResponsiveStyleValue<string>;
|
|
59
|
+
pr?: ResponsiveStyleValue<string>;
|
|
53
60
|
}
|
|
54
|
-
declare const Card: ({ children, variant, size, ...props }: CardProps) => JSX.Element;
|
|
61
|
+
declare const Card: ({ children, variant, size, p, px, py, pt, pb, pl, pr, ...props }: CardProps) => JSX.Element;
|
|
55
62
|
|
|
56
63
|
interface CheckboxThemeExtension extends ThemeExtensionsWithParts<'Checkbox', [
|
|
57
64
|
'container',
|
|
@@ -63,7 +70,7 @@ interface CheckboxThemeExtension extends ThemeExtensionsWithParts<'Checkbox', [
|
|
|
63
70
|
* `react-aria` has a slightly different API for the above events.
|
|
64
71
|
* Thus, we adjust our regular props to match them.
|
|
65
72
|
*/
|
|
66
|
-
declare type CustomCheckboxProps = 'value' | 'onChange' | 'onFocus' | 'onBlur';
|
|
73
|
+
declare type CustomCheckboxProps = 'value' | 'onChange' | 'onFocus' | 'onBlur' | 'onKeyDown' | 'onKeyUp';
|
|
67
74
|
interface CheckboxProps extends ThemeComponentProps, Omit<ComponentProps<'input'>, 'size' | 'type' | 'defaultValue' | CustomCheckboxProps>, Pick<AriaCheckboxProps, CustomCheckboxProps> {
|
|
68
75
|
children?: ReactNode;
|
|
69
76
|
indeterminate?: boolean;
|
|
@@ -470,8 +477,8 @@ interface TextAreaThemeExtension extends ThemeExtension<'TextArea'> {
|
|
|
470
477
|
* `react-aria` has a slightly different API for the above events.
|
|
471
478
|
* Thus, we adjust our regular props to match them.
|
|
472
479
|
*/
|
|
473
|
-
declare type
|
|
474
|
-
interface TextAreaProps extends Omit<ComponentProps<'textarea'>, 'value' | 'defaultValue' | 'size' |
|
|
480
|
+
declare type CustomTextAreaEvents = 'onChange' | 'onFocus' | 'onBlur' | 'onCopy' | 'onSelect' | 'onPaste' | 'onCut' | 'onCompositionStart' | 'onCompositionUpdate' | 'onCompositionEnd' | 'onBeforeInput' | 'onInput' | 'onKeyDown' | 'onKeyUp';
|
|
481
|
+
interface TextAreaProps extends Omit<ComponentProps<'textarea'>, 'value' | 'defaultValue' | 'size' | CustomTextAreaEvents>, Pick<AriaTextFieldProps, CustomTextAreaEvents>, Pick<FieldBaseProps, 'label' | 'description' | 'error' | 'errorMessage'> {
|
|
475
482
|
variant?: string;
|
|
476
483
|
size?: string;
|
|
477
484
|
width?: string;
|
|
@@ -553,9 +560,9 @@ interface ContainerProps extends ComponentProps<'div'> {
|
|
|
553
560
|
contentType?: 'content' | 'header';
|
|
554
561
|
size?: keyof typeof size.content | keyof typeof size.header;
|
|
555
562
|
align?: 'left' | 'right' | 'center';
|
|
556
|
-
|
|
563
|
+
alignItems?: 'left' | 'right' | 'center' | 'none';
|
|
557
564
|
}
|
|
558
|
-
declare const Container: ({ contentType, size, align,
|
|
565
|
+
declare const Container: ({ contentType, size, align, alignItems, children, ...props }: ContainerProps) => JSX.Element;
|
|
559
566
|
|
|
560
567
|
declare const ALIGNMENT_X$1: {
|
|
561
568
|
left: string;
|
|
@@ -603,12 +610,17 @@ interface StackProps {
|
|
|
603
610
|
}
|
|
604
611
|
declare const Stack: ({ children, space, alignX, alignY, stretch, ...props }: StackProps) => JSX.Element;
|
|
605
612
|
|
|
606
|
-
|
|
613
|
+
/**
|
|
614
|
+
* `react-aria` has a slightly different API for the above events.
|
|
615
|
+
* Thus, we adjust our regular props to match them.
|
|
616
|
+
*/
|
|
617
|
+
declare type CustomTextFieldEvents = 'onChange' | 'onFocus' | 'onBlur' | 'onKeyDown' | 'onKeyUp';
|
|
618
|
+
interface TextFieldProps extends Omit<ComponentProps<'input'>, 'value' | 'defaultValue' | 'size' | 'width' | CustomTextFieldEvents>,
|
|
607
619
|
/**
|
|
608
620
|
* `react-aria` has a slightly different API for `onChange`, `onFocus`
|
|
609
621
|
* and `onBlur` events. Thus, we adjust our regular props to match them.
|
|
610
622
|
*/
|
|
611
|
-
Pick<AriaTextFieldProps,
|
|
623
|
+
Pick<AriaTextFieldProps, CustomTextFieldEvents>, Pick<FieldBaseProps, 'label' | 'description' | 'error' | 'errorMessage'> {
|
|
612
624
|
variant?: string;
|
|
613
625
|
size?: string;
|
|
614
626
|
width?: string;
|
|
@@ -624,4 +636,4 @@ interface TilesProps {
|
|
|
624
636
|
}
|
|
625
637
|
declare const Tiles: React.ForwardRefExoticComponent<TilesProps & React.RefAttributes<HTMLDivElement>>;
|
|
626
638
|
|
|
627
|
-
export { Aside, AsideProps, Aspect, AspectProps, Badge, BadgeProps, BadgeThemeExtension, Breakout, BreakoutProps, Button, ButtonOwnProps, ButtonProps, ButtonThemeExtension, Card, CardProps, CardThemeExtension, Center, CenterProps, Checkbox, CheckboxGroup, CheckboxGroupContext, CheckboxGroupContextProps, CheckboxGroupThemeExtension, CheckboxProps, CheckboxThemeExtension, Columns, ColumnsProps, Container, ContainerProps, Content, ContentProps, ContentThemeExtension, CustomCheckboxProps, CustomRadioProps, CustomSwitchProps,
|
|
639
|
+
export { Aside, AsideProps, Aspect, AspectProps, Badge, BadgeProps, BadgeThemeExtension, Breakout, BreakoutProps, Button, ButtonOwnProps, ButtonProps, ButtonThemeExtension, Card, CardProps, CardThemeExtension, Center, CenterProps, Checkbox, CheckboxGroup, CheckboxGroupContext, CheckboxGroupContextProps, CheckboxGroupThemeExtension, CheckboxProps, CheckboxThemeExtension, Columns, ColumnsProps, Container, ContainerProps, Content, ContentProps, ContentThemeExtension, CustomCheckboxProps, CustomRadioProps, CustomSwitchProps, CustomTextAreaEvents, CustomTextFieldEvents, Dialog, DialogChildProps, DialogProps, DialogThemeExtension, Divider, DividerProps, DividerThemeExtension, Footer, FooterProps, FooterThemeExtension, Header, HeaderProps, HeaderThemeExtension, Headline, HeadlineProps, HeadlineThemeExtension, Image, ImageProps, ImageThemeExtension, Inline, InlineProps, Input, InputOwnProps, InputProps, InputThemeExtension, Label, LabelProps, LabelThemeExtension, Link, LinkOwnProps, LinkProps, LinkThemeExtension, List, ListProps, ListThemeExtension, MarigoldProvider, MarigoldProviderProps, Menu, MenuProps, MenuThemeExtension, Message, MessageProps, MessageThemeExtension, NumberField, NumberFieldProps, NumberFieldThemeExtension, Overlay, OverlayProps, Popover, PopoverProps, Radio, RadioComponent, RadioGroupProps, RadioGroupThemeExtension, RadioProps, RadioThemeExtension, Select, SelectComponent, SelectProps, SelectThemeExtension, Slider, SliderProps, SliderThemeExtension, Split, SplitProps, Stack, StackProps, Switch, SwitchProps, SwitchThemeExtension, Table, TableProps, TableThemeExtension, Text, TextArea, TextAreaProps, TextAreaThemeExtension, TextField, TextFieldProps, TextProps, TextThemeExtension, Theme, Tiles, TilesProps, Tooltip, TooltipProps, TooltipThemeExtension, Underlay, UnderlayProps, UnderlayThemeExtension, useCheckboxGroupContext };
|
package/dist/index.js
CHANGED
|
@@ -253,11 +253,23 @@ var Button = (0, import_react5.forwardRef)(
|
|
|
253
253
|
// src/Card/Card.tsx
|
|
254
254
|
var import_react6 = __toESM(require("react"));
|
|
255
255
|
var import_system4 = require("@marigold/system");
|
|
256
|
-
var Card = ({
|
|
256
|
+
var Card = ({
|
|
257
|
+
children,
|
|
258
|
+
variant,
|
|
259
|
+
size,
|
|
260
|
+
p,
|
|
261
|
+
px,
|
|
262
|
+
py,
|
|
263
|
+
pt,
|
|
264
|
+
pb,
|
|
265
|
+
pl,
|
|
266
|
+
pr,
|
|
267
|
+
...props
|
|
268
|
+
}) => {
|
|
257
269
|
const styles = (0, import_system4.useComponentStyles)("Card", { variant, size });
|
|
258
270
|
return /* @__PURE__ */ import_react6.default.createElement(import_system4.Box, {
|
|
259
271
|
...props,
|
|
260
|
-
css: styles
|
|
272
|
+
css: [styles, { p, px, py, pt, pb, pl, pr }]
|
|
261
273
|
}, children);
|
|
262
274
|
};
|
|
263
275
|
|
|
@@ -522,63 +534,62 @@ var Columns = ({
|
|
|
522
534
|
)}`
|
|
523
535
|
);
|
|
524
536
|
}
|
|
525
|
-
const getColumnWidths = columns.map((column, index) => {
|
|
526
|
-
return {
|
|
527
|
-
[`> :nth-of-type(${index + 1})`]: {
|
|
528
|
-
flexGrow: column
|
|
529
|
-
}
|
|
530
|
-
};
|
|
531
|
-
});
|
|
532
537
|
return /* @__PURE__ */ import_react11.default.createElement(import_system.Box, {
|
|
533
538
|
display: "flex",
|
|
534
|
-
css:
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
},
|
|
542
|
-
...getColumnWidths
|
|
543
|
-
),
|
|
539
|
+
css: {
|
|
540
|
+
flexWrap: "wrap",
|
|
541
|
+
gap: space,
|
|
542
|
+
"> *": {
|
|
543
|
+
flexBasis: `calc(( ${collapseAt} - 100%) * 999)`
|
|
544
|
+
}
|
|
545
|
+
},
|
|
544
546
|
...props
|
|
545
|
-
}, children)
|
|
547
|
+
}, import_react11.Children.map(children, (child, idx) => /* @__PURE__ */ import_react11.default.createElement(import_system.Box, {
|
|
548
|
+
css: {
|
|
549
|
+
flexGrow: columns[idx]
|
|
550
|
+
}
|
|
551
|
+
}, (0, import_react11.isValidElement)(child) ? (0, import_react11.cloneElement)(child) : null)));
|
|
546
552
|
};
|
|
547
553
|
|
|
548
554
|
// src/Container/Container.tsx
|
|
549
555
|
var import_react12 = __toESM(require("react"));
|
|
550
556
|
var import_tokens2 = require("@marigold/tokens");
|
|
551
|
-
var
|
|
552
|
-
left: "
|
|
557
|
+
var ALIGN_ITEMS = {
|
|
558
|
+
left: "start",
|
|
553
559
|
center: "center",
|
|
554
|
-
right: "
|
|
560
|
+
right: "end",
|
|
561
|
+
none: "undefined"
|
|
562
|
+
};
|
|
563
|
+
var ALIGN = {
|
|
564
|
+
left: (maxWidth) => ({
|
|
565
|
+
gridTemplateColumns: `minmax(0, ${maxWidth}) 1fr 1fr`,
|
|
566
|
+
gridColumn: 1
|
|
567
|
+
}),
|
|
568
|
+
center: (maxWidth) => ({
|
|
569
|
+
gridTemplateColumns: `1fr minmax(0, ${maxWidth}) 1fr`,
|
|
570
|
+
gridColumn: 2
|
|
571
|
+
}),
|
|
572
|
+
right: (maxWidth) => ({
|
|
573
|
+
gridTemplateColumns: `1fr 1fr minmax(0, ${maxWidth})`,
|
|
574
|
+
gridColumn: 3
|
|
575
|
+
})
|
|
555
576
|
};
|
|
556
577
|
var Container = ({
|
|
557
578
|
contentType = "content",
|
|
558
579
|
size = "medium",
|
|
559
580
|
align = "left",
|
|
560
|
-
|
|
581
|
+
alignItems = "none",
|
|
561
582
|
children,
|
|
562
583
|
...props
|
|
563
584
|
}) => {
|
|
564
585
|
const maxWidth = import_tokens2.size[contentType][size];
|
|
565
|
-
let gridTemplateColumns = `${maxWidth} 1fr 1fr`;
|
|
566
|
-
let gridColumn = 1;
|
|
567
|
-
if (alignContainer === "center") {
|
|
568
|
-
gridTemplateColumns = `1fr ${maxWidth} 1fr`;
|
|
569
|
-
gridColumn = 2;
|
|
570
|
-
}
|
|
571
|
-
if (alignContainer === "right") {
|
|
572
|
-
gridTemplateColumns = `1fr 1fr ${maxWidth}`;
|
|
573
|
-
gridColumn = 3;
|
|
574
|
-
}
|
|
575
586
|
return /* @__PURE__ */ import_react12.default.createElement(import_system.Box, {
|
|
576
587
|
display: "grid",
|
|
577
588
|
css: {
|
|
578
|
-
gridTemplateColumns,
|
|
579
|
-
placeItems:
|
|
589
|
+
gridTemplateColumns: ALIGN[align](maxWidth).gridTemplateColumns,
|
|
590
|
+
placeItems: ALIGN_ITEMS[alignItems],
|
|
580
591
|
"> *": {
|
|
581
|
-
gridColumn
|
|
592
|
+
gridColumn: ALIGN[align](maxWidth).gridColumn
|
|
582
593
|
}
|
|
583
594
|
},
|
|
584
595
|
...props
|
|
@@ -994,13 +1005,14 @@ var Link = (0, import_react28.forwardRef)(
|
|
|
994
1005
|
linkRef
|
|
995
1006
|
);
|
|
996
1007
|
const styles = (0, import_system18.useComponentStyles)("Link", { variant, size });
|
|
997
|
-
return /* @__PURE__ */ import_react28.default.createElement(import_system.Box, {
|
|
1008
|
+
return /* @__PURE__ */ import_react28.default.createElement(import_react28.default.Fragment, null, " ", /* @__PURE__ */ import_react28.default.createElement(import_system.Box, {
|
|
998
1009
|
as,
|
|
1010
|
+
role: "link",
|
|
999
1011
|
css: styles,
|
|
1000
1012
|
ref: linkRef,
|
|
1001
1013
|
...props,
|
|
1002
1014
|
...linkProps
|
|
1003
|
-
}, children);
|
|
1015
|
+
}, children), " ");
|
|
1004
1016
|
}
|
|
1005
1017
|
);
|
|
1006
1018
|
|
|
@@ -1790,14 +1802,14 @@ var Chevron = ({ css }) => /* @__PURE__ */ import_react49.default.createElement(
|
|
|
1790
1802
|
}));
|
|
1791
1803
|
var Select = (0, import_react49.forwardRef)(
|
|
1792
1804
|
({ variant, size, width, open, disabled, required, error, ...rest }, ref) => {
|
|
1793
|
-
const formatMessage = (0, import_i18n2.
|
|
1805
|
+
const formatMessage = (0, import_i18n2.useLocalizedStringFormatter)(messages);
|
|
1794
1806
|
const buttonRef = (0, import_utils11.useObjectRef)(ref);
|
|
1795
1807
|
const props = {
|
|
1796
1808
|
isOpen: open,
|
|
1797
1809
|
isDisabled: disabled,
|
|
1798
1810
|
isRequired: required,
|
|
1799
1811
|
validationState: error ? "invalid" : "valid",
|
|
1800
|
-
placeholder: rest.placeholder || formatMessage("placeholder"),
|
|
1812
|
+
placeholder: rest.placeholder || formatMessage.format("placeholder"),
|
|
1801
1813
|
...rest
|
|
1802
1814
|
};
|
|
1803
1815
|
const state = (0, import_select2.useSelectState)(props);
|
|
@@ -2184,7 +2196,7 @@ var import_utils15 = require("@react-aria/utils");
|
|
|
2184
2196
|
var import_system40 = require("@marigold/system");
|
|
2185
2197
|
var TableCell = ({ cell }) => {
|
|
2186
2198
|
const ref = (0, import_react57.useRef)(null);
|
|
2187
|
-
const { state, styles } = useTableContext();
|
|
2199
|
+
const { interactive, state, styles } = useTableContext();
|
|
2188
2200
|
const disabled = state.disabledKeys.has(cell.parentKey);
|
|
2189
2201
|
const { gridCellProps } = (0, import_table2.useTableCell)(
|
|
2190
2202
|
{
|
|
@@ -2193,13 +2205,18 @@ var TableCell = ({ cell }) => {
|
|
|
2193
2205
|
state,
|
|
2194
2206
|
ref
|
|
2195
2207
|
);
|
|
2208
|
+
const cellProps = interactive ? gridCellProps : {
|
|
2209
|
+
...gridCellProps,
|
|
2210
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
2211
|
+
onPointerDown: (e) => e.stopPropagation()
|
|
2212
|
+
};
|
|
2196
2213
|
const { focusProps, isFocusVisible } = (0, import_focus11.useFocusRing)();
|
|
2197
2214
|
const stateProps = (0, import_system40.useStateProps)({ disabled, focusVisible: isFocusVisible });
|
|
2198
2215
|
return /* @__PURE__ */ import_react57.default.createElement(import_system40.Box, {
|
|
2199
2216
|
as: "td",
|
|
2200
2217
|
ref,
|
|
2201
2218
|
css: styles.cell,
|
|
2202
|
-
...(0, import_utils15.mergeProps)(
|
|
2219
|
+
...(0, import_utils15.mergeProps)(cellProps, focusProps),
|
|
2203
2220
|
...stateProps
|
|
2204
2221
|
}, cell.rendered);
|
|
2205
2222
|
};
|
|
@@ -2305,6 +2322,7 @@ var TableColumnHeader = ({ column }) => {
|
|
|
2305
2322
|
as: "th",
|
|
2306
2323
|
colSpan: column.colspan,
|
|
2307
2324
|
ref,
|
|
2325
|
+
__baseCSS: { cursor: "default" },
|
|
2308
2326
|
css: styles.header,
|
|
2309
2327
|
...(0, import_utils18.mergeProps)(columnHeaderProps, hoverProps, focusProps),
|
|
2310
2328
|
...stateProps
|
|
@@ -2346,7 +2364,7 @@ var import_utils19 = require("@react-aria/utils");
|
|
|
2346
2364
|
var import_system43 = require("@marigold/system");
|
|
2347
2365
|
var TableRow = ({ children, row }) => {
|
|
2348
2366
|
const ref = (0, import_react62.useRef)(null);
|
|
2349
|
-
const { state, styles } = useTableContext();
|
|
2367
|
+
const { interactive, state, styles } = useTableContext();
|
|
2350
2368
|
const { rowProps, isPressed } = (0, import_table7.useTableRow)(
|
|
2351
2369
|
{
|
|
2352
2370
|
node: row
|
|
@@ -2357,7 +2375,9 @@ var TableRow = ({ children, row }) => {
|
|
|
2357
2375
|
const disabled = state.disabledKeys.has(row.key);
|
|
2358
2376
|
const selected = state.selectionManager.isSelected(row.key);
|
|
2359
2377
|
const { focusProps, isFocusVisible } = (0, import_focus14.useFocusRing)({ within: true });
|
|
2360
|
-
const { hoverProps, isHovered } = (0, import_interactions9.useHover)({
|
|
2378
|
+
const { hoverProps, isHovered } = (0, import_interactions9.useHover)({
|
|
2379
|
+
isDisabled: disabled || !interactive
|
|
2380
|
+
});
|
|
2361
2381
|
const stateProps = (0, import_system43.useStateProps)({
|
|
2362
2382
|
disabled,
|
|
2363
2383
|
selected,
|
|
@@ -2368,6 +2388,9 @@ var TableRow = ({ children, row }) => {
|
|
|
2368
2388
|
return /* @__PURE__ */ import_react62.default.createElement(import_system43.Box, {
|
|
2369
2389
|
as: "tr",
|
|
2370
2390
|
ref,
|
|
2391
|
+
__baseCSS: {
|
|
2392
|
+
cursor: !interactive ? "text" : disabled ? "default" : "pointer"
|
|
2393
|
+
},
|
|
2371
2394
|
css: styles.row,
|
|
2372
2395
|
...(0, import_utils19.mergeProps)(rowProps, focusProps, hoverProps),
|
|
2373
2396
|
...stateProps
|
|
@@ -2419,12 +2442,15 @@ var Table = ({
|
|
|
2419
2442
|
variant,
|
|
2420
2443
|
size,
|
|
2421
2444
|
stretch,
|
|
2445
|
+
selectionMode = "none",
|
|
2422
2446
|
...props
|
|
2423
2447
|
}) => {
|
|
2448
|
+
const interactive = selectionMode !== "none";
|
|
2424
2449
|
const tableRef = (0, import_react64.useRef)(null);
|
|
2425
2450
|
const state = (0, import_table10.useTableState)({
|
|
2426
2451
|
...props,
|
|
2427
|
-
|
|
2452
|
+
selectionMode,
|
|
2453
|
+
showSelectionCheckboxes: selectionMode === "multiple" && props.selectionBehavior !== "replace"
|
|
2428
2454
|
});
|
|
2429
2455
|
const { gridProps } = (0, import_table9.useTable)(props, state, tableRef);
|
|
2430
2456
|
const styles = (0, import_system45.useComponentStyles)(
|
|
@@ -2434,12 +2460,15 @@ var Table = ({
|
|
|
2434
2460
|
);
|
|
2435
2461
|
const { collection } = state;
|
|
2436
2462
|
return /* @__PURE__ */ import_react64.default.createElement(TableContext.Provider, {
|
|
2437
|
-
value: { state, styles }
|
|
2463
|
+
value: { state, interactive, styles }
|
|
2438
2464
|
}, /* @__PURE__ */ import_react64.default.createElement(import_system45.Box, {
|
|
2439
2465
|
as: "table",
|
|
2440
2466
|
ref: tableRef,
|
|
2441
2467
|
__baseCSS: {
|
|
2468
|
+
display: "block",
|
|
2442
2469
|
borderCollapse: "collapse",
|
|
2470
|
+
overflow: "auto",
|
|
2471
|
+
whiteSpace: "nowrap",
|
|
2443
2472
|
width: stretch ? "100%" : void 0
|
|
2444
2473
|
},
|
|
2445
2474
|
css: styles.table,
|
package/dist/index.mjs
CHANGED
|
@@ -178,11 +178,23 @@ import {
|
|
|
178
178
|
Box as Box3,
|
|
179
179
|
useComponentStyles as useComponentStyles3
|
|
180
180
|
} from "@marigold/system";
|
|
181
|
-
var Card = ({
|
|
181
|
+
var Card = ({
|
|
182
|
+
children,
|
|
183
|
+
variant,
|
|
184
|
+
size,
|
|
185
|
+
p,
|
|
186
|
+
px,
|
|
187
|
+
py,
|
|
188
|
+
pt,
|
|
189
|
+
pb,
|
|
190
|
+
pl,
|
|
191
|
+
pr,
|
|
192
|
+
...props
|
|
193
|
+
}) => {
|
|
182
194
|
const styles = useComponentStyles3("Card", { variant, size });
|
|
183
195
|
return /* @__PURE__ */ React6.createElement(Box3, {
|
|
184
196
|
...props,
|
|
185
|
-
css: styles
|
|
197
|
+
css: [styles, { p, px, py, pt, pb, pl, pr }]
|
|
186
198
|
}, children);
|
|
187
199
|
};
|
|
188
200
|
|
|
@@ -441,7 +453,11 @@ var Checkbox = forwardRef2(
|
|
|
441
453
|
);
|
|
442
454
|
|
|
443
455
|
// src/Columns/Columns.tsx
|
|
444
|
-
import React11, {
|
|
456
|
+
import React11, {
|
|
457
|
+
Children,
|
|
458
|
+
cloneElement,
|
|
459
|
+
isValidElement
|
|
460
|
+
} from "react";
|
|
445
461
|
var Columns = ({
|
|
446
462
|
space = "none",
|
|
447
463
|
columns,
|
|
@@ -456,63 +472,62 @@ var Columns = ({
|
|
|
456
472
|
)}`
|
|
457
473
|
);
|
|
458
474
|
}
|
|
459
|
-
const getColumnWidths = columns.map((column, index) => {
|
|
460
|
-
return {
|
|
461
|
-
[`> :nth-of-type(${index + 1})`]: {
|
|
462
|
-
flexGrow: column
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
});
|
|
466
475
|
return /* @__PURE__ */ React11.createElement(Box, {
|
|
467
476
|
display: "flex",
|
|
468
|
-
css:
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
},
|
|
476
|
-
...getColumnWidths
|
|
477
|
-
),
|
|
477
|
+
css: {
|
|
478
|
+
flexWrap: "wrap",
|
|
479
|
+
gap: space,
|
|
480
|
+
"> *": {
|
|
481
|
+
flexBasis: `calc(( ${collapseAt} - 100%) * 999)`
|
|
482
|
+
}
|
|
483
|
+
},
|
|
478
484
|
...props
|
|
479
|
-
}, children)
|
|
485
|
+
}, Children.map(children, (child, idx) => /* @__PURE__ */ React11.createElement(Box, {
|
|
486
|
+
css: {
|
|
487
|
+
flexGrow: columns[idx]
|
|
488
|
+
}
|
|
489
|
+
}, isValidElement(child) ? cloneElement(child) : null)));
|
|
480
490
|
};
|
|
481
491
|
|
|
482
492
|
// src/Container/Container.tsx
|
|
483
493
|
import React12 from "react";
|
|
484
494
|
import { size as tokenSize } from "@marigold/tokens";
|
|
485
|
-
var
|
|
486
|
-
left: "
|
|
495
|
+
var ALIGN_ITEMS = {
|
|
496
|
+
left: "start",
|
|
487
497
|
center: "center",
|
|
488
|
-
right: "
|
|
498
|
+
right: "end",
|
|
499
|
+
none: "undefined"
|
|
500
|
+
};
|
|
501
|
+
var ALIGN = {
|
|
502
|
+
left: (maxWidth) => ({
|
|
503
|
+
gridTemplateColumns: `minmax(0, ${maxWidth}) 1fr 1fr`,
|
|
504
|
+
gridColumn: 1
|
|
505
|
+
}),
|
|
506
|
+
center: (maxWidth) => ({
|
|
507
|
+
gridTemplateColumns: `1fr minmax(0, ${maxWidth}) 1fr`,
|
|
508
|
+
gridColumn: 2
|
|
509
|
+
}),
|
|
510
|
+
right: (maxWidth) => ({
|
|
511
|
+
gridTemplateColumns: `1fr 1fr minmax(0, ${maxWidth})`,
|
|
512
|
+
gridColumn: 3
|
|
513
|
+
})
|
|
489
514
|
};
|
|
490
515
|
var Container = ({
|
|
491
516
|
contentType = "content",
|
|
492
517
|
size = "medium",
|
|
493
518
|
align = "left",
|
|
494
|
-
|
|
519
|
+
alignItems = "none",
|
|
495
520
|
children,
|
|
496
521
|
...props
|
|
497
522
|
}) => {
|
|
498
523
|
const maxWidth = tokenSize[contentType][size];
|
|
499
|
-
let gridTemplateColumns = `${maxWidth} 1fr 1fr`;
|
|
500
|
-
let gridColumn = 1;
|
|
501
|
-
if (alignContainer === "center") {
|
|
502
|
-
gridTemplateColumns = `1fr ${maxWidth} 1fr`;
|
|
503
|
-
gridColumn = 2;
|
|
504
|
-
}
|
|
505
|
-
if (alignContainer === "right") {
|
|
506
|
-
gridTemplateColumns = `1fr 1fr ${maxWidth}`;
|
|
507
|
-
gridColumn = 3;
|
|
508
|
-
}
|
|
509
524
|
return /* @__PURE__ */ React12.createElement(Box, {
|
|
510
525
|
display: "grid",
|
|
511
526
|
css: {
|
|
512
|
-
gridTemplateColumns,
|
|
513
|
-
placeItems:
|
|
527
|
+
gridTemplateColumns: ALIGN[align](maxWidth).gridTemplateColumns,
|
|
528
|
+
placeItems: ALIGN_ITEMS[alignItems],
|
|
514
529
|
"> *": {
|
|
515
|
-
gridColumn
|
|
530
|
+
gridColumn: ALIGN[align](maxWidth).gridColumn
|
|
516
531
|
}
|
|
517
532
|
},
|
|
518
533
|
...props
|
|
@@ -941,13 +956,14 @@ var Link = forwardRef6(
|
|
|
941
956
|
linkRef
|
|
942
957
|
);
|
|
943
958
|
const styles = useComponentStyles16("Link", { variant, size });
|
|
944
|
-
return /* @__PURE__ */ React27.createElement(Box, {
|
|
959
|
+
return /* @__PURE__ */ React27.createElement(React27.Fragment, null, " ", /* @__PURE__ */ React27.createElement(Box, {
|
|
945
960
|
as,
|
|
961
|
+
role: "link",
|
|
946
962
|
css: styles,
|
|
947
963
|
ref: linkRef,
|
|
948
964
|
...props,
|
|
949
965
|
...linkProps
|
|
950
|
-
}, children);
|
|
966
|
+
}, children), " ");
|
|
951
967
|
}
|
|
952
968
|
);
|
|
953
969
|
|
|
@@ -1629,7 +1645,7 @@ import React44, {
|
|
|
1629
1645
|
} from "react";
|
|
1630
1646
|
import { useButton as useButton4 } from "@react-aria/button";
|
|
1631
1647
|
import { FocusScope as FocusScope3, useFocusRing as useFocusRing6 } from "@react-aria/focus";
|
|
1632
|
-
import {
|
|
1648
|
+
import { useLocalizedStringFormatter } from "@react-aria/i18n";
|
|
1633
1649
|
import { DismissButton as DismissButton2, useOverlayPosition as useOverlayPosition2 } from "@react-aria/overlays";
|
|
1634
1650
|
import { HiddenSelect, useSelect } from "@react-aria/select";
|
|
1635
1651
|
import { useSelectState } from "@react-stately/select";
|
|
@@ -1774,14 +1790,14 @@ var Chevron = ({ css }) => /* @__PURE__ */ React44.createElement(Box27, {
|
|
|
1774
1790
|
}));
|
|
1775
1791
|
var Select = forwardRef10(
|
|
1776
1792
|
({ variant, size, width, open, disabled, required, error, ...rest }, ref) => {
|
|
1777
|
-
const formatMessage =
|
|
1793
|
+
const formatMessage = useLocalizedStringFormatter(messages);
|
|
1778
1794
|
const buttonRef = useObjectRef8(ref);
|
|
1779
1795
|
const props = {
|
|
1780
1796
|
isOpen: open,
|
|
1781
1797
|
isDisabled: disabled,
|
|
1782
1798
|
isRequired: required,
|
|
1783
1799
|
validationState: error ? "invalid" : "valid",
|
|
1784
|
-
placeholder: rest.placeholder || formatMessage("placeholder"),
|
|
1800
|
+
placeholder: rest.placeholder || formatMessage.format("placeholder"),
|
|
1785
1801
|
...rest
|
|
1786
1802
|
};
|
|
1787
1803
|
const state = useSelectState(props);
|
|
@@ -2181,7 +2197,7 @@ import { mergeProps as mergeProps9 } from "@react-aria/utils";
|
|
|
2181
2197
|
import { Box as Box29, useStateProps as useStateProps11 } from "@marigold/system";
|
|
2182
2198
|
var TableCell = ({ cell }) => {
|
|
2183
2199
|
const ref = useRef10(null);
|
|
2184
|
-
const { state, styles } = useTableContext();
|
|
2200
|
+
const { interactive, state, styles } = useTableContext();
|
|
2185
2201
|
const disabled = state.disabledKeys.has(cell.parentKey);
|
|
2186
2202
|
const { gridCellProps } = useTableCell(
|
|
2187
2203
|
{
|
|
@@ -2190,13 +2206,18 @@ var TableCell = ({ cell }) => {
|
|
|
2190
2206
|
state,
|
|
2191
2207
|
ref
|
|
2192
2208
|
);
|
|
2209
|
+
const cellProps = interactive ? gridCellProps : {
|
|
2210
|
+
...gridCellProps,
|
|
2211
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
2212
|
+
onPointerDown: (e) => e.stopPropagation()
|
|
2213
|
+
};
|
|
2193
2214
|
const { focusProps, isFocusVisible } = useFocusRing9();
|
|
2194
2215
|
const stateProps = useStateProps11({ disabled, focusVisible: isFocusVisible });
|
|
2195
2216
|
return /* @__PURE__ */ React51.createElement(Box29, {
|
|
2196
2217
|
as: "td",
|
|
2197
2218
|
ref,
|
|
2198
2219
|
css: styles.cell,
|
|
2199
|
-
...mergeProps9(
|
|
2220
|
+
...mergeProps9(cellProps, focusProps),
|
|
2200
2221
|
...stateProps
|
|
2201
2222
|
}, cell.rendered);
|
|
2202
2223
|
};
|
|
@@ -2302,6 +2323,7 @@ var TableColumnHeader = ({ column }) => {
|
|
|
2302
2323
|
as: "th",
|
|
2303
2324
|
colSpan: column.colspan,
|
|
2304
2325
|
ref,
|
|
2326
|
+
__baseCSS: { cursor: "default" },
|
|
2305
2327
|
css: styles.header,
|
|
2306
2328
|
...mergeProps11(columnHeaderProps, hoverProps, focusProps),
|
|
2307
2329
|
...stateProps
|
|
@@ -2343,7 +2365,7 @@ import { mergeProps as mergeProps12 } from "@react-aria/utils";
|
|
|
2343
2365
|
import { Box as Box32, useStateProps as useStateProps14 } from "@marigold/system";
|
|
2344
2366
|
var TableRow = ({ children, row }) => {
|
|
2345
2367
|
const ref = useRef14(null);
|
|
2346
|
-
const { state, styles } = useTableContext();
|
|
2368
|
+
const { interactive, state, styles } = useTableContext();
|
|
2347
2369
|
const { rowProps, isPressed } = useTableRow(
|
|
2348
2370
|
{
|
|
2349
2371
|
node: row
|
|
@@ -2354,7 +2376,9 @@ var TableRow = ({ children, row }) => {
|
|
|
2354
2376
|
const disabled = state.disabledKeys.has(row.key);
|
|
2355
2377
|
const selected = state.selectionManager.isSelected(row.key);
|
|
2356
2378
|
const { focusProps, isFocusVisible } = useFocusRing12({ within: true });
|
|
2357
|
-
const { hoverProps, isHovered } = useHover7({
|
|
2379
|
+
const { hoverProps, isHovered } = useHover7({
|
|
2380
|
+
isDisabled: disabled || !interactive
|
|
2381
|
+
});
|
|
2358
2382
|
const stateProps = useStateProps14({
|
|
2359
2383
|
disabled,
|
|
2360
2384
|
selected,
|
|
@@ -2365,6 +2389,9 @@ var TableRow = ({ children, row }) => {
|
|
|
2365
2389
|
return /* @__PURE__ */ React56.createElement(Box32, {
|
|
2366
2390
|
as: "tr",
|
|
2367
2391
|
ref,
|
|
2392
|
+
__baseCSS: {
|
|
2393
|
+
cursor: !interactive ? "text" : disabled ? "default" : "pointer"
|
|
2394
|
+
},
|
|
2368
2395
|
css: styles.row,
|
|
2369
2396
|
...mergeProps12(rowProps, focusProps, hoverProps),
|
|
2370
2397
|
...stateProps
|
|
@@ -2419,12 +2446,15 @@ var Table = ({
|
|
|
2419
2446
|
variant,
|
|
2420
2447
|
size,
|
|
2421
2448
|
stretch,
|
|
2449
|
+
selectionMode = "none",
|
|
2422
2450
|
...props
|
|
2423
2451
|
}) => {
|
|
2452
|
+
const interactive = selectionMode !== "none";
|
|
2424
2453
|
const tableRef = useRef16(null);
|
|
2425
2454
|
const state = useTableState({
|
|
2426
2455
|
...props,
|
|
2427
|
-
|
|
2456
|
+
selectionMode,
|
|
2457
|
+
showSelectionCheckboxes: selectionMode === "multiple" && props.selectionBehavior !== "replace"
|
|
2428
2458
|
});
|
|
2429
2459
|
const { gridProps } = useTable(props, state, tableRef);
|
|
2430
2460
|
const styles = useComponentStyles28(
|
|
@@ -2434,12 +2464,15 @@ var Table = ({
|
|
|
2434
2464
|
);
|
|
2435
2465
|
const { collection } = state;
|
|
2436
2466
|
return /* @__PURE__ */ React58.createElement(TableContext.Provider, {
|
|
2437
|
-
value: { state, styles }
|
|
2467
|
+
value: { state, interactive, styles }
|
|
2438
2468
|
}, /* @__PURE__ */ React58.createElement(Box34, {
|
|
2439
2469
|
as: "table",
|
|
2440
2470
|
ref: tableRef,
|
|
2441
2471
|
__baseCSS: {
|
|
2472
|
+
display: "block",
|
|
2442
2473
|
borderCollapse: "collapse",
|
|
2474
|
+
overflow: "auto",
|
|
2475
|
+
whiteSpace: "nowrap",
|
|
2443
2476
|
width: stretch ? "100%" : void 0
|
|
2444
2477
|
},
|
|
2445
2478
|
css: styles.table,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marigold/components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Components for the Marigold Design System",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -23,52 +23,52 @@
|
|
|
23
23
|
"directory": "packages/components"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@marigold/icons": "1.0.
|
|
27
|
-
"@marigold/system": "2.
|
|
26
|
+
"@marigold/icons": "1.0.5",
|
|
27
|
+
"@marigold/system": "2.2.0",
|
|
28
28
|
"@marigold/tokens": "3.1.0",
|
|
29
|
-
"@marigold/types": "0.5.
|
|
30
|
-
"@react-aria/button": "3.6.
|
|
31
|
-
"@react-aria/checkbox": "3.5.
|
|
32
|
-
"@react-aria/dialog": "3.3.
|
|
29
|
+
"@marigold/types": "0.5.3",
|
|
30
|
+
"@react-aria/button": "3.6.1",
|
|
31
|
+
"@react-aria/checkbox": "3.5.1",
|
|
32
|
+
"@react-aria/dialog": "3.3.1",
|
|
33
33
|
"@react-aria/focus": "3.7.0",
|
|
34
|
-
"@react-aria/i18n": "3.
|
|
35
|
-
"@react-aria/interactions": "3.
|
|
36
|
-
"@react-aria/link": "3.3.
|
|
37
|
-
"@react-aria/listbox": "3.6.
|
|
38
|
-
"@react-aria/menu": "3.6.
|
|
39
|
-
"@react-aria/numberfield": "3.3.
|
|
40
|
-
"@react-aria/overlays": "3.10.
|
|
41
|
-
"@react-aria/radio": "3.3.
|
|
42
|
-
"@react-aria/select": "3.8.
|
|
43
|
-
"@react-aria/separator": "3.2.
|
|
44
|
-
"@react-aria/slider": "3.2.
|
|
34
|
+
"@react-aria/i18n": "3.6.0",
|
|
35
|
+
"@react-aria/interactions": "3.11.0",
|
|
36
|
+
"@react-aria/link": "3.3.3",
|
|
37
|
+
"@react-aria/listbox": "3.6.1",
|
|
38
|
+
"@react-aria/menu": "3.6.1",
|
|
39
|
+
"@react-aria/numberfield": "3.3.1",
|
|
40
|
+
"@react-aria/overlays": "3.10.1",
|
|
41
|
+
"@react-aria/radio": "3.3.1",
|
|
42
|
+
"@react-aria/select": "3.8.1",
|
|
43
|
+
"@react-aria/separator": "3.2.3",
|
|
44
|
+
"@react-aria/slider": "3.2.1",
|
|
45
45
|
"@react-aria/ssr": "3.3.0",
|
|
46
|
-
"@react-aria/switch": "3.2.
|
|
47
|
-
"@react-aria/table": "3.4.
|
|
48
|
-
"@react-aria/textfield": "3.7.
|
|
49
|
-
"@react-aria/tooltip": "3.3.
|
|
50
|
-
"@react-aria/utils": "3.13.
|
|
51
|
-
"@react-aria/visually-hidden": "3.4.
|
|
52
|
-
"@react-stately/checkbox": "3.2.
|
|
53
|
-
"@react-stately/collections": "3.4.
|
|
46
|
+
"@react-aria/switch": "3.2.3",
|
|
47
|
+
"@react-aria/table": "3.4.1",
|
|
48
|
+
"@react-aria/textfield": "3.7.1",
|
|
49
|
+
"@react-aria/tooltip": "3.3.1",
|
|
50
|
+
"@react-aria/utils": "3.13.3",
|
|
51
|
+
"@react-aria/visually-hidden": "3.4.1",
|
|
52
|
+
"@react-stately/checkbox": "3.2.1",
|
|
53
|
+
"@react-stately/collections": "3.4.3",
|
|
54
54
|
"@react-stately/data": "^3.6.0",
|
|
55
|
-
"@react-stately/list": "3.5.
|
|
56
|
-
"@react-stately/menu": "3.4.
|
|
57
|
-
"@react-stately/numberfield": "3.2.
|
|
58
|
-
"@react-stately/overlays": "3.4.
|
|
59
|
-
"@react-stately/radio": "3.5.
|
|
60
|
-
"@react-stately/select": "3.3.
|
|
61
|
-
"@react-stately/slider": "3.2.
|
|
62
|
-
"@react-stately/table": "3.
|
|
63
|
-
"@react-stately/toggle": "3.4.
|
|
64
|
-
"@react-stately/tooltip": "3.2.
|
|
65
|
-
"@react-stately/tree": "3.3.
|
|
66
|
-
"@react-types/checkbox": "3.3.
|
|
67
|
-
"@react-types/dialog": "3.4.
|
|
68
|
-
"@react-types/numberfield": "3.3.
|
|
69
|
-
"@react-types/radio": "3.2.
|
|
70
|
-
"@react-types/shared": "3.14.
|
|
71
|
-
"@react-types/tooltip": "3.2.
|
|
55
|
+
"@react-stately/list": "3.5.3",
|
|
56
|
+
"@react-stately/menu": "3.4.1",
|
|
57
|
+
"@react-stately/numberfield": "3.2.1",
|
|
58
|
+
"@react-stately/overlays": "3.4.1",
|
|
59
|
+
"@react-stately/radio": "3.5.1",
|
|
60
|
+
"@react-stately/select": "3.3.1",
|
|
61
|
+
"@react-stately/slider": "3.2.1",
|
|
62
|
+
"@react-stately/table": "3.4.0",
|
|
63
|
+
"@react-stately/toggle": "3.4.1",
|
|
64
|
+
"@react-stately/tooltip": "3.2.1",
|
|
65
|
+
"@react-stately/tree": "3.3.3",
|
|
66
|
+
"@react-types/checkbox": "3.3.3",
|
|
67
|
+
"@react-types/dialog": "3.4.3",
|
|
68
|
+
"@react-types/numberfield": "3.3.3",
|
|
69
|
+
"@react-types/radio": "3.2.3",
|
|
70
|
+
"@react-types/shared": "3.14.1",
|
|
71
|
+
"@react-types/tooltip": "3.2.3",
|
|
72
72
|
"react-is": "18.2.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@marigold/tsconfig": "0.3.0",
|
|
80
80
|
"react": "18.2.0",
|
|
81
81
|
"react-dom": "18.2.0",
|
|
82
|
-
"tsup": "6.2.
|
|
82
|
+
"tsup": "6.2.3"
|
|
83
83
|
},
|
|
84
84
|
"scripts": {
|
|
85
85
|
"build": "tsup src/index.ts",
|