@dust-tt/sparkle 0.2.513 → 0.2.516

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.
Files changed (47) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/esm/components/BarHeader.d.ts +6 -2
  3. package/dist/esm/components/BarHeader.d.ts.map +1 -1
  4. package/dist/esm/components/BarHeader.js +18 -7
  5. package/dist/esm/components/BarHeader.js.map +1 -1
  6. package/dist/esm/components/MultiPageSheet.d.ts +30 -0
  7. package/dist/esm/components/MultiPageSheet.d.ts.map +1 -0
  8. package/dist/esm/components/MultiPageSheet.js +59 -0
  9. package/dist/esm/components/MultiPageSheet.js.map +1 -0
  10. package/dist/esm/components/index.d.ts +1 -0
  11. package/dist/esm/components/index.d.ts.map +1 -1
  12. package/dist/esm/components/index.js +1 -0
  13. package/dist/esm/components/index.js.map +1 -1
  14. package/dist/esm/icons/app/Moon.d.ts +5 -0
  15. package/dist/esm/icons/app/Moon.d.ts.map +1 -0
  16. package/dist/esm/icons/app/Moon.js +6 -0
  17. package/dist/esm/icons/app/Moon.js.map +1 -0
  18. package/dist/esm/icons/app/Sun.d.ts +5 -0
  19. package/dist/esm/icons/app/Sun.d.ts.map +1 -0
  20. package/dist/esm/icons/app/Sun.js +6 -0
  21. package/dist/esm/icons/app/Sun.js.map +1 -0
  22. package/dist/esm/icons/app/index.d.ts +2 -0
  23. package/dist/esm/icons/app/index.d.ts.map +1 -1
  24. package/dist/esm/icons/app/index.js +2 -0
  25. package/dist/esm/icons/app/index.js.map +1 -1
  26. package/dist/esm/icons/src/app/moon.svg +3 -0
  27. package/dist/esm/icons/src/app/sun.svg +3 -0
  28. package/dist/esm/stories/BarHeader.stories.d.ts +1 -0
  29. package/dist/esm/stories/BarHeader.stories.d.ts.map +1 -1
  30. package/dist/esm/stories/BarHeader.stories.js +25 -1
  31. package/dist/esm/stories/BarHeader.stories.js.map +1 -1
  32. package/dist/esm/stories/MultiPageSheet.stories.d.ts +8 -0
  33. package/dist/esm/stories/MultiPageSheet.stories.d.ts.map +1 -0
  34. package/dist/esm/stories/MultiPageSheet.stories.js +179 -0
  35. package/dist/esm/stories/MultiPageSheet.stories.js.map +1 -0
  36. package/dist/sparkle.css +13 -0
  37. package/package.json +1 -1
  38. package/src/components/BarHeader.tsx +25 -15
  39. package/src/components/MultiPageSheet.tsx +202 -0
  40. package/src/components/index.ts +8 -0
  41. package/src/icons/app/Moon.tsx +18 -0
  42. package/src/icons/app/Sun.tsx +18 -0
  43. package/src/icons/app/index.ts +2 -0
  44. package/src/icons/src/app/moon.svg +3 -0
  45. package/src/icons/src/app/sun.svg +3 -0
  46. package/src/stories/BarHeader.stories.tsx +80 -1
  47. package/src/stories/MultiPageSheet.stories.tsx +331 -0
@@ -0,0 +1,179 @@
1
+ import { __assign, __read } from "tslib";
2
+ import React, { useState } from "react";
3
+ import { Button } from "../components/Button";
4
+ import { MultiPageSheet, MultiPageSheetContent, MultiPageSheetTrigger, } from "../components/MultiPageSheet";
5
+ import { Cog6ToothIcon, DocumentTextIcon, UserIcon } from "../icons/app";
6
+ var meta = {
7
+ title: "Primitives/MultiPageSheet",
8
+ component: MultiPageSheetContent,
9
+ };
10
+ export default meta;
11
+ var samplePages = [
12
+ {
13
+ id: "profile",
14
+ title: "User Profile",
15
+ description: "Manage your personal information",
16
+ icon: UserIcon,
17
+ content: (React.createElement("div", { className: "s-space-y-4" },
18
+ React.createElement("div", null,
19
+ React.createElement("h3", { className: "s-mb-2 s-text-lg s-font-semibold" }, "Personal Information"),
20
+ React.createElement("p", { className: "s-text-sm s-text-muted-foreground" }, "Update your profile details and preferences.")),
21
+ React.createElement("div", { className: "s-space-y-3" },
22
+ React.createElement("div", null,
23
+ React.createElement("label", { className: "s-text-sm s-font-medium" }, "Full Name"),
24
+ React.createElement("input", { type: "text", className: "s-mt-1 s-w-full s-rounded-md s-border s-px-3 s-py-2", placeholder: "John Doe" })),
25
+ React.createElement("div", null,
26
+ React.createElement("label", { className: "s-text-sm s-font-medium" }, "Email"),
27
+ React.createElement("input", { type: "email", className: "s-mt-1 s-w-full s-rounded-md s-border s-px-3 s-py-2", placeholder: "john@example.com" }))))),
28
+ },
29
+ {
30
+ id: "documents",
31
+ title: "Documents",
32
+ description: "Manage your uploaded files",
33
+ icon: DocumentTextIcon,
34
+ content: (React.createElement("div", { className: "s-space-y-4" },
35
+ React.createElement("div", null,
36
+ React.createElement("h3", { className: "s-mb-2 s-text-lg s-font-semibold" }, "File Management"),
37
+ React.createElement("p", { className: "s-text-sm s-text-muted-foreground" }, "Upload, organize, and manage your documents.")),
38
+ React.createElement("div", { className: "s-space-y-2" },
39
+ React.createElement("div", { className: "s-flex s-items-center s-justify-between s-rounded-md s-border s-p-3" },
40
+ React.createElement("span", { className: "s-text-sm" }, "document1.pdf"),
41
+ React.createElement(Button, { label: "Download", size: "sm", variant: "outline" })),
42
+ React.createElement("div", { className: "s-flex s-items-center s-justify-between s-rounded-md s-border s-p-3" },
43
+ React.createElement("span", { className: "s-text-sm" }, "report.docx"),
44
+ React.createElement(Button, { label: "Download", size: "sm", variant: "outline" }))))),
45
+ },
46
+ {
47
+ id: "settings",
48
+ title: "Settings",
49
+ description: "Configure your preferences",
50
+ icon: Cog6ToothIcon,
51
+ content: (React.createElement("div", { className: "s-space-y-4" },
52
+ React.createElement("div", null,
53
+ React.createElement("h3", { className: "s-mb-2 s-text-lg s-font-semibold" }, "Application Settings"),
54
+ React.createElement("p", { className: "s-text-sm s-text-muted-foreground" }, "Customize your experience and notification preferences.")),
55
+ React.createElement("div", { className: "s-space-y-3" },
56
+ React.createElement("div", { className: "s-flex s-items-center s-justify-between" },
57
+ React.createElement("span", { className: "s-text-sm" }, "Email notifications"),
58
+ React.createElement("input", { type: "checkbox", className: "s-rounded", defaultChecked: true })),
59
+ React.createElement("div", { className: "s-flex s-items-center s-justify-between" },
60
+ React.createElement("span", { className: "s-text-sm" }, "Dark mode"),
61
+ React.createElement("input", { type: "checkbox", className: "s-rounded" })),
62
+ React.createElement("div", { className: "s-flex s-items-center s-justify-between" },
63
+ React.createElement("span", { className: "s-text-sm" }, "Auto-save"),
64
+ React.createElement("input", { type: "checkbox", className: "s-rounded", defaultChecked: true }))))),
65
+ },
66
+ ];
67
+ var MultiPageSheetDemo = function () {
68
+ var _a = __read(useState("profile"), 2), currentPageId = _a[0], setCurrentPageId = _a[1];
69
+ var handleSave = function () {
70
+ alert("Changes saved!");
71
+ };
72
+ return (React.createElement(MultiPageSheet, null,
73
+ React.createElement(MultiPageSheetTrigger, { asChild: true },
74
+ React.createElement(Button, { label: "Open Multi-Page Sheet" })),
75
+ React.createElement(MultiPageSheetContent, { pages: samplePages, currentPageId: currentPageId, onPageChange: setCurrentPageId, size: "lg", onSave: handleSave })));
76
+ };
77
+ export var Default = {
78
+ render: function () { return React.createElement(MultiPageSheetDemo, null); },
79
+ };
80
+ export var InteractiveContent = {
81
+ render: function () {
82
+ var _a = __read(useState("step1"), 2), currentPageId = _a[0], setCurrentPageId = _a[1];
83
+ var _b = __read(useState({
84
+ name: "",
85
+ email: "",
86
+ selectedFile: "",
87
+ notifications: false,
88
+ }), 2), formData = _b[0], setFormData = _b[1];
89
+ var handleSave = function () {
90
+ alert("Setup completed! Data: ".concat(JSON.stringify(formData, null, 2)));
91
+ };
92
+ var interactivePages = [
93
+ {
94
+ id: "step1",
95
+ title: "Personal Info",
96
+ description: "Enter your basic information",
97
+ icon: UserIcon,
98
+ content: (React.createElement("div", { className: "s-space-y-4" },
99
+ React.createElement("div", null,
100
+ React.createElement("h3", { className: "s-mb-2 s-text-lg s-font-semibold" }, "Let's get started"),
101
+ React.createElement("p", { className: "s-text-sm s-text-muted-foreground" }, "Fill in your details to continue to the next step.")),
102
+ React.createElement("div", { className: "s-space-y-3" },
103
+ React.createElement("div", null,
104
+ React.createElement("label", { className: "s-text-sm s-font-medium" }, "Full Name *"),
105
+ React.createElement("input", { type: "text", className: "s-mt-1 s-w-full s-rounded-md s-border s-px-3 s-py-2", placeholder: "Enter your name", value: formData.name, onChange: function (e) {
106
+ return setFormData(__assign(__assign({}, formData), { name: e.target.value }));
107
+ } })),
108
+ React.createElement("div", null,
109
+ React.createElement("label", { className: "s-text-sm s-font-medium" }, "Email *"),
110
+ React.createElement("input", { type: "email", className: "s-mt-1 s-w-full s-rounded-md s-border s-px-3 s-py-2", placeholder: "Enter your email", value: formData.email, onChange: function (e) {
111
+ return setFormData(__assign(__assign({}, formData), { email: e.target.value }));
112
+ } })),
113
+ React.createElement("div", { className: "s-pt-2" },
114
+ React.createElement(Button, { label: "Continue to File Selection", variant: "primary", size: "sm", disabled: !formData.name || !formData.email, onClick: function () { return setCurrentPageId("step2"); } }))))),
115
+ },
116
+ {
117
+ id: "step2",
118
+ title: "File Selection",
119
+ description: "Choose your files",
120
+ icon: DocumentTextIcon,
121
+ content: (React.createElement("div", { className: "s-space-y-4" },
122
+ React.createElement("div", null,
123
+ React.createElement("h3", { className: "s-mb-2 s-text-lg s-font-semibold" }, "Select a file to work with"),
124
+ React.createElement("p", { className: "s-text-sm s-text-muted-foreground" }, "Choose from the available files below.")),
125
+ React.createElement("div", { className: "s-space-y-2" }, [
126
+ "project-proposal.pdf",
127
+ "budget-2024.xlsx",
128
+ "meeting-notes.docx",
129
+ ].map(function (file) { return (React.createElement("div", { key: file, className: "s-flex s-cursor-pointer s-items-center s-justify-between s-rounded-md s-border s-p-3 s-transition-colors hover:s-bg-gray-50 ".concat(formData.selectedFile === file
130
+ ? "s-border-blue-300 s-bg-blue-50"
131
+ : ""), onClick: function () {
132
+ return setFormData(__assign(__assign({}, formData), { selectedFile: file }));
133
+ } },
134
+ React.createElement("span", { className: "s-text-sm" }, file),
135
+ React.createElement("div", { className: "s-flex s-items-center s-gap-2" },
136
+ React.createElement("input", { type: "radio", checked: formData.selectedFile === file, readOnly: true, className: "s-pointer-events-none" })))); })),
137
+ formData.selectedFile && (React.createElement("div", { className: "s-pt-2" },
138
+ React.createElement(Button, { label: "Continue to Settings", variant: "primary", size: "sm", onClick: function () { return setCurrentPageId("step3"); } }))))),
139
+ },
140
+ {
141
+ id: "step3",
142
+ title: "Final Settings",
143
+ description: "Configure your preferences",
144
+ icon: Cog6ToothIcon,
145
+ content: (React.createElement("div", { className: "s-space-y-4" },
146
+ React.createElement("div", null,
147
+ React.createElement("h3", { className: "s-mb-2 s-text-lg s-font-semibold" }, "Almost done!"),
148
+ React.createElement("p", { className: "s-text-sm s-text-muted-foreground" }, "Configure your final preferences and complete the setup.")),
149
+ React.createElement("div", { className: "s-space-y-3" },
150
+ React.createElement("div", { className: "s-flex s-items-center s-justify-between" },
151
+ React.createElement("span", { className: "s-text-sm" }, "Enable email notifications"),
152
+ React.createElement("input", { type: "checkbox", className: "s-rounded", checked: formData.notifications, onChange: function (e) {
153
+ return setFormData(__assign(__assign({}, formData), { notifications: e.target.checked }));
154
+ } })),
155
+ React.createElement("div", { className: "s-rounded-md s-bg-gray-50 s-p-3" },
156
+ React.createElement("h4", { className: "s-mb-2 s-text-sm s-font-medium" }, "Summary"),
157
+ React.createElement("div", { className: "s-space-y-1 s-text-xs s-text-gray-600" },
158
+ React.createElement("div", null,
159
+ "Name: ",
160
+ formData.name),
161
+ React.createElement("div", null,
162
+ "Email: ",
163
+ formData.email),
164
+ React.createElement("div", null,
165
+ "Selected File: ",
166
+ formData.selectedFile),
167
+ React.createElement("div", null,
168
+ "Notifications:",
169
+ " ",
170
+ formData.notifications ? "Enabled" : "Disabled")))))),
171
+ },
172
+ ];
173
+ return (React.createElement(MultiPageSheet, null,
174
+ React.createElement(MultiPageSheetTrigger, { asChild: true },
175
+ React.createElement(Button, { label: "Open Interactive Setup" })),
176
+ React.createElement(MultiPageSheetContent, { pages: interactivePages, currentPageId: currentPageId, onPageChange: setCurrentPageId, size: "lg", onSave: handleSave })));
177
+ },
178
+ };
179
+ //# sourceMappingURL=MultiPageSheet.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiPageSheet.stories.js","sourceRoot":"","sources":["../../../src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
919
+ pointer-events: none;
920
+ }
921
+
918
922
  .s-pointer-events-auto {
919
923
  pointer-events: auto;
920
924
  }
@@ -1199,6 +1203,10 @@ select {
1199
1203
  margin-right: 0.5rem;
1200
1204
  }
1201
1205
 
1206
+ .s-mt-1 {
1207
+ margin-top: 0.25rem;
1208
+ }
1209
+
1202
1210
  .s-mt-11 {
1203
1211
  margin-top: 2.75rem;
1204
1212
  }
@@ -5418,6 +5426,11 @@ select {
5418
5426
  border-color: rgb(223 224 226 / var(--tw-border-opacity));
5419
5427
  }
5420
5428
 
5429
+ .hover\:s-bg-gray-50:hover {
5430
+ --tw-bg-opacity: 1;
5431
+ background-color: rgb(247 247 247 / var(--tw-bg-opacity));
5432
+ }
5433
+
5421
5434
  .hover\:s-bg-highlight-300:hover {
5422
5435
  --tw-bg-opacity: 1;
5423
5436
  background-color: rgb(122 198 255 / var(--tw-bg-opacity));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dust-tt/sparkle",
3
- "version": "0.2.513",
3
+ "version": "0.2.516",
4
4
  "scripts": {
5
5
  "build": "rm -rf dist && npm run tailwind && npm run build:esm && npm run build:cjs",
6
6
  "tailwind": "tailwindcss -i ./src/styles/tailwind.css -o dist/sparkle.css",
@@ -1,3 +1,4 @@
1
+ import { cva, type VariantProps } from "class-variance-authority";
1
2
  import React from "react";
2
3
 
3
4
  import { Tooltip } from "@sparkle/components/Tooltip";
@@ -7,11 +8,27 @@ import {
7
8
  TrashIcon,
8
9
  XMarkIcon,
9
10
  } from "@sparkle/icons/app";
10
- import { classNames } from "@sparkle/lib/utils";
11
+ import { cn } from "@sparkle/lib/utils";
11
12
 
12
13
  import { Button } from "./Button";
13
14
 
14
- interface BarHeaderProps {
15
+ const barHeaderVariants = cva(
16
+ "s-flex s-h-16 s-flex-row s-items-center s-gap-3 s-border-b s-px-4",
17
+ {
18
+ variants: {
19
+ variant: {
20
+ full: "s-fixed s-left-0 s-right-0 s-top-0 s-z-30 s-backdrop-blur s-border-border-dark/70 s-bg-background/80 dark:s-border-border-dark-night/70 dark:s-bg-background-night/80",
21
+ default:
22
+ "s-relative s-z-10 s-border-structure-200 s-bg-structure-50 dark:s-border-structure-200-night dark:s-bg-structure-50-night",
23
+ },
24
+ },
25
+ defaultVariants: {
26
+ variant: "full",
27
+ },
28
+ }
29
+ );
30
+
31
+ interface BarHeaderProps extends VariantProps<typeof barHeaderVariants> {
15
32
  title: string;
16
33
  tooltip?: string;
17
34
  leftActions?: React.ReactNode;
@@ -24,24 +41,17 @@ export function BarHeader({
24
41
  tooltip,
25
42
  leftActions,
26
43
  rightActions,
27
- className = "",
44
+ className,
45
+ variant,
28
46
  }: BarHeaderProps) {
29
- const titleClasses = classNames(
47
+ const titleClasses = cn(
30
48
  "s-text-foreground dark:s-text-foreground-night",
31
49
  "s-heading-base s-truncate s-grow"
32
50
  );
33
- const buttonBarClasses = "s-flex s-gap-1";
34
51
 
35
52
  return (
36
- <div
37
- className={classNames(
38
- "s-fixed s-left-0 s-right-0 s-top-0 s-z-30 s-flex s-h-16 s-flex-row s-items-center s-gap-3 s-border-b s-px-4 s-backdrop-blur",
39
- "s-border-border-dark/70 s-bg-background/80",
40
- "dark:s-border-border-dark-night/70 dark:s-bg-background-night/80",
41
- className
42
- )}
43
- >
44
- {leftActions && <div className={buttonBarClasses}>{leftActions}</div>}
53
+ <div className={cn(barHeaderVariants({ variant }), className)}>
54
+ {leftActions && <div className="s-flex s-gap-1">{leftActions}</div>}
45
55
  <div className={titleClasses}>
46
56
  {tooltip ? (
47
57
  <Tooltip
@@ -53,7 +63,7 @@ export function BarHeader({
53
63
  title
54
64
  )}
55
65
  </div>
56
- {rightActions && <div className={buttonBarClasses}>{rightActions}</div>}
66
+ {rightActions && <div className="s-flex s-gap-1">{rightActions}</div>}
57
67
  </div>
58
68
  );
59
69
  }
@@ -0,0 +1,202 @@
1
+ import * as React from "react";
2
+
3
+ import { Button, Icon } from "@sparkle/components";
4
+ import {
5
+ Sheet,
6
+ SheetClose,
7
+ SheetContainer,
8
+ SheetContent,
9
+ SheetDescription,
10
+ SheetFooter,
11
+ SheetHeader,
12
+ SheetTitle,
13
+ SheetTrigger,
14
+ } from "@sparkle/components/Sheet";
15
+ import { ChevronLeftIcon, ChevronRightIcon } from "@sparkle/icons/app";
16
+
17
+ interface MultiPageSheetPage {
18
+ id: string;
19
+ title: string;
20
+ description?: string;
21
+ icon?: React.ComponentType;
22
+ content: React.ReactNode;
23
+ }
24
+
25
+ interface MultiPageSheetProps {
26
+ pages: MultiPageSheetPage[];
27
+ currentPageId: string;
28
+ onPageChange: (pageId: string) => void;
29
+ size?: React.ComponentProps<typeof SheetContent>["size"];
30
+ side?: React.ComponentProps<typeof SheetContent>["side"];
31
+ trapFocusScope?: boolean;
32
+ showNavigation?: boolean;
33
+ footerContent?: React.ReactNode;
34
+ onSave?: () => void;
35
+ className?: string;
36
+ }
37
+
38
+ const MultiPageSheetRoot = Sheet;
39
+ const MultiPageSheetTrigger = SheetTrigger;
40
+ const MultiPageSheetClose = SheetClose;
41
+
42
+ interface MultiPageSheetContentProps extends MultiPageSheetProps {
43
+ children?: never;
44
+ }
45
+
46
+ const MultiPageSheetContent = React.forwardRef<
47
+ React.ElementRef<typeof SheetContent>,
48
+ MultiPageSheetContentProps
49
+ >(
50
+ (
51
+ {
52
+ pages,
53
+ currentPageId,
54
+ onPageChange,
55
+ size = "md",
56
+ side = "right",
57
+ trapFocusScope,
58
+ showNavigation = true,
59
+ footerContent,
60
+ onSave,
61
+ className,
62
+ ...props
63
+ },
64
+ ref
65
+ ) => {
66
+ const currentPageIndex = pages.findIndex(
67
+ (page) => page.id === currentPageId
68
+ );
69
+ const currentPage = pages[currentPageIndex];
70
+
71
+ const handlePrevious = React.useCallback(() => {
72
+ if (currentPageIndex > 0) {
73
+ onPageChange(pages[currentPageIndex - 1].id);
74
+ }
75
+ }, [currentPageIndex, pages, onPageChange]);
76
+
77
+ const handleNext = React.useCallback(() => {
78
+ if (currentPageIndex < pages.length - 1) {
79
+ onPageChange(pages[currentPageIndex + 1].id);
80
+ }
81
+ }, [currentPageIndex, pages, onPageChange]);
82
+
83
+ if (!currentPage) {
84
+ console.warn(`Page with id "${currentPageId}" not found`);
85
+ return null;
86
+ }
87
+
88
+ const hasPrevious = currentPageIndex > 0;
89
+ const hasNext = currentPageIndex < pages.length - 1;
90
+
91
+ return (
92
+ <SheetContent
93
+ ref={ref}
94
+ size={size}
95
+ side={side}
96
+ trapFocusScope={trapFocusScope}
97
+ className={className}
98
+ {...props}
99
+ >
100
+ <SheetHeader hideButton={true}>
101
+ <div className="s-flex s-items-center s-justify-between s-pr-8">
102
+ <div className="s-flex s-items-center s-gap-3">
103
+ {showNavigation && (
104
+ <div className="s-flex s-items-center s-gap-1">
105
+ <Button
106
+ icon={ChevronLeftIcon}
107
+ variant="ghost"
108
+ size="sm"
109
+ disabled={!hasPrevious}
110
+ onClick={handlePrevious}
111
+ tooltip={hasPrevious ? "Previous page" : undefined}
112
+ />
113
+ <Button
114
+ icon={ChevronRightIcon}
115
+ variant="ghost"
116
+ size="sm"
117
+ disabled={!hasNext}
118
+ onClick={handleNext}
119
+ tooltip={hasNext ? "Next page" : undefined}
120
+ />
121
+ </div>
122
+ )}
123
+ <div className="s-flex s-items-center s-gap-2">
124
+ {currentPage.icon && (
125
+ <Icon
126
+ visual={currentPage.icon}
127
+ size="lg"
128
+ className="s-text-foreground"
129
+ />
130
+ )}
131
+ <div>
132
+ <SheetTitle>{currentPage.title}</SheetTitle>
133
+ {currentPage.description && (
134
+ <SheetDescription>
135
+ {currentPage.description}
136
+ </SheetDescription>
137
+ )}
138
+ </div>
139
+ </div>
140
+ </div>
141
+ {showNavigation && pages.length > 1 && (
142
+ <div className="s-text-xs s-text-muted-foreground dark:s-text-muted-foreground-night">
143
+ {currentPageIndex + 1} / {pages.length}
144
+ </div>
145
+ )}
146
+ </div>
147
+ </SheetHeader>
148
+
149
+ <SheetContainer>{currentPage.content}</SheetContainer>
150
+
151
+ <SheetFooter
152
+ leftButtonProps={{
153
+ label: "Cancel",
154
+ variant: "outline",
155
+ size: "sm",
156
+ }}
157
+ >
158
+ <div className="s-ml-auto s-flex s-items-center s-gap-2">
159
+ {showNavigation && pages.length > 1 && hasPrevious && (
160
+ <Button
161
+ label="Previous"
162
+ icon={ChevronLeftIcon}
163
+ variant="outline"
164
+ size="sm"
165
+ onClick={handlePrevious}
166
+ />
167
+ )}
168
+ {showNavigation && pages.length > 1 && hasNext && (
169
+ <Button
170
+ label="Next"
171
+ icon={ChevronRightIcon}
172
+ variant="outline"
173
+ size="sm"
174
+ onClick={handleNext}
175
+ />
176
+ )}
177
+ {showNavigation && pages.length > 1 && !hasNext && onSave && (
178
+ <Button
179
+ label="Save changes"
180
+ variant="primary"
181
+ size="sm"
182
+ onClick={onSave}
183
+ />
184
+ )}
185
+ {footerContent}
186
+ </div>
187
+ </SheetFooter>
188
+ </SheetContent>
189
+ );
190
+ }
191
+ );
192
+
193
+ MultiPageSheetContent.displayName = "MultiPageSheetContent";
194
+
195
+ export {
196
+ MultiPageSheetRoot as MultiPageSheet,
197
+ MultiPageSheetClose,
198
+ MultiPageSheetContent,
199
+ type MultiPageSheetPage,
200
+ type MultiPageSheetProps,
201
+ MultiPageSheetTrigger,
202
+ };
@@ -97,6 +97,14 @@ export { LinkWrapper } from "./LinkWrapper";
97
97
  export { LoadingBlock } from "./LoadingBlock";
98
98
  export * from "./markdown";
99
99
  export { markdownStyles } from "./markdown/styles";
100
+ export {
101
+ MultiPageSheet,
102
+ MultiPageSheetClose,
103
+ MultiPageSheetContent,
104
+ type MultiPageSheetPage,
105
+ type MultiPageSheetProps,
106
+ MultiPageSheetTrigger,
107
+ } from "./MultiPageSheet";
100
108
  export * from "./NavigationList";
101
109
  export type { NotificationType } from "./Notification";
102
110
  export { Notification, useSendNotification } from "./Notification";
@@ -0,0 +1,18 @@
1
+ import type { SVGProps } from "react";
2
+ import * as React from "react";
3
+ const SvgMoon = (props: SVGProps<SVGSVGElement>) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width="1em"
7
+ height="1em"
8
+ fill="none"
9
+ viewBox="0 0 24 25"
10
+ {...props}
11
+ >
12
+ <path
13
+ fill="currentColor"
14
+ d="M10 7.875a7 7 0 0 0 12 4.9v.1c0 5.523-4.477 10-10 10s-10-4.477-10-10 4.477-10 10-10h.1a6.98 6.98 0 0 0-2.1 5Z"
15
+ />
16
+ </svg>
17
+ );
18
+ export default SvgMoon;
@@ -0,0 +1,18 @@
1
+ import type { SVGProps } from "react";
2
+ import * as React from "react";
3
+ const SvgSun = (props: SVGProps<SVGSVGElement>) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width="1em"
7
+ height="1em"
8
+ fill="none"
9
+ viewBox="0 0 24 25"
10
+ {...props}
11
+ >
12
+ <path
13
+ fill="currentColor"
14
+ d="M12 18.875a6 6 0 1 1 0-12 6 6 0 0 1 0 12Zm-1-17h2v3h-2v-3Zm0 19h2v3h-2v-3ZM3.515 5.804 4.929 4.39 7.05 6.51 5.636 7.925 3.515 5.804ZM16.95 19.239l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121Zm2.121-14.85 1.414 1.415-2.121 2.121-1.414-1.414L19.07 4.39ZM5.636 17.826l1.414 1.414L4.93 21.36l-1.414-1.414 2.121-2.121ZM23 11.875v2h-3v-2h3Zm-19 0v2H1v-2h3Z"
15
+ />
16
+ </svg>
17
+ );
18
+ export default SvgSun;
@@ -88,6 +88,7 @@ export { default as LogoutIcon } from "./Logout";
88
88
  export { default as MagicIcon } from "./Magic";
89
89
  export { default as MagnifyingGlassIcon } from "./MagnifyingGlass";
90
90
  export { default as MenuIcon } from "./Menu";
91
+ export { default as MoonIcon } from "./Moon";
91
92
  export { default as MoreIcon } from "./More";
92
93
  export { default as MovingMailIcon } from "./MovingMail";
93
94
  export { default as PaintIcon } from "./Paint";
@@ -114,6 +115,7 @@ export { default as StarStrokeIcon } from "./StarStroke";
114
115
  export { default as StopIcon } from "./Stop";
115
116
  export { default as StopSignIcon } from "./StopSign";
116
117
  export { default as SuitcaseIcon } from "./Suitcase";
118
+ export { default as SunIcon } from "./Sun";
117
119
  export { default as TableIcon } from "./Table";
118
120
  export { default as TagIcon } from "./Tag";
119
121
  export { default as TestTubeIcon } from "./TestTube";
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M10 7.875C10 11.741 13.134 14.875 17 14.875C18.9584 14.875 20.729 14.0707 21.9995 12.7745C22 12.808 22 12.8415 22 12.875C22 18.3978 17.5228 22.875 12 22.875C6.47715 22.875 2 18.3978 2 12.875C2 7.35215 6.47715 2.875 12 2.875C12.0335 2.875 12.067 2.875 12.1005 2.87549C10.8043 4.14598 10 5.91657 10 7.875Z" fill="#111418"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M12 18.875C8.68629 18.875 6 16.1887 6 12.875C6 9.56129 8.68629 6.875 12 6.875C15.3137 6.875 18 9.56129 18 12.875C18 16.1887 15.3137 18.875 12 18.875ZM11 1.875H13V4.875H11V1.875ZM11 20.875H13V23.875H11V20.875ZM3.51472 5.80393L4.92893 4.38972L7.05025 6.51104L5.63604 7.92525L3.51472 5.80393ZM16.9497 19.239L18.364 17.8247L20.4853 19.9461L19.0711 21.3603L16.9497 19.239ZM19.0711 4.38972L20.4853 5.80393L18.364 7.92525L16.9497 6.51104L19.0711 4.38972ZM5.63604 17.8247L7.05025 19.239L4.92893 21.3603L3.51472 19.9461L5.63604 17.8247ZM23 11.875V13.875H20V11.875H23ZM4 11.875V13.875H1V11.875H4Z" fill="#111418"/>
3
+ </svg>