@syscore/ui-library 1.27.3 → 2.0.0-beta-publish-workflow-beta.2
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/client/App.tsx +0 -2
- package/client/assets/alert/icon-clear.svg +4 -0
- package/client/assets/alert/icon-done.svg +3 -0
- package/client/assets/avatar-identity/photo.png +0 -0
- package/client/assets/avatar-identity/placeholder-icon.svg +8 -0
- package/client/assets/breadcrumb/icon-ellipsis.svg +5 -0
- package/client/assets/breadcrumb/icon-home.svg +3 -0
- package/client/assets/breadcrumb/icon-separator.svg +3 -0
- package/client/assets/button-v01/icon-back.svg +4 -0
- package/client/assets/button-v01/icon-check.svg +3 -0
- package/client/assets/button-v01/icon-close.svg +4 -0
- package/client/assets/button-v01/icon-delete.svg +3 -0
- package/client/assets/button-v01/icon-device.svg +3 -0
- package/client/assets/dropdown/icon-carrot-contract.svg +3 -0
- package/client/assets/dropdown/icon-carrot-expand.svg +3 -0
- package/client/assets/dropdown/icon-clear.svg +4 -0
- package/client/assets/dropdown/icon-enter.svg +3 -0
- package/client/components/icons/UtilityChangeType.tsx +21 -0
- package/client/components/ui/alert-dialog-panel.tsx +246 -0
- package/client/components/ui/alert-v02.tsx +214 -0
- package/client/components/ui/app-bar.tsx +299 -0
- package/client/components/ui/avatar-identity.tsx +122 -0
- package/client/components/ui/banner.tsx +108 -0
- package/client/components/ui/bottom-navigation.tsx +223 -0
- package/client/components/ui/breadcrumb-trail.tsx +170 -0
- package/client/components/ui/button-v01.tsx +238 -0
- package/client/components/ui/button.tsx +2 -0
- package/client/components/ui/card.tsx +108 -26
- package/client/components/ui/code-badge.tsx +62 -0
- package/client/components/ui/date-picker.tsx +188 -0
- package/client/components/ui/dropdown.tsx +448 -0
- package/client/components/ui/empty-state.tsx +197 -0
- package/client/components/ui/file-upload.tsx +214 -0
- package/client/components/ui/footer.tsx +179 -0
- package/client/components/ui/layout.tsx +1182 -0
- package/client/components/ui/pagination-v01.tsx +157 -0
- package/client/components/ui/password-field-v01.tsx +67 -0
- package/client/components/ui/search-field-v01.tsx +192 -0
- package/client/components/ui/section-heading.tsx +49 -0
- package/client/components/ui/sidebar.tsx +2 -3
- package/client/components/ui/standard-navigation.tsx +8 -2
- package/client/components/ui/stepper.tsx +148 -0
- package/client/components/ui/switch-v01.tsx +71 -0
- package/client/components/ui/system-bar.tsx +119 -0
- package/client/components/ui/table-v01.tsx +230 -0
- package/client/components/ui/tabs-v01.tsx +99 -0
- package/client/components/ui/tag-v02.tsx +113 -0
- package/client/components/ui/text-area-v01.tsx +33 -0
- package/client/components/ui/text-field-v01.tsx +108 -0
- package/client/components/ui/timeline.tsx +181 -0
- package/client/components/ui/toast-v01.tsx +206 -0
- package/client/components/ui/tooltip.tsx +264 -71
- package/client/global.css +9565 -4378
- package/client/storybook.css +125 -0
- package/client/ui/Accordion.stories.tsx +1 -1
- package/client/ui/AlertDialogPanel/AlertDialogPanel.stories.tsx +150 -0
- package/client/ui/AlertV02/AlertV02.stories.tsx +188 -0
- package/client/ui/AppBar/app-bar.stories.tsx +280 -0
- package/client/ui/AspectRatio.stories.tsx +1 -1
- package/client/ui/AvatarIdentity/AvatarIdentity.stories.tsx +77 -0
- package/client/ui/Banner/banner.stories.tsx +238 -0
- package/client/ui/BottomNavigation/bottom-navigation.stories.tsx +285 -0
- package/client/ui/BreadcrumbTrail/BreadcrumbTrail.stories.tsx +232 -0
- package/client/ui/Button.stories.tsx +1 -1
- package/client/ui/ButtonV01/ButtonV01.stories.tsx +417 -0
- package/client/ui/Calendar/Calendar.stories.tsx +1 -1
- package/client/ui/Card.stories.tsx +285 -168
- package/client/ui/Carousel/Carousel.stories.tsx +1 -1
- package/client/ui/Chart/Chart.stories.tsx +1 -1
- package/client/ui/Checkbox.stories.tsx +1 -1
- package/client/ui/Collapsible/Collapsible.stories.tsx +1 -1
- package/client/ui/Colors.stories.tsx +1 -1
- package/client/ui/Command/Command.stories.tsx +1 -1
- package/client/ui/ContextMenu/ContextMenu.stories.tsx +1 -1
- package/client/ui/DatePicker/DatePicker.stories.tsx +293 -0
- package/client/ui/Dialog.stories.tsx +1 -1
- package/client/ui/Drawer/Drawer.stories.tsx +1 -1
- package/client/ui/Dropdown/Dropdown.stories.tsx +205 -0
- package/client/ui/EmptyState/empty-state.stories.tsx +251 -0
- package/client/ui/FileUpload/FileUpload.stories.tsx +218 -0
- package/client/ui/Footer/footer.stories.tsx +194 -0
- package/client/ui/Form/Form.stories.tsx +1 -1
- package/client/ui/Hero.stories.tsx +1 -1
- package/client/ui/HoverCard/HoverCard.stories.tsx +1 -1
- package/client/ui/Icons.stories.tsx +1 -1
- package/client/ui/Input.stories.tsx +1 -1
- package/client/ui/InputOTP/InputOTP.stories.tsx +1 -1
- package/client/ui/Label.stories.tsx +1 -1
- package/client/ui/Layout/Center.stories.tsx +100 -0
- package/client/ui/Layout/Columns.stories.tsx +136 -0
- package/client/ui/Layout/Container.stories.tsx +104 -0
- package/client/ui/Layout/FormLayout.stories.tsx +144 -0
- package/client/ui/Layout/Grid.stories.tsx +158 -0
- package/client/ui/Layout/GridSpan.stories.tsx +75 -0
- package/client/ui/Layout/HStack.stories.tsx +128 -0
- package/client/ui/Layout/Layout.stories.tsx +287 -0
- package/client/ui/Layout/LayoutContent.stories.tsx +91 -0
- package/client/ui/Layout/LayoutFooter.stories.tsx +77 -0
- package/client/ui/Layout/LayoutHeader.stories.tsx +104 -0
- package/client/ui/Layout/LayoutPanel.stories.tsx +143 -0
- package/client/ui/Layout/Positioned.stories.tsx +113 -0
- package/client/ui/Layout/Section.stories.tsx +84 -0
- package/client/ui/Layout/ShowHide.stories.tsx +99 -0
- package/client/ui/Layout/Spacer.stories.tsx +149 -0
- package/client/ui/Layout/Stack.stories.tsx +69 -0
- package/client/ui/Layout/StackItem.stories.tsx +124 -0
- package/client/ui/Layout/VStack.stories.tsx +101 -0
- package/client/ui/Layout/controls.ts +33 -0
- package/client/ui/Layout/demo.tsx +37 -0
- package/client/ui/Menubar/Menubar.stories.tsx +1 -1
- package/client/ui/MobileNav.stories.tsx +1 -1
- package/client/ui/Navigation.stories.tsx +1 -1
- package/client/ui/NavigationMenu/NavigationMenu.stories.tsx +1 -1
- package/client/ui/PageHeader.stories.tsx +13 -13
- package/client/ui/Pagination/Pagination.stories.tsx +178 -98
- package/client/ui/Pagination/PaginationLegacy.stories.tsx +121 -0
- package/client/ui/Panel.stories.tsx +1 -1
- package/client/ui/Popover/Popover.stories.tsx +1 -1
- package/client/ui/Progress/Progress.stories.tsx +1 -1
- package/client/ui/RadioGroup/RadioGroup.stories.tsx +1 -1
- package/client/ui/Resizable/Resizable.stories.tsx +1 -1
- package/client/ui/ScrollArea/ScrollArea.stories.tsx +1 -1
- package/client/ui/SearchField/SearchField.stories.tsx +153 -0
- package/client/ui/{SearchField.stories.tsx → SearchField/SearchFieldLegacy.stories.tsx} +2 -2
- package/client/ui/SectionBadge.stories.tsx +1 -1
- package/client/ui/Select.stories.tsx +1 -1
- package/client/ui/Separator/Separator.stories.tsx +1 -1
- package/client/ui/Sheet/Sheet.stories.tsx +1 -1
- package/client/ui/Sidebar/Sidebar.stories.tsx +57 -8
- package/client/ui/Skeleton/Skeleton.stories.tsx +1 -1
- package/client/ui/Slider/Slider.stories.tsx +1 -1
- package/client/ui/StandardNavigation.stories.tsx +1 -1
- package/client/ui/Stepper/Stepper.stories.tsx +344 -0
- package/client/ui/Switch.stories.tsx +1 -1
- package/client/ui/SwitchV01/SwitchV01.stories.tsx +152 -0
- package/client/ui/SystemBar/system-bar.stories.tsx +179 -0
- package/client/ui/Table/TableV01.stories.tsx +256 -0
- package/client/ui/Tabs.stories.tsx +1 -1
- package/client/ui/TabsV01/TabsV01.stories.tsx +144 -0
- package/client/ui/Tag.stories.tsx +1 -1
- package/client/ui/TagV02/TagStatusV02.stories.tsx +132 -0
- package/client/ui/TagV02/TagV02.stories.tsx +142 -0
- package/client/ui/TextAreaV01/TextAreaV01.stories.tsx +146 -0
- package/client/ui/TextFieldV01/PasswordFieldV01.stories.tsx +161 -0
- package/client/ui/TextFieldV01/TextFieldV01.stories.tsx +160 -0
- package/client/ui/Textarea.stories.tsx +1 -1
- package/client/ui/Timeline/timeline.stories.tsx +404 -0
- package/client/ui/Toast/Toast.stories.tsx +1 -1
- package/client/ui/ToastV01/ToastV01.stories.tsx +201 -0
- package/client/ui/Toaster/Toaster.stories.tsx +1 -1
- package/client/ui/Toggle.stories.tsx +1 -1
- package/client/ui/Tooltip.stories.tsx +287 -114
- package/client/ui/Typography.stories.tsx +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +649 -13
- package/dist/index.es.js +4405 -653
- package/package.json +1 -1
- package/client/components/ui/badge.tsx +0 -33
- package/client/components/ui/sonner.tsx +0 -26
- package/client/components/ui/toggle-group.tsx +0 -76
- package/client/ui/Alert/Alert.stories.tsx +0 -82
- package/client/ui/AlertDialog/AlertDialog.stories.tsx +0 -106
- package/client/ui/Avatar/Avatar.stories.tsx +0 -94
- package/client/ui/Badge/Badge.stories.tsx +0 -60
- package/client/ui/Breadcrumb/Breadcrumb.stories.tsx +0 -97
- package/client/ui/DropdownMenu/DropdownMenu.stories.tsx +0 -139
- package/client/ui/Sonner/Sonner.stories.tsx +0 -48
- package/client/ui/Table/Table.stories.tsx +0 -135
- package/client/ui/ToggleGroup/ToggleGroup.stories.tsx +0 -88
|
@@ -1,115 +1,195 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { useState } from "react";
|
|
2
3
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
PaginationV01,
|
|
5
|
+
PaginationV01Ellipsis,
|
|
6
|
+
PaginationV01Next,
|
|
7
|
+
PaginationV01Page,
|
|
8
|
+
PaginationV01Previous,
|
|
9
|
+
type PaginationV01State,
|
|
10
|
+
} from "../../components/ui/pagination-v01";
|
|
11
|
+
|
|
12
|
+
/** Args for the playground stories: one row of parts, driven from Controls. */
|
|
13
|
+
type RowArgs = {
|
|
14
|
+
state: PaginationV01State;
|
|
15
|
+
page: string;
|
|
16
|
+
showPage: boolean;
|
|
17
|
+
showEllipsis: boolean;
|
|
18
|
+
previousLabel: string;
|
|
19
|
+
nextLabel: string;
|
|
20
|
+
};
|
|
11
21
|
|
|
12
22
|
const meta = {
|
|
13
|
-
title: "
|
|
14
|
-
component:
|
|
23
|
+
title: "Components/Pagination",
|
|
24
|
+
component: PaginationV01,
|
|
15
25
|
tags: ["autodocs"],
|
|
16
26
|
parameters: {
|
|
17
|
-
layout: "
|
|
27
|
+
layout: "centered",
|
|
28
|
+
docs: {
|
|
29
|
+
description: {
|
|
30
|
+
component: [
|
|
31
|
+
"Page navigation: Previous, Next, page number and ellipsis — each with a `default`, `active` and `disabled` state.",
|
|
32
|
+
"Existing `Draft/Pagination Legacy` (`Pagination`) is unchanged.",
|
|
33
|
+
"",
|
|
34
|
+
"---",
|
|
35
|
+
"",
|
|
36
|
+
"## Import",
|
|
37
|
+
"",
|
|
38
|
+
"```tsx",
|
|
39
|
+
`import {`,
|
|
40
|
+
` PaginationV01,`,
|
|
41
|
+
` PaginationV01Previous,`,
|
|
42
|
+
` PaginationV01Page,`,
|
|
43
|
+
` PaginationV01Ellipsis,`,
|
|
44
|
+
` PaginationV01Next,`,
|
|
45
|
+
`} from "@syscore/ui-library"`,
|
|
46
|
+
"```",
|
|
47
|
+
"",
|
|
48
|
+
"## How to use",
|
|
49
|
+
"",
|
|
50
|
+
"```tsx",
|
|
51
|
+
"<PaginationV01>",
|
|
52
|
+
" <PaginationV01Previous onClick={goPrev} />",
|
|
53
|
+
" <PaginationV01Page>1</PaginationV01Page>",
|
|
54
|
+
" <PaginationV01Page current>2</PaginationV01Page>",
|
|
55
|
+
" <PaginationV01Ellipsis />",
|
|
56
|
+
" <PaginationV01Next onClick={goNext} />",
|
|
57
|
+
"</PaginationV01>",
|
|
58
|
+
"```",
|
|
59
|
+
"",
|
|
60
|
+
"| Part | Prop | Values | Default | Effect |",
|
|
61
|
+
"|------|------|--------|---------|--------|",
|
|
62
|
+
"| Previous / Next / Page / Ellipsis | `state` | `default` `active` `disabled` | `default` | Color / chrome |",
|
|
63
|
+
'| Page | `current` | boolean | `false` | Same as `state="active"` (cyan-50 fill, cyan-300 border) |',
|
|
64
|
+
].join("\n"),
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
argTypes: {
|
|
69
|
+
state: {
|
|
70
|
+
control: "inline-radio",
|
|
71
|
+
options: ["default", "active", "disabled"],
|
|
72
|
+
description: "Applied to every part in the row.",
|
|
73
|
+
table: { defaultValue: { summary: "default" } },
|
|
74
|
+
},
|
|
75
|
+
page: {
|
|
76
|
+
control: "text",
|
|
77
|
+
description: "Label on the page-number part.",
|
|
78
|
+
table: { defaultValue: { summary: "1" } },
|
|
79
|
+
},
|
|
80
|
+
showPage: {
|
|
81
|
+
control: "boolean",
|
|
82
|
+
description: "Render the page-number part.",
|
|
83
|
+
},
|
|
84
|
+
showEllipsis: {
|
|
85
|
+
control: "boolean",
|
|
86
|
+
description: "Render the ellipsis part.",
|
|
87
|
+
},
|
|
88
|
+
previousLabel: { control: "text" },
|
|
89
|
+
nextLabel: { control: "text" },
|
|
90
|
+
},
|
|
91
|
+
args: {
|
|
92
|
+
state: "default",
|
|
93
|
+
page: "1",
|
|
94
|
+
showPage: true,
|
|
95
|
+
showEllipsis: true,
|
|
96
|
+
previousLabel: "Previous",
|
|
97
|
+
nextLabel: "Next",
|
|
18
98
|
},
|
|
19
|
-
} satisfies Meta<
|
|
99
|
+
} satisfies Meta<RowArgs>;
|
|
20
100
|
|
|
21
101
|
export default meta;
|
|
102
|
+
type Story = StoryObj<RowArgs>;
|
|
22
103
|
|
|
23
|
-
|
|
104
|
+
function Parts({
|
|
105
|
+
state,
|
|
106
|
+
page = "1",
|
|
107
|
+
showPage = true,
|
|
108
|
+
showEllipsis = true,
|
|
109
|
+
previousLabel = "Previous",
|
|
110
|
+
nextLabel = "Next",
|
|
111
|
+
}: Partial<RowArgs> & { state: PaginationV01State }) {
|
|
112
|
+
return (
|
|
113
|
+
<div className="sb-pagination-spec">
|
|
114
|
+
<PaginationV01Previous state={state}>
|
|
115
|
+
{previousLabel}
|
|
116
|
+
</PaginationV01Previous>
|
|
117
|
+
{showPage ? (
|
|
118
|
+
<PaginationV01Page state={state}>{page}</PaginationV01Page>
|
|
119
|
+
) : null}
|
|
120
|
+
{showEllipsis ? <PaginationV01Ellipsis state={state} /> : null}
|
|
121
|
+
<PaginationV01Next state={state}>{nextLabel}</PaginationV01Next>
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
24
125
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<PaginationItem>
|
|
44
|
-
<PaginationEllipsis />
|
|
45
|
-
</PaginationItem>
|
|
46
|
-
<PaginationItem>
|
|
47
|
-
<PaginationNext href="#" />
|
|
48
|
-
</PaginationItem>
|
|
49
|
-
</PaginationContent>
|
|
50
|
-
</Pagination>
|
|
51
|
-
),
|
|
52
|
-
};
|
|
126
|
+
const stateStory = (state: PaginationV01State): Story => ({
|
|
127
|
+
args: { state },
|
|
128
|
+
parameters: {
|
|
129
|
+
docs: {
|
|
130
|
+
description: {
|
|
131
|
+
story:
|
|
132
|
+
"Previous, page number, ellipsis, Next. Use `showPage` / `showEllipsis` to drop a part and `page` to change the number.",
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
render: (args) => <Parts {...args} />,
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export const Default: Story = stateStory("default");
|
|
140
|
+
|
|
141
|
+
export const Active: Story = stateStory("active");
|
|
142
|
+
|
|
143
|
+
export const Disabled: Story = stateStory("disabled");
|
|
53
144
|
|
|
54
|
-
export const
|
|
145
|
+
export const AllVariants: Story = {
|
|
146
|
+
name: "All variants",
|
|
147
|
+
parameters: { controls: { disable: true } },
|
|
55
148
|
render: () => (
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
<
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
{page}
|
|
65
|
-
</PaginationLink>
|
|
66
|
-
</PaginationItem>
|
|
67
|
-
))}
|
|
68
|
-
<PaginationItem>
|
|
69
|
-
<PaginationEllipsis />
|
|
70
|
-
</PaginationItem>
|
|
71
|
-
<PaginationItem>
|
|
72
|
-
<PaginationNext href="#" />
|
|
73
|
-
</PaginationItem>
|
|
74
|
-
</PaginationContent>
|
|
75
|
-
</Pagination>
|
|
149
|
+
<div className="sb-pagination-matrix">
|
|
150
|
+
{(["default", "active", "disabled"] as const).map((state) => (
|
|
151
|
+
<div key={state} className="sb-pagination-row">
|
|
152
|
+
<span className="sb-pagination-label font-mazzardSoft">{state}</span>
|
|
153
|
+
<Parts state={state} />
|
|
154
|
+
</div>
|
|
155
|
+
))}
|
|
156
|
+
</div>
|
|
76
157
|
),
|
|
77
158
|
};
|
|
78
159
|
|
|
79
|
-
export const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
</
|
|
99
|
-
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
),
|
|
160
|
+
export const InABar: Story = {
|
|
161
|
+
name: "In a bar",
|
|
162
|
+
parameters: { controls: { disable: true } },
|
|
163
|
+
render: function InABarStory() {
|
|
164
|
+
const [page, setPage] = useState(2);
|
|
165
|
+
const last = 12;
|
|
166
|
+
return (
|
|
167
|
+
<PaginationV01>
|
|
168
|
+
<PaginationV01Previous
|
|
169
|
+
state={page === 1 ? "disabled" : "default"}
|
|
170
|
+
onClick={() => setPage((p) => Math.max(1, p - 1))}
|
|
171
|
+
/>
|
|
172
|
+
<PaginationV01Page current={page === 1} onClick={() => setPage(1)}>
|
|
173
|
+
1
|
|
174
|
+
</PaginationV01Page>
|
|
175
|
+
{page > 3 ? <PaginationV01Ellipsis /> : null}
|
|
176
|
+
{page !== 1 && page !== last ? (
|
|
177
|
+
<PaginationV01Page current onClick={() => setPage(page)}>
|
|
178
|
+
{page}
|
|
179
|
+
</PaginationV01Page>
|
|
180
|
+
) : null}
|
|
181
|
+
{page < last - 2 ? <PaginationV01Ellipsis /> : null}
|
|
182
|
+
<PaginationV01Page
|
|
183
|
+
current={page === last}
|
|
184
|
+
onClick={() => setPage(last)}
|
|
185
|
+
>
|
|
186
|
+
{last}
|
|
187
|
+
</PaginationV01Page>
|
|
188
|
+
<PaginationV01Next
|
|
189
|
+
state={page === last ? "disabled" : "default"}
|
|
190
|
+
onClick={() => setPage((p) => Math.min(last, p + 1))}
|
|
191
|
+
/>
|
|
192
|
+
</PaginationV01>
|
|
193
|
+
);
|
|
194
|
+
},
|
|
115
195
|
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import {
|
|
3
|
+
Pagination,
|
|
4
|
+
PaginationContent,
|
|
5
|
+
PaginationEllipsis,
|
|
6
|
+
PaginationItem,
|
|
7
|
+
PaginationLink,
|
|
8
|
+
PaginationNext,
|
|
9
|
+
PaginationPrevious,
|
|
10
|
+
} from "../../components/ui/pagination";
|
|
11
|
+
|
|
12
|
+
const meta = {
|
|
13
|
+
title: "Draft/Pagination Legacy",
|
|
14
|
+
component: Pagination,
|
|
15
|
+
tags: ["autodocs"],
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: "padded",
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component:
|
|
21
|
+
"Previous pagination (shadcn). Unchanged. New work should use `PaginationV01` under Components/Pagination.",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
} satisfies Meta<typeof Pagination>;
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
|
|
29
|
+
type Story = StoryObj<typeof meta>;
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
render: () => (
|
|
33
|
+
<Pagination>
|
|
34
|
+
<PaginationContent>
|
|
35
|
+
<PaginationItem>
|
|
36
|
+
<PaginationPrevious href="#" />
|
|
37
|
+
</PaginationItem>
|
|
38
|
+
<PaginationItem>
|
|
39
|
+
<PaginationLink href="#">1</PaginationLink>
|
|
40
|
+
</PaginationItem>
|
|
41
|
+
<PaginationItem>
|
|
42
|
+
<PaginationLink href="#" isActive>
|
|
43
|
+
2
|
|
44
|
+
</PaginationLink>
|
|
45
|
+
</PaginationItem>
|
|
46
|
+
<PaginationItem>
|
|
47
|
+
<PaginationLink href="#">3</PaginationLink>
|
|
48
|
+
</PaginationItem>
|
|
49
|
+
<PaginationItem>
|
|
50
|
+
<PaginationEllipsis />
|
|
51
|
+
</PaginationItem>
|
|
52
|
+
<PaginationItem>
|
|
53
|
+
<PaginationNext href="#" />
|
|
54
|
+
</PaginationItem>
|
|
55
|
+
</PaginationContent>
|
|
56
|
+
</Pagination>
|
|
57
|
+
),
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const Extended: Story = {
|
|
61
|
+
render: () => (
|
|
62
|
+
<Pagination>
|
|
63
|
+
<PaginationContent>
|
|
64
|
+
<PaginationItem>
|
|
65
|
+
<PaginationPrevious href="#" />
|
|
66
|
+
</PaginationItem>
|
|
67
|
+
{[1, 2, 3, 4, 5, 6, 7, 8].map((page) => (
|
|
68
|
+
<PaginationItem key={page}>
|
|
69
|
+
<PaginationLink href="#" isActive={page === 3}>
|
|
70
|
+
{page}
|
|
71
|
+
</PaginationLink>
|
|
72
|
+
</PaginationItem>
|
|
73
|
+
))}
|
|
74
|
+
<PaginationItem>
|
|
75
|
+
<PaginationEllipsis />
|
|
76
|
+
</PaginationItem>
|
|
77
|
+
<PaginationItem>
|
|
78
|
+
<PaginationNext href="#" />
|
|
79
|
+
</PaginationItem>
|
|
80
|
+
</PaginationContent>
|
|
81
|
+
</Pagination>
|
|
82
|
+
),
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const WithEllipsis: Story = {
|
|
86
|
+
render: () => (
|
|
87
|
+
<Pagination>
|
|
88
|
+
<PaginationContent>
|
|
89
|
+
<PaginationItem>
|
|
90
|
+
<PaginationPrevious href="#" />
|
|
91
|
+
</PaginationItem>
|
|
92
|
+
<PaginationItem>
|
|
93
|
+
<PaginationLink href="#">1</PaginationLink>
|
|
94
|
+
</PaginationItem>
|
|
95
|
+
<PaginationItem>
|
|
96
|
+
<PaginationEllipsis />
|
|
97
|
+
</PaginationItem>
|
|
98
|
+
<PaginationItem>
|
|
99
|
+
<PaginationLink href="#">10</PaginationLink>
|
|
100
|
+
</PaginationItem>
|
|
101
|
+
<PaginationItem>
|
|
102
|
+
<PaginationLink href="#" isActive>
|
|
103
|
+
11
|
|
104
|
+
</PaginationLink>
|
|
105
|
+
</PaginationItem>
|
|
106
|
+
<PaginationItem>
|
|
107
|
+
<PaginationLink href="#">12</PaginationLink>
|
|
108
|
+
</PaginationItem>
|
|
109
|
+
<PaginationItem>
|
|
110
|
+
<PaginationEllipsis />
|
|
111
|
+
</PaginationItem>
|
|
112
|
+
<PaginationItem>
|
|
113
|
+
<PaginationLink href="#">20</PaginationLink>
|
|
114
|
+
</PaginationItem>
|
|
115
|
+
<PaginationItem>
|
|
116
|
+
<PaginationNext href="#" />
|
|
117
|
+
</PaginationItem>
|
|
118
|
+
</PaginationContent>
|
|
119
|
+
</Pagination>
|
|
120
|
+
),
|
|
121
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import {
|
|
4
|
+
SearchFieldV01,
|
|
5
|
+
type SearchFieldV01Props,
|
|
6
|
+
type SearchFieldV01State,
|
|
7
|
+
} from "../../components/ui/search-field-v01";
|
|
8
|
+
|
|
9
|
+
const meta = {
|
|
10
|
+
title: "Components/SearchField",
|
|
11
|
+
component: SearchFieldV01,
|
|
12
|
+
tags: ["autodocs"],
|
|
13
|
+
parameters: {
|
|
14
|
+
layout: "centered",
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: [
|
|
18
|
+
"Search input with inline typeahead and a clear button.",
|
|
19
|
+
"",
|
|
20
|
+
"```tsx",
|
|
21
|
+
`import { SearchFieldV01 } from "@syscore/ui-library"`,
|
|
22
|
+
"",
|
|
23
|
+
'<SearchFieldV01 placeholder="Search projects" onClear={clear} />',
|
|
24
|
+
"```",
|
|
25
|
+
"",
|
|
26
|
+
"The state is derived from focus and value, so you normally pass nothing:",
|
|
27
|
+
"",
|
|
28
|
+
"| | empty | has value |",
|
|
29
|
+
"|---|---|---|",
|
|
30
|
+
"| **blurred** | search icon + placeholder | value + clear button |",
|
|
31
|
+
"| **focused** | cyan border, icon hidden | cyan border, typeahead + Enter |",
|
|
32
|
+
"",
|
|
33
|
+
"Pass `state` only to pin one for a spec or a screenshot.",
|
|
34
|
+
"",
|
|
35
|
+
"| Prop | Values | Default |",
|
|
36
|
+
"|------|--------|---------|",
|
|
37
|
+
"| `state` | `default` \\| `focus` \\| `active` \\| `filled` \\| `disabled` | derived |",
|
|
38
|
+
"| `suggestion` | inline typeahead remainder shown after the value | — |",
|
|
39
|
+
"| `onClear` | shows the clear button once there is a value | — |",
|
|
40
|
+
"| `placeholder` | `string` | `Placeholder` |",
|
|
41
|
+
"",
|
|
42
|
+
"Anything else is forwarded to the `<input>`.",
|
|
43
|
+
].join("\n"),
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
argTypes: {
|
|
48
|
+
state: {
|
|
49
|
+
control: "inline-radio",
|
|
50
|
+
options: ["default", "focus", "active", "filled", "disabled"],
|
|
51
|
+
},
|
|
52
|
+
placeholder: { control: "text" },
|
|
53
|
+
suggestion: { control: "text" },
|
|
54
|
+
value: { control: "text" },
|
|
55
|
+
onClear: { table: { disable: true } },
|
|
56
|
+
containerClassName: { table: { disable: true } },
|
|
57
|
+
},
|
|
58
|
+
args: {
|
|
59
|
+
placeholder: "Placeholder",
|
|
60
|
+
},
|
|
61
|
+
} satisfies Meta<typeof SearchFieldV01>;
|
|
62
|
+
|
|
63
|
+
export default meta;
|
|
64
|
+
type Story = StoryObj<typeof meta>;
|
|
65
|
+
|
|
66
|
+
const STATES: SearchFieldV01State[] = [
|
|
67
|
+
"default",
|
|
68
|
+
"focus",
|
|
69
|
+
"active",
|
|
70
|
+
"filled",
|
|
71
|
+
"disabled",
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
/** Each story pins one state so every variant is visible without interacting. */
|
|
75
|
+
const stateArgs: Record<SearchFieldV01State, Partial<SearchFieldV01Props>> = {
|
|
76
|
+
default: {},
|
|
77
|
+
focus: {},
|
|
78
|
+
active: { value: "Entry", suggestion: "typeahead" },
|
|
79
|
+
filled: { value: "Entry" },
|
|
80
|
+
disabled: {},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const Default: Story = {
|
|
84
|
+
args: { state: "default" },
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const Focus: Story = {
|
|
88
|
+
args: { state: "focus" },
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const Active: Story = {
|
|
92
|
+
args: { state: "active", value: "Entry", suggestion: "typeahead" },
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const Filled: Story = {
|
|
96
|
+
args: { state: "filled", value: "Entry", onClear: () => {} },
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const Disabled: Story = {
|
|
100
|
+
args: { state: "disabled" },
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const AllVariants: Story = {
|
|
104
|
+
name: "All variants",
|
|
105
|
+
parameters: {
|
|
106
|
+
controls: { disable: true },
|
|
107
|
+
docs: {
|
|
108
|
+
description: {
|
|
109
|
+
story: "Every state, one row each.",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
render: () => (
|
|
114
|
+
<div className="sb-searchfield-matrix">
|
|
115
|
+
{STATES.map((state) => (
|
|
116
|
+
<div key={state} className="sb-searchfield-row">
|
|
117
|
+
<span className="sb-searchfield-label font-mazzardSoft">{state}</span>
|
|
118
|
+
<SearchFieldV01
|
|
119
|
+
state={state}
|
|
120
|
+
placeholder="Placeholder"
|
|
121
|
+
onClear={() => {}}
|
|
122
|
+
{...stateArgs[state]}
|
|
123
|
+
/>
|
|
124
|
+
</div>
|
|
125
|
+
))}
|
|
126
|
+
</div>
|
|
127
|
+
),
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const Interactive: Story = {
|
|
131
|
+
name: "Interactive",
|
|
132
|
+
parameters: {
|
|
133
|
+
controls: { disable: true },
|
|
134
|
+
docs: {
|
|
135
|
+
description: {
|
|
136
|
+
story:
|
|
137
|
+
"No pinned `state` — focus it, type, and blur to move through default, focus, active and filled.",
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
render: function InteractiveField() {
|
|
142
|
+
const [value, setValue] = useState("");
|
|
143
|
+
return (
|
|
144
|
+
<SearchFieldV01
|
|
145
|
+
value={value}
|
|
146
|
+
suggestion={value === "Ent" ? "ry" : undefined}
|
|
147
|
+
placeholder="Placeholder"
|
|
148
|
+
onChange={(event) => setValue(event.target.value)}
|
|
149
|
+
onClear={() => setValue("")}
|
|
150
|
+
/>
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { SearchField } from "
|
|
2
|
+
import { SearchField } from "../../components/ui/search";
|
|
3
3
|
|
|
4
4
|
const meta = {
|
|
5
|
-
title: "
|
|
5
|
+
title: "Draft/SearchField Legacy",
|
|
6
6
|
component: SearchField,
|
|
7
7
|
tags: ["autodocs"],
|
|
8
8
|
parameters: {
|
|
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from "@storybook/react";
|
|
|
2
2
|
import { SectionBadge } from "../components/ui/section-badge";
|
|
3
3
|
|
|
4
4
|
const meta = {
|
|
5
|
-
title: "
|
|
5
|
+
title: "Components/SectionBadge",
|
|
6
6
|
component: SectionBadge,
|
|
7
7
|
tags: ["autodocs"],
|
|
8
8
|
parameters: {
|