@simplybusiness/mobius 4.0.0-beta.11 → 4.0.0-beta.13
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.md +22 -0
- package/dist/cjs/components/Button/Button.d.ts +1 -1
- package/dist/cjs/components/Button/Button.js +1 -1
- package/dist/cjs/components/Button/Button.js.map +1 -1
- package/dist/cjs/components/Button/Button.stories.js +12 -12
- package/dist/cjs/components/Button/Button.stories.js.map +1 -1
- package/dist/cjs/components/Drawer/Drawer.js +22 -36
- package/dist/cjs/components/Drawer/Drawer.js.map +1 -1
- package/dist/cjs/components/Flex/Flex.stories.js +8 -13
- package/dist/cjs/components/Flex/Flex.stories.js.map +1 -1
- package/dist/cjs/components/Grid/Grid.stories.js +11 -16
- package/dist/cjs/components/Grid/Grid.stories.js.map +1 -1
- package/dist/cjs/components/Icon/Icon.js +1 -2
- package/dist/cjs/components/Icon/Icon.js.map +1 -1
- package/dist/cjs/components/Icon/Icon.stories.js +1 -1
- package/dist/cjs/components/Icon/types.d.ts +1 -1
- package/dist/cjs/components/LinkButton/LinkButton.stories.js +1 -1
- package/dist/cjs/components/LinkButton/LinkButton.stories.js.map +1 -1
- package/dist/cjs/components/Modal/Modal.js +24 -41
- package/dist/cjs/components/Modal/Modal.js.map +1 -1
- package/dist/cjs/components/Modal/Modal.stories.d.ts +2 -0
- package/dist/cjs/components/Modal/Modal.stories.js +18 -1
- package/dist/cjs/components/Modal/Modal.stories.js.map +1 -1
- package/dist/cjs/components/Modal/Modal.test.js +29 -6
- package/dist/cjs/components/Modal/Modal.test.js.map +1 -1
- package/dist/cjs/components/Radio/Radio.stories.js +1 -1
- package/dist/cjs/components/Segment/Segment.stories.js +11 -13
- package/dist/cjs/components/Segment/Segment.stories.js.map +1 -1
- package/dist/cjs/components/Segment/SegmentGroup.d.ts +1 -1
- package/dist/cjs/components/Segment/SegmentGroup.js.map +1 -1
- package/dist/cjs/components/Text/Text.d.ts +2 -2
- package/dist/cjs/components/Text/Text.js +1 -1
- package/dist/cjs/components/Text/Text.js.map +1 -1
- package/dist/cjs/components/Text/Text.stories.js +2 -2
- package/dist/cjs/components/Text/Text.stories.js.map +1 -1
- package/dist/cjs/components/Text/Text.test.js +2 -2
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/components/Button/Button.js +1 -1
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/Drawer/Drawer.js +22 -36
- package/dist/esm/components/Drawer/Drawer.js.map +1 -1
- package/dist/esm/components/Icon/Icon.js +1 -2
- package/dist/esm/components/Icon/Icon.js.map +1 -1
- package/dist/esm/components/Modal/Modal.js +24 -41
- package/dist/esm/components/Modal/Modal.js.map +1 -1
- package/dist/esm/components/Segment/SegmentGroup.js.map +1 -1
- package/dist/esm/components/Text/Text.js +1 -1
- package/dist/esm/components/Text/Text.js.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/mobius.d.ts +46 -5
- package/package.json +2 -2
- package/src/components/Button/Button.mdx +7 -7
- package/src/components/Button/Button.stories.tsx +12 -12
- package/src/components/Button/Button.story.styles.css +1 -1
- package/src/components/Button/Button.tsx +2 -2
- package/src/components/Checkbox/Checkbox.mdx +4 -1
- package/src/components/Drawer/Drawer.tsx +34 -46
- package/src/components/Flex/Flex.mdx +18 -23
- package/src/components/Flex/Flex.stories.tsx +8 -13
- package/src/components/Grid/Grid.mdx +13 -18
- package/src/components/Grid/Grid.stories.tsx +11 -16
- package/src/components/Icon/Icon.stories.tsx +1 -1
- package/src/components/Icon/Icon.tsx +1 -1
- package/src/components/Icon/types.ts +1 -17
- package/src/components/LinkButton/LinkButton.stories.tsx +1 -1
- package/src/components/Modal/Modal.mdx +51 -0
- package/src/components/Modal/Modal.stories.tsx +53 -0
- package/src/components/Modal/Modal.test.tsx +49 -6
- package/src/components/Modal/Modal.tsx +35 -50
- package/src/components/Progress/Progress.mdx +3 -3
- package/src/components/Radio/Radio.mdx +5 -2
- package/src/components/Radio/Radio.stories.tsx +1 -1
- package/src/components/Segment/Segment.mdx +22 -24
- package/src/components/Segment/Segment.stories.tsx +22 -24
- package/src/components/Segment/SegmentGroup.tsx +1 -9
- package/src/components/Text/Text.stories.tsx +3 -5
- package/src/components/Text/Text.test.tsx +2 -2
- package/src/components/Text/Text.tsx +3 -13
- package/src/components/index.tsx +1 -0
|
@@ -64,7 +64,7 @@ export const Normal: Meta<typeof Button> = {
|
|
|
64
64
|
args: {
|
|
65
65
|
children: "Confirm",
|
|
66
66
|
variant: "primary",
|
|
67
|
-
size: "
|
|
67
|
+
size: "md",
|
|
68
68
|
isDisabled: false,
|
|
69
69
|
isLoading: false,
|
|
70
70
|
isSuccess: false,
|
|
@@ -76,7 +76,7 @@ export const Secondary: Meta<typeof Button> = {
|
|
|
76
76
|
render: (args: ButtonProps) => <Button {...args} />,
|
|
77
77
|
args: {
|
|
78
78
|
variant: "secondary",
|
|
79
|
-
size: "
|
|
79
|
+
size: "md",
|
|
80
80
|
children: "Secondary Button",
|
|
81
81
|
isDisabled: false,
|
|
82
82
|
isLoading: false,
|
|
@@ -89,7 +89,7 @@ export const Ghost: Meta<typeof Button> = {
|
|
|
89
89
|
render: (args: ButtonProps) => <Button {...args} />,
|
|
90
90
|
args: {
|
|
91
91
|
variant: "ghost",
|
|
92
|
-
size: "
|
|
92
|
+
size: "md",
|
|
93
93
|
children: "Ghost Button",
|
|
94
94
|
isDisabled: false,
|
|
95
95
|
isLoading: false,
|
|
@@ -102,7 +102,7 @@ export const Basic: Meta<typeof Button> = {
|
|
|
102
102
|
render: (args: ButtonProps) => <Button {...args} />,
|
|
103
103
|
args: {
|
|
104
104
|
variant: "basic",
|
|
105
|
-
size: "
|
|
105
|
+
size: "md",
|
|
106
106
|
children: "Basic Button",
|
|
107
107
|
isDisabled: false,
|
|
108
108
|
isLoading: false,
|
|
@@ -116,7 +116,7 @@ export const Large: Meta<typeof Button> = {
|
|
|
116
116
|
args: {
|
|
117
117
|
children: "Large Button",
|
|
118
118
|
variant: "primary",
|
|
119
|
-
size: "
|
|
119
|
+
size: "lg",
|
|
120
120
|
isDisabled: false,
|
|
121
121
|
isLoading: false,
|
|
122
122
|
isSuccess: false,
|
|
@@ -130,7 +130,7 @@ export const Link: Meta<typeof Button> = {
|
|
|
130
130
|
children: "Link Button",
|
|
131
131
|
elementType: "a",
|
|
132
132
|
variant: "primary",
|
|
133
|
-
size: "
|
|
133
|
+
size: "md",
|
|
134
134
|
isDisabled: false,
|
|
135
135
|
isLoading: false,
|
|
136
136
|
isSuccess: false,
|
|
@@ -145,7 +145,7 @@ export const Loading: Meta<typeof Button> = {
|
|
|
145
145
|
args: {
|
|
146
146
|
children: "Loading",
|
|
147
147
|
variant: "primary",
|
|
148
|
-
size: "
|
|
148
|
+
size: "md",
|
|
149
149
|
isDisabled: false,
|
|
150
150
|
isLoading: true,
|
|
151
151
|
isSuccess: false,
|
|
@@ -158,7 +158,7 @@ export const Success: Meta<typeof Button> = {
|
|
|
158
158
|
args: {
|
|
159
159
|
children: "Success",
|
|
160
160
|
variant: "primary",
|
|
161
|
-
size: "
|
|
161
|
+
size: "md",
|
|
162
162
|
isDisabled: false,
|
|
163
163
|
isLoading: false,
|
|
164
164
|
isSuccess: true,
|
|
@@ -171,7 +171,7 @@ export const Disabled: Meta<typeof Button> = {
|
|
|
171
171
|
args: {
|
|
172
172
|
children: "Disabled",
|
|
173
173
|
variant: "primary",
|
|
174
|
-
size: "
|
|
174
|
+
size: "md",
|
|
175
175
|
isDisabled: true,
|
|
176
176
|
isLoading: false,
|
|
177
177
|
isSuccess: false,
|
|
@@ -193,7 +193,7 @@ export const WithIconOnTheLeft: Meta<typeof Button> = {
|
|
|
193
193
|
</>
|
|
194
194
|
),
|
|
195
195
|
variant: "secondary",
|
|
196
|
-
size: "
|
|
196
|
+
size: "md",
|
|
197
197
|
isDisabled: false,
|
|
198
198
|
isLoading: false,
|
|
199
199
|
isSuccess: false,
|
|
@@ -215,7 +215,7 @@ export const WithIconOnTheRight: Meta<typeof Button> = {
|
|
|
215
215
|
</>
|
|
216
216
|
),
|
|
217
217
|
variant: "primary",
|
|
218
|
-
size: "
|
|
218
|
+
size: "md",
|
|
219
219
|
isDisabled: false,
|
|
220
220
|
isLoading: false,
|
|
221
221
|
isSuccess: false,
|
|
@@ -233,7 +233,7 @@ export const Themed: Meta<typeof Button> = {
|
|
|
233
233
|
args: {
|
|
234
234
|
children: "Confirm",
|
|
235
235
|
variant: "primary",
|
|
236
|
-
size: "
|
|
236
|
+
size: "md",
|
|
237
237
|
isDisabled: false,
|
|
238
238
|
isLoading: false,
|
|
239
239
|
isSuccess: false,
|
|
@@ -19,7 +19,7 @@ export type Variant =
|
|
|
19
19
|
| "inverse-ghost"
|
|
20
20
|
| "basic";
|
|
21
21
|
|
|
22
|
-
export type Size = "
|
|
22
|
+
export type Size = "sm" | "md" | "lg";
|
|
23
23
|
|
|
24
24
|
export interface ButtonProps
|
|
25
25
|
extends UseButtonProps,
|
|
@@ -57,7 +57,7 @@ const Button: ForwardedRefComponent<ButtonProps, ButtonElementType> =
|
|
|
57
57
|
isLoading,
|
|
58
58
|
isSuccess,
|
|
59
59
|
variant = "primary",
|
|
60
|
-
size = "
|
|
60
|
+
size = "md",
|
|
61
61
|
icon,
|
|
62
62
|
iconPosition,
|
|
63
63
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -59,7 +59,10 @@ The `onChange` prop can be used to listen to changes of the selected state of th
|
|
|
59
59
|
|
|
60
60
|
## Props
|
|
61
61
|
|
|
62
|
-
<ArgTypes
|
|
62
|
+
<ArgTypes
|
|
63
|
+
of={Checkbox}
|
|
64
|
+
exclude={["groupDisabled", "selected", "setSelected"]}
|
|
65
|
+
/>
|
|
63
66
|
|
|
64
67
|
## Component HTML Structure and Class names
|
|
65
68
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import classNames from "classnames/dedupe";
|
|
7
7
|
import {
|
|
8
8
|
Children,
|
|
9
|
+
ReactEventHandler,
|
|
9
10
|
ReactNode,
|
|
10
11
|
cloneElement,
|
|
11
12
|
isValidElement,
|
|
@@ -13,7 +14,6 @@ import {
|
|
|
13
14
|
useEffect,
|
|
14
15
|
useRef,
|
|
15
16
|
} from "react";
|
|
16
|
-
import { useOnClickOutside } from "../../hooks";
|
|
17
17
|
import { useBodyScrollLock } from "../../hooks/useBodyScrollLock";
|
|
18
18
|
import { supportsDialog } from "../../utils/polyfill-tests";
|
|
19
19
|
import { VisuallyHidden } from "../VisuallyHidden";
|
|
@@ -46,8 +46,8 @@ const Drawer = ({
|
|
|
46
46
|
children,
|
|
47
47
|
}: DrawerProps) => {
|
|
48
48
|
const hasOpened = useRef<boolean>(false);
|
|
49
|
-
const
|
|
50
|
-
const dialog =
|
|
49
|
+
const modalRef = useRef<HTMLDialogElement>(null);
|
|
50
|
+
const dialog = modalRef.current as HTMLDialogElement;
|
|
51
51
|
|
|
52
52
|
// Fire onOpen once
|
|
53
53
|
if (onOpen && !hasOpened.current) {
|
|
@@ -58,43 +58,31 @@ const Drawer = ({
|
|
|
58
58
|
useBodyScrollLock({ enabled: isOpen });
|
|
59
59
|
|
|
60
60
|
// Add close handler, to enable closing animations
|
|
61
|
-
const handleClose = useCallback(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
event.clientX <= rect.left + rect.width;
|
|
87
|
-
if (!isInDialog) {
|
|
88
|
-
handleClose();
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// Close modal if Escape button is pressed
|
|
93
|
-
useOnClickOutside(ref, () => {
|
|
94
|
-
if (ref.current && isOpen) {
|
|
95
|
-
handleClose();
|
|
96
|
-
}
|
|
97
|
-
});
|
|
61
|
+
const handleClose: ReactEventHandler<HTMLDialogElement> = useCallback(
|
|
62
|
+
event => {
|
|
63
|
+
if (event) {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
event.stopPropagation();
|
|
66
|
+
|
|
67
|
+
const doClose = () => {
|
|
68
|
+
dialog.close();
|
|
69
|
+
onClose?.();
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Delay close to allow exit animation
|
|
73
|
+
dialog.classList.add("close");
|
|
74
|
+
dialog.addEventListener(
|
|
75
|
+
"animationend",
|
|
76
|
+
() => {
|
|
77
|
+
dialog.classList.remove("close");
|
|
78
|
+
doClose();
|
|
79
|
+
},
|
|
80
|
+
{ once: true },
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
[onClose, dialog],
|
|
85
|
+
);
|
|
98
86
|
|
|
99
87
|
const modalClasses = classNames(
|
|
100
88
|
"mobius",
|
|
@@ -109,14 +97,14 @@ const Drawer = ({
|
|
|
109
97
|
if (!supportsDialog() && typeof window !== "undefined") {
|
|
110
98
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
111
99
|
const { default: dialogPolyfill } = await import("dialog-polyfill");
|
|
112
|
-
dialogPolyfill.registerDialog(
|
|
100
|
+
dialogPolyfill.registerDialog(modalRef.current as HTMLDialogElement);
|
|
113
101
|
}
|
|
114
102
|
|
|
115
103
|
if (isOpen) {
|
|
116
|
-
|
|
104
|
+
modalRef.current?.showModal();
|
|
117
105
|
onOpen?.();
|
|
118
|
-
} else if (
|
|
119
|
-
|
|
106
|
+
} else if (modalRef.current?.open) {
|
|
107
|
+
modalRef.current?.close();
|
|
120
108
|
}
|
|
121
109
|
}
|
|
122
110
|
|
|
@@ -125,8 +113,8 @@ const Drawer = ({
|
|
|
125
113
|
|
|
126
114
|
return (
|
|
127
115
|
<dialog
|
|
128
|
-
ref={
|
|
129
|
-
onCancel={
|
|
116
|
+
ref={modalRef}
|
|
117
|
+
onCancel={handleClose}
|
|
130
118
|
className={modalClasses}
|
|
131
119
|
aria-describedby="screen-reader-announce"
|
|
132
120
|
>
|
|
@@ -6,17 +6,12 @@ import * as FlexStories from "./Flex.stories";
|
|
|
6
6
|
|
|
7
7
|
export const sizeOptions = [
|
|
8
8
|
"",
|
|
9
|
-
"var(--size-
|
|
10
|
-
"var(--size-
|
|
11
|
-
"var(--size-
|
|
12
|
-
"var(--size-
|
|
13
|
-
"var(--size-
|
|
14
|
-
"var(--size-
|
|
15
|
-
"var(--size-60)",
|
|
16
|
-
"var(--size-70)",
|
|
17
|
-
"var(--size-80)",
|
|
18
|
-
"var(--size-90)",
|
|
19
|
-
"var(--size-100)",
|
|
9
|
+
"var(--size-xs)",
|
|
10
|
+
"var(--size-sm)",
|
|
11
|
+
"var(--size-md)",
|
|
12
|
+
"var(--size-lg)",
|
|
13
|
+
"var(--size-xl)",
|
|
14
|
+
"var(--size-xxl)",
|
|
20
15
|
];
|
|
21
16
|
|
|
22
17
|
<Meta of={FlexStories} />
|
|
@@ -59,18 +54,18 @@ export const Card = ({ children, style, ...props }) => (
|
|
|
59
54
|
|
|
60
55
|
### Flex Layout
|
|
61
56
|
|
|
62
|
-
<Flex flexDirection="column" gap="var(--size-
|
|
57
|
+
<Flex flexDirection="column" gap="var(--size-xs)">
|
|
63
58
|
<Flex
|
|
64
59
|
alignItems="center"
|
|
65
60
|
style={{
|
|
66
61
|
backgroundColor: "var(--color-background-subtle)",
|
|
67
|
-
height: "var(--size-
|
|
62
|
+
height: "var(--size-lg)",
|
|
68
63
|
}}
|
|
69
64
|
>
|
|
70
65
|
Header
|
|
71
66
|
</Flex>
|
|
72
67
|
|
|
73
|
-
<Flex flexDirection="row" gap={4} style={{ height: "
|
|
68
|
+
<Flex flexDirection="row" gap={4} style={{ height: "128px" }}>
|
|
74
69
|
<Flex style={{ backgroundColor: "var(--color-background)" }} flex={2}>
|
|
75
70
|
Main
|
|
76
71
|
</Flex>
|
|
@@ -83,7 +78,7 @@ export const Card = ({ children, style, ...props }) => (
|
|
|
83
78
|
alignItems="center"
|
|
84
79
|
style={{
|
|
85
80
|
backgroundColor: "var(--color-background-subtle)",
|
|
86
|
-
height: "var(--size-
|
|
81
|
+
height: "var(--size-lg)",
|
|
87
82
|
}}
|
|
88
83
|
>
|
|
89
84
|
Footer
|
|
@@ -91,17 +86,17 @@ export const Card = ({ children, style, ...props }) => (
|
|
|
91
86
|
</Flex>
|
|
92
87
|
|
|
93
88
|
```jsx
|
|
94
|
-
<Flex flexDirection="column" gap="var(--size-
|
|
89
|
+
<Flex flexDirection="column" gap="var(--size-xs)">
|
|
95
90
|
<Flex
|
|
96
91
|
alignItems="center"
|
|
97
92
|
style={{
|
|
98
93
|
backgroundColor: "var(--color-background-subtle)",
|
|
99
|
-
height: "var(--size-
|
|
94
|
+
height: "var(--size-lg)",
|
|
100
95
|
}}
|
|
101
96
|
>
|
|
102
97
|
Header
|
|
103
98
|
</Flex>
|
|
104
|
-
<Flex flexDirection="row" gap={4} style={{ height: "
|
|
99
|
+
<Flex flexDirection="row" gap={4} style={{ height: "128px" }}>
|
|
105
100
|
<Flex flex={2}>Main</Flex>
|
|
106
101
|
<Flex
|
|
107
102
|
style={{ backgroundColor: "var(--color-background-muted)" }}
|
|
@@ -112,7 +107,7 @@ export const Card = ({ children, style, ...props }) => (
|
|
|
112
107
|
alignItems="center"
|
|
113
108
|
style={{
|
|
114
109
|
backgroundColor: "var(--color-background-subtle)",
|
|
115
|
-
height: "var(--size-
|
|
110
|
+
height: "var(--size-lg)",
|
|
116
111
|
}}
|
|
117
112
|
>
|
|
118
113
|
Footer
|
|
@@ -124,7 +119,7 @@ export const Card = ({ children, style, ...props }) => (
|
|
|
124
119
|
|
|
125
120
|
You can use the `flexWrap` prop to wrap the elements inside the `Flex` container.
|
|
126
121
|
|
|
127
|
-
<Flex flexWrap="wrap" gap="var(--size-
|
|
122
|
+
<Flex flexWrap="wrap" gap="var(--size-xs)">
|
|
128
123
|
{Array.from({ length: 60 }).map((_, i) => (
|
|
129
124
|
<Card
|
|
130
125
|
key={i}
|
|
@@ -158,7 +153,7 @@ const Card = ({ children, ...props }) => (
|
|
|
158
153
|
</Box>
|
|
159
154
|
);
|
|
160
155
|
|
|
161
|
-
<Flex flexWrap="wrap" gap="var(--size-
|
|
156
|
+
<Flex flexWrap="wrap" gap="var(--size-xs)">
|
|
162
157
|
{Array.from({ length: 60 }).map((_, i) => (
|
|
163
158
|
<Card key={i} />
|
|
164
159
|
))}
|
|
@@ -194,7 +189,7 @@ const Card = ({ children, ...props }) => (
|
|
|
194
189
|
</Box>
|
|
195
190
|
);
|
|
196
191
|
|
|
197
|
-
<Flex flexDirection="row" gap="var(--size-
|
|
192
|
+
<Flex flexDirection="row" gap="var(--size-xs)">
|
|
198
193
|
<Card>Item</Card>
|
|
199
194
|
<Card>Item</Card>
|
|
200
195
|
<Card>Item</Card>
|
|
@@ -226,7 +221,7 @@ const Card = ({ children, ...props }) => (
|
|
|
226
221
|
</Box>
|
|
227
222
|
);
|
|
228
223
|
|
|
229
|
-
<Flex flexDirection="column" gap="var(--size-
|
|
224
|
+
<Flex flexDirection="column" gap="var(--size-xs)">
|
|
230
225
|
<Card>Item</Card>
|
|
231
226
|
<Card>Item</Card>
|
|
232
227
|
<Card>Item</Card>
|
|
@@ -7,17 +7,12 @@ import { FlexProps } from "./types";
|
|
|
7
7
|
|
|
8
8
|
const sizeOptions = [
|
|
9
9
|
"",
|
|
10
|
-
"var(--size-
|
|
11
|
-
"var(--size-
|
|
12
|
-
"var(--size-
|
|
13
|
-
"var(--size-
|
|
14
|
-
"var(--size-
|
|
15
|
-
"var(--size-
|
|
16
|
-
"var(--size-60)",
|
|
17
|
-
"var(--size-70)",
|
|
18
|
-
"var(--size-80)",
|
|
19
|
-
"var(--size-90)",
|
|
20
|
-
"var(--size-100)",
|
|
10
|
+
"var(--size-xs)",
|
|
11
|
+
"var(--size-sm)",
|
|
12
|
+
"var(--size-md)",
|
|
13
|
+
"var(--size-lg)",
|
|
14
|
+
"var(--size-xl)",
|
|
15
|
+
"var(--size-xxl)",
|
|
21
16
|
];
|
|
22
17
|
|
|
23
18
|
type CardProps = {
|
|
@@ -153,7 +148,7 @@ export const RowLayout: Meta<typeof Flex> = {
|
|
|
153
148
|
justifyContent: "normal",
|
|
154
149
|
alignItems: "stretch",
|
|
155
150
|
alignContent: "flex-start",
|
|
156
|
-
gap: "var(--size-
|
|
151
|
+
gap: "var(--size-xs)",
|
|
157
152
|
rowGap: "",
|
|
158
153
|
columnGap: "",
|
|
159
154
|
},
|
|
@@ -175,7 +170,7 @@ export const ColumnLayout: Meta<typeof Flex> = {
|
|
|
175
170
|
justifyContent: "normal",
|
|
176
171
|
alignItems: "stretch",
|
|
177
172
|
alignContent: "normal",
|
|
178
|
-
gap: "var(--size-
|
|
173
|
+
gap: "var(--size-xs)",
|
|
179
174
|
rowGap: "",
|
|
180
175
|
columnGap: "",
|
|
181
176
|
},
|
|
@@ -8,17 +8,12 @@ import * as GridStories from "./Grid.stories";
|
|
|
8
8
|
|
|
9
9
|
export const sizeOptions = [
|
|
10
10
|
"",
|
|
11
|
-
"size-
|
|
12
|
-
"size-
|
|
13
|
-
"size-
|
|
14
|
-
"size-
|
|
15
|
-
"size-
|
|
16
|
-
"size-
|
|
17
|
-
"size-60",
|
|
18
|
-
"size-70",
|
|
19
|
-
"size-80",
|
|
20
|
-
"size-90",
|
|
21
|
-
"size-100",
|
|
11
|
+
"size-xs",
|
|
12
|
+
"size-s",
|
|
13
|
+
"size-m",
|
|
14
|
+
"size-l",
|
|
15
|
+
"size-xl",
|
|
16
|
+
"size-xxl",
|
|
22
17
|
];
|
|
23
18
|
|
|
24
19
|
<Meta of={GridStories} />
|
|
@@ -61,7 +56,7 @@ export const Card = ({ children, ...props }) => (
|
|
|
61
56
|
|
|
62
57
|
Different items can have different widths. This is especially useful when creating layouts with sidebars.
|
|
63
58
|
|
|
64
|
-
<Grid gap="size-
|
|
59
|
+
<Grid gap="size-xs">
|
|
65
60
|
<Grid.Item span={12}>
|
|
66
61
|
<Card>span=12</Card>
|
|
67
62
|
</Grid.Item>
|
|
@@ -121,7 +116,7 @@ const Card = ({ children, ...props }) => (
|
|
|
121
116
|
</Box>
|
|
122
117
|
);
|
|
123
118
|
|
|
124
|
-
<Grid gap="size-
|
|
119
|
+
<Grid gap="size-xs">
|
|
125
120
|
<Grid.Item span={12}>
|
|
126
121
|
<Card>span=12</Card>
|
|
127
122
|
</Grid.Item>
|
|
@@ -189,7 +184,7 @@ export const Square = ({ children, ...props }) => (
|
|
|
189
184
|
```jsx
|
|
190
185
|
import { Grid } from "@simplybusiness/mobius";
|
|
191
186
|
|
|
192
|
-
<Grid gap="size-
|
|
187
|
+
<Grid gap="size-xs">
|
|
193
188
|
<Grid.Item span={4}>
|
|
194
189
|
<Square>1</Square>
|
|
195
190
|
</Grid.Item>
|
|
@@ -244,7 +239,7 @@ const Card = ({ children, ...props }) => (
|
|
|
244
239
|
</Box>
|
|
245
240
|
);
|
|
246
241
|
|
|
247
|
-
<Grid gap="size-
|
|
242
|
+
<Grid gap="size-xs">
|
|
248
243
|
<Grid.Item span={12}>
|
|
249
244
|
<Card>span=12</Card>
|
|
250
245
|
</Grid.Item>
|
|
@@ -309,7 +304,7 @@ const Card = ({ children, ...props }) => (
|
|
|
309
304
|
</Box>
|
|
310
305
|
);
|
|
311
306
|
|
|
312
|
-
<Grid columns={8} gap="size-
|
|
307
|
+
<Grid columns={8} gap="size-xs">
|
|
313
308
|
<Card columns={8}>span=1</Card>
|
|
314
309
|
<Card columns={8}>span=1</Card>
|
|
315
310
|
<Card columns={8}>span=1</Card>
|
|
@@ -344,7 +339,7 @@ const Card = ({ children, ...props }) => (
|
|
|
344
339
|
</Box>
|
|
345
340
|
);
|
|
346
341
|
|
|
347
|
-
<Grid gap="size-
|
|
342
|
+
<Grid gap="size-xs">
|
|
348
343
|
<Grid.Item xs={12} sm={6} md={2} lg={8} xl={12} xxl={4}>
|
|
349
344
|
<Card>xs=12 sm=6 md=2 lg=8 xl=12 xxl=4</Card>
|
|
350
345
|
</Grid.Item>
|
|
@@ -392,7 +387,7 @@ const AlignSquare = ({ children, ...props }) => (
|
|
|
392
387
|
{children}
|
|
393
388
|
</Box>
|
|
394
389
|
);
|
|
395
|
-
<Grid gap="size-
|
|
390
|
+
<Grid gap="size-xs">
|
|
396
391
|
<AlignSquareItem span={4} alignSelf="center" justifySelf="end">
|
|
397
392
|
<AlignSquare>1</AlignSquare>
|
|
398
393
|
</AlignSquareItem>
|
|
@@ -8,17 +8,12 @@ import { GridItem } from "./Item";
|
|
|
8
8
|
|
|
9
9
|
const sizeOptions = [
|
|
10
10
|
"",
|
|
11
|
-
"size-
|
|
12
|
-
"size-
|
|
13
|
-
"size-
|
|
14
|
-
"size-
|
|
15
|
-
"size-
|
|
16
|
-
"size-
|
|
17
|
-
"size-60",
|
|
18
|
-
"size-70",
|
|
19
|
-
"size-80",
|
|
20
|
-
"size-90",
|
|
21
|
-
"size-100",
|
|
11
|
+
"size-xs",
|
|
12
|
+
"size-s",
|
|
13
|
+
"size-m",
|
|
14
|
+
"size-l",
|
|
15
|
+
"size-xl",
|
|
16
|
+
"size-xxl",
|
|
22
17
|
];
|
|
23
18
|
|
|
24
19
|
type SharedProps = {
|
|
@@ -159,7 +154,7 @@ export const AlignmentProperties: Meta<typeof Grid> = {
|
|
|
159
154
|
),
|
|
160
155
|
args: {
|
|
161
156
|
columns: 12,
|
|
162
|
-
gap: "size-
|
|
157
|
+
gap: "size-xs",
|
|
163
158
|
rowGap: "",
|
|
164
159
|
columnGap: "",
|
|
165
160
|
alignItems: "stretch",
|
|
@@ -214,7 +209,7 @@ export const Normal: Meta<typeof Grid> = {
|
|
|
214
209
|
),
|
|
215
210
|
args: {
|
|
216
211
|
columns: 12,
|
|
217
|
-
gap: "size-
|
|
212
|
+
gap: "size-xs",
|
|
218
213
|
rowGap: "",
|
|
219
214
|
columnGap: "",
|
|
220
215
|
alignItems: "stretch",
|
|
@@ -233,7 +228,7 @@ export const EightColumns: Meta<typeof Grid> = {
|
|
|
233
228
|
),
|
|
234
229
|
args: {
|
|
235
230
|
columns: 8,
|
|
236
|
-
gap: "size-
|
|
231
|
+
gap: "size-xs",
|
|
237
232
|
alignItems: "stretch",
|
|
238
233
|
justifyItems: "stretch",
|
|
239
234
|
className: "grid-example-eight-columns",
|
|
@@ -258,7 +253,7 @@ export const Responsive: Meta<typeof GridItem> = {
|
|
|
258
253
|
.join(" ");
|
|
259
254
|
|
|
260
255
|
return (
|
|
261
|
-
<Grid gap="size-
|
|
256
|
+
<Grid gap="size-xs" alignItems="stretch" justifyItems="stretch">
|
|
262
257
|
<Grid.Item {...args}>
|
|
263
258
|
<Card>{allArgs}</Card>
|
|
264
259
|
</Grid.Item>
|
|
@@ -302,7 +297,7 @@ export const ItemPositioning: Meta<typeof GridItem> = {
|
|
|
302
297
|
render: (args: GridItemProps) => (
|
|
303
298
|
<Grid
|
|
304
299
|
columns={12}
|
|
305
|
-
gap="size-
|
|
300
|
+
gap="size-xs"
|
|
306
301
|
alignItems="stretch"
|
|
307
302
|
justifyItems="stretch"
|
|
308
303
|
className="grid-example-fixed-size-grid"
|
|
@@ -22,9 +22,9 @@ export function Icon({
|
|
|
22
22
|
"mobius",
|
|
23
23
|
"mobius/Icon",
|
|
24
24
|
`svg-inline--${ICON_PREFIX}`,
|
|
25
|
+
`--size-${size}`,
|
|
25
26
|
className,
|
|
26
27
|
{
|
|
27
|
-
[`${ICON_PREFIX}-${size}`]: size,
|
|
28
28
|
[`${ICON_PREFIX}-fw`]: fixedWidth,
|
|
29
29
|
[`${ICON_PREFIX}-spin`]: spin || spinReverse,
|
|
30
30
|
[`${ICON_PREFIX}-spin-reverse`]: spinReverse,
|
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
import { Ref } from "react";
|
|
2
2
|
import { IconDefinition } from "../../types/icon";
|
|
3
3
|
|
|
4
|
-
export type IconSizeProp =
|
|
5
|
-
| "2xs"
|
|
6
|
-
| "xs"
|
|
7
|
-
| "sm"
|
|
8
|
-
| "lg"
|
|
9
|
-
| "xl"
|
|
10
|
-
| "2xl"
|
|
11
|
-
| "1x"
|
|
12
|
-
| "2x"
|
|
13
|
-
| "3x"
|
|
14
|
-
| "4x"
|
|
15
|
-
| "5x"
|
|
16
|
-
| "6x"
|
|
17
|
-
| "7x"
|
|
18
|
-
| "8x"
|
|
19
|
-
| "9x"
|
|
20
|
-
| "10x";
|
|
4
|
+
export type IconSizeProp = "xs" | "sm" | "md" | "lg";
|
|
21
5
|
|
|
22
6
|
export interface IconProps {
|
|
23
7
|
icon?: IconDefinition;
|