@sit-onyx/storybook-utils 1.0.0-beta.91 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sit-onyx/storybook-utils",
3
3
  "description": "Storybook utilities for Vue",
4
- "version": "1.0.0-beta.91",
4
+ "version": "1.0.0-beta.92",
5
5
  "type": "module",
6
6
  "author": "Schwarz IT KG",
7
7
  "license": "Apache-2.0",
package/src/preview.ts CHANGED
@@ -100,7 +100,7 @@ export const createPreview = <T extends Preview = Preview>(
100
100
  disable: true,
101
101
  },
102
102
  viewport: {
103
- viewports: ONYX_BREAKPOINTS,
103
+ options: ONYX_BREAKPOINTS,
104
104
  },
105
105
  },
106
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
- obj[breakpoint] = { name: breakpoint, styles: { width: `${width}px`, height: "100%" } };
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, StorybookBreakpoint>,
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