@crystallize/design-system 1.20.1 → 1.21.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/CHANGELOG.md +12 -0
- package/dist/chunk-QVHGXWBD.mjs +6022 -0
- package/dist/index.css +83 -472
- package/dist/index.d.ts +1 -22
- package/dist/index.js +37053 -35784
- package/dist/index.mjs +274 -9461
- package/dist/rich-text-editor-HJ3MS6B5.css +2366 -0
- package/dist/rich-text-editor-VCJEH7QE.mjs +3227 -0
- package/package.json +20 -20
- package/src/action-menu/action-menu.css +4 -0
- package/src/action-menu/action-menu.tsx +1 -1
- package/src/button/Button.stories.tsx +8 -1
- package/src/checkbox/checkbox.stories.tsx +13 -7
- package/src/colors/Colors.stories.tsx +37 -8
- package/src/dialog/Dialog.stories.tsx +4 -4
- package/src/dialog/confirm-dialog.tsx +1 -1
- package/src/dialog/dialog.css +10 -0
- package/src/dialog/dialog.tsx +1 -1
- package/src/dropdown-menu/DropdownMenu.stories.tsx +4 -4
- package/src/icon-button/IconButton.stories.tsx +9 -2
- package/src/iconography/Icon.stories.tsx +6 -3
- package/src/index.css +0 -11
- package/src/input-with-label/InputWithLabel.stories.tsx +1 -1
- package/src/popover/popover.stories.tsx +2 -2
- package/src/progress/progress.css +1 -1
- package/src/radio/radio.stories.tsx +75 -37
- package/src/rich-text-editor/index.tsx +15 -0
- package/src/rich-text-editor/plugins/DraggableBlockPlugin/index.css +1 -1
- package/src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.css +2 -1
- package/src/rich-text-editor/plugins/ToolbarPlugin/index.css +6 -1
- package/src/rich-text-editor/plugins/ToolbarPlugin/index.tsx +1 -1
- package/src/rich-text-editor/rich-text-editor.css +2 -1
- package/src/rich-text-editor/rich-text-editor.stories.tsx +9 -15
- package/src/rich-text-editor/rich-text-editor.tsx +2 -4
- package/src/rich-text-editor/tests/rich-text-editor-text-formats.test.tsx +11 -2
- package/src/rich-text-editor/themes/CrystallizeRTEditorTheme.css +8 -9
- package/src/select/select.css +2 -1
- package/src/select/select.stories.tsx +1 -1
- package/src/slider/Slider.stories.tsx +1 -1
- package/src/stack-icon/stack-icon.css +8 -0
- package/src/stack-icon/stack-icon.tsx +3 -5
- package/src/switch/Switch.stories.tsx +15 -9
- package/src/tag/tag.css +4 -0
- package/src/tag/tag.tsx +1 -1
- package/src/toast/toast.css +3 -1
- package/src/toast/toast.stories.tsx +2 -2
- package/src/tooltip/Tooltip.stories.tsx +20 -7
- package/src/tooltip/tooltip.css +2 -1
- package/tailwind.config.cjs +17 -1
- package/src/rich-text-editor/index.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crystallize/design-system",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.1",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -60,35 +60,35 @@
|
|
|
60
60
|
"@faker-js/faker": "7.6.0",
|
|
61
61
|
"@ianvs/prettier-plugin-sort-imports": "^3.7.1",
|
|
62
62
|
"@mdx-js/react": "^2.2.1",
|
|
63
|
-
"@storybook/addon-actions": "7.
|
|
64
|
-
"@storybook/addon-backgrounds": "7.
|
|
63
|
+
"@storybook/addon-actions": "7.6.2",
|
|
64
|
+
"@storybook/addon-backgrounds": "7.6.2",
|
|
65
65
|
"@storybook/addon-docs": "7.0.0-beta.14",
|
|
66
|
-
"@storybook/addon-essentials": "7.
|
|
67
|
-
"@storybook/addon-highlight": "7.
|
|
68
|
-
"@storybook/addon-interactions": "7.
|
|
69
|
-
"@storybook/addon-links": "7.
|
|
70
|
-
"@storybook/addon-measure": "7.
|
|
71
|
-
"@storybook/addon-outline": "7.
|
|
72
|
-
"@storybook/manager-api": "7.
|
|
73
|
-
"@storybook/react": "7.
|
|
74
|
-
"@storybook/react-vite": "7.
|
|
75
|
-
"@storybook/theming": "7.
|
|
76
|
-
"@testing-library/jest-dom": "
|
|
77
|
-
"@testing-library/react": "
|
|
78
|
-
"@testing-library/user-event": "14.
|
|
66
|
+
"@storybook/addon-essentials": "7.6.2",
|
|
67
|
+
"@storybook/addon-highlight": "7.6.2",
|
|
68
|
+
"@storybook/addon-interactions": "7.6.2",
|
|
69
|
+
"@storybook/addon-links": "7.6.2",
|
|
70
|
+
"@storybook/addon-measure": "7.6.2",
|
|
71
|
+
"@storybook/addon-outline": "7.6.2",
|
|
72
|
+
"@storybook/manager-api": "7.6.2",
|
|
73
|
+
"@storybook/react": "7.6.2",
|
|
74
|
+
"@storybook/react-vite": "7.6.2",
|
|
75
|
+
"@storybook/theming": "7.6.2",
|
|
76
|
+
"@testing-library/jest-dom": "6.1.5",
|
|
77
|
+
"@testing-library/react": "14.1.2",
|
|
78
|
+
"@testing-library/user-event": "14.5.1",
|
|
79
79
|
"@types/prettier": "2.7.2",
|
|
80
80
|
"@types/react": "17.0.1",
|
|
81
81
|
"@types/react-dom": "17.0.1",
|
|
82
|
-
"@types/testing-library__jest-dom": "5.14.5",
|
|
83
82
|
"@vitejs/plugin-react": "^3.0.1",
|
|
84
83
|
"concurrently": "^7.6.0",
|
|
85
84
|
"hex-rgb": "4.3.0",
|
|
86
85
|
"postcss": "^8.4.21",
|
|
86
|
+
"postcss-import": "^15.1.0",
|
|
87
87
|
"prettier": "2.8.4",
|
|
88
|
-
"storybook": "7.
|
|
88
|
+
"storybook": "7.6.2",
|
|
89
89
|
"storybook-addon-designs": "^6.3.1",
|
|
90
90
|
"storybook-dark-mode": "^2.0.5",
|
|
91
|
-
"tailwindcss": "^3.3.
|
|
91
|
+
"tailwindcss": "^3.3.5",
|
|
92
92
|
"tsup": "^6.5.0",
|
|
93
93
|
"typescript": "4.9.4",
|
|
94
94
|
"vite": "4.3.4",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
],
|
|
117
117
|
"scripts": {
|
|
118
118
|
"build:storybook": "storybook build -s public",
|
|
119
|
-
"build:tw": "tailwindcss
|
|
119
|
+
"build:tw": "tailwindcss -c ./tailwind.config.cjs -i src/index.css -o dist/index.css",
|
|
120
120
|
"build:tsup": "tsup src/index.ts --format esm,cjs --dts",
|
|
121
121
|
"build": "pnpm build:tw && pnpm build:tsup",
|
|
122
122
|
"dev:tw": "tailwindcss --content ./src/**/*.tsx,!./src/**/*.stories.tsx -c ./tailwind.config.cjs -i src/index.css -o dist/index.css --watch & tsup src/index.ts --format esm --dts --watch",
|
|
@@ -36,7 +36,7 @@ export function ActionMenu({ children, tabIndex, size, ...delegated }: ActionMen
|
|
|
36
36
|
tabIndex={tabIndex}
|
|
37
37
|
type="button"
|
|
38
38
|
>
|
|
39
|
-
<span className="
|
|
39
|
+
<span className="c-action-menu__trigger-text">Open more options</span>
|
|
40
40
|
<span className="c-action-menu-dot"></span>
|
|
41
41
|
<span className="c-action-menu-dot"></span>
|
|
42
42
|
<span className="c-action-menu-dot"></span>
|
|
@@ -30,7 +30,14 @@ export const AllButton: Story = {
|
|
|
30
30
|
render: () => {
|
|
31
31
|
return (
|
|
32
32
|
<div>
|
|
33
|
-
<div
|
|
33
|
+
<div
|
|
34
|
+
style={{
|
|
35
|
+
display: 'grid',
|
|
36
|
+
gridTemplateColumns: 'repeat(6, minmax(0, 1fr))',
|
|
37
|
+
gap: '1.5rem',
|
|
38
|
+
justifyItems: 'center',
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
34
41
|
{sizes.map(size =>
|
|
35
42
|
variants.map(variant =>
|
|
36
43
|
intent.map(intent => (
|
|
@@ -36,9 +36,11 @@ export const Controlled: Story = {
|
|
|
36
36
|
export const WithLabel: Story = {
|
|
37
37
|
render: () => {
|
|
38
38
|
return (
|
|
39
|
-
<div
|
|
39
|
+
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
40
40
|
<Checkbox id="with-label-c1" defaultChecked={true} />
|
|
41
|
-
<Label htmlFor="with-label-c1">
|
|
41
|
+
<Label style={{ marginLeft: '0.5rem' }} htmlFor="with-label-c1">
|
|
42
|
+
Accept terms and conditions.
|
|
43
|
+
</Label>
|
|
42
44
|
</div>
|
|
43
45
|
);
|
|
44
46
|
},
|
|
@@ -47,14 +49,18 @@ export const WithLabel: Story = {
|
|
|
47
49
|
export const Disabled: Story = {
|
|
48
50
|
render: () => {
|
|
49
51
|
return (
|
|
50
|
-
<div
|
|
51
|
-
<div
|
|
52
|
+
<div>
|
|
53
|
+
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
52
54
|
<Checkbox id="disabled-c1" defaultChecked={true} disabled />
|
|
53
|
-
<Label htmlFor="disabled-c1">
|
|
55
|
+
<Label style={{ marginLeft: '0.5rem' }} htmlFor="disabled-c1">
|
|
56
|
+
Accept terms and conditions.
|
|
57
|
+
</Label>
|
|
54
58
|
</div>
|
|
55
|
-
<div
|
|
59
|
+
<div style={{ display: 'flex', marginTop: '1rem', alignItems: 'center' }}>
|
|
56
60
|
<Checkbox id="disabled-c2" defaultChecked={false} disabled />
|
|
57
|
-
<Label htmlFor="disabled-c2">
|
|
61
|
+
<Label style={{ marginLeft: '0.5rem' }} htmlFor="disabled-c2">
|
|
62
|
+
Accept terms and conditions.
|
|
63
|
+
</Label>
|
|
58
64
|
</div>
|
|
59
65
|
</div>
|
|
60
66
|
);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { cx } from 'class-variance-authority';
|
|
2
1
|
import { useDarkMode } from 'storybook-dark-mode';
|
|
3
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
3
|
|
|
@@ -73,8 +72,8 @@ function ColorItem({ colorName, color }: { colorName: ColorName; color: Color })
|
|
|
73
72
|
|
|
74
73
|
return (
|
|
75
74
|
<div>
|
|
76
|
-
<h2
|
|
77
|
-
<div
|
|
75
|
+
<h2 style={{ color: 'rgb(var(--c-color-gray))' }}>{colorName}</h2>
|
|
76
|
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(10, minmax(0, 1fr))' }}>
|
|
78
77
|
{shades.map(shade => {
|
|
79
78
|
// @ts-expect-error
|
|
80
79
|
const def = color[shade] as string;
|
|
@@ -87,20 +86,50 @@ function ColorItem({ colorName, color }: { colorName: ColorName; color: Color })
|
|
|
87
86
|
return (
|
|
88
87
|
<div>
|
|
89
88
|
<div
|
|
90
|
-
style={{
|
|
91
|
-
|
|
89
|
+
style={{
|
|
90
|
+
background: def,
|
|
91
|
+
color: textColor,
|
|
92
|
+
display: 'flex',
|
|
93
|
+
position: 'relative',
|
|
94
|
+
flex: '1 1 0%',
|
|
95
|
+
justifyContent: 'center',
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
height: '6rem',
|
|
98
|
+
}}
|
|
92
99
|
>
|
|
93
100
|
{!isDefault ? null : (
|
|
94
101
|
<div
|
|
95
|
-
className="h-[8px] w-[8px] rounded"
|
|
96
102
|
style={{
|
|
103
|
+
width: 8,
|
|
104
|
+
height: 8,
|
|
97
105
|
backgroundColor: 'currentColor',
|
|
106
|
+
borderRadius: '0.25rem',
|
|
98
107
|
}}
|
|
99
108
|
/>
|
|
100
109
|
)}
|
|
101
|
-
<div
|
|
110
|
+
<div
|
|
111
|
+
style={{
|
|
112
|
+
position: 'absolute',
|
|
113
|
+
top: '0.5rem',
|
|
114
|
+
right: '0.5rem',
|
|
115
|
+
left: '0.5rem',
|
|
116
|
+
fontSize: '0.875rem',
|
|
117
|
+
lineHeight: '1.25rem',
|
|
118
|
+
textAlign: 'center',
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
{shade}
|
|
122
|
+
</div>
|
|
102
123
|
</div>
|
|
103
|
-
<div
|
|
124
|
+
<div
|
|
125
|
+
style={{
|
|
126
|
+
padding: '1rem',
|
|
127
|
+
fontSize: '0.875rem',
|
|
128
|
+
lineHeight: '1.25rem',
|
|
129
|
+
textAlign: 'center',
|
|
130
|
+
color: 'rgb(var(--c-color-gray))',
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
104
133
|
{applicatedAt.map(a => (
|
|
105
134
|
<div key={a.application}>{a.application}</div>
|
|
106
135
|
))}
|
|
@@ -15,7 +15,7 @@ export default meta;
|
|
|
15
15
|
type Story = StoryObj<typeof Dialog>;
|
|
16
16
|
|
|
17
17
|
const Lorem = () => (
|
|
18
|
-
<p
|
|
18
|
+
<p style={{ lineHeight: '1.5rem' }}>
|
|
19
19
|
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Reiciendis neque id, blanditiis exercitationem doloremque
|
|
20
20
|
quam ab minima architecto culpa.
|
|
21
21
|
</p>
|
|
@@ -30,7 +30,7 @@ export const Component: Story = {
|
|
|
30
30
|
<Dialog.Content>
|
|
31
31
|
<Dialog.Title>This is a normal Dialog</Dialog.Title>
|
|
32
32
|
<Dialog.Description>That is described in a declarative way</Dialog.Description>
|
|
33
|
-
<div
|
|
33
|
+
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
|
34
34
|
Here will go the main content
|
|
35
35
|
<ActionMenu>
|
|
36
36
|
<ActionMenu.Item onSelect={() => console.warn('Download')}>Download</ActionMenu.Item>
|
|
@@ -58,7 +58,7 @@ export const ComponentWithDangerAction: Story = {
|
|
|
58
58
|
<Lorem />
|
|
59
59
|
</Dialog.Description>
|
|
60
60
|
|
|
61
|
-
<div
|
|
61
|
+
<div style={{ display: 'flex', marginTop: '2rem', gap: '1rem', justifyContent: 'flex-end' }}>
|
|
62
62
|
<Button>Cancel</Button>
|
|
63
63
|
<Button intent="danger">Delete</Button>
|
|
64
64
|
</div>
|
|
@@ -76,7 +76,7 @@ export const ShowConfirm: Story = {
|
|
|
76
76
|
title: 'We need your confirmation',
|
|
77
77
|
description: 'In order to proceed to you account we need your confirmation',
|
|
78
78
|
content: (
|
|
79
|
-
<p
|
|
79
|
+
<p style={{ marginTop: '1.5rem', marginBottom: '1.5rem' }}>
|
|
80
80
|
We really like cookies and our cookies is what allow us to provide you with an awesome user experience. Do
|
|
81
81
|
you allow us to set some cookies for you?
|
|
82
82
|
</p>
|
|
@@ -59,7 +59,7 @@ export function ConfirmDialog({
|
|
|
59
59
|
{description && <Dialog.Description>{description}</Dialog.Description>}
|
|
60
60
|
{content}
|
|
61
61
|
{(displayOk || okCancel || displayCancel) && (
|
|
62
|
-
<div className="
|
|
62
|
+
<div className="c-dialog-content__buttons">
|
|
63
63
|
{cancelButton}
|
|
64
64
|
{okButton}
|
|
65
65
|
</div>
|
package/src/dialog/dialog.css
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
@apply fixed inset-0 z-[100] bg-overlay;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
&-icon-wrapper {
|
|
10
|
+
@apply flex h-[44px] w-[44px] min-w-[44px] items-center justify-center rounded-lg bg-gray-50-900 p-[5px];
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
&-icon {
|
|
10
14
|
@apply my-1 shrink-0;
|
|
11
15
|
}
|
|
@@ -25,4 +29,10 @@
|
|
|
25
29
|
&-with-icon {
|
|
26
30
|
@apply flex items-start gap-6 pl-6;
|
|
27
31
|
}
|
|
32
|
+
|
|
33
|
+
&-content {
|
|
34
|
+
&__buttons {
|
|
35
|
+
@apply mt-4 flex items-center justify-end gap-4;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
28
38
|
}
|
package/src/dialog/dialog.tsx
CHANGED
|
@@ -41,7 +41,7 @@ function DialogContent({ children, closable = true, type, className, container,
|
|
|
41
41
|
<DialogPrimitive.Overlay className="c-dialog-overlay" />
|
|
42
42
|
<DialogPrimitive.Content className={dialogContentStyles({ withIcon, class: className })} {...delegated}>
|
|
43
43
|
{IconComponent && (
|
|
44
|
-
<div className="
|
|
44
|
+
<div className="c-dialog-icon-wrapper">
|
|
45
45
|
<IconComponent className="c-dialog-icon" width={34} height={34} />
|
|
46
46
|
</div>
|
|
47
47
|
)}
|
|
@@ -14,15 +14,15 @@ function ContentWithIcon() {
|
|
|
14
14
|
<>
|
|
15
15
|
<DropdownMenu.Label>View</DropdownMenu.Label>
|
|
16
16
|
<DropdownMenu.Item>
|
|
17
|
-
<div
|
|
17
|
+
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
18
18
|
<Icon.Glasses width={24} height={24} />
|
|
19
|
-
<span
|
|
19
|
+
<span style={{ padding: '0 12px' }}>Nerdy</span>
|
|
20
20
|
</div>
|
|
21
21
|
</DropdownMenu.Item>
|
|
22
22
|
<DropdownMenu.Item>
|
|
23
|
-
<div
|
|
23
|
+
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
24
24
|
<Icon.GraphQL width={24} height={24} />
|
|
25
|
-
<span
|
|
25
|
+
<span style={{ padding: '0 12px' }}>Developer</span>
|
|
26
26
|
</div>
|
|
27
27
|
</DropdownMenu.Item>
|
|
28
28
|
</>
|
|
@@ -19,9 +19,16 @@ export const AllButton: Story = {
|
|
|
19
19
|
name: 'All Buttons',
|
|
20
20
|
render: () => {
|
|
21
21
|
return (
|
|
22
|
-
<div
|
|
22
|
+
<div
|
|
23
|
+
style={{
|
|
24
|
+
display: 'grid',
|
|
25
|
+
gridTemplateColumns: 'repeat(5, minmax(0, 1fr))',
|
|
26
|
+
gap: '1.5rem',
|
|
27
|
+
justifyItems: 'center',
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
23
30
|
{sizes.map(size => (
|
|
24
|
-
<Card>
|
|
31
|
+
<Card style={{ display: 'flex', alignItems: 'center' }}>
|
|
25
32
|
<IconButton size={size}>
|
|
26
33
|
<Icon.Cancel width={16} height={16} />
|
|
27
34
|
</IconButton>
|
|
@@ -20,14 +20,15 @@ export const AllIcons: Story = {
|
|
|
20
20
|
render: () => {
|
|
21
21
|
return (
|
|
22
22
|
<div>
|
|
23
|
-
<div
|
|
23
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '1.5rem' }}>
|
|
24
24
|
{Object.keys(Icon).map(iconName => {
|
|
25
25
|
// @ts-expect-error
|
|
26
26
|
const Cmp = Icon[iconName];
|
|
27
27
|
const cmpString = `<Icon.${iconName} />`;
|
|
28
28
|
return (
|
|
29
29
|
<div
|
|
30
|
-
className="
|
|
30
|
+
className="copy-icon-button"
|
|
31
|
+
style={{ width: '9rem', height: '9rem', textAlign: 'center', cursor: 'pointer' }}
|
|
31
32
|
onClick={() => {
|
|
32
33
|
const type = 'text/plain';
|
|
33
34
|
const blob = new Blob([cmpString], { type });
|
|
@@ -37,7 +38,9 @@ export const AllIcons: Story = {
|
|
|
37
38
|
<Card title={cmpString}>
|
|
38
39
|
<Cmp width={44} height={44} />
|
|
39
40
|
</Card>
|
|
40
|
-
<div
|
|
41
|
+
<div style={{ marginTop: '0.5rem', fontSize: '0.75rem', lineHeight: '1rem', whiteSpace: 'nowrap' }}>
|
|
42
|
+
{cmpString}
|
|
43
|
+
</div>
|
|
41
44
|
</div>
|
|
42
45
|
);
|
|
43
46
|
})}
|
package/src/index.css
CHANGED
|
@@ -28,7 +28,7 @@ type Story = StoryObj<typeof Popover>;
|
|
|
28
28
|
export const SimpleTemplate: Story = {
|
|
29
29
|
name: 'Simple Template',
|
|
30
30
|
render: args => (
|
|
31
|
-
<div
|
|
31
|
+
<div style={{ display: 'flex', paddingTop: '3.5rem', justifyContent: 'center', width: '50%' }}>
|
|
32
32
|
<Popover {...args} content="Content goes here">
|
|
33
33
|
<Icon.Customers width={32} height={32} />
|
|
34
34
|
</Popover>
|
|
@@ -39,7 +39,7 @@ export const SimpleTemplate: Story = {
|
|
|
39
39
|
export const WithCustomCloseButton: Story = {
|
|
40
40
|
name: 'With custom Close button',
|
|
41
41
|
render: () => (
|
|
42
|
-
<div
|
|
42
|
+
<div style={{ display: 'flex', paddingTop: '3.5rem', justifyContent: 'center', width: '50%' }}>
|
|
43
43
|
<Popover content="Content goes here" side="left" closeButton={<button>close</button>}>
|
|
44
44
|
<Icon.Customers width={32} height={32} />
|
|
45
45
|
</Popover>
|
|
@@ -14,21 +14,29 @@ export default meta;
|
|
|
14
14
|
|
|
15
15
|
type Story = StoryObj<typeof Radio.Group>;
|
|
16
16
|
|
|
17
|
+
const style = { display: 'flex', marginLeft: '0.5rem', alignItems: 'center' };
|
|
18
|
+
|
|
17
19
|
export const Example: Story = {
|
|
18
20
|
render: () => {
|
|
19
21
|
return (
|
|
20
22
|
<Radio.Group defaultValue="default">
|
|
21
|
-
<div
|
|
23
|
+
<div style={style}>
|
|
22
24
|
<Radio.Item value="default" id="example-r1" />
|
|
23
|
-
<Label htmlFor="example-r1">
|
|
25
|
+
<Label style={{ marginLeft: 4 }} htmlFor="example-r1">
|
|
26
|
+
Default
|
|
27
|
+
</Label>
|
|
24
28
|
</div>
|
|
25
|
-
<div
|
|
29
|
+
<div style={style}>
|
|
26
30
|
<Radio.Item value="comfortable" id="example-r2" />
|
|
27
|
-
<Label htmlFor="example-r2">
|
|
31
|
+
<Label style={{ marginLeft: 4 }} htmlFor="example-r2">
|
|
32
|
+
Comfortable
|
|
33
|
+
</Label>
|
|
28
34
|
</div>
|
|
29
|
-
<div
|
|
35
|
+
<div style={style}>
|
|
30
36
|
<Radio.Item value="compact" id="example-r3" />
|
|
31
|
-
<Label htmlFor="example-r3">
|
|
37
|
+
<Label style={{ marginLeft: 4 }} htmlFor="example-r3">
|
|
38
|
+
Compact
|
|
39
|
+
</Label>
|
|
32
40
|
</div>
|
|
33
41
|
</Radio.Group>
|
|
34
42
|
);
|
|
@@ -39,17 +47,23 @@ export const Uncontrolled: Story = {
|
|
|
39
47
|
render: () => {
|
|
40
48
|
return (
|
|
41
49
|
<Radio.Group defaultValue="default">
|
|
42
|
-
<div
|
|
50
|
+
<div style={style}>
|
|
43
51
|
<Radio.Item value="default" id="uncontrolled-r1" />
|
|
44
|
-
<Label htmlFor="uncontrolled-r1">
|
|
52
|
+
<Label style={{ marginLeft: 4 }} htmlFor="uncontrolled-r1">
|
|
53
|
+
Default
|
|
54
|
+
</Label>
|
|
45
55
|
</div>
|
|
46
|
-
<div
|
|
56
|
+
<div style={style}>
|
|
47
57
|
<Radio.Item value="comfortable" id="uncontrolled-r2" />
|
|
48
|
-
<Label htmlFor="uncontrolled-r2">
|
|
58
|
+
<Label style={{ marginLeft: 4 }} htmlFor="uncontrolled-r2">
|
|
59
|
+
Comfortable
|
|
60
|
+
</Label>
|
|
49
61
|
</div>
|
|
50
|
-
<div
|
|
62
|
+
<div style={style}>
|
|
51
63
|
<Radio.Item value="compact" id="uncontrolled-r3" />
|
|
52
|
-
<Label htmlFor="uncontrolled-r3">
|
|
64
|
+
<Label style={{ marginLeft: 4 }} htmlFor="uncontrolled-r3">
|
|
65
|
+
Compact
|
|
66
|
+
</Label>
|
|
53
67
|
</div>
|
|
54
68
|
</Radio.Group>
|
|
55
69
|
);
|
|
@@ -61,17 +75,23 @@ export const Controlled: Story = {
|
|
|
61
75
|
const [value, setValue] = useState('default');
|
|
62
76
|
return (
|
|
63
77
|
<Radio.Group value={value} onValueChange={v => setValue(v)}>
|
|
64
|
-
<div
|
|
78
|
+
<div style={style}>
|
|
65
79
|
<Radio.Item value="default" id="controlled-r1" />
|
|
66
|
-
<Label htmlFor="controlled-r1">
|
|
80
|
+
<Label style={{ marginLeft: 4 }} htmlFor="controlled-r1">
|
|
81
|
+
Default
|
|
82
|
+
</Label>
|
|
67
83
|
</div>
|
|
68
|
-
<div
|
|
84
|
+
<div style={style}>
|
|
69
85
|
<Radio.Item value="comfortable" id="controlled-r2" />
|
|
70
|
-
<Label htmlFor="controlled-r2">
|
|
86
|
+
<Label style={{ marginLeft: 4 }} htmlFor="controlled-r2">
|
|
87
|
+
Comfortable
|
|
88
|
+
</Label>
|
|
71
89
|
</div>
|
|
72
|
-
<div
|
|
90
|
+
<div style={style}>
|
|
73
91
|
<Radio.Item value="compact" id="controlled-r3" />
|
|
74
|
-
<Label htmlFor="controlled-r3">
|
|
92
|
+
<Label style={{ marginLeft: 4 }} htmlFor="controlled-r3">
|
|
93
|
+
Compact
|
|
94
|
+
</Label>
|
|
75
95
|
</div>
|
|
76
96
|
</Radio.Group>
|
|
77
97
|
);
|
|
@@ -81,18 +101,24 @@ export const Controlled: Story = {
|
|
|
81
101
|
export const Horizontal: Story = {
|
|
82
102
|
render: () => {
|
|
83
103
|
return (
|
|
84
|
-
<Radio.Group defaultValue="default" orientation="horizontal"
|
|
85
|
-
<div
|
|
104
|
+
<Radio.Group defaultValue="default" orientation="horizontal" style={{ display: 'flex' }}>
|
|
105
|
+
<div style={style}>
|
|
86
106
|
<Radio.Item value="default" id="horizontal-r1" />
|
|
87
|
-
<Label htmlFor="horizontal-r1">
|
|
107
|
+
<Label style={{ marginLeft: 4 }} htmlFor="horizontal-r1">
|
|
108
|
+
Default
|
|
109
|
+
</Label>
|
|
88
110
|
</div>
|
|
89
|
-
<div
|
|
111
|
+
<div style={{ ...style, margin: '0 1.5rem' }}>
|
|
90
112
|
<Radio.Item value="comfortable" id="horizontal-r2" />
|
|
91
|
-
<Label htmlFor="horizontal-r2">
|
|
113
|
+
<Label style={{ marginLeft: 4 }} htmlFor="horizontal-r2">
|
|
114
|
+
Comfortable
|
|
115
|
+
</Label>
|
|
92
116
|
</div>
|
|
93
|
-
<div
|
|
117
|
+
<div style={style}>
|
|
94
118
|
<Radio.Item value="compact" id="horizontal-r3" />
|
|
95
|
-
<Label htmlFor="horizontal-r3">
|
|
119
|
+
<Label style={{ marginLeft: 4 }} htmlFor="horizontal-r3">
|
|
120
|
+
Compact
|
|
121
|
+
</Label>
|
|
96
122
|
</div>
|
|
97
123
|
</Radio.Group>
|
|
98
124
|
);
|
|
@@ -103,17 +129,23 @@ export const NoLoop: Story = {
|
|
|
103
129
|
render: () => {
|
|
104
130
|
return (
|
|
105
131
|
<Radio.Group defaultValue="default" loop={false}>
|
|
106
|
-
<div
|
|
132
|
+
<div style={style}>
|
|
107
133
|
<Radio.Item value="default" id="noloop-r1" />
|
|
108
|
-
<Label htmlFor="noloop-r1">
|
|
134
|
+
<Label style={{ marginLeft: 4 }} htmlFor="noloop-r1">
|
|
135
|
+
Default
|
|
136
|
+
</Label>
|
|
109
137
|
</div>
|
|
110
|
-
<div
|
|
138
|
+
<div style={style}>
|
|
111
139
|
<Radio.Item value="comfortable" id="noloop-r2" />
|
|
112
|
-
<Label htmlFor="noloop-r2">
|
|
140
|
+
<Label style={{ marginLeft: 4 }} htmlFor="noloop-r2">
|
|
141
|
+
Comfortable
|
|
142
|
+
</Label>
|
|
113
143
|
</div>
|
|
114
|
-
<div
|
|
144
|
+
<div style={style}>
|
|
115
145
|
<Radio.Item value="compact" id="noloop-r3" />
|
|
116
|
-
<Label htmlFor="noloop-r3">
|
|
146
|
+
<Label style={{ marginLeft: 4 }} htmlFor="noloop-r3">
|
|
147
|
+
Compact
|
|
148
|
+
</Label>
|
|
117
149
|
</div>
|
|
118
150
|
</Radio.Group>
|
|
119
151
|
);
|
|
@@ -124,17 +156,23 @@ export const Disabled: Story = {
|
|
|
124
156
|
render: () => {
|
|
125
157
|
return (
|
|
126
158
|
<Radio.Group defaultValue="default">
|
|
127
|
-
<div
|
|
159
|
+
<div style={style}>
|
|
128
160
|
<Radio.Item value="default" id="disabled-r1" />
|
|
129
|
-
<Label htmlFor="disabled-r1">
|
|
161
|
+
<Label style={{ marginLeft: 4 }} htmlFor="disabled-r1">
|
|
162
|
+
Default
|
|
163
|
+
</Label>
|
|
130
164
|
</div>
|
|
131
|
-
<div
|
|
165
|
+
<div style={style}>
|
|
132
166
|
<Radio.Item value="comfortable" id="disabled-r2" disabled />
|
|
133
|
-
<Label htmlFor="disabled-r2">
|
|
167
|
+
<Label style={{ marginLeft: 4 }} htmlFor="disabled-r2">
|
|
168
|
+
Comfortable
|
|
169
|
+
</Label>
|
|
134
170
|
</div>
|
|
135
|
-
<div
|
|
171
|
+
<div style={style}>
|
|
136
172
|
<Radio.Item value="compact" id="disabled-r3" />
|
|
137
|
-
<Label htmlFor="disabled-r3">
|
|
173
|
+
<Label style={{ marginLeft: 4 }} htmlFor="disabled-r3">
|
|
174
|
+
Compact
|
|
175
|
+
</Label>
|
|
138
176
|
</div>
|
|
139
177
|
</Radio.Group>
|
|
140
178
|
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { lazy, Suspense } from 'react';
|
|
2
|
+
|
|
3
|
+
const LazyRichTextEditor = lazy(() => import('./rich-text-editor'));
|
|
4
|
+
|
|
5
|
+
// Export types
|
|
6
|
+
export type { CrystallizeRichText } from './types/crystallize-rich-text-types';
|
|
7
|
+
export * from './types/types';
|
|
8
|
+
|
|
9
|
+
export const RichTextEditor = (props: any) => {
|
|
10
|
+
return (
|
|
11
|
+
<Suspense fallback={null}>
|
|
12
|
+
<LazyRichTextEditor {...props} />
|
|
13
|
+
</Suspense>
|
|
14
|
+
);
|
|
15
|
+
};
|