paris 0.8.0 → 0.8.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
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "paris",
|
|
3
3
|
"author": "Sanil Chawla <sanil@slingshot.fm> (https://sanil.co)",
|
|
4
4
|
"description": "Paris is Slingshot's React design system. It's a collection of reusable components, design tokens, and guidelines that help us build consistent, accessible, and performant user interfaces.",
|
|
5
|
-
"version": "0.8.
|
|
5
|
+
"version": "0.8.1",
|
|
6
6
|
"homepage": "https://paris.slingshot.fm",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|
|
@@ -292,11 +292,11 @@ $panelAnimationDelay: var(--pte-animations-duration-fast);
|
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
.
|
|
295
|
+
.paginationTitle {
|
|
296
296
|
display: flex;
|
|
297
297
|
flex-direction: row;
|
|
298
298
|
align-items: center;
|
|
299
|
-
gap:
|
|
299
|
+
gap: 12px;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
.enter {
|
|
@@ -42,7 +42,6 @@ export const Default: Story = {
|
|
|
42
42
|
|
|
43
43
|
export const Paginated: Story = {
|
|
44
44
|
args: {
|
|
45
|
-
title: 'Creation process',
|
|
46
45
|
children: [],
|
|
47
46
|
},
|
|
48
47
|
render: (args) => {
|
|
@@ -50,6 +49,12 @@ export const Paginated: Story = {
|
|
|
50
49
|
const pages = ['step1', 'step2', 'step3'] as const;
|
|
51
50
|
const pagination = usePagination<typeof pages>('step1');
|
|
52
51
|
|
|
52
|
+
const currentPageTitle = {
|
|
53
|
+
step1: 'Step 1',
|
|
54
|
+
step2: 'Step 2',
|
|
55
|
+
step3: 'Step 3',
|
|
56
|
+
}[pagination.currentPage];
|
|
57
|
+
|
|
53
58
|
return (
|
|
54
59
|
<>
|
|
55
60
|
<Button
|
|
@@ -62,6 +67,7 @@ export const Paginated: Story = {
|
|
|
62
67
|
isOpen={isOpen}
|
|
63
68
|
onClose={setIsOpen}
|
|
64
69
|
pagination={pagination}
|
|
70
|
+
title={currentPageTitle}
|
|
65
71
|
>
|
|
66
72
|
<div key="step1" style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
|
|
67
73
|
Step 1: Enter your name
|
|
@@ -273,7 +273,7 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
|
|
|
273
273
|
>
|
|
274
274
|
<div
|
|
275
275
|
className={clsx(
|
|
276
|
-
styles.
|
|
276
|
+
styles.paginationTitle,
|
|
277
277
|
)}
|
|
278
278
|
>
|
|
279
279
|
<Button
|
|
@@ -306,6 +306,16 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
|
|
|
306
306
|
>
|
|
307
307
|
Go to next page in this modal
|
|
308
308
|
</Button>
|
|
309
|
+
<VisuallyHidden
|
|
310
|
+
// Hide when requested, or when pagination is enabled (the title isn't relevant to any specific page).
|
|
311
|
+
when={hideTitle}
|
|
312
|
+
>
|
|
313
|
+
<Dialog.Title as="h2" className={styles.titleTextContainer}>
|
|
314
|
+
<TextWhenString kind="paragraphSmall" weight="medium">
|
|
315
|
+
{title}
|
|
316
|
+
</TextWhenString>
|
|
317
|
+
</Dialog.Title>
|
|
318
|
+
</VisuallyHidden>
|
|
309
319
|
</div>
|
|
310
320
|
<Button
|
|
311
321
|
kind="tertiary"
|
|
@@ -40,6 +40,11 @@ export type PaginationState<T extends string[] | readonly string[] = string[]> =
|
|
|
40
40
|
* The page history.
|
|
41
41
|
*/
|
|
42
42
|
history: T[number][],
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Clear the page history and reset to the initial page.
|
|
46
|
+
*/
|
|
47
|
+
reset: () => void,
|
|
43
48
|
};
|
|
44
49
|
|
|
45
50
|
/**
|
|
@@ -94,6 +99,11 @@ export const usePagination = <T extends string[] | readonly string[] = string[]>
|
|
|
94
99
|
}
|
|
95
100
|
};
|
|
96
101
|
|
|
102
|
+
const reset = (): void => {
|
|
103
|
+
setCurrentPage(initialPage);
|
|
104
|
+
setHistory([initialPage]);
|
|
105
|
+
};
|
|
106
|
+
|
|
97
107
|
return {
|
|
98
108
|
currentPage,
|
|
99
109
|
open,
|
|
@@ -101,6 +111,7 @@ export const usePagination = <T extends string[] | readonly string[] = string[]>
|
|
|
101
111
|
back,
|
|
102
112
|
canGoForward,
|
|
103
113
|
forward,
|
|
114
|
+
reset,
|
|
104
115
|
history,
|
|
105
116
|
} as PaginationState<T>;
|
|
106
117
|
};
|