@adobe-commerce/elsie 1.0.0-alpha04071347
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 +21 -0
- package/.eslintrc.js +18 -0
- package/README.md +52 -0
- package/__mocks__/svg.js +11 -0
- package/bin/builders/build/index.js +20 -0
- package/bin/builders/generate/api/index.js +65 -0
- package/bin/builders/generate/api/templates/function.js +9 -0
- package/bin/builders/generate/api/templates/index.js +7 -0
- package/bin/builders/generate/api/templates/story.js +23 -0
- package/bin/builders/generate/api/templates/unit-test.js +15 -0
- package/bin/builders/generate/component/index.js +87 -0
- package/bin/builders/generate/component/templates/Component.js +43 -0
- package/bin/builders/generate/component/templates/css.js +24 -0
- package/bin/builders/generate/component/templates/index.js +8 -0
- package/bin/builders/generate/component/templates/stories.js +46 -0
- package/bin/builders/generate/component/templates/unit-test.js +19 -0
- package/bin/builders/generate/config/index.js +54 -0
- package/bin/builders/generate/config/templates/elsie.js +29 -0
- package/bin/builders/generate/container/index.js +65 -0
- package/bin/builders/generate/container/templates/Component.js +18 -0
- package/bin/builders/generate/container/templates/index.js +8 -0
- package/bin/builders/generate/container/templates/stories.js +34 -0
- package/bin/builders/generate/container/templates/unit-test.js +19 -0
- package/bin/builders/generate/index.js +283 -0
- package/bin/builders/gql/createOrClearDirectory.js +33 -0
- package/bin/builders/gql/getSchemaRef.js +25 -0
- package/bin/builders/gql/index.js +71 -0
- package/bin/builders/lint/index.js +5 -0
- package/bin/builders/serve/index.js +44 -0
- package/bin/builders/storybook/index.js +5 -0
- package/bin/builders/test/index.js +5 -0
- package/bin/index.js +26 -0
- package/bin/lib/cli.js +8 -0
- package/bin/lib/config.js +12 -0
- package/bin/lib/log-message.js +11 -0
- package/bin/lib/string.js +26 -0
- package/bin/lib/validate-typeof.js +28 -0
- package/bin/lib/write-file.js +30 -0
- package/bin/lib/write-parent-index.js +45 -0
- package/config/eslint.js +113 -0
- package/config/jest.js +90 -0
- package/config/prettier.js +16 -0
- package/config/setEnvVars.js +14 -0
- package/config/storybook/addon.js +130 -0
- package/config/storybook/components/FileTree/FileTree.jsx +192 -0
- package/config/storybook/components/FileTree/index.js +10 -0
- package/config/storybook/components/Flex/Flex.jsx +21 -0
- package/config/storybook/components/Flex/Flex.module.css +29 -0
- package/config/storybook/components/Flex/index.js +10 -0
- package/config/storybook/components/OptionsTable/OptionsTable.jsx +88 -0
- package/config/storybook/components/OptionsTable/OptionsTable.module.css +104 -0
- package/config/storybook/components/OptionsTable/index.js +10 -0
- package/config/storybook/components/Panel/Panel.module.css +56 -0
- package/config/storybook/components/Panel/Panel.tsx +46 -0
- package/config/storybook/components/Panel/index.ts +10 -0
- package/config/storybook/components/Screenshot/Screenshot.jsx +23 -0
- package/config/storybook/components/Screenshot/Screenshot.module.css +28 -0
- package/config/storybook/components/Screenshot/index.js +10 -0
- package/config/storybook/components/Steps/Steps.jsx +21 -0
- package/config/storybook/components/Steps/Steps.module.css +43 -0
- package/config/storybook/components/Steps/index.js +10 -0
- package/config/storybook/components/StoryWrapper/StoryWrapper.jsx +18 -0
- package/config/storybook/components/StoryWrapper/StoryWrapper.module.css +22 -0
- package/config/storybook/components/StoryWrapper/index.js +10 -0
- package/config/storybook/components/Summary/Summary.jsx +19 -0
- package/config/storybook/components/Summary/Summary.module.css +20 -0
- package/config/storybook/components/Summary/index.js +10 -0
- package/config/storybook/components/Variants/Variants.js +57 -0
- package/config/storybook/components/Variants/docs.css +48 -0
- package/config/storybook/components/Variants/index.js +10 -0
- package/config/storybook/components/video/index.jsx +28 -0
- package/config/storybook/manager.js +23 -0
- package/config/storybook/preview.jsx +88 -0
- package/config/storybook/theming/fonts.css +68 -0
- package/config/storybook/theming/logo.svg +19 -0
- package/config/storybook/theming/manager.css +63 -0
- package/config/storybook/theming/preview.css +93 -0
- package/config/storybook/theming/theme.js +61 -0
- package/config/tsconfig-base.json +16 -0
- package/config/tsconfig-preact.json +15 -0
- package/config/vite.mjs +306 -0
- package/package.json +113 -0
- package/post-release.sh +5 -0
- package/src/components/Accordion/Accordion.css +88 -0
- package/src/components/Accordion/Accordion.stories.tsx +582 -0
- package/src/components/Accordion/Accordion.tsx +177 -0
- package/src/components/Accordion/index.ts +11 -0
- package/src/components/ActionButton/ActionButton.css +100 -0
- package/src/components/ActionButton/ActionButton.stories.tsx +169 -0
- package/src/components/ActionButton/ActionButton.tsx +53 -0
- package/src/components/ActionButton/index.ts +10 -0
- package/src/components/ActionButtonGroup/ActionButtonGroup.css +77 -0
- package/src/components/ActionButtonGroup/ActionButtonGroup.stories.tsx +97 -0
- package/src/components/ActionButtonGroup/ActionButtonGroup.tsx +91 -0
- package/src/components/ActionButtonGroup/index.ts +10 -0
- package/src/components/AlertBanner/AlertBanner.css +144 -0
- package/src/components/AlertBanner/AlertBanner.stories.tsx +165 -0
- package/src/components/AlertBanner/AlertBanner.tsx +90 -0
- package/src/components/AlertBanner/index.ts +11 -0
- package/src/components/Breadcrumbs/Breadcrumbs.css +60 -0
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +195 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +71 -0
- package/src/components/Breadcrumbs/index.ts +11 -0
- package/src/components/Button/Button.css +213 -0
- package/src/components/Button/Button.mdx +133 -0
- package/src/components/Button/Button.stories.tsx +398 -0
- package/src/components/Button/Button.tsx +121 -0
- package/src/components/Button/index.ts +11 -0
- package/src/components/Card/Card.css +34 -0
- package/src/components/Card/Card.stories.tsx +76 -0
- package/src/components/Card/Card.tsx +34 -0
- package/src/components/Card/index.ts +10 -0
- package/src/components/CartItem/CartItem.css +509 -0
- package/src/components/CartItem/CartItem.stories.tsx +628 -0
- package/src/components/CartItem/CartItem.tsx +467 -0
- package/src/components/CartItem/CartItemSkeleton.tsx +38 -0
- package/src/components/CartItem/index.ts +12 -0
- package/src/components/CartList/CartList.css +35 -0
- package/src/components/CartList/CartList.stories.tsx +111 -0
- package/src/components/CartList/CartList.tsx +40 -0
- package/src/components/CartList/index.ts +11 -0
- package/src/components/Checkbox/Checkbox.css +255 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +290 -0
- package/src/components/Checkbox/Checkbox.tsx +138 -0
- package/src/components/Checkbox/index.ts +10 -0
- package/src/components/ColorSwatch/ColorSwatch.css +132 -0
- package/src/components/ColorSwatch/ColorSwatch.stories.tsx +274 -0
- package/src/components/ColorSwatch/ColorSwatch.tsx +127 -0
- package/src/components/ColorSwatch/index.ts +11 -0
- package/src/components/ContentGrid/ContentGrid.css +54 -0
- package/src/components/ContentGrid/ContentGrid.stories.tsx +137 -0
- package/src/components/ContentGrid/ContentGrid.tsx +57 -0
- package/src/components/ContentGrid/index.ts +11 -0
- package/src/components/Divider/Divider.css +22 -0
- package/src/components/Divider/Divider.stories.tsx +62 -0
- package/src/components/Divider/Divider.tsx +33 -0
- package/src/components/Divider/index.ts +11 -0
- package/src/components/Field/Field.css +83 -0
- package/src/components/Field/Field.stories.tsx +238 -0
- package/src/components/Field/Field.tsx +84 -0
- package/src/components/Field/index.ts +10 -0
- package/src/components/Header/Header.css +56 -0
- package/src/components/Header/Header.stories.tsx +180 -0
- package/src/components/Header/Header.tsx +81 -0
- package/src/components/Header/index.ts +11 -0
- package/src/components/Icon/Icon.css +26 -0
- package/src/components/Icon/Icon.stories.helpers.jsx +21 -0
- package/src/components/Icon/Icon.stories.tsx +98 -0
- package/src/components/Icon/Icon.tsx +112 -0
- package/src/components/Icon/index.ts +10 -0
- package/src/components/IllustratedMessage/IllustratedMessage.css +61 -0
- package/src/components/IllustratedMessage/IllustratedMessage.stories.tsx +126 -0
- package/src/components/IllustratedMessage/IllustratedMessage.tsx +78 -0
- package/src/components/IllustratedMessage/index.ts +11 -0
- package/src/components/Image/Image.css +52 -0
- package/src/components/Image/Image.stories.tsx +89 -0
- package/src/components/Image/Image.tsx +66 -0
- package/src/components/Image/index.ts +10 -0
- package/src/components/ImageSwatch/ImageSwatch.css +154 -0
- package/src/components/ImageSwatch/ImageSwatch.stories.tsx +310 -0
- package/src/components/ImageSwatch/ImageSwatch.tsx +123 -0
- package/src/components/ImageSwatch/index.ts +11 -0
- package/src/components/InLineAlert/InLineAlert.css +116 -0
- package/src/components/InLineAlert/InLineAlert.stories.tsx +326 -0
- package/src/components/InLineAlert/InLineAlert.tsx +128 -0
- package/src/components/InLineAlert/index.ts +11 -0
- package/src/components/Incrementer/Incrementer.css +165 -0
- package/src/components/Incrementer/Incrementer.stories.tsx +172 -0
- package/src/components/Incrementer/Incrementer.tsx +192 -0
- package/src/components/Incrementer/index.ts +10 -0
- package/src/components/Input/Input.css +304 -0
- package/src/components/Input/Input.stories.tsx +155 -0
- package/src/components/Input/Input.tsx +166 -0
- package/src/components/Input/index.ts +11 -0
- package/src/components/InputDate/InputDate.css +56 -0
- package/src/components/InputDate/InputDate.stories.tsx +117 -0
- package/src/components/InputDate/InputDate.tsx +120 -0
- package/src/components/InputDate/index.ts +11 -0
- package/src/components/InputPassword/InputPassword.css +31 -0
- package/src/components/InputPassword/InputPassword.stories.tsx +148 -0
- package/src/components/InputPassword/InputPassword.tsx +135 -0
- package/src/components/InputPassword/PasswordStatusIndicator/PasswordStatusIndicator.css +31 -0
- package/src/components/InputPassword/PasswordStatusIndicator/PasswordStatusIndicator.tsx +96 -0
- package/src/components/InputPassword/PasswordStatusIndicator/index.ts +11 -0
- package/src/components/InputPassword/index.ts +11 -0
- package/src/components/Modal/Modal.css +125 -0
- package/src/components/Modal/Modal.stories.tsx +250 -0
- package/src/components/Modal/Modal.tsx +157 -0
- package/src/components/Modal/index.ts +10 -0
- package/src/components/Pagination/Pagination.css +95 -0
- package/src/components/Pagination/Pagination.stories.tsx +117 -0
- package/src/components/Pagination/Pagination.tsx +149 -0
- package/src/components/Pagination/index.ts +11 -0
- package/src/components/Picker/Picker.css +220 -0
- package/src/components/Picker/Picker.stories.tsx +318 -0
- package/src/components/Picker/Picker.tsx +203 -0
- package/src/components/Picker/index.ts +10 -0
- package/src/components/Price/Price.css +57 -0
- package/src/components/Price/Price.stories.tsx +110 -0
- package/src/components/Price/Price.tsx +75 -0
- package/src/components/Price/index.ts +10 -0
- package/src/components/PriceRange/PriceRange.css +66 -0
- package/src/components/PriceRange/PriceRange.stories.tsx +240 -0
- package/src/components/PriceRange/PriceRange.tsx +248 -0
- package/src/components/PriceRange/index.ts +11 -0
- package/src/components/ProgressSpinner/ProgressSpinner.css +91 -0
- package/src/components/ProgressSpinner/ProgressSpinner.stories.tsx +300 -0
- package/src/components/ProgressSpinner/ProgressSpinner.tsx +86 -0
- package/src/components/ProgressSpinner/index.ts +11 -0
- package/src/components/RadioButton/RadioButton.css +134 -0
- package/src/components/RadioButton/RadioButton.stories.tsx +126 -0
- package/src/components/RadioButton/RadioButton.tsx +86 -0
- package/src/components/RadioButton/index.ts +11 -0
- package/src/components/Skeleton/Skeleton.css +145 -0
- package/src/components/Skeleton/Skeleton.stories.tsx +265 -0
- package/src/components/Skeleton/Skeleton.tsx +133 -0
- package/src/components/Skeleton/index.ts +10 -0
- package/src/components/Tag/Tag.css +26 -0
- package/src/components/Tag/Tag.stories.tsx +103 -0
- package/src/components/Tag/Tag.tsx +38 -0
- package/src/components/Tag/index.ts +11 -0
- package/src/components/TextArea/TextArea.css +140 -0
- package/src/components/TextArea/TextArea.stories.tsx +130 -0
- package/src/components/TextArea/TextArea.tsx +89 -0
- package/src/components/TextArea/index.ts +11 -0
- package/src/components/TextSwatch/TextSwatch.css +152 -0
- package/src/components/TextSwatch/TextSwatch.stories.tsx +277 -0
- package/src/components/TextSwatch/TextSwatch.tsx +131 -0
- package/src/components/TextSwatch/index.ts +11 -0
- package/src/components/ToggleButton/ToggleButton.css +95 -0
- package/src/components/ToggleButton/ToggleButton.stories.tsx +190 -0
- package/src/components/ToggleButton/ToggleButton.tsx +75 -0
- package/src/components/ToggleButton/index.ts +11 -0
- package/src/components/UIProvider/UIProvider.css +140 -0
- package/src/components/UIProvider/UIProvider.tsx +61 -0
- package/src/components/UIProvider/debugger.css +47 -0
- package/src/components/UIProvider/index.ts +10 -0
- package/src/components/UIProvider/normalize.css +26 -0
- package/src/components/index.ts +49 -0
- package/src/docs/API/event-bus.mdx +52 -0
- package/src/docs/API/graphql.mdx +214 -0
- package/src/docs/API/initializer.mdx +119 -0
- package/src/docs/API/render.mdx +125 -0
- package/src/docs/Design/colors.mdx +202 -0
- package/src/docs/Design/designBlocks.jsx +87 -0
- package/src/docs/Design/getTokenData.ts +28 -0
- package/src/docs/Design/grid.mdx +365 -0
- package/src/docs/Design/overview.mdx +69 -0
- package/src/docs/Design/shapes.mdx +100 -0
- package/src/docs/Design/spacing.mdx +22 -0
- package/src/docs/Design/typography.mdx +126 -0
- package/src/docs/Utilities/classList.mdx +52 -0
- package/src/docs/Utilities/debounce.mdx +49 -0
- package/src/docs/Utilities/deepmerge.mdx +12 -0
- package/src/docs/Utilities/getFormErrors.mdx +41 -0
- package/src/docs/Utilities/getFormValues.mdx +38 -0
- package/src/docs/assets/Banner.png +0 -0
- package/src/docs/assets/Colors.png +0 -0
- package/src/docs/assets/DropinBanner.png +0 -0
- package/src/docs/assets/ShapeStyles.png +0 -0
- package/src/docs/assets/Spacing.png +0 -0
- package/src/docs/assets/Typography.png +0 -0
- package/src/docs/cli-usage.mdx +181 -0
- package/src/docs/components/overview.mdx +124 -0
- package/src/docs/quick-start.mdx +245 -0
- package/src/docs/slots.mdx +211 -0
- package/src/docs/welcome.mdx +52 -0
- package/src/i18n/en_US.json +146 -0
- package/src/i18n/index.ts +26 -0
- package/src/icons/Add.svg +9 -0
- package/src/icons/AddressBook.svg +3 -0
- package/src/icons/Bulk.svg +24 -0
- package/src/icons/Burger.svg +5 -0
- package/src/icons/Card.svg +7 -0
- package/src/icons/Cart.svg +11 -0
- package/src/icons/Check.svg +8 -0
- package/src/icons/CheckWithCircle.svg +4 -0
- package/src/icons/ChevronDown.svg +3 -0
- package/src/icons/ChevronRight.svg +8 -0
- package/src/icons/ChevronUp.svg +3 -0
- package/src/icons/Close.svg +4 -0
- package/src/icons/Coupon.svg +3 -0
- package/src/icons/Date.svg +4 -0
- package/src/icons/Delivery.svg +11 -0
- package/src/icons/EmptyBox.svg +3 -0
- package/src/icons/Eye.svg +3 -0
- package/src/icons/EyeClose.svg +3 -0
- package/src/icons/Gift.svg +3 -0
- package/src/icons/GiftCard.svg +3 -0
- package/src/icons/Heart.svg +3 -0
- package/src/icons/HeartFilled.svg +3 -0
- package/src/icons/InfoFilled.svg +3 -0
- package/src/icons/Locker.svg +11 -0
- package/src/icons/Minus.svg +3 -0
- package/src/icons/Order.svg +6 -0
- package/src/icons/OrderError.svg +15 -0
- package/src/icons/OrderSuccess.svg +15 -0
- package/src/icons/PaymentError.svg +16 -0
- package/src/icons/Placeholder.svg +3 -0
- package/src/icons/PlaceholderFilled.svg +4 -0
- package/src/icons/Search.svg +9 -0
- package/src/icons/SearchFilled.svg +10 -0
- package/src/icons/Sort.svg +12 -0
- package/src/icons/Star.svg +8 -0
- package/src/icons/Trash.svg +7 -0
- package/src/icons/User.svg +5 -0
- package/src/icons/View.svg +14 -0
- package/src/icons/Wallet.svg +6 -0
- package/src/icons/Warning.svg +12 -0
- package/src/icons/WarningFilled.svg +3 -0
- package/src/icons/WarningWithCircle.svg +4 -0
- package/src/icons/index.ts +42 -0
- package/src/lib/classes.ts +34 -0
- package/src/lib/config.ts +24 -0
- package/src/lib/debounce.ts +16 -0
- package/src/lib/deepmerge.ts +45 -0
- package/src/lib/deviceUtils.ts +16 -0
- package/src/lib/form-values.ts +31 -0
- package/src/lib/i18n.ts +18 -0
- package/src/lib/image-params-keymap.ts +36 -0
- package/src/lib/index.ts +24 -0
- package/src/lib/initializer.ts +134 -0
- package/src/lib/is-number.ts +12 -0
- package/src/lib/render.tsx +138 -0
- package/src/lib/resolve-image.ts +101 -0
- package/src/lib/signals.ts +11 -0
- package/src/lib/slot.tsx +434 -0
- package/src/lib/tests.tsx +47 -0
- package/src/lib/types.ts +16 -0
- package/src/lib/vcomponent.tsx +42 -0
- package/static/assets/images/Card.png +0 -0
- package/static/assets/images/example.jpg +0 -0
- package/static/assets/images/index.ts +11 -0
- package/static/dropin.png +0 -0
- package/static/favicon.svg +14 -0
- package/storybook-stories.js +21 -0
- package/tests/__mocks__/browserMocks.ts +28 -0
- package/tests/__mocks__/fileMocks.ts +12 -0
- package/tests/__mocks__/styleMock.ts +0 -0
- package/types/icons.d.ts +18 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
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.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
10
|
+
// https://storybook.js.org/docs/7.0/preact/writing-stories/introduction
|
|
11
|
+
import type { Meta, StoryObj } from '@storybook/preact';
|
|
12
|
+
import {
|
|
13
|
+
ToggleButton as component,
|
|
14
|
+
ToggleButtonProps,
|
|
15
|
+
} from '@adobe-commerce/elsie/components/ToggleButton';
|
|
16
|
+
import { Card as CardSVG } from '@adobe-commerce/elsie/icons';
|
|
17
|
+
import { Card as CardPNG } from '@adobe-commerce/elsie/static/assets/images';
|
|
18
|
+
import { expect, within } from '@storybook/test';
|
|
19
|
+
import { Price } from '@adobe-commerce/elsie/components';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Use ToggleButtons to let users select one option from a set of mutually exclusive choices.
|
|
23
|
+
*/
|
|
24
|
+
const meta: Meta<ToggleButtonProps> = {
|
|
25
|
+
title: 'Components/ToggleButton',
|
|
26
|
+
component,
|
|
27
|
+
argTypes: {
|
|
28
|
+
icon: {
|
|
29
|
+
description: 'Icon of the Toggle button',
|
|
30
|
+
},
|
|
31
|
+
label: {
|
|
32
|
+
description: 'Label of the Toggle button',
|
|
33
|
+
required: true,
|
|
34
|
+
table: {
|
|
35
|
+
type: {
|
|
36
|
+
summary: 'string | VNode',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
control: {
|
|
40
|
+
type: 'text',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
name: {
|
|
44
|
+
description: 'Field name (used for mapping the value in a form)',
|
|
45
|
+
type: {
|
|
46
|
+
required: true,
|
|
47
|
+
name: 'string',
|
|
48
|
+
},
|
|
49
|
+
control: {
|
|
50
|
+
type: 'text',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
value: {
|
|
54
|
+
description: 'Field value',
|
|
55
|
+
type: {
|
|
56
|
+
required: true,
|
|
57
|
+
name: 'string',
|
|
58
|
+
},
|
|
59
|
+
control: {
|
|
60
|
+
type: 'text',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
selected: {
|
|
64
|
+
description: 'Whether or not the Toggle button is selected',
|
|
65
|
+
type: {
|
|
66
|
+
required: true,
|
|
67
|
+
name: 'boolean',
|
|
68
|
+
},
|
|
69
|
+
control: {
|
|
70
|
+
type: 'boolean',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
busy: {
|
|
74
|
+
description: 'Whether or not the Toggle button is in a loading state',
|
|
75
|
+
type: {
|
|
76
|
+
name: 'boolean',
|
|
77
|
+
},
|
|
78
|
+
control: {
|
|
79
|
+
type: 'boolean',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
onChange: {
|
|
83
|
+
description: 'Function to be called when the Toggle button is clicked',
|
|
84
|
+
type: {
|
|
85
|
+
name: 'function',
|
|
86
|
+
},
|
|
87
|
+
control: false,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export default meta;
|
|
93
|
+
|
|
94
|
+
type Story = StoryObj<ToggleButtonProps>;
|
|
95
|
+
|
|
96
|
+
export const ToggleButtonStory: Story = {
|
|
97
|
+
name: 'Toggle Button',
|
|
98
|
+
args: {
|
|
99
|
+
label: 'Toggle Button label',
|
|
100
|
+
name: 'toggle-button-name',
|
|
101
|
+
value: 'value',
|
|
102
|
+
selected: true,
|
|
103
|
+
},
|
|
104
|
+
play: async ({ canvasElement }) => {
|
|
105
|
+
const canvas = within(canvasElement);
|
|
106
|
+
const toggleButton = document.querySelector('.dropin-toggle-button');
|
|
107
|
+
const toggleButtonInput = await canvas.findByRole('radio');
|
|
108
|
+
const toggleButtonText = document.querySelector(
|
|
109
|
+
'.dropin-toggle-button__content'
|
|
110
|
+
);
|
|
111
|
+
await expect(toggleButton).toHaveClass('dropin-toggle-button__selected');
|
|
112
|
+
await expect(toggleButtonText).toHaveTextContent('Toggle Button label');
|
|
113
|
+
await expect(toggleButtonInput).toBeChecked();
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const ToggleButtonNotSelected: Story = {
|
|
118
|
+
name: 'Toggle Button not selected',
|
|
119
|
+
args: {
|
|
120
|
+
label: 'Toggle Button label',
|
|
121
|
+
name: 'toggle-button-name',
|
|
122
|
+
value: 'value',
|
|
123
|
+
selected: false,
|
|
124
|
+
},
|
|
125
|
+
play: async ({ canvasElement }) => {
|
|
126
|
+
const canvas = within(canvasElement);
|
|
127
|
+
const toggleButton = document.querySelector('.dropin-toggle-button');
|
|
128
|
+
const toggleButtonInput = await canvas.findByRole('radio');
|
|
129
|
+
const toggleButtonText = await canvas.findByText('Toggle Button label');
|
|
130
|
+
await expect(toggleButton).not.toHaveClass(
|
|
131
|
+
'dropin-toggle-button__selected'
|
|
132
|
+
);
|
|
133
|
+
await expect(toggleButtonText).toHaveTextContent('Toggle Button label');
|
|
134
|
+
await expect(toggleButtonInput).not.toBeChecked();
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export const ToggleButtonWithIcon: Story = {
|
|
139
|
+
name: 'Toggle Button with icon',
|
|
140
|
+
args: {
|
|
141
|
+
label: 'Toggle Button label',
|
|
142
|
+
name: 'toggle-button-name',
|
|
143
|
+
value: 'value',
|
|
144
|
+
selected: true,
|
|
145
|
+
icon: <CardSVG />,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const ToggleButtonWithImage: Story = {
|
|
150
|
+
name: 'Toggle Button with image',
|
|
151
|
+
args: {
|
|
152
|
+
label: 'Toggle Button label',
|
|
153
|
+
name: 'toggle-button-name',
|
|
154
|
+
value: 'value',
|
|
155
|
+
selected: true,
|
|
156
|
+
icon: <img src={CardPNG} alt="alt" />,
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export const ToggleButtonWithHTML: Story = {
|
|
161
|
+
name: 'Toggle Button with HTML',
|
|
162
|
+
args: {
|
|
163
|
+
label: (
|
|
164
|
+
<p>
|
|
165
|
+
Toggle Button label {''}
|
|
166
|
+
<a href="https://www.adobe.com/" target="_blank" rel="noreferrer">
|
|
167
|
+
with a link
|
|
168
|
+
</a>
|
|
169
|
+
</p>
|
|
170
|
+
),
|
|
171
|
+
name: 'toggle-button-name',
|
|
172
|
+
value: 'value',
|
|
173
|
+
selected: true,
|
|
174
|
+
icon: <img src={CardPNG} alt="alt" />,
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export const ToggleButtonWithPrice: Story = {
|
|
179
|
+
name: 'Toggle Button with Price',
|
|
180
|
+
args: {
|
|
181
|
+
label: (
|
|
182
|
+
<p>
|
|
183
|
+
<Price currency="USD" value={100} /> Toggle Button label
|
|
184
|
+
</p>
|
|
185
|
+
),
|
|
186
|
+
name: 'toggle-button-name',
|
|
187
|
+
value: 'value',
|
|
188
|
+
selected: true,
|
|
189
|
+
},
|
|
190
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
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.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
10
|
+
import { FunctionComponent, VNode } from 'preact';
|
|
11
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
12
|
+
import { classes } from '@adobe-commerce/elsie/lib';
|
|
13
|
+
import '@adobe-commerce/elsie/components/ToggleButton/ToggleButton.css';
|
|
14
|
+
import { RadioButton } from '@adobe-commerce/elsie/components';
|
|
15
|
+
|
|
16
|
+
export interface ToggleButtonProps
|
|
17
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'icon' | 'label'> {
|
|
18
|
+
label: string | VNode<HTMLAttributes<HTMLElement>>;
|
|
19
|
+
name: string;
|
|
20
|
+
value: string;
|
|
21
|
+
busy?: boolean;
|
|
22
|
+
icon?:
|
|
23
|
+
| VNode<HTMLAttributes<SVGSVGElement>>
|
|
24
|
+
| VNode<HTMLAttributes<HTMLImageElement>>;
|
|
25
|
+
onChange?: (value: string) => void;
|
|
26
|
+
selected?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const ToggleButton: FunctionComponent<ToggleButtonProps> = ({
|
|
30
|
+
label,
|
|
31
|
+
name,
|
|
32
|
+
value,
|
|
33
|
+
busy = false,
|
|
34
|
+
children,
|
|
35
|
+
className,
|
|
36
|
+
icon,
|
|
37
|
+
onChange,
|
|
38
|
+
selected = true,
|
|
39
|
+
...props
|
|
40
|
+
}) => {
|
|
41
|
+
return (
|
|
42
|
+
<div
|
|
43
|
+
{...props}
|
|
44
|
+
className={classes([
|
|
45
|
+
'dropin-toggle-button',
|
|
46
|
+
className,
|
|
47
|
+
['dropin-toggle-button__selected', selected],
|
|
48
|
+
])}
|
|
49
|
+
>
|
|
50
|
+
<label className="dropin-toggle-button__actionButton">
|
|
51
|
+
<RadioButton
|
|
52
|
+
label=""
|
|
53
|
+
name={name}
|
|
54
|
+
value={value}
|
|
55
|
+
checked={selected}
|
|
56
|
+
onChange={() => onChange && onChange(value)}
|
|
57
|
+
aria-label={name}
|
|
58
|
+
busy={busy}
|
|
59
|
+
className={classes([className, 'dropin-toggle-button__radioButton'])}
|
|
60
|
+
/>
|
|
61
|
+
|
|
62
|
+
<span className="dropin-toggle-button__content">
|
|
63
|
+
{icon && (
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
<icon.type
|
|
66
|
+
{...icon?.props}
|
|
67
|
+
className="dropin-toggle-button__icon"
|
|
68
|
+
/>
|
|
69
|
+
)}
|
|
70
|
+
{label}
|
|
71
|
+
</span>
|
|
72
|
+
</label>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
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.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
10
|
+
export * from '@adobe-commerce/elsie/components/ToggleButton/ToggleButton';
|
|
11
|
+
export { ToggleButton as default } from '@adobe-commerce/elsie/components/ToggleButton/ToggleButton';
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
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.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Do not edit directly
|
|
12
|
+
* Generated on Tue, 05 Mar 2024 20:18:40 GMT
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
.dropin-design {
|
|
16
|
+
--color-brand-500: #454545; /* Brand buttons default - AAA */
|
|
17
|
+
--color-brand-600: #383838; /* Brand buttons on hover - AAA */
|
|
18
|
+
--color-brand-700: #2b2b2b; /* Brand buttons selected */
|
|
19
|
+
--color-neutral-50: #ffffff; /* Lightest surface / Text & components On Dark surface - AAA */
|
|
20
|
+
--color-neutral-100: #fafafa; /* Light surface - AAA */
|
|
21
|
+
--color-neutral-200: #f5f5f5; /* Light surface - AAA */
|
|
22
|
+
--color-neutral-300: #e8e8e8; /* Disabled surfaces - AAA */
|
|
23
|
+
--color-neutral-400: #d6d6d6; /* Ornamental elements (ie. Divider) */
|
|
24
|
+
--color-neutral-500: #b8b8b8; /* Disabled text */
|
|
25
|
+
--color-neutral-600: #8f8f8f; /* Component borders (ie. Text field border) - AA Large text */
|
|
26
|
+
--color-neutral-700: #666666; /* Secondary text - AAA */
|
|
27
|
+
--color-neutral-800: #3d3d3d; /* Default text - AAA */
|
|
28
|
+
--color-neutral-900: #292929; /* Default text on hover - AAA */
|
|
29
|
+
--color-positive-200: #eff5ef; /* Semantic positive surface - AA Large text */
|
|
30
|
+
--color-positive-500: #7fb078; /* Semantic positive surface */
|
|
31
|
+
--color-positive-800: #53824c; /* Semantic Positive text - On Light AA */
|
|
32
|
+
--color-informational-200: #eeeffb; /* Semantic informational surface - AA Large text */
|
|
33
|
+
--color-informational-500: #6978d9; /* Semantic informational surface */
|
|
34
|
+
--color-informational-800: #5d6dd6; /* Semantic informational text, Highlights - On Light AA */
|
|
35
|
+
--color-warning-200: #fdf3e9; /* Semantic warning surface - AA Large text */
|
|
36
|
+
--color-warning-500: #e79f5c; /* Semantic warning surface */
|
|
37
|
+
--color-warning-800: #ad5c00; /* Semantic warning text - On Light AA */
|
|
38
|
+
--color-alert-200: #ffebeb; /* Semantic alert surface - AA Large text */
|
|
39
|
+
--color-alert-500: #db7070; /* Semantic alert surface */
|
|
40
|
+
--color-alert-800: #bf4545; /* Semantic alert text - On light AA */
|
|
41
|
+
--color-opacity-16: rgba(255, 255, 255, 0.16);
|
|
42
|
+
--color-opacity-24: rgba(255, 255, 255, 0.24);
|
|
43
|
+
--color-action-button-active: #ffffff; /* Defaults to var(--color-neutral-50) */
|
|
44
|
+
--color-action-button-hover: #e8e8e8; /* Defaults to var(--color-neutral-300) */
|
|
45
|
+
--color-button-active: #2b2b2b; /* Defaults to var(--color-brand-700) */
|
|
46
|
+
--color-button-focus: #d6d6d6; /* Defaults to var(--color-neutral-400) */
|
|
47
|
+
--color-button-hover: #383838; /* Defaults to var(--color-brand-600) */
|
|
48
|
+
--grid-1-columns: 4;
|
|
49
|
+
--grid-1-margins: 0;
|
|
50
|
+
--grid-1-gutters: 16px;
|
|
51
|
+
--grid-2-columns: 12;
|
|
52
|
+
--grid-2-margins: 0;
|
|
53
|
+
--grid-2-gutters: 16px;
|
|
54
|
+
--grid-3-columns: 12;
|
|
55
|
+
--grid-3-margins: 0;
|
|
56
|
+
--grid-3-gutters: 24px;
|
|
57
|
+
--grid-4-columns: 12;
|
|
58
|
+
--grid-4-margins: 0;
|
|
59
|
+
--grid-4-gutters: 24px;
|
|
60
|
+
--grid-5-columns: 12;
|
|
61
|
+
--grid-5-margins: 0;
|
|
62
|
+
--grid-5-gutters: 24px;
|
|
63
|
+
--shape-border-radius-1: 3px;
|
|
64
|
+
--shape-border-radius-2: 8px;
|
|
65
|
+
--shape-border-radius-3: 24px;
|
|
66
|
+
--shape-border-width-1: 1px;
|
|
67
|
+
--shape-border-width-2: 1.5px;
|
|
68
|
+
--shape-border-width-3: 2px;
|
|
69
|
+
--shape-border-width-4: 4px;
|
|
70
|
+
--shape-shadow-1: 0 0 16px 0 rgba(0, 0, 0, 0.16); /* Elevated panels (ie. Page side panel, Mobile bottom bar) */
|
|
71
|
+
--shape-shadow-2: 0 2px 16px 0 rgba(0, 0, 0, 0.16); /* Elevated dialogs (ie. Modal) */
|
|
72
|
+
--shape-shadow-3: 0 2px 3px 0 rgba(0, 0, 0, 0.16); /* Elevated container (ie. Card) */
|
|
73
|
+
--shape-icon-stroke-1: 1px;
|
|
74
|
+
--shape-icon-stroke-2: 1.5px;
|
|
75
|
+
--shape-icon-stroke-3: 2px;
|
|
76
|
+
--shape-icon-stroke-4: 4px;
|
|
77
|
+
--spacing-xxsmall: 4px;
|
|
78
|
+
--spacing-xsmall: 8px;
|
|
79
|
+
--spacing-small: 16px;
|
|
80
|
+
--spacing-medium: 24px;
|
|
81
|
+
--spacing-big: 32px;
|
|
82
|
+
--spacing-xbig: 40px;
|
|
83
|
+
--spacing-xxbig: 48px;
|
|
84
|
+
--spacing-large: 64px;
|
|
85
|
+
--spacing-xlarge: 72px;
|
|
86
|
+
--spacing-xxlarge: 96px;
|
|
87
|
+
--spacing-huge: 120px;
|
|
88
|
+
--spacing-xhuge: 144px;
|
|
89
|
+
--spacing-xxhuge: 192px;
|
|
90
|
+
--type-base-font-family: system-ui, sans-serif;
|
|
91
|
+
--type-display-1-font: normal normal 300 60px/72px
|
|
92
|
+
var(--type-base-font-family); /* Hero title */
|
|
93
|
+
--type-display-1-letter-spacing: 0.04em;
|
|
94
|
+
--type-display-2-font: normal normal 300 48px/56px
|
|
95
|
+
var(--type-base-font-family); /* Banner title */
|
|
96
|
+
--type-display-2-letter-spacing: 0.04em;
|
|
97
|
+
--type-display-3-font: normal normal 300 34px/40px
|
|
98
|
+
var(--type-base-font-family); /* Desktop & tablet section title */
|
|
99
|
+
--type-display-3-letter-spacing: 0.04em;
|
|
100
|
+
--type-headline-1-font: normal normal 400 24px/32px
|
|
101
|
+
var(--type-base-font-family); /* Desktop & tablet page title */
|
|
102
|
+
--type-headline-1-letter-spacing: 0.04em;
|
|
103
|
+
--type-headline-2-default-font: normal normal 300 20px/24px
|
|
104
|
+
var(--type-base-font-family); /* Rail title */
|
|
105
|
+
--type-headline-2-default-letter-spacing: 0.04em;
|
|
106
|
+
--type-headline-2-strong-font: normal normal 400 20px/24px
|
|
107
|
+
var(--type-base-font-family); /* Mobile page and section title */
|
|
108
|
+
--type-headline-2-strong-letter-spacing: 0.04em;
|
|
109
|
+
--type-body-1-default-font: normal normal 300 16px/24px
|
|
110
|
+
var(--type-base-font-family); /* Normal text paragraph */
|
|
111
|
+
--type-body-1-default-letter-spacing: 0.04em;
|
|
112
|
+
--type-body-1-strong-font: normal normal 400 16px/24px
|
|
113
|
+
var(--type-base-font-family);
|
|
114
|
+
--type-body-1-strong-letter-spacing: 0.04em;
|
|
115
|
+
--type-body-1-emphasized-font: normal normal 700 16px/24px
|
|
116
|
+
var(--type-base-font-family);
|
|
117
|
+
--type-body-1-emphasized-letter-spacing: 0.04em;
|
|
118
|
+
--type-body-2-default-font: normal normal 300 14px/20px
|
|
119
|
+
var(--type-base-font-family);
|
|
120
|
+
--type-body-2-default-letter-spacing: 0.04em;
|
|
121
|
+
--type-body-2-strong-font: normal normal 400 14px/20px
|
|
122
|
+
var(--type-base-font-family);
|
|
123
|
+
--type-body-2-strong-letter-spacing: 0.04em;
|
|
124
|
+
--type-body-2-emphasized-font: normal normal 700 14px/20px
|
|
125
|
+
var(--type-base-font-family);
|
|
126
|
+
--type-body-2-emphasized-letter-spacing: 0.04em;
|
|
127
|
+
--type-button-1-font: normal normal 400 20px/26px var(--type-base-font-family); /* Primary button text */
|
|
128
|
+
--type-button-1-letter-spacing: 0.08em;
|
|
129
|
+
--type-button-2-font: normal normal 400 16px/24px var(--type-base-font-family); /* Small buttons */
|
|
130
|
+
--type-button-2-letter-spacing: 0.08em;
|
|
131
|
+
--type-details-caption-1-font: normal normal 400 12px/16px
|
|
132
|
+
var(--type-base-font-family);
|
|
133
|
+
--type-details-caption-1-letter-spacing: 0.08em;
|
|
134
|
+
--type-details-caption-2-font: normal normal 300 12px/16px
|
|
135
|
+
var(--type-base-font-family);
|
|
136
|
+
--type-details-caption-2-letter-spacing: 0.08em;
|
|
137
|
+
--type-details-overline-font: normal normal 700 12px/20px
|
|
138
|
+
var(--type-base-font-family);
|
|
139
|
+
--type-details-overline-letter-spacing: 0.16em;
|
|
140
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
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.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
10
|
+
import { FunctionComponent } from 'preact';
|
|
11
|
+
import { HTMLAttributes, createContext, useMemo } from 'preact/compat';
|
|
12
|
+
import { deepmerge, Render } from '@adobe-commerce/elsie/lib';
|
|
13
|
+
import { IntlProvider, getDefinitionByLanguage, Lang } from '@adobe-commerce/elsie/i18n';
|
|
14
|
+
|
|
15
|
+
import '@adobe-commerce/elsie/components/UIProvider/UIProvider.css';
|
|
16
|
+
import '@adobe-commerce/elsie/components/UIProvider/normalize.css';
|
|
17
|
+
|
|
18
|
+
export const UIContext = createContext<{
|
|
19
|
+
locale: string;
|
|
20
|
+
}>({
|
|
21
|
+
locale: 'en-US',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
type LangDefinitions = { [key: string]: any };
|
|
25
|
+
|
|
26
|
+
export interface UIProviderProps extends HTMLAttributes<HTMLDivElement> {
|
|
27
|
+
lang?: Lang; // ... list of other supported languages
|
|
28
|
+
langDefinitions?: LangDefinitions;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const UIProvider: FunctionComponent<UIProviderProps> = ({
|
|
32
|
+
lang = 'en_US',
|
|
33
|
+
langDefinitions = {},
|
|
34
|
+
children,
|
|
35
|
+
}) => {
|
|
36
|
+
const definitions = useMemo(() => {
|
|
37
|
+
// Merge default definition with selected definition
|
|
38
|
+
const selectedDefinitions: LangDefinitions = deepmerge(
|
|
39
|
+
langDefinitions.default,
|
|
40
|
+
langDefinitions[lang] ?? {}
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
// Merge SDK default definitions with custom definitions
|
|
44
|
+
return deepmerge(
|
|
45
|
+
getDefinitionByLanguage(lang), // SDK default definitions
|
|
46
|
+
selectedDefinitions // Custom definitions
|
|
47
|
+
);
|
|
48
|
+
}, [lang, langDefinitions]);
|
|
49
|
+
|
|
50
|
+
const locale = lang.replace('_', '-');
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<UIContext.Provider value={{ locale }}>
|
|
54
|
+
<IntlProvider definition={definitions}>
|
|
55
|
+
<>{children}</>
|
|
56
|
+
</IntlProvider>
|
|
57
|
+
</UIContext.Provider>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const provider = new Render(<UIProvider />);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
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.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
10
|
+
.dropin-debugger--show-slots [data-slot-key] {
|
|
11
|
+
outline: 1px dashed var(--color-neutral-600);
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.dropin-debugger--show-slots [data-slot-key]::before {
|
|
16
|
+
content: attr(data-slot-key);
|
|
17
|
+
font: var(--type-details-caption-1-font);
|
|
18
|
+
color: var(--color-informational-800);
|
|
19
|
+
background-color: var(--color-informational-200);
|
|
20
|
+
font-size: 0.75rem;
|
|
21
|
+
border-radius: 4px 4px 0 0;
|
|
22
|
+
padding: 0.2rem 0.4rem;
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
position: absolute;
|
|
25
|
+
z-index: 2;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.dropin-debugger--show-slots [data-slot] {
|
|
29
|
+
outline: 2px dashed var(--color-informational-800);
|
|
30
|
+
outline-offset: 3px;
|
|
31
|
+
border-radius: 4px;
|
|
32
|
+
min-height: 2rem;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.dropin-debugger--show-slots [data-slot]::before {
|
|
36
|
+
font: var(--type-details-caption-1-font);
|
|
37
|
+
content: attr(data-slot);
|
|
38
|
+
color: var(--color-informational-200);
|
|
39
|
+
background-color: var(--color-informational-800);
|
|
40
|
+
font-size: 0.75rem;
|
|
41
|
+
border-radius: 4px 4px 0 0;
|
|
42
|
+
padding: 0.2rem 0.4rem;
|
|
43
|
+
font-weight: 600;
|
|
44
|
+
position: absolute;
|
|
45
|
+
transform: translateY(-26px);
|
|
46
|
+
z-index: 2;
|
|
47
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
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.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
10
|
+
export * from '@adobe-commerce/elsie/components/UIProvider/UIProvider';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
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.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
10
|
+
.dropin-design a {
|
|
11
|
+
--textColor: var(--color-brand-500);
|
|
12
|
+
color: var(--textColor);
|
|
13
|
+
text-decoration: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.dropin-design a:hover {
|
|
17
|
+
--textColor: var(--color-brand-700);
|
|
18
|
+
text-decoration: solid underline var(--textColor);
|
|
19
|
+
text-underline-offset: 6px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.dropin-design a:focus-visible {
|
|
23
|
+
outline: solid var(--shape-border-width-4) var(--color-neutral-400);
|
|
24
|
+
border: var(--shape-border-width-1) solid var(--color-neutral-800);
|
|
25
|
+
border-radius: var(--shape-border-radius-1);
|
|
26
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
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.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
10
|
+
export * from '@adobe-commerce/elsie/components/Skeleton';
|
|
11
|
+
export * from '@adobe-commerce/elsie/components/UIProvider';
|
|
12
|
+
export * from '@adobe-commerce/elsie/components/Incrementer';
|
|
13
|
+
export * from '@adobe-commerce/elsie/components/Input';
|
|
14
|
+
export * from '@adobe-commerce/elsie/components/InputDate';
|
|
15
|
+
export * from '@adobe-commerce/elsie/components/InputPassword';
|
|
16
|
+
export * from '@adobe-commerce/elsie/components/TextArea';
|
|
17
|
+
export * from '@adobe-commerce/elsie/components/Image';
|
|
18
|
+
export * from '@adobe-commerce/elsie/components/Divider';
|
|
19
|
+
export * from '@adobe-commerce/elsie/components/Icon';
|
|
20
|
+
export * from '@adobe-commerce/elsie/components/Price';
|
|
21
|
+
export * from '@adobe-commerce/elsie/components/RadioButton';
|
|
22
|
+
export * from '@adobe-commerce/elsie/components/Image';
|
|
23
|
+
export * from '@adobe-commerce/elsie/components/Divider';
|
|
24
|
+
export * from '@adobe-commerce/elsie/components/Icon';
|
|
25
|
+
export * from '@adobe-commerce/elsie/components/Button';
|
|
26
|
+
export * from '@adobe-commerce/elsie/components/Picker';
|
|
27
|
+
export * from '@adobe-commerce/elsie/components/Field';
|
|
28
|
+
export * from '@adobe-commerce/elsie/components/ActionButton';
|
|
29
|
+
export * from '@adobe-commerce/elsie/components/ActionButtonGroup';
|
|
30
|
+
export * from '@adobe-commerce/elsie/components/Card';
|
|
31
|
+
export * from '@adobe-commerce/elsie/components/Checkbox';
|
|
32
|
+
export * from '@adobe-commerce/elsie/components/ColorSwatch';
|
|
33
|
+
export * from '@adobe-commerce/elsie/components/TextSwatch';
|
|
34
|
+
export * from '@adobe-commerce/elsie/components/ProgressSpinner';
|
|
35
|
+
export * from '@adobe-commerce/elsie/components/ImageSwatch';
|
|
36
|
+
export * from '@adobe-commerce/elsie/components/Accordion';
|
|
37
|
+
export * from '@adobe-commerce/elsie/components/InLineAlert';
|
|
38
|
+
export * from '@adobe-commerce/elsie/components/Modal';
|
|
39
|
+
export * from '@adobe-commerce/elsie/components/CartItem';
|
|
40
|
+
export * from '@adobe-commerce/elsie/components/CartList';
|
|
41
|
+
export * from '@adobe-commerce/elsie/components/PriceRange';
|
|
42
|
+
export * from '@adobe-commerce/elsie/components/Breadcrumbs';
|
|
43
|
+
export * from '@adobe-commerce/elsie/components/AlertBanner';
|
|
44
|
+
export * from '@adobe-commerce/elsie/components/IllustratedMessage';
|
|
45
|
+
export * from '@adobe-commerce/elsie/components/ToggleButton';
|
|
46
|
+
export * from '@adobe-commerce/elsie/components/Header';
|
|
47
|
+
export * from '@adobe-commerce/elsie/components/Tag';
|
|
48
|
+
export * from '@adobe-commerce/elsie/components/ContentGrid';
|
|
49
|
+
export * from '@adobe-commerce/elsie/components/Pagination';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Meta, Unstyled } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="API/Event Bus" />
|
|
4
|
+
<Unstyled>
|
|
5
|
+
|
|
6
|
+
# Event Bus
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
// from drop-in project (SDK)
|
|
12
|
+
import { events } from '@adobe-commerce/elsie/lib';
|
|
13
|
+
|
|
14
|
+
// from host site
|
|
15
|
+
import { events } from '@dropins/tools/event-bus.js';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Methods
|
|
19
|
+
|
|
20
|
+
### Listener
|
|
21
|
+
```ts
|
|
22
|
+
const onEvent = events.on('<event>', (payload) => {
|
|
23
|
+
//...handle payload
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Stop listening to event
|
|
27
|
+
onEvent.off();
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Emit
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
events.emit('<event>', <payload>);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Logging
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
// Enable logging
|
|
40
|
+
events.enableLogger(true);
|
|
41
|
+
|
|
42
|
+
// Disable logging
|
|
43
|
+
events.enableLogger(false);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Get Latest Payload
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
events.lastPayload('<event>'): EventPayload | undefined;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
</Unstyled>
|