reshaped 3.7.4 → 3.8.0-canary.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/CHANGELOG-extra.md +3 -0
- package/CHANGELOG.md +40 -55
- package/LICENSE.md +1 -1
- package/README.md +24 -0
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +10 -10
- package/dist/cjs/themes/index.d.ts +1 -0
- package/dist/cjs/themes/index.js +3 -1
- package/dist/components/Accordion/Accordion.types.d.ts +13 -2
- package/dist/components/ActionBar/ActionBar.types.d.ts +10 -0
- package/dist/components/Actionable/Actionable.types.d.ts +14 -0
- package/dist/components/Alert/Alert.types.d.ts +11 -0
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +7 -0
- package/dist/components/Avatar/Avatar.types.d.ts +18 -0
- package/dist/components/Avatar/tests/Avatar.stories.js +1 -1
- package/dist/components/Badge/Badge.types.d.ts +25 -1
- package/dist/components/Badge/tests/Badge.test.stories.js +3 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -0
- package/dist/components/Button/Button.types.d.ts +20 -0
- package/dist/components/Calendar/Calendar.types.d.ts +31 -0
- package/dist/components/Calendar/tests/Calendar.stories.js +1 -1
- package/dist/components/Card/Card.types.d.ts +12 -0
- package/dist/components/Carousel/Carousel.types.d.ts +13 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts +19 -0
- package/dist/components/Checkbox/tests/Checkbox.stories.js +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.types.d.ts +10 -0
- package/dist/components/Container/Container.types.d.ts +11 -1
- package/dist/components/Dismissible/Dismissible.types.d.ts +10 -0
- package/dist/components/Divider/Divider.types.d.ts +6 -0
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +3 -0
- package/dist/components/FileUpload/FileUpload.types.d.ts +10 -0
- package/dist/components/Flyout/Flyout.types.d.ts +38 -0
- package/dist/components/Flyout/FlyoutContent.js +1 -1
- package/dist/components/FormControl/FormControl.types.d.ts +9 -0
- package/dist/components/Grid/Grid.js +3 -1
- package/dist/components/Grid/Grid.module.css +1 -1
- package/dist/components/Grid/Grid.types.d.ts +31 -0
- package/dist/components/Grid/tests/Grid.stories.d.ts +3 -0
- package/dist/components/Grid/tests/Grid.stories.js +39 -1
- package/dist/components/Hidden/Hidden.types.d.ts +4 -0
- package/dist/components/HiddenVisually/HiddenVisually.types.d.ts +1 -0
- package/dist/components/Hotkey/Hotkey.types.d.ts +4 -0
- package/dist/components/Icon/Icon.types.d.ts +6 -0
- package/dist/components/Image/Image.types.d.ts +15 -0
- package/dist/components/Link/Link.types.d.ts +7 -0
- package/dist/components/Loader/Loader.types.d.ts +5 -0
- package/dist/components/MenuItem/MenuItem.types.d.ts +13 -1
- package/dist/components/Modal/Modal.types.d.ts +19 -0
- package/dist/components/NumberField/NumberField.types.d.ts +10 -0
- package/dist/components/Overlay/Overlay.types.d.ts +13 -0
- package/dist/components/Pagination/Pagination.types.d.ts +11 -29
- package/dist/components/PinField/PinField.types.d.ts +13 -0
- package/dist/components/Popover/Popover.types.d.ts +3 -0
- package/dist/components/Progress/Progress.types.d.ts +9 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.js +13 -84
- package/dist/components/ProgressIndicator/ProgressIndicator.module.css +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.types.d.ts +8 -0
- package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.js +8 -1
- package/dist/components/Radio/Radio.types.d.ts +12 -0
- package/dist/components/RadioGroup/RadioGroup.types.d.ts +14 -0
- package/dist/components/Reshaped/Reshaped.types.d.ts +12 -0
- package/dist/components/Resizable/Resizable.types.d.ts +7 -0
- package/dist/components/Scrim/Scrim.types.d.ts +6 -1
- package/dist/components/ScrollArea/ScrollArea.types.d.ts +7 -0
- package/dist/components/Select/Select.types.d.ts +27 -0
- package/dist/components/Skeleton/Skeleton.types.d.ts +2 -0
- package/dist/components/Slider/Slider.types.d.ts +56 -0
- package/dist/components/Stepper/Stepper.types.d.ts +13 -0
- package/dist/components/Switch/Switch.types.d.ts +16 -0
- package/dist/components/Table/Table.types.d.ts +29 -0
- package/dist/components/Tabs/Tabs.module.css +1 -1
- package/dist/components/Tabs/Tabs.types.d.ts +24 -0
- package/dist/components/Tabs/TabsItem.js +2 -2
- package/dist/components/Tabs/tests/Tabs.stories.js +6 -6
- package/dist/components/Text/Text.types.d.ts +12 -0
- package/dist/components/TextArea/TextArea.types.d.ts +17 -0
- package/dist/components/TextField/TextField.types.d.ts +29 -0
- package/dist/components/Theme/Theme.js +4 -1
- package/dist/components/Theme/Theme.types.d.ts +5 -0
- package/dist/components/Timeline/Timeline.types.d.ts +7 -0
- package/dist/components/Toast/Toast.types.d.ts +18 -0
- package/dist/components/ToggleButton/ToggleButton.types.d.ts +9 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.types.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +5 -0
- package/dist/components/View/View.types.d.ts +56 -1
- package/dist/components/_private/Aligner/Aligner.types.d.ts +6 -0
- package/dist/themes/index.d.ts +1 -0
- package/dist/themes/index.js +1 -0
- package/package.json +21 -17
- package/LICENSE-SOURCE.md +0 -40
- package/dist/components/Grid/tests/Grid.test.stories.d.ts +0 -23
- package/dist/components/Grid/tests/Grid.test.stories.js +0 -42
@@ -1,20 +1,30 @@
|
|
1
1
|
import type React from "react";
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
type WithClose = {
|
4
|
+
/** Hide the close button */
|
4
5
|
hideCloseButton: true;
|
6
|
+
/** aria-label attribute for the close button */
|
5
7
|
closeAriaLabel?: string;
|
6
8
|
};
|
7
9
|
type WithoutClose = {
|
10
|
+
/** Show the close button */
|
8
11
|
hideCloseButton?: false;
|
12
|
+
/** aria-label attribute for the close button */
|
9
13
|
closeAriaLabel: string;
|
10
14
|
};
|
11
15
|
export type CloseProps = WithClose | WithoutClose;
|
12
16
|
export type Props = CloseProps & {
|
17
|
+
/** Component render variant */
|
13
18
|
variant?: "media";
|
19
|
+
/** Close button alignment */
|
14
20
|
align?: "top" | "center";
|
21
|
+
/** Node for inserting children */
|
15
22
|
children?: React.ReactNode;
|
23
|
+
/** Callback when the component is dismissed */
|
16
24
|
onClose?: () => void;
|
25
|
+
/** Additional classname for the root element */
|
17
26
|
className?: G.ClassName;
|
27
|
+
/** Additional attributes for the root element */
|
18
28
|
attributes?: G.Attributes<"div">;
|
19
29
|
};
|
20
30
|
export {};
|
@@ -1,10 +1,16 @@
|
|
1
1
|
import type React from "react";
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
export type Props = {
|
4
|
+
/** Change component to take no space, useful for using it as a border in components like Tabs */
|
4
5
|
blank?: boolean;
|
6
|
+
/** Change component to render vertically */
|
5
7
|
vertical?: G.Responsive<boolean>;
|
8
|
+
/** Position for rendering children */
|
6
9
|
contentPosition?: "start" | "center" | "end";
|
10
|
+
/** Node for inserting text labels or custom components as a part of divider */
|
7
11
|
children?: React.ReactNode;
|
12
|
+
/** Additional classname for the root element */
|
8
13
|
className?: G.ClassName;
|
14
|
+
/** Additional attributes for the root element */
|
9
15
|
attributes?: G.Attributes<"hr">;
|
10
16
|
};
|
@@ -4,14 +4,17 @@ import type { MenuItemProps } from "../MenuItem";
|
|
4
4
|
import type { FlyoutContentProps } from "../Flyout";
|
5
5
|
export type Instance = PopoverInstance;
|
6
6
|
export type Props = Pick<PopoverProps, "children" | "position" | "forcePosition" | "fallbackPositions" | "triggerType" | "contentGap" | "contentShift" | "onOpen" | "onClose" | "active" | "defaultActive" | "width" | "disableHideAnimation" | "disableCloseOnOutsideClick" | "instanceRef" | "containerRef" | "originCoordinates"> & {
|
7
|
+
/** Change component trap focus keyboard behavior and shortcuts */
|
7
8
|
trapFocusMode?: Extract<PopoverProps["trapFocusMode"], "action-menu" | "selection-menu"> | false;
|
8
9
|
};
|
9
10
|
export type ContentProps = Pick<FlyoutContentProps, "attributes" | "children" | "className">;
|
10
11
|
export type ItemProps = Omit<MenuItemProps, "roundedCorners">;
|
11
12
|
export type SectionProps = {
|
13
|
+
/** Node for inserting children */
|
12
14
|
children: React.ReactNode;
|
13
15
|
};
|
14
16
|
export type SubMenuProps = {
|
17
|
+
/** Node for inserting children */
|
15
18
|
children: React.ReactNode;
|
16
19
|
};
|
17
20
|
export type SubTriggerProps = Omit<MenuItemProps, "endSlot" | "roundedCorners">;
|
@@ -2,18 +2,28 @@ import type React from "react";
|
|
2
2
|
import type { ViewProps } from "../View";
|
3
3
|
import type * as G from "../../types/global";
|
4
4
|
export type Props = {
|
5
|
+
/** Name of the input element */
|
5
6
|
name: string;
|
7
|
+
/** Node for inserting children, can be a render function that receives component state */
|
6
8
|
children?: React.ReactNode | ((props: {
|
7
9
|
highlighted?: boolean;
|
8
10
|
}) => React.ReactNode);
|
11
|
+
/** Callback when the component value is changed */
|
9
12
|
onChange?: G.ChangeHandler<File[], React.DragEvent<HTMLDivElement> | React.ChangeEvent<HTMLInputElement>>;
|
13
|
+
/** Component height, literal css value or unit token multiplier */
|
10
14
|
height?: ViewProps["height"];
|
15
|
+
/** Component variant, headless variant is useful for rendering custom triggers like a Button */
|
11
16
|
variant?: "outline" | "headless";
|
17
|
+
/** Change component to render inline making it more compact */
|
12
18
|
inline?: boolean;
|
19
|
+
/** Additional classname for the root element */
|
13
20
|
className?: G.ClassName;
|
21
|
+
/** Additional attributes for the root element */
|
14
22
|
attributes?: G.Attributes<"div">;
|
23
|
+
/** Additional attributes for the input element */
|
15
24
|
inputAttributes?: G.Attributes<"input">;
|
16
25
|
};
|
17
26
|
export type TriggerProps = {
|
27
|
+
/** Node for inserting children */
|
18
28
|
children: React.ReactNode;
|
19
29
|
};
|
@@ -50,16 +50,23 @@ export type UseFlyoutData = Pick<State, "styles" | "position" | "status"> & {
|
|
50
50
|
* Component
|
51
51
|
*/
|
52
52
|
export type Instance = {
|
53
|
+
/** Open the flyout content */
|
53
54
|
open: () => void;
|
55
|
+
/** Close the flyout content */
|
54
56
|
close: () => void;
|
57
|
+
/** Sync the flyout content position with the trigger element position */
|
55
58
|
updatePosition: () => void;
|
56
59
|
} | null;
|
57
60
|
type WithUncontrolled = {
|
61
|
+
/** Control the content visibility, enables controlled mode */
|
58
62
|
active?: never;
|
63
|
+
/** Control the content default visibility, enables uncontrolled mode */
|
59
64
|
defaultActive?: boolean;
|
60
65
|
};
|
61
66
|
type WithControlled = {
|
67
|
+
/** Control the content visibility, enables controlled mode */
|
62
68
|
active: boolean;
|
69
|
+
/** Control the content default visibility, enables uncontrolled mode */
|
63
70
|
defaultActive?: never;
|
64
71
|
};
|
65
72
|
export type TriggerAttributes = {
|
@@ -78,34 +85,61 @@ export type TriggerAttributes = {
|
|
78
85
|
"aria-controls"?: string;
|
79
86
|
};
|
80
87
|
type BaseProps = {
|
88
|
+
/** Unique id for the flyout content and trigger */
|
81
89
|
id?: string;
|
90
|
+
/** Event used for displaying the content */
|
82
91
|
triggerType?: "hover" | "click" | "focus";
|
92
|
+
/** Removes the content display delay if another flyout is already active */
|
83
93
|
groupTimeouts?: boolean;
|
94
|
+
/** Content position relative to the trigger element */
|
84
95
|
position?: Position;
|
85
96
|
/**
|
86
97
|
* @deprecated Use fallbackPosition={false} instead, will be removed in v4
|
87
98
|
*/
|
88
99
|
forcePosition?: boolean;
|
100
|
+
/** Fallback positions for the content when it doesn't fit into the viewport or container */
|
89
101
|
fallbackPositions?: Position[] | false;
|
102
|
+
/** Change component trap focus keyboard behavior and shortcuts */
|
90
103
|
trapFocusMode?: TrapMode | false;
|
104
|
+
/** Disable the flyout content interactivity */
|
91
105
|
disabled?: boolean;
|
106
|
+
/** Disable the flyout content hide animation */
|
92
107
|
disableHideAnimation?: boolean;
|
108
|
+
/** Ignore the content hover events and hide it if the triggerType is hover */
|
93
109
|
disableContentHover?: boolean;
|
110
|
+
/** Disable the flyout content close on outside click */
|
94
111
|
disableCloseOnOutsideClick?: boolean;
|
112
|
+
/** Automatically focus the first focusable element in the content, when false the content container will be focused instead
|
113
|
+
* @default true
|
114
|
+
*/
|
95
115
|
autoFocus?: boolean;
|
116
|
+
/** Origin coordinates for the content when there is no trigger element */
|
96
117
|
originCoordinates?: G.Coordinates;
|
118
|
+
/** Node for inserting children */
|
97
119
|
children?: React.ReactNode;
|
120
|
+
/** Callback when the content is opened */
|
98
121
|
onOpen?: () => void;
|
122
|
+
/** Callback when the content is closed */
|
99
123
|
onClose?: (args: {
|
100
124
|
reason?: CloseReason;
|
101
125
|
}) => void;
|
126
|
+
/** Content width, literal css value or unit token multiplier */
|
102
127
|
width?: Width;
|
128
|
+
/** Gap between the content and the trigger element */
|
103
129
|
contentGap?: number;
|
130
|
+
/** Shift the content on the secondary axis, relative to its original position */
|
104
131
|
contentShift?: number;
|
132
|
+
/** Additional classname for the content element */
|
105
133
|
contentClassName?: string;
|
134
|
+
/** Additional attributes for the content element */
|
106
135
|
contentAttributes?: G.Attributes<"div">;
|
136
|
+
/** Ref accessor for the flyout methods */
|
107
137
|
instanceRef?: React.Ref<Instance>;
|
138
|
+
/** Container to render the content in using a portal, position is calculated based on the container bounds
|
139
|
+
* @default document.body
|
140
|
+
*/
|
108
141
|
containerRef?: React.RefObject<HTMLElement | null>;
|
142
|
+
/** Element to focus when the content is opened */
|
109
143
|
initialFocusRef?: React.RefObject<HTMLElement | null>;
|
110
144
|
};
|
111
145
|
export type DefaultProps = Required<{
|
@@ -116,11 +150,15 @@ export type UncontrolledProps = BaseProps & WithUncontrolled;
|
|
116
150
|
export type ControlledProps = BaseProps & WithControlled;
|
117
151
|
export type Props = ControlledProps | UncontrolledProps;
|
118
152
|
export type TriggerProps = {
|
153
|
+
/** Node for inserting children, provides attributes for the trigger element */
|
119
154
|
children: (attributes: TriggerAttributes) => React.ReactNode;
|
120
155
|
};
|
121
156
|
export type ContentProps = {
|
157
|
+
/** Node for inserting children */
|
122
158
|
children?: React.ReactNode;
|
159
|
+
/** Additional classname for the content element */
|
123
160
|
className?: G.ClassName;
|
161
|
+
/** Additional attributes for the content element */
|
124
162
|
attributes?: G.Attributes<"div">;
|
125
163
|
};
|
126
164
|
export type ContextProps = {
|
@@ -94,7 +94,7 @@ const FlyoutContent = (props) => {
|
|
94
94
|
const content = (_jsx(ContentProvider, { value: { elRef: flyoutElRef }, children: _jsx("div", { className: rootClassNames, style: {
|
95
95
|
...styles,
|
96
96
|
"--rs-flyout-gap": contentGap,
|
97
|
-
}, ref: flyoutElRef, onTransitionEnd: handleTransitionEnd, onMouseEnter: triggerType === "hover" ? handleMouseEnter : undefined, onMouseLeave: triggerType === "hover" ? handleMouseLeave : undefined, onMouseDown: handleContentMouseDown, onTouchStart: handleContentMouseDown, onMouseUp: handleContentMouseUp, onTouchEnd: handleContentMouseUp, children: _jsx("div", { role: role, ...attributes, id: id, tabIndex: !autoFocus ? -1 : undefined, "aria-modal": role === "dialog" ? true : undefined, style: contentAttributes?.style, className: innerClassNames, children: children }) }) }));
|
97
|
+
}, ref: flyoutElRef, onTransitionEnd: handleTransitionEnd, onMouseEnter: triggerType === "hover" ? handleMouseEnter : undefined, onMouseLeave: triggerType === "hover" ? handleMouseLeave : undefined, onMouseDown: handleContentMouseDown, onTouchStart: handleContentMouseDown, onMouseUp: handleContentMouseUp, onTouchEnd: handleContentMouseUp, children: _jsx("div", { role: role, ...attributes, id: id, tabIndex: !autoFocus ? -1 : undefined, "aria-modal": role === "dialog" ? true : undefined, style: { ...attributes?.style, ...contentAttributes?.style }, className: innerClassNames, children: children }) }) }));
|
98
98
|
return _jsx(Portal, { targetRef: containerRef, children: content });
|
99
99
|
};
|
100
100
|
FlyoutContent.displayName = "Flyout.Content";
|
@@ -1,17 +1,26 @@
|
|
1
1
|
import type React from "react";
|
2
2
|
export type Props = {
|
3
|
+
/** Node for inserting children */
|
3
4
|
children: React.ReactNode;
|
5
|
+
/** Component size, to be used together with the other form component sizes */
|
4
6
|
size?: "medium" | "large";
|
7
|
+
/** Change component to show an error state and display FormControl.Error */
|
5
8
|
hasError?: boolean;
|
9
|
+
/** Change component to show a required indicator */
|
6
10
|
required?: boolean;
|
11
|
+
/** Apply disabled styles */
|
7
12
|
disabled?: boolean;
|
13
|
+
/** Apply semantic html markup when used for displaying multiple form fields together with a single label */
|
8
14
|
group?: boolean;
|
15
|
+
/** Custom id for the form control */
|
9
16
|
id?: string;
|
10
17
|
};
|
11
18
|
export type LabelProps = {
|
19
|
+
/** Node for inserting the label text */
|
12
20
|
children: React.ReactNode;
|
13
21
|
};
|
14
22
|
export type CaptionProps = {
|
23
|
+
/** Node for inserting the caption text */
|
15
24
|
children: React.ReactNode;
|
16
25
|
};
|
17
26
|
export type PrivateCaptionProps = CaptionProps & {
|
@@ -24,7 +24,7 @@ const GridItem = (props) => {
|
|
24
24
|
return (_jsx(TagName, { ...attributes, className: itemClassNames, style: rootVariables, children: children }));
|
25
25
|
};
|
26
26
|
const Grid = (props) => {
|
27
|
-
const { areas, columns, rows, gap, align, justify, autoColumns, autoRows, autoFlow, children, className, width, height, maxWidth,
|
27
|
+
const { areas, columns, rows, gap, columnGap, rowGap, align, justify, autoColumns, autoRows, autoFlow, children, className, width, height, maxWidth,
|
28
28
|
// Using any here to let TS save on type resolving, otherwise TS throws an error due to the type complexity
|
29
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
30
30
|
as: TagName = "div", attributes, } = props;
|
@@ -39,6 +39,8 @@ const Grid = (props) => {
|
|
39
39
|
const rootVariables = {
|
40
40
|
...attributes?.style,
|
41
41
|
...responsiveVariables("--rs-grid-gap", gap),
|
42
|
+
...responsiveVariables("--rs-grid-column-gap", columnGap),
|
43
|
+
...responsiveVariables("--rs-grid-row-gap", rowGap),
|
42
44
|
...responsiveVariables("--rs-grid-rows", resolvedRows),
|
43
45
|
...responsiveVariables("--rs-grid-columns", resolvedColumns),
|
44
46
|
...responsiveVariables("--rs-grid-areas", resolvedAreas),
|
@@ -1 +1 @@
|
|
1
|
-
.root{display:grid}.root[style*="--rs-grid-gap"]{--rs-grid-gap-value:calc(var(--rs-grid-gap) * var(--rs-unit-x1));gap:var(--rs-grid-gap-value);--rs-grid-gap-s:0;--rs-grid-gap-m:var(--rs-grid-gap-s);--rs-grid-gap-l:var(--rs-grid-gap-m);--rs-grid-gap-xl:var(--rs-grid-gap-l);--rs-grid-gap:var(--rs-grid-gap-s)}.root[style*="--rs-grid-rows"]{grid-template-rows:var(--rs-grid-rows);--rs-grid-rows-s: ;--rs-grid-rows-m:var(--rs-grid-rows-s);--rs-grid-rows-l:var(--rs-grid-rows-m);--rs-grid-rows-xl:var(--rs-grid-rows-l);--rs-grid-rows:var(--rs-grid-rows-s)}.root[style*="--rs-grid-columns"]{grid-template-columns:var(--rs-grid-columns);--rs-grid-columns-s: ;--rs-grid-columns-m:var(--rs-grid-columns-s);--rs-grid-columns-l:var(--rs-grid-columns-m);--rs-grid-columns-xl:var(--rs-grid-columns-l);--rs-grid-columns:var(--rs-grid-columns-s)}.root[style*="--rs-grid-areas"]{grid-template-areas:var(--rs-grid-areas);--rs-grid-areas-s: ;--rs-grid-areas-m:var(--rs-grid-areas-s);--rs-grid-areas-l:var(--rs-grid-areas-m);--rs-grid-areas-xl:var(--rs-grid-areas-l);--rs-grid-areas:var(--rs-grid-areas-s)}.root[style*="--rs-grid-auto-flow"]{grid-auto-flow:var(--rs-grid-auto-flow);--rs-grid-auto-flow-s: ;--rs-grid-auto-flow-m:var(--rs-grid-auto-flow-s);--rs-grid-auto-flow-l:var(--rs-grid-auto-flow-m);--rs-grid-auto-flow-xl:var(--rs-grid-auto-flow-l);--rs-grid-auto-flow:var(--rs-grid-auto-flow-s)}.root[style*="--rs-grid-auto-columns"]{grid-auto-columns:var(--rs-grid-auto-columns);--rs-grid-auto-columns-s: ;--rs-grid-auto-columns-m:var(--rs-grid-auto-columns-s);--rs-grid-auto-columns-l:var(--rs-grid-auto-columns-m);--rs-grid-auto-columns-xl:var(--rs-grid-auto-columns-l);--rs-grid-auto-columns:var(--rs-grid-auto-columns-s)}.root[style*="--rs-grid-auto-rows"]{grid-auto-rows:var(--rs-grid-auto-rows);--rs-grid-auto-rows-s: ;--rs-grid-auto-rows-m:var(--rs-grid-auto-rows-s);--rs-grid-auto-rows-l:var(--rs-grid-auto-rows-m);--rs-grid-auto-rows-xl:var(--rs-grid-auto-rows-l);--rs-grid-auto-rows:var(--rs-grid-auto-rows-s)}.item[style*="--rs-grid-area"]{grid-area:var(--rs-grid-area);--rs-grid-area-s: ;--rs-grid-area-m:var(--rs-grid-area-s);--rs-grid-area-l:var(--rs-grid-area-m);--rs-grid-area-xl:var(--rs-grid-area-l);--rs-grid-area:var(--rs-grid-area-s)}.item[style*="--rs-grid-col-start"]{grid-column-start:var(--rs-grid-col-start);--rs-grid-col-start-s: ;--rs-grid-col-start-m:var(--rs-grid-col-start-s);--rs-grid-col-start-l:var(--rs-grid-col-start-m);--rs-grid-col-start-xl:var(--rs-grid-col-start-l);--rs-grid-col-start:var(--rs-grid-col-start-s)}.item[style*="--rs-grid-col-end"]{grid-column-end:var(--rs-grid-col-end);--rs-grid-col-end-s: ;--rs-grid-col-end-m:var(--rs-grid-col-end-s);--rs-grid-col-end-l:var(--rs-grid-col-end-m);--rs-grid-col-end-xl:var(--rs-grid-col-end-l);--rs-grid-col-end:var(--rs-grid-col-end-s)}.item[style*="--rs-grid-row-start"]{grid-row-start:var(--rs-grid-row-start);--rs-grid-row-start-s: ;--rs-grid-row-start-m:var(--rs-grid-row-start-s);--rs-grid-row-start-l:var(--rs-grid-row-start-m);--rs-grid-row-start-xl:var(--rs-grid-row-start-l);--rs-grid-row-start:var(--rs-grid-row-start-s)}.item[style*="--rs-grid-row-end"]{grid-row-end:var(--rs-grid-row-end);--rs-grid-row-end-s: ;--rs-grid-row-end-m:var(--rs-grid-row-end-s);--rs-grid-row-end-l:var(--rs-grid-row-end-m);--rs-grid-row-end-xl:var(--rs-grid-row-end-l);--rs-grid-row-end:var(--rs-grid-row-end-s)}@media (--rs-viewport-m ){.root[style*="--rs-grid-gap"]{--rs-grid-gap:var(--rs-grid-gap-m)}.root[style*="--rs-grid-rows"]{--rs-grid-rows:var(--rs-grid-rows-m)}.root[style*="--rs-grid-columns"]{--rs-grid-columns:var(--rs-grid-columns-m)}.root[style*="--rs-grid-areas"]{--rs-grid-areas:var(--rs-grid-areas-m)}.root[style*="--rs-grid-auto-flow"]{--rs-grid-auto-flow:var(--rs-grid-auto-flow-m)}.root[style*="--rs-grid-auto-columns"]{--rs-grid-auto-columns:var(--rs-grid-auto-columns-m)}.root[style*="--rs-grid-auto-rows"]{--rs-grid-auto-rows:var(--rs-grid-auto-rows-m)}.item[style*="--rs-grid-area"]{--rs-grid-area:var(--rs-grid-area-m)}.item[style*="--rs-grid-col-start"]{--rs-grid-col-start:var(--rs-grid-col-start-m)}.item[style*="--rs-grid-col-end"]{--rs-grid-col-end:var(--rs-grid-col-end-m)}.item[style*="--rs-grid-row-start"]{--rs-grid-row-start:var(--rs-grid-row-start-m)}.item[style*="--rs-grid-row-end"]{--rs-grid-row-end:var(--rs-grid-row-end-m)}}@media (--rs-viewport-l ){.root[style*="--rs-grid-gap"]{--rs-grid-gap:var(--rs-grid-gap-l)}.root[style*="--rs-grid-rows"]{--rs-grid-rows:var(--rs-grid-rows-l)}.root[style*="--rs-grid-columns"]{--rs-grid-columns:var(--rs-grid-columns-l)}.root[style*="--rs-grid-areas"]{--rs-grid-areas:var(--rs-grid-areas-l)}.root[style*="--rs-grid-auto-flow"]{--rs-grid-auto-flow:var(--rs-grid-auto-flow-l)}.root[style*="--rs-grid-auto-columns"]{--rs-grid-auto-columns:var(--rs-grid-auto-columns-l)}.root[style*="--rs-grid-auto-rows"]{--rs-grid-auto-rows:var(--rs-grid-auto-rows-l)}.item[style*="--rs-grid-area"]{--rs-grid-area:var(--rs-grid-area-l)}.item[style*="--rs-grid-col-start"]{--rs-grid-col-start:var(--rs-grid-col-start-l)}.item[style*="--rs-grid-col-end"]{--rs-grid-col-end:var(--rs-grid-col-end-l)}.item[style*="--rs-grid-row-start"]{--rs-grid-row-start:var(--rs-grid-row-start-l)}.item[style*="--rs-grid-row-end"]{--rs-grid-row-end:var(--rs-grid-row-end-l)}}@media (--rs-viewport-xl ){.root[style*="--rs-grid-gap"]{--rs-grid-gap:var(--rs-grid-gap-xl)}.root[style*="--rs-grid-rows"]{--rs-grid-rows:var(--rs-grid-rows-xl)}.root[style*="--rs-grid-columns"]{--rs-grid-columns:var(--rs-grid-columns-xl)}.root[style*="--rs-grid-areas"]{--rs-grid-areas:var(--rs-grid-areas-xl)}.root[style*="--rs-grid-auto-flow"]{--rs-grid-auto-flow:var(--rs-grid-auto-flow-xl)}.root[style*="--rs-grid-auto-columns"]{--rs-grid-auto-columns:var(--rs-grid-auto-columns-xl)}.root[style*="--rs-grid-auto-rows"]{--rs-grid-auto-rows:var(--rs-grid-auto-rows-xl)}.item[style*="--rs-grid-area"]{--rs-grid-area:var(--rs-grid-area-xl)}.item[style*="--rs-grid-col-start"]{--rs-grid-col-start:var(--rs-grid-col-start-xl)}.item[style*="--rs-grid-col-end"]{--rs-grid-col-end:var(--rs-grid-col-end-xl)}.item[style*="--rs-grid-row-start"]{--rs-grid-row-start:var(--rs-grid-row-start-xl)}.item[style*="--rs-grid-row-end"]{--rs-grid-row-end:var(--rs-grid-row-end-xl)}}
|
1
|
+
.root{display:grid}.root[style*="--rs-grid-gap"]{--rs-grid-gap-value:calc(var(--rs-grid-gap) * var(--rs-unit-x1));gap:var(--rs-grid-gap-value);--rs-grid-gap-s:0;--rs-grid-gap-m:var(--rs-grid-gap-s);--rs-grid-gap-l:var(--rs-grid-gap-m);--rs-grid-gap-xl:var(--rs-grid-gap-l);--rs-grid-gap:var(--rs-grid-gap-s)}.root[style*="--rs-grid-column-gap"]{--rs-grid-column-gap-value:calc(var(--rs-grid-column-gap) * var(--rs-unit-x1));column-gap:var(--rs-grid-column-gap-value);--rs-grid-column-gap-s:0;--rs-grid-column-gap-m:var(--rs-grid-column-gap-s);--rs-grid-column-gap-l:var(--rs-grid-column-gap-m);--rs-grid-column-gap-xl:var(--rs-grid-column-gap-l);--rs-grid-column-gap:var(--rs-grid-column-gap-s)}.root[style*="--rs-grid-row-gap"]{--rs-grid-row-gap-value:calc(var(--rs-grid-row-gap) * var(--rs-unit-x1));row-gap:var(--rs-grid-row-gap-value);--rs-grid-row-gap-s:0;--rs-grid-row-gap-m:var(--rs-grid-row-gap-s);--rs-grid-row-gap-l:var(--rs-grid-row-gap-m);--rs-grid-row-gap-xl:var(--rs-grid-row-gap-l);--rs-grid-row-gap:var(--rs-grid-row-gap-s)}.root[style*="--rs-grid-rows"]{grid-template-rows:var(--rs-grid-rows);--rs-grid-rows-s: ;--rs-grid-rows-m:var(--rs-grid-rows-s);--rs-grid-rows-l:var(--rs-grid-rows-m);--rs-grid-rows-xl:var(--rs-grid-rows-l);--rs-grid-rows:var(--rs-grid-rows-s)}.root[style*="--rs-grid-columns"]{grid-template-columns:var(--rs-grid-columns);--rs-grid-columns-s: ;--rs-grid-columns-m:var(--rs-grid-columns-s);--rs-grid-columns-l:var(--rs-grid-columns-m);--rs-grid-columns-xl:var(--rs-grid-columns-l);--rs-grid-columns:var(--rs-grid-columns-s)}.root[style*="--rs-grid-areas"]{grid-template-areas:var(--rs-grid-areas);--rs-grid-areas-s: ;--rs-grid-areas-m:var(--rs-grid-areas-s);--rs-grid-areas-l:var(--rs-grid-areas-m);--rs-grid-areas-xl:var(--rs-grid-areas-l);--rs-grid-areas:var(--rs-grid-areas-s)}.root[style*="--rs-grid-auto-flow"]{grid-auto-flow:var(--rs-grid-auto-flow);--rs-grid-auto-flow-s: ;--rs-grid-auto-flow-m:var(--rs-grid-auto-flow-s);--rs-grid-auto-flow-l:var(--rs-grid-auto-flow-m);--rs-grid-auto-flow-xl:var(--rs-grid-auto-flow-l);--rs-grid-auto-flow:var(--rs-grid-auto-flow-s)}.root[style*="--rs-grid-auto-columns"]{grid-auto-columns:var(--rs-grid-auto-columns);--rs-grid-auto-columns-s: ;--rs-grid-auto-columns-m:var(--rs-grid-auto-columns-s);--rs-grid-auto-columns-l:var(--rs-grid-auto-columns-m);--rs-grid-auto-columns-xl:var(--rs-grid-auto-columns-l);--rs-grid-auto-columns:var(--rs-grid-auto-columns-s)}.root[style*="--rs-grid-auto-rows"]{grid-auto-rows:var(--rs-grid-auto-rows);--rs-grid-auto-rows-s: ;--rs-grid-auto-rows-m:var(--rs-grid-auto-rows-s);--rs-grid-auto-rows-l:var(--rs-grid-auto-rows-m);--rs-grid-auto-rows-xl:var(--rs-grid-auto-rows-l);--rs-grid-auto-rows:var(--rs-grid-auto-rows-s)}.item[style*="--rs-grid-area"]{grid-area:var(--rs-grid-area);--rs-grid-area-s: ;--rs-grid-area-m:var(--rs-grid-area-s);--rs-grid-area-l:var(--rs-grid-area-m);--rs-grid-area-xl:var(--rs-grid-area-l);--rs-grid-area:var(--rs-grid-area-s)}.item[style*="--rs-grid-col-start"]{grid-column-start:var(--rs-grid-col-start);--rs-grid-col-start-s: ;--rs-grid-col-start-m:var(--rs-grid-col-start-s);--rs-grid-col-start-l:var(--rs-grid-col-start-m);--rs-grid-col-start-xl:var(--rs-grid-col-start-l);--rs-grid-col-start:var(--rs-grid-col-start-s)}.item[style*="--rs-grid-col-end"]{grid-column-end:var(--rs-grid-col-end);--rs-grid-col-end-s: ;--rs-grid-col-end-m:var(--rs-grid-col-end-s);--rs-grid-col-end-l:var(--rs-grid-col-end-m);--rs-grid-col-end-xl:var(--rs-grid-col-end-l);--rs-grid-col-end:var(--rs-grid-col-end-s)}.item[style*="--rs-grid-row-start"]{grid-row-start:var(--rs-grid-row-start);--rs-grid-row-start-s: ;--rs-grid-row-start-m:var(--rs-grid-row-start-s);--rs-grid-row-start-l:var(--rs-grid-row-start-m);--rs-grid-row-start-xl:var(--rs-grid-row-start-l);--rs-grid-row-start:var(--rs-grid-row-start-s)}.item[style*="--rs-grid-row-end"]{grid-row-end:var(--rs-grid-row-end);--rs-grid-row-end-s: ;--rs-grid-row-end-m:var(--rs-grid-row-end-s);--rs-grid-row-end-l:var(--rs-grid-row-end-m);--rs-grid-row-end-xl:var(--rs-grid-row-end-l);--rs-grid-row-end:var(--rs-grid-row-end-s)}@media (--rs-viewport-m ){.root[style*="--rs-grid-gap"]{--rs-grid-gap:var(--rs-grid-gap-m)}.root[style*="--rs-grid-column-gap"]{--rs-grid-column-gap:var(--rs-grid-column-gap-m)}.root[style*="--rs-grid-row-gap"]{--rs-grid-row-gap:var(--rs-grid-row-gap-m)}.root[style*="--rs-grid-rows"]{--rs-grid-rows:var(--rs-grid-rows-m)}.root[style*="--rs-grid-columns"]{--rs-grid-columns:var(--rs-grid-columns-m)}.root[style*="--rs-grid-areas"]{--rs-grid-areas:var(--rs-grid-areas-m)}.root[style*="--rs-grid-auto-flow"]{--rs-grid-auto-flow:var(--rs-grid-auto-flow-m)}.root[style*="--rs-grid-auto-columns"]{--rs-grid-auto-columns:var(--rs-grid-auto-columns-m)}.root[style*="--rs-grid-auto-rows"]{--rs-grid-auto-rows:var(--rs-grid-auto-rows-m)}.item[style*="--rs-grid-area"]{--rs-grid-area:var(--rs-grid-area-m)}.item[style*="--rs-grid-col-start"]{--rs-grid-col-start:var(--rs-grid-col-start-m)}.item[style*="--rs-grid-col-end"]{--rs-grid-col-end:var(--rs-grid-col-end-m)}.item[style*="--rs-grid-row-start"]{--rs-grid-row-start:var(--rs-grid-row-start-m)}.item[style*="--rs-grid-row-end"]{--rs-grid-row-end:var(--rs-grid-row-end-m)}}@media (--rs-viewport-l ){.root[style*="--rs-grid-gap"]{--rs-grid-gap:var(--rs-grid-gap-l)}.root[style*="--rs-grid-column-gap"]{--rs-grid-column-gap:var(--rs-grid-column-gap-l)}.root[style*="--rs-grid-row-gap"]{--rs-grid-row-gap:var(--rs-grid-row-gap-l)}.root[style*="--rs-grid-rows"]{--rs-grid-rows:var(--rs-grid-rows-l)}.root[style*="--rs-grid-columns"]{--rs-grid-columns:var(--rs-grid-columns-l)}.root[style*="--rs-grid-areas"]{--rs-grid-areas:var(--rs-grid-areas-l)}.root[style*="--rs-grid-auto-flow"]{--rs-grid-auto-flow:var(--rs-grid-auto-flow-l)}.root[style*="--rs-grid-auto-columns"]{--rs-grid-auto-columns:var(--rs-grid-auto-columns-l)}.root[style*="--rs-grid-auto-rows"]{--rs-grid-auto-rows:var(--rs-grid-auto-rows-l)}.item[style*="--rs-grid-area"]{--rs-grid-area:var(--rs-grid-area-l)}.item[style*="--rs-grid-col-start"]{--rs-grid-col-start:var(--rs-grid-col-start-l)}.item[style*="--rs-grid-col-end"]{--rs-grid-col-end:var(--rs-grid-col-end-l)}.item[style*="--rs-grid-row-start"]{--rs-grid-row-start:var(--rs-grid-row-start-l)}.item[style*="--rs-grid-row-end"]{--rs-grid-row-end:var(--rs-grid-row-end-l)}}@media (--rs-viewport-xl ){.root[style*="--rs-grid-gap"]{--rs-grid-gap:var(--rs-grid-gap-xl)}.root[style*="--rs-grid-column-gap"]{--rs-grid-column-gap:var(--rs-grid-column-gap-xl)}.root[style*="--rs-grid-row-gap"]{--rs-grid-row-gap:var(--rs-grid-row-gap-xl)}.root[style*="--rs-grid-rows"]{--rs-grid-rows:var(--rs-grid-rows-xl)}.root[style*="--rs-grid-columns"]{--rs-grid-columns:var(--rs-grid-columns-xl)}.root[style*="--rs-grid-areas"]{--rs-grid-areas:var(--rs-grid-areas-xl)}.root[style*="--rs-grid-auto-flow"]{--rs-grid-auto-flow:var(--rs-grid-auto-flow-xl)}.root[style*="--rs-grid-auto-columns"]{--rs-grid-auto-columns:var(--rs-grid-auto-columns-xl)}.root[style*="--rs-grid-auto-rows"]{--rs-grid-auto-rows:var(--rs-grid-auto-rows-xl)}.item[style*="--rs-grid-area"]{--rs-grid-area:var(--rs-grid-area-xl)}.item[style*="--rs-grid-col-start"]{--rs-grid-col-start:var(--rs-grid-col-start-xl)}.item[style*="--rs-grid-col-end"]{--rs-grid-col-end:var(--rs-grid-col-end-xl)}.item[style*="--rs-grid-row-start"]{--rs-grid-row-start:var(--rs-grid-row-start-xl)}.item[style*="--rs-grid-row-end"]{--rs-grid-row-end:var(--rs-grid-row-end-xl)}}
|
@@ -3,33 +3,64 @@ import type { Property } from "csstype";
|
|
3
3
|
import type * as G from "../../types/global";
|
4
4
|
import type * as TStyles from "../../styles/types";
|
5
5
|
export type Props<TagName extends keyof React.JSX.IntrinsicElements = "div"> = {
|
6
|
+
/** Gap between grid items */
|
6
7
|
gap?: G.Responsive<number>;
|
8
|
+
/** Horizontal gap between grid items */
|
9
|
+
columnGap?: G.Responsive<number>;
|
10
|
+
/** Vertical gap between grid items */
|
11
|
+
rowGap?: G.Responsive<number>;
|
12
|
+
/** Align grid items vertically */
|
7
13
|
align?: G.Responsive<TStyles.Align>;
|
14
|
+
/** Justify grid items horizontally */
|
8
15
|
justify?: G.Responsive<TStyles.Justify>;
|
16
|
+
/** Grid template rows */
|
9
17
|
rows?: G.Responsive<number | Property.GridTemplateRows>;
|
18
|
+
/** Grid template columns */
|
10
19
|
columns?: G.Responsive<number | Property.GridTemplateColumns>;
|
20
|
+
/** Grid areas for template syntax */
|
11
21
|
areas?: G.Responsive<string[]>;
|
22
|
+
/** Grid auto flow */
|
12
23
|
autoFlow?: G.Responsive<Property.GridAutoFlow>;
|
24
|
+
/** Grid auto columns */
|
13
25
|
autoColumns?: G.Responsive<Property.GridAutoColumns>;
|
26
|
+
/** Grid auto rows */
|
14
27
|
autoRows?: G.Responsive<Property.GridAutoRows>;
|
28
|
+
/** Maximum width of the grid container, literal css value or unit token multiplier */
|
15
29
|
maxWidth?: G.Responsive<string | number>;
|
30
|
+
/** Width of the grid container, literal css value or unit token multiplier */
|
16
31
|
width?: G.Responsive<string | number>;
|
32
|
+
/** Height of the grid container, literal css value or unit token multiplier */
|
17
33
|
height?: G.Responsive<string | number>;
|
34
|
+
/** Node for inserting children */
|
18
35
|
children?: React.ReactNode;
|
36
|
+
/** Custom root element html tag */
|
19
37
|
as?: TagName;
|
38
|
+
/** Additional classname for the root element */
|
20
39
|
className?: G.ClassName;
|
40
|
+
/** Additional attributes for the root element */
|
21
41
|
attributes?: G.Attributes<TagName>;
|
22
42
|
};
|
23
43
|
export type ItemProps<TagName extends keyof React.JSX.IntrinsicElements = "div"> = {
|
44
|
+
/** Grid area for template syntax */
|
24
45
|
area?: string;
|
46
|
+
/** Starting column position */
|
25
47
|
colStart?: G.Responsive<number>;
|
48
|
+
/** Ending column position */
|
26
49
|
colEnd?: G.Responsive<number>;
|
50
|
+
/** Column span value */
|
27
51
|
colSpan?: G.Responsive<number>;
|
52
|
+
/** Starting row position */
|
28
53
|
rowStart?: G.Responsive<number>;
|
54
|
+
/** Ending row position */
|
29
55
|
rowEnd?: G.Responsive<number>;
|
56
|
+
/** Row span value */
|
30
57
|
rowSpan?: G.Responsive<number>;
|
58
|
+
/** Node for inserting children */
|
31
59
|
children?: React.ReactNode;
|
60
|
+
/** Custom item element html tag */
|
32
61
|
as?: TagName;
|
62
|
+
/** Additional classname for the item element */
|
33
63
|
className?: G.ClassName;
|
64
|
+
/** Additional attributes for the item element */
|
34
65
|
attributes?: G.Attributes<TagName>;
|
35
66
|
};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react-vite";
|
1
2
|
declare const _default: {
|
2
3
|
title: string;
|
3
4
|
component: {
|
@@ -35,3 +36,5 @@ export declare const auto: {
|
|
35
36
|
name: string;
|
36
37
|
render: () => import("react").JSX.Element;
|
37
38
|
};
|
39
|
+
export declare const as: StoryObj;
|
40
|
+
export declare const className: StoryObj;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { expect } from "storybook/test";
|
1
2
|
import { Example } from "../../../utilities/storybook/index.js";
|
2
3
|
import Grid from "../index.js";
|
3
4
|
import View from "../../View/index.js";
|
@@ -11,7 +12,7 @@ export default {
|
|
11
12
|
},
|
12
13
|
};
|
13
14
|
export const base = {
|
14
|
-
name: "gap, align, justify, maxWidth, width, height",
|
15
|
+
name: "gap, columnGap, rowGap, align, justify, maxWidth, width, height",
|
15
16
|
render: () => (<Example>
|
16
17
|
<Example.Item title="gap: 2">
|
17
18
|
<Grid gap={2} columns={2}>
|
@@ -20,6 +21,13 @@ export const base = {
|
|
20
21
|
</View>))}
|
21
22
|
</Grid>
|
22
23
|
</Example.Item>
|
24
|
+
<Example.Item title="columnGap: 2, rowGap: 4">
|
25
|
+
<Grid columnGap={2} rowGap={4} columns={2}>
|
26
|
+
{[1, 2, 3, 4].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
|
27
|
+
{i}
|
28
|
+
</View>))}
|
29
|
+
</Grid>
|
30
|
+
</Example.Item>
|
23
31
|
<Example.Item title="align: center">
|
24
32
|
<Grid gap={2} columns={2} align="center">
|
25
33
|
<View backgroundColor="neutral-faded" borderRadius="medium" padding={4}>
|
@@ -205,3 +213,33 @@ export const auto = {
|
|
205
213
|
</Example.Item>
|
206
214
|
</Example>),
|
207
215
|
};
|
216
|
+
export const as = {
|
217
|
+
name: "as",
|
218
|
+
render: () => (<Grid as="ul">
|
219
|
+
<Grid.Item as="li">Content</Grid.Item>
|
220
|
+
</Grid>),
|
221
|
+
play: ({ canvas }) => {
|
222
|
+
const ul = canvas.getByRole("list");
|
223
|
+
const li = canvas.getByRole("listitem");
|
224
|
+
expect(ul).toBeInTheDocument();
|
225
|
+
expect(li).toBeInTheDocument();
|
226
|
+
},
|
227
|
+
};
|
228
|
+
export const className = {
|
229
|
+
name: "className, attributes",
|
230
|
+
render: () => (<div data-testid="root">
|
231
|
+
<Grid className="test-class" attributes={{ id: "test-id" }}>
|
232
|
+
<Grid.Item className="test-item-class" attributes={{ id: "test-item-id" }}>
|
233
|
+
Content
|
234
|
+
</Grid.Item>
|
235
|
+
</Grid>
|
236
|
+
</div>),
|
237
|
+
play: async ({ canvas }) => {
|
238
|
+
const root = canvas.getByTestId("root").firstChild;
|
239
|
+
const item = root?.firstChild;
|
240
|
+
expect(root).toHaveAttribute("id", "test-id");
|
241
|
+
expect(root).toHaveClass("test-class");
|
242
|
+
expect(item).toHaveAttribute("id", "test-item-id");
|
243
|
+
expect(item).toHaveClass("test-item-class");
|
244
|
+
},
|
245
|
+
};
|
@@ -1,8 +1,12 @@
|
|
1
1
|
import type React from "react";
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
export type Props = {
|
4
|
+
/** Pick at which viewport sizes to hide the children*/
|
4
5
|
hide?: G.Responsive<boolean>;
|
6
|
+
/** Use visibility hidden instead of display none */
|
5
7
|
visibility?: boolean;
|
8
|
+
/** Custom root element html tag */
|
6
9
|
as?: keyof React.JSX.IntrinsicElements;
|
10
|
+
/** Node for inserting children */
|
7
11
|
children: React.ReactNode;
|
8
12
|
};
|
@@ -1,8 +1,12 @@
|
|
1
1
|
import type React from "react";
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
export type Props = {
|
4
|
+
/** Node for inserting children */
|
4
5
|
children: React.ReactNode;
|
6
|
+
/** Highlight the component, can be used to show when hotkey is pressed */
|
5
7
|
active?: boolean;
|
8
|
+
/** Additional classname for the root element */
|
6
9
|
className?: G.ClassName;
|
10
|
+
/** Additional attributes for the root element */
|
7
11
|
attributes?: G.Attributes<"span">;
|
8
12
|
};
|
@@ -1,10 +1,16 @@
|
|
1
1
|
import type React from "react";
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
export type Props = {
|
4
|
+
/** Icon svg component or node */
|
4
5
|
svg: React.ReactElement | React.ComponentType;
|
6
|
+
/** Icon size, literal css value or unit token multiplier */
|
5
7
|
size?: G.Responsive<number | string>;
|
8
|
+
/** Icon color, based on the color tokens */
|
6
9
|
color?: "neutral" | "neutral-faded" | "positive" | "critical" | "warning" | "primary" | "disabled";
|
10
|
+
/** Use the width of the svg asset instead of providing a square bounding box */
|
7
11
|
autoWidth?: boolean;
|
12
|
+
/** Additional classname for the root element */
|
8
13
|
className?: G.ClassName;
|
14
|
+
/** Additional attributes for the root element */
|
9
15
|
attributes?: G.Attributes<"span">;
|
10
16
|
};
|
@@ -2,22 +2,37 @@ import type React from "react";
|
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
import type * as TStyles from "../../styles/types";
|
4
4
|
export type Props = {
|
5
|
+
/** Image URL */
|
5
6
|
src?: string;
|
7
|
+
/** Image alt text */
|
6
8
|
alt?: string;
|
9
|
+
/** Image width, literal css value or unit token multiplier */
|
7
10
|
width?: G.Responsive<string | number>;
|
11
|
+
/** Image height, literal css value or unit token multiplier */
|
8
12
|
height?: G.Responsive<string | number>;
|
13
|
+
/** Image max width, literal css value or unit token multiplier */
|
9
14
|
maxWidth?: G.Responsive<string | number>;
|
15
|
+
/** Image aspect ratio, width / height */
|
10
16
|
aspectRatio?: G.Responsive<number>;
|
17
|
+
/** Image border radius, based on the radius tokens */
|
11
18
|
borderRadius?: Extract<TStyles.Radius, "small" | "medium" | "large">;
|
19
|
+
/** Image display mode for controlling how it fits into the provided boundaries */
|
12
20
|
displayMode?: "cover" | "contain";
|
21
|
+
/** Image on load event */
|
13
22
|
onLoad?: (e: React.SyntheticEvent) => void;
|
23
|
+
/** Image on error event */
|
14
24
|
onError?: (e: React.SyntheticEvent) => void;
|
25
|
+
/** Image fallback content if the image fails to load or was not provided */
|
15
26
|
fallback?: string | React.ReactNode | boolean;
|
27
|
+
/** Image render function, can be used for integrating with Image component in 3rd party frameworks */
|
16
28
|
renderImage?: (attributes: Omit<G.Attributes<"img">, "src" | "alt"> & {
|
17
29
|
src: string;
|
18
30
|
alt: string;
|
19
31
|
}) => React.ReactNode;
|
32
|
+
/** Additional attributes for the image element */
|
20
33
|
imageAttributes?: G.Attributes<"img">;
|
34
|
+
/** Additional classname for the root element */
|
21
35
|
className?: G.ClassName;
|
36
|
+
/** Additional attributes for the root element */
|
22
37
|
attributes?: G.Attributes<"div"> & G.Attributes<"img">;
|
23
38
|
};
|
@@ -1,7 +1,14 @@
|
|
1
1
|
import type { ActionableProps } from "../Actionable";
|
2
2
|
import type { IconProps } from "../Icon";
|
3
3
|
export type Props = Pick<ActionableProps, "attributes" | "className" | "disabled" | "children" | "href" | "onClick" | "type" | "stopPropagation"> & {
|
4
|
+
/** Icon at the start position */
|
4
5
|
icon?: IconProps["svg"];
|
6
|
+
/** Link color, based on the color tokens
|
7
|
+
* @default "primary"
|
8
|
+
*/
|
5
9
|
color?: "inherit" | "critical" | "primary" | "positive" | "warning";
|
10
|
+
/** Link render variant
|
11
|
+
* @default "underline"
|
12
|
+
*/
|
6
13
|
variant?: "plain" | "underline";
|
7
14
|
};
|
@@ -1,8 +1,13 @@
|
|
1
1
|
import type * as G from "../../types/global";
|
2
2
|
export type Props = {
|
3
|
+
/** Component size */
|
3
4
|
size?: G.Responsive<"small" | "medium" | "large">;
|
5
|
+
/** Component color, based on the color tokens */
|
4
6
|
color?: "primary" | "critical" | "positive" | "inherit";
|
7
|
+
/** aria-label attribute for the root element */
|
5
8
|
ariaLabel?: string;
|
9
|
+
/** Additional classname for the root element */
|
6
10
|
className?: G.ClassName;
|
11
|
+
/** Additional attributes for the root element */
|
7
12
|
attributes?: G.Attributes<"span">;
|
8
13
|
};
|
@@ -4,19 +4,31 @@ import type { ActionableProps, ActionableRef } from "../Actionable";
|
|
4
4
|
import type * as G from "../../types/global";
|
5
5
|
export type Size = "small" | "medium" | "large";
|
6
6
|
export type Props = Pick<ActionableProps, "attributes" | "className" | "disabled" | "children" | "href" | "onClick" | "as" | "stopPropagation"> & {
|
7
|
+
/** Component color, based on the color tokens */
|
7
8
|
color?: "neutral" | "critical" | "primary";
|
9
|
+
/** Icon at the start position */
|
8
10
|
icon?: IconProps["svg"];
|
9
|
-
|
11
|
+
/** Node for inserting children */
|
10
12
|
children: React.ReactNode;
|
13
|
+
/** Node for inserting content at the start side of the component */
|
14
|
+
startSlot?: React.ReactNode;
|
15
|
+
/** Node for inserting content at the end side of the component */
|
11
16
|
endSlot?: React.ReactNode;
|
17
|
+
/** Highlight the component as hovered or focused. For example, when displaying currently focused item in Autocomplete */
|
12
18
|
highlighted?: boolean;
|
19
|
+
/** Highlight the component as selected */
|
13
20
|
selected?: boolean;
|
21
|
+
/** Component size */
|
14
22
|
size?: G.Responsive<Size>;
|
23
|
+
/** Round the corners of the component */
|
15
24
|
roundedCorners?: G.Responsive<boolean>;
|
16
25
|
};
|
17
26
|
export type AlignerProps = {
|
27
|
+
/** Node for inserting children */
|
18
28
|
children: React.ReactElement;
|
29
|
+
/** Additional classname for the root element */
|
19
30
|
className?: G.ClassName;
|
31
|
+
/** Additional attributes for the root element */
|
20
32
|
attributes?: G.Attributes<"div">;
|
21
33
|
};
|
22
34
|
export type Export = React.ForwardRefExoticComponent<Props & {
|
@@ -9,28 +9,47 @@ export type Context = {
|
|
9
9
|
setSubtitleMounted: (b: boolean) => void;
|
10
10
|
};
|
11
11
|
export type TitleProps = {
|
12
|
+
/** Node for inserting the title text */
|
12
13
|
children: React.ReactNode;
|
13
14
|
};
|
14
15
|
export type SubtitleProps = {
|
16
|
+
/** Node for inserting the subtitle text */
|
15
17
|
children: React.ReactNode;
|
16
18
|
};
|
17
19
|
export type Props = {
|
20
|
+
/** Node for inserting children */
|
18
21
|
children?: React.ReactNode;
|
22
|
+
/** Component position on the screen */
|
19
23
|
position?: G.Responsive<"center" | "end" | "bottom" | "start" | "full-screen">;
|
24
|
+
/** Component size, literal css value */
|
20
25
|
size?: G.Responsive<string>;
|
26
|
+
/** Component padding, unit token multiplier */
|
21
27
|
padding?: G.Responsive<number>;
|
28
|
+
/** Remove overflow from the component content */
|
22
29
|
overflow?: "visible";
|
30
|
+
/** Callback when the component is closed */
|
23
31
|
onClose?: (args: {
|
24
32
|
reason: OverlayCloseReason | "drag";
|
25
33
|
}) => void;
|
34
|
+
/** Make the overlay transparent */
|
26
35
|
transparentOverlay?: boolean;
|
36
|
+
/** Make the overlay blurred */
|
27
37
|
blurredOverlay?: boolean;
|
38
|
+
/** Disable swipe gesture to close the component on touch devices */
|
28
39
|
disableSwipeGesture?: boolean;
|
40
|
+
/** Disable closing the component on outside click */
|
29
41
|
disableCloseOnOutsideClick?: boolean;
|
42
|
+
/** Focus the first focusable element in the component when it is opened, when false, focus will be set on the component content container
|
43
|
+
* @default true
|
44
|
+
*/
|
30
45
|
autoFocus?: boolean;
|
46
|
+
/** aria-label attribute for the root element, useful when there is no visible title */
|
31
47
|
ariaLabel?: string;
|
48
|
+
/** Additional classname for the root element */
|
32
49
|
className?: G.ClassName;
|
50
|
+
/** Additional classname for the overlay element */
|
33
51
|
overlayClassName?: G.ClassName;
|
52
|
+
/** Additional attributes for the root element */
|
34
53
|
attributes?: G.Attributes<"div"> & {
|
35
54
|
ref?: React.RefObject<HTMLDivElement | null>;
|
36
55
|
};
|