@saas-ui/storybook-addon 1.0.1-next.1 → 1.1.0-rc.3

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @chakra-ui/storybook-addon
2
2
 
3
+ ## 1.1.0-rc.3
4
+
5
+ ### Minor Changes
6
+
7
+ - 046e42b8: Updated to Chakra UI 2.7
8
+
9
+ ## 1.0.1-rc.2
10
+
11
+ ### Patch Changes
12
+
13
+ - Bump version
14
+
3
15
  ## 1.0.1-next.1
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,32 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
21
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
22
+ }) : x)(function(x) {
23
+ if (typeof require !== "undefined")
24
+ return require.apply(this, arguments);
25
+ throw new Error('Dynamic require of "' + x + '" is not supported');
26
+ });
27
+
28
+ export {
29
+ __spreadValues,
30
+ __spreadProps,
31
+ __require
32
+ };
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  __spreadProps,
7
7
  __spreadValues
8
- } from "./chunk-UK7U2PBM.js";
8
+ } from "./chunk-BTQOTIPQ.js";
9
9
 
10
10
  // src/feature/direction/DirectionTool.tsx
11
11
  import { useCallback, useEffect } from "react";
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  __spreadProps,
13
13
  __spreadValues
14
- } from "./chunk-UK7U2PBM.js";
14
+ } from "./chunk-BTQOTIPQ.js";
15
15
 
16
16
  // src/feature/decorator/ChakraProviderDecorator.tsx
17
17
  import React, { useMemo } from "react";
@@ -23,7 +23,7 @@ import { theme as baseGlassTheme } from "@saas-ui/theme-glass";
23
23
  import { jsx, jsxs } from "react/jsx-runtime";
24
24
  var glassTheme = extendTheme(baseGlassTheme, suiTheme);
25
25
  var useThemeSync = () => {
26
- const [themeId, setTheme] = useLocalStorage("storybook.theme", "0");
26
+ const [themeId, setTheme] = useLocalStorage("storybook.theme", "1");
27
27
  React.useEffect(() => {
28
28
  const channel = addons.getChannel();
29
29
  const themeCallback = (value) => setTheme(value);
@@ -0,0 +1,77 @@
1
+ import {
2
+ ADDON_ID,
3
+ EVENTS
4
+ } from "./chunk-HSBRF2QZ.js";
5
+
6
+ // src/feature/color-mode/ThemeTool.tsx
7
+ import { useAddonState } from "@storybook/api";
8
+ import {
9
+ IconButton,
10
+ WithTooltip,
11
+ TooltipLinkList,
12
+ Icons
13
+ } from "@storybook/components";
14
+ import { addons } from "@storybook/addons";
15
+ import { jsx, jsxs } from "react/jsx-runtime";
16
+ var themes = {
17
+ 0: "Chakra UI",
18
+ 1: "Saas UI",
19
+ 2: "Glass"
20
+ };
21
+ var ThemeTool = () => {
22
+ const themeId = localStorage.getItem("saas-ui-theme");
23
+ const [theme, setTheme] = useAddonState(`${ADDON_ID}/theme`, themeId);
24
+ const channel = addons.getChannel();
25
+ const setActiveTheme = (themeId2) => {
26
+ channel.emit(EVENTS.SET_THEME, !themeId2 ? "1" : themeId2);
27
+ setTheme(themeId2);
28
+ };
29
+ return /* @__PURE__ */ jsx(
30
+ WithTooltip,
31
+ {
32
+ placement: "top",
33
+ closeOnClick: true,
34
+ trigger: "click",
35
+ tooltip: ({ onHide }) => /* @__PURE__ */ jsx(
36
+ TooltipLinkList,
37
+ {
38
+ links: [
39
+ {
40
+ id: "0",
41
+ title: "Chakra UI",
42
+ onClick: () => {
43
+ setActiveTheme("0");
44
+ onHide();
45
+ }
46
+ },
47
+ {
48
+ id: "1",
49
+ title: "Saas UI",
50
+ onClick: () => {
51
+ setActiveTheme("1");
52
+ onHide();
53
+ }
54
+ },
55
+ {
56
+ id: "2",
57
+ title: "Glass",
58
+ onClick: () => {
59
+ setActiveTheme("2");
60
+ onHide();
61
+ }
62
+ }
63
+ ]
64
+ }
65
+ ),
66
+ children: /* @__PURE__ */ jsxs(IconButton, { title: "Select theme", children: [
67
+ /* @__PURE__ */ jsx(Icons, { icon: "eye" }),
68
+ " ",
69
+ themes[theme || "1"]
70
+ ] })
71
+ }
72
+ );
73
+ };
74
+
75
+ export {
76
+ ThemeTool
77
+ };
package/dist/constants.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  EVENTS,
6
6
  THEME_TOOL_ID
7
7
  } from "./chunk-HSBRF2QZ.js";
8
- import "./chunk-UK7U2PBM.js";
8
+ import "./chunk-BTQOTIPQ.js";
9
9
  export {
10
10
  ADDON_ID,
11
11
  COLOR_MODE_TOOL_ID,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getThemingArgTypes
3
3
  } from "../chunk-NOGSFSIA.js";
4
- import "../chunk-UK7U2PBM.js";
4
+ import "../chunk-BTQOTIPQ.js";
5
5
  export {
6
6
  getThemingArgTypes
7
7
  };
@@ -2,7 +2,7 @@ import {
2
2
  ColorModeSync
3
3
  } from "../../chunk-SVHNULTN.js";
4
4
  import "../../chunk-HSBRF2QZ.js";
5
- import "../../chunk-UK7U2PBM.js";
5
+ import "../../chunk-BTQOTIPQ.js";
6
6
  export {
7
7
  ColorModeSync
8
8
  };
@@ -2,7 +2,7 @@ import {
2
2
  ColorModeTool
3
3
  } from "../../chunk-QNOLFHPG.js";
4
4
  import "../../chunk-HSBRF2QZ.js";
5
- import "../../chunk-UK7U2PBM.js";
5
+ import "../../chunk-BTQOTIPQ.js";
6
6
  export {
7
7
  ColorModeTool
8
8
  };