@lunit/design-system 1.0.0 → 2.0.1
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/cjs/components/Alert/index.js +1 -1
- package/dist/cjs/components/Alert/index.js.map +1 -1
- package/dist/cjs/components/Button/index.js +1 -1
- package/dist/cjs/components/Button/index.js.map +1 -1
- package/dist/cjs/components/Checkbox/index.js +1 -1
- package/dist/cjs/components/Checkbox/index.js.map +1 -1
- package/dist/cjs/components/Dialog/index.js +2 -0
- package/dist/cjs/components/Dialog/index.js.map +1 -0
- package/dist/cjs/components/Radio/index.js +1 -1
- package/dist/cjs/components/Radio/index.js.map +1 -1
- package/dist/cjs/components/ToggleButton/index.js +1 -1
- package/dist/cjs/components/ToggleButton/index.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/components/Button/Button.styled.js +1 -1
- package/dist/components/Button/Button.styled.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +9 -19
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Dialog/Dialog.js +57 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/Dialog/Dialog.styled.js +146 -0
- package/dist/components/Dialog/Dialog.styled.js.map +1 -0
- package/dist/components/Dialog/components/DialogAction.js +18 -0
- package/dist/components/Dialog/components/DialogAction.js.map +1 -0
- package/dist/components/Dialog/index.js +2 -0
- package/dist/components/Dialog/index.js.map +1 -0
- package/dist/components/Radio/Radio.js +7 -21
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.styled.js +1 -1
- package/dist/components/ToggleButton/ToggleButton.styled.js.map +1 -1
- package/dist/foundation/Elevation/index.js +1 -1
- package/dist/foundation/Elevation/index.js.map +1 -1
- package/dist/foundation/Typography/index.js +0 -6
- package/dist/foundation/Typography/index.js.map +1 -1
- package/dist/foundation/Typography/tokens.js +1 -1
- package/dist/foundation/colors/base/grey.js +3 -1
- package/dist/foundation/colors/base/grey.js.map +1 -1
- package/dist/foundation/colors/index.js +5 -6
- package/dist/foundation/colors/index.js.map +1 -1
- package/dist/foundation/colors/token/component.js +31 -115
- package/dist/foundation/colors/token/component.js.map +1 -1
- package/dist/foundation/colors/token/core.js +43 -75
- package/dist/foundation/colors/token/core.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/components/Alert/Alert.utils.d.ts +3 -3
- package/dist/types/components/Button/Button.styled.d.ts +8 -8
- package/dist/types/components/Chip/Chip.styled.d.ts +12 -12
- package/dist/types/components/Dialog/Dialog.d.ts +50 -0
- package/dist/types/components/Dialog/Dialog.styled.d.ts +12 -0
- package/dist/types/components/Dialog/components/DialogAction.d.ts +8 -0
- package/dist/types/components/Dialog/index.d.ts +2 -0
- package/dist/types/components/Toast/Toast.utils.d.ts +1 -1
- package/dist/types/components/ToggleButton/ToggleButton.styled.d.ts +2 -2
- package/dist/types/foundation/Elevation/index.d.ts +1 -1
- package/dist/types/foundation/Typography/index.d.ts +1 -7
- package/dist/types/foundation/Typography/tokens.d.ts +1 -1
- package/dist/types/foundation/colors/base/grey.d.ts +2 -0
- package/dist/types/foundation/colors/index.d.ts +5 -6
- package/dist/types/foundation/colors/token/types.d.ts +0 -2
- package/dist/types/foundation/colors/types.d.ts +78 -76
- package/dist/types/foundation/index.d.ts +5 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Button/Button.styled.ts +1 -1
- package/src/components/Checkbox/Checkbox.tsx +39 -22
- package/src/components/Dialog/Dialog.styled.ts +172 -0
- package/src/components/Dialog/Dialog.tsx +189 -0
- package/src/components/Dialog/components/DialogAction.tsx +36 -0
- package/src/components/Dialog/index.ts +14 -0
- package/src/components/Radio/Radio.tsx +37 -25
- package/src/components/ToggleButton/ToggleButton.styled.ts +1 -1
- package/src/foundation/Elevation/index.ts +1 -1
- package/src/foundation/Typography/index.ts +0 -6
- package/src/foundation/Typography/tokens.ts +1 -1
- package/src/foundation/colors/base/grey.ts +3 -1
- package/src/foundation/colors/index.ts +5 -6
- package/src/foundation/colors/token/component.ts +26 -110
- package/src/foundation/colors/token/core.ts +39 -71
- package/src/foundation/colors/token/types.ts +0 -2
- package/src/foundation/colors/types.ts +78 -75
- package/src/index.ts +1 -1
- package/src/stories/GettingStarted.mdx +88 -0
- package/src/stories/components/Button/BasicButton.stories.tsx +80 -52
- package/src/stories/components/Button/ButtonDocs.mdx +187 -0
- package/src/stories/components/Button/Color.stories.tsx +132 -0
- package/src/stories/components/Button/IconButton.stories.tsx +41 -35
- package/src/stories/components/Button/Kind.stories.tsx +13 -52
- package/src/stories/components/{SelectControl/Checkbox.stories.tsx → CheckBox/BasicCheckbox.stories.tsx} +84 -105
- package/src/stories/components/CheckBox/CheckboxDocs.mdx +85 -0
- package/src/stories/components/Chip/Chip.stories.tsx +65 -0
- package/src/stories/components/Chip/ChipDocs.mdx +132 -0
- package/src/stories/components/Dialog/Dialog.stories.tsx +320 -0
- package/src/stories/components/Dialog/DialogDocs.mdx +181 -0
- package/src/stories/components/TextField/BasicTextField.stories.tsx +214 -0
- package/src/stories/components/TextField/TextFieldDocs.mdx +140 -0
- package/src/stories/components/TextField/TextFieldSize.stories.tsx +26 -3
- package/src/stories/components/ToggleButton/Basic.stories.tsx +312 -0
- package/src/stories/components/ToggleButton/ToggleButtonDocs.mdx +180 -0
- package/src/stories/components/ToggleButton/ToggleButtonKind.stories.tsx +65 -0
- package/src/stories/components/ToggleButton/WithIcon.stories.tsx +138 -0
- package/src/stories/foundation/Typography/Typography.mdx +31 -46
- package/src/stories/foundation/Typography/Typography.stories.tsx +30 -1
- package/src/stories/foundation/colors/ColorSystem.tsx +86 -0
- package/src/stories/foundation/colors/Docs.mdx +225 -0
- package/src/stories/foundation/colors/TokenPaletteTable.tsx +1 -5
- package/src/components/Modal/Modal.tsx +0 -8
- package/src/components/Modal/index.ts +0 -1
- package/src/stories/components/Modal/Modal.stories.tsx +0 -15
- package/src/stories/foundation/Typography/TypographyExamples.stories.tsx +0 -44
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Meta } from "@storybook/react";
|
|
3
3
|
import { action } from "@storybook/addon-actions";
|
|
4
|
+
import { Box } from "@mui/system";
|
|
5
|
+
|
|
4
6
|
import Chip from "@/components/Chip";
|
|
5
7
|
import {
|
|
6
8
|
Logo16,
|
|
@@ -17,6 +19,10 @@ export default {
|
|
|
17
19
|
argTypes: {
|
|
18
20
|
kind: {
|
|
19
21
|
description: `Default status of Contained or Outlined Chip is readOnly. You can pass onClick, onDelete or thumbnail to Contained Chip only.`,
|
|
22
|
+
control: {
|
|
23
|
+
type: "select",
|
|
24
|
+
},
|
|
25
|
+
options: ["contained", "outlined"],
|
|
20
26
|
},
|
|
21
27
|
variant: {
|
|
22
28
|
description: `The variant is alias of kind. It is Filled or Outlined.`,
|
|
@@ -102,6 +108,8 @@ export default {
|
|
|
102
108
|
},
|
|
103
109
|
} as Meta<typeof Chip>;
|
|
104
110
|
|
|
111
|
+
export const Basic = {};
|
|
112
|
+
|
|
105
113
|
export const Outlined = {
|
|
106
114
|
parameters: {
|
|
107
115
|
docs: {
|
|
@@ -153,6 +161,41 @@ export const Contained = {
|
|
|
153
161
|
name: "Kind(Variant): Contained / Read Only",
|
|
154
162
|
};
|
|
155
163
|
|
|
164
|
+
export const Kind = {
|
|
165
|
+
chromatic: { disableSnapshot: true },
|
|
166
|
+
render: () => (
|
|
167
|
+
<Box sx={{ display: "flex", flexDirection: "row", gap: 4 }}>
|
|
168
|
+
<Chip kind="outlined" label="label@lunit.io" />
|
|
169
|
+
<Chip kind="contained" label="label@lunit.io" />
|
|
170
|
+
</Box>
|
|
171
|
+
),
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export const Color = {
|
|
175
|
+
chromatic: { disableSnapshot: true },
|
|
176
|
+
render: () => (
|
|
177
|
+
<Box sx={{ display: "flex", flexDirection: "row", gap: 4 }}>
|
|
178
|
+
<Chip color="primary" label="label@lunit.io" />
|
|
179
|
+
<Chip color="secondary" label="label@lunit.io" />
|
|
180
|
+
<Chip color="warning" label="label@lunit.io" />
|
|
181
|
+
<Chip color="error" label="label@lunit.io" />
|
|
182
|
+
<Chip color="success" label="label@lunit.io" />
|
|
183
|
+
</Box>
|
|
184
|
+
),
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export const Thumbnail = {
|
|
188
|
+
chromatic: { disableSnapshot: true },
|
|
189
|
+
render: () => (
|
|
190
|
+
<Box sx={{ display: "flex", flexDirection: "row", gap: 4 }}>
|
|
191
|
+
<Chip thumbnail={<Logo16 />} label="label@lunit.io" />
|
|
192
|
+
<Chip thumbnail={<Avatar16 />} label="label@lunit.io" />
|
|
193
|
+
<Chip thumbnail={<Success16 />} label="label@lunit.io" />
|
|
194
|
+
<Chip thumbnail="W as initial" label="label@lunit.io" />
|
|
195
|
+
</Box>
|
|
196
|
+
),
|
|
197
|
+
};
|
|
198
|
+
|
|
156
199
|
export const ContainedWithClick = {
|
|
157
200
|
args: {
|
|
158
201
|
...Contained.args,
|
|
@@ -216,3 +259,25 @@ export const ContainedWithThumbnail = {
|
|
|
216
259
|
|
|
217
260
|
name: "Kind(Variant): Contained with Thumbnail",
|
|
218
261
|
};
|
|
262
|
+
|
|
263
|
+
export const ContainedWithDeleteAndThumbnail = {
|
|
264
|
+
args: {
|
|
265
|
+
...Contained.args,
|
|
266
|
+
thumbnail: "Initial",
|
|
267
|
+
onClick: undefined,
|
|
268
|
+
onDelete: action("onDelete"),
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
parameters: {
|
|
272
|
+
docs: {
|
|
273
|
+
description: {
|
|
274
|
+
story: `Contained chip can have thumbnail and delete button.`,
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
controls: {
|
|
278
|
+
exclude: ["onClick"],
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
|
|
282
|
+
name: "Kind(Variant): Contained with Thumbnail and Deletable",
|
|
283
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Canvas, Stories, Controls, Meta, Story } from "@storybook/blocks";
|
|
2
|
+
import { Error } from "@lunit/design-system-icons";
|
|
3
|
+
|
|
4
|
+
import Chip from "@/components/Chip";
|
|
5
|
+
import * as ChipStories from "./Chip.stories";
|
|
6
|
+
|
|
7
|
+
<Meta name="Chip Docs" of={ChipStories} />
|
|
8
|
+
|
|
9
|
+
# Chip
|
|
10
|
+
|
|
11
|
+
Chips are compact elements that represent an input, attribute, or action.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Basic Chip
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Chip } from "@lunit/design-system";
|
|
19
|
+
// or
|
|
20
|
+
import Chip from "@lunit/design-system/Chip";
|
|
21
|
+
|
|
22
|
+
<Chip />;
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Demo
|
|
26
|
+
|
|
27
|
+
<Canvas of={ChipStories.Basic} />
|
|
28
|
+
|
|
29
|
+
<Controls />
|
|
30
|
+
|
|
31
|
+
### Label
|
|
32
|
+
|
|
33
|
+
The label is the text that will be displayed in the Chip.
|
|
34
|
+
If the label is not provided, the Chip will be rendered as a circle.
|
|
35
|
+
|
|
36
|
+
<Canvas of={ChipStories.Contained} meta={ChipStories.Contained.meta} />
|
|
37
|
+
```tsx
|
|
38
|
+
<Chip label="label@lunit.io" />
|
|
39
|
+
````
|
|
40
|
+
|
|
41
|
+
### Kind(variant)
|
|
42
|
+
|
|
43
|
+
The Chip has 2 kinds of variants: outlined and contained. <br />
|
|
44
|
+
(In the Lunit Design System, the variant and kind are used interchangeably. The variant is a fallback prop of the kind.) <br />
|
|
45
|
+
You can change the kind of the Chip by using the kind or variant prop, and the outcome will be the same.
|
|
46
|
+
The `contained` kind corresponds to the `filled` and `contained` variants of the MUI system. <br />
|
|
47
|
+
The default kind(variant) is contained. <br />
|
|
48
|
+
|
|
49
|
+
<Canvas of={ChipStories.Kind} meta={ChipStories.Contained.meta} />
|
|
50
|
+
```tsx
|
|
51
|
+
<Chip variant="contained" label="label@lunit.io" />
|
|
52
|
+
<Chip variant="outlined" label="label@lunit.io" />
|
|
53
|
+
// or (kind is a fallback prop of the variant)
|
|
54
|
+
<Chip kind="contained" label="label@lunit.io" />
|
|
55
|
+
<Chip kind="outlined" label="label@lunit.io" />
|
|
56
|
+
````
|
|
57
|
+
|
|
58
|
+
### Color
|
|
59
|
+
|
|
60
|
+
The Chip has 5 kinds of colors: `primary`, `secondary`, `warning`, `error`, and `success`. <br />
|
|
61
|
+
By using the color prop, you can change the color of the Chip. <br />
|
|
62
|
+
The default color is `primary`.
|
|
63
|
+
|
|
64
|
+
<Canvas of={ChipStories.Color} meta={ChipStories.Contained.meta} />
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
<Chip color="primary" label="label@lunit.io" />
|
|
68
|
+
<Chip color="secondary" label="label@lunit.io" />
|
|
69
|
+
<Chip color="warning" label="label@lunit.io" />
|
|
70
|
+
<Chip color="error" label="label@lunit.io" />
|
|
71
|
+
<Chip color="success" label="label@lunit.io" />
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Clickable
|
|
75
|
+
|
|
76
|
+
Chips with the `onClick` are clickable. <br />
|
|
77
|
+
You cannot pass the `onClick` prop to the Chip when its variant is `outlined`. <br />
|
|
78
|
+
|
|
79
|
+
<Canvas of={ChipStories.ContainedWithClick} />
|
|
80
|
+
```tsx
|
|
81
|
+
<Chip label="label@lunit.io" onClick={() => console.log("onClick")} />
|
|
82
|
+
|
|
83
|
+
````
|
|
84
|
+
|
|
85
|
+
### Deletable
|
|
86
|
+
|
|
87
|
+
Chips with the `onDelete` are deletable. <br />
|
|
88
|
+
You cannot pass the `onDelete` prop to the Chip when its variant is `outlined`. <br />
|
|
89
|
+
The hover/pressed effects are only applied to the delete icon. <br />
|
|
90
|
+
|
|
91
|
+
<Canvas of={ChipStories.ContainedWithDelete} />
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
<Chip label="label@lunit.io" onDelete={() => console.log("onDelete")} />
|
|
95
|
+
|
|
96
|
+
````
|
|
97
|
+
|
|
98
|
+
### Thumbnail(logo, avatar, icon, first letter)
|
|
99
|
+
|
|
100
|
+
Chips with the thumbnail prop can display a logo, avatar, icon, or the first letter of a string.<br />
|
|
101
|
+
The thumbnail replaces all the left side icons of MUI, so you cannot use the icon or avatar prop of the MUI system. <br />
|
|
102
|
+
The thumbnail prop cannot be used when the kind (variant) is outlined.
|
|
103
|
+
|
|
104
|
+
<Canvas of={ChipStories.Thumbnail} />
|
|
105
|
+
```tsx
|
|
106
|
+
<Chip thumbnail={<Logo16 />} label="label@lunit.io" />
|
|
107
|
+
<Chip thumbnail={<Avatar16 />} label="label@lunit.io" />
|
|
108
|
+
<Chip thumbnail={<Success16 />} label="label@lunit.io" />
|
|
109
|
+
<Chip thumbnail="W as initial" label="label@lunit.io" />
|
|
110
|
+
|
|
111
|
+
````
|
|
112
|
+
|
|
113
|
+
### Thumbnail and Deletable
|
|
114
|
+
|
|
115
|
+
The Chip can have a thumbnail and be deletable. <br />
|
|
116
|
+
The hover/pressed effects are only applied to the delete icon. <br />
|
|
117
|
+
|
|
118
|
+
<Canvas of={ChipStories.ContainedWithDeleteAndThumbnail} />
|
|
119
|
+
```tsx
|
|
120
|
+
<Chip label="label@lunit.io" onDelete={() => console.log("onDelete")} thumbnail="W as initial" />
|
|
121
|
+
````
|
|
122
|
+
|
|
123
|
+
## Reference
|
|
124
|
+
|
|
125
|
+
- [Material-UI Chip](https://mui.com/material-ui/react-chip/)
|
|
126
|
+
- [Material-UI Chip API](https://mui.com/material-ui/api/chip/)
|
|
127
|
+
- [Lunit Design System Chip Figma](https://www.figma.com/file/oh2WsSLBuX30Yp589gyliB/Design-System_1.0.7_Latest?type=design&node-id=1887-7970&mode=design)
|
|
128
|
+
|
|
129
|
+
## Support
|
|
130
|
+
|
|
131
|
+
- Github: [Create a new issue](https://github.com/lunit-io/design-system/issues/new)
|
|
132
|
+
- Slack: #tf_design_system
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import Error from "@lunit/design-system-icons/Error";
|
|
4
|
+
|
|
5
|
+
import Button from "@/components/Button";
|
|
6
|
+
import Dialog from "@/components/Dialog";
|
|
7
|
+
|
|
8
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof Dialog> = {
|
|
11
|
+
title: "components/Dialog",
|
|
12
|
+
component: Dialog,
|
|
13
|
+
tags: ["autodocs"],
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: { disable: true, hidden: true },
|
|
16
|
+
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
onClose: { action: "onClose" },
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof Dialog>;
|
|
24
|
+
|
|
25
|
+
export const PassiveModal: Story = {
|
|
26
|
+
name: "Type: passive modal",
|
|
27
|
+
render: function PassiveModalRender(_Story, context) {
|
|
28
|
+
const classNameFromGlobal = context.globals.theme;
|
|
29
|
+
const [target, setTarget] = useState<HTMLDivElement | null>(null);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div style={{ width: "100vw", height: "100vh" }}>
|
|
33
|
+
<div ref={(ref) => setTarget(ref)} />
|
|
34
|
+
<Dialog
|
|
35
|
+
className={classNameFromGlobal}
|
|
36
|
+
isOpen={Boolean(target)}
|
|
37
|
+
onClose={close}
|
|
38
|
+
type="passive"
|
|
39
|
+
title="Title area"
|
|
40
|
+
>
|
|
41
|
+
Lorem Ipsum is simply dummy text of the a printing and typesetting
|
|
42
|
+
industry
|
|
43
|
+
</Dialog>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const ActionModal: Story = {
|
|
50
|
+
name: "Type: action modal",
|
|
51
|
+
render: function ActionModalRender(_Story, context) {
|
|
52
|
+
const classNameFromGlobal = context.globals.theme;
|
|
53
|
+
const [target, setTarget] = useState<HTMLDivElement | null>(null);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div style={{ width: "100vw", height: "100vh" }}>
|
|
57
|
+
<div ref={(ref) => setTarget(ref)} />
|
|
58
|
+
<Dialog
|
|
59
|
+
className={classNameFromGlobal}
|
|
60
|
+
isOpen={Boolean(target)}
|
|
61
|
+
onClose={close}
|
|
62
|
+
type="action"
|
|
63
|
+
title="Title area"
|
|
64
|
+
actions={
|
|
65
|
+
<>
|
|
66
|
+
<Button
|
|
67
|
+
kind="ghost"
|
|
68
|
+
color="secondary"
|
|
69
|
+
size="medium"
|
|
70
|
+
onClick={close}
|
|
71
|
+
>
|
|
72
|
+
Cancel
|
|
73
|
+
</Button>
|
|
74
|
+
<Button kind="contained" size="medium" onClick={close}>
|
|
75
|
+
Save
|
|
76
|
+
</Button>
|
|
77
|
+
</>
|
|
78
|
+
}
|
|
79
|
+
>
|
|
80
|
+
Lorem Ipsum is simply dummy text of the a printing and typesetting
|
|
81
|
+
industry
|
|
82
|
+
</Dialog>
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const NonModal: Story = {
|
|
89
|
+
name: "Type: non modal",
|
|
90
|
+
render: function NonModalRender(_Story, context) {
|
|
91
|
+
const classNameFromGlobal = context.globals.theme;
|
|
92
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
93
|
+
function open() {
|
|
94
|
+
setIsOpen(true);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function close() {
|
|
98
|
+
setIsOpen(false);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<>
|
|
103
|
+
<Box sx={{ display: "flex", gap: "8px" }}>
|
|
104
|
+
<Button kind="contained" size="medium" onClick={open}>
|
|
105
|
+
Open to see Dialog
|
|
106
|
+
</Button>
|
|
107
|
+
<Button kind="contained" size="medium" onClick={close}>
|
|
108
|
+
click to close Dialog
|
|
109
|
+
</Button>
|
|
110
|
+
</Box>
|
|
111
|
+
|
|
112
|
+
<Dialog
|
|
113
|
+
className={classNameFromGlobal}
|
|
114
|
+
isOpen={isOpen}
|
|
115
|
+
nonModal
|
|
116
|
+
type="action"
|
|
117
|
+
onClose={close}
|
|
118
|
+
title="Title area"
|
|
119
|
+
actions={
|
|
120
|
+
<>
|
|
121
|
+
<Button
|
|
122
|
+
kind="ghost"
|
|
123
|
+
color="secondary"
|
|
124
|
+
size="medium"
|
|
125
|
+
onClick={close}
|
|
126
|
+
>
|
|
127
|
+
Cancel
|
|
128
|
+
</Button>
|
|
129
|
+
<Button kind="contained" size="medium" onClick={close}>
|
|
130
|
+
Save
|
|
131
|
+
</Button>
|
|
132
|
+
</>
|
|
133
|
+
}
|
|
134
|
+
>
|
|
135
|
+
Lorem Ipsum is simply dummy text of the a printing and typesetting
|
|
136
|
+
industry
|
|
137
|
+
</Dialog>
|
|
138
|
+
</>
|
|
139
|
+
);
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const SmallFalse: Story = {
|
|
144
|
+
name: "Option: small false",
|
|
145
|
+
render: function SmallFalseRender(_Story, context) {
|
|
146
|
+
const classNameFromGlobal = context.globals.theme;
|
|
147
|
+
const [target, setTarget] = useState<HTMLDivElement | null>(null);
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<div style={{ width: "100vw", height: "100vh" }}>
|
|
151
|
+
<div ref={(ref) => setTarget(ref)} />
|
|
152
|
+
<Dialog
|
|
153
|
+
className={classNameFromGlobal}
|
|
154
|
+
isOpen={Boolean(target)}
|
|
155
|
+
type="passive"
|
|
156
|
+
onClose={close}
|
|
157
|
+
title="Title area"
|
|
158
|
+
size="medium"
|
|
159
|
+
>
|
|
160
|
+
Lorem Ipsum is simply dummy text of the a printing and typesetting
|
|
161
|
+
industry
|
|
162
|
+
</Dialog>
|
|
163
|
+
</div>
|
|
164
|
+
);
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export const WithTitleIcon: Story = {
|
|
169
|
+
name: "Option: title icon",
|
|
170
|
+
render: function WithTitleIconRender(_Story, context) {
|
|
171
|
+
const classNameFromGlobal = context.globals.theme;
|
|
172
|
+
const [target, setTarget] = useState<HTMLDivElement | null>(null);
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
<div style={{ width: "100vw", height: "100vh" }}>
|
|
176
|
+
<div ref={(ref) => setTarget(ref)} />
|
|
177
|
+
<Dialog
|
|
178
|
+
className={classNameFromGlobal}
|
|
179
|
+
isOpen={Boolean(target)}
|
|
180
|
+
type="action"
|
|
181
|
+
onClose={close}
|
|
182
|
+
title="Title area"
|
|
183
|
+
titleIcon={<Error color="error" variant="filled" />}
|
|
184
|
+
actions={
|
|
185
|
+
<>
|
|
186
|
+
<Button
|
|
187
|
+
kind="ghost"
|
|
188
|
+
color="secondary"
|
|
189
|
+
size="medium"
|
|
190
|
+
onClick={close}
|
|
191
|
+
>
|
|
192
|
+
Cancel
|
|
193
|
+
</Button>
|
|
194
|
+
<Button
|
|
195
|
+
kind="contained"
|
|
196
|
+
color="error"
|
|
197
|
+
size="medium"
|
|
198
|
+
onClick={close}
|
|
199
|
+
>
|
|
200
|
+
Confirm
|
|
201
|
+
</Button>
|
|
202
|
+
</>
|
|
203
|
+
}
|
|
204
|
+
>
|
|
205
|
+
Lorem Ipsum is simply dummy text of the a printing and typesetting
|
|
206
|
+
industry
|
|
207
|
+
</Dialog>
|
|
208
|
+
</div>
|
|
209
|
+
);
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export const WithCustomStyle: Story = {
|
|
214
|
+
name: "Option: custom style",
|
|
215
|
+
render: function WithCustomStyleRender(_Story, context) {
|
|
216
|
+
const classNameFromGlobal = context.globals.theme;
|
|
217
|
+
const [target, setTarget] = useState<HTMLDivElement | null>(null);
|
|
218
|
+
|
|
219
|
+
return (
|
|
220
|
+
<div style={{ width: "100vw", height: "100vh" }}>
|
|
221
|
+
<div ref={(ref) => setTarget(ref)} />
|
|
222
|
+
<Dialog
|
|
223
|
+
className={classNameFromGlobal}
|
|
224
|
+
isOpen={Boolean(target)}
|
|
225
|
+
type="passive"
|
|
226
|
+
onClose={close}
|
|
227
|
+
title="Title area"
|
|
228
|
+
sx={{
|
|
229
|
+
"& .dialog-title-wrapper": {
|
|
230
|
+
border: "4px dashed red",
|
|
231
|
+
borderRadius: "10px",
|
|
232
|
+
backgroundColor: "green",
|
|
233
|
+
},
|
|
234
|
+
}}
|
|
235
|
+
>
|
|
236
|
+
Lorem Ipsum is simply dummy text of the a printing and typesetting
|
|
237
|
+
industry
|
|
238
|
+
</Dialog>
|
|
239
|
+
</div>
|
|
240
|
+
);
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export const WithScroll: Story = {
|
|
245
|
+
name: "Option: with scroll",
|
|
246
|
+
render: function WithScrollRender(_Story, context) {
|
|
247
|
+
const classNameFromGlobal = context.globals.theme;
|
|
248
|
+
const [target, setTarget] = useState<HTMLDivElement | null>(null);
|
|
249
|
+
|
|
250
|
+
return (
|
|
251
|
+
<div style={{ width: "100vw", height: "100vh" }}>
|
|
252
|
+
<div ref={(ref) => setTarget(ref)} />
|
|
253
|
+
<Dialog
|
|
254
|
+
className={classNameFromGlobal}
|
|
255
|
+
isOpen={Boolean(target)}
|
|
256
|
+
type="action"
|
|
257
|
+
onClose={close}
|
|
258
|
+
title="Title area"
|
|
259
|
+
actions={
|
|
260
|
+
<>
|
|
261
|
+
<Button
|
|
262
|
+
kind="ghost"
|
|
263
|
+
color="secondary"
|
|
264
|
+
size="medium"
|
|
265
|
+
onClick={close}
|
|
266
|
+
>
|
|
267
|
+
Cancel
|
|
268
|
+
</Button>
|
|
269
|
+
<Button
|
|
270
|
+
kind="contained"
|
|
271
|
+
color="error"
|
|
272
|
+
size="medium"
|
|
273
|
+
onClick={close}
|
|
274
|
+
>
|
|
275
|
+
Confirm
|
|
276
|
+
</Button>
|
|
277
|
+
</>
|
|
278
|
+
}
|
|
279
|
+
>
|
|
280
|
+
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quis,
|
|
281
|
+
suscipit at. Atque enim, hic architecto sequi libero deserunt dolores
|
|
282
|
+
omnis, cumque dignissimos ab animi. Recusandae saepe facere error
|
|
283
|
+
tempore quasi. Lorem ipsum dolor sit amet consectetur adipisicing
|
|
284
|
+
elit. Consectetur eius commodi deserunt reiciendis. Officia veniam
|
|
285
|
+
consequuntur doloribus debitis numquam ipsum autem, eos repellendus
|
|
286
|
+
eligendi esse voluptatum natus, cum optio? Unde! Lorem ipsum dolor sit
|
|
287
|
+
amet consectetur adipisicing elit. Quibusdam praesentium incidunt
|
|
288
|
+
tempora quam aut nulla corrupti ipsa voluptatem vitae soluta ex
|
|
289
|
+
officia, explicabo, voluptate porro. Eius mollitia veritatis corporis
|
|
290
|
+
neque. Lorem Ipsum is simply dummy text of the a printing and
|
|
291
|
+
typesetting industry Lorem ipsum dolor sit amet consectetur Lorem
|
|
292
|
+
ipsum dolor sit amet consectetur, adipisicing elit. Quis, suscipit at.
|
|
293
|
+
Atque enim, hic architecto sequi libero deserunt dolores omnis, cumque
|
|
294
|
+
dignissimos ab animi. Recusandae saepe facere error tempore quasi.
|
|
295
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Consectetur
|
|
296
|
+
eius commodi deserunt reiciendis. Officia veniam consequuntur
|
|
297
|
+
doloribus debitis numquam ipsum autem, eos repellendus eligendi esse
|
|
298
|
+
voluptatum natus, cum optio? Unde! Lorem ipsum dolor sit amet
|
|
299
|
+
consectetur adipisicing elit. Quibusdam praesentium incidunt tempora
|
|
300
|
+
quam aut nulla corrupti ipsa voluptatem vitae soluta ex officia,
|
|
301
|
+
explicabo, voluptate porro. Eius mollitia veritatis corporis neque.
|
|
302
|
+
Lorem Ipsum is simply dummy text of the a printing and typesetting
|
|
303
|
+
industry Lorem ipsum dolor sit amet consectetur Lorem ipsum dolor sit
|
|
304
|
+
amet consectetur, adipisicing elit. Quis, suscipit at. Atque enim, hic
|
|
305
|
+
architecto sequi libero deserunt dolores omnis, cumque dignissimos ab
|
|
306
|
+
animi. Recusandae saepe facere error tempore quasi. Lorem ipsum dolor
|
|
307
|
+
sit amet consectetur adipisicing elit. Consectetur eius commodi
|
|
308
|
+
deserunt reiciendis. Officia veniam consequuntur doloribus debitis
|
|
309
|
+
numquam ipsum autem, eos repellendus eligendi esse voluptatum natus,
|
|
310
|
+
cum optio? Unde! Lorem ipsum dolor sit amet consectetur adipisicing
|
|
311
|
+
elit. Quibusdam praesentium incidunt tempora quam aut nulla corrupti
|
|
312
|
+
ipsa voluptatem vitae soluta ex officia, explicabo, voluptate porro.
|
|
313
|
+
Eius mollitia veritatis corporis neque. Lorem Ipsum is simply dummy
|
|
314
|
+
text of the a printing and typesetting industry Lorem ipsum dolor sit
|
|
315
|
+
amet consectetur
|
|
316
|
+
</Dialog>
|
|
317
|
+
</div>
|
|
318
|
+
);
|
|
319
|
+
},
|
|
320
|
+
};
|