@sit-onyx/storybook-utils 1.0.0-beta.91 → 1.0.0-beta.93
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/package.json +1 -1
- package/src/preview.ts +1 -1
- package/src/style.css +12 -12
- package/src/theme.ts +27 -21
package/package.json
CHANGED
package/src/preview.ts
CHANGED
package/src/style.css
CHANGED
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
*/
|
|
41
41
|
:where(:root),
|
|
42
42
|
.onyx-theme-default {
|
|
43
|
-
--onyx-color-steel-100: #fafbfc;
|
|
44
|
-
--onyx-color-steel-200: #e3eaf0;
|
|
45
|
-
--onyx-color-steel-300: #c9d6e0;
|
|
46
|
-
--onyx-color-steel-400: #9db3c4;
|
|
47
|
-
--onyx-color-steel-500: #7392aa;
|
|
48
|
-
--onyx-color-steel-600: #506e84;
|
|
49
|
-
--onyx-color-steel-700: #3e596e;
|
|
50
|
-
--onyx-color-steel-800: #31495c;
|
|
51
|
-
--onyx-color-steel-900: #22384a;
|
|
52
|
-
--onyx-color-steel-1000: #11212d;
|
|
53
|
-
--onyx-color-steel-1100: #081723;
|
|
54
|
-
--onyx-color-steel-1200: #000e19;
|
|
43
|
+
--onyx-color-neutral-steel-100: #fafbfc;
|
|
44
|
+
--onyx-color-neutral-steel-200: #e3eaf0;
|
|
45
|
+
--onyx-color-neutral-steel-300: #c9d6e0;
|
|
46
|
+
--onyx-color-neutral-steel-400: #9db3c4;
|
|
47
|
+
--onyx-color-neutral-steel-500: #7392aa;
|
|
48
|
+
--onyx-color-neutral-steel-600: #506e84;
|
|
49
|
+
--onyx-color-neutral-steel-700: #3e596e;
|
|
50
|
+
--onyx-color-neutral-steel-800: #31495c;
|
|
51
|
+
--onyx-color-neutral-steel-900: #22384a;
|
|
52
|
+
--onyx-color-neutral-steel-1000: #11212d;
|
|
53
|
+
--onyx-color-neutral-steel-1100: #081723;
|
|
54
|
+
--onyx-color-neutral-steel-1200: #000e19;
|
|
55
55
|
--onyx-color-themed-primary-100: #e8fcfc;
|
|
56
56
|
--onyx-color-themed-primary-200: #bbeaed;
|
|
57
57
|
--onyx-color-themed-primary-300: #79dde2;
|
package/src/theme.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
type OnyxBreakpoint,
|
|
4
4
|
} from "@sit-onyx/shared/breakpoints";
|
|
5
5
|
import { create, type ThemeVars } from "storybook/internal/theming";
|
|
6
|
+
import type { Viewport } from "storybook/internal/viewport";
|
|
6
7
|
|
|
7
8
|
export type BrandDetails = Pick<ThemeVars, "brandTitle" | "brandImage" | "brandUrl">;
|
|
8
9
|
|
|
@@ -19,8 +20,7 @@ export const getCustomProperty = (property: string, el: Element = document.body)
|
|
|
19
20
|
* @see https://storybook.js.org/docs/react/configure/theming#create-a-theme-quickstart
|
|
20
21
|
*/
|
|
21
22
|
export const createTheme = (base: "light" | "dark" = "light", brandDetails?: BrandDetails) => {
|
|
22
|
-
const primaryColor = getCustomProperty("--onyx-color-
|
|
23
|
-
|
|
23
|
+
const primaryColor = getCustomProperty("--onyx-color-onyx-500");
|
|
24
24
|
return create({
|
|
25
25
|
brandTitle: brandDetails?.brandTitle,
|
|
26
26
|
brandUrl: brandDetails?.brandUrl,
|
|
@@ -44,20 +44,20 @@ export const createTheme = (base: "light" | "dark" = "light", brandDetails?: Bra
|
|
|
44
44
|
const getLightTheme = (): Partial<ThemeVars> => {
|
|
45
45
|
return defineTheme({
|
|
46
46
|
background: getCustomProperty("--onyx-color-universal-grayscale-white"),
|
|
47
|
-
contentBackground: getCustomProperty("--onyx-color-steel-100"),
|
|
48
|
-
text: getCustomProperty("--onyx-color-steel-700"),
|
|
49
|
-
textMuted: getCustomProperty("--onyx-color-steel-600"),
|
|
50
|
-
border: getCustomProperty("--onyx-color-steel-300"),
|
|
47
|
+
contentBackground: getCustomProperty("--onyx-color-neutral-steel-100"),
|
|
48
|
+
text: getCustomProperty("--onyx-color-neutral-steel-700"),
|
|
49
|
+
textMuted: getCustomProperty("--onyx-color-neutral-steel-600"),
|
|
50
|
+
border: getCustomProperty("--onyx-color-neutral-steel-300"),
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
const getDarkTheme = (): Partial<ThemeVars> => {
|
|
55
55
|
return defineTheme({
|
|
56
|
-
background: getCustomProperty("--onyx-color-steel-1100"),
|
|
57
|
-
contentBackground: getCustomProperty("--onyx-color-steel-1200"),
|
|
58
|
-
text: getCustomProperty("--onyx-color-steel-200"),
|
|
59
|
-
textMuted: getCustomProperty("--onyx-color-steel-400"),
|
|
60
|
-
border: getCustomProperty("--onyx-color-steel-900"),
|
|
56
|
+
background: getCustomProperty("--onyx-color-neutral-steel-1100"),
|
|
57
|
+
contentBackground: getCustomProperty("--onyx-color-neutral-steel-1200"),
|
|
58
|
+
text: getCustomProperty("--onyx-color-neutral-steel-200"),
|
|
59
|
+
textMuted: getCustomProperty("--onyx-color-neutral-steel-400"),
|
|
60
|
+
border: getCustomProperty("--onyx-color-neutral-steel-900"),
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
63
|
|
|
@@ -100,20 +100,26 @@ const defineTheme = (colors: {
|
|
|
100
100
|
export const ONYX_BREAKPOINTS = Object.entries(RAW_ONYX_BREAKPOINTS).reduce(
|
|
101
101
|
(obj, [name, width]) => {
|
|
102
102
|
const breakpoint = name as OnyxBreakpoint;
|
|
103
|
-
|
|
103
|
+
|
|
104
|
+
const TYPES: Record<OnyxBreakpoint, Viewport["type"]> = {
|
|
105
|
+
"2xs": "mobile",
|
|
106
|
+
xs: "mobile",
|
|
107
|
+
sm: "tablet",
|
|
108
|
+
md: "tablet",
|
|
109
|
+
lg: "desktop",
|
|
110
|
+
xl: "desktop",
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
obj[breakpoint] = {
|
|
114
|
+
name: breakpoint,
|
|
115
|
+
styles: { width: `${width}px`, height: "100%" },
|
|
116
|
+
type: TYPES[breakpoint],
|
|
117
|
+
};
|
|
104
118
|
return obj;
|
|
105
119
|
},
|
|
106
|
-
{} as Record<OnyxBreakpoint,
|
|
120
|
+
{} as Record<OnyxBreakpoint, Viewport>,
|
|
107
121
|
);
|
|
108
122
|
|
|
109
|
-
export type StorybookBreakpoint = {
|
|
110
|
-
name: OnyxBreakpoint;
|
|
111
|
-
styles: {
|
|
112
|
-
width: string;
|
|
113
|
-
height: string;
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
|
|
117
123
|
/**
|
|
118
124
|
* Converts a rem string into a numeric value with a rem base of 16.
|
|
119
125
|
* @example "1rem" => 16
|