@rovula/ui 0.0.45 → 0.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/bundle.css +57 -28
- package/dist/cjs/bundle.js +2 -2
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/Table/Table.d.ts +1 -0
- package/dist/cjs/types/components/Table/Table.stories.d.ts +2 -0
- package/dist/cjs/types/components/Toast/Toast.stories.d.ts +8 -0
- package/dist/cjs/types/components/Toast/Toaster.d.ts +2 -1
- package/dist/cjs/types/components/Toast/useToast.d.ts +1 -0
- package/dist/components/Switch/Switch.js +15 -1
- package/dist/components/Table/Table.js +2 -2
- package/dist/components/Toast/Toast.stories.js +19 -0
- package/dist/components/Toast/Toaster.js +4 -3
- package/dist/components/Toast/useToast.js +5 -2
- package/dist/esm/bundle.css +57 -28
- package/dist/esm/bundle.js +2 -2
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/Table/Table.d.ts +1 -0
- package/dist/esm/types/components/Table/Table.stories.d.ts +2 -0
- package/dist/esm/types/components/Toast/Toast.stories.d.ts +8 -0
- package/dist/esm/types/components/Toast/Toaster.d.ts +2 -1
- package/dist/esm/types/components/Toast/useToast.d.ts +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/src/theme/global.css +1249 -37
- package/dist/theme/global.css +1 -0
- package/dist/theme/themes/SKL/baseline.css +12 -0
- package/dist/theme/themes/SKL/color.css +78 -0
- package/dist/theme/themes/SKL/components/action-button.css +127 -0
- package/dist/theme/themes/SKL/components/button.css +512 -0
- package/dist/theme/themes/SKL/components/dropdown-menu.css +27 -0
- package/dist/theme/themes/SKL/components/loading.css +11 -0
- package/dist/theme/themes/SKL/components/navbar.css +8 -0
- package/dist/theme/themes/SKL/components/progress-bar.css +8 -0
- package/dist/theme/themes/SKL/components/switch.css +30 -0
- package/dist/theme/themes/SKL/palette.css +145 -0
- package/dist/theme/themes/SKL/state.css +86 -0
- package/dist/theme/themes/SKL/transparent.css +68 -0
- package/dist/theme/themes/SKL/typography.css +199 -0
- package/dist/theme/themes/SKL/variables.css +28 -0
- package/dist/theme/tokens/baseline.css +2 -1
- package/dist/theme/tokens/components/switch.css +30 -0
- package/package.json +1 -1
- package/src/components/Switch/Switch.tsx +37 -9
- package/src/components/Table/Table.tsx +7 -2
- package/src/components/Toast/Toast.stories.tsx +50 -0
- package/src/components/Toast/Toaster.tsx +5 -3
- package/src/components/Toast/useToast.ts +6 -2
- package/src/theme/global.css +1 -0
- package/src/theme/themes/SKL/baseline.css +12 -0
- package/src/theme/themes/SKL/color.css +78 -0
- package/src/theme/themes/SKL/components/action-button.css +127 -0
- package/src/theme/themes/SKL/components/button.css +512 -0
- package/src/theme/themes/SKL/components/dropdown-menu.css +27 -0
- package/src/theme/themes/SKL/components/loading.css +11 -0
- package/src/theme/themes/SKL/components/navbar.css +8 -0
- package/src/theme/themes/SKL/components/progress-bar.css +8 -0
- package/src/theme/themes/SKL/components/switch.css +30 -0
- package/src/theme/themes/SKL/palette.css +145 -0
- package/src/theme/themes/SKL/state.css +86 -0
- package/src/theme/themes/SKL/transparent.css +68 -0
- package/src/theme/themes/SKL/typography.css +199 -0
- package/src/theme/themes/SKL/variables.css +28 -0
- package/src/theme/tokens/baseline.css +2 -1
- package/src/theme/tokens/components/switch.css +30 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
2
|
|
|
3
3
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
4
|
+
import { action } from "@storybook/addon-actions";
|
|
4
5
|
import { Markdown } from "@storybook/blocks";
|
|
5
6
|
import { Toast, ToastAction } from "./Toast";
|
|
6
7
|
import { Toaster } from "./Toaster";
|
|
@@ -142,3 +143,52 @@ export const WithAction = {
|
|
|
142
143
|
);
|
|
143
144
|
},
|
|
144
145
|
} satisfies StoryObj;
|
|
146
|
+
|
|
147
|
+
export const Custom = {
|
|
148
|
+
args: {
|
|
149
|
+
onClose: action("Close Naja (*0_0*) "),
|
|
150
|
+
},
|
|
151
|
+
render: (args) => {
|
|
152
|
+
const props: typeof args = {
|
|
153
|
+
...args,
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const { toast } = useToast();
|
|
157
|
+
|
|
158
|
+
return (
|
|
159
|
+
<div className="flex flex-row gap-4 w-full">
|
|
160
|
+
<Toaster
|
|
161
|
+
viewportClassName="bg-red-100 -mt-[30px]"
|
|
162
|
+
titleClassName="text-red-500"
|
|
163
|
+
descriptionClassName="text-grey2-500"
|
|
164
|
+
contentClassName="bg-pink-100"
|
|
165
|
+
iconWrapperClassName="border-info border-2"
|
|
166
|
+
actionWrapperClassName="bg-green-500"
|
|
167
|
+
duration={3000} // default timeout
|
|
168
|
+
/>
|
|
169
|
+
<Button
|
|
170
|
+
onClick={() => {
|
|
171
|
+
toast({
|
|
172
|
+
title: "Uh oh! Something went wrong.",
|
|
173
|
+
description: "There was a problem with your request.",
|
|
174
|
+
action: (
|
|
175
|
+
<ToastAction
|
|
176
|
+
altText="Try again"
|
|
177
|
+
onClick={() => alert("My action")}
|
|
178
|
+
>
|
|
179
|
+
Try again
|
|
180
|
+
</ToastAction>
|
|
181
|
+
),
|
|
182
|
+
duration: 1000,
|
|
183
|
+
onClose: props.onClose,
|
|
184
|
+
});
|
|
185
|
+
}}
|
|
186
|
+
>
|
|
187
|
+
Show Toast
|
|
188
|
+
</Button>
|
|
189
|
+
</div>
|
|
190
|
+
);
|
|
191
|
+
},
|
|
192
|
+
} satisfies StoryObj<{
|
|
193
|
+
onClose?: () => void;
|
|
194
|
+
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import React from "react";
|
|
3
|
+
import React, { useEffect } from "react";
|
|
4
4
|
import {
|
|
5
5
|
Toast,
|
|
6
6
|
ToastClose,
|
|
@@ -13,6 +13,7 @@ import { useToast } from "./useToast";
|
|
|
13
13
|
import Icon from "../Icon/Icon";
|
|
14
14
|
import { toastContentVariants, toastIconVariants } from "./Toast.styles";
|
|
15
15
|
import { cn } from "@/utils/cn";
|
|
16
|
+
import { ToastProviderProps } from "@radix-ui/react-toast";
|
|
16
17
|
|
|
17
18
|
type ToasterProps = {
|
|
18
19
|
viewportClassName?: string;
|
|
@@ -30,11 +31,12 @@ export function Toaster({
|
|
|
30
31
|
contentClassName,
|
|
31
32
|
iconWrapperClassName,
|
|
32
33
|
actionWrapperClassName,
|
|
33
|
-
|
|
34
|
+
...toastProviderProps
|
|
35
|
+
}: ToasterProps & ToastProviderProps) {
|
|
34
36
|
const { toasts, position } = useToast();
|
|
35
37
|
|
|
36
38
|
return (
|
|
37
|
-
<ToastProvider>
|
|
39
|
+
<ToastProvider {...toastProviderProps}>
|
|
38
40
|
{toasts.map(function ({
|
|
39
41
|
id,
|
|
40
42
|
title,
|
|
@@ -13,6 +13,7 @@ type ToasterToast = ToastProps & {
|
|
|
13
13
|
description?: React.ReactNode;
|
|
14
14
|
action?: ToastActionElement;
|
|
15
15
|
contentMode?: "vertical" | "horizontal";
|
|
16
|
+
onClose?: () => void;
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
type ToasterPosition =
|
|
@@ -81,7 +82,7 @@ const addToRemoveQueue = (toastId: string) => {
|
|
|
81
82
|
type: "REMOVE_TOAST",
|
|
82
83
|
toastId: toastId,
|
|
83
84
|
});
|
|
84
|
-
}, TOAST_REMOVE_DELAY);
|
|
85
|
+
}, TOAST_REMOVE_DELAY);
|
|
85
86
|
|
|
86
87
|
toastTimeouts.set(toastId, timeout);
|
|
87
88
|
};
|
|
@@ -176,7 +177,10 @@ function toast({ ...props }: Toast) {
|
|
|
176
177
|
id,
|
|
177
178
|
open: true,
|
|
178
179
|
onOpenChange: (open) => {
|
|
179
|
-
if (!open)
|
|
180
|
+
if (!open) {
|
|
181
|
+
dismiss();
|
|
182
|
+
props?.onClose?.();
|
|
183
|
+
}
|
|
180
184
|
},
|
|
181
185
|
},
|
|
182
186
|
});
|
package/src/theme/global.css
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@import url(palette.css);
|
|
2
|
+
@import url(state.css);
|
|
3
|
+
@import url(color.css);
|
|
4
|
+
@import url(transparent.css);
|
|
5
|
+
@import url(variables.css);
|
|
6
|
+
@import url(typography.css);
|
|
7
|
+
@import url(components/button.css);
|
|
8
|
+
@import url(components/action-button.css);
|
|
9
|
+
@import url(components/loading.css);
|
|
10
|
+
@import url(components/navbar.css);
|
|
11
|
+
@import url(components/dropdown-menu.css);
|
|
12
|
+
@import url(components/switch.css);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
|
|
2
|
+
:root[data-theme="SKL"] {
|
|
3
|
+
/* Base from design */
|
|
4
|
+
--input-color-default-text: #9e9e9e;
|
|
5
|
+
--input-color-default-stroke: #cfcfcf;
|
|
6
|
+
--input-color-filled-text: #4f4f4f;
|
|
7
|
+
--input-color-active-stroke: #9e9e9e;
|
|
8
|
+
--input-color-disable-text: #919eab;
|
|
9
|
+
--input-color-disable-stroke: #e7ebed;
|
|
10
|
+
--input-color-disable-bg: #f2f5f5;
|
|
11
|
+
--input-color-label-bg: #ffffff;/* #2d2e30; */
|
|
12
|
+
--input-color-error: #ed2f15;
|
|
13
|
+
|
|
14
|
+
/* Function button */
|
|
15
|
+
--function-default-solid: #1e3249;
|
|
16
|
+
--function-default-hover: #35475b;
|
|
17
|
+
--function-default-hover-bg: rgba(30 50 73 / 0.08);
|
|
18
|
+
--function-default-stroke: rgba(30 50 73 / 0.48);
|
|
19
|
+
--function-default-icon: #ffffff;
|
|
20
|
+
--function-default-outline-icon: #1e3249;
|
|
21
|
+
--function-active-solid: #9b8f00;
|
|
22
|
+
--function-active-hover: #b1a400;
|
|
23
|
+
--function-active-hover-bg: rgba(221 205 0 / 0.08);
|
|
24
|
+
--function-active-stroke: rgba(177 164 0 / 0.48);
|
|
25
|
+
--function-active-icon: #ffffff;
|
|
26
|
+
|
|
27
|
+
--text-black: #000000;
|
|
28
|
+
--text-dark: #18283a;
|
|
29
|
+
--text-medium: #4b5b6d;
|
|
30
|
+
--text-light: #8e98a4;
|
|
31
|
+
--text-grey-dark: #4f4f4f;
|
|
32
|
+
--text-grey-medium: #7e7e7e;
|
|
33
|
+
--text-grey-light: #9e9e9e;
|
|
34
|
+
--text-white: #ffffff;
|
|
35
|
+
|
|
36
|
+
--base-color-bg: #f5f5f5;
|
|
37
|
+
--base-color-bg2: #f5f5f5;
|
|
38
|
+
--base-color-bg3: #d8d8d8;
|
|
39
|
+
--base-color-workspace-stroke: #e2e2e2;
|
|
40
|
+
--base-color-guideline-stroke: #c5c5c5;
|
|
41
|
+
--base-color-popup: #ffffff;
|
|
42
|
+
--base-color-popup-hightlight: #343638;
|
|
43
|
+
--base-color-popup-curtain: rgba(0 0 0 / 0.6);
|
|
44
|
+
--common-white: #ffffff;
|
|
45
|
+
--common-black: #000000;
|
|
46
|
+
|
|
47
|
+
/* ------- Addon base ---------- */
|
|
48
|
+
--background: var(--base-color-bg);
|
|
49
|
+
--foreground: var(--common-black);
|
|
50
|
+
|
|
51
|
+
--primary: var(--primary-ramps-primary-100);
|
|
52
|
+
--secondary: var(--secondary-ramps-secondary-100);
|
|
53
|
+
--tertiary: var(--tertiary-ramps-tertiary-100);
|
|
54
|
+
--info: var(--info-info-100);
|
|
55
|
+
--success: var(--success-success-100);
|
|
56
|
+
--warning: var(--warning-warning-100);
|
|
57
|
+
--error: var(--error-error-100);
|
|
58
|
+
--grey: var(--grey-grey-100);
|
|
59
|
+
--grey2: var(--grey2-grey2-100);
|
|
60
|
+
|
|
61
|
+
--primary-foreground: var(--state-color-primary-text-solid);
|
|
62
|
+
--secondary-foreground: var(--state-color-secondary-text-solid);
|
|
63
|
+
--tertiary-foreground: var(--state-color-tertiary-text-solid);
|
|
64
|
+
--info-foreground: var(--state-color-info-text-solid);
|
|
65
|
+
--success-foreground: var(--state-color-success-text-solid);
|
|
66
|
+
--warning-foreground: var(--state-color-warning-text-solid);
|
|
67
|
+
--error-foreground: var(--state-color-error-text-solid);
|
|
68
|
+
--grey-foreground: var(--common-black);
|
|
69
|
+
--grey2-foreground: var(--common-black);
|
|
70
|
+
|
|
71
|
+
--surface: var(--base-color-bg);
|
|
72
|
+
--surface-foreground: var(--common-black);
|
|
73
|
+
|
|
74
|
+
--primary-foreground: var(--common-white);
|
|
75
|
+
--secondary-foreground: var(--common-white);
|
|
76
|
+
|
|
77
|
+
--base-color-popup-foreground: var(--text-dark);
|
|
78
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
:root[data-theme="SKL"] {
|
|
2
|
+
/* --------------------------------------------------------------------------------- */
|
|
3
|
+
/* Action Button Component Tokens */
|
|
4
|
+
/* --------------------------------------------------------------------------------- */
|
|
5
|
+
/* Naming Convention: --[component]-[mode]-[state]-[property] */
|
|
6
|
+
/* Mone: [solid, outline, icon] */
|
|
7
|
+
/* States: [default, hover, pressed, active, active-pressed active-hover disabled] */
|
|
8
|
+
/* --------------------------------------------------------------------------------- */
|
|
9
|
+
|
|
10
|
+
/* ------------------------------------------------------------------ */
|
|
11
|
+
/* Solid Mode Tokens */
|
|
12
|
+
/* ------------------------------------------------------------------ */
|
|
13
|
+
|
|
14
|
+
/* Default State */
|
|
15
|
+
--action-button-solid-default-bg: var(--function-default-solid);
|
|
16
|
+
--action-button-solid-default-border: var(--function-default-solid);
|
|
17
|
+
--action-button-solid-default-text: var(--function-default-icon);
|
|
18
|
+
|
|
19
|
+
/* Hover State */
|
|
20
|
+
--action-button-solid-hover-bg: var(--function-default-hover);
|
|
21
|
+
--action-button-solid-hover-border: var(--function-default-hover);
|
|
22
|
+
--action-button-solid-hover-text: var(--function-default-icon);
|
|
23
|
+
|
|
24
|
+
/* Pressed State */
|
|
25
|
+
--action-button-solid-pressed-bg: var(--function-default-solid);
|
|
26
|
+
--action-button-solid-pressed-border: var(--function-default-solid);
|
|
27
|
+
--action-button-solid-pressed-text: var(--function-default-icon);
|
|
28
|
+
|
|
29
|
+
/* Active State */
|
|
30
|
+
--action-button-solid-active-bg: var(--function-active-solid);
|
|
31
|
+
--action-button-solid-active-border: var(--function-active-solid);
|
|
32
|
+
--action-button-solid-active-text: var(--function-active-icon);
|
|
33
|
+
|
|
34
|
+
/* Active Hover State */
|
|
35
|
+
--action-button-solid-active-hover-bg: var(--function-active-hover);
|
|
36
|
+
--action-button-solid-active-hover-border: var(--function-active-hover);
|
|
37
|
+
--action-button-solid-active-hover-text: var(--function-active-icon);
|
|
38
|
+
|
|
39
|
+
/* Active Pressed State */
|
|
40
|
+
--action-button-solid-active-pressed-bg: var(--function-active-solid);
|
|
41
|
+
--action-button-solid-active-pressed-border: var(--function-active-solid);
|
|
42
|
+
--action-button-solid-active-pressed-text: var(--function-active-icon);
|
|
43
|
+
|
|
44
|
+
/* Disabled State */
|
|
45
|
+
--action-button-solid-disabled-bg: var(--state-color-disable-solid);
|
|
46
|
+
--action-button-solid-disabled-border: var(--state-color-disable-solid);
|
|
47
|
+
--action-button-solid-disabled-text: var(--state-color-disable-outline);
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
/* ------------------------------------------------------------------ */
|
|
51
|
+
/* Outline Mode Tokens */
|
|
52
|
+
/* ------------------------------------------------------------------ */
|
|
53
|
+
|
|
54
|
+
/* Default State */
|
|
55
|
+
--action-button-outline-default-bg: transparent;
|
|
56
|
+
--action-button-outline-default-border: var(--function-default-stroke);
|
|
57
|
+
--action-button-outline-default-text: var(--function-default-outline-icon);
|
|
58
|
+
|
|
59
|
+
/* Hover State */
|
|
60
|
+
--action-button-outline-hover-bg: var(--function-default-hover-bg);
|
|
61
|
+
--action-button-outline-hover-border: var(--function-default-hover);
|
|
62
|
+
--action-button-outline-hover-text: var(--function-default-hover);
|
|
63
|
+
|
|
64
|
+
/* Pressed State */
|
|
65
|
+
--action-button-outline-pressed-bg: var(--function-default-hover-bg);
|
|
66
|
+
--action-button-outline-pressed-border: var(--function-default-stroke);
|
|
67
|
+
--action-button-outline-pressed-text: var(--function-default-outline-icon);
|
|
68
|
+
|
|
69
|
+
/* Active State */
|
|
70
|
+
--action-button-outline-active-bg: transparent;
|
|
71
|
+
--action-button-outline-active-border: var(--function-active-stroke);
|
|
72
|
+
--action-button-outline-active-text: var(--function-active-solid);
|
|
73
|
+
|
|
74
|
+
/* Active Hover State */
|
|
75
|
+
--action-button-outline-active-hover-bg: var(--function-active-hover-bg);;
|
|
76
|
+
--action-button-outline-active-hover-border: var(--function-active-hover);
|
|
77
|
+
--action-button-outline-active-hover-text: var(--function-active-hover);
|
|
78
|
+
|
|
79
|
+
/* Active Pressed State */
|
|
80
|
+
--action-button-outline-active-pressed-bg: var(--function-active-hover-bg);;
|
|
81
|
+
--action-button-outline-active-pressed-border: var(--function-active-stroke);
|
|
82
|
+
--action-button-outline-active-pressed-text: var(--function-active-solid);
|
|
83
|
+
|
|
84
|
+
/* Disabled State */
|
|
85
|
+
--action-button-outline-disabled-bg: transparent;
|
|
86
|
+
--action-button-outline-disabled-border: var(--state-color-disable-outline);
|
|
87
|
+
--action-button-outline-disabled-text: var(--state-color-disable-outline);
|
|
88
|
+
|
|
89
|
+
/* ------------------------------------------------------------------ */
|
|
90
|
+
/* Icon Mode Tokens */
|
|
91
|
+
/* ------------------------------------------------------------------ */
|
|
92
|
+
|
|
93
|
+
/* Default State */
|
|
94
|
+
--action-button-icon-default-bg: transparent;
|
|
95
|
+
--action-button-icon-default-border: transparent;
|
|
96
|
+
--action-button-icon-default-text: var(--function-default-outline-icon);
|
|
97
|
+
|
|
98
|
+
/* Hover State */
|
|
99
|
+
--action-button-icon-hover-bg: var(--function-default-hover-bg);
|
|
100
|
+
--action-button-icon-hover-border: transparent;
|
|
101
|
+
--action-button-icon-hover-text: var(--function-default-hover);
|
|
102
|
+
|
|
103
|
+
/* Pressed State */
|
|
104
|
+
--action-button-icon-pressed-bg: transparent;
|
|
105
|
+
--action-button-icon-pressed-border: transparent;
|
|
106
|
+
--action-button-icon-pressed-text: var(--function-default-outline-icon);
|
|
107
|
+
|
|
108
|
+
/* Active State */
|
|
109
|
+
--action-button-icon-active-bg: transparent;
|
|
110
|
+
--action-button-icon-active-border: transparent;
|
|
111
|
+
--action-button-icon-active-text: var(--function-active-solid);
|
|
112
|
+
|
|
113
|
+
/* Active Hover State */
|
|
114
|
+
--action-button-icon-active-hover-bg: var(--function-active-hover-bg);
|
|
115
|
+
--action-button-icon-active-hover-border: transparent;
|
|
116
|
+
--action-button-icon-active-hover-text: var(--function-active-hover);
|
|
117
|
+
|
|
118
|
+
/* Active Pressed State */
|
|
119
|
+
--action-button-icon-active-pressed-bg: transparent;
|
|
120
|
+
--action-button-icon-active-pressed-border: transparent;
|
|
121
|
+
--action-button-icon-active-pressed-text: var(--function-active-solid);
|
|
122
|
+
|
|
123
|
+
/* Disabled State */
|
|
124
|
+
--action-button-icon-disabled-bg: transparent;
|
|
125
|
+
--action-button-icon-disabled-border: transparent;
|
|
126
|
+
--action-button-icon-disabled-text: var(--state-color-disable-outline);
|
|
127
|
+
}
|