@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
|
@@ -2,24 +2,53 @@ import type { Meta, StoryObj } from "@storybook/react";
|
|
|
2
2
|
import {
|
|
3
3
|
Sidebar,
|
|
4
4
|
SidebarContent,
|
|
5
|
+
SidebarFooter,
|
|
5
6
|
SidebarGroup,
|
|
6
7
|
SidebarGroupContent,
|
|
7
8
|
SidebarGroupLabel,
|
|
9
|
+
SidebarHeader,
|
|
10
|
+
SidebarInset,
|
|
8
11
|
SidebarMenu,
|
|
9
12
|
SidebarMenuButton,
|
|
10
13
|
SidebarMenuItem,
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
SidebarProvider,
|
|
15
|
+
SidebarTrigger,
|
|
13
16
|
} from "../../components/ui/sidebar";
|
|
14
17
|
import { Home, Settings, Users, CreditCard, LogOut } from "lucide-react";
|
|
15
18
|
|
|
16
19
|
const meta = {
|
|
17
|
-
title: "
|
|
20
|
+
title: "Draft/Sidebar",
|
|
18
21
|
component: Sidebar,
|
|
19
22
|
tags: ["autodocs"],
|
|
20
23
|
parameters: {
|
|
21
24
|
layout: "padded",
|
|
25
|
+
docs: {
|
|
26
|
+
description: {
|
|
27
|
+
component: [
|
|
28
|
+
"`Sidebar` reads collapse/open state from context. Always wrap it in `SidebarProvider`.",
|
|
29
|
+
"",
|
|
30
|
+
"```tsx",
|
|
31
|
+
`import { Sidebar, SidebarProvider, SidebarInset, SidebarTrigger } from "@syscore/ui-library"`,
|
|
32
|
+
"",
|
|
33
|
+
"<SidebarProvider>",
|
|
34
|
+
" <Sidebar>…</Sidebar>",
|
|
35
|
+
" <SidebarInset>",
|
|
36
|
+
" <SidebarTrigger />",
|
|
37
|
+
" {children}",
|
|
38
|
+
" </SidebarInset>",
|
|
39
|
+
"</SidebarProvider>",
|
|
40
|
+
"```",
|
|
41
|
+
].join("\n"),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
22
44
|
},
|
|
45
|
+
decorators: [
|
|
46
|
+
(Story) => (
|
|
47
|
+
<SidebarProvider style={{ minHeight: 384, height: 384 }}>
|
|
48
|
+
<Story />
|
|
49
|
+
</SidebarProvider>
|
|
50
|
+
),
|
|
51
|
+
],
|
|
23
52
|
} satisfies Meta<typeof Sidebar>;
|
|
24
53
|
|
|
25
54
|
export default meta;
|
|
@@ -27,8 +56,25 @@ export default meta;
|
|
|
27
56
|
type Story = StoryObj<typeof meta>;
|
|
28
57
|
|
|
29
58
|
export const Default: Story = {
|
|
59
|
+
parameters: {
|
|
60
|
+
docs: {
|
|
61
|
+
source: {
|
|
62
|
+
code: `<SidebarProvider>
|
|
63
|
+
<Sidebar>
|
|
64
|
+
<SidebarHeader>App</SidebarHeader>
|
|
65
|
+
<SidebarContent>…</SidebarContent>
|
|
66
|
+
<SidebarFooter>…</SidebarFooter>
|
|
67
|
+
</Sidebar>
|
|
68
|
+
<SidebarInset>
|
|
69
|
+
<SidebarTrigger />
|
|
70
|
+
Main content
|
|
71
|
+
</SidebarInset>
|
|
72
|
+
</SidebarProvider>`,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
30
76
|
render: () => (
|
|
31
|
-
|
|
77
|
+
<>
|
|
32
78
|
<Sidebar>
|
|
33
79
|
<SidebarHeader>
|
|
34
80
|
<h2 className="font-semibold">App</h2>
|
|
@@ -84,9 +130,12 @@ export const Default: Story = {
|
|
|
84
130
|
</SidebarMenu>
|
|
85
131
|
</SidebarFooter>
|
|
86
132
|
</Sidebar>
|
|
87
|
-
<
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
133
|
+
<SidebarInset>
|
|
134
|
+
<div className="p-4">
|
|
135
|
+
<SidebarTrigger />
|
|
136
|
+
<p className="text-sm text-gray-600 mt-3">Main content area</p>
|
|
137
|
+
</div>
|
|
138
|
+
</SidebarInset>
|
|
139
|
+
</>
|
|
91
140
|
),
|
|
92
141
|
};
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Stepper } from "../../components/ui/stepper";
|
|
4
|
+
import { Button } from "../../components/ui/button";
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Components/Stepper",
|
|
8
|
+
component: Stepper,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "padded",
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: [
|
|
15
|
+
"A step indicator for multi-step flows — registration wizards, certification processes, onboarding.",
|
|
16
|
+
"",
|
|
17
|
+
"**Import:**",
|
|
18
|
+
"```tsx",
|
|
19
|
+
`import { Stepper } from "@syscore/ui-library"`,
|
|
20
|
+
"```",
|
|
21
|
+
"",
|
|
22
|
+
"**Key props:**",
|
|
23
|
+
"",
|
|
24
|
+
"| Prop | Type | Default | Effect |",
|
|
25
|
+
"|------|------|---------|--------|",
|
|
26
|
+
"| `steps` | `{ title, description? }[]` | — | The step definitions |",
|
|
27
|
+
"| `currentStep` | number | — | 0-indexed active step |",
|
|
28
|
+
"| `orientation` | `\"horizontal\"` \\| `\"vertical\"` | `\"horizontal\"` | Layout direction |",
|
|
29
|
+
"| `variant` | `\"default\"` \\| `\"outlined\"` | `\"default\"` | Filled vs outlined indicators |",
|
|
30
|
+
"| `size` | `\"sm\"` \\| `\"md\"` \\| `\"lg\"` | `\"md\"` | Size of indicators and labels |",
|
|
31
|
+
"| `onStepClick` | `(index) => void` | — | Makes completed steps clickable |",
|
|
32
|
+
].join("\n"),
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
args: {
|
|
37
|
+
steps: [
|
|
38
|
+
{ title: "Project details", description: "Basic information" },
|
|
39
|
+
{ title: "Documents", description: "Upload required files" },
|
|
40
|
+
{ title: "Review", description: "Check your submission" },
|
|
41
|
+
{ title: "Submit", description: "Complete registration" },
|
|
42
|
+
],
|
|
43
|
+
currentStep: 1,
|
|
44
|
+
},
|
|
45
|
+
} satisfies Meta<typeof Stepper>;
|
|
46
|
+
|
|
47
|
+
export default meta;
|
|
48
|
+
type Story = StoryObj<typeof meta>;
|
|
49
|
+
|
|
50
|
+
const REGISTRATION_STEPS = [
|
|
51
|
+
{ title: "Project details", description: "Basic information" },
|
|
52
|
+
{ title: "Documents", description: "Upload required files" },
|
|
53
|
+
{ title: "Review", description: "Check your submission" },
|
|
54
|
+
{ title: "Submit", description: "Complete registration" },
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
const SIMPLE_STEPS = [
|
|
58
|
+
{ title: "Account" },
|
|
59
|
+
{ title: "Profile" },
|
|
60
|
+
{ title: "Preferences" },
|
|
61
|
+
{ title: "Done" },
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
export const Default: Story = {
|
|
67
|
+
parameters: {
|
|
68
|
+
docs: {
|
|
69
|
+
source: {
|
|
70
|
+
code: `import { Stepper } from "@syscore/ui-library"
|
|
71
|
+
|
|
72
|
+
const steps = [
|
|
73
|
+
{ title: "Project details", description: "Basic information" },
|
|
74
|
+
{ title: "Documents", description: "Upload required files" },
|
|
75
|
+
{ title: "Review", description: "Check your submission" },
|
|
76
|
+
{ title: "Submit", description: "Complete registration" },
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
<Stepper steps={steps} currentStep={1} />`,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
render: () => (
|
|
84
|
+
<Stepper steps={REGISTRATION_STEPS} currentStep={1} />
|
|
85
|
+
),
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const AllStepsState: Story = {
|
|
89
|
+
name: "Step states",
|
|
90
|
+
parameters: {
|
|
91
|
+
docs: {
|
|
92
|
+
source: {
|
|
93
|
+
code: `import { Stepper } from "@syscore/ui-library"
|
|
94
|
+
|
|
95
|
+
// currentStep=0 → all upcoming
|
|
96
|
+
<Stepper steps={steps} currentStep={0} />
|
|
97
|
+
|
|
98
|
+
// currentStep=2 → 2 complete, 1 current, 1 upcoming
|
|
99
|
+
<Stepper steps={steps} currentStep={2} />
|
|
100
|
+
|
|
101
|
+
// currentStep=4 → all complete
|
|
102
|
+
<Stepper steps={steps} currentStep={4} />`,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
render: () => (
|
|
107
|
+
<div className="flex flex-col gap-10 w-full">
|
|
108
|
+
<div className="flex flex-col gap-2">
|
|
109
|
+
<span className="text-xs text-gray-400 font-medium">Not started (currentStep=0)</span>
|
|
110
|
+
<Stepper steps={SIMPLE_STEPS} currentStep={0} />
|
|
111
|
+
</div>
|
|
112
|
+
<div className="flex flex-col gap-2">
|
|
113
|
+
<span className="text-xs text-gray-400 font-medium">In progress (currentStep=2)</span>
|
|
114
|
+
<Stepper steps={SIMPLE_STEPS} currentStep={2} />
|
|
115
|
+
</div>
|
|
116
|
+
<div className="flex flex-col gap-2">
|
|
117
|
+
<span className="text-xs text-gray-400 font-medium">Complete (currentStep=4)</span>
|
|
118
|
+
<Stepper steps={SIMPLE_STEPS} currentStep={4} />
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
),
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export const Vertical: Story = {
|
|
125
|
+
parameters: {
|
|
126
|
+
docs: {
|
|
127
|
+
source: {
|
|
128
|
+
code: `import { Stepper } from "@syscore/ui-library"
|
|
129
|
+
|
|
130
|
+
<Stepper
|
|
131
|
+
steps={steps}
|
|
132
|
+
currentStep={1}
|
|
133
|
+
orientation="vertical"
|
|
134
|
+
/>`,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
render: () => (
|
|
139
|
+
<div className="max-w-xs">
|
|
140
|
+
<Stepper
|
|
141
|
+
steps={REGISTRATION_STEPS}
|
|
142
|
+
currentStep={1}
|
|
143
|
+
orientation="vertical"
|
|
144
|
+
/>
|
|
145
|
+
</div>
|
|
146
|
+
),
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const Outlined: Story = {
|
|
150
|
+
parameters: {
|
|
151
|
+
docs: {
|
|
152
|
+
source: {
|
|
153
|
+
code: `import { Stepper } from "@syscore/ui-library"
|
|
154
|
+
|
|
155
|
+
<Stepper steps={steps} currentStep={2} variant="outlined" />`,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
render: () => (
|
|
160
|
+
<Stepper steps={REGISTRATION_STEPS} currentStep={2} variant="outlined" />
|
|
161
|
+
),
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const Sizes: Story = {
|
|
165
|
+
parameters: {
|
|
166
|
+
docs: {
|
|
167
|
+
source: {
|
|
168
|
+
code: `import { Stepper } from "@syscore/ui-library"
|
|
169
|
+
|
|
170
|
+
<Stepper steps={steps} currentStep={1} size="sm" />
|
|
171
|
+
<Stepper steps={steps} currentStep={1} size="md" />
|
|
172
|
+
<Stepper steps={steps} currentStep={1} size="lg" />`,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
render: () => (
|
|
177
|
+
<div className="flex flex-col gap-10 w-full">
|
|
178
|
+
{(["sm", "md", "lg"] as const).map((size) => (
|
|
179
|
+
<div key={size} className="flex flex-col gap-2">
|
|
180
|
+
<span className="text-xs text-gray-400 font-medium">size="{size}"</span>
|
|
181
|
+
<Stepper steps={SIMPLE_STEPS} currentStep={1} size={size} />
|
|
182
|
+
</div>
|
|
183
|
+
))}
|
|
184
|
+
</div>
|
|
185
|
+
),
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export const Clickable: Story = {
|
|
189
|
+
name: "Clickable steps",
|
|
190
|
+
parameters: {
|
|
191
|
+
docs: {
|
|
192
|
+
source: {
|
|
193
|
+
code: `import { Stepper } from "@syscore/ui-library"
|
|
194
|
+
import { useState } from "react"
|
|
195
|
+
|
|
196
|
+
const [currentStep, setCurrentStep] = useState(2)
|
|
197
|
+
|
|
198
|
+
{/* Completed steps are clickable — lets users go back */}
|
|
199
|
+
<Stepper
|
|
200
|
+
steps={steps}
|
|
201
|
+
currentStep={currentStep}
|
|
202
|
+
onStepClick={setCurrentStep}
|
|
203
|
+
/>`,
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
render: () => {
|
|
208
|
+
const [currentStep, setCurrentStep] = useState(2);
|
|
209
|
+
return (
|
|
210
|
+
<div className="flex flex-col gap-6 w-full">
|
|
211
|
+
<Stepper
|
|
212
|
+
steps={REGISTRATION_STEPS}
|
|
213
|
+
currentStep={currentStep}
|
|
214
|
+
onStepClick={setCurrentStep}
|
|
215
|
+
/>
|
|
216
|
+
<p className="text-sm text-gray-500 text-center">
|
|
217
|
+
Click a completed step (green) to go back
|
|
218
|
+
</p>
|
|
219
|
+
</div>
|
|
220
|
+
);
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export const WithNavigation: Story = {
|
|
225
|
+
name: "With next / back buttons",
|
|
226
|
+
parameters: {
|
|
227
|
+
docs: {
|
|
228
|
+
source: {
|
|
229
|
+
code: `import { Stepper } from "@syscore/ui-library"
|
|
230
|
+
import { Button, Stack } from "@syscore/ui-library"
|
|
231
|
+
import { useState } from "react"
|
|
232
|
+
|
|
233
|
+
const [currentStep, setCurrentStep] = useState(0)
|
|
234
|
+
|
|
235
|
+
<Stack gap="xl">
|
|
236
|
+
<Stepper steps={steps} currentStep={currentStep} />
|
|
237
|
+
|
|
238
|
+
<Stack direction="horizontal" justify="between">
|
|
239
|
+
<Button
|
|
240
|
+
variant="secondary-light"
|
|
241
|
+
size="large"
|
|
242
|
+
disabled={currentStep === 0}
|
|
243
|
+
onClick={() => setCurrentStep(s => s - 1)}
|
|
244
|
+
>
|
|
245
|
+
Back
|
|
246
|
+
</Button>
|
|
247
|
+
<Button
|
|
248
|
+
variant="primary-dark"
|
|
249
|
+
size="large"
|
|
250
|
+
disabled={currentStep === steps.length}
|
|
251
|
+
onClick={() => setCurrentStep(s => s + 1)}
|
|
252
|
+
>
|
|
253
|
+
{currentStep === steps.length - 1 ? "Submit" : "Next"}
|
|
254
|
+
</Button>
|
|
255
|
+
</Stack>
|
|
256
|
+
</Stack>`,
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
render: () => {
|
|
261
|
+
const [currentStep, setCurrentStep] = useState(0);
|
|
262
|
+
const steps = REGISTRATION_STEPS;
|
|
263
|
+
|
|
264
|
+
return (
|
|
265
|
+
<div className="w-full max-w-2xl border border-gray-100 rounded-xl p-8 flex flex-col gap-8">
|
|
266
|
+
<Stepper steps={steps} currentStep={currentStep} />
|
|
267
|
+
|
|
268
|
+
{/* Step content placeholder */}
|
|
269
|
+
<div className="min-h-[120px] flex items-center justify-center rounded-lg border border-dashed border-gray-200 bg-gray-50">
|
|
270
|
+
<span className="text-sm text-gray-400">
|
|
271
|
+
{currentStep < steps.length
|
|
272
|
+
? `${steps[currentStep].title} — step content goes here`
|
|
273
|
+
: "All steps complete!"}
|
|
274
|
+
</span>
|
|
275
|
+
</div>
|
|
276
|
+
|
|
277
|
+
{/* Navigation */}
|
|
278
|
+
<div className="flex justify-between">
|
|
279
|
+
<Button
|
|
280
|
+
variant="secondary-light"
|
|
281
|
+
size="large"
|
|
282
|
+
disabled={currentStep === 0}
|
|
283
|
+
onClick={() => setCurrentStep((s) => s - 1)}
|
|
284
|
+
>
|
|
285
|
+
Back
|
|
286
|
+
</Button>
|
|
287
|
+
<Button
|
|
288
|
+
variant="primary-dark"
|
|
289
|
+
size="large"
|
|
290
|
+
disabled={currentStep >= steps.length}
|
|
291
|
+
onClick={() => setCurrentStep((s) => s + 1)}
|
|
292
|
+
>
|
|
293
|
+
{currentStep === steps.length - 1 ? "Submit" : "Next"}
|
|
294
|
+
</Button>
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
);
|
|
298
|
+
},
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
export const CertificationWizard: Story = {
|
|
302
|
+
name: "WELL certification wizard",
|
|
303
|
+
parameters: {
|
|
304
|
+
docs: {
|
|
305
|
+
source: {
|
|
306
|
+
code: `import { Stepper } from "@syscore/ui-library"
|
|
307
|
+
|
|
308
|
+
const certificationSteps = [
|
|
309
|
+
{ title: "Registration", description: "Project & team details" },
|
|
310
|
+
{ title: "Documentation", description: "Upload project files" },
|
|
311
|
+
{ title: "Assessment", description: "WELL scorecard review" },
|
|
312
|
+
{ title: "Verification", description: "On-site performance tests" },
|
|
313
|
+
{ title: "Certification", description: "Award & seal issuance" },
|
|
314
|
+
]
|
|
315
|
+
|
|
316
|
+
<Stepper
|
|
317
|
+
steps={certificationSteps}
|
|
318
|
+
currentStep={2}
|
|
319
|
+
orientation="vertical"
|
|
320
|
+
size="lg"
|
|
321
|
+
/>`,
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
render: () => {
|
|
326
|
+
const certificationSteps = [
|
|
327
|
+
{ title: "Registration", description: "Project & team details" },
|
|
328
|
+
{ title: "Documentation", description: "Upload project files" },
|
|
329
|
+
{ title: "Assessment", description: "WELL scorecard review" },
|
|
330
|
+
{ title: "Verification", description: "On-site performance tests" },
|
|
331
|
+
{ title: "Certification", description: "Award & seal issuance" },
|
|
332
|
+
];
|
|
333
|
+
return (
|
|
334
|
+
<div className="max-w-xs border border-gray-100 rounded-xl p-6">
|
|
335
|
+
<Stepper
|
|
336
|
+
steps={certificationSteps}
|
|
337
|
+
currentStep={2}
|
|
338
|
+
orientation="vertical"
|
|
339
|
+
size="lg"
|
|
340
|
+
/>
|
|
341
|
+
</div>
|
|
342
|
+
);
|
|
343
|
+
},
|
|
344
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { SwitchV01 } from "../../components/ui/switch-v01";
|
|
3
|
+
|
|
4
|
+
const directions = ["right", "left"] as const;
|
|
5
|
+
const states = [
|
|
6
|
+
{ label: "Active", checked: true },
|
|
7
|
+
{ label: "Inactive", checked: false },
|
|
8
|
+
] as const;
|
|
9
|
+
|
|
10
|
+
const meta = {
|
|
11
|
+
title: "Components/Switch",
|
|
12
|
+
component: SwitchV01,
|
|
13
|
+
tags: ["autodocs"],
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: "centered",
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component: [
|
|
19
|
+
"Binary toggle. Existing `Components/SwitchLegacy` (`Switch`) is unchanged.",
|
|
20
|
+
"",
|
|
21
|
+
"Stories are the two states: **Active** and **Inactive**.",
|
|
22
|
+
"Use **Controls** for text direction, label, and disabled.",
|
|
23
|
+
"All Variants shows the full set of **4**.",
|
|
24
|
+
"",
|
|
25
|
+
"---",
|
|
26
|
+
"",
|
|
27
|
+
"## Import",
|
|
28
|
+
"",
|
|
29
|
+
"```tsx",
|
|
30
|
+
`import { SwitchV01 } from "@syscore/ui-library"`,
|
|
31
|
+
"```",
|
|
32
|
+
"",
|
|
33
|
+
"## How to use",
|
|
34
|
+
"",
|
|
35
|
+
"Wraps the Radix switch, so it is a real checkbox-role control: space toggles it,",
|
|
36
|
+
"it takes focus, and the label is clickable. Leave it uncontrolled with",
|
|
37
|
+
"`defaultChecked`, or drive it with `checked` and `onCheckedChange`.",
|
|
38
|
+
"",
|
|
39
|
+
"```tsx",
|
|
40
|
+
"const [enabled, setEnabled] = useState(false)",
|
|
41
|
+
"",
|
|
42
|
+
"<SwitchV01",
|
|
43
|
+
` label="Email alerts"`,
|
|
44
|
+
` textDirection="right"`,
|
|
45
|
+
" checked={enabled}",
|
|
46
|
+
" onCheckedChange={setEnabled}",
|
|
47
|
+
"/>",
|
|
48
|
+
"```",
|
|
49
|
+
"",
|
|
50
|
+
"| Situation | Use |",
|
|
51
|
+
"|-----------|-----|",
|
|
52
|
+
'| Label after the toggle | `textDirection="right"` (default) |',
|
|
53
|
+
'| Label before the toggle | `textDirection="left"` |',
|
|
54
|
+
"| Toggle on its own | `showText={false}` |",
|
|
55
|
+
"| Read-only row | `disabled` |",
|
|
56
|
+
"",
|
|
57
|
+
"## Props",
|
|
58
|
+
"",
|
|
59
|
+
"| Prop | Values | Default | Effect |",
|
|
60
|
+
"|------|--------|---------|--------|",
|
|
61
|
+
"| `checked` | `boolean` | — | Controlled state (stories) |",
|
|
62
|
+
"| `defaultChecked` | `boolean` | `false` | Uncontrolled initial state |",
|
|
63
|
+
"| `onCheckedChange` | `(checked: boolean) => void` | — | Fires on toggle |",
|
|
64
|
+
'| `textDirection` | `"right"` \\| `"left"` | `"right"` | Which side the label sits on |',
|
|
65
|
+
'| `label` | `ReactNode` | `"Label"` | Overline text beside the toggle |',
|
|
66
|
+
"| `showText` | `boolean` | `true` | Drop the label and render the toggle alone |",
|
|
67
|
+
"| `disabled` | `boolean` | `false` | Dims and blocks interaction |",
|
|
68
|
+
].join("\n"),
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
argTypes: {
|
|
73
|
+
textDirection: { control: "inline-radio", options: [...directions] },
|
|
74
|
+
label: { control: "text" },
|
|
75
|
+
showText: { control: "boolean" },
|
|
76
|
+
disabled: { control: "boolean" },
|
|
77
|
+
checked: { table: { disable: true } },
|
|
78
|
+
},
|
|
79
|
+
args: {
|
|
80
|
+
textDirection: "right",
|
|
81
|
+
label: "Label",
|
|
82
|
+
showText: true,
|
|
83
|
+
disabled: false,
|
|
84
|
+
},
|
|
85
|
+
} satisfies Meta<typeof SwitchV01>;
|
|
86
|
+
|
|
87
|
+
export default meta;
|
|
88
|
+
type Story = StoryObj<typeof meta>;
|
|
89
|
+
|
|
90
|
+
export const Active: Story = {
|
|
91
|
+
args: { checked: true },
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const Inactive: Story = {
|
|
95
|
+
args: { checked: false },
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const AllVariants: Story = {
|
|
99
|
+
name: "All Variants",
|
|
100
|
+
render: (args) => (
|
|
101
|
+
<div
|
|
102
|
+
style={{
|
|
103
|
+
display: "grid",
|
|
104
|
+
gridTemplateColumns: "minmax(0, 1fr)",
|
|
105
|
+
justifyItems: "center",
|
|
106
|
+
gap: 40,
|
|
107
|
+
width: "100%",
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
{directions.map((textDirection) => (
|
|
111
|
+
<section key={textDirection} style={{ width: "100%", maxWidth: 460 }}>
|
|
112
|
+
<h3
|
|
113
|
+
style={{
|
|
114
|
+
margin: "0 0 16px",
|
|
115
|
+
fontSize: 14,
|
|
116
|
+
fontWeight: 600,
|
|
117
|
+
textTransform: "uppercase",
|
|
118
|
+
letterSpacing: 0.5,
|
|
119
|
+
color: "#52545d",
|
|
120
|
+
textAlign: "center",
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
Text {textDirection}
|
|
124
|
+
</h3>
|
|
125
|
+
<div
|
|
126
|
+
style={{
|
|
127
|
+
display: "grid",
|
|
128
|
+
gridTemplateColumns: "repeat(auto-fill, minmax(200px, 1fr))",
|
|
129
|
+
maxWidth: 416,
|
|
130
|
+
margin: "0 auto",
|
|
131
|
+
gap: 16,
|
|
132
|
+
justifyItems: "center",
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
{states.map((state) => (
|
|
136
|
+
<SwitchV01
|
|
137
|
+
key={`${textDirection}-${state.label}`}
|
|
138
|
+
{...args}
|
|
139
|
+
textDirection={textDirection}
|
|
140
|
+
checked={state.checked}
|
|
141
|
+
/>
|
|
142
|
+
))}
|
|
143
|
+
</div>
|
|
144
|
+
</section>
|
|
145
|
+
))}
|
|
146
|
+
</div>
|
|
147
|
+
),
|
|
148
|
+
argTypes: {
|
|
149
|
+
textDirection: { table: { disable: true } },
|
|
150
|
+
},
|
|
151
|
+
parameters: { layout: "padded" },
|
|
152
|
+
};
|