Skip to content

Commit 1fcb4d1

Browse files
Axo dialog design updates & aria checks
1 parent 2838857 commit 1fcb4d1

39 files changed

+540
-247
lines changed

.eslint/rules/file-suffix.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ const DOM_PACKAGES = new Set([
150150
'blob-util',
151151
'blueimp-load-image',
152152
'copy-text-to-clipboard',
153+
'dom-accessibility-api',
153154
'fabric',
154155
'focus-trap-react',
155156
'radix-ui',

ACKNOWLEDGMENTS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3643,6 +3643,30 @@ Signal Desktop makes use of the following open source projects.
36433643
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
36443644
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36453645

3646+
## dom-accessibility-api
3647+
3648+
MIT License
3649+
3650+
Copyright (c) 2020 Sebastian Silbermann
3651+
3652+
Permission is hereby granted, free of charge, to any person obtaining a copy
3653+
of this software and associated documentation files (the "Software"), to deal
3654+
in the Software without restriction, including without limitation the rights
3655+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3656+
copies of the Software, and to permit persons to whom the Software is
3657+
furnished to do so, subject to the following conditions:
3658+
3659+
The above copyright notice and this permission notice shall be included in all
3660+
copies or substantial portions of the Software.
3661+
3662+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3663+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3664+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3665+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3666+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3667+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3668+
SOFTWARE.
3669+
36463670
## emoji-datasource
36473671

36483672
The MIT License (MIT)

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156
"credit-card-type": "10.0.2",
157157
"dashdash": "2.0.0",
158158
"direction": "1.0.4",
159+
"dom-accessibility-api": "0.7.0",
159160
"emoji-datasource": "16.0.0",
160161
"emoji-datasource-apple": "16.0.0",
161162
"emoji-regex": "10.4.0",

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

stylesheets/tailwind-config.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@
277277
--type-font-weight-title-small: var(--font-weight-semibold);
278278
--type-font-weight-body-large: var(--font-weight-regular);
279279
--type-font-weight-body-medium: var(--font-weight-regular);
280-
--type-font-weight-body-small: var(--font-weight-medium);
280+
--type-font-weight-body-small: var(--font-weight-regular);
281281
--type-font-weight-caption: var(--font-weight-regular);
282282
/* letter-spacing */
283283
--tracking-*: initial; /* reset defaults */

ts/axo/AriaClickable.dom.stories.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,7 @@ function CardButton(props: {
7878
}) {
7979
return (
8080
<AriaClickable.SubWidget>
81-
<AxoButton.Root
82-
variant={props.variant}
83-
size="medium"
84-
onClick={props.onClick}
85-
>
81+
<AxoButton.Root variant={props.variant} size="md" onClick={props.onClick}>
8682
{props.children}
8783
</AxoButton.Root>
8884
</AriaClickable.SubWidget>

ts/axo/AxoAlertDialog.dom.stories.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ const EXAMPLE_TITLE_LONG = (
2020
</>
2121
);
2222

23-
const EXAMPLE_DESCRIPTION = <>Exporting chat</>;
23+
const EXAMPLE_DESCRIPTION = (
24+
<>
25+
Your chat will be downloaded in the background. You can continue to use
26+
Signal during this process.
27+
</>
28+
);
2429
const EXAMPLE_DESCRIPTION_LONG = (
2530
<>
2631
Lorem ipsum dolor sit amet consectetur adipisicing elit. Nobis, amet aut
@@ -72,12 +77,11 @@ function Template(props: {
7277
return (
7378
<AxoAlertDialog.Root open={open} onOpenChange={setOpen}>
7479
<AxoAlertDialog.Trigger>
75-
<AxoButton.Root variant="subtle-primary" size="medium">
80+
<AxoButton.Root variant="subtle-primary" size="md">
7681
Open
7782
</AxoButton.Root>
7883
</AxoAlertDialog.Trigger>
7984
<AxoAlertDialog.Content
80-
size="md"
8185
escape={
8286
props.requireExplicitChoice
8387
? 'cancel-is-destructive'

ts/axo/AxoAlertDialog.dom.tsx

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type { AxoSymbol } from './AxoSymbol.dom.js';
1212

1313
const Namespace = 'AxoAlertDialog';
1414

15-
const { useContentEscapeBehavior, useContentSize } = AxoBaseDialog;
15+
const { useContentEscapeBehavior } = AxoBaseDialog;
1616

1717
/**
1818
* Displays a menu located at the pointer, triggered by a right click or a long press.
@@ -74,30 +74,29 @@ export namespace AxoAlertDialog {
7474
* --------------------------------
7575
*/
7676

77-
export type ContentSize = AxoBaseDialog.ContentSize;
7877
export type ContentEscape = AxoBaseDialog.ContentEscape;
79-
export type ContentProps = AxoBaseDialog.ContentProps;
78+
export type ContentProps = Readonly<{
79+
escape: ContentEscape;
80+
children: ReactNode;
81+
}>;
8082

8183
export const Content: FC<ContentProps> = memo(props => {
82-
const sizeConfig = AxoBaseDialog.ContentSizes[props.size];
8384
const handleContentEscapeEvent = useContentEscapeBehavior(props.escape);
8485
return (
85-
<AxoBaseDialog.ContentSizeProvider value={props.size}>
86-
<AlertDialog.Portal>
87-
<AlertDialog.Overlay className={AxoBaseDialog.overlayStyles}>
88-
<AlertDialog.Content
89-
onEscapeKeyDown={handleContentEscapeEvent}
90-
className={AxoBaseDialog.contentStyles}
91-
style={{
92-
minWidth: sizeConfig.minWidth,
93-
width: sizeConfig.width,
94-
}}
95-
>
96-
{props.children}
97-
</AlertDialog.Content>
98-
</AlertDialog.Overlay>
99-
</AlertDialog.Portal>
100-
</AxoBaseDialog.ContentSizeProvider>
86+
<AlertDialog.Portal>
87+
<AlertDialog.Overlay className={AxoBaseDialog.overlayStyles}>
88+
<AlertDialog.Content
89+
onEscapeKeyDown={handleContentEscapeEvent}
90+
className={AxoBaseDialog.contentStyles}
91+
style={{
92+
minWidth: 300,
93+
width: 300,
94+
}}
95+
>
96+
{props.children}
97+
</AlertDialog.Content>
98+
</AlertDialog.Overlay>
99+
</AlertDialog.Portal>
101100
);
102101
});
103102

@@ -113,14 +112,8 @@ export namespace AxoAlertDialog {
113112
}>;
114113

115114
export const Body: FC<BodyProps> = memo(props => {
116-
const contentSize = useContentSize();
117-
const contentSizeConfig = AxoBaseDialog.ContentSizes[contentSize];
118-
119115
return (
120-
<AxoScrollArea.Root
121-
maxHeight={contentSizeConfig.maxBodyHeight}
122-
scrollbarWidth="none"
123-
>
116+
<AxoScrollArea.Root maxHeight={440} scrollbarWidth="none">
124117
<AxoScrollArea.Hint edge="bottom" />
125118
<AxoScrollArea.Viewport>
126119
<AxoScrollArea.Content>
@@ -208,7 +201,7 @@ export namespace AxoAlertDialog {
208201
export const Cancel: FC<CancelProps> = memo(props => {
209202
return (
210203
<AlertDialog.Cancel asChild>
211-
<AxoButton.Root variant="secondary" size="medium" width="fill">
204+
<AxoButton.Root variant="secondary" size="md" width="full">
212205
{props.children}
213206
</AxoButton.Root>
214207
</AlertDialog.Cancel>
@@ -239,8 +232,8 @@ export namespace AxoAlertDialog {
239232
variant={props.variant}
240233
symbol={props.symbol}
241234
arrow={props.arrow}
242-
size="medium"
243-
width="fill"
235+
size="md"
236+
width="full"
244237
>
245238
{props.children}
246239
</AxoButton.Root>

ts/axo/AxoButton.dom.stories.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -145,23 +145,23 @@ const LONG_TEXT = (
145145

146146
function Fit(props: { longText?: boolean }) {
147147
return (
148-
<AxoButton.Root variant="primary" size="medium" width="fit">
148+
<AxoButton.Root variant="primary" size="md" width="fit">
149149
Fit {props.longText && LONG_TEXT}
150150
</AxoButton.Root>
151151
);
152152
}
153153

154154
function Grow(props: { longText?: boolean }) {
155155
return (
156-
<AxoButton.Root variant="affirmative" size="medium" width="grow">
156+
<AxoButton.Root variant="affirmative" size="md" width="grow">
157157
Grow {props.longText && LONG_TEXT}
158158
</AxoButton.Root>
159159
);
160160
}
161161

162-
function Fill(props: { longText?: boolean }) {
162+
function Full(props: { longText?: boolean }) {
163163
return (
164-
<AxoButton.Root variant="destructive" size="medium" width="fill">
164+
<AxoButton.Root variant="destructive" size="md" width="full">
165165
Fill {props.longText && LONG_TEXT}
166166
</AxoButton.Root>
167167
);
@@ -180,7 +180,7 @@ function WidthTestTemplate(props: {
180180
<>
181181
<Fit />
182182
<Grow />
183-
<Fill />
183+
<Full />
184184
</>
185185
)}
186186

@@ -239,26 +239,26 @@ function WidthTestTemplate(props: {
239239
<p>Fill</p>
240240
{props.children(
241241
<>
242-
<Fill />
243-
<Fill />
244-
<Fill />
242+
<Full />
243+
<Full />
244+
<Full />
245245
</>
246246
)}
247-
<p>Fill: With long text</p>
247+
<p>Full: With long text</p>
248248
{props.children(
249249
<>
250-
<Fill longText />
251-
<Fill longText />
252-
<Fill longText />
250+
<Full longText />
251+
<Full longText />
252+
<Full longText />
253253
</>
254254
)}
255255

256-
<p>Fill: With mixed length texts</p>
256+
<p>Full: With mixed length texts</p>
257257
{props.children(
258258
<>
259-
<Fill />
260-
<Fill />
261-
<Fill longText />
259+
<Full />
260+
<Full />
261+
<Full longText />
262262
</>
263263
)}
264264
</div>

ts/axo/AxoButton.dom.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ const AxoButtonVariants = {
128128
};
129129

130130
const AxoButtonSizes = {
131-
large: tw('min-w-16 px-4 py-2 type-body-medium font-medium'),
132-
medium: tw('min-w-14 px-3 py-1.5 type-body-medium font-medium'),
133-
small: tw('min-w-12 px-2 py-1 type-body-small font-medium'),
131+
lg: tw('min-w-16 px-4 py-2 type-body-medium font-medium'),
132+
md: tw('min-w-14 px-3 py-1.5 type-body-medium font-medium'),
133+
sm: tw('min-w-12 px-2 py-1 type-body-small font-medium'),
134134
} as const satisfies Record<string, TailwindStyles>;
135135

136136
type BaseButtonAttrs = Omit<
@@ -171,9 +171,9 @@ const AxoButtonSpinnerSizes: Record<
171171
AxoButtonSize,
172172
{ size: number; strokeWidth: number }
173173
> = {
174-
large: { size: 20, strokeWidth: 2 },
175-
medium: { size: 20, strokeWidth: 2 },
176-
small: { size: 16, strokeWidth: 1.5 },
174+
lg: { size: 20, strokeWidth: 2 },
175+
md: { size: 20, strokeWidth: 2 },
176+
sm: { size: 16, strokeWidth: 1.5 },
177177
};
178178

179179
type ExperimentalButtonSpinnerProps = Readonly<{
@@ -204,15 +204,15 @@ export namespace AxoButton {
204204
export type Variant = AxoButtonVariant;
205205
export type Size = AxoButtonSize;
206206

207-
export type Width = 'fit' | 'grow' | 'fill';
207+
export type Width = 'fit' | 'grow' | 'full';
208208

209209
const Widths: Record<Width, TailwindStyles> = {
210210
/* Always try to fit to the content of the button */
211211
fit: tw(''),
212212
/* Allow the button to grow within a flex container */
213213
grow: tw('grow'),
214214
/* Always try to fill the available space */
215-
fill: tw('w-full'),
215+
full: tw('w-full'),
216216
};
217217

218218
export type RootProps = BaseButtonAttrs &

0 commit comments

Comments
 (0)