@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.
- package/.elsie.js +3 -3
- package/CHANGELOG.md +385 -112
- package/LICENSE.md +257 -157
- package/README.md +4 -2
- package/__mocks__/svg.js +3 -3
- package/bin/builders/build/index.js +2 -1
- package/bin/builders/changeset/index.js +1 -1
- package/bin/builders/concurrently/index.js +1 -1
- package/bin/builders/generate/api/index.js +7 -7
- package/bin/builders/generate/component/index.js +8 -8
- package/bin/builders/generate/config/index.js +5 -5
- package/bin/builders/generate/config/templates/elsie.js +1 -1
- package/bin/builders/generate/container/index.js +7 -7
- package/bin/builders/generate/index.js +36 -36
- package/bin/builders/gql/index.js +28 -28
- package/bin/builders/gql/validate.js +116 -105
- package/bin/builders/lint/index.js +1 -1
- package/bin/builders/serve/index.js +1 -1
- package/bin/builders/storybook/index.js +9 -1
- package/bin/builders/types/index.js +1 -2
- package/bin/builders/types/validate-tsconfig.js +5 -5
- package/bin/index.js +12 -6
- package/bin/lib/cli.js +9 -8
- package/bin/lib/resolve-bin.js +9 -0
- package/bin/lib/validate-typeof.js +3 -3
- package/bin/lib/write-file.js +3 -3
- package/bin/lib/write-parent-index.js +4 -4
- package/config/eslint.mjs +2 -1
- package/config/jest.mjs +7 -2
- package/config/plugins/dts-normalize-relative-replacer.cjs +1 -1
- package/config/plugins/dts.mjs +4 -3
- package/config/prettier.json +25 -3
- package/config/setEnvVars.mjs +2 -2
- package/config/storybook/addon.js +5 -5
- package/config/storybook/components/FileTree/FileTree.jsx +4 -4
- package/config/storybook/components/FileTree/index.js +4 -4
- package/config/storybook/components/Flex/Flex.jsx +3 -3
- package/config/storybook/components/Flex/index.js +3 -3
- package/config/storybook/components/OptionsTable/OptionsTable.jsx +3 -3
- package/config/storybook/components/OptionsTable/index.js +4 -4
- package/config/storybook/components/Panel/Panel.tsx +7 -7
- package/config/storybook/components/Panel/index.ts +3 -3
- package/config/storybook/components/Screenshot/Screenshot.jsx +3 -3
- package/config/storybook/components/Screenshot/index.js +4 -4
- package/config/storybook/components/Steps/Steps.jsx +3 -3
- package/config/storybook/components/Steps/index.js +4 -4
- package/config/storybook/components/StoryWrapper/StoryWrapper.jsx +3 -3
- package/config/storybook/components/StoryWrapper/index.js +3 -3
- package/config/storybook/components/Summary/Summary.jsx +3 -3
- package/config/storybook/components/Summary/index.js +3 -3
- package/config/storybook/components/Variants/Variants.jsx +11 -7
- package/config/storybook/components/Variants/index.js +3 -3
- package/config/storybook/manager.js +3 -3
- package/config/storybook/preview.jsx +3 -3
- package/config/storybook/theming/fonts.css +12 -4
- package/config/storybook/theming/preview.css +3 -1
- package/config/storybook/theming/theme.js +3 -3
- package/config/vite.mjs +53 -26
- package/package.json +36 -34
- package/src/components/Accordion/Accordion.css +1 -1
- package/src/components/Accordion/Accordion.stories.tsx +18 -18
- package/src/components/Accordion/Accordion.tsx +12 -8
- package/src/components/Accordion/index.ts +3 -3
- package/src/components/ActionButton/ActionButton.stories.tsx +8 -8
- package/src/components/ActionButton/ActionButton.tsx +7 -5
- package/src/components/ActionButton/index.ts +3 -3
- package/src/components/ActionButtonGroup/ActionButtonGroup.stories.tsx +3 -3
- package/src/components/ActionButtonGroup/ActionButtonGroup.tsx +2 -2
- package/src/components/ActionButtonGroup/index.ts +3 -3
- package/src/components/AlertBanner/AlertBanner.stories.tsx +6 -6
- package/src/components/AlertBanner/AlertBanner.tsx +12 -10
- package/src/components/AlertBanner/index.ts +3 -3
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +14 -14
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +3 -3
- package/src/components/Breadcrumbs/index.ts +3 -3
- package/src/components/Button/Button.mdx +24 -11
- package/src/components/Button/Button.stories.tsx +6 -6
- package/src/components/Button/Button.tsx +7 -8
- package/src/components/Button/index.ts +3 -3
- package/src/components/Card/Card.stories.tsx +6 -6
- package/src/components/Card/Card.tsx +3 -3
- package/src/components/Card/index.ts +3 -3
- package/src/components/CartItem/CartItem.stories.tsx +12 -12
- package/src/components/CartItem/CartItem.tsx +4 -2
- package/src/components/CartItem/CartItemSkeleton.tsx +3 -3
- package/src/components/CartItem/index.ts +3 -3
- package/src/components/CartList/CartList.tsx +3 -3
- package/src/components/CartList/index.ts +3 -3
- package/src/components/Checkbox/Checkbox.stories.tsx +17 -14
- package/src/components/Checkbox/Checkbox.tsx +8 -6
- package/src/components/Checkbox/index.ts +3 -3
- package/src/components/ColorSwatch/ColorSwatch.css +8 -4
- package/src/components/ColorSwatch/ColorSwatch.stories.tsx +6 -6
- package/src/components/ColorSwatch/ColorSwatch.tsx +8 -6
- package/src/components/ColorSwatch/index.ts +3 -3
- package/src/components/ContentGrid/ContentGrid.css +15 -15
- package/src/components/ContentGrid/ContentGrid.stories.tsx +4 -4
- package/src/components/ContentGrid/ContentGrid.tsx +3 -3
- package/src/components/ContentGrid/index.ts +3 -3
- package/src/components/Divider/Divider.stories.tsx +7 -4
- package/src/components/Divider/Divider.tsx +3 -3
- package/src/components/Divider/index.ts +4 -4
- package/src/components/Field/Field.stories.tsx +7 -7
- package/src/components/Field/Field.tsx +4 -2
- package/src/components/Field/index.ts +3 -3
- package/src/components/Header/Header.stories.tsx +9 -10
- package/src/components/Header/Header.tsx +11 -7
- package/src/components/Header/index.ts +3 -3
- package/src/components/Icon/Icon.stories.helpers.jsx +4 -4
- package/src/components/Icon/Icon.stories.tsx +74 -60
- package/src/components/Icon/Icon.tsx +77 -44
- package/src/components/Icon/index.ts +3 -3
- package/src/components/IllustratedMessage/IllustratedMessage.stories.tsx +8 -8
- package/src/components/IllustratedMessage/IllustratedMessage.tsx +7 -5
- package/src/components/IllustratedMessage/index.ts +3 -3
- package/src/components/Image/Image.stories.tsx +3 -3
- package/src/components/Image/Image.tsx +4 -4
- package/src/components/Image/index.ts +3 -3
- package/src/components/ImageSwatch/ImageSwatch.css +8 -4
- package/src/components/ImageSwatch/ImageSwatch.stories.tsx +10 -10
- package/src/components/ImageSwatch/ImageSwatch.tsx +25 -23
- package/src/components/ImageSwatch/index.ts +3 -3
- package/src/components/InLineAlert/InLineAlert.stories.tsx +12 -7
- package/src/components/InLineAlert/InLineAlert.tsx +4 -2
- package/src/components/InLineAlert/index.ts +3 -3
- package/src/components/Incrementer/Incrementer.stories.tsx +9 -9
- package/src/components/Incrementer/Incrementer.tsx +75 -37
- package/src/components/Incrementer/index.ts +3 -3
- package/src/components/Input/Input.css +4 -1
- package/src/components/Input/Input.stories.tsx +5 -5
- package/src/components/Input/Input.tsx +5 -3
- package/src/components/Input/index.ts +3 -3
- package/src/components/InputDate/InputDate.tsx +3 -3
- package/src/components/InputDate/index.ts +3 -3
- package/src/components/InputFile/InputFile.css +16 -16
- package/src/components/InputFile/InputFile.stories.tsx +21 -16
- package/src/components/InputFile/InputFile.tsx +8 -6
- package/src/components/InputFile/index.ts +5 -5
- package/src/components/InputPassword/InputPassword.stories.tsx +4 -4
- package/src/components/InputPassword/InputPassword.tsx +5 -4
- package/src/components/InputPassword/PasswordStatusIndicator/PasswordStatusIndicator.tsx +1 -1
- package/src/components/InputPassword/PasswordStatusIndicator/index.ts +3 -3
- package/src/components/InputPassword/index.ts +3 -3
- package/src/components/Modal/Modal.stories.tsx +27 -16
- package/src/components/Modal/Modal.tsx +10 -11
- package/src/components/Modal/index.ts +3 -3
- package/src/components/MultiSelect/MultiSelect.stories.tsx +15 -15
- package/src/components/MultiSelect/MultiSelect.tsx +15 -15
- package/src/components/Pagination/Pagination.css +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +0 -1
- package/src/components/Pagination/Pagination.tsx +17 -12
- package/src/components/Pagination/PaginationButton.tsx +2 -3
- package/src/components/Pagination/index.ts +3 -3
- package/src/components/Picker/Picker.css +3 -1
- package/src/components/Picker/Picker.stories.tsx +1 -1
- package/src/components/Picker/Picker.tsx +8 -6
- package/src/components/Picker/index.ts +3 -3
- package/src/components/Portal/Portal.stories.tsx +50 -44
- package/src/components/Portal/Portal.tsx +4 -4
- package/src/components/Price/Price.stories.tsx +3 -3
- package/src/components/Price/Price.tsx +4 -2
- package/src/components/Price/index.ts +3 -3
- package/src/components/PriceRange/PriceRange.stories.tsx +3 -3
- package/src/components/PriceRange/PriceRange.tsx +8 -6
- package/src/components/PriceRange/index.ts +3 -3
- package/src/components/ProductItemCard/ProductItemCard.tsx +4 -2
- package/src/components/ProductItemCard/ProductItemCardSkeleton.tsx +16 -16
- package/src/components/ProductItemCard/index.ts +4 -4
- package/src/components/ProgressSpinner/ProgressSpinner.stories.tsx +8 -8
- package/src/components/ProgressSpinner/ProgressSpinner.tsx +7 -5
- package/src/components/ProgressSpinner/index.ts +3 -3
- package/src/components/RadioButton/RadioButton.stories.tsx +1 -1
- package/src/components/RadioButton/RadioButton.tsx +4 -2
- package/src/components/Skeleton/Skeleton.stories.tsx +4 -4
- package/src/components/Skeleton/Skeleton.tsx +11 -7
- package/src/components/Skeleton/index.ts +3 -3
- package/src/components/Table/Table.css +106 -99
- package/src/components/Table/Table.stories.tsx +404 -227
- package/src/components/Table/Table.tsx +11 -7
- package/src/components/Table/index.ts +4 -4
- package/src/components/Tag/Tag.stories.tsx +6 -6
- package/src/components/Tag/Tag.tsx +7 -5
- package/src/components/Tag/index.ts +3 -3
- package/src/components/TextArea/TextArea.css +3 -1
- package/src/components/TextArea/TextArea.stories.tsx +9 -6
- package/src/components/TextArea/TextArea.tsx +3 -3
- package/src/components/TextArea/index.ts +3 -3
- package/src/components/TextSwatch/TextSwatch.css +4 -2
- package/src/components/TextSwatch/TextSwatch.stories.tsx +8 -8
- package/src/components/TextSwatch/TextSwatch.tsx +12 -7
- package/src/components/TextSwatch/index.ts +3 -3
- package/src/components/ToggleButton/ToggleButton.css +6 -2
- package/src/components/ToggleButton/ToggleButton.stories.tsx +10 -6
- package/src/components/ToggleButton/ToggleButton.tsx +8 -3
- package/src/components/ToggleButton/index.ts +3 -3
- package/src/components/UIProvider/UIProvider.css +3 -2
- package/src/components/UIProvider/UIProvider.tsx +11 -7
- package/src/components/UIProvider/debugger.css +5 -6
- package/src/components/UIProvider/index.ts +3 -3
- package/src/docs/API/event-bus.mdx +64 -37
- package/src/docs/API/graphql.mdx +69 -36
- package/src/docs/API/initializer.mdx +58 -35
- package/src/docs/API/render.mdx +45 -32
- package/src/docs/Design/colors.mdx +10 -12
- package/src/docs/Design/grid.mdx +41 -14
- package/src/docs/Design/overview.mdx +20 -4
- package/src/docs/Design/shapes.mdx +8 -7
- package/src/docs/Design/spacing.mdx +3 -1
- package/src/docs/Design/typography.mdx +3 -2
- package/src/docs/Utilities/VComponent.mdx +27 -10
- package/src/docs/Utilities/classList.mdx +7 -5
- package/src/docs/Utilities/debounce.mdx +6 -7
- package/src/docs/Utilities/getCookie.mdx +1 -2
- package/src/docs/Utilities/getFormErrors.mdx +1 -2
- package/src/docs/Utilities/getFormValues.mdx +1 -2
- package/src/docs/Utilities/getPathValue.mdx +2 -4
- package/src/docs/Utilities/links.mdx +16 -7
- package/src/docs/cli-usage.mdx +8 -3
- package/src/docs/components/overview.mdx +14 -4
- package/src/docs/quick-start.mdx +69 -22
- package/src/docs/slots.mdx +74 -37
- package/src/docs/welcome.mdx +13 -4
- package/src/i18n/index.ts +3 -3
- package/src/lib/aem/assets.ts +9 -9
- package/src/lib/aem/configs.ts +16 -8
- package/src/lib/classes.ts +4 -4
- package/src/lib/config.ts +3 -3
- package/src/lib/debounce.ts +3 -3
- package/src/lib/deepmerge.ts +6 -13
- package/src/lib/deviceUtils.ts +3 -3
- package/src/lib/form-values.ts +3 -3
- package/src/lib/get-price-formatter.ts +8 -3
- package/src/lib/i18n.ts +3 -3
- package/src/lib/image-params-keymap.ts +4 -5
- package/src/lib/initializer.ts +11 -12
- package/src/lib/is-number.ts +3 -3
- package/src/lib/locale-config.ts +4 -4
- package/src/lib/render.tsx +14 -8
- package/src/lib/resolve-image.ts +19 -16
- package/src/lib/signals.ts +4 -4
- package/src/lib/slot.tsx +34 -27
- package/src/lib/tests.tsx +6 -8
- package/src/lib/types.ts +3 -3
- package/src/lib/vcomponent.tsx +3 -3
- package/src/shims/importmap.js +3107 -20
- package/static/assets/images/index.ts +3 -3
- package/storybook-stories.js +3 -3
- package/tests/__mocks__/browserMocks.ts +3 -3
- 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
|
export * from '@adobe-commerce/elsie/config/storybook/components/Variants/Variants';
|
|
@@ -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 { addons } from 'storybook/manager-api';
|
|
@@ -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 { UIProvider } from '../../src/components';
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
/* Light */
|
|
11
11
|
@font-face {
|
|
12
12
|
font-family: 'adobe-clean';
|
|
13
|
-
src:
|
|
13
|
+
src:
|
|
14
|
+
local('Adobe Clean Light'),
|
|
15
|
+
local('AdobeClean-Light'),
|
|
14
16
|
url('https://use.typekit.net/af/40207f/0000000000000000000176ff/27/l?primer=7cdcb44be4a7db8877ffa5c0007b8dd865b3bbc383831fe2ea177f62257a9191&fvd=n3&v=3')
|
|
15
17
|
format('woff2'),
|
|
16
18
|
url('https://use.typekit.net/af/40207f/0000000000000000000176ff/27/d?primer=7cdcb44be4a7db8877ffa5c0007b8dd865b3bbc383831fe2ea177f62257a9191&fvd=n3&v=3')
|
|
@@ -25,7 +27,9 @@
|
|
|
25
27
|
/* Normal */
|
|
26
28
|
@font-face {
|
|
27
29
|
font-family: 'adobe-clean';
|
|
28
|
-
src:
|
|
30
|
+
src:
|
|
31
|
+
local('Adobe Clean'),
|
|
32
|
+
local('AdobeClean-Regular'),
|
|
29
33
|
url('https://use.typekit.net/af/cb695f/000000000000000000017701/27/l?primer=7cdcb44be4a7db8877ffa5c0007b8dd865b3bbc383831fe2ea177f62257a9191&fvd=n4&v=3')
|
|
30
34
|
format('woff2'),
|
|
31
35
|
url('https://use.typekit.net/af/cb695f/000000000000000000017701/27/d?primer=7cdcb44be4a7db8877ffa5c0007b8dd865b3bbc383831fe2ea177f62257a9191&fvd=n4&v=3')
|
|
@@ -40,7 +44,9 @@
|
|
|
40
44
|
/* Bold */
|
|
41
45
|
@font-face {
|
|
42
46
|
font-family: 'adobe-clean';
|
|
43
|
-
src:
|
|
47
|
+
src:
|
|
48
|
+
local('Adobe Clean Bold'),
|
|
49
|
+
local('AdobeClean-Bold'),
|
|
44
50
|
url('https://use.typekit.net/af/eaf09c/000000000000000000017703/27/l?primer=7cdcb44be4a7db8877ffa5c0007b8dd865b3bbc383831fe2ea177f62257a9191&fvd=n7&v=3')
|
|
45
51
|
format('woff2'),
|
|
46
52
|
url('https://use.typekit.net/af/eaf09c/000000000000000000017703/27/d?primer=7cdcb44be4a7db8877ffa5c0007b8dd865b3bbc383831fe2ea177f62257a9191&fvd=n7&v=3')
|
|
@@ -55,7 +61,9 @@
|
|
|
55
61
|
/* Italic */
|
|
56
62
|
@font-face {
|
|
57
63
|
font-family: 'adobe-clean';
|
|
58
|
-
src:
|
|
64
|
+
src:
|
|
65
|
+
local('Adobe Clean Italic'),
|
|
66
|
+
local('AdobeClean-It'),
|
|
59
67
|
url('https://use.typekit.net/af/74ffb1/000000000000000000017702/27/l?primer=7cdcb44be4a7db8877ffa5c0007b8dd865b3bbc383831fe2ea177f62257a9191&fvd=i4&v=3')
|
|
60
68
|
format('woff2'),
|
|
61
69
|
url('https://use.typekit.net/af/74ffb1/000000000000000000017702/27/d?primer=7cdcb44be4a7db8877ffa5c0007b8dd865b3bbc383831fe2ea177f62257a9191&fvd=i4&v=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
|
import { create } from 'storybook/theming';
|
package/config/vite.mjs
CHANGED
|
@@ -31,10 +31,14 @@ const env = loadEnv('', process.cwd());
|
|
|
31
31
|
// Load Elsie Config — prefer .elsie.cjs (always CJS regardless of package "type")
|
|
32
32
|
const toFileUrl = (p) =>
|
|
33
33
|
p.startsWith('file://') ? p : `file://${p.replace(/\\/g, '/')}`;
|
|
34
|
-
const elsieConfigPath = fs.existsSync(
|
|
34
|
+
const elsieConfigPath = fs.existsSync(
|
|
35
|
+
path.resolve(process.cwd(), './.elsie.cjs'),
|
|
36
|
+
)
|
|
35
37
|
? path.resolve(process.cwd(), './.elsie.cjs')
|
|
36
38
|
: path.resolve(process.cwd(), './.elsie.js');
|
|
37
|
-
const elsieConfig = await import(toFileUrl(elsieConfigPath)).then(
|
|
39
|
+
const elsieConfig = await import(toFileUrl(elsieConfigPath)).then(
|
|
40
|
+
(m) => m.default,
|
|
41
|
+
);
|
|
38
42
|
|
|
39
43
|
// Read package.json using createRequire (compatible with Node 20 and 22)
|
|
40
44
|
const require = createRequire(import.meta.url);
|
|
@@ -54,12 +58,12 @@ const paths = {
|
|
|
54
58
|
? path.resolve(
|
|
55
59
|
process.cwd(),
|
|
56
60
|
elsieConfig.api.root,
|
|
57
|
-
elsieConfig.api.fragments
|
|
61
|
+
elsieConfig.api.fragments,
|
|
58
62
|
)
|
|
59
63
|
: undefined,
|
|
60
64
|
|
|
61
65
|
components: elsieConfig.components?.map((component) =>
|
|
62
|
-
path.resolve(process.cwd(), component.root)
|
|
66
|
+
path.resolve(process.cwd(), component.root),
|
|
63
67
|
),
|
|
64
68
|
};
|
|
65
69
|
|
|
@@ -76,7 +80,7 @@ const input = {
|
|
|
76
80
|
.sync(path.resolve(paths.containers, '**/*/index.ts'))
|
|
77
81
|
.reduce((entries, entry) => {
|
|
78
82
|
const containerRegEx = new RegExp(
|
|
79
|
-
`${paths.containers}/(.*)/index.ts
|
|
83
|
+
`${paths.containers}/(.*)/index.ts`,
|
|
80
84
|
);
|
|
81
85
|
const key = RegExp(containerRegEx).exec(entry)[1];
|
|
82
86
|
|
|
@@ -114,7 +118,9 @@ function isReachableFrom(targetPath, id, getModuleInfo, visited = new Set()) {
|
|
|
114
118
|
visited.add(id);
|
|
115
119
|
const info = getModuleInfo(id);
|
|
116
120
|
return info?.importers?.some(
|
|
117
|
-
(imp) =>
|
|
121
|
+
(imp) =>
|
|
122
|
+
imp === targetPath ||
|
|
123
|
+
isReachableFrom(targetPath, imp, getModuleInfo, visited),
|
|
118
124
|
);
|
|
119
125
|
}
|
|
120
126
|
|
|
@@ -151,7 +157,10 @@ function fragmentImportRedirectPlugin(paths, elsieConfig) {
|
|
|
151
157
|
// values without re-reading elsieConfig and without unsafe property access
|
|
152
158
|
// inside hook callbacks (where elsieConfig.api could be undefined).
|
|
153
159
|
const apiAliasRoot = elsieConfig.api?.importAliasRoot;
|
|
154
|
-
const apiRoot = path.resolve(
|
|
160
|
+
const apiRoot = path.resolve(
|
|
161
|
+
process.cwd(),
|
|
162
|
+
elsieConfig.api?.root ?? 'src/api',
|
|
163
|
+
);
|
|
155
164
|
// Alias specifier for the barrel itself, e.g. '@/cart/api/fragments'
|
|
156
165
|
const barrelAlias = apiAliasRoot
|
|
157
166
|
? `${apiAliasRoot}/${path.basename(paths.fragments, path.extname(paths.fragments))}`
|
|
@@ -178,7 +187,10 @@ function fragmentImportRedirectPlugin(paths, elsieConfig) {
|
|
|
178
187
|
// Resolve alias-prefixed specifiers (e.g. '@/cart/api/graphql/CartFragment')
|
|
179
188
|
// using the dropin's importAliasRoot config before probing the filesystem.
|
|
180
189
|
if (apiAliasRoot && specifier.startsWith(`${apiAliasRoot}/`)) {
|
|
181
|
-
specifier = path.join(
|
|
190
|
+
specifier = path.join(
|
|
191
|
+
apiRoot,
|
|
192
|
+
specifier.slice(apiAliasRoot.length + 1),
|
|
193
|
+
);
|
|
182
194
|
} else if (specifier.startsWith('.')) {
|
|
183
195
|
specifier = path.resolve(barrelDir, specifier);
|
|
184
196
|
} else {
|
|
@@ -200,7 +212,8 @@ function fragmentImportRedirectPlugin(paths, elsieConfig) {
|
|
|
200
212
|
if (!importer || fragmentSourceFiles.size === 0) return null;
|
|
201
213
|
// Allow the barrel to import fragment files (its own re-exports) and
|
|
202
214
|
// allow fragment files to import each other (shared helper fragments).
|
|
203
|
-
if (importer === paths.fragments || fragmentSourceFiles.has(importer))
|
|
215
|
+
if (importer === paths.fragments || fragmentSourceFiles.has(importer))
|
|
216
|
+
return null;
|
|
204
217
|
|
|
205
218
|
// Delegate to subsequent plugins (including tsconfigPaths) so alias
|
|
206
219
|
// specifiers are fully resolved to an absolute path before we check.
|
|
@@ -209,7 +222,8 @@ function fragmentImportRedirectPlugin(paths, elsieConfig) {
|
|
|
209
222
|
if (!resolved || !fragmentSourceFiles.has(resolved.id)) return null;
|
|
210
223
|
|
|
211
224
|
// Track the violation for the buildEnd warning.
|
|
212
|
-
if (!fragmentViolations.has(resolved.id))
|
|
225
|
+
if (!fragmentViolations.has(resolved.id))
|
|
226
|
+
fragmentViolations.set(resolved.id, []);
|
|
213
227
|
fragmentViolations.get(resolved.id).push(importer);
|
|
214
228
|
|
|
215
229
|
// Redirect to the barrel. Rollup treats the barrel as the resolved module,
|
|
@@ -221,15 +235,21 @@ function fragmentImportRedirectPlugin(paths, elsieConfig) {
|
|
|
221
235
|
for (const [fragmentFile, importers] of fragmentViolations) {
|
|
222
236
|
// Derive the wrong specifier from the actual fragment file path so the
|
|
223
237
|
// suggestion shows the real import, not a generic placeholder.
|
|
224
|
-
const relFragment = path
|
|
225
|
-
|
|
238
|
+
const relFragment = path
|
|
239
|
+
.relative(apiRoot, fragmentFile)
|
|
240
|
+
.replace(/\.(ts|tsx|js)$/, '');
|
|
241
|
+
const wrongSpecifier = apiAliasRoot
|
|
242
|
+
? `${apiAliasRoot}/${relFragment}`
|
|
243
|
+
: relFragment;
|
|
226
244
|
|
|
227
245
|
this.warn(
|
|
228
246
|
`\n"${path.relative(process.cwd(), fragmentFile)}" belongs to the fragments barrel ` +
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
247
|
+
`but was directly imported by:\n${importers
|
|
248
|
+
.map((imp) => ` - ${path.relative(process.cwd(), imp)}`)
|
|
249
|
+
.join(
|
|
250
|
+
'\n',
|
|
251
|
+
)}\n\nThe import was automatically redirected through the fragments barrel. ` +
|
|
252
|
+
`\nUpdate the import in source to silence this warning: '${wrongSpecifier}' → '${barrelAlias}'\n`,
|
|
233
253
|
);
|
|
234
254
|
}
|
|
235
255
|
},
|
|
@@ -267,7 +287,7 @@ function rewriteSourcemapSourcesPlugin(packageJSON) {
|
|
|
267
287
|
// the package name so the path is stable and globally unique.
|
|
268
288
|
return input.replace(
|
|
269
289
|
/(?:\.\.?\/)+src\//,
|
|
270
|
-
`/${packageJSON.name}/src
|
|
290
|
+
`/${packageJSON.name}/src/`,
|
|
271
291
|
);
|
|
272
292
|
});
|
|
273
293
|
|
|
@@ -309,7 +329,7 @@ function generateDistPackageJsonPlugin(packageJSON) {
|
|
|
309
329
|
license: packageJSON.license,
|
|
310
330
|
},
|
|
311
331
|
null,
|
|
312
|
-
2
|
|
332
|
+
2,
|
|
313
333
|
),
|
|
314
334
|
});
|
|
315
335
|
|
|
@@ -372,21 +392,26 @@ export default {
|
|
|
372
392
|
chunkFileNames: 'chunks/[name].js',
|
|
373
393
|
manualChunks: (id, { getModuleInfo }) => {
|
|
374
394
|
// Fragments barrel entry does not accept chunking
|
|
375
|
-
if (paths.fragments && id.includes(paths.fragments))
|
|
395
|
+
if (paths.fragments && id.includes(paths.fragments))
|
|
396
|
+
return 'no-chunk';
|
|
376
397
|
|
|
377
398
|
// API functions → chunks/api.js
|
|
378
399
|
// All modules under paths.api go to the api chunk, except those imported
|
|
379
400
|
// by the fragments barrel — those must stay in the fragments output so the
|
|
380
401
|
// boilerplate GraphQL override mechanism can replace them independently.
|
|
381
402
|
if (paths.api && id.includes(paths.api)) {
|
|
382
|
-
if (
|
|
403
|
+
if (
|
|
404
|
+
paths.fragments &&
|
|
405
|
+
isReachableFrom(paths.fragments, id, getModuleInfo)
|
|
406
|
+
) {
|
|
383
407
|
return undefined;
|
|
384
408
|
}
|
|
385
409
|
return 'api';
|
|
386
410
|
}
|
|
387
411
|
|
|
388
412
|
// components → chunks/components.js
|
|
389
|
-
if (paths.components?.some((component) => id.includes(component)))
|
|
413
|
+
if (paths.components?.some((component) => id.includes(component)))
|
|
414
|
+
return 'components';
|
|
390
415
|
|
|
391
416
|
return undefined;
|
|
392
417
|
},
|
|
@@ -456,7 +481,8 @@ export default {
|
|
|
456
481
|
name: 'inject-dropin-metadata',
|
|
457
482
|
transform(code, id) {
|
|
458
483
|
if (!paths.containers) return null;
|
|
459
|
-
if (!id.startsWith(paths.containers) || !id.endsWith('/index.ts'))
|
|
484
|
+
if (!id.startsWith(paths.containers) || !id.endsWith('/index.ts'))
|
|
485
|
+
return null;
|
|
460
486
|
|
|
461
487
|
const name = path.relative(paths.containers, path.dirname(id));
|
|
462
488
|
const ast = this.parse(code);
|
|
@@ -466,10 +492,11 @@ export default {
|
|
|
466
492
|
node.type !== 'ExportNamedDeclaration' ||
|
|
467
493
|
!node.source ||
|
|
468
494
|
!node.specifiers
|
|
469
|
-
)
|
|
495
|
+
)
|
|
496
|
+
continue;
|
|
470
497
|
|
|
471
498
|
const defaultSpec = node.specifiers.find(
|
|
472
|
-
(s) => s.exported.name === 'default'
|
|
499
|
+
(s) => s.exported.name === 'default',
|
|
473
500
|
);
|
|
474
501
|
if (!defaultSpec) continue;
|
|
475
502
|
|
|
@@ -515,7 +542,7 @@ export default {
|
|
|
515
542
|
|
|
516
543
|
injectCodeFunction: function injectCodeCustomRunTimeFunction(
|
|
517
544
|
cssCode,
|
|
518
|
-
options
|
|
545
|
+
options,
|
|
519
546
|
) {
|
|
520
547
|
try {
|
|
521
548
|
if (typeof document != 'undefined') {
|
|
@@ -539,7 +566,7 @@ export default {
|
|
|
539
566
|
} else {
|
|
540
567
|
// Inject in head before the first <link> or <style> tag.
|
|
541
568
|
const base = document.querySelector(
|
|
542
|
-
'link[rel="stylesheet"], style'
|
|
569
|
+
'link[rel="stylesheet"], style',
|
|
543
570
|
);
|
|
544
571
|
|
|
545
572
|
if (base) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe-commerce/elsie",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1-alpha-20260728135101",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"description": "Domain Package SDK",
|
|
6
6
|
"engines": {
|
|
@@ -12,30 +12,14 @@
|
|
|
12
12
|
"bin": {
|
|
13
13
|
"elsie": "./bin/index.js"
|
|
14
14
|
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"dev": "elsie concurrently 'yarn storybook' 'yarn serve'",
|
|
17
|
-
"storybook": "elsie storybook",
|
|
18
|
-
"serve": "elsie serve --config vite.config.mjs",
|
|
19
|
-
"lint": "elsie lint",
|
|
20
|
-
"test": "elsie test",
|
|
21
|
-
"test:ci": "jest --config jest.config.mjs --passWithNoTests --coverage",
|
|
22
|
-
"build": "yarn cleanup && yarn build:js",
|
|
23
|
-
"build:js": "elsie build --config vite.config.mjs",
|
|
24
|
-
"analyze": "yarn cleanup && ANALYZE=true yarn build:js",
|
|
25
|
-
"build-storybook": "storybook build --disable-telemetry",
|
|
26
|
-
"test-storybook": "test-storybook",
|
|
27
|
-
"test-storybook-ci": "concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"npx http-server storybook-static --port 6006 --silent\" \"elsie wait-on tcp:127.0.0.1:6006 && test-storybook\"",
|
|
28
|
-
"cleanup": "rimraf dist",
|
|
29
|
-
"prepack": "cp ../../LICENSE.md ./LICENSE.md",
|
|
30
|
-
"postpublish": "node ./scripts/publish-tools.mjs"
|
|
31
|
-
},
|
|
32
15
|
"devDependencies": {
|
|
33
16
|
"@adobe-commerce/event-bus": "~1.1.1",
|
|
34
17
|
"@adobe-commerce/fetch-graphql": "~1.3.1",
|
|
35
18
|
"@adobe-commerce/recaptcha": "1.2.1",
|
|
36
19
|
"@adobe-commerce/storefront-design": "~1.1.1",
|
|
37
20
|
"@chromatic-com/storybook": "^5",
|
|
38
|
-
"@dropins/build-tools": "~1.2.1"
|
|
21
|
+
"@dropins/build-tools": "~1.2.1",
|
|
22
|
+
"@adobe-commerce/elsie": "2.0.1-alpha-20260728135101"
|
|
39
23
|
},
|
|
40
24
|
"peerDependencies": {
|
|
41
25
|
"eslint-plugin-cypress": ">=3.0.0"
|
|
@@ -51,16 +35,16 @@
|
|
|
51
35
|
"@babel/preset-env": "^7.29.7",
|
|
52
36
|
"@babel/preset-typescript": "^7.24.7",
|
|
53
37
|
"@babel/traverse": "^7.24.0",
|
|
54
|
-
"@changesets/cli": "^2.
|
|
38
|
+
"@changesets/cli": "^2.31.1",
|
|
55
39
|
"@graphql-codegen/cli": "^5.0.0",
|
|
56
|
-
"@graphql-codegen/client-preset": "^6.0
|
|
40
|
+
"@graphql-codegen/client-preset": "^6.1.0",
|
|
57
41
|
"@graphql-codegen/typescript-operations": "^4.0.1",
|
|
58
|
-
"@preact/preset-vite": "^2.
|
|
42
|
+
"@preact/preset-vite": "^2.10.6",
|
|
59
43
|
"@preact/signals": "1.3.0",
|
|
60
|
-
"@storybook/addon-a11y": "^10.
|
|
44
|
+
"@storybook/addon-a11y": "^10.5.3",
|
|
61
45
|
"@storybook/addon-coverage": "^3.0.2",
|
|
62
|
-
"@storybook/addon-docs": "^10.
|
|
63
|
-
"@storybook/preact-vite": "^10.
|
|
46
|
+
"@storybook/addon-docs": "^10.5.3",
|
|
47
|
+
"@storybook/preact-vite": "^10.5.3",
|
|
64
48
|
"@storybook/test-runner": "^0.24.4",
|
|
65
49
|
"@testing-library/jest-dom": "^6.4.6",
|
|
66
50
|
"@testing-library/preact": "^3.2.4",
|
|
@@ -69,15 +53,15 @@
|
|
|
69
53
|
"axe-playwright": "^2.0.1",
|
|
70
54
|
"babel-jest": "^30.4.1",
|
|
71
55
|
"common-tags": "^1.8.2",
|
|
72
|
-
"concurrently": "^
|
|
56
|
+
"concurrently": "^10.0.3",
|
|
73
57
|
"core-js": "^3.24.0",
|
|
74
58
|
"deepmerge": "^4.2.2",
|
|
75
|
-
"dotenv": "^
|
|
59
|
+
"dotenv": "^17.4.2",
|
|
76
60
|
"eslint": "^9.39.5",
|
|
77
61
|
"eslint-config-preact": "^2.0.0",
|
|
78
62
|
"eslint-config-prettier": "^10.0.0",
|
|
79
63
|
"eslint-plugin-mdx": "^3.8.1",
|
|
80
|
-
"eslint-plugin-storybook": "^10.
|
|
64
|
+
"eslint-plugin-storybook": "^10.5.3",
|
|
81
65
|
"glob": "^13.0.6",
|
|
82
66
|
"globals": "^15.0.0",
|
|
83
67
|
"graphql": "^16.14.2",
|
|
@@ -86,18 +70,19 @@
|
|
|
86
70
|
"identity-obj-proxy": "^3.0.0",
|
|
87
71
|
"jest": "^30.4.2",
|
|
88
72
|
"jest-environment-jsdom": "^30.0.0",
|
|
89
|
-
"
|
|
73
|
+
"playwright": "1.60.0",
|
|
74
|
+
"preact": "~10.29.7",
|
|
90
75
|
"preact-i18n": "2.4.0-preactx",
|
|
91
76
|
"preact-render-to-string": "^5.1.4",
|
|
92
|
-
"prettier": "^
|
|
77
|
+
"prettier": "^3.8.4",
|
|
93
78
|
"react": "^18.2.0",
|
|
94
79
|
"react-dom": "^18.2.0",
|
|
95
80
|
"rimraf": "^6.1.3",
|
|
96
81
|
"rollup-plugin-visualizer": "^7.0.1",
|
|
97
|
-
"storybook": "^10.
|
|
98
|
-
"tsc-alias": "^1.
|
|
82
|
+
"storybook": "^10.5.3",
|
|
83
|
+
"tsc-alias": "^1.9.1",
|
|
99
84
|
"typescript": "^6.0.0",
|
|
100
|
-
"typescript-eslint": "^8.
|
|
85
|
+
"typescript-eslint": "^8.63.0",
|
|
101
86
|
"vite": "^5.2.10",
|
|
102
87
|
"vite-plugin-banner": "^0.8.0",
|
|
103
88
|
"vite-plugin-css-injected-by-js": "^3.5.1",
|
|
@@ -105,5 +90,22 @@
|
|
|
105
90
|
"vite-tsconfig-paths": "^4.3.2",
|
|
106
91
|
"wait-on": "^9.0.10",
|
|
107
92
|
"yargs": "^17.5.1"
|
|
93
|
+
},
|
|
94
|
+
"scripts": {
|
|
95
|
+
"dev": "pnpm run dev:all",
|
|
96
|
+
"dev:all": "elsie concurrently \"pnpm run dev:storybook\" \"pnpm run dev:serve\"",
|
|
97
|
+
"dev:storybook": "elsie storybook",
|
|
98
|
+
"dev:serve": "elsie serve --config vite.config.mjs",
|
|
99
|
+
"lint": "elsie lint",
|
|
100
|
+
"test": "elsie test",
|
|
101
|
+
"test:ci": "jest --config jest.config.mjs --passWithNoTests --coverage",
|
|
102
|
+
"test:storybook": "test-storybook",
|
|
103
|
+
"test:storybook:ci": "concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"npx http-server storybook-static --port 6006 --silent\" \"elsie wait-on tcp:127.0.0.1:6006 && test-storybook\"",
|
|
104
|
+
"build": "pnpm run build:js",
|
|
105
|
+
"build:js": "pnpm run cleanup && elsie build --config vite.config.mjs",
|
|
106
|
+
"build:storybook": "storybook build --disable-telemetry",
|
|
107
|
+
"build:storybook:ci": "storybook build --disable-telemetry --quiet",
|
|
108
|
+
"analyze": "pnpm run cleanup && ANALYZE=true pnpm run build:js",
|
|
109
|
+
"cleanup": "rimraf dist"
|
|
108
110
|
}
|
|
109
|
-
}
|
|
111
|
+
}
|
|
@@ -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
|
|
@@ -150,22 +150,22 @@ export const SingleSection: Story = {
|
|
|
150
150
|
),
|
|
151
151
|
play: async () => {
|
|
152
152
|
const canvasElement = document.querySelector(
|
|
153
|
-
'#storybook-root'
|
|
153
|
+
'#storybook-root',
|
|
154
154
|
) as HTMLElement;
|
|
155
155
|
const canvas = within(canvasElement);
|
|
156
156
|
|
|
157
157
|
const loaderIcon = document.querySelector(
|
|
158
|
-
'div[class*="dropin-accordion"]'
|
|
158
|
+
'div[class*="dropin-accordion"]',
|
|
159
159
|
) as HTMLElement;
|
|
160
160
|
await expect(loaderIcon).toBeVisible();
|
|
161
161
|
const header = document.querySelector(
|
|
162
|
-
'.dropin-accordion-section__heading'
|
|
162
|
+
'.dropin-accordion-section__heading',
|
|
163
163
|
) as HTMLElement;
|
|
164
164
|
await expect(header).toHaveTextContent('Title');
|
|
165
165
|
|
|
166
166
|
await userEvent.click(canvas.getByRole('button'));
|
|
167
167
|
const content = document.querySelector(
|
|
168
|
-
'.dropin-accordion-section__content-container'
|
|
168
|
+
'.dropin-accordion-section__content-container',
|
|
169
169
|
) as HTMLElement;
|
|
170
170
|
await expect(content).toBeVisible();
|
|
171
171
|
},
|
|
@@ -216,11 +216,11 @@ export const SingleSectionWithLeftIcon: Story = {
|
|
|
216
216
|
),
|
|
217
217
|
play: async () => {
|
|
218
218
|
const loaderIcon = document.querySelector(
|
|
219
|
-
'div[class*="dropin-accordion"]'
|
|
219
|
+
'div[class*="dropin-accordion"]',
|
|
220
220
|
) as HTMLElement;
|
|
221
221
|
await expect(loaderIcon).toBeVisible();
|
|
222
222
|
const leftHeader = document.querySelector(
|
|
223
|
-
'.dropin-accordion-section__title-container'
|
|
223
|
+
'.dropin-accordion-section__title-container',
|
|
224
224
|
) as HTMLElement;
|
|
225
225
|
await expect(leftHeader).toBeVisible();
|
|
226
226
|
await expect(leftHeader).toContainHTML('<svg');
|
|
@@ -271,11 +271,11 @@ export const SingleSectionWithOptionalText: Story = {
|
|
|
271
271
|
),
|
|
272
272
|
play: async () => {
|
|
273
273
|
const loaderIcon = document.querySelector(
|
|
274
|
-
'div[class*="dropin-accordion"]'
|
|
274
|
+
'div[class*="dropin-accordion"]',
|
|
275
275
|
) as HTMLElement;
|
|
276
276
|
await expect(loaderIcon).toBeVisible();
|
|
277
277
|
const secondaryText = document.querySelector(
|
|
278
|
-
'.dropin-accordion-section__secondary-text'
|
|
278
|
+
'.dropin-accordion-section__secondary-text',
|
|
279
279
|
) as HTMLElement;
|
|
280
280
|
await expect(secondaryText).toBeVisible();
|
|
281
281
|
await expect(secondaryText).toHaveTextContent('Optional Text');
|
|
@@ -319,11 +319,11 @@ export const SingleSectionWithPrice: Story = {
|
|
|
319
319
|
),
|
|
320
320
|
play: async () => {
|
|
321
321
|
const loaderIcon = document.querySelector(
|
|
322
|
-
'div[class*="dropin-accordion"]'
|
|
322
|
+
'div[class*="dropin-accordion"]',
|
|
323
323
|
) as HTMLElement;
|
|
324
324
|
await expect(loaderIcon).toBeVisible();
|
|
325
325
|
const secondaryText = document.querySelector(
|
|
326
|
-
'.dropin-accordion-section__secondary-text'
|
|
326
|
+
'.dropin-accordion-section__secondary-text',
|
|
327
327
|
) as HTMLElement;
|
|
328
328
|
await expect(secondaryText).toBeVisible();
|
|
329
329
|
await expect(secondaryText).toHaveTextContent('$9.99');
|
|
@@ -401,7 +401,7 @@ export const SingleSectionWithLinkAndCartItem: Story = {
|
|
|
401
401
|
),
|
|
402
402
|
play: async () => {
|
|
403
403
|
const accordionElement = document.querySelector(
|
|
404
|
-
'.dropin-accordion'
|
|
404
|
+
'.dropin-accordion',
|
|
405
405
|
) as HTMLElement;
|
|
406
406
|
const link = accordionElement.querySelector('.dropin-accordion a');
|
|
407
407
|
|
|
@@ -511,11 +511,11 @@ export const MultipleSection: Story = {
|
|
|
511
511
|
),
|
|
512
512
|
play: async () => {
|
|
513
513
|
const loaderIcon = document.querySelector(
|
|
514
|
-
'div[class*="dropin-accordion"]'
|
|
514
|
+
'div[class*="dropin-accordion"]',
|
|
515
515
|
) as HTMLElement;
|
|
516
516
|
await expect(loaderIcon).toBeVisible();
|
|
517
517
|
const section = document.querySelector(
|
|
518
|
-
'.dropin-accordion-section'
|
|
518
|
+
'.dropin-accordion-section',
|
|
519
519
|
) as HTMLElement;
|
|
520
520
|
await expect(section).toBeVisible();
|
|
521
521
|
const divider = document.querySelector('.dropin-divider') as HTMLElement;
|
|
@@ -570,11 +570,11 @@ export const SingleSection_ToggleBehavior: Story = {
|
|
|
570
570
|
),
|
|
571
571
|
play: async () => {
|
|
572
572
|
const loaderIcon = document.querySelector(
|
|
573
|
-
'div[class*="dropin-accordion"]'
|
|
573
|
+
'div[class*="dropin-accordion"]',
|
|
574
574
|
) as HTMLElement;
|
|
575
575
|
await expect(loaderIcon).toBeVisible();
|
|
576
576
|
const secondaryText = document.querySelector(
|
|
577
|
-
'.dropin-accordion-section__secondary-text'
|
|
577
|
+
'.dropin-accordion-section__secondary-text',
|
|
578
578
|
) as HTMLElement;
|
|
579
579
|
await expect(secondaryText).toBeVisible();
|
|
580
580
|
await expect(secondaryText).toHaveTextContent('$9.99');
|
|
@@ -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, VNode } from 'preact';
|
|
@@ -14,8 +14,10 @@ import { Divider, Icon, IconNode } from '@adobe-commerce/elsie/components';
|
|
|
14
14
|
import { Add, Minus } from '@adobe-commerce/elsie/icons';
|
|
15
15
|
import { useText } from '@adobe-commerce/elsie/i18n';
|
|
16
16
|
import '@adobe-commerce/elsie/components/Accordion/Accordion.css';
|
|
17
|
-
export interface AccordionSectionProps
|
|
18
|
-
|
|
17
|
+
export interface AccordionSectionProps extends Omit<
|
|
18
|
+
HTMLAttributes<HTMLDivElement>,
|
|
19
|
+
'icon'
|
|
20
|
+
> {
|
|
19
21
|
defaultOpen?: boolean;
|
|
20
22
|
actionIconPosition?: 'left' | 'right';
|
|
21
23
|
ariaLabelTitle: string;
|
|
@@ -60,7 +62,7 @@ export const AccordionSection: FunctionComponent<AccordionSectionProps> = ({
|
|
|
60
62
|
}, [defaultOpen]);
|
|
61
63
|
|
|
62
64
|
const buttonLabel = useText(
|
|
63
|
-
`Dropin.Accordion.${open ? 'close' : 'open'}.label
|
|
65
|
+
`Dropin.Accordion.${open ? 'close' : 'open'}.label`,
|
|
64
66
|
).label;
|
|
65
67
|
|
|
66
68
|
const openIcon = (
|
|
@@ -129,8 +131,10 @@ export const AccordionSection: FunctionComponent<AccordionSectionProps> = ({
|
|
|
129
131
|
);
|
|
130
132
|
};
|
|
131
133
|
|
|
132
|
-
export interface AccordionProps
|
|
133
|
-
|
|
134
|
+
export interface AccordionProps extends Omit<
|
|
135
|
+
HTMLAttributes<HTMLDivElement>,
|
|
136
|
+
'icon'
|
|
137
|
+
> {
|
|
134
138
|
actionIconPosition?: 'left' | 'right';
|
|
135
139
|
iconOpen?: IconNode;
|
|
136
140
|
iconClose?: IconNode;
|
|
@@ -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/Accordion/Accordion';
|