@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
@@ -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
  // https://storybook.js.org/docs/7.0/preact/writing-stories/introduction
@@ -50,7 +50,7 @@ export const Default: Story = {
50
50
  const canvas = within(canvasElement);
51
51
  await expect(await canvas.findByRole('button')).toBeVisible();
52
52
  await expect(await canvas.findByRole('button')).toHaveClass(
53
- 'dropin-action-button'
53
+ 'dropin-action-button',
54
54
  );
55
55
  },
56
56
  };
@@ -74,10 +74,10 @@ export const IconOnly: Story = {
74
74
  play: async ({ canvasElement }) => {
75
75
  const canvas = within(canvasElement);
76
76
  const buttonIcon = document.querySelector(
77
- '.dropin-action-button-icon'
77
+ '.dropin-action-button-icon',
78
78
  ) as HTMLElement;
79
79
  const addIcon = document.querySelector(
80
- 'g[data-name="Add icon"]'
80
+ 'g[data-name="Add icon"]',
81
81
  ) as HTMLElement;
82
82
  await expect(await canvas.findByRole('button')).toBeVisible();
83
83
  await expect(await buttonIcon).toBeVisible();
@@ -102,10 +102,10 @@ export const WithIcon: Story = {
102
102
  play: async ({ canvasElement }) => {
103
103
  const canvas = within(canvasElement);
104
104
  const buttonIcon = document.querySelector(
105
- '.dropin-action-button-icon'
105
+ '.dropin-action-button-icon',
106
106
  ) as HTMLElement;
107
107
  const addIcon = document.querySelector(
108
- 'g[data-name="Add icon"]'
108
+ 'g[data-name="Add icon"]',
109
109
  ) as HTMLElement;
110
110
  await expect(await canvas.findByRole('button')).toBeVisible();
111
111
  await expect(await buttonIcon).toBeVisible();
@@ -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 { ComponentChildren, FunctionComponent, VNode } from 'preact';
@@ -12,8 +12,10 @@ import { HTMLAttributes } from 'preact/compat';
12
12
  import { VComponent, classes } from '@adobe-commerce/elsie/lib';
13
13
  import '@adobe-commerce/elsie/components/ActionButton/ActionButton.css';
14
14
 
15
- export interface ActionButtonProps
16
- extends Omit<HTMLAttributes<HTMLButtonElement>, 'icon'> {
15
+ export interface ActionButtonProps extends Omit<
16
+ HTMLAttributes<HTMLButtonElement>,
17
+ 'icon'
18
+ > {
17
19
  children?: ComponentChildren;
18
20
  icon?: VNode<HTMLAttributes<SVGSVGElement>>;
19
21
  active?: boolean;
@@ -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/components/ActionButton/ActionButton';
@@ -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
  // https://storybook.js.org/docs/7.0/preact/writing-stories/introduction
@@ -52,7 +52,7 @@ export const ActionButtonGroup: FunctionComponent<ActionButtonGroupProps> = ({
52
52
  }
53
53
  }
54
54
  },
55
- [handleSelect, setActiveOptionState, disabled]
55
+ [handleSelect, setActiveOptionState, disabled],
56
56
  );
57
57
 
58
58
  const buttonGroupOptions = Children.map(
@@ -71,7 +71,7 @@ export const ActionButtonGroup: FunctionComponent<ActionButtonGroupProps> = ({
71
71
  ['dropin-action-button-group__option--with-dividers', dividers],
72
72
  ]),
73
73
  });
74
- }
74
+ },
75
75
  );
76
76
 
77
77
  return (
@@ -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/components/ActionButtonGroup/ActionButtonGroup';
@@ -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
  // https://storybook.js.org/docs/7.0/preact/writing-stories/introduction
@@ -94,13 +94,13 @@ export const Neutral: Story = {
94
94
  },
95
95
  play: async () => {
96
96
  const alertBanner = document.querySelector(
97
- 'div[class*="dropin-alert-banner"]'
97
+ 'div[class*="dropin-alert-banner"]',
98
98
  ) as HTMLElement;
99
99
 
100
100
  await expect(alertBanner).toBeVisible();
101
101
 
102
102
  const link = alertBanner.querySelector(
103
- '.dropin-alert-banner__dismiss-button'
103
+ '.dropin-alert-banner__dismiss-button',
104
104
  );
105
105
  await expect(link).toBeVisible();
106
106
  await expect(link?.ariaLabel).toBe('Dismiss Alert');
@@ -152,7 +152,7 @@ export const Action: Story = {
152
152
  },
153
153
  play: async () => {
154
154
  const alertBanner = document.querySelector(
155
- 'div[class*="dropin-alert-banner"]'
155
+ 'div[class*="dropin-alert-banner"]',
156
156
  ) as HTMLElement;
157
157
 
158
158
  await expect(alertBanner).toBeVisible();
@@ -2,21 +2,23 @@
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
- import { FunctionComponent, VNode } from 'preact';
11
- import { HTMLAttributes } from 'preact/compat';
12
- import { classes, VComponent } from '@adobe-commerce/elsie/lib';
13
- import '@adobe-commerce/elsie/components/AlertBanner/AlertBanner.css';
14
10
  import { Button, Icon } from '@adobe-commerce/elsie/components';
15
- import { Close } from '@adobe-commerce/elsie/icons';
11
+ import '@adobe-commerce/elsie/components/AlertBanner/AlertBanner.css';
16
12
  import { useText } from '@adobe-commerce/elsie/i18n';
13
+ import { Close } from '@adobe-commerce/elsie/icons';
14
+ import { classes, VComponent } from '@adobe-commerce/elsie/lib';
15
+ import { FunctionComponent, VNode } from 'preact';
16
+ import { HTMLAttributes } from 'preact/compat';
17
17
 
18
- export interface AlertBannerProps
19
- extends Omit<HTMLAttributes<HTMLDivElement>, 'icon' | 'action'> {
18
+ export interface AlertBannerProps extends Omit<
19
+ HTMLAttributes<HTMLDivElement>,
20
+ 'icon' | 'action'
21
+ > {
20
22
  variant: 'brand' | 'neutral' | 'success' | 'warning';
21
23
  icon?: VNode<HTMLAttributes<SVGSVGElement>>;
22
24
  message: VNode;
@@ -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/components/AlertBanner/AlertBanner';
@@ -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
  // https://storybook.js.org/docs/7.0/preact/writing-stories/introduction
@@ -65,10 +65,10 @@ export const Breadcrumbs: Story = {
65
65
  },
66
66
  play: async () => {
67
67
  const breadcrumbsElement = document.querySelector(
68
- '.dropin-breadcrumbs__container'
68
+ '.dropin-breadcrumbs__container',
69
69
  ) as HTMLElement;
70
70
  const categories = breadcrumbsElement.querySelectorAll(
71
- '.dropin-breadcrumbs__item a'
71
+ '.dropin-breadcrumbs__item a',
72
72
  );
73
73
 
74
74
  await expect(breadcrumbsElement).toBeVisible();
@@ -99,13 +99,13 @@ export const BreadcrumbsWithLeadingIcon: Story = {
99
99
  },
100
100
  play: async () => {
101
101
  const breadcrumbsElement = document.querySelector(
102
- '.dropin-breadcrumbs__container'
102
+ '.dropin-breadcrumbs__container',
103
103
  ) as HTMLElement;
104
104
  const icon = breadcrumbsElement.querySelector(
105
- '.dropin-breadcrumbs__item svg'
105
+ '.dropin-breadcrumbs__item svg',
106
106
  ) as HTMLElement;
107
107
  const categories = breadcrumbsElement.querySelectorAll(
108
- '.dropin-breadcrumbs__item a'
108
+ '.dropin-breadcrumbs__item a',
109
109
  );
110
110
 
111
111
  await expect(breadcrumbsElement).toBeVisible();
@@ -130,10 +130,10 @@ export const BreadcrumbsWithSeparator: Story = {
130
130
  },
131
131
  play: async () => {
132
132
  const breadcrumbsElement = document.querySelector(
133
- '.dropin-breadcrumbs__container'
133
+ '.dropin-breadcrumbs__container',
134
134
  ) as HTMLElement;
135
135
  const separators = breadcrumbsElement.querySelectorAll(
136
- '.dropin-breadcrumbs__separator--icon'
136
+ '.dropin-breadcrumbs__separator--icon',
137
137
  );
138
138
 
139
139
  await expect(breadcrumbsElement).toBeVisible();
@@ -174,16 +174,16 @@ export const BreadcrumbsWithIcons: Story = {
174
174
  },
175
175
  play: async () => {
176
176
  const breadcrumbsElement = document.querySelector(
177
- '.dropin-breadcrumbs__container'
177
+ '.dropin-breadcrumbs__container',
178
178
  ) as HTMLElement;
179
179
  const icon = breadcrumbsElement.querySelector(
180
- '.dropin-breadcrumbs__item svg'
180
+ '.dropin-breadcrumbs__item svg',
181
181
  ) as HTMLElement;
182
182
  const categories = breadcrumbsElement.querySelectorAll(
183
- '.dropin-breadcrumbs__item a'
183
+ '.dropin-breadcrumbs__item a',
184
184
  );
185
185
  const separators = breadcrumbsElement.querySelectorAll(
186
- '.dropin-breadcrumbs__separator--icon'
186
+ '.dropin-breadcrumbs__separator--icon',
187
187
  );
188
188
 
189
189
  await expect(breadcrumbsElement).toBeVisible();
@@ -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 { HTMLAttributes } from 'preact/compat';
@@ -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/components/Breadcrumbs/Breadcrumbs';
@@ -29,17 +29,23 @@ This example uses all the `Button` properties.
29
29
 
30
30
  ## All props
31
31
 
32
- The table below shows the name, description, and default value of each `Button` prop.
33
- Use the table controls to learn how each property affects the Button.
32
+ The table below shows the name, description, and default value of each `Button`
33
+ prop. Use the table controls to learn how each property affects the Button.
34
34
 
35
35
  <Canvas of={ButtonStories.Button} />
36
36
  <Controls of={ButtonStories.Button} sort="requiredFirst" />
37
37
 
38
38
  ## Active
39
39
 
40
- Setting `active` to `true` overrides the Button's `icon` and `children` properties with the values you set for the `activeIcon` and `activeChildren` properties. With this one property, you can quickly toggle the Button's icon and text.
40
+ Setting `active` to `true` overrides the Button's `icon` and `children`
41
+ properties with the values you set for the `activeIcon` and `activeChildren`
42
+ properties. With this one property, you can quickly toggle the Button's icon and
43
+ text.
41
44
 
42
- **Note:** Setting the `active` property to `false` (from `true`) returns the button's `children` and `icon` values. It does not disable the button. To disable the button, use the `disabled` property, as described in the [Disabled](#disabled) section below.
45
+ **Note:** Setting the `active` property to `false` (from `true`) returns the
46
+ button's `children` and `icon` values. It does not disable the button. To
47
+ disable the button, use the `disabled` property, as described in the
48
+ [Disabled](#disabled) section below.
43
49
 
44
50
  <StoryWrapper>
45
51
  <Story of={ButtonStories.Active} />
@@ -51,9 +57,12 @@ Setting `active` to `true` overrides the Button's `icon` and `children` properti
51
57
 
52
58
  ## Children
53
59
 
54
- The `children` prop accepts the Preact `ComponentChildren` type. This type is equal to React's `ReactNode` type and can accept any type. But in practice, you should try to limit the `children` prop to a `string`.
60
+ The `children` prop accepts the Preact `ComponentChildren` type. This type is
61
+ equal to React's `ReactNode` type and can accept any type. But in practice, you
62
+ should try to limit the `children` prop to a `string`.
55
63
 
56
- To create Icon-only buttons, use the `icon` prop. See the [Icons](#icons) section below for more information.
64
+ To create Icon-only buttons, use the `icon` prop. See the [Icons](#icons)
65
+ section below for more information.
57
66
 
58
67
  <StoryWrapper>
59
68
  <Story of={ButtonStories.Children} />
@@ -73,7 +82,8 @@ The `disabled` prop is a `boolean` that disables the button. Default is `false`.
73
82
 
74
83
  ## Icons
75
84
 
76
- The `icon` prop adds an `Icon` component. You can add an `Icon` with or without Button text.
85
+ The `icon` prop adds an `Icon` component. You can add an `Icon` with or without
86
+ Button text.
77
87
 
78
88
  <StoryWrapper>
79
89
  <Story of={ButtonStories.IconOnly} />
@@ -112,17 +122,20 @@ The `variant` prop sets the appearance of the button.
112
122
  ### When to use
113
123
 
114
124
  Use buttons to communicate actions users can take and interact with the page.
115
- Usually, each page should have only one primary button, and any remaining calls to action should be represented as lower-emphasis buttons.
125
+ Usually, each page should have only one primary button, and any remaining calls
126
+ to action should be represented as lower-emphasis buttons.
116
127
 
117
128
  ### When not to use
118
129
 
119
- Do not use the `onClick()` attribute to make buttons act as navigational elements.
120
- Instead, render the button as a link when the desired action is to take the user to a new page.
130
+ Do not use the `onClick()` attribute to make buttons act as navigational
131
+ elements. Instead, render the button as a link when the desired action is to
132
+ take the user to a new page.
121
133
 
122
134
  ### Render as a link
123
135
 
124
136
  To use a button as a navigation element, set the `href` prop to the target URL.
125
- This renders the button as an anchor tag (`<a>`) instead of a button tag (`<button>`).
137
+ This renders the button as an anchor tag (`<a>`) instead of a button tag
138
+ (`<button>`).
126
139
 
127
140
  <StoryWrapper>
128
141
  <Story of={ButtonStories.AsLink} />
@@ -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 type { Meta, StoryObj } from '@storybook/preact-vite';
@@ -265,7 +265,7 @@ export const IconOnly: Story = {
265
265
  play: async ({ canvasElement }) => {
266
266
  const canvas = within(canvasElement);
267
267
  const searchIcon = document.querySelector(
268
- 'g[data-name="Search icon"]'
268
+ 'g[data-name="Search icon"]',
269
269
  ) as HTMLElement;
270
270
  await expect(await canvas.findByRole('button')).toBeVisible();
271
271
  await expect(searchIcon).toBeVisible();
@@ -294,7 +294,7 @@ export const TextAndIcon: Story = {
294
294
  play: async ({ canvasElement }) => {
295
295
  const canvas = within(canvasElement);
296
296
  const searchIcon = document.querySelector(
297
- 'g[data-name="Search icon"]'
297
+ 'g[data-name="Search icon"]',
298
298
  ) as HTMLElement;
299
299
  await expect(await canvas.findByRole('button')).toBeVisible();
300
300
  await expect(searchIcon).toBeVisible();
@@ -351,7 +351,7 @@ export const Active: Story = {
351
351
  play: async ({ canvasElement }) => {
352
352
  const canvas = within(canvasElement);
353
353
  const searchIcon = document.querySelector(
354
- '[data-name="Search icon filled"]'
354
+ '[data-name="Search icon filled"]',
355
355
  ) as HTMLElement;
356
356
  await expect(await canvas.findByRole('button')).toBeVisible();
357
357
  await expect(canvas.getByText('Active')).toBeVisible();
@@ -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 { ComponentChildren, FunctionComponent, VNode } from 'preact';
@@ -12,11 +12,10 @@ import { HTMLAttributes } from 'preact/compat';
12
12
  import { VComponent, classes } from '@adobe-commerce/elsie/lib';
13
13
  import '@adobe-commerce/elsie/components/Button/Button.css';
14
14
 
15
- export interface ButtonProps
16
- extends Omit<
17
- HTMLAttributes<HTMLButtonElement | HTMLAnchorElement>,
18
- 'size' | 'icon'
19
- > {
15
+ export interface ButtonProps extends Omit<
16
+ HTMLAttributes<HTMLButtonElement | HTMLAnchorElement>,
17
+ 'size' | 'icon'
18
+ > {
20
19
  variant?: 'primary' | 'secondary' | 'tertiary';
21
20
  size?: 'medium' | 'large';
22
21
  children?: ComponentChildren;
@@ -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/components/Button/Button';
@@ -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
  // https://storybook.js.org/docs/7.0/preact/writing-stories/introduction
@@ -28,7 +28,7 @@ const meta: Meta<CardProps> = {
28
28
  description: 'The content of the Card.',
29
29
  control: false,
30
30
  type: { name: 'other', value: 'VNode[]' },
31
- }
31
+ },
32
32
  },
33
33
  };
34
34
 
@@ -61,8 +61,8 @@ export const Primary: Story = {
61
61
  await expect(await canvas.getByText('Title')).toBeVisible();
62
62
  await expect(
63
63
  await canvas.getByText(
64
- 'This is a short description of the item and should be kept to two or three lines as maximum.'
65
- )
64
+ 'This is a short description of the item and should be kept to two or three lines as maximum.',
65
+ ),
66
66
  ).toBeVisible();
67
67
  },
68
68
  };
@@ -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 { ComponentChildren, FunctionComponent } from 'preact';
@@ -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/components/Card/Card';
@@ -469,48 +469,48 @@ export const CartItem: Story = {
469
469
  },
470
470
  play: async () => {
471
471
  const canvasElement = document.querySelector(
472
- '#storybook-root'
472
+ '#storybook-root',
473
473
  ) as HTMLElement;
474
474
  const canvas = within(canvasElement);
475
475
 
476
476
  const itemImage = document.querySelector(
477
- '.dropin-cart-item__image'
477
+ '.dropin-cart-item__image',
478
478
  ) as HTMLElement;
479
479
  expect(itemImage).toBeVisible();
480
480
  const itemTitle = document.querySelector(
481
- '.dropin-cart-item__title'
481
+ '.dropin-cart-item__title',
482
482
  ) as HTMLElement;
483
483
  expect(itemTitle).toBeVisible();
484
484
  const itemSku = document.querySelector(
485
- '.dropin-cart-item__sku'
485
+ '.dropin-cart-item__sku',
486
486
  ) as HTMLElement;
487
487
  expect(itemSku).toBeVisible();
488
488
  const itemConfigurations = document.querySelector(
489
- '.dropin-cart-item__configurations'
489
+ '.dropin-cart-item__configurations',
490
490
  ) as HTMLElement;
491
491
  expect(itemConfigurations).toBeVisible();
492
492
  const itemPrice = document.querySelector(
493
- '.dropin-cart-item__price'
493
+ '.dropin-cart-item__price',
494
494
  ) as HTMLElement;
495
495
  expect(itemPrice).toBeVisible();
496
496
  const quantityStepper = document.querySelector(
497
- '.dropin-cart-item__quantity'
497
+ '.dropin-cart-item__quantity',
498
498
  ) as HTMLElement;
499
499
  expect(quantityStepper).toBeVisible();
500
500
  const itemTotal = document.querySelector(
501
- '.dropin-cart-item__total'
501
+ '.dropin-cart-item__total',
502
502
  ) as HTMLElement;
503
503
  expect(itemTotal).toBeVisible();
504
504
  const actions = document.querySelector(
505
- '.dropin-cart-item__buttons'
505
+ '.dropin-cart-item__buttons',
506
506
  ) as HTMLElement;
507
507
  expect(actions).toBeVisible();
508
508
 
509
509
  const increaseButton = document.querySelector(
510
- 'button[aria-label="Increase Quantity"]'
510
+ 'button[aria-label="Increase Quantity"]',
511
511
  ) as HTMLElement;
512
512
  const decreaseButton = document.querySelector(
513
- 'button[aria-label="Decrease Quantity"]'
513
+ 'button[aria-label="Decrease Quantity"]',
514
514
  ) as HTMLElement;
515
515
 
516
516
  // Without this wait test failing intermittently as click event is triggering before even element fully loaded
@@ -665,7 +665,7 @@ export const WithPromotionalBadge: Story = {
665
665
  play: async ({ canvasElement }) => {
666
666
  // Verify row total footer is rendered below the total
667
667
  const rowTotalFooter = canvasElement.querySelector(
668
- '.dropin-cart-item__row-total-footer'
668
+ '.dropin-cart-item__row-total-footer',
669
669
  ) as HTMLElement;
670
670
  expect(rowTotalFooter).toBeTruthy();
671
671
  expect(rowTotalFooter?.textContent).toContain('Super offer');
@@ -24,8 +24,10 @@ import { Trash } from '@adobe-commerce/elsie/icons';
24
24
 
25
25
  import '@adobe-commerce/elsie/components/CartItem/CartItem.css';
26
26
 
27
- export interface CartItemProps
28
- extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'loading'> {
27
+ export interface CartItemProps extends Omit<
28
+ HTMLAttributes<HTMLDivElement>,
29
+ 'title' | 'loading'
30
+ > {
29
31
  ariaLabel?: string;
30
32
  image?: VNode;
31
33
  title?: VNode;
@@ -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 } from 'preact';