@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 +12 -0
- package/dist/chunk-BTQOTIPQ.js +32 -0
- package/dist/{chunk-SGM3YTWS.js → chunk-KOZXHA3B.js} +1 -1
- package/dist/{chunk-GII4NPN2.js → chunk-VAH7CV3O.js} +2 -2
- package/dist/chunk-YXF4RUSK.js +77 -0
- package/dist/constants.js +1 -1
- package/dist/feature/arg-types.js +1 -1
- package/dist/feature/color-mode/ColorModeSync.js +1 -1
- package/dist/feature/color-mode/ColorModeTool.js +1 -1
- package/dist/feature/color-mode/ThemeTool.cjs +32 -4972
- package/dist/feature/color-mode/ThemeTool.js +2 -2
- package/dist/feature/decorator/ChakraProviderDecorator.cjs +1 -1
- package/dist/feature/decorator/ChakraProviderDecorator.js +2 -2
- package/dist/feature/direction/DirectionTool.js +2 -2
- package/dist/feature/direction/useDirection.js +1 -1
- package/dist/index.js +1 -1
- package/dist/preset/decorators.cjs +1 -1
- package/dist/preset/decorators.js +2 -2
- package/dist/preset/index.js +1 -1
- package/dist/preset/register.cjs +83 -5018
- package/dist/preset/register.js +3 -3
- package/package.json +9 -12
- package/dist/chunk-MSSXLFPL.js +0 -4979
- package/dist/chunk-UK7U2PBM.js +0 -70
package/CHANGELOG.md
CHANGED
@@ -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
|
+
};
|
@@ -11,7 +11,7 @@ import {
|
|
11
11
|
import {
|
12
12
|
__spreadProps,
|
13
13
|
__spreadValues
|
14
|
-
} from "./chunk-
|
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", "
|
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