@moises.ai/design-system 3.12.3 → 3.13.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/package.json
CHANGED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import classNames from 'classnames'
|
|
2
|
+
import { Dialog, Flex } from '@radix-ui/themes'
|
|
3
|
+
import { CloseIcon } from '../../icons/CloseIcon'
|
|
4
|
+
import styles from './SpecialDialog.module.css'
|
|
5
|
+
|
|
6
|
+
export const SpecialDialog = ({
|
|
7
|
+
title,
|
|
8
|
+
description,
|
|
9
|
+
open,
|
|
10
|
+
onOpenChange,
|
|
11
|
+
children,
|
|
12
|
+
icon,
|
|
13
|
+
image,
|
|
14
|
+
imageAlt = '',
|
|
15
|
+
className,
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
const showImage = Boolean(image)
|
|
19
|
+
const showIcon = Boolean(icon) && !showImage
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Dialog.Root open={open} onOpenChange={onOpenChange}>
|
|
23
|
+
<Dialog.Content
|
|
24
|
+
className={classNames(styles.content, className)}
|
|
25
|
+
{...props}
|
|
26
|
+
>
|
|
27
|
+
<div className={styles.hero}>
|
|
28
|
+
{showImage ? (
|
|
29
|
+
<img
|
|
30
|
+
className={styles.heroImage}
|
|
31
|
+
src={image}
|
|
32
|
+
alt={imageAlt}
|
|
33
|
+
/>
|
|
34
|
+
) : null}
|
|
35
|
+
{showIcon ? <div className={styles.heroIcon}>{icon}</div> : null}
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<Dialog.Close asChild>
|
|
39
|
+
<button
|
|
40
|
+
type="button"
|
|
41
|
+
className={styles.close}
|
|
42
|
+
aria-label="Close"
|
|
43
|
+
>
|
|
44
|
+
<CloseIcon width={18} height={18} color="white" />
|
|
45
|
+
</button>
|
|
46
|
+
</Dialog.Close>
|
|
47
|
+
|
|
48
|
+
<Flex p="5" align="center" direction="column" gap="5">
|
|
49
|
+
<Flex align="center" direction="column" gap="2">
|
|
50
|
+
<Dialog.Title size="5" align="center" weight="bold" mb="0">
|
|
51
|
+
{title}
|
|
52
|
+
</Dialog.Title>
|
|
53
|
+
<Dialog.Description align="center" size="2" mb="0">
|
|
54
|
+
{description}
|
|
55
|
+
</Dialog.Description>
|
|
56
|
+
</Flex>
|
|
57
|
+
|
|
58
|
+
{children}
|
|
59
|
+
</Flex>
|
|
60
|
+
</Dialog.Content>
|
|
61
|
+
</Dialog.Root>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
SpecialDialog.displayName = 'SpecialDialog'
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* Overrides Radix .rt-BaseDialogContent (shadow reads as an outline) */
|
|
2
|
+
.content {
|
|
3
|
+
position: relative;
|
|
4
|
+
width: 360px;
|
|
5
|
+
max-width: 360px;
|
|
6
|
+
padding: 0;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
border: none !important;
|
|
9
|
+
outline: none !important;
|
|
10
|
+
box-shadow: none !important;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.content:focus,
|
|
14
|
+
.content:focus-visible {
|
|
15
|
+
outline: none !important;
|
|
16
|
+
box-shadow: none !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.hero {
|
|
20
|
+
position: relative;
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
height: 180px;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
background: linear-gradient(180deg, #013641 0%, #011a1f 100%);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.heroImage {
|
|
30
|
+
position: absolute;
|
|
31
|
+
inset: 0;
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 100%;
|
|
34
|
+
object-fit: cover;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.heroIcon {
|
|
38
|
+
position: relative;
|
|
39
|
+
z-index: 1;
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.close {
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: 16px;
|
|
48
|
+
right: 16px;
|
|
49
|
+
z-index: 2;
|
|
50
|
+
margin: 0;
|
|
51
|
+
padding: 0;
|
|
52
|
+
border: none;
|
|
53
|
+
background: transparent;
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
color: var(--gray-1, #fcfcfd);
|
|
56
|
+
display: inline-flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
line-height: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.close:focus-visible {
|
|
63
|
+
outline: 2px solid var(--cyan-8, #00a2c7);
|
|
64
|
+
outline-offset: 2px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.close:hover {
|
|
68
|
+
opacity: 0.88;
|
|
69
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { StarFilledIcon } from '@radix-ui/react-icons'
|
|
3
|
+
import { fn } from '@storybook/test'
|
|
4
|
+
import { SpecialDialog } from './SpecialDialog'
|
|
5
|
+
import { Button } from '../Button/Button'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Components/SpecialDialog',
|
|
9
|
+
component: SpecialDialog,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: `
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
\`\`\`jsx
|
|
18
|
+
import { SpecialDialog, Button } from '@moises.ai/design-system'
|
|
19
|
+
|
|
20
|
+
const MyComponent = () => {
|
|
21
|
+
const [open, setOpen] = useState(false)
|
|
22
|
+
return (
|
|
23
|
+
<>
|
|
24
|
+
<Button type="button" onClick={() => setOpen(true)}>
|
|
25
|
+
Open dialog
|
|
26
|
+
</Button>
|
|
27
|
+
<SpecialDialog
|
|
28
|
+
open={open}
|
|
29
|
+
onOpenChange={setOpen}
|
|
30
|
+
icon={<StarFilledIcon width={48} height={48} color="white" />}
|
|
31
|
+
title="Special Dialog"
|
|
32
|
+
description="This is a special dialog"
|
|
33
|
+
>
|
|
34
|
+
<Button variant="solid" color="cyan">Action</Button>
|
|
35
|
+
</SpecialDialog>
|
|
36
|
+
</>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
\`\`\`
|
|
40
|
+
`,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
tags: ['autodocs'],
|
|
45
|
+
argTypes: {
|
|
46
|
+
children: {
|
|
47
|
+
description:
|
|
48
|
+
'The dialog content - can be button, text or icon',
|
|
49
|
+
control: { type: 'text' },
|
|
50
|
+
table: {
|
|
51
|
+
type: { summary: 'React.ReactNode' },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
open: {
|
|
55
|
+
description: 'When true, the dialog is visible (controlled)',
|
|
56
|
+
control: { type: 'boolean' },
|
|
57
|
+
table: {
|
|
58
|
+
type: { summary: 'boolean' },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
onOpenChange: {
|
|
62
|
+
action: 'openChange',
|
|
63
|
+
description: 'Called with the next open state (use to sync controlled `open`)',
|
|
64
|
+
table: {
|
|
65
|
+
type: { summary: '(open: boolean) => void' },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
icon: {
|
|
69
|
+
description:
|
|
70
|
+
'Optional icon centered in the header area (ignored if `image` is set)',
|
|
71
|
+
control: { disable: true },
|
|
72
|
+
table: {
|
|
73
|
+
type: { summary: 'React.ReactNode' },
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
image: {
|
|
77
|
+
description: 'Optional image URL for the header; `object-fit: cover`, fills the 180px header',
|
|
78
|
+
control: { type: 'text' },
|
|
79
|
+
table: {
|
|
80
|
+
type: { summary: 'string' },
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
imageAlt: {
|
|
84
|
+
description: 'Alt text for the header image',
|
|
85
|
+
control: { type: 'text' },
|
|
86
|
+
table: {
|
|
87
|
+
type: { summary: 'string' },
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export const Default = {
|
|
94
|
+
render: (args) => {
|
|
95
|
+
const [open, setOpen] = useState(false)
|
|
96
|
+
const onOpenChange = (next) => {
|
|
97
|
+
setOpen(next)
|
|
98
|
+
args.onOpenChange?.(next)
|
|
99
|
+
}
|
|
100
|
+
return (
|
|
101
|
+
<>
|
|
102
|
+
<Button type="button" variant="solid" color="cyan" onClick={() => setOpen(true)}>
|
|
103
|
+
Open dialog
|
|
104
|
+
</Button>
|
|
105
|
+
|
|
106
|
+
<SpecialDialog {...args} open={open} onOpenChange={onOpenChange}>
|
|
107
|
+
<Button size="4" variant="solid" color="cyan" style={{ width: '100%' }}>Action</Button>
|
|
108
|
+
</SpecialDialog>
|
|
109
|
+
</>
|
|
110
|
+
)
|
|
111
|
+
},
|
|
112
|
+
args: {
|
|
113
|
+
onOpenChange: fn(),
|
|
114
|
+
icon: <StarFilledIcon width={48} height={48} color="white" />,
|
|
115
|
+
title: 'Special Dialog',
|
|
116
|
+
description: 'This is a special dialog',
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const WithHeaderImage = {
|
|
121
|
+
render: (args) => {
|
|
122
|
+
const [open, setOpen] = useState(false)
|
|
123
|
+
const onOpenChange = (next) => {
|
|
124
|
+
setOpen(next)
|
|
125
|
+
args.onOpenChange?.(next)
|
|
126
|
+
}
|
|
127
|
+
return (
|
|
128
|
+
<>
|
|
129
|
+
<Button type="button" variant="solid" color="cyan" onClick={() => setOpen(true)}>
|
|
130
|
+
Open dialog
|
|
131
|
+
</Button>
|
|
132
|
+
<SpecialDialog {...args} open={open} onOpenChange={onOpenChange}>
|
|
133
|
+
<Button size="4" variant="solid" color="cyan" style={{ width: '100%' }}>Action</Button>
|
|
134
|
+
</SpecialDialog>
|
|
135
|
+
</>
|
|
136
|
+
)
|
|
137
|
+
},
|
|
138
|
+
args: {
|
|
139
|
+
onOpenChange: fn(),
|
|
140
|
+
image:
|
|
141
|
+
'https://images.unsplash.com/photo-1511379938547-c1f69419868d?w=720&h=360&fit=crop',
|
|
142
|
+
imageAlt: 'Studio headphones',
|
|
143
|
+
title: 'Special Dialog',
|
|
144
|
+
description: 'Header uses an image with cover fit. Example action button is full width.',
|
|
145
|
+
},
|
|
146
|
+
}
|
package/src/index.jsx
CHANGED
|
@@ -148,3 +148,4 @@ export { TrackHeader } from './components/TrackHeader/TrackHeader'
|
|
|
148
148
|
export { useForm } from './components/useForm/useForm'
|
|
149
149
|
export { VoiceConversionForm } from './components/VoiceConversionForm/VoiceConversionForm'
|
|
150
150
|
export { Waveform } from './components/VoiceConversionForm/Waveform/Waveform'
|
|
151
|
+
export { SpecialDialog } from './components/SpecialDialog/SpecialDialog'
|