@carbon/storybook-addon-theme 2.8.0 → 2.9.0
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/dist/Panel.js +1 -1
- package/dist/Panel.js.map +1 -1
- package/dist/components/PanelContent.js +1 -1
- package/dist/components/PanelContent.js.map +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/decorators/withCarbonTheme.js.map +1 -1
- package/dist/manager.js.map +1 -1
- package/package.json +13 -13
package/dist/Panel.js
CHANGED
|
@@ -9,7 +9,7 @@ var _managerApi = require("@storybook/manager-api");
|
|
|
9
9
|
var _components = require("@storybook/components");
|
|
10
10
|
var _constants = require("./constants");
|
|
11
11
|
var _PanelContent = require("./components/PanelContent");
|
|
12
|
-
function _interopRequireDefault(
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
/**
|
|
14
14
|
* Copyright IBM Corp. 2023, 2023
|
|
15
15
|
*
|
package/dist/Panel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.js","names":["_react","_interopRequireDefault","require","_managerApi","_components","_constants","_PanelContent","
|
|
1
|
+
{"version":3,"file":"Panel.js","names":["_react","_interopRequireDefault","require","_managerApi","_components","_constants","_PanelContent","e","__esModule","default","Panel","props","globals","updateGlobals","useGlobals","globalCarbonTheme","PARAM_KEY","createElement","AddonPanel","PanelContent","theme","onChange","value","exports"],"sources":["../src/Panel.js"],"sourcesContent":["/**\n * Copyright IBM Corp. 2023, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport React from 'react';\nimport { useGlobals } from '@storybook/manager-api';\n\nimport { AddonPanel } from '@storybook/components';\nimport { PARAM_KEY } from './constants';\nimport { PanelContent } from './components/PanelContent';\n\nexport const Panel = (props) => {\n const [globals, updateGlobals] = useGlobals();\n const globalCarbonTheme = globals[PARAM_KEY];\n\n return (\n <AddonPanel {...props}>\n <PanelContent\n theme={globalCarbonTheme}\n onChange={(value) => {\n updateGlobals({ [PARAM_KEY]: value });\n }}\n />\n </AddonPanel>\n );\n};\n"],"mappings":";;;;;;AAMA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAAyD,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAXzD;AACA;AACA;AACA;AACA;AACA;;AAQO,MAAMG,KAAK,GAAIC,KAAK,IAAK;EAC9B,MAAM,CAACC,OAAO,EAAEC,aAAa,CAAC,GAAG,IAAAC,sBAAU,EAAC,CAAC;EAC7C,MAAMC,iBAAiB,GAAGH,OAAO,CAACI,oBAAS,CAAC;EAE5C,oBACEhB,MAAA,CAAAS,OAAA,CAAAQ,aAAA,CAACb,WAAA,CAAAc,UAAU,EAAKP,KAAK,eACnBX,MAAA,CAAAS,OAAA,CAAAQ,aAAA,CAACX,aAAA,CAAAa,YAAY;IACXC,KAAK,EAAEL,iBAAkB;IACzBM,QAAQ,EAAGC,KAAK,IAAK;MACnBT,aAAa,CAAC;QAAE,CAACG,oBAAS,GAAGM;MAAM,CAAC,CAAC;IACvC;EAAE,CACH,CACS,CAAC;AAEjB,CAAC;AAACC,OAAA,CAAAb,KAAA,GAAAA,KAAA","ignoreList":[]}
|
|
@@ -8,7 +8,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _components = require("@storybook/components");
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _constants = require("../constants");
|
|
11
|
-
function _interopRequireDefault(
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
/**
|
|
13
13
|
* Copyright IBM Corp. 2023, 2023
|
|
14
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelContent.js","names":["_react","_interopRequireDefault","require","_components","_propTypes","_constants","
|
|
1
|
+
{"version":3,"file":"PanelContent.js","names":["_react","_interopRequireDefault","require","_components","_propTypes","_constants","e","__esModule","default","PanelContent","theme","onChange","themes","Object","values","CARBON_THEMES","createElement","Form","Field","label","Select","name","value","ev","target","size","map","option","key","exports","propTypes","PropTypes","func","string"],"sources":["../../src/components/PanelContent.js"],"sourcesContent":["/**\n * Copyright IBM Corp. 2023, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport React from 'react';\nimport { Form } from '@storybook/components';\nimport PropTypes from 'prop-types';\nimport { CARBON_THEMES } from '../constants';\n\nexport const PanelContent = ({ theme, onChange }) => {\n const themes = Object.values(CARBON_THEMES);\n\n return (\n <div>\n <Form>\n <Form.Field label=\"Select Carbon theme:\">\n <Form.Select\n name=\"carbon-theme\"\n value={theme}\n onChange={(ev) => {\n onChange && onChange(ev.target.value);\n }}\n size=\"flex\"\n >\n {themes.map((option) => (\n <option key={option} value={option}>\n {option}\n </option>\n ))}\n </Form.Select>\n </Form.Field>\n </Form>\n </div>\n );\n};\n\nPanelContent.propTypes = {\n onChange: PropTypes.func,\n theme: PropTypes.string,\n};\n"],"mappings":";;;;;;AAMA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAA6C,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAT7C;AACA;AACA;AACA;AACA;AACA;;AAMO,MAAMG,YAAY,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAS,CAAC,KAAK;EACnD,MAAMC,MAAM,GAAGC,MAAM,CAACC,MAAM,CAACC,wBAAa,CAAC;EAE3C,oBACEf,MAAA,CAAAQ,OAAA,CAAAQ,aAAA,2BACEhB,MAAA,CAAAQ,OAAA,CAAAQ,aAAA,CAACb,WAAA,CAAAc,IAAI,qBACHjB,MAAA,CAAAQ,OAAA,CAAAQ,aAAA,CAACb,WAAA,CAAAc,IAAI,CAACC,KAAK;IAACC,KAAK,EAAC;EAAsB,gBACtCnB,MAAA,CAAAQ,OAAA,CAAAQ,aAAA,CAACb,WAAA,CAAAc,IAAI,CAACG,MAAM;IACVC,IAAI,EAAC,cAAc;IACnBC,KAAK,EAAEZ,KAAM;IACbC,QAAQ,EAAGY,EAAE,IAAK;MAChBZ,QAAQ,IAAIA,QAAQ,CAACY,EAAE,CAACC,MAAM,CAACF,KAAK,CAAC;IACvC,CAAE;IACFG,IAAI,EAAC;EAAM,GAEVb,MAAM,CAACc,GAAG,CAAEC,MAAM,iBACjB3B,MAAA,CAAAQ,OAAA,CAAAQ,aAAA;IAAQY,GAAG,EAAED,MAAO;IAACL,KAAK,EAAEK;EAAO,GAChCA,MACK,CACT,CACU,CACH,CACR,CACH,CAAC;AAEV,CAAC;AAACE,OAAA,CAAApB,YAAA,GAAAA,YAAA;AAEFA,YAAY,CAACqB,SAAS,GAAG;EACvBnB,QAAQ,EAAEoB,kBAAS,CAACC,IAAI;EACxBtB,KAAK,EAAEqB,kBAAS,CAACE;AACnB,CAAC","ignoreList":[]}
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["ADDON_ID","exports","PANEL_ID","TOOL_ID","PARAM_KEY","CARBON_THEMES","white","g10","g90","g100"],"sources":["../src/constants.js"],"sourcesContent":["/**\n * Copyright IBM Corp. 2023, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nexport const ADDON_ID = '@carbon/theme';\nexport const PANEL_ID = `${ADDON_ID}/panel`;\nexport const TOOL_ID = `${ADDON_ID}/tool`;\nexport const PARAM_KEY = 'carbonTheme';\nexport const CARBON_THEMES = {\n white: 'white',\n g10: 'g10',\n g90: 'g90',\n g100: 'g100',\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG,eAAe;AAChC,MAAME,QAAQ,GAAAD,OAAA,CAAAC,QAAA,
|
|
1
|
+
{"version":3,"file":"constants.js","names":["ADDON_ID","exports","PANEL_ID","TOOL_ID","PARAM_KEY","CARBON_THEMES","white","g10","g90","g100"],"sources":["../src/constants.js"],"sourcesContent":["/**\n * Copyright IBM Corp. 2023, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nexport const ADDON_ID = '@carbon/theme';\nexport const PANEL_ID = `${ADDON_ID}/panel`;\nexport const TOOL_ID = `${ADDON_ID}/tool`;\nexport const PARAM_KEY = 'carbonTheme';\nexport const CARBON_THEMES = {\n white: 'white',\n g10: 'g10',\n g90: 'g90',\n g100: 'g100',\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG,eAAe;AAChC,MAAME,QAAQ,GAAAD,OAAA,CAAAC,QAAA,GAAG,GAAGF,QAAQ,QAAQ;AACpC,MAAMG,OAAO,GAAAF,OAAA,CAAAE,OAAA,GAAG,GAAGH,QAAQ,OAAO;AAClC,MAAMI,SAAS,GAAAH,OAAA,CAAAG,SAAA,GAAG,aAAa;AAC/B,MAAMC,aAAa,GAAAJ,OAAA,CAAAI,aAAA,GAAG;EAC3BC,KAAK,EAAE,OAAO;EACdC,GAAG,EAAE,KAAK;EACVC,GAAG,EAAE,KAAK;EACVC,IAAI,EAAE;AACR,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withCarbonTheme.js","names":["_previewApi","require","_constants","withCarbonTheme","StoryFn","context","globals","parameters","globalCarbonTheme","PARAM_KEY","storyCarbonTheme","useEffect","selector","viewMode","rootElements","document","querySelectorAll","forEach","rootElement","setAttribute","id","exports"],"sources":["../../src/decorators/withCarbonTheme.js"],"sourcesContent":["/**\n * Copyright IBM Corp. 2023, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { useEffect } from '@storybook/preview-api';\nimport { PARAM_KEY } from '../constants';\n\nexport const withCarbonTheme = (StoryFn, context) => {\n const { globals, parameters } = context;\n\n const globalCarbonTheme = globals[PARAM_KEY];\n const storyCarbonTheme = parameters[PARAM_KEY];\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n const selector =\n context.viewMode === 'docs'\n ? `.sbdocs-preview .docs-story`\n : '.sb-show-main';\n\n const rootElements = document.querySelectorAll(selector);\n rootElements.forEach((rootElement) => {\n rootElement.setAttribute(\n 'storybook-carbon-theme',\n globalCarbonTheme ?? storyCarbonTheme\n );\n });\n }, [context.id, context.viewMode, globalCarbonTheme, storyCarbonTheme]);\n\n return StoryFn();\n};\n"],"mappings":";;;;;;AAMA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAPA;AACA;AACA;AACA;AACA;AACA;;AAIO,MAAME,eAAe,GAAGA,CAACC,OAAO,EAAEC,OAAO,KAAK;EACnD,MAAM;IAAEC,OAAO;IAAEC;EAAW,CAAC,GAAGF,OAAO;EAEvC,MAAMG,iBAAiB,GAAGF,OAAO,CAACG,oBAAS,CAAC;EAC5C,MAAMC,gBAAgB,GAAGH,UAAU,CAACE,oBAAS,CAAC;;EAE9C;EACA,IAAAE,qBAAS,EAAC,MAAM;IACd,MAAMC,QAAQ,GACZP,OAAO,CAACQ,QAAQ,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"withCarbonTheme.js","names":["_previewApi","require","_constants","withCarbonTheme","StoryFn","context","globals","parameters","globalCarbonTheme","PARAM_KEY","storyCarbonTheme","useEffect","selector","viewMode","rootElements","document","querySelectorAll","forEach","rootElement","setAttribute","id","exports"],"sources":["../../src/decorators/withCarbonTheme.js"],"sourcesContent":["/**\n * Copyright IBM Corp. 2023, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { useEffect } from '@storybook/preview-api';\nimport { PARAM_KEY } from '../constants';\n\nexport const withCarbonTheme = (StoryFn, context) => {\n const { globals, parameters } = context;\n\n const globalCarbonTheme = globals[PARAM_KEY];\n const storyCarbonTheme = parameters[PARAM_KEY];\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n const selector =\n context.viewMode === 'docs'\n ? `.sbdocs-preview .docs-story`\n : '.sb-show-main';\n\n const rootElements = document.querySelectorAll(selector);\n rootElements.forEach((rootElement) => {\n rootElement.setAttribute(\n 'storybook-carbon-theme',\n globalCarbonTheme ?? storyCarbonTheme\n );\n });\n }, [context.id, context.viewMode, globalCarbonTheme, storyCarbonTheme]);\n\n return StoryFn();\n};\n"],"mappings":";;;;;;AAMA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAPA;AACA;AACA;AACA;AACA;AACA;;AAIO,MAAME,eAAe,GAAGA,CAACC,OAAO,EAAEC,OAAO,KAAK;EACnD,MAAM;IAAEC,OAAO;IAAEC;EAAW,CAAC,GAAGF,OAAO;EAEvC,MAAMG,iBAAiB,GAAGF,OAAO,CAACG,oBAAS,CAAC;EAC5C,MAAMC,gBAAgB,GAAGH,UAAU,CAACE,oBAAS,CAAC;;EAE9C;EACA,IAAAE,qBAAS,EAAC,MAAM;IACd,MAAMC,QAAQ,GACZP,OAAO,CAACQ,QAAQ,KAAK,MAAM,GACvB,6BAA6B,GAC7B,eAAe;IAErB,MAAMC,YAAY,GAAGC,QAAQ,CAACC,gBAAgB,CAACJ,QAAQ,CAAC;IACxDE,YAAY,CAACG,OAAO,CAAEC,WAAW,IAAK;MACpCA,WAAW,CAACC,YAAY,CACtB,wBAAwB,EACxBX,iBAAiB,IAAIE,gBACvB,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,EAAE,CAACL,OAAO,CAACe,EAAE,EAAEf,OAAO,CAACQ,QAAQ,EAAEL,iBAAiB,EAAEE,gBAAgB,CAAC,CAAC;EAEvE,OAAON,OAAO,CAAC,CAAC;AAClB,CAAC;AAACiB,OAAA,CAAAlB,eAAA,GAAAA,eAAA","ignoreList":[]}
|
package/dist/manager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","names":["_managerApi","require","_Panel","ADDON_ID","PANEL_ID","addons","register","add","type","types","PANEL","title","render","Panel"],"sources":["../src/manager.js"],"sourcesContent":["/**\n * Copyright IBM Corp. 2023, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { addons, types } from '@storybook/manager-api';\n\nimport { Panel } from './Panel';\n\nconst ADDON_ID = 'carbonTheme';\nconst PANEL_ID = `${ADDON_ID}/panel`;\n\naddons.register(ADDON_ID, () => {\n addons.add(PANEL_ID, {\n type: types.PANEL,\n title: 'Carbon Theme',\n render: Panel,\n });\n});\n"],"mappings":";;AAMA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;AACA;AACA;AACA;;AAKA,MAAME,QAAQ,GAAG,aAAa;AAC9B,MAAMC,QAAQ,
|
|
1
|
+
{"version":3,"file":"manager.js","names":["_managerApi","require","_Panel","ADDON_ID","PANEL_ID","addons","register","add","type","types","PANEL","title","render","Panel"],"sources":["../src/manager.js"],"sourcesContent":["/**\n * Copyright IBM Corp. 2023, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { addons, types } from '@storybook/manager-api';\n\nimport { Panel } from './Panel';\n\nconst ADDON_ID = 'carbonTheme';\nconst PANEL_ID = `${ADDON_ID}/panel`;\n\naddons.register(ADDON_ID, () => {\n addons.add(PANEL_ID, {\n type: types.PANEL,\n title: 'Carbon Theme',\n render: Panel,\n });\n});\n"],"mappings":";;AAMA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;AACA;AACA;AACA;;AAKA,MAAME,QAAQ,GAAG,aAAa;AAC9B,MAAMC,QAAQ,GAAG,GAAGD,QAAQ,QAAQ;AAEpCE,kBAAM,CAACC,QAAQ,CAACH,QAAQ,EAAE,MAAM;EAC9BE,kBAAM,CAACE,GAAG,CAACH,QAAQ,EAAE;IACnBI,IAAI,EAAEC,iBAAK,CAACC,KAAK;IACjBC,KAAK,EAAE,cAAc;IACrBC,MAAM,EAAEC;EACV,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/storybook-addon-theme",
|
|
3
3
|
"description": "Carbon theme switcher for Storybook",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.9.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/react.js",
|
|
7
7
|
"repository": {
|
|
@@ -45,24 +45,24 @@
|
|
|
45
45
|
"vue": "*"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@ibm/telemetry-js": "^1.
|
|
48
|
+
"@ibm/telemetry-js": "^1.8.0",
|
|
49
49
|
"@storybook/addons": "^7.6.17",
|
|
50
50
|
"@storybook/api": "^7.6.17",
|
|
51
51
|
"@storybook/client-api": "^7.6.17",
|
|
52
|
-
"@storybook/client-logger": "^8.4.
|
|
53
|
-
"@storybook/components": "^8.4.
|
|
54
|
-
"@storybook/core-events": "^8.4.
|
|
55
|
-
"@storybook/theming": "^8.4.
|
|
56
|
-
"core-js": "^3.
|
|
52
|
+
"@storybook/client-logger": "^8.4.7",
|
|
53
|
+
"@storybook/components": "^8.4.7",
|
|
54
|
+
"@storybook/core-events": "^8.4.7",
|
|
55
|
+
"@storybook/theming": "^8.4.7",
|
|
56
|
+
"core-js": "^3.40.0",
|
|
57
57
|
"global": "^4.4.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@babel/cli": "^7.
|
|
61
|
-
"@babel/core": "^7.
|
|
62
|
-
"@babel/preset-react": "^7.
|
|
63
|
-
"npm-check-updates": "^17.1.
|
|
60
|
+
"@babel/cli": "^7.26.4",
|
|
61
|
+
"@babel/core": "^7.26.0",
|
|
62
|
+
"@babel/preset-react": "^7.26.3",
|
|
63
|
+
"npm-check-updates": "^17.1.13",
|
|
64
64
|
"npm-run-all": "^4.1.5",
|
|
65
|
-
"rimraf": "^
|
|
65
|
+
"rimraf": "^6.0.1"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "802c916a0f4325e3530a340e187320d011187b51"
|
|
68
68
|
}
|