@dust-tt/sparkle 0.2.278 → 0.2.280-rc-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/cjs/index.js +4166 -34377
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/esm/components/Notification.d.ts +11 -0
  4. package/dist/esm/components/Notification.d.ts.map +1 -1
  5. package/dist/esm/components/Notification.js +46 -1
  6. package/dist/esm/components/Notification.js.map +1 -1
  7. package/dist/esm/components/Tabs.d.ts +12 -0
  8. package/dist/esm/components/Tabs.d.ts.map +1 -0
  9. package/dist/esm/components/Tabs.js +24 -0
  10. package/dist/esm/components/Tabs.js.map +1 -0
  11. package/dist/esm/components/index.d.ts +3 -2
  12. package/dist/esm/components/index.d.ts.map +1 -1
  13. package/dist/esm/components/index.js +2 -2
  14. package/dist/esm/components/index.js.map +1 -1
  15. package/dist/esm/stories/Notification.stories.d.ts +3 -4
  16. package/dist/esm/stories/Notification.stories.d.ts.map +1 -1
  17. package/dist/esm/stories/Notification.stories.js +16 -1
  18. package/dist/esm/stories/Notification.stories.js.map +1 -1
  19. package/dist/esm/stories/Tabs.stories.d.ts +7 -0
  20. package/dist/esm/stories/Tabs.stories.d.ts.map +1 -0
  21. package/dist/esm/stories/Tabs.stories.js +17 -0
  22. package/dist/esm/stories/Tabs.stories.js.map +1 -0
  23. package/dist/sparkle.css +35 -80
  24. package/package.json +6 -3
  25. package/src/components/Notification.tsx +107 -1
  26. package/src/components/Tabs.tsx +60 -0
  27. package/src/components/index.ts +3 -2
  28. package/src/stories/Notification.stories.tsx +27 -2
  29. package/src/stories/Tabs.stories.tsx +33 -0
  30. package/dist/esm/components/Tab.d.ts +0 -38
  31. package/dist/esm/components/Tab.d.ts.map +0 -1
  32. package/dist/esm/components/Tab.js +0 -130
  33. package/dist/esm/components/Tab.js.map +0 -1
  34. package/dist/esm/stories/Tab.stories.d.ts +0 -9
  35. package/dist/esm/stories/Tab.stories.d.ts.map +0 -1
  36. package/dist/esm/stories/Tab.stories.js +0 -80
  37. package/dist/esm/stories/Tab.stories.js.map +0 -1
  38. package/src/components/Tab.tsx +0 -243
  39. package/src/stories/Tab.stories.tsx +0 -104
@@ -1,4 +1,6 @@
1
- import React from "react";
1
+ import { Transition } from "@headlessui/react";
2
+ import React, { useEffect } from "react";
3
+ import { createPortal } from "react-dom";
2
4
 
3
5
  import { IconButton } from "@sparkle/components/IconButton";
4
6
  import { CheckCircleIcon, XCircleIcon, XMarkIcon } from "@sparkle/icons";
@@ -6,6 +8,17 @@ import { classNames } from "@sparkle/lib/utils";
6
8
 
7
9
  import { Icon } from "./Icon";
8
10
 
11
+ const NOTIFICATION_DELAY = 5000;
12
+
13
+ export type NotificationType = {
14
+ title?: string;
15
+ description?: string;
16
+ type: "success" | "error";
17
+ };
18
+
19
+ const NotificationsContext = React.createContext<(n: NotificationType) => void>(
20
+ (n) => n
21
+ );
9
22
  export interface NotificationProps {
10
23
  className?: string;
11
24
  description?: string;
@@ -70,3 +83,96 @@ export function Notification({
70
83
  </div>
71
84
  );
72
85
  }
86
+
87
+ function NotificationWithTransition({
88
+ title,
89
+ description,
90
+ type,
91
+ }: NotificationType) {
92
+ const [showNotification, setShowNotification] = React.useState(true);
93
+ useEffect(() => {
94
+ setTimeout(() => {
95
+ setShowNotification(false);
96
+ }, NOTIFICATION_DELAY);
97
+ }, []);
98
+ return (
99
+ <Transition
100
+ show={showNotification}
101
+ appear={true}
102
+ enter="s-transition s-ease-in-out s-duration-300 s-transform"
103
+ enterFrom="s-translate-y-16 s-opacity-0"
104
+ enterTo="s-translate-y-0 s-opacity-100"
105
+ leave="s-transition s-ease-in-out s-duration-300 s-transform"
106
+ leaveFrom="s-translate-y-0 s-opacity-100"
107
+ leaveTo="s-translate-y-16 s-opacity-0"
108
+ >
109
+ <Notification
110
+ variant={type}
111
+ description={description}
112
+ title={title}
113
+ onClick={() => setShowNotification(false)}
114
+ />
115
+ </Transition>
116
+ );
117
+ }
118
+
119
+ function NotificationsList({
120
+ notifications,
121
+ }: {
122
+ notifications: (NotificationType & { id: string })[];
123
+ }) {
124
+ return (
125
+ <div className="s-pointer-events-none s-fixed s-bottom-0 s-right-0 s-z-60 s-w-96">
126
+ <div className="s-flex s-flex-col s-items-center s-justify-center s-gap-4 s-p-4">
127
+ {notifications.map((n) => {
128
+ return (
129
+ <NotificationWithTransition
130
+ key={n.id}
131
+ title={n.title}
132
+ description={n.description}
133
+ type={n.type}
134
+ />
135
+ );
136
+ })}
137
+ </div>
138
+ </div>
139
+ );
140
+ }
141
+
142
+ Notification.Area = ({ children }: { children: React.ReactNode }) => {
143
+ const [notifications, setNotifications] = React.useState<
144
+ (NotificationType & { id: string })[]
145
+ >([]);
146
+
147
+ function sendNotification(n: NotificationType) {
148
+ const id = Math.random().toString();
149
+ setNotifications((notifications) => [...notifications, { ...n, id }]);
150
+ /* After a delay allowing for the notification exit animation, remove the
151
+ notification from the list */
152
+ setTimeout(() => {
153
+ setNotifications((notifications) =>
154
+ notifications.filter((n) => n.id !== id)
155
+ );
156
+ }, NOTIFICATION_DELAY + 1000);
157
+ }
158
+
159
+ return (
160
+ <NotificationsContext.Provider value={sendNotification}>
161
+ {children}
162
+ {
163
+ /** Notifications are created at DOM root via a Portal. This is to avoid
164
+ * them being made inert by headlessUI modals */
165
+ typeof window === "object" ? (
166
+ createPortal(
167
+ <NotificationsList notifications={notifications} />,
168
+ document.body
169
+ )
170
+ ) : (
171
+ <NotificationsList notifications={notifications} />
172
+ ) // SSR (otherwise hydration issues)
173
+ }
174
+ </NotificationsContext.Provider>
175
+ );
176
+ };
177
+
178
+ export const useSendNotification = () => React.useContext(NotificationsContext);
@@ -0,0 +1,60 @@
1
+ import * as TabsPrimitive from "@radix-ui/react-tabs";
2
+ import * as React from "react";
3
+
4
+ import { Button } from "@sparkle/components";
5
+ import { cn } from "@sparkle/lib/utils";
6
+
7
+ const Tabs = TabsPrimitive.Root;
8
+
9
+ const TabsList = React.forwardRef<
10
+ React.ElementRef<typeof TabsPrimitive.List>,
11
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
12
+ >(({ className, ...props }, ref) => (
13
+ <TabsPrimitive.List
14
+ ref={ref}
15
+ className={cn(
16
+ "s-inline-flex s-h-10 s-items-center s-gap-2 s-border-b s-border-separator",
17
+ className
18
+ )}
19
+ {...props}
20
+ />
21
+ ));
22
+ TabsList.displayName = TabsPrimitive.List.displayName;
23
+
24
+ const TabsTrigger = React.forwardRef<
25
+ React.ElementRef<typeof TabsPrimitive.Trigger>,
26
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger> & {
27
+ label?: string;
28
+ icon?: React.ComponentType;
29
+ isLoading?: boolean;
30
+ }
31
+ >(({ className, label, icon, ...props }, ref) => (
32
+ <TabsPrimitive.Trigger
33
+ ref={ref}
34
+ className={cn(
35
+ "s-border-0 s-border-b-2 s-border-primary-800/0 s-pb-1 disabled:s-pointer-events-none data-[state=active]:s-border-primary-800",
36
+ className
37
+ )}
38
+ {...props}
39
+ >
40
+ <Button variant="ghost" size="sm" label={label} icon={icon} />
41
+ </TabsPrimitive.Trigger>
42
+ ));
43
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
44
+
45
+ const TabsContent = React.forwardRef<
46
+ React.ElementRef<typeof TabsPrimitive.Content>,
47
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
48
+ >(({ className, ...props }, ref) => (
49
+ <TabsPrimitive.Content
50
+ ref={ref}
51
+ className={cn(
52
+ "focus-visible:s-ring-ring s-contents s-ring-offset-background focus-visible:s-outline-none focus-visible:s-ring-2 focus-visible:s-ring-offset-2",
53
+ className
54
+ )}
55
+ {...props}
56
+ />
57
+ ));
58
+ TabsContent.displayName = TabsPrimitive.Content.displayName;
59
+
60
+ export { Tabs, TabsContent, TabsList, TabsTrigger };
@@ -66,7 +66,8 @@ export {
66
66
  NewDropdownMenuSubTrigger,
67
67
  NewDropdownMenuTrigger,
68
68
  } from "./NewDropdown";
69
- export { Notification } from "./Notification";
69
+ export type { NotificationType } from "./Notification";
70
+ export { Notification, useSendNotification } from "./Notification";
70
71
  export { Page } from "./Page";
71
72
  export { PaginatedCitationsGrid } from "./PaginatedCitationsGrid";
72
73
  export { Pagination } from "./Pagination";
@@ -84,7 +85,7 @@ export { Searchbar } from "./Searchbar";
84
85
  export { Separator } from "./Separator";
85
86
  export { SliderToggle } from "./SliderToggle";
86
87
  export { default as Spinner } from "./Spinner";
87
- export { Tab } from "./Tab";
88
+ export { Tabs, TabsContent, TabsList, TabsTrigger } from "./Tabs";
88
89
  export { TextArea } from "./TextArea";
89
90
  export {
90
91
  Tooltip,
@@ -1,11 +1,20 @@
1
1
  import type { Meta } from "@storybook/react";
2
2
  import React from "react";
3
3
 
4
- import { Notification } from "../index_with_tw_base";
4
+ import { useSendNotification } from "@sparkle/components/Notification";
5
5
 
6
- const meta = {
6
+ import { Button, Notification } from "../index_with_tw_base";
7
+
8
+ const meta: Meta<typeof Notification> = {
7
9
  title: "Modules/Notification",
8
10
  component: Notification,
11
+ decorators: [
12
+ (Story) => (
13
+ <Notification.Area>
14
+ <Story />
15
+ </Notification.Area>
16
+ ),
17
+ ],
9
18
  } satisfies Meta<typeof Notification>;
10
19
 
11
20
  export default meta;
@@ -36,3 +45,19 @@ export const NotificationExample = () => {
36
45
  </>
37
46
  );
38
47
  };
48
+
49
+ export const NotificationAreaExample = () => {
50
+ const sendNotification = useSendNotification();
51
+ return (
52
+ <Button
53
+ onClick={() =>
54
+ sendNotification({
55
+ title: "Success",
56
+ description: "it works",
57
+ type: "success",
58
+ })
59
+ }
60
+ label="click"
61
+ />
62
+ );
63
+ };
@@ -0,0 +1,33 @@
1
+ import { Meta } from "@storybook/react";
2
+ import React from "react";
3
+
4
+ import {
5
+ Cog6ToothIcon,
6
+ CommandIcon,
7
+ LightbulbIcon,
8
+ Tabs,
9
+ TabsContent,
10
+ TabsList,
11
+ TabsTrigger,
12
+ } from "../index_with_tw_base";
13
+
14
+ const meta = {
15
+ title: "Components/Tabs",
16
+ } satisfies Meta;
17
+
18
+ export default meta;
19
+
20
+ export function TabExample() {
21
+ return (
22
+ <Tabs defaultValue="account">
23
+ <TabsList className="grid w-full grid-cols-2">
24
+ <TabsTrigger value="account" label="Hello" icon={CommandIcon} />
25
+ <TabsTrigger value="password" label="World" icon={LightbulbIcon} />
26
+ <TabsTrigger value="settings" icon={Cog6ToothIcon} />
27
+ </TabsList>
28
+ <TabsContent value="account">Hello</TabsContent>
29
+ <TabsContent value="password">World</TabsContent>
30
+ <TabsContent value="settings">Settings</TabsContent>
31
+ </Tabs>
32
+ );
33
+ }
@@ -1,38 +0,0 @@
1
- import React, { ComponentType, MouseEvent } from "react";
2
- type TabType<E> = {
3
- current: boolean;
4
- disabled?: boolean;
5
- hasSeparator?: boolean;
6
- hideLabel?: boolean;
7
- icon?: ComponentType<{
8
- className?: string;
9
- }>;
10
- id?: E;
11
- label: string;
12
- sizing?: "hug" | "expand";
13
- } & ({
14
- onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
15
- href?: never;
16
- } | {
17
- onClick?: never;
18
- href: string;
19
- });
20
- type TabProps<E> = {
21
- variant?: "default" | "stepper";
22
- tabs: Array<TabType<E>>;
23
- setCurrentTab?: (tabId: E, e: MouseEvent<HTMLAnchorElement>) => void;
24
- tabClassName?: string;
25
- className?: string;
26
- };
27
- /**
28
- * Tab component displaying a list of tabs.
29
- *
30
- * Tab click action is specified:
31
- * - either per tab, by providing either an href or an onClick handler in tab
32
- * data (mutually exclusive);
33
- * - or globally, by providing a setCurrentTab function.
34
- * Both per-tab and global actions can be set, the per-tab action taking precedence.
35
- */
36
- export declare function Tab<E>({ variant, tabs, setCurrentTab, className, tabClassName, }: TabProps<E>): React.JSX.Element;
37
- export {};
38
- //# sourceMappingURL=Tab.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../src/components/Tab.tsx"],"names":[],"mappings":"AAAA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
- import { noHrefLink, SparkleContext, } from "../context";
3
- import { ChevronRightIcon } from "../icons";
4
- import { classNames } from "../lib/utils";
5
- import { Icon } from "./Icon";
6
- import { Tooltip } from "./Tooltip";
7
- var tabClasses = {
8
- default: {
9
- base: "s-text-element-800 s-border-transparent s-cursor-pointer s-border-b-2",
10
- hover: "hover:s-text-action-500 hover:s-border-action-300",
11
- dark: {
12
- base: "dark:s-text-element-700-dark",
13
- hover: "dark:hover:s-text-action-600-dark",
14
- },
15
- },
16
- selected: {
17
- base: "s-border-action-500 s-text-action-500 s-cursor-default s-border-b-2",
18
- hover: "",
19
- dark: {
20
- base: "dark:s-border-action-500-dark dark:s-text-action-500-dark",
21
- hover: "",
22
- },
23
- },
24
- stepperDefault: {
25
- base: "s-text-element-800 s-cursor-pointer",
26
- hover: "hover:s-text-action-500",
27
- dark: {
28
- base: "dark:s-text-element-700-dark",
29
- hover: "dark:hover:s-text-action-600-dark",
30
- },
31
- },
32
- stepperSelected: {
33
- base: "s-text-action-500 s-cursor-default",
34
- hover: "",
35
- dark: {
36
- base: "dark:dark:s-text-action-500-dark",
37
- hover: "",
38
- },
39
- },
40
- };
41
- var iconClasses = {
42
- default: {
43
- base: "s-text-element-600",
44
- hover: "group-hover/tab:s-text-action-400",
45
- dark: {
46
- base: "dark:s-text-element-600-dark",
47
- hover: "dark:group-hover/tab:s-text-action-500-dark",
48
- },
49
- },
50
- selected: {
51
- base: "s-text-action-400",
52
- hover: "",
53
- dark: {
54
- base: "dark:s-text-action-500-dark",
55
- hover: "",
56
- },
57
- },
58
- };
59
- var tabSizingClasses = {
60
- hug: "",
61
- expand: "s-flex-1",
62
- };
63
- /**
64
- * Tab component displaying a list of tabs.
65
- *
66
- * Tab click action is specified:
67
- * - either per tab, by providing either an href or an onClick handler in tab
68
- * data (mutually exclusive);
69
- * - or globally, by providing a setCurrentTab function.
70
- * Both per-tab and global actions can be set, the per-tab action taking precedence.
71
- */
72
- export function Tab(_a) {
73
- var _b = _a.variant, variant = _b === void 0 ? "default" : _b, tabs = _a.tabs, setCurrentTab = _a.setCurrentTab, className = _a.className, _c = _a.tabClassName, tabClassName = _c === void 0 ? "" : _c;
74
- var components = React.useContext(SparkleContext).components;
75
- var renderTabs = function () {
76
- return tabs.map(function (tab, i) {
77
- var _a, _b, _c, _d, _e;
78
- var tabStateClasses = variant === "stepper"
79
- ? tab.current
80
- ? tabClasses.stepperSelected
81
- : tabClasses.stepperDefault
82
- : tab.current
83
- ? tabClasses.selected
84
- : tabClasses.default;
85
- var iconStateClasses = tab.current
86
- ? iconClasses.selected
87
- : iconClasses.default;
88
- var finalTabClasses = classNames("s-group/tab s-justify-center s-flex s-text-sm s-font-semibold s-py-2.5 s-transition-all ease-out s-duration-400 s-whitespace-nowrap s-select-none", variant === "default"
89
- ? tab.icon
90
- ? tab.hideLabel
91
- ? "s-px-3"
92
- : "s-pr-3.5 s-pl-2.5"
93
- : "s-px-3"
94
- : "s-pl-1", tabStateClasses.base, tabStateClasses.hover, tabStateClasses.dark.base, tabStateClasses.dark.hover, tabClassName, tab.disabled ? "s-opacity-50 s-pointer-events-none" : "");
95
- var finalIconClasses = classNames("s-transition-colors s-duration-400", iconStateClasses.base, iconStateClasses.hover, iconStateClasses.dark.base, iconStateClasses.dark.hover, tabClassName);
96
- var Link = tab.href
97
- ? components.link
98
- : noHrefLink;
99
- // precedence on href and onClick (mutually exclusive), then setCurrentTab
100
- var setCurrentTabFn = function (e) {
101
- if (!tab.id) {
102
- throw new Error("Tab id is required to use setCurrentTab");
103
- }
104
- setCurrentTab === null || setCurrentTab === void 0 ? void 0 : setCurrentTab(tab.id, e);
105
- };
106
- var onClickAction = tab.href
107
- ? undefined
108
- : (_a = tab.onClick) !== null && _a !== void 0 ? _a : setCurrentTabFn;
109
- var content = (React.createElement(Link, { key: tab.label, className: finalTabClasses, "aria-current": tab.current ? "page" : undefined, onClick: onClickAction, href: tab.href || "#" },
110
- React.createElement("div", { className: tab.current
111
- ? "s-flex s-gap-x-2"
112
- : "s-flex s-gap-x-2 s-transition s-duration-300 s-ease-out" },
113
- tab.icon && (React.createElement(Icon, { visual: tab.icon, className: finalIconClasses, size: "sm" })), (_b = tab.hideLabel) !== null && _b !== void 0 ? _b : tab.label,
114
- variant === "stepper" && i < tabs.length - 1 && (React.createElement(Icon, { visual: ChevronRightIcon, className: "s-mx-2 s-text-element-500", size: "sm" })))));
115
- return tab.hideLabel ? (tab.label ? (React.createElement(React.Fragment, { key: "tab-".concat(i) },
116
- React.createElement("div", { className: tabSizingClasses[(_c = tab.sizing) !== null && _c !== void 0 ? _c : "hug"] },
117
- React.createElement(Tooltip, { trigger: content, label: tab.label })),
118
- tab.hasSeparator && (React.createElement("div", { className: "s-flex s-h-full s-grow", key: "sep-".concat(i) })))) : (React.createElement(React.Fragment, { key: "tab-".concat(i) },
119
- React.createElement("div", { className: tabSizingClasses[(_d = tab.sizing) !== null && _d !== void 0 ? _d : "hug"] }, content),
120
- tab.hasSeparator && (React.createElement("div", { className: "s-flex s-h-full s-grow", key: "sep-".concat(i) }))))) : (React.createElement(React.Fragment, { key: "tab-".concat(i) },
121
- React.createElement("div", { className: tabSizingClasses[(_e = tab.sizing) !== null && _e !== void 0 ? _e : "hug"] }, content),
122
- tab.hasSeparator && (React.createElement("div", { className: "s-flex s-h-full s-grow", key: "sep-".concat(i) }))));
123
- });
124
- };
125
- return (React.createElement("div", { className: classNames(variant === "default"
126
- ? "s-border-b s-border-structure-200 dark:s-border-structure-200-dark"
127
- : "", className !== null && className !== void 0 ? className : "", "s-overflow-x-auto s-overflow-y-hidden s-scrollbar-hide") },
128
- React.createElement("nav", { className: "s-flex s-space-x-0", "aria-label": "Tabs" }, renderTabs())));
129
- }
130
- //# sourceMappingURL=Tab.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../src/components/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAEpE,OAAO,EACL,UAAU,EACV,cAAc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K,CAAC,IAAG,OAAO,CAAO;gBACrE,GAAG,CAAC,YAAY,IAAI,CACnB,6BAAK,SAAS,EAAC,wBAAwB,EAAC,GAAG,EAAE,cAAO,CAAC,CAAE,GAAI,CAC5D,CACc,CAClB,CAAC;QACJ,CAAC,CAAC;IAhHF,CAgHE,CAAC;IAEL,OAAO,CACL,6BACE,SAAS,EAAE,UAAU,CACnB,OAAO,KAAK,SAAS;YACnB,CAAC,CAAC,oEAAoE;YACtE,CAAC,CAAC,EAAE,EACN,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,EACf,wDAAwD,CACzD;QAED,6BAAK,SAAS,EAAC,oBAAoB,gBAAY,MAAM,IAClD,UAAU,EAAE,CACT,CACF,CACP,CAAC;AACJ,CAAC"}
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- import { Tab } from "../index_with_tw_base";
3
- declare const meta: {
4
- title: string;
5
- component: typeof Tab;
6
- };
7
- export default meta;
8
- export declare const TabExample: () => React.JSX.Element;
9
- //# sourceMappingURL=Tab.stories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tab.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/Tab.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAIL,GAAG,EAEJ,MAAM,uBAAuB,CAAC;AAM/B,QAAA,MAAM,IAAI;;;CAGkB,CAAC;AAE7B,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,UAAU,yBAiFtB,CAAC"}
@@ -1,80 +0,0 @@
1
- import { __read } from "tslib";
2
- import React from "react";
3
- import { CircleIcon, RobotIcon, SquareIcon, Tab, TriangleIcon, } from "../index_with_tw_base";
4
- import { ChatBubbleBottomCenterTextIcon, Cog6ToothIcon, } from "../index_with_tw_base";
5
- var meta = {
6
- title: "Components/Tab",
7
- component: Tab,
8
- };
9
- export default meta;
10
- export var TabExample = function () {
11
- var _a = __read(React.useState("chat"), 2), currentTab = _a[0], setCurrentTab = _a[1];
12
- var _b = __read(React.useState("instructions"), 2), currentTab2 = _b[0], setCurrentTab2 = _b[1];
13
- return (React.createElement("div", { className: "s-flex s-flex-col s-gap-10" },
14
- React.createElement("div", { className: "s-w-[320px]" },
15
- React.createElement(Tab, { tabs: [
16
- {
17
- label: "Chat",
18
- id: "chat",
19
- current: currentTab === "chat",
20
- icon: ChatBubbleBottomCenterTextIcon,
21
- sizing: "expand",
22
- },
23
- {
24
- label: "Build",
25
- id: "build",
26
- current: currentTab === "build",
27
- icon: RobotIcon,
28
- sizing: "expand",
29
- },
30
- {
31
- label: "Admin",
32
- id: "admin",
33
- current: currentTab === "admin",
34
- icon: RobotIcon,
35
- sizing: "expand",
36
- hasSeparator: true,
37
- disabled: true,
38
- },
39
- {
40
- label: "Settings",
41
- id: "settings",
42
- hideLabel: true,
43
- current: false,
44
- icon: Cog6ToothIcon,
45
- },
46
- ], setCurrentTab: function (tabId, event) {
47
- // add logic here
48
- event.preventDefault();
49
- setCurrentTab(tabId);
50
- } })),
51
- React.createElement("div", { className: "s-w-full" },
52
- React.createElement(Tab, { variant: "stepper", tabs: [
53
- {
54
- label: "Instructions",
55
- id: "instructions",
56
- current: currentTab2 === "instructions",
57
- icon: SquareIcon,
58
- sizing: "hug",
59
- },
60
- {
61
- label: "Data sources & Actions",
62
- id: "data",
63
- current: currentTab2 === "data",
64
- icon: CircleIcon,
65
- sizing: "hug",
66
- },
67
- {
68
- label: "Naming",
69
- id: "naming",
70
- current: currentTab2 === "naming",
71
- icon: TriangleIcon,
72
- sizing: "hug",
73
- },
74
- ], setCurrentTab: function (tabId, event) {
75
- // add logic here
76
- event.preventDefault();
77
- setCurrentTab2(tabId);
78
- } }))));
79
- };
80
- //# sourceMappingURL=Tab.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tab.stories.js","sourceRoot":"","sources":["../../../src/stories/Tab.stories.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B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