@sit-onyx/storybook-utils 1.0.0-beta.90 → 1.0.0-beta.92
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 +2 -1
- package/src/theme.ts +17 -10
package/package.json
CHANGED
package/src/preview.ts
CHANGED
|
@@ -62,6 +62,7 @@ export const createPreview = <T extends Preview = Preview>(
|
|
|
62
62
|
sort: "requiredFirst",
|
|
63
63
|
// needed to also show props/events descriptions etc. when opening a single story
|
|
64
64
|
expanded: true,
|
|
65
|
+
exclude: ["ref", "ref_for", "ref_key", "class", "style", "key", "$slots"],
|
|
65
66
|
},
|
|
66
67
|
docs: {
|
|
67
68
|
// see: https://github.com/hipstersmoothie/storybook-dark-mode/issues/127#issuecomment-840701971
|
|
@@ -99,7 +100,7 @@ export const createPreview = <T extends Preview = Preview>(
|
|
|
99
100
|
disable: true,
|
|
100
101
|
},
|
|
101
102
|
viewport: {
|
|
102
|
-
|
|
103
|
+
options: ONYX_BREAKPOINTS,
|
|
103
104
|
},
|
|
104
105
|
},
|
|
105
106
|
} satisfies Preview;
|
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
|
|
|
@@ -100,20 +101,26 @@ const defineTheme = (colors: {
|
|
|
100
101
|
export const ONYX_BREAKPOINTS = Object.entries(RAW_ONYX_BREAKPOINTS).reduce(
|
|
101
102
|
(obj, [name, width]) => {
|
|
102
103
|
const breakpoint = name as OnyxBreakpoint;
|
|
103
|
-
|
|
104
|
+
|
|
105
|
+
const TYPES: Record<OnyxBreakpoint, Viewport["type"]> = {
|
|
106
|
+
"2xs": "mobile",
|
|
107
|
+
xs: "mobile",
|
|
108
|
+
sm: "tablet",
|
|
109
|
+
md: "tablet",
|
|
110
|
+
lg: "desktop",
|
|
111
|
+
xl: "desktop",
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
obj[breakpoint] = {
|
|
115
|
+
name: breakpoint,
|
|
116
|
+
styles: { width: `${width}px`, height: "100%" },
|
|
117
|
+
type: TYPES[breakpoint],
|
|
118
|
+
};
|
|
104
119
|
return obj;
|
|
105
120
|
},
|
|
106
|
-
{} as Record<OnyxBreakpoint,
|
|
121
|
+
{} as Record<OnyxBreakpoint, Viewport>,
|
|
107
122
|
);
|
|
108
123
|
|
|
109
|
-
export type StorybookBreakpoint = {
|
|
110
|
-
name: OnyxBreakpoint;
|
|
111
|
-
styles: {
|
|
112
|
-
width: string;
|
|
113
|
-
height: string;
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
|
|
117
124
|
/**
|
|
118
125
|
* Converts a rem string into a numeric value with a rem base of 16.
|
|
119
126
|
* @example "1rem" => 16
|