@saas-ui/storybook-addon 2.0.3 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/ChakraProviderDecorator.cjs +33 -0
  3. package/dist/ChakraProviderDecorator.cjs.map +1 -0
  4. package/dist/ChakraProviderDecorator.d.cts +3 -0
  5. package/dist/ChakraProviderDecorator.d.ts +1 -3
  6. package/dist/ChakraProviderDecorator.js +8 -47
  7. package/dist/ChakraProviderDecorator.js.map +1 -1
  8. package/dist/{arg-types.mjs → arg-types.cjs} +4 -2
  9. package/dist/arg-types.cjs.map +1 -0
  10. package/dist/arg-types.d.cts +52 -0
  11. package/dist/arg-types.d.ts +1 -1
  12. package/dist/arg-types.js +1 -3
  13. package/dist/arg-types.js.map +1 -1
  14. package/dist/color-mode/ColorModeSync.cjs +11 -0
  15. package/dist/color-mode/ColorModeSync.cjs.map +1 -0
  16. package/dist/color-mode/ColorModeSync.d.cts +6 -0
  17. package/dist/color-mode/ColorModeSync.js +5 -7
  18. package/dist/color-mode/ColorModeSync.js.map +1 -1
  19. package/dist/color-mode/ColorModeTool.cjs +32 -0
  20. package/dist/color-mode/ColorModeTool.cjs.map +1 -0
  21. package/dist/color-mode/ColorModeTool.d.cts +5 -0
  22. package/dist/color-mode/ColorModeTool.js +6 -28
  23. package/dist/color-mode/ColorModeTool.js.map +1 -1
  24. package/dist/{constants.mjs → constants.cjs} +8 -2
  25. package/dist/constants.cjs.map +1 -0
  26. package/dist/constants.d.cts +11 -0
  27. package/dist/constants.js +1 -7
  28. package/dist/constants.js.map +1 -1
  29. package/dist/direction/DirectionTool.cjs +12 -0
  30. package/dist/direction/DirectionTool.cjs.map +1 -0
  31. package/dist/direction/DirectionTool.d.cts +8 -0
  32. package/dist/direction/DirectionTool.js +6 -8
  33. package/dist/direction/DirectionTool.js.map +1 -1
  34. package/dist/direction/useDirection.cjs +10 -0
  35. package/dist/direction/useDirection.cjs.map +1 -0
  36. package/dist/direction/useDirection.d.cts +6 -0
  37. package/dist/direction/useDirection.js +4 -6
  38. package/dist/direction/useDirection.js.map +1 -1
  39. package/dist/{index.mjs → index.cjs} +9 -2
  40. package/dist/index.cjs.map +1 -0
  41. package/dist/index.d.cts +4 -0
  42. package/dist/index.js +1 -8
  43. package/dist/index.js.map +1 -1
  44. package/dist/manager.cjs +31 -0
  45. package/dist/manager.cjs.map +1 -0
  46. package/dist/manager.d.cts +2 -0
  47. package/dist/manager.d.ts +1 -1
  48. package/dist/manager.js +8 -31
  49. package/dist/manager.js.map +1 -1
  50. package/dist/preview.cjs +33 -0
  51. package/dist/preview.cjs.map +1 -0
  52. package/dist/preview.d.cts +5 -0
  53. package/dist/preview.js +8 -47
  54. package/dist/preview.js.map +1 -1
  55. package/dist/theme/ThemeTool.cjs +12 -0
  56. package/dist/theme/ThemeTool.cjs.map +1 -0
  57. package/dist/theme/ThemeTool.d.cts +8 -0
  58. package/dist/theme/ThemeTool.js +6 -29
  59. package/dist/theme/ThemeTool.js.map +1 -1
  60. package/package.json +25 -30
  61. package/dist/ChakraProviderDecorator.mjs +0 -30
  62. package/dist/ChakraProviderDecorator.mjs.map +0 -1
  63. package/dist/arg-types.mjs.map +0 -1
  64. package/dist/color-mode/ColorModeSync.mjs +0 -9
  65. package/dist/color-mode/ColorModeSync.mjs.map +0 -1
  66. package/dist/color-mode/ColorModeTool.mjs +0 -10
  67. package/dist/color-mode/ColorModeTool.mjs.map +0 -1
  68. package/dist/constants.mjs.map +0 -1
  69. package/dist/direction/DirectionTool.mjs +0 -10
  70. package/dist/direction/DirectionTool.mjs.map +0 -1
  71. package/dist/direction/useDirection.mjs +0 -8
  72. package/dist/direction/useDirection.mjs.map +0 -1
  73. package/dist/index.mjs.map +0 -1
  74. package/dist/manager.mjs +0 -12
  75. package/dist/manager.mjs.map +0 -1
  76. package/dist/preview.mjs +0 -30
  77. package/dist/preview.mjs.map +0 -1
  78. package/dist/theme/ThemeTool.mjs +0 -12
  79. package/dist/theme/ThemeTool.mjs.map +0 -1
@@ -1,12 +0,0 @@
1
- import * as f from '@storybook/manager-api';
2
- import { addons } from '@storybook/manager-api';
3
- import { WithTooltip, TooltipLinkList, IconButton, Icons } from '@storybook/components';
4
- import '@storybook/types';
5
- import '@storybook/preview-api/dist/addons';
6
- import { jsx, jsxs } from 'react/jsx-runtime';
7
-
8
- var E=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var a=(s,o,r,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of u(o))!h.call(s,t)&&t!==r&&E(s,t,{get:()=>o[t],enumerable:!(c=O(o,t))||c.enumerable});return s},m=(s,o,r)=>(a(s,o,"default"),r&&a(r,o,"default"));var l={};m(l,f);var e="@saas-ui/storybook-addon2",T={TOGGLE_COLOR_MODE:`${e}/toggleColorMode`,TOGGLE_DIRECTION:`${e}/toggleDirection`,SET_THEME:`${e}/setTheme`};var D={0:"Chakra UI",1:"Saas UI",2:"Glass"},j=()=>{let s=localStorage.getItem("saas-ui-theme"),[o,r]=(0, l.useAddonState)(`${e}/theme`,s),c=addons.getChannel(),t=n=>{c.emit(T.SET_THEME,n||"1"),r(n);};return jsx(WithTooltip,{placement:"top",closeOnClick:!0,trigger:"click",tooltip:({onHide:n})=>jsx(TooltipLinkList,{links:[{id:"0",title:"Chakra UI",onClick:()=>{t("0"),n();}},{id:"1",title:"Saas UI",onClick:()=>{t("1"),n();}},{id:"2",title:"Glass",onClick:()=>{t("2"),n();}}]}),children:jsxs(IconButton,{title:"Select theme",children:[jsx(Icons,{icon:"eye"})," ",D[o||"1"]]})})};
9
-
10
- export { j as ThemeTool };
11
- //# sourceMappingURL=out.js.map
12
- //# sourceMappingURL=ThemeTool.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../node_modules/@storybook/api/dist/entry.mjs","../../src/theme/ThemeTool.tsx","../../../../node_modules/@storybook/addons/dist/index.mjs","../../src/constants.ts"],"names":["entry_exports","__reExport","manager_api_star","IconButton","WithTooltip","TooltipLinkList","Icons","Addon_TypesEnum","addons","mockChannel","HooksContext","applyHooks","makeDecorator","useArgs","useCallback","useChannel","useEffect","useGlobals","useMemo","useParameter","useReducer","useRef","useState","useStoryContext","ADDON_ID","COLOR_MODE_TOOL_ID","DIRECTION_TOOL_ID","THEME_TOOL_ID","EVENTS","jsx","jsxs","themes","ThemeTool","themeId","theme","setTheme","channel","setActiveTheme","onHide"],"mappings":"wWAAA,IAAAA,EAAA,GACAC,EAAAD,EAAAE,GAAA,UAAAA,MAAc,yBCAd,OACE,cAAAC,EACA,eAAAC,EACA,mBAAAC,EACA,SAAAC,MACK,wBCNP,OAA4B,mBAAnBC,MAAgC,mBACzC,OAAS,UAAAC,EAAQ,eAAAC,MAAmB,yBACpC,OAAS,gBAAAC,EAAc,cAAAC,EAAY,iBAAAC,EAAe,WAAAC,EAAS,eAAAC,EAAa,cAAAC,EAAY,aAAAC,EAAW,cAAAC,EAAY,WAAAC,EAAS,gBAAAC,EAAc,cAAAC,EAAY,UAAAC,EAAQ,YAAAC,EAAU,mBAAAC,MAAuB,qCCFhL,IAAMC,EAAW,4BACXC,EAAqB,GAAGD,oBACxBE,EAAoB,GAAGF,mBACvBG,EAAgB,GAAGH,eAEnBI,EAAS,CACpB,kBAAmB,GAAGJ,oBACtB,iBAAkB,GAAGA,oBACrB,UAAW,GAAGA,YAChB,EF2BQ,cAAAK,EA8BF,QAAAC,MA9BE,oBA1BR,IAAMC,EAAiC,CACrC,EAAG,YACH,EAAG,UACH,EAAG,OACL,EAKaC,EAAY,IAAM,CAC7B,IAAMC,EAAU,aAAa,QAAQ,eAAe,EAC9C,CAACC,EAAOC,CAAQ,KAAI,iBAAc,GAAGX,UAAkBS,CAAO,EAE9DG,EAAU5B,EAAO,WAAW,EAE5B6B,EAAkBJ,GAAoB,CAC1CG,EAAQ,KAAKR,EAAO,UAAYK,GAAU,GAAa,EACvDE,EAASF,CAAO,CAClB,EAEA,OACEJ,EAACzB,EAAA,CACC,UAAU,MACV,aAAY,GACZ,QAAQ,QACR,QAAS,CAAC,CAAE,OAAAkC,CAAO,IACjBT,EAACxB,EAAA,CACC,MAAO,CACL,CACE,GAAI,IACJ,MAAO,YACP,QAAS,IAAM,CACbgC,EAAe,GAAG,EAClBC,EAAO,CACT,CACF,EACA,CACE,GAAI,IACJ,MAAO,UACP,QAAS,IAAM,CACbD,EAAe,GAAG,EAClBC,EAAO,CACT,CACF,EACA,CACE,GAAI,IACJ,MAAO,QACP,QAAS,IAAM,CACbD,EAAe,GAAG,EAClBC,EAAO,CACT,CACF,CACF,EACF,EAGF,SAAAR,EAAC3B,EAAA,CAAW,MAAM,eAChB,UAAA0B,EAACvB,EAAA,CAAM,KAAK,MAAM,EAAE,IAAEyB,EAAOG,GAAS,GAAG,GAC3C,EACF,CAEJ","sourcesContent":["// shim-mmode\nexport * from '@storybook/manager-api';","import { useAddonState } from '@storybook/api'\nimport {\n IconButton,\n WithTooltip,\n TooltipLinkList,\n Icons,\n} from '@storybook/components'\nimport { addons } from '@storybook/addons'\nimport { ADDON_ID, EVENTS } from '../constants'\n\nconst themes: Record<string, string> = {\n 0: 'Chakra UI',\n 1: 'Saas UI',\n 2: 'Glass',\n}\n\n/**\n * This component is rendered in the Storybook toolbar\n */\nexport const ThemeTool = () => {\n const themeId = localStorage.getItem('saas-ui-theme')\n const [theme, setTheme] = useAddonState(`${ADDON_ID}/theme`, themeId)\n\n const channel = addons.getChannel()\n\n const setActiveTheme = (themeId: string) => {\n channel.emit(EVENTS.SET_THEME, !themeId ? '1' : themeId)\n setTheme(themeId)\n }\n\n return (\n <WithTooltip\n placement=\"top\"\n closeOnClick\n trigger=\"click\"\n tooltip={({ onHide }) => (\n <TooltipLinkList\n links={[\n {\n id: '0',\n title: 'Chakra UI',\n onClick: () => {\n setActiveTheme('0')\n onHide()\n },\n },\n {\n id: '1',\n title: 'Saas UI',\n onClick: () => {\n setActiveTheme('1')\n onHide()\n },\n },\n {\n id: '2',\n title: 'Glass',\n onClick: () => {\n setActiveTheme('2')\n onHide()\n },\n },\n ]}\n />\n )}\n >\n <IconButton title=\"Select theme\">\n <Icons icon=\"eye\" /> {themes[theme || '1']}\n </IconButton>\n </WithTooltip>\n )\n}\n","export { Addon_TypesEnum as types } from '@storybook/types';\nexport { addons, mockChannel } from '@storybook/manager-api';\nexport { HooksContext, applyHooks, makeDecorator, useArgs, useCallback, useChannel, useEffect, useGlobals, useMemo, useParameter, useReducer, useRef, useState, useStoryContext } from '@storybook/preview-api/dist/addons';\n","export const ADDON_ID = '@saas-ui/storybook-addon2'\nexport const COLOR_MODE_TOOL_ID = `${ADDON_ID}/color-mode-tool`\nexport const DIRECTION_TOOL_ID = `${ADDON_ID}/direction-tool`\nexport const THEME_TOOL_ID = `${ADDON_ID}/theme-tool`\n\nexport const EVENTS = {\n TOGGLE_COLOR_MODE: `${ADDON_ID}/toggleColorMode`,\n TOGGLE_DIRECTION: `${ADDON_ID}/toggleDirection`,\n SET_THEME: `${ADDON_ID}/setTheme`,\n}\n"]}