@dust-tt/sparkle 0.2.224 → 0.2.226
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/cjs/index.js +293 -153
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/Breadcrumbs.d.ts +7 -6
- package/dist/esm/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/esm/components/Breadcrumbs.js +3 -2
- package/dist/esm/components/Breadcrumbs.js.map +1 -1
- package/dist/esm/components/DataTable.d.ts +5 -2
- package/dist/esm/components/DataTable.d.ts.map +1 -1
- package/dist/esm/components/DataTable.js +50 -33
- package/dist/esm/components/DataTable.js.map +1 -1
- package/dist/esm/components/DropdownMenu.d.ts +10 -10
- package/dist/esm/components/DropdownMenu.d.ts.map +1 -1
- package/dist/esm/components/DropdownMenu.js +7 -7
- package/dist/esm/components/DropdownMenu.js.map +1 -1
- package/dist/esm/components/Item.d.ts +18 -15
- package/dist/esm/components/Item.d.ts.map +1 -1
- package/dist/esm/components/Item.js +2 -1
- package/dist/esm/components/Item.js.map +1 -1
- package/dist/esm/components/PaginatedCitationsGrid.d.ts.map +1 -1
- package/dist/esm/components/PaginatedCitationsGrid.js +8 -4
- package/dist/esm/components/PaginatedCitationsGrid.js.map +1 -1
- package/dist/esm/components/Pagination.d.ts +5 -4
- package/dist/esm/components/Pagination.d.ts.map +1 -1
- package/dist/esm/components/Pagination.js +35 -35
- package/dist/esm/components/Pagination.js.map +1 -1
- package/dist/esm/hooks/index.d.ts +3 -0
- package/dist/esm/hooks/index.d.ts.map +1 -0
- package/dist/esm/hooks/index.js +3 -0
- package/dist/esm/hooks/index.js.map +1 -0
- package/dist/esm/hooks/useHashParams.d.ts +18 -0
- package/dist/esm/hooks/useHashParams.d.ts.map +1 -0
- package/dist/esm/hooks/useHashParams.js +67 -0
- package/dist/esm/hooks/useHashParams.js.map +1 -0
- package/dist/esm/hooks/usePaginationFromUrl.d.ts +6 -0
- package/dist/esm/hooks/usePaginationFromUrl.d.ts.map +1 -0
- package/dist/esm/hooks/usePaginationFromUrl.js +23 -0
- package/dist/esm/hooks/usePaginationFromUrl.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/stories/DataTable.stories.d.ts +2 -0
- package/dist/esm/stories/DataTable.stories.d.ts.map +1 -1
- package/dist/esm/stories/DataTable.stories.js +133 -105
- package/dist/esm/stories/DataTable.stories.js.map +1 -1
- package/dist/esm/stories/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/esm/stories/DropdownMenu.stories.js +32 -31
- package/dist/esm/stories/DropdownMenu.stories.js.map +1 -1
- package/dist/esm/stories/Item.stories.d.ts.map +1 -1
- package/dist/esm/stories/Item.stories.js +8 -6
- package/dist/esm/stories/Item.stories.js.map +1 -1
- package/dist/esm/stories/Pagination.stories.d.ts +1 -0
- package/dist/esm/stories/Pagination.stories.d.ts.map +1 -1
- package/dist/esm/stories/Pagination.stories.js +25 -3
- package/dist/esm/stories/Pagination.stories.js.map +1 -1
- package/dist/sparkle.css +4 -0
- package/package.json +1 -1
- package/src/components/Breadcrumbs.tsx +11 -10
- package/src/components/DataTable.tsx +116 -81
- package/src/components/DropdownMenu.tsx +13 -13
- package/src/components/Item.tsx +20 -16
- package/src/components/PaginatedCitationsGrid.tsx +11 -6
- package/src/components/Pagination.tsx +48 -45
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useHashParams.ts +95 -0
- package/src/hooks/usePaginationFromUrl.ts +36 -0
- package/src/index.ts +1 -0
- package/src/stories/DataTable.stories.tsx +200 -129
- package/src/stories/DropdownMenu.stories.tsx +43 -31
- package/src/stories/Item.stories.tsx +26 -6
- package/src/stories/Pagination.stories.tsx +38 -10
|
@@ -82,8 +82,8 @@ export const ListItemExample = () => (
|
|
|
82
82
|
<DropdownMenu>
|
|
83
83
|
<DropdownMenu.Button label="Dust" />
|
|
84
84
|
<DropdownMenu.Items>
|
|
85
|
-
<DropdownMenu.Item label="item 1" href
|
|
86
|
-
<DropdownMenu.Item label="item 2" href
|
|
85
|
+
<DropdownMenu.Item label="item 1" link={{ href: "#" }} />
|
|
86
|
+
<DropdownMenu.Item label="item 2" link={{ href: "#" }} />
|
|
87
87
|
</DropdownMenu.Items>
|
|
88
88
|
</DropdownMenu>
|
|
89
89
|
</div>
|
|
@@ -91,8 +91,16 @@ export const ListItemExample = () => (
|
|
|
91
91
|
<DropdownMenu>
|
|
92
92
|
<DropdownMenu.Button label="Dust" />
|
|
93
93
|
<DropdownMenu.Items>
|
|
94
|
-
<DropdownMenu.Item
|
|
95
|
-
|
|
94
|
+
<DropdownMenu.Item
|
|
95
|
+
label="item 1"
|
|
96
|
+
link={{ href: "#" }}
|
|
97
|
+
icon={Cog6ToothIcon}
|
|
98
|
+
/>
|
|
99
|
+
<DropdownMenu.Item
|
|
100
|
+
label="item 2"
|
|
101
|
+
link={{ href: "#" }}
|
|
102
|
+
icon={Cog6ToothIcon}
|
|
103
|
+
/>
|
|
96
104
|
</DropdownMenu.Items>
|
|
97
105
|
</DropdownMenu>
|
|
98
106
|
</div>
|
|
@@ -102,13 +110,25 @@ export const ListItemExample = () => (
|
|
|
102
110
|
<DropdownMenu.Items>
|
|
103
111
|
<DropdownMenu.Item
|
|
104
112
|
label="item 1"
|
|
105
|
-
href
|
|
113
|
+
link={{ href: "#" }}
|
|
114
|
+
icon={Cog6ToothIcon}
|
|
115
|
+
description="Desciption of the item"
|
|
116
|
+
/>
|
|
117
|
+
<DropdownMenu.Item
|
|
118
|
+
label="Dust site"
|
|
119
|
+
link={{ href: "https://dust.tt", target: "_blank" }}
|
|
120
|
+
icon={Cog6ToothIcon}
|
|
121
|
+
description="Desciption of the item"
|
|
122
|
+
/>
|
|
123
|
+
<DropdownMenu.Item
|
|
124
|
+
label="item 1"
|
|
125
|
+
link={{ href: "#" }}
|
|
106
126
|
icon={Cog6ToothIcon}
|
|
107
127
|
description="Desciption of the item"
|
|
108
128
|
/>
|
|
109
129
|
<DropdownMenu.Item
|
|
110
130
|
label="item 2"
|
|
111
|
-
href
|
|
131
|
+
link={{ href: "#" }}
|
|
112
132
|
icon={Cog6ToothIcon}
|
|
113
133
|
description="Desciption of the item"
|
|
114
134
|
/>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Meta } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
|
+
import { usePaginationFromUrl } from "@sparkle/hooks/usePaginationFromUrl";
|
|
5
|
+
|
|
4
6
|
import { Pagination } from "../index_with_tw_base";
|
|
5
7
|
|
|
6
8
|
const meta = {
|
|
@@ -9,38 +11,64 @@ const meta = {
|
|
|
9
11
|
} satisfies Meta<typeof Pagination>;
|
|
10
12
|
|
|
11
13
|
export default meta;
|
|
12
|
-
|
|
13
14
|
export const PaginationSM = () => {
|
|
15
|
+
const [pagination, setPagination] = React.useState({
|
|
16
|
+
pageIndex: 0,
|
|
17
|
+
pageSize: 50,
|
|
18
|
+
});
|
|
14
19
|
return (
|
|
15
20
|
<Pagination
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
rowCount={960}
|
|
22
|
+
pagination={pagination}
|
|
23
|
+
setPagination={setPagination}
|
|
19
24
|
/>
|
|
20
25
|
);
|
|
21
26
|
};
|
|
22
27
|
|
|
23
28
|
export const PaginationXS = () => {
|
|
29
|
+
const [pagination, setPagination] = React.useState({
|
|
30
|
+
pageIndex: 0,
|
|
31
|
+
pageSize: 50,
|
|
32
|
+
});
|
|
24
33
|
return (
|
|
25
34
|
<Pagination
|
|
26
|
-
|
|
27
|
-
maxItemsPerPage={50}
|
|
35
|
+
rowCount={960}
|
|
28
36
|
size="xs"
|
|
29
37
|
showDetails={false}
|
|
30
|
-
|
|
38
|
+
pagination={pagination}
|
|
39
|
+
setPagination={setPagination}
|
|
31
40
|
/>
|
|
32
41
|
);
|
|
33
42
|
};
|
|
34
43
|
|
|
35
44
|
export const PaginationNoPageButtons = () => {
|
|
45
|
+
const [pagination, setPagination] = React.useState({
|
|
46
|
+
pageIndex: 0,
|
|
47
|
+
pageSize: 50,
|
|
48
|
+
});
|
|
36
49
|
return (
|
|
37
50
|
<Pagination
|
|
38
|
-
|
|
39
|
-
maxItemsPerPage={50}
|
|
51
|
+
rowCount={960}
|
|
40
52
|
size="xs"
|
|
41
53
|
showDetails={false}
|
|
42
54
|
showPageButtons={false}
|
|
43
|
-
|
|
55
|
+
pagination={pagination}
|
|
56
|
+
setPagination={setPagination}
|
|
44
57
|
/>
|
|
45
58
|
);
|
|
46
59
|
};
|
|
60
|
+
|
|
61
|
+
export const PaginationWithUrl = () => {
|
|
62
|
+
const { pagination, setPagination } = usePaginationFromUrl("example", 50);
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<>
|
|
66
|
+
<div className="s-p-2">Current hash: {location.hash}</div>
|
|
67
|
+
<Pagination
|
|
68
|
+
rowCount={960}
|
|
69
|
+
pagination={pagination}
|
|
70
|
+
setPagination={setPagination}
|
|
71
|
+
/>
|
|
72
|
+
</>
|
|
73
|
+
);
|
|
74
|
+
};
|