@carbon/storybook-addon-theme 2.9.0 → 2.10.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/README.md CHANGED
@@ -79,7 +79,7 @@ export { decorators, globals };
79
79
  @use '@carbon/styles' as styles;
80
80
  @use '@carbon/styles/scss/theme' as *;
81
81
 
82
- [storybook-carbon-theme] {
82
+ [data-carbon-theme] {
83
83
  @include styles.theme(styles.$white);
84
84
 
85
85
  /* make sure background and color are set if theme in use */
@@ -87,17 +87,17 @@ export { decorators, globals };
87
87
  color: $text-primary;
88
88
  }
89
89
 
90
- [storybook-carbon-theme='g10'],
90
+ [data-carbon-theme='g10'],
91
91
  .sb--use-carbon-theme-g10 {
92
92
  @include styles.theme(styles.$g10);
93
93
  }
94
94
 
95
- [storybook-carbon-theme='g90'],
95
+ [data-carbon-theme='g90'],
96
96
  .sb--use-carbon-theme-g90 {
97
97
  @include styles.theme(styles.$g90);
98
98
  }
99
99
 
100
- [storybook-carbon-theme='g100'],
100
+ [data-carbon-theme='g100'],
101
101
  .sb--use-carbon-theme-g100 {
102
102
  @include styles.theme(styles.$g100);
103
103
  }
@@ -116,7 +116,7 @@ $feature-flags: (
116
116
  @import "carbon-components/scss/globals/scss/styles";
117
117
  @import "@carbon/themes/scss/themes";
118
118
 
119
- [storybook-carbon-theme] {
119
+ [data-carbon-theme] {
120
120
  background: $ui-background;
121
121
  color: $ui-01;
122
122
 
@@ -126,14 +126,14 @@ $feature-flags: (
126
126
  );
127
127
  }
128
128
 
129
- [storybook-carbon-theme="g10"] {
129
+ [data-carbon-theme="g10"] {
130
130
  @include carbon--theme(
131
131
  $theme: $carbon--theme--g10,
132
132
  $emit-custom-properties: true
133
133
  );
134
134
  }
135
135
 
136
- [storybook-carbon-theme="g90"] {
136
+ [data-carbon-theme="g90"] {
137
137
  z-index: 90;
138
138
  @include carbon--theme(
139
139
  $theme: $carbon--theme--g90,
@@ -141,7 +141,7 @@ $feature-flags: (
141
141
  );
142
142
  }
143
143
 
144
- [storybook-carbon-theme="g100"] {
144
+ [data-carbon-theme="g100"] {
145
145
  @include carbon--theme(
146
146
  $theme: $carbon--theme--g100,
147
147
  $emit-custom-properties: true
@@ -26,7 +26,7 @@ const withCarbonTheme = (StoryFn, context) => {
26
26
  const selector = context.viewMode === 'docs' ? `.sbdocs-preview .docs-story` : '.sb-show-main';
27
27
  const rootElements = document.querySelectorAll(selector);
28
28
  rootElements.forEach(rootElement => {
29
- rootElement.setAttribute('storybook-carbon-theme', globalCarbonTheme ?? storyCarbonTheme);
29
+ rootElement.setAttribute('data-carbon-theme', globalCarbonTheme ?? storyCarbonTheme);
30
30
  });
31
31
  }, [context.id, context.viewMode, globalCarbonTheme, storyCarbonTheme]);
32
32
  return StoryFn();
@@ -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,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":[]}
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 'data-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,mBAAmB,EACnBX,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/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.9.0",
4
+ "version": "2.10.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/react.js",
7
7
  "repository": {
@@ -64,5 +64,5 @@
64
64
  "npm-run-all": "^4.1.5",
65
65
  "rimraf": "^6.0.1"
66
66
  },
67
- "gitHead": "802c916a0f4325e3530a340e187320d011187b51"
67
+ "gitHead": "2722d2ea768f07df5445cf74a5e9aed8d250637b"
68
68
  }