@adobe-commerce/elsie 2.0.0 → 2.0.1-alpha-20260728135101

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.
Files changed (249) hide show
  1. package/.elsie.js +3 -3
  2. package/CHANGELOG.md +385 -112
  3. package/LICENSE.md +257 -157
  4. package/README.md +4 -2
  5. package/__mocks__/svg.js +3 -3
  6. package/bin/builders/build/index.js +2 -1
  7. package/bin/builders/changeset/index.js +1 -1
  8. package/bin/builders/concurrently/index.js +1 -1
  9. package/bin/builders/generate/api/index.js +7 -7
  10. package/bin/builders/generate/component/index.js +8 -8
  11. package/bin/builders/generate/config/index.js +5 -5
  12. package/bin/builders/generate/config/templates/elsie.js +1 -1
  13. package/bin/builders/generate/container/index.js +7 -7
  14. package/bin/builders/generate/index.js +36 -36
  15. package/bin/builders/gql/index.js +28 -28
  16. package/bin/builders/gql/validate.js +116 -105
  17. package/bin/builders/lint/index.js +1 -1
  18. package/bin/builders/serve/index.js +1 -1
  19. package/bin/builders/storybook/index.js +9 -1
  20. package/bin/builders/types/index.js +1 -2
  21. package/bin/builders/types/validate-tsconfig.js +5 -5
  22. package/bin/index.js +12 -6
  23. package/bin/lib/cli.js +9 -8
  24. package/bin/lib/resolve-bin.js +9 -0
  25. package/bin/lib/validate-typeof.js +3 -3
  26. package/bin/lib/write-file.js +3 -3
  27. package/bin/lib/write-parent-index.js +4 -4
  28. package/config/eslint.mjs +2 -1
  29. package/config/jest.mjs +7 -2
  30. package/config/plugins/dts-normalize-relative-replacer.cjs +1 -1
  31. package/config/plugins/dts.mjs +4 -3
  32. package/config/prettier.json +25 -3
  33. package/config/setEnvVars.mjs +2 -2
  34. package/config/storybook/addon.js +5 -5
  35. package/config/storybook/components/FileTree/FileTree.jsx +4 -4
  36. package/config/storybook/components/FileTree/index.js +4 -4
  37. package/config/storybook/components/Flex/Flex.jsx +3 -3
  38. package/config/storybook/components/Flex/index.js +3 -3
  39. package/config/storybook/components/OptionsTable/OptionsTable.jsx +3 -3
  40. package/config/storybook/components/OptionsTable/index.js +4 -4
  41. package/config/storybook/components/Panel/Panel.tsx +7 -7
  42. package/config/storybook/components/Panel/index.ts +3 -3
  43. package/config/storybook/components/Screenshot/Screenshot.jsx +3 -3
  44. package/config/storybook/components/Screenshot/index.js +4 -4
  45. package/config/storybook/components/Steps/Steps.jsx +3 -3
  46. package/config/storybook/components/Steps/index.js +4 -4
  47. package/config/storybook/components/StoryWrapper/StoryWrapper.jsx +3 -3
  48. package/config/storybook/components/StoryWrapper/index.js +3 -3
  49. package/config/storybook/components/Summary/Summary.jsx +3 -3
  50. package/config/storybook/components/Summary/index.js +3 -3
  51. package/config/storybook/components/Variants/Variants.jsx +11 -7
  52. package/config/storybook/components/Variants/index.js +3 -3
  53. package/config/storybook/manager.js +3 -3
  54. package/config/storybook/preview.jsx +3 -3
  55. package/config/storybook/theming/fonts.css +12 -4
  56. package/config/storybook/theming/preview.css +3 -1
  57. package/config/storybook/theming/theme.js +3 -3
  58. package/config/vite.mjs +53 -26
  59. package/package.json +36 -34
  60. package/src/components/Accordion/Accordion.css +1 -1
  61. package/src/components/Accordion/Accordion.stories.tsx +18 -18
  62. package/src/components/Accordion/Accordion.tsx +12 -8
  63. package/src/components/Accordion/index.ts +3 -3
  64. package/src/components/ActionButton/ActionButton.stories.tsx +8 -8
  65. package/src/components/ActionButton/ActionButton.tsx +7 -5
  66. package/src/components/ActionButton/index.ts +3 -3
  67. package/src/components/ActionButtonGroup/ActionButtonGroup.stories.tsx +3 -3
  68. package/src/components/ActionButtonGroup/ActionButtonGroup.tsx +2 -2
  69. package/src/components/ActionButtonGroup/index.ts +3 -3
  70. package/src/components/AlertBanner/AlertBanner.stories.tsx +6 -6
  71. package/src/components/AlertBanner/AlertBanner.tsx +12 -10
  72. package/src/components/AlertBanner/index.ts +3 -3
  73. package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +14 -14
  74. package/src/components/Breadcrumbs/Breadcrumbs.tsx +3 -3
  75. package/src/components/Breadcrumbs/index.ts +3 -3
  76. package/src/components/Button/Button.mdx +24 -11
  77. package/src/components/Button/Button.stories.tsx +6 -6
  78. package/src/components/Button/Button.tsx +7 -8
  79. package/src/components/Button/index.ts +3 -3
  80. package/src/components/Card/Card.stories.tsx +6 -6
  81. package/src/components/Card/Card.tsx +3 -3
  82. package/src/components/Card/index.ts +3 -3
  83. package/src/components/CartItem/CartItem.stories.tsx +12 -12
  84. package/src/components/CartItem/CartItem.tsx +4 -2
  85. package/src/components/CartItem/CartItemSkeleton.tsx +3 -3
  86. package/src/components/CartItem/index.ts +3 -3
  87. package/src/components/CartList/CartList.tsx +3 -3
  88. package/src/components/CartList/index.ts +3 -3
  89. package/src/components/Checkbox/Checkbox.stories.tsx +17 -14
  90. package/src/components/Checkbox/Checkbox.tsx +8 -6
  91. package/src/components/Checkbox/index.ts +3 -3
  92. package/src/components/ColorSwatch/ColorSwatch.css +8 -4
  93. package/src/components/ColorSwatch/ColorSwatch.stories.tsx +6 -6
  94. package/src/components/ColorSwatch/ColorSwatch.tsx +8 -6
  95. package/src/components/ColorSwatch/index.ts +3 -3
  96. package/src/components/ContentGrid/ContentGrid.css +15 -15
  97. package/src/components/ContentGrid/ContentGrid.stories.tsx +4 -4
  98. package/src/components/ContentGrid/ContentGrid.tsx +3 -3
  99. package/src/components/ContentGrid/index.ts +3 -3
  100. package/src/components/Divider/Divider.stories.tsx +7 -4
  101. package/src/components/Divider/Divider.tsx +3 -3
  102. package/src/components/Divider/index.ts +4 -4
  103. package/src/components/Field/Field.stories.tsx +7 -7
  104. package/src/components/Field/Field.tsx +4 -2
  105. package/src/components/Field/index.ts +3 -3
  106. package/src/components/Header/Header.stories.tsx +9 -10
  107. package/src/components/Header/Header.tsx +11 -7
  108. package/src/components/Header/index.ts +3 -3
  109. package/src/components/Icon/Icon.stories.helpers.jsx +4 -4
  110. package/src/components/Icon/Icon.stories.tsx +74 -60
  111. package/src/components/Icon/Icon.tsx +77 -44
  112. package/src/components/Icon/index.ts +3 -3
  113. package/src/components/IllustratedMessage/IllustratedMessage.stories.tsx +8 -8
  114. package/src/components/IllustratedMessage/IllustratedMessage.tsx +7 -5
  115. package/src/components/IllustratedMessage/index.ts +3 -3
  116. package/src/components/Image/Image.stories.tsx +3 -3
  117. package/src/components/Image/Image.tsx +4 -4
  118. package/src/components/Image/index.ts +3 -3
  119. package/src/components/ImageSwatch/ImageSwatch.css +8 -4
  120. package/src/components/ImageSwatch/ImageSwatch.stories.tsx +10 -10
  121. package/src/components/ImageSwatch/ImageSwatch.tsx +25 -23
  122. package/src/components/ImageSwatch/index.ts +3 -3
  123. package/src/components/InLineAlert/InLineAlert.stories.tsx +12 -7
  124. package/src/components/InLineAlert/InLineAlert.tsx +4 -2
  125. package/src/components/InLineAlert/index.ts +3 -3
  126. package/src/components/Incrementer/Incrementer.stories.tsx +9 -9
  127. package/src/components/Incrementer/Incrementer.tsx +75 -37
  128. package/src/components/Incrementer/index.ts +3 -3
  129. package/src/components/Input/Input.css +4 -1
  130. package/src/components/Input/Input.stories.tsx +5 -5
  131. package/src/components/Input/Input.tsx +5 -3
  132. package/src/components/Input/index.ts +3 -3
  133. package/src/components/InputDate/InputDate.tsx +3 -3
  134. package/src/components/InputDate/index.ts +3 -3
  135. package/src/components/InputFile/InputFile.css +16 -16
  136. package/src/components/InputFile/InputFile.stories.tsx +21 -16
  137. package/src/components/InputFile/InputFile.tsx +8 -6
  138. package/src/components/InputFile/index.ts +5 -5
  139. package/src/components/InputPassword/InputPassword.stories.tsx +4 -4
  140. package/src/components/InputPassword/InputPassword.tsx +5 -4
  141. package/src/components/InputPassword/PasswordStatusIndicator/PasswordStatusIndicator.tsx +1 -1
  142. package/src/components/InputPassword/PasswordStatusIndicator/index.ts +3 -3
  143. package/src/components/InputPassword/index.ts +3 -3
  144. package/src/components/Modal/Modal.stories.tsx +27 -16
  145. package/src/components/Modal/Modal.tsx +10 -11
  146. package/src/components/Modal/index.ts +3 -3
  147. package/src/components/MultiSelect/MultiSelect.stories.tsx +15 -15
  148. package/src/components/MultiSelect/MultiSelect.tsx +15 -15
  149. package/src/components/Pagination/Pagination.css +1 -1
  150. package/src/components/Pagination/Pagination.stories.tsx +0 -1
  151. package/src/components/Pagination/Pagination.tsx +17 -12
  152. package/src/components/Pagination/PaginationButton.tsx +2 -3
  153. package/src/components/Pagination/index.ts +3 -3
  154. package/src/components/Picker/Picker.css +3 -1
  155. package/src/components/Picker/Picker.stories.tsx +1 -1
  156. package/src/components/Picker/Picker.tsx +8 -6
  157. package/src/components/Picker/index.ts +3 -3
  158. package/src/components/Portal/Portal.stories.tsx +50 -44
  159. package/src/components/Portal/Portal.tsx +4 -4
  160. package/src/components/Price/Price.stories.tsx +3 -3
  161. package/src/components/Price/Price.tsx +4 -2
  162. package/src/components/Price/index.ts +3 -3
  163. package/src/components/PriceRange/PriceRange.stories.tsx +3 -3
  164. package/src/components/PriceRange/PriceRange.tsx +8 -6
  165. package/src/components/PriceRange/index.ts +3 -3
  166. package/src/components/ProductItemCard/ProductItemCard.tsx +4 -2
  167. package/src/components/ProductItemCard/ProductItemCardSkeleton.tsx +16 -16
  168. package/src/components/ProductItemCard/index.ts +4 -4
  169. package/src/components/ProgressSpinner/ProgressSpinner.stories.tsx +8 -8
  170. package/src/components/ProgressSpinner/ProgressSpinner.tsx +7 -5
  171. package/src/components/ProgressSpinner/index.ts +3 -3
  172. package/src/components/RadioButton/RadioButton.stories.tsx +1 -1
  173. package/src/components/RadioButton/RadioButton.tsx +4 -2
  174. package/src/components/Skeleton/Skeleton.stories.tsx +4 -4
  175. package/src/components/Skeleton/Skeleton.tsx +11 -7
  176. package/src/components/Skeleton/index.ts +3 -3
  177. package/src/components/Table/Table.css +106 -99
  178. package/src/components/Table/Table.stories.tsx +404 -227
  179. package/src/components/Table/Table.tsx +11 -7
  180. package/src/components/Table/index.ts +4 -4
  181. package/src/components/Tag/Tag.stories.tsx +6 -6
  182. package/src/components/Tag/Tag.tsx +7 -5
  183. package/src/components/Tag/index.ts +3 -3
  184. package/src/components/TextArea/TextArea.css +3 -1
  185. package/src/components/TextArea/TextArea.stories.tsx +9 -6
  186. package/src/components/TextArea/TextArea.tsx +3 -3
  187. package/src/components/TextArea/index.ts +3 -3
  188. package/src/components/TextSwatch/TextSwatch.css +4 -2
  189. package/src/components/TextSwatch/TextSwatch.stories.tsx +8 -8
  190. package/src/components/TextSwatch/TextSwatch.tsx +12 -7
  191. package/src/components/TextSwatch/index.ts +3 -3
  192. package/src/components/ToggleButton/ToggleButton.css +6 -2
  193. package/src/components/ToggleButton/ToggleButton.stories.tsx +10 -6
  194. package/src/components/ToggleButton/ToggleButton.tsx +8 -3
  195. package/src/components/ToggleButton/index.ts +3 -3
  196. package/src/components/UIProvider/UIProvider.css +3 -2
  197. package/src/components/UIProvider/UIProvider.tsx +11 -7
  198. package/src/components/UIProvider/debugger.css +5 -6
  199. package/src/components/UIProvider/index.ts +3 -3
  200. package/src/docs/API/event-bus.mdx +64 -37
  201. package/src/docs/API/graphql.mdx +69 -36
  202. package/src/docs/API/initializer.mdx +58 -35
  203. package/src/docs/API/render.mdx +45 -32
  204. package/src/docs/Design/colors.mdx +10 -12
  205. package/src/docs/Design/grid.mdx +41 -14
  206. package/src/docs/Design/overview.mdx +20 -4
  207. package/src/docs/Design/shapes.mdx +8 -7
  208. package/src/docs/Design/spacing.mdx +3 -1
  209. package/src/docs/Design/typography.mdx +3 -2
  210. package/src/docs/Utilities/VComponent.mdx +27 -10
  211. package/src/docs/Utilities/classList.mdx +7 -5
  212. package/src/docs/Utilities/debounce.mdx +6 -7
  213. package/src/docs/Utilities/getCookie.mdx +1 -2
  214. package/src/docs/Utilities/getFormErrors.mdx +1 -2
  215. package/src/docs/Utilities/getFormValues.mdx +1 -2
  216. package/src/docs/Utilities/getPathValue.mdx +2 -4
  217. package/src/docs/Utilities/links.mdx +16 -7
  218. package/src/docs/cli-usage.mdx +8 -3
  219. package/src/docs/components/overview.mdx +14 -4
  220. package/src/docs/quick-start.mdx +69 -22
  221. package/src/docs/slots.mdx +74 -37
  222. package/src/docs/welcome.mdx +13 -4
  223. package/src/i18n/index.ts +3 -3
  224. package/src/lib/aem/assets.ts +9 -9
  225. package/src/lib/aem/configs.ts +16 -8
  226. package/src/lib/classes.ts +4 -4
  227. package/src/lib/config.ts +3 -3
  228. package/src/lib/debounce.ts +3 -3
  229. package/src/lib/deepmerge.ts +6 -13
  230. package/src/lib/deviceUtils.ts +3 -3
  231. package/src/lib/form-values.ts +3 -3
  232. package/src/lib/get-price-formatter.ts +8 -3
  233. package/src/lib/i18n.ts +3 -3
  234. package/src/lib/image-params-keymap.ts +4 -5
  235. package/src/lib/initializer.ts +11 -12
  236. package/src/lib/is-number.ts +3 -3
  237. package/src/lib/locale-config.ts +4 -4
  238. package/src/lib/render.tsx +14 -8
  239. package/src/lib/resolve-image.ts +19 -16
  240. package/src/lib/signals.ts +4 -4
  241. package/src/lib/slot.tsx +34 -27
  242. package/src/lib/tests.tsx +6 -8
  243. package/src/lib/types.ts +3 -3
  244. package/src/lib/vcomponent.tsx +3 -3
  245. package/src/shims/importmap.js +3107 -20
  246. package/static/assets/images/index.ts +3 -3
  247. package/storybook-stories.js +3 -3
  248. package/tests/__mocks__/browserMocks.ts +3 -3
  249. package/tests/__mocks__/fileMocks.ts +3 -3
@@ -1,5 +1,13 @@
1
1
  const cli = require('../../lib/cli');
2
2
 
3
3
  module.exports = function generateResourceBuilder() {
4
- return cli('storybook dev -h localhost -p 6006 --disable-telemetry --quiet');
4
+ return cli('storybook', [
5
+ 'dev',
6
+ '-h',
7
+ 'localhost',
8
+ '-p',
9
+ '6006',
10
+ '--disable-telemetry',
11
+ '--quiet',
12
+ ]);
5
13
  };
@@ -27,8 +27,7 @@ module.exports = async function tscBuilder({ argv } = {}) {
27
27
  return;
28
28
  }
29
29
 
30
- const tscBin = require.resolve('typescript/bin/tsc');
31
- return cli(`node ${tscBin} --noEmit --project ${configPath}`);
30
+ return cli('typescript', ['--noEmit', '--project', configPath], 'tsc');
32
31
  };
33
32
 
34
33
  module.exports.builder = (yargs) =>
@@ -2,9 +2,9 @@
2
2
  * Copyright 2025 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  const fs = require('fs');
@@ -67,7 +67,7 @@ module.exports = function validateTsconfig(configPath) {
67
67
  if (value !== undefined && removedValues.includes(value.toLowerCase())) {
68
68
  errors.push(
69
69
  `compilerOptions.${key}: "${value}" was removed in TypeScript 6. ` +
70
- `Use ${key === 'moduleResolution' ? '"nodenext" or "bundler"' : '"es2015" or later'} instead.`
70
+ `Use ${key === 'moduleResolution' ? '"nodenext" or "bundler"' : '"es2015" or later'} instead.`,
71
71
  );
72
72
  }
73
73
  }
@@ -78,7 +78,7 @@ module.exports = function validateTsconfig(configPath) {
78
78
  if (compilerOptions[key] !== undefined) {
79
79
  warnings.push(
80
80
  `compilerOptions.${key} is deprecated in TypeScript 6 and will be removed in TS7. ` +
81
- `Add "ignoreDeprecations": "6.0" to silence, or migrate away from this option.`
81
+ `Add "ignoreDeprecations": "6.0" to silence, or migrate away from this option.`,
82
82
  );
83
83
  }
84
84
  }
package/bin/index.js CHANGED
@@ -10,7 +10,7 @@ yargs
10
10
  .command(
11
11
  'gql',
12
12
  'Generates types or mocks for your API',
13
- require('./builders/gql')
13
+ require('./builders/gql'),
14
14
  )
15
15
  .command('build', 'Build bundles', require('./builders/build'))
16
16
  .command('test', 'Run Jest tests', require('./builders/test'))
@@ -18,24 +18,30 @@ yargs
18
18
  .command(
19
19
  'concurrently',
20
20
  'Run multiple commands concurrently',
21
- require('./builders/concurrently')
21
+ // Loaded lazily: concurrently is ESM-only and only needs to resolve when this
22
+ // command actually runs, not whenever this CLI module is merely required.
23
+ (...args) => require('./builders/concurrently')(...args),
22
24
  )
23
25
  .command(
24
26
  'wait-on',
25
27
  'Wait for files, ports, sockets, or http(s) resources',
26
- require('./builders/wait-on')
28
+ require('./builders/wait-on'),
27
29
  )
28
30
  .command(
29
31
  'types',
30
32
  'Type-check with TypeScript and validate tsconfig for TS6 compatibility',
31
- require('./builders/types')
33
+ require('./builders/types'),
32
34
  )
33
35
  .command(
34
36
  'generate',
35
37
  'Generate a new <resource>',
36
- require('./builders/generate')
38
+ require('./builders/generate'),
39
+ )
40
+ .command(
41
+ 'changeset',
42
+ 'Run changeset commands',
43
+ require('./builders/changeset'),
37
44
  )
38
- .command('changeset', 'Run changeset commands', require('./builders/changeset'))
39
45
 
40
46
  .help('help')
41
47
 
package/bin/lib/cli.js CHANGED
@@ -1,13 +1,14 @@
1
1
  const { spawn } = require('child_process');
2
+ const resolveBin = require('./resolve-bin');
3
+
4
+ module.exports = function cli(packageName, args = [], binName) {
5
+ const scriptPath = resolveBin(packageName, binName);
6
+ const passthroughArgs = process.argv.slice(3);
7
+ const allArgs = [scriptPath, ...args, ...passthroughArgs];
2
8
 
3
- module.exports = function cli(command) {
4
- let cmd = command;
5
- const argvs = process.argv.slice(3).join(' ');
6
- if (argvs) cmd += ` ${argvs}`;
7
-
8
9
  return new Promise((resolve, reject) => {
9
- const child = spawn(cmd, { shell: true, stdio: 'inherit' });
10
-
10
+ const child = spawn(process.execPath, allArgs, { stdio: 'inherit' });
11
+
11
12
  child.on('close', (code) => {
12
13
  if (code !== 0) {
13
14
  reject(new Error(`Command failed with exit code ${code}`));
@@ -15,7 +16,7 @@ module.exports = function cli(command) {
15
16
  resolve(child);
16
17
  }
17
18
  });
18
-
19
+
19
20
  child.on('error', (err) => {
20
21
  reject(err);
21
22
  });
@@ -0,0 +1,9 @@
1
+ const path = require('path');
2
+
3
+ module.exports = function resolveBin(packageName, binName = packageName) {
4
+ const pkgJsonPath = require.resolve(`${packageName}/package.json`);
5
+ const pkgDir = path.dirname(pkgJsonPath);
6
+ const { bin } = require(pkgJsonPath);
7
+ const binRelativePath = typeof bin === 'string' ? bin : bin[binName];
8
+ return path.join(pkgDir, binRelativePath);
9
+ };
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  module.exports = function validateTypeOf(values, rules) {
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  const path = require('path');
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  const path = require('path');
@@ -13,7 +13,7 @@ const m = require('./log-message');
13
13
 
14
14
  module.exports = function writeParentIndex(
15
15
  filePath,
16
- { pathname, importAliasRoot = '.' }
16
+ { pathname, importAliasRoot = '.' },
17
17
  ) {
18
18
  const relativePath = path.relative('.', filePath);
19
19
 
package/config/eslint.mjs CHANGED
@@ -122,7 +122,8 @@ export const sourceImportRestrictions = [
122
122
  },
123
123
  {
124
124
  group: ['preact-i18n'],
125
- message: 'Please use "@adobe-commerce/elsie/i18n" instead of "preact-i18n".',
125
+ message:
126
+ 'Please use "@adobe-commerce/elsie/i18n" instead of "preact-i18n".',
126
127
  },
127
128
  ],
128
129
  },
package/config/jest.mjs CHANGED
@@ -14,7 +14,9 @@ import { createRequire } from 'module';
14
14
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
15
15
  const require = createRequire(import.meta.url);
16
16
 
17
- const { compilerOptions } = require(path.resolve(process.cwd(), 'tsconfig.json'));
17
+ const { compilerOptions } = require(
18
+ path.resolve(process.cwd(), 'tsconfig.json'),
19
+ );
18
20
 
19
21
  const paths = { ...compilerOptions.paths };
20
22
 
@@ -46,7 +48,10 @@ export default {
46
48
  '^react-dom/test-utils$': 'preact/test-utils',
47
49
  '^react-dom$': 'preact/compat',
48
50
  '^react$': 'preact/compat',
49
- '\\.(css|less|scss|sass)\\?inline$': path.resolve(__dirname, '../tests/__mocks__/cssMock.js'),
51
+ '\\.(css|less|scss|sass)\\?inline$': path.resolve(
52
+ __dirname,
53
+ '../tests/__mocks__/cssMock.js',
54
+ ),
50
55
  '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
51
56
  '\\.svg': '@adobe-commerce/elsie/__mocks__/svg.js',
52
57
  '^@adobe-commerce/elsie/(.*)$': path.resolve(__dirname, '../src/$1'),
@@ -42,6 +42,6 @@ exports.default = function normalizeRelativeReplacer({ orig, file }) {
42
42
  if (rel === importPath) return orig;
43
43
  return orig.replace(
44
44
  `${openQuote}${importPath}${closeQuote}`,
45
- `${openQuote}${rel}${closeQuote}`
45
+ `${openQuote}${rel}${closeQuote}`,
46
46
  );
47
47
  };
@@ -88,7 +88,7 @@ export function dtsPlugin({
88
88
  // truth — tsconfig files do not need to define declarationDir themselves.
89
89
  execSync(
90
90
  `"${tscBin}" -p "${tsconfigAbsPath}" --declarationDir "${absDeclDir}"`,
91
- { stdio: 'inherit', cwd }
91
+ { stdio: 'inherit', cwd },
92
92
  );
93
93
 
94
94
  {
@@ -127,7 +127,8 @@ export function dtsPlugin({
127
127
  // receive the import *clause* (not the trailing ';'), so returning '' from
128
128
  // one leaves an invalid bare ';' (TS1036). Removing the whole statement in
129
129
  // a single pass avoids that.
130
- const PURE_IMPORT = /^[ \t]*import\s+['"][^'"]+['"][^\S\r\n]*;?[^\S\r\n]*(?:\r?\n|$)/gm;
130
+ const PURE_IMPORT =
131
+ /^[ \t]*import\s+['"][^'"]+['"][^\S\r\n]*;?[^\S\r\n]*(?:\r?\n|$)/gm;
131
132
  for (const filePath of walkDts(absDeclDir)) {
132
133
  const content = readFileSync(filePath, 'utf-8');
133
134
  const cleaned = content.replace(PURE_IMPORT, '');
@@ -148,7 +149,7 @@ export function dtsPlugin({
148
149
  const isLocalFile =
149
150
  existsSync(absSrc) ||
150
151
  ['.ts', '.tsx', '.js', '.jsx'].some((ext) =>
151
- existsSync(absSrc + ext)
152
+ existsSync(absSrc + ext),
152
153
  );
153
154
  if (!isLocalFile) {
154
155
  writeFileSync(barrelPath, `export * from '${srcPath}';\n`, 'utf-8');
@@ -1,7 +1,29 @@
1
1
  {
2
- "tabWidth": 2,
2
+ "trailingComma": "all",
3
3
  "useTabs": false,
4
+ "semi": true,
5
+ "tabWidth": 2,
4
6
  "singleQuote": true,
5
- "trailingComma": "es5",
6
- "semi": true
7
+ "overrides": [
8
+ {
9
+ "files": ["*.json", "*.json5"],
10
+ "options": {
11
+ "parser": "json",
12
+ "trailingComma": "none"
13
+ }
14
+ },
15
+ {
16
+ "files": ["*.yaml", "*.yml"],
17
+ "options": {
18
+ "singleQuote": false
19
+ }
20
+ },
21
+ {
22
+ "files": ["*.md", "*.mdx"],
23
+ "options": {
24
+ "proseWrap": "always",
25
+ "printWidth": 80
26
+ }
27
+ }
28
+ ]
7
29
  }
@@ -8,7 +8,7 @@
8
8
  *******************************************************************/
9
9
 
10
10
  // Used in the Price component to avoid using the system locale in tests, which can be different between computers
11
- process.env.LOCALE = "en-US";
11
+ process.env.LOCALE = 'en-US';
12
12
 
13
13
  // Used mainly for the elsie generator to avoid issues with the system locale in tests
14
- process.env.LANG = "en_US.UTF-8";
14
+ process.env.LANG = 'en_US.UTF-8';
@@ -74,7 +74,7 @@ module.exports = (_storybookOptions, { dropinViteConfig = true } = {}) => ({
74
74
  Object.entries(env).map(([k, v]) => [
75
75
  `process.env.${k}`,
76
76
  JSON.stringify(v),
77
- ])
77
+ ]),
78
78
  ),
79
79
  };
80
80
 
@@ -108,8 +108,8 @@ module.exports = (_storybookOptions, { dropinViteConfig = true } = {}) => ({
108
108
  ...(Array.isArray(config.resolve?.alias)
109
109
  ? config.resolve.alias
110
110
  : Object.entries(config.resolve?.alias ?? {}).map(
111
- ([find, replacement]) => ({ find, replacement })
112
- )),
111
+ ([find, replacement]) => ({ find, replacement }),
112
+ )),
113
113
  {
114
114
  find: /^@adobe-commerce\/elsie\/src(.*)$/,
115
115
  replacement: `${elsieRoot}/src$1`,
@@ -138,10 +138,10 @@ module.exports = (_storybookOptions, { dropinViteConfig = true } = {}) => ({
138
138
  const sbComponentEntries = fs
139
139
  .readdirSync(sbComponentsDir)
140
140
  .filter((entry) =>
141
- fs.statSync(path.join(sbComponentsDir, entry)).isDirectory()
141
+ fs.statSync(path.join(sbComponentsDir, entry)).isDirectory(),
142
142
  )
143
143
  .map(
144
- (name) => `@adobe-commerce/elsie/config/storybook/components/${name}`
144
+ (name) => `@adobe-commerce/elsie/config/storybook/components/${name}`,
145
145
  );
146
146
 
147
147
  config.optimizeDeps = {
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  import { createContext, memo, useCallback, useContext, useState } from 'react';
@@ -136,7 +136,7 @@ const Folder = memo(
136
136
  )}
137
137
  </li>
138
138
  );
139
- }
139
+ },
140
140
  );
141
141
  Folder.displayName = 'Folder';
142
142
 
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
- export * from '@adobe-commerce/elsie/config/storybook/components/FileTree/FileTree';
10
+ export * from '@adobe-commerce/elsie/config/storybook/components/FileTree/FileTree';
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  import styles from './Flex.module.css';
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  export * from '@adobe-commerce/elsie/config/storybook/components/Flex/Flex';
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  import React from 'react';
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
- export * from '@adobe-commerce/elsie/config/storybook/components/OptionsTable/OptionsTable';
10
+ export * from '@adobe-commerce/elsie/config/storybook/components/OptionsTable/OptionsTable';
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  import { FunctionComponent, toChildArray } from 'preact';
@@ -31,10 +31,10 @@ export const Panel: FunctionComponent<PanelProps> = ({
31
31
  hasHeader && !hasFooter
32
32
  ? childrenArray.slice(1)
33
33
  : !hasHeader && hasFooter
34
- ? childrenArray.slice(0, -1)
35
- : hasHeader && hasFooter
36
- ? childrenArray.slice(1, -1)
37
- : childrenArray;
34
+ ? childrenArray.slice(0, -1)
35
+ : hasHeader && hasFooter
36
+ ? childrenArray.slice(1, -1)
37
+ : childrenArray;
38
38
 
39
39
  return (
40
40
  <div className={`${styles.panel}`}>
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  export * from '@adobe-commerce/elsie/config/storybook/components/Panel/Panel';
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  import styles from './Screenshot.module.css';
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
- export * from '@adobe-commerce/elsie/config/storybook/components/Screenshot/Screenshot';
10
+ export * from '@adobe-commerce/elsie/config/storybook/components/Screenshot/Screenshot';
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  import { Unstyled } from '@storybook/addon-docs/blocks';
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
- export * from '@adobe-commerce/elsie/config/storybook/components/Steps/Steps';
10
+ export * from '@adobe-commerce/elsie/config/storybook/components/Steps/Steps';
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  import styles from './StoryWrapper.module.css';
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  export * from '@adobe-commerce/elsie/config/storybook/components/StoryWrapper/StoryWrapper';
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  import { Unstyled } from '@storybook/addon-docs/blocks';
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  export * from '@adobe-commerce/elsie/config/storybook/components/Summary/Summary';
@@ -2,9 +2,9 @@
2
2
  * Copyright 2024 Adobe
3
3
  * All Rights Reserved.
4
4
  *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
8
  *******************************************************************/
9
9
 
10
10
  import { useState } from 'preact/hooks';
@@ -14,12 +14,12 @@ import './docs.css';
14
14
  export const Variants = ({ of, storyOrder = [] }) => {
15
15
  const info = useOf(of || 'story', ['story', 'meta', 'component']);
16
16
  const stories = Object.values(info.csfFile.stories).map(
17
- (story) => story.moduleExport
17
+ (story) => story.moduleExport,
18
18
  );
19
19
  const [bgColor, setBgColor] = useState('#F5F5F5');
20
20
  const toggleBgColor = () => {
21
21
  setBgColor((prevColor) =>
22
- prevColor === '#F5F5F5' ? '#222222' : '#F5F5F5'
22
+ prevColor === '#F5F5F5' ? '#222222' : '#F5F5F5',
23
23
  );
24
24
  };
25
25
 
@@ -42,10 +42,14 @@ export const Variants = ({ of, storyOrder = [] }) => {
42
42
  <div className="story__item story__item--left">
43
43
  <h3 className="docs__header3">{story.name}</h3>
44
44
  <p className="docs__paragraph">
45
- {story.parameters.docs.description || `Add description to ${story.name}.stories.tsx.`}
45
+ {story.parameters.docs.description ||
46
+ `Add description to ${story.name}.stories.tsx.`}
46
47
  </p>
47
48
  </div>
48
- <div className="story__item story__item--right" style={{ backgroundColor: bgColor }}>
49
+ <div
50
+ className="story__item story__item--right"
51
+ style={{ backgroundColor: bgColor }}
52
+ >
49
53
  <Story of={story} />
50
54
  <Source of={story} />
51
55
  </div>