@duro-app/ui 0.20.0 → 0.20.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/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.stories.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.stories.d.ts.map +1 -1
- package/dist/components/Drawer/useSwipeDismiss.d.ts.map +1 -1
- package/dist/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Dialog/Dialog.stories.tsx +5 -7
- package/src/components/Dialog/Dialog.tsx +1 -5
- package/src/components/Drawer/Drawer.stories.tsx +24 -21
- package/src/components/Drawer/Drawer.tsx +2 -9
- package/src/components/Drawer/useSwipeDismiss.ts +13 -6
- package/src/components/Table/Table.stories.tsx +1 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duro-app/ui",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@duro-app/tokens": "^0.20.
|
|
55
|
+
"@duro-app/tokens": "^0.20.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@babel/preset-typescript": "^7.28.0",
|
|
@@ -177,9 +177,7 @@ function FormDialogDemo() {
|
|
|
177
177
|
<Dialog.Title>Edit profile</Dialog.Title>
|
|
178
178
|
<Dialog.Close />
|
|
179
179
|
</Dialog.Header>
|
|
180
|
-
<Dialog.Description>
|
|
181
|
-
Update your display name and email address.
|
|
182
|
-
</Dialog.Description>
|
|
180
|
+
<Dialog.Description>Update your display name and email address.</Dialog.Description>
|
|
183
181
|
<Dialog.Body>
|
|
184
182
|
<Stack gap="md">
|
|
185
183
|
<Field.Root>
|
|
@@ -270,8 +268,8 @@ export const NonDismissable: Story = {
|
|
|
270
268
|
<Dialog.Body>
|
|
271
269
|
<Stack gap="md">
|
|
272
270
|
<Text>
|
|
273
|
-
You must accept the terms of service to continue. This dialog cannot be
|
|
274
|
-
|
|
271
|
+
You must accept the terms of service to continue. This dialog cannot be dismissed by
|
|
272
|
+
clicking outside or pressing Escape.
|
|
275
273
|
</Text>
|
|
276
274
|
<Text variant="bodySm" color="muted">
|
|
277
275
|
Try clicking the backdrop or pressing Escape — the dialog stays open.
|
|
@@ -309,8 +307,8 @@ function BackdropDismissDemo() {
|
|
|
309
307
|
</Dialog.Header>
|
|
310
308
|
<Dialog.Body>
|
|
311
309
|
<Text>
|
|
312
|
-
Click the dark backdrop behind this dialog to dismiss it.
|
|
313
|
-
|
|
310
|
+
Click the dark backdrop behind this dialog to dismiss it. You can also press Escape or
|
|
311
|
+
use the close button.
|
|
314
312
|
</Text>
|
|
315
313
|
</Dialog.Body>
|
|
316
314
|
</Dialog.Portal>
|
|
@@ -278,11 +278,7 @@ function Close({children, 'aria-label': ariaLabel = 'Close'}: CloseProps) {
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
return (
|
|
281
|
-
<html.button
|
|
282
|
-
onClick={requestClose}
|
|
283
|
-
aria-label={ariaLabel}
|
|
284
|
-
style={styles.closeButton}
|
|
285
|
-
>
|
|
281
|
+
<html.button onClick={requestClose} aria-label={ariaLabel} style={styles.closeButton}>
|
|
286
282
|
<svg width={16} height={16} viewBox="0 0 16 16" fill="none">
|
|
287
283
|
<path
|
|
288
284
|
d="M4 4l8 8M12 4l-8 8"
|
|
@@ -31,8 +31,8 @@ export const Default: Story = {
|
|
|
31
31
|
</Drawer.Header>
|
|
32
32
|
<Drawer.Body>
|
|
33
33
|
<Text>
|
|
34
|
-
This drawer slides in from the right edge. It's useful for showing details,
|
|
35
|
-
|
|
34
|
+
This drawer slides in from the right edge. It's useful for showing details, settings
|
|
35
|
+
panels, or supplementary content without leaving the current page.
|
|
36
36
|
</Text>
|
|
37
37
|
</Drawer.Body>
|
|
38
38
|
<Drawer.Footer>
|
|
@@ -93,9 +93,15 @@ export const BottomAnchor: Story = {
|
|
|
93
93
|
</Drawer.Header>
|
|
94
94
|
<Drawer.Body>
|
|
95
95
|
<Stack gap="sm">
|
|
96
|
-
<Button variant="secondary" fullWidth>
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
<Button variant="secondary" fullWidth>
|
|
97
|
+
Share
|
|
98
|
+
</Button>
|
|
99
|
+
<Button variant="secondary" fullWidth>
|
|
100
|
+
Duplicate
|
|
101
|
+
</Button>
|
|
102
|
+
<Button variant="danger" fullWidth>
|
|
103
|
+
Delete
|
|
104
|
+
</Button>
|
|
99
105
|
</Stack>
|
|
100
106
|
</Drawer.Body>
|
|
101
107
|
</Drawer.Portal>
|
|
@@ -125,7 +131,10 @@ function SizesDemo() {
|
|
|
125
131
|
<Drawer.Close />
|
|
126
132
|
</Drawer.Header>
|
|
127
133
|
<Drawer.Body>
|
|
128
|
-
<Text>
|
|
134
|
+
<Text>
|
|
135
|
+
This drawer uses the {s} size preset (
|
|
136
|
+
{s === 'sm' ? '360' : s === 'md' ? '480' : '640'}px max-width).
|
|
137
|
+
</Text>
|
|
129
138
|
</Drawer.Body>
|
|
130
139
|
<Drawer.Footer>
|
|
131
140
|
<Drawer.Close>
|
|
@@ -164,9 +173,7 @@ function FormDrawerDemo() {
|
|
|
164
173
|
<Drawer.Title>Edit profile</Drawer.Title>
|
|
165
174
|
<Drawer.Close />
|
|
166
175
|
</Drawer.Header>
|
|
167
|
-
<Drawer.Description>
|
|
168
|
-
Update your account information below.
|
|
169
|
-
</Drawer.Description>
|
|
176
|
+
<Drawer.Description>Update your account information below.</Drawer.Description>
|
|
170
177
|
<Drawer.Body>
|
|
171
178
|
<Stack gap="md">
|
|
172
179
|
<Field.Root>
|
|
@@ -269,8 +276,8 @@ export const NonDismissable: Story = {
|
|
|
269
276
|
<Drawer.Body>
|
|
270
277
|
<Stack gap="md">
|
|
271
278
|
<Text>
|
|
272
|
-
This drawer cannot be dismissed by clicking the backdrop or pressing Escape.
|
|
273
|
-
|
|
279
|
+
This drawer cannot be dismissed by clicking the backdrop or pressing Escape. You must
|
|
280
|
+
use the explicit close action below.
|
|
274
281
|
</Text>
|
|
275
282
|
<Text variant="bodySm" color="muted">
|
|
276
283
|
Try clicking outside or pressing Escape — nothing happens.
|
|
@@ -302,8 +309,8 @@ export const NoSwipeDismiss: Story = {
|
|
|
302
309
|
</Drawer.Header>
|
|
303
310
|
<Drawer.Body>
|
|
304
311
|
<Text>
|
|
305
|
-
This bottom drawer has swipe-to-dismiss disabled. On mobile, you cannot
|
|
306
|
-
|
|
312
|
+
This bottom drawer has swipe-to-dismiss disabled. On mobile, you cannot swipe down to
|
|
313
|
+
close it — use the close button or tap the backdrop instead.
|
|
307
314
|
</Text>
|
|
308
315
|
</Drawer.Body>
|
|
309
316
|
</Drawer.Portal>
|
|
@@ -326,12 +333,10 @@ export const SwipeDismiss: Story = {
|
|
|
326
333
|
</Drawer.Header>
|
|
327
334
|
<Drawer.Body>
|
|
328
335
|
<Stack gap="md">
|
|
329
|
-
<Text>
|
|
330
|
-
Drag this drawer downward to dismiss it. The backdrop fades as you drag.
|
|
331
|
-
</Text>
|
|
336
|
+
<Text>Drag this drawer downward to dismiss it. The backdrop fades as you drag.</Text>
|
|
332
337
|
<Text variant="bodySm" color="muted">
|
|
333
|
-
Swipe past 30% of the panel height or flick quickly to dismiss.
|
|
334
|
-
|
|
338
|
+
Swipe past 30% of the panel height or flick quickly to dismiss. Otherwise it snaps
|
|
339
|
+
back.
|
|
335
340
|
</Text>
|
|
336
341
|
</Stack>
|
|
337
342
|
</Drawer.Body>
|
|
@@ -354,9 +359,7 @@ export const SwipeDismissRight: Story = {
|
|
|
354
359
|
<Drawer.Close />
|
|
355
360
|
</Drawer.Header>
|
|
356
361
|
<Drawer.Body>
|
|
357
|
-
<Text>
|
|
358
|
-
Drag this panel to the right to dismiss it. Works with touch and mouse.
|
|
359
|
-
</Text>
|
|
362
|
+
<Text>Drag this panel to the right to dismiss it. Works with touch and mouse.</Text>
|
|
360
363
|
</Drawer.Body>
|
|
361
364
|
</Drawer.Portal>
|
|
362
365
|
</Drawer.Root>
|
|
@@ -252,10 +252,7 @@ function Portal({children, size = 'md'}: PortalProps) {
|
|
|
252
252
|
/>
|
|
253
253
|
|
|
254
254
|
{/* Viewport */}
|
|
255
|
-
<html.div
|
|
256
|
-
style={[styles.viewport, viewportAnchorMap[anchor]]}
|
|
257
|
-
data-drawer-viewport=""
|
|
258
|
-
>
|
|
255
|
+
<html.div style={[styles.viewport, viewportAnchorMap[anchor]]} data-drawer-viewport="">
|
|
259
256
|
<html.div
|
|
260
257
|
ref={panelRef}
|
|
261
258
|
role="dialog"
|
|
@@ -338,11 +335,7 @@ function Close({children, 'aria-label': ariaLabel = 'Close'}: CloseProps) {
|
|
|
338
335
|
}
|
|
339
336
|
|
|
340
337
|
return (
|
|
341
|
-
<html.button
|
|
342
|
-
onClick={requestClose}
|
|
343
|
-
aria-label={ariaLabel}
|
|
344
|
-
style={styles.closeButton}
|
|
345
|
-
>
|
|
338
|
+
<html.button onClick={requestClose} aria-label={ariaLabel} style={styles.closeButton}>
|
|
346
339
|
<svg width={16} height={16} viewBox="0 0 16 16" fill="none">
|
|
347
340
|
<path
|
|
348
341
|
d="M4 4l8 8M12 4l-8 8"
|
|
@@ -97,9 +97,7 @@ export function useSwipeDismiss({anchor, enabled, onDismiss, panelRef}: UseSwipe
|
|
|
97
97
|
|
|
98
98
|
panelEl.style.transform = ''
|
|
99
99
|
panelEl.style.boxShadow =
|
|
100
|
-
shadowSpread > 0
|
|
101
|
-
? `0 0 ${shadowSpread * 2}px ${shadowSpread}px rgba(0, 0, 0, 0.15)`
|
|
102
|
-
: ''
|
|
100
|
+
shadowSpread > 0 ? `0 0 ${shadowSpread * 2}px ${shadowSpread}px rgba(0, 0, 0, 0.15)` : ''
|
|
103
101
|
}
|
|
104
102
|
},
|
|
105
103
|
[anchor, isHorizontal],
|
|
@@ -255,8 +253,7 @@ export function useSwipeDismiss({anchor, enabled, onDismiss, panelRef}: UseSwipe
|
|
|
255
253
|
}
|
|
256
254
|
|
|
257
255
|
const fraction = movement / state.panelSize
|
|
258
|
-
const shouldDismiss =
|
|
259
|
-
fraction > DISMISS_THRESHOLD || velocity > VELOCITY_THRESHOLD
|
|
256
|
+
const shouldDismiss = fraction > DISMISS_THRESHOLD || velocity > VELOCITY_THRESHOLD
|
|
260
257
|
|
|
261
258
|
if (shouldDismiss) {
|
|
262
259
|
animateDismiss(panel!)
|
|
@@ -291,5 +288,15 @@ export function useSwipeDismiss({anchor, enabled, onDismiss, panelRef}: UseSwipe
|
|
|
291
288
|
panel.removeEventListener('pointercancel', handlePointerCancel)
|
|
292
289
|
panel.removeEventListener('touchmove', handleTouchMove)
|
|
293
290
|
}
|
|
294
|
-
}, [
|
|
291
|
+
}, [
|
|
292
|
+
enabled,
|
|
293
|
+
panelRef,
|
|
294
|
+
anchor,
|
|
295
|
+
isHorizontal,
|
|
296
|
+
getMovement,
|
|
297
|
+
applyTransform,
|
|
298
|
+
resetStyles,
|
|
299
|
+
animateSnapBack,
|
|
300
|
+
animateDismiss,
|
|
301
|
+
])
|
|
295
302
|
}
|
|
@@ -271,10 +271,7 @@ function CheckboxTableDemo() {
|
|
|
271
271
|
</Table.Body>
|
|
272
272
|
</Table.Root>
|
|
273
273
|
|
|
274
|
-
<ActionBar
|
|
275
|
-
selectedItemCount={selected.size}
|
|
276
|
-
onClearSelection={() => setSelected(new Set())}
|
|
277
|
-
>
|
|
274
|
+
<ActionBar selectedItemCount={selected.size} onClearSelection={() => setSelected(new Set())}>
|
|
278
275
|
<Button variant="danger" size="small">
|
|
279
276
|
Delete
|
|
280
277
|
</Button>
|