@dropins/tools 0.21.1 → 0.21.2-alpha2
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/components/Accordion/Accordion.d.ts +25 -0
- package/components/Accordion/Accordion.d.ts.map +1 -0
- package/components/Accordion/Accordion.jsx +59 -0
- package/components/Accordion/Accordion.stories.d.ts +22 -0
- package/components/Accordion/Accordion.stories.d.ts.map +1 -0
- package/components/Accordion/Accordion.stories.jsx +320 -0
- package/components/Accordion/Accordion.test.d.ts +3 -0
- package/components/Accordion/Accordion.test.d.ts.map +1 -0
- package/components/Accordion/Accordion.test.jsx +79 -0
- package/components/Accordion/index.d.ts +3 -0
- package/components/Accordion/index.d.ts.map +1 -0
- package/components/Accordion/index.js +2 -0
- package/components/ActionButton/ActionButton.d.ts +11 -0
- package/components/ActionButton/ActionButton.d.ts.map +1 -0
- package/components/ActionButton/ActionButton.jsx +14 -0
- package/components/ActionButton/ActionButton.stories.d.ts +16 -0
- package/components/ActionButton/ActionButton.stories.d.ts.map +1 -0
- package/components/ActionButton/ActionButton.stories.jsx +119 -0
- package/components/ActionButton/ActionButton.test.d.ts +3 -0
- package/components/ActionButton/ActionButton.test.d.ts.map +1 -0
- package/components/ActionButton/ActionButton.test.jsx +47 -0
- package/components/ActionButton/index.d.ts +2 -0
- package/components/ActionButton/index.d.ts.map +1 -0
- package/components/ActionButton/index.js +1 -0
- package/components/ActionButtonGroup/ActionButtonGroup.d.ts +20 -0
- package/components/ActionButtonGroup/ActionButtonGroup.d.ts.map +1 -0
- package/components/ActionButtonGroup/ActionButtonGroup.jsx +39 -0
- package/components/ActionButtonGroup/ActionButtonGroup.stories.d.ts +16 -0
- package/components/ActionButtonGroup/ActionButtonGroup.stories.d.ts.map +1 -0
- package/components/ActionButtonGroup/ActionButtonGroup.stories.jsx +72 -0
- package/components/ActionButtonGroup/ActionButtonGroup.test.d.ts +3 -0
- package/components/ActionButtonGroup/ActionButtonGroup.test.d.ts.map +1 -0
- package/components/ActionButtonGroup/ActionButtonGroup.test.jsx +78 -0
- package/components/ActionButtonGroup/index.d.ts +2 -0
- package/components/ActionButtonGroup/index.d.ts.map +1 -0
- package/components/ActionButtonGroup/index.js +1 -0
- package/components/AlertBanner/AlertBanner.d.ts +15 -0
- package/components/AlertBanner/AlertBanner.d.ts.map +1 -0
- package/components/AlertBanner/AlertBanner.jsx +30 -0
- package/components/AlertBanner/AlertBanner.stories.d.ts +17 -0
- package/components/AlertBanner/AlertBanner.stories.d.ts.map +1 -0
- package/components/AlertBanner/AlertBanner.stories.jsx +128 -0
- package/components/AlertBanner/AlertBanner.test.d.ts +3 -0
- package/components/AlertBanner/AlertBanner.test.d.ts.map +1 -0
- package/components/AlertBanner/AlertBanner.test.jsx +40 -0
- package/components/AlertBanner/index.d.ts +3 -0
- package/components/AlertBanner/index.d.ts.map +1 -0
- package/components/AlertBanner/index.js +2 -0
- package/components/Breadcrumbs/Breadcrumbs.d.ts +9 -0
- package/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -0
- package/components/Breadcrumbs/Breadcrumbs.jsx +26 -0
- package/components/Breadcrumbs/Breadcrumbs.stories.d.ts +15 -0
- package/components/Breadcrumbs/Breadcrumbs.stories.d.ts.map +1 -0
- package/components/Breadcrumbs/Breadcrumbs.stories.jsx +110 -0
- package/components/Breadcrumbs/Breadcrumbs.test.d.ts +3 -0
- package/components/Breadcrumbs/Breadcrumbs.test.d.ts.map +1 -0
- package/components/Breadcrumbs/Breadcrumbs.test.jsx +67 -0
- package/components/Breadcrumbs/index.d.ts +3 -0
- package/components/Breadcrumbs/index.d.ts.map +1 -0
- package/components/Breadcrumbs/index.js +2 -0
- package/components/Button/Button.d.ts +15 -0
- package/components/Button/Button.d.ts.map +1 -0
- package/components/Button/Button.jsx +59 -0
- package/components/Button/Button.stories.d.ts +135 -0
- package/components/Button/Button.stories.d.ts.map +1 -0
- package/components/Button/Button.stories.jsx +354 -0
- package/components/Button/Button.test.d.ts +2 -0
- package/components/Button/Button.test.d.ts.map +1 -0
- package/components/Button/Button.test.jsx +134 -0
- package/components/Button/index.d.ts +3 -0
- package/components/Button/index.d.ts.map +1 -0
- package/components/Button/index.js +2 -0
- package/components/Card/Card.d.ts +9 -0
- package/components/Card/Card.d.ts.map +1 -0
- package/components/Card/Card.jsx +7 -0
- package/components/Card/Card.stories.d.ts +16 -0
- package/components/Card/Card.stories.d.ts.map +1 -0
- package/components/Card/Card.stories.jsx +47 -0
- package/components/Card/Card.test.d.ts +3 -0
- package/components/Card/Card.test.d.ts.map +1 -0
- package/components/Card/Card.test.jsx +26 -0
- package/components/Card/index.d.ts +2 -0
- package/components/Card/index.d.ts.map +1 -0
- package/components/Card/index.js +1 -0
- package/components/CartItem/CartItem.d.ts +25 -0
- package/components/CartItem/CartItem.d.ts.map +1 -0
- package/components/CartItem/CartItem.jsx +124 -0
- package/components/CartItem/CartItem.stories.d.ts +54 -0
- package/components/CartItem/CartItem.stories.d.ts.map +1 -0
- package/components/CartItem/CartItem.stories.jsx +309 -0
- package/components/CartItem/CartItem.test.d.ts +3 -0
- package/components/CartItem/CartItem.test.d.ts.map +1 -0
- package/components/CartItem/CartItem.test.jsx +71 -0
- package/components/CartItem/CartItemSkeleton.d.ts +3 -0
- package/components/CartItem/CartItemSkeleton.d.ts.map +1 -0
- package/components/CartItem/CartItemSkeleton.jsx +25 -0
- package/components/CartItem/CartItemSkeleton.test.d.ts +3 -0
- package/components/CartItem/CartItemSkeleton.test.d.ts.map +1 -0
- package/components/CartItem/CartItemSkeleton.test.jsx +11 -0
- package/components/CartItem/index.d.ts +4 -0
- package/components/CartItem/index.d.ts.map +1 -0
- package/components/CartItem/index.js +3 -0
- package/components/CartList/CartList.d.ts +7 -0
- package/components/CartList/CartList.d.ts.map +1 -0
- package/components/CartList/CartList.jsx +14 -0
- package/components/CartList/CartList.stories.d.ts +17 -0
- package/components/CartList/CartList.stories.d.ts.map +1 -0
- package/components/CartList/CartList.stories.jsx +54 -0
- package/components/CartList/CartList.test.d.ts +3 -0
- package/components/CartList/CartList.test.d.ts.map +1 -0
- package/components/CartList/CartList.test.jsx +12 -0
- package/components/CartList/index.d.ts +3 -0
- package/components/CartList/index.d.ts.map +1 -0
- package/components/CartList/index.js +2 -0
- package/components/Checkbox/Checkbox.d.ts +13 -0
- package/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/components/Checkbox/Checkbox.jsx +51 -0
- package/components/Checkbox/Checkbox.stories.d.ts +22 -0
- package/components/Checkbox/Checkbox.stories.d.ts.map +1 -0
- package/components/Checkbox/Checkbox.stories.jsx +157 -0
- package/components/Checkbox/Checkbox.test.d.ts +3 -0
- package/components/Checkbox/Checkbox.test.d.ts.map +1 -0
- package/components/Checkbox/Checkbox.test.jsx +136 -0
- package/components/Checkbox/index.d.ts +2 -0
- package/components/Checkbox/index.d.ts.map +1 -0
- package/components/Checkbox/index.js +1 -0
- package/components/ColorSwatch/ColorSwatch.d.ts +20 -0
- package/components/ColorSwatch/ColorSwatch.d.ts.map +1 -0
- package/components/ColorSwatch/ColorSwatch.jsx +57 -0
- package/components/ColorSwatch/ColorSwatch.stories.d.ts +20 -0
- package/components/ColorSwatch/ColorSwatch.stories.d.ts.map +1 -0
- package/components/ColorSwatch/ColorSwatch.stories.jsx +206 -0
- package/components/ColorSwatch/ColorSwatch.test.d.ts +3 -0
- package/components/ColorSwatch/ColorSwatch.test.d.ts.map +1 -0
- package/components/ColorSwatch/ColorSwatch.test.jsx +87 -0
- package/components/ColorSwatch/index.d.ts +3 -0
- package/components/ColorSwatch/index.d.ts.map +1 -0
- package/components/ColorSwatch/index.js +2 -0
- package/components/Divider/Divider.d.ts +8 -0
- package/components/Divider/Divider.d.ts.map +1 -0
- package/components/Divider/Divider.jsx +9 -0
- package/components/Divider/Divider.stories.d.ts +11 -0
- package/components/Divider/Divider.stories.d.ts.map +1 -0
- package/components/Divider/Divider.stories.jsx +43 -0
- package/components/Divider/Divider.test.d.ts +2 -0
- package/components/Divider/Divider.test.d.ts.map +1 -0
- package/components/Divider/Divider.test.jsx +19 -0
- package/components/Divider/index.d.ts +3 -0
- package/components/Divider/index.d.ts.map +1 -0
- package/components/Divider/index.js +2 -0
- package/components/Field/Field.d.ts +14 -0
- package/components/Field/Field.d.ts.map +1 -0
- package/components/Field/Field.jsx +29 -0
- package/components/Field/Field.stories.d.ts +37 -0
- package/components/Field/Field.stories.d.ts.map +1 -0
- package/components/Field/Field.stories.jsx +174 -0
- package/components/Field/Field.test.d.ts +3 -0
- package/components/Field/Field.test.d.ts.map +1 -0
- package/components/Field/Field.test.jsx +91 -0
- package/components/Field/index.d.ts +2 -0
- package/components/Field/index.d.ts.map +1 -0
- package/components/Field/index.js +1 -0
- package/components/Icon/Icon.d.ts +11 -0
- package/components/Icon/Icon.d.ts.map +1 -0
- package/components/Icon/Icon.jsx +57 -0
- package/components/Icon/Icon.stories.d.ts +16 -0
- package/components/Icon/Icon.stories.d.ts.map +1 -0
- package/components/Icon/Icon.stories.helpers.d.ts +4 -0
- package/components/Icon/Icon.stories.helpers.d.ts.map +1 -0
- package/components/Icon/Icon.stories.helpers.jsx +7 -0
- package/components/Icon/Icon.stories.jsx +48 -0
- package/components/Icon/Icon.test.d.ts +3 -0
- package/components/Icon/Icon.test.d.ts.map +1 -0
- package/components/Icon/Icon.test.jsx +67 -0
- package/components/Icon/index.d.ts +2 -0
- package/components/Icon/index.d.ts.map +1 -0
- package/components/Icon/index.js +1 -0
- package/components/IllustratedMessage/IllustratedMessage.d.ts +13 -0
- package/components/IllustratedMessage/IllustratedMessage.d.ts.map +1 -0
- package/components/IllustratedMessage/IllustratedMessage.jsx +21 -0
- package/components/IllustratedMessage/IllustratedMessage.stories.d.ts +10 -0
- package/components/IllustratedMessage/IllustratedMessage.stories.d.ts.map +1 -0
- package/components/IllustratedMessage/IllustratedMessage.stories.jsx +90 -0
- package/components/IllustratedMessage/IllustratedMessage.test.d.ts +3 -0
- package/components/IllustratedMessage/IllustratedMessage.test.d.ts.map +1 -0
- package/components/IllustratedMessage/IllustratedMessage.test.jsx +42 -0
- package/components/IllustratedMessage/index.d.ts +3 -0
- package/components/IllustratedMessage/index.d.ts.map +1 -0
- package/components/IllustratedMessage/index.js +2 -0
- package/components/Image/Image.d.ts +11 -0
- package/components/Image/Image.d.ts.map +1 -0
- package/components/Image/Image.jsx +26 -0
- package/components/Image/Image.stories.d.ts +11 -0
- package/components/Image/Image.stories.d.ts.map +1 -0
- package/components/Image/Image.stories.jsx +66 -0
- package/components/Image/Image.test.d.ts +3 -0
- package/components/Image/Image.test.d.ts.map +1 -0
- package/components/Image/Image.test.jsx +82 -0
- package/components/Image/index.d.ts +2 -0
- package/components/Image/index.d.ts.map +1 -0
- package/components/Image/index.js +1 -0
- package/components/ImageSwatch/ImageSwatch.d.ts +20 -0
- package/components/ImageSwatch/ImageSwatch.d.ts.map +1 -0
- package/components/ImageSwatch/ImageSwatch.jsx +49 -0
- package/components/ImageSwatch/ImageSwatch.stories.d.ts +20 -0
- package/components/ImageSwatch/ImageSwatch.stories.d.ts.map +1 -0
- package/components/ImageSwatch/ImageSwatch.stories.jsx +206 -0
- package/components/ImageSwatch/ImageSwatch.test.d.ts +3 -0
- package/components/ImageSwatch/ImageSwatch.test.d.ts.map +1 -0
- package/components/ImageSwatch/ImageSwatch.test.jsx +64 -0
- package/components/ImageSwatch/index.d.ts +3 -0
- package/components/ImageSwatch/index.d.ts.map +1 -0
- package/components/ImageSwatch/index.js +2 -0
- package/components/InLineAlert/InLineAlert.d.ts +16 -0
- package/components/InLineAlert/InLineAlert.d.ts.map +1 -0
- package/components/InLineAlert/InLineAlert.jsx +38 -0
- package/components/InLineAlert/InLineAlert.stories.d.ts +86 -0
- package/components/InLineAlert/InLineAlert.stories.d.ts.map +1 -0
- package/components/InLineAlert/InLineAlert.stories.jsx +193 -0
- package/components/InLineAlert/InLineAlert.test.d.ts +3 -0
- package/components/InLineAlert/InLineAlert.test.d.ts.map +1 -0
- package/components/InLineAlert/InLineAlert.test.jsx +77 -0
- package/components/InLineAlert/index.d.ts +3 -0
- package/components/InLineAlert/index.d.ts.map +1 -0
- package/components/InLineAlert/index.js +2 -0
- package/components/Incrementer/Incrementer.d.ts +17 -0
- package/components/Incrementer/Incrementer.d.ts.map +1 -0
- package/components/Incrementer/Incrementer.jsx +87 -0
- package/components/Incrementer/Incrementer.stories.d.ts +10 -0
- package/components/Incrementer/Incrementer.stories.d.ts.map +1 -0
- package/components/Incrementer/Incrementer.stories.jsx +68 -0
- package/components/Incrementer/Incrementer.test.d.ts +3 -0
- package/components/Incrementer/Incrementer.test.d.ts.map +1 -0
- package/components/Incrementer/Incrementer.test.jsx +112 -0
- package/components/Incrementer/index.d.ts +2 -0
- package/components/Incrementer/index.d.ts.map +1 -0
- package/components/Incrementer/index.js +1 -0
- package/components/Input/Input.d.ts +19 -0
- package/components/Input/Input.d.ts.map +1 -0
- package/components/Input/Input.jsx +73 -0
- package/components/Input/Input.stories.d.ts +11 -0
- package/components/Input/Input.stories.d.ts.map +1 -0
- package/components/Input/Input.stories.jsx +115 -0
- package/components/Input/Input.test.d.ts +3 -0
- package/components/Input/Input.test.d.ts.map +1 -0
- package/components/Input/Input.test.jsx +111 -0
- package/components/Input/index.d.ts +3 -0
- package/components/Input/index.d.ts.map +1 -0
- package/components/Input/index.js +2 -0
- package/components/Modal/Modal.d.ts +15 -0
- package/components/Modal/Modal.d.ts.map +1 -0
- package/components/Modal/Modal.jsx +93 -0
- package/components/Modal/Modal.stories.d.ts +56 -0
- package/components/Modal/Modal.stories.d.ts.map +1 -0
- package/components/Modal/Modal.stories.jsx +189 -0
- package/components/Modal/Modal.test.d.ts +3 -0
- package/components/Modal/Modal.test.d.ts.map +1 -0
- package/components/Modal/Modal.test.jsx +85 -0
- package/components/Modal/index.d.ts +2 -0
- package/components/Modal/index.d.ts.map +1 -0
- package/components/Modal/index.js +14 -0
- package/components/Picker/Picker.d.ts +26 -0
- package/components/Picker/Picker.d.ts.map +1 -0
- package/components/Picker/Picker.jsx +81 -0
- package/components/Picker/Picker.stories.d.ts +22 -0
- package/components/Picker/Picker.stories.d.ts.map +1 -0
- package/components/Picker/Picker.stories.jsx +236 -0
- package/components/Picker/Picker.test.d.ts +2 -0
- package/components/Picker/Picker.test.d.ts.map +1 -0
- package/components/Picker/Picker.test.jsx +190 -0
- package/components/Picker/index.d.ts +2 -0
- package/components/Picker/index.d.ts.map +1 -0
- package/components/Picker/index.js +1 -0
- package/components/Price/Price.d.ts +17 -0
- package/components/Price/Price.d.ts.map +1 -0
- package/components/Price/Price.jsx +24 -0
- package/components/Price/Price.stories.d.ts +17 -0
- package/components/Price/Price.stories.d.ts.map +1 -0
- package/components/Price/Price.stories.jsx +78 -0
- package/components/Price/Price.test.d.ts +3 -0
- package/components/Price/Price.test.d.ts.map +1 -0
- package/components/Price/Price.test.jsx +68 -0
- package/components/Price/index.d.ts +2 -0
- package/components/Price/index.d.ts.map +1 -0
- package/components/Price/index.js +1 -0
- package/components/PriceRange/PriceRange.d.ts +17 -0
- package/components/PriceRange/PriceRange.d.ts.map +1 -0
- package/components/PriceRange/PriceRange.jsx +75 -0
- package/components/PriceRange/PriceRange.stories.d.ts +107 -0
- package/components/PriceRange/PriceRange.stories.d.ts.map +1 -0
- package/components/PriceRange/PriceRange.stories.jsx +210 -0
- package/components/PriceRange/PriceRange.test.d.ts +3 -0
- package/components/PriceRange/PriceRange.test.d.ts.map +1 -0
- package/components/PriceRange/PriceRange.test.jsx +188 -0
- package/components/PriceRange/index.d.ts +3 -0
- package/components/PriceRange/index.d.ts.map +1 -0
- package/components/PriceRange/index.js +2 -0
- package/components/PriceSummary/PriceSummary.d.ts +43 -0
- package/components/PriceSummary/PriceSummary.d.ts.map +1 -0
- package/components/PriceSummary/PriceSummary.jsx +228 -0
- package/components/PriceSummary/PriceSummary.stories.d.ts +127 -0
- package/components/PriceSummary/PriceSummary.stories.d.ts.map +1 -0
- package/components/PriceSummary/PriceSummary.stories.jsx +456 -0
- package/components/PriceSummary/PriceSummary.test.d.ts +3 -0
- package/components/PriceSummary/PriceSummary.test.d.ts.map +1 -0
- package/components/PriceSummary/PriceSummary.test.jsx +275 -0
- package/components/PriceSummary/index.d.ts +3 -0
- package/components/PriceSummary/index.d.ts.map +1 -0
- package/components/PriceSummary/index.js +2 -0
- package/components/ProgressSpinner/ProgressSpinner.d.ts +14 -0
- package/components/ProgressSpinner/ProgressSpinner.d.ts.map +1 -0
- package/components/ProgressSpinner/ProgressSpinner.jsx +31 -0
- package/components/ProgressSpinner/ProgressSpinner.stories.d.ts +19 -0
- package/components/ProgressSpinner/ProgressSpinner.stories.d.ts.map +1 -0
- package/components/ProgressSpinner/ProgressSpinner.stories.jsx +195 -0
- package/components/ProgressSpinner/ProgressSpinner.test.d.ts +3 -0
- package/components/ProgressSpinner/ProgressSpinner.test.d.ts.map +1 -0
- package/components/ProgressSpinner/ProgressSpinner.test.jsx +40 -0
- package/components/ProgressSpinner/index.d.ts +3 -0
- package/components/ProgressSpinner/index.d.ts.map +1 -0
- package/components/ProgressSpinner/index.js +2 -0
- package/components/RadioButton/RadioButton.d.ts +15 -0
- package/components/RadioButton/RadioButton.d.ts.map +1 -0
- package/components/RadioButton/RadioButton.jsx +31 -0
- package/components/RadioButton/RadioButton.stories.d.ts +15 -0
- package/components/RadioButton/RadioButton.stories.d.ts.map +1 -0
- package/components/RadioButton/RadioButton.stories.jsx +92 -0
- package/components/RadioButton/RadioButton.test.d.ts +3 -0
- package/components/RadioButton/RadioButton.test.d.ts.map +1 -0
- package/components/RadioButton/RadioButton.test.jsx +62 -0
- package/components/RadioButton/index.d.ts +3 -0
- package/components/RadioButton/index.d.ts.map +1 -0
- package/components/RadioButton/index.js +2 -0
- package/components/Skeleton/Skeleton.d.ts +17 -0
- package/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/components/Skeleton/Skeleton.jsx +52 -0
- package/components/Skeleton/Skeleton.stories.d.ts +67 -0
- package/components/Skeleton/Skeleton.stories.d.ts.map +1 -0
- package/components/Skeleton/Skeleton.stories.jsx +184 -0
- package/components/Skeleton/Skeleton.test.d.ts +3 -0
- package/components/Skeleton/Skeleton.test.d.ts.map +1 -0
- package/components/Skeleton/Skeleton.test.jsx +62 -0
- package/components/Skeleton/index.d.ts +2 -0
- package/components/Skeleton/index.d.ts.map +1 -0
- package/components/Skeleton/index.js +1 -0
- package/components/TextSwatch/TextSwatch.d.ts +18 -0
- package/components/TextSwatch/TextSwatch.d.ts.map +1 -0
- package/components/TextSwatch/TextSwatch.jsx +56 -0
- package/components/TextSwatch/TextSwatch.stories.d.ts +21 -0
- package/components/TextSwatch/TextSwatch.stories.d.ts.map +1 -0
- package/components/TextSwatch/TextSwatch.stories.jsx +211 -0
- package/components/TextSwatch/TextSwatch.test.d.ts +3 -0
- package/components/TextSwatch/TextSwatch.test.d.ts.map +1 -0
- package/components/TextSwatch/TextSwatch.test.jsx +85 -0
- package/components/TextSwatch/index.d.ts +3 -0
- package/components/TextSwatch/index.d.ts.map +1 -0
- package/components/TextSwatch/index.js +2 -0
- package/components/UIProvider/UIProvider.d.ts +18 -0
- package/components/UIProvider/UIProvider.d.ts.map +1 -0
- package/components/UIProvider/UIProvider.jsx +26 -0
- package/components/UIProvider/UIProvider.test.d.ts +2 -0
- package/components/UIProvider/UIProvider.test.d.ts.map +1 -0
- package/components/UIProvider/UIProvider.test.jsx +9 -0
- package/components/UIProvider/index.d.ts +2 -0
- package/components/UIProvider/index.d.ts.map +1 -0
- package/components/UIProvider/index.js +1 -0
- package/components/index.d.ts +34 -0
- package/components/index.d.ts.map +1 -0
- package/components/index.js +33 -0
- package/docs/Design/designBlocks.d.ts +21 -0
- package/docs/Design/designBlocks.d.ts.map +1 -0
- package/docs/Design/designBlocks.jsx +59 -0
- package/docs/Design/getTokenData.d.ts +7 -0
- package/docs/Design/getTokenData.d.ts.map +1 -0
- package/docs/Design/getTokenData.js +18 -0
- package/docs/Design/getTokenData.test.d.ts +2 -0
- package/docs/Design/getTokenData.test.d.ts.map +1 -0
- package/docs/Design/getTokenData.test.js +92 -0
- package/event-bus.js +49 -1
- package/fetch-graphql.js +62 -1
- package/i18n/en_US.json +112 -0
- package/i18n/index.d.ts +341 -0
- package/i18n/index.d.ts.map +1 -0
- package/i18n/index.js +12 -0
- package/i18n/index.test.d.ts +2 -0
- package/i18n/index.test.d.ts.map +1 -0
- package/i18n/index.test.js +11 -0
- package/icons/index.d.ts +35 -0
- package/icons/index.d.ts.map +1 -0
- package/icons/index.js +34 -0
- package/initializer.js +61 -1
- package/lib/classes.d.ts +5 -0
- package/lib/classes.d.ts.map +1 -0
- package/lib/classes.js +16 -0
- package/lib/classes.test.d.ts +2 -0
- package/lib/classes.test.d.ts.map +1 -0
- package/lib/classes.test.js +18 -0
- package/lib/config.d.ts +7 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +12 -0
- package/lib/config.test.d.ts +2 -0
- package/lib/config.test.d.ts.map +1 -0
- package/lib/config.test.js +12 -0
- package/lib/debounce.d.ts +2 -0
- package/lib/debounce.d.ts.map +1 -0
- package/lib/debounce.js +7 -0
- package/lib/debounce.test.d.ts +2 -0
- package/lib/debounce.test.d.ts.map +1 -0
- package/lib/debounce.test.js +40 -0
- package/lib/deepmerge.d.ts +2 -0
- package/lib/deepmerge.d.ts.map +1 -0
- package/lib/deepmerge.js +1 -0
- package/lib/form-values.d.ts +5 -0
- package/lib/form-values.d.ts.map +1 -0
- package/lib/form-values.js +17 -0
- package/lib/form-values.test.d.ts +2 -0
- package/lib/form-values.test.d.ts.map +1 -0
- package/lib/form-values.test.jsx +29 -0
- package/lib/i18n.d.ts +8 -0
- package/lib/i18n.d.ts.map +1 -0
- package/lib/i18n.js +9 -0
- package/lib/i18n.test.d.ts +2 -0
- package/lib/i18n.test.d.ts.map +1 -0
- package/lib/i18n.test.jsx +8 -0
- package/lib/image-params-keymap.d.ts +4 -0
- package/lib/image-params-keymap.d.ts.map +1 -0
- package/lib/image-params-keymap.js +19 -0
- package/lib/image-params-keymap.test.d.ts +2 -0
- package/lib/image-params-keymap.test.d.ts.map +1 -0
- package/lib/image-params-keymap.test.js +7 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +13 -0
- package/lib/initializer.d.ts +78 -0
- package/lib/initializer.d.ts.map +1 -0
- package/lib/initializer.js +93 -0
- package/lib/initializer.test.d.ts +2 -0
- package/lib/initializer.test.d.ts.map +1 -0
- package/lib/initializer.test.js +64 -0
- package/lib/render.d.ts +10 -0
- package/lib/render.d.ts.map +1 -0
- package/lib/render.jsx +34 -0
- package/lib/render.test.d.ts +2 -0
- package/lib/render.test.d.ts.map +1 -0
- package/lib/render.test.jsx +70 -0
- package/lib/resolve-image.d.ts +10 -0
- package/lib/resolve-image.d.ts.map +1 -0
- package/lib/resolve-image.js +57 -0
- package/lib/resolve-image.test.d.ts +2 -0
- package/lib/resolve-image.test.d.ts.map +1 -0
- package/lib/resolve-image.test.jsx +146 -0
- package/lib/slot.d.ts +43 -0
- package/lib/slot.d.ts.map +1 -0
- package/lib/slot.jsx +184 -0
- package/lib/slot.test.d.ts +2 -0
- package/lib/slot.test.d.ts.map +1 -0
- package/lib/slot.test.jsx +325 -0
- package/lib/tests.d.ts +4 -0
- package/lib/tests.d.ts.map +1 -0
- package/lib/tests.jsx +19 -0
- package/lib/tests.test.d.ts +2 -0
- package/lib/tests.test.d.ts.map +1 -0
- package/lib/tests.test.jsx +13 -0
- package/lib/types.d.ts +9 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +1 -0
- package/lib/vcomponent.d.ts +8 -0
- package/lib/vcomponent.d.ts.map +1 -0
- package/lib/vcomponent.jsx +27 -0
- package/lib/vcomponent.test.d.ts +2 -0
- package/lib/vcomponent.test.d.ts.map +1 -0
- package/lib/vcomponent.test.jsx +51 -0
- package/package.json +1 -1
- package/preact-compat.js +93 -1
- package/preact-hooks.js +40 -1
- package/preact-jsx-runtime.js +35 -1
- package/preact.js +21 -1
- package/runtime.js +69 -1
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/** https://preactjs.com/guide/v10/preact-testing-library/ */
|
|
2
|
+
import { screen, render, fireEvent } from '@adobe/elsie/lib/tests';
|
|
3
|
+
import { PriceSummary, } from '@adobe/elsie/components/PriceSummary';
|
|
4
|
+
import { Picker, Price } from '..';
|
|
5
|
+
import { act } from 'preact/test-utils';
|
|
6
|
+
const baseProps = {
|
|
7
|
+
heading: 'Order Summary',
|
|
8
|
+
loading: false,
|
|
9
|
+
total: {
|
|
10
|
+
price: <Price amount={100} currency="USD"/>,
|
|
11
|
+
},
|
|
12
|
+
subTotal: {
|
|
13
|
+
price: <Price amount={90} currency="USD"/>,
|
|
14
|
+
},
|
|
15
|
+
shipping: {
|
|
16
|
+
price: <Price amount={10} currency="USD"/>,
|
|
17
|
+
},
|
|
18
|
+
taxTotal: {
|
|
19
|
+
price: <Price amount={10} currency="USD"/>,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
describe('Base/Components/PriceSummary', () => {
|
|
23
|
+
test('renders base props content correctly', () => {
|
|
24
|
+
const { container } = render(<PriceSummary {...baseProps}/>);
|
|
25
|
+
const loadingSkeleton = screen.queryByTestId('loading-skeleton');
|
|
26
|
+
expect(loadingSkeleton).toBeFalsy();
|
|
27
|
+
expect(!!container).toEqual(true);
|
|
28
|
+
const taxBreakdown = screen.queryByTestId('tax-breakdown');
|
|
29
|
+
expect(taxBreakdown).toBeFalsy();
|
|
30
|
+
const taxOnly = screen.queryByTestId('tax-total-only');
|
|
31
|
+
expect(taxOnly).toBeTruthy();
|
|
32
|
+
const totalWithoutTax = screen.queryByTestId('total-without-tax');
|
|
33
|
+
expect(totalWithoutTax).toBeFalsy();
|
|
34
|
+
const subTotalTaxCaption = screen.queryByTestId('sub-total-tax-caption');
|
|
35
|
+
expect(subTotalTaxCaption).toBeFalsy();
|
|
36
|
+
});
|
|
37
|
+
test('renders with loading state', () => {
|
|
38
|
+
render(<PriceSummary heading="Test" loading/>);
|
|
39
|
+
const loadingSkeleton = screen.queryByTestId('loading-skeleton');
|
|
40
|
+
expect(loadingSkeleton).toBeTruthy();
|
|
41
|
+
});
|
|
42
|
+
test('renders loading state if loading is not defined', () => {
|
|
43
|
+
render(<PriceSummary heading="Test" loading={undefined}/>);
|
|
44
|
+
const loadingSkeleton = screen.queryByTestId('loading-skeleton');
|
|
45
|
+
expect(loadingSkeleton).toBeTruthy();
|
|
46
|
+
});
|
|
47
|
+
test('renders with primary action', () => {
|
|
48
|
+
render(<PriceSummary {...baseProps} primaryAction={<button>Primary Action</button>}/>);
|
|
49
|
+
const primaryAction = screen.queryByText('Primary Action');
|
|
50
|
+
expect(primaryAction).toBeTruthy();
|
|
51
|
+
});
|
|
52
|
+
describe('Tax breakdown', () => {
|
|
53
|
+
const taxesApplied = [
|
|
54
|
+
{
|
|
55
|
+
label: 'VAT standard',
|
|
56
|
+
price: <Price amount={5} currency="USD"/>,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: 'VAT reduced',
|
|
60
|
+
price: <Price amount={5} currency="USD"/>,
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
test('renders tax breakdown but not entries on initial render', () => {
|
|
64
|
+
render(<PriceSummary {...baseProps} taxesApplied={taxesApplied}/>);
|
|
65
|
+
const taxBreakdown = screen.queryByTestId('tax-breakdown');
|
|
66
|
+
expect(taxBreakdown).toBeTruthy();
|
|
67
|
+
const taxEntries = screen.queryAllByText('VAT', { exact: false });
|
|
68
|
+
expect(taxEntries.length).toEqual(0);
|
|
69
|
+
});
|
|
70
|
+
test('reveal/hide tax breakdown entries when toggle button is pressed', () => {
|
|
71
|
+
render(<PriceSummary {...baseProps} taxesApplied={taxesApplied}/>);
|
|
72
|
+
const taxEntries = screen.queryAllByText('VAT', { exact: false });
|
|
73
|
+
expect(taxEntries.length).toEqual(0);
|
|
74
|
+
const toggleTaxBreakdown = screen.queryByRole('button');
|
|
75
|
+
expect(toggleTaxBreakdown).toBeTruthy();
|
|
76
|
+
act(() => {
|
|
77
|
+
toggleTaxBreakdown?.click();
|
|
78
|
+
});
|
|
79
|
+
const taxEntriesAfterClick = screen.queryAllByText('VAT', {
|
|
80
|
+
exact: false,
|
|
81
|
+
});
|
|
82
|
+
expect(taxEntriesAfterClick.length).toEqual(2);
|
|
83
|
+
});
|
|
84
|
+
test('renders estimated total tax', () => {
|
|
85
|
+
render(<PriceSummary {...baseProps} taxTotal={{
|
|
86
|
+
price: <Price amount={10} currency="USD"/>,
|
|
87
|
+
estimated: true,
|
|
88
|
+
}}/>);
|
|
89
|
+
const taxTotalOnly = screen.queryByTestId('tax-total-only');
|
|
90
|
+
expect(taxTotalOnly).toBeTruthy();
|
|
91
|
+
expect(taxTotalOnly?.classList).toContain('dropin-price-summary__taxTotal');
|
|
92
|
+
const label = taxTotalOnly?.getElementsByTagName('span')[0];
|
|
93
|
+
expect(label?.textContent).toMatchInlineSnapshot(`"Estimated Tax"`);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
describe('Shipping', () => {
|
|
97
|
+
const shipping = {
|
|
98
|
+
price: <Price amount={10} currency="USD"/>,
|
|
99
|
+
country: <Picker value="US"/>,
|
|
100
|
+
estimated: true,
|
|
101
|
+
destinationText: '12345',
|
|
102
|
+
};
|
|
103
|
+
test('renders entry with clickable zip if provided', () => {
|
|
104
|
+
render(<PriceSummary {...baseProps} shipping={shipping}/>);
|
|
105
|
+
const shippingZip = screen.queryByText('12345', { exact: false });
|
|
106
|
+
expect(shippingZip).toBeTruthy();
|
|
107
|
+
expect(shippingZip?.getAttribute('role')).toEqual('button');
|
|
108
|
+
// Simulate click events
|
|
109
|
+
act(() => {
|
|
110
|
+
shippingZip?.click();
|
|
111
|
+
shippingZip?.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
|
|
112
|
+
shippingZip?.dispatchEvent(new KeyboardEvent('keydown', { key: ' ' }));
|
|
113
|
+
shippingZip?.dispatchEvent(new KeyboardEvent('keydown', { key: 'a' }));
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
test('renders entry without clickable zip if not provided', () => {
|
|
117
|
+
render(<PriceSummary {...baseProps} shipping={{
|
|
118
|
+
price: <Price amount={1} currency="USD"/>,
|
|
119
|
+
estimated: true,
|
|
120
|
+
taxIncluded: true,
|
|
121
|
+
}}/>);
|
|
122
|
+
const shippingZip = screen.queryByText('12345', { exact: false });
|
|
123
|
+
expect(shippingZip).toBeFalsy();
|
|
124
|
+
const shippingContent = screen.queryByTestId('shipping-content');
|
|
125
|
+
expect(shippingContent).toMatchSnapshot();
|
|
126
|
+
});
|
|
127
|
+
describe('estimate form', () => {
|
|
128
|
+
const mockOnEstimate = jest.fn();
|
|
129
|
+
const shippingProps = {
|
|
130
|
+
price: <Price amount={10} currency="USD"/>,
|
|
131
|
+
countryField: (<select name="country" data-testid="country-field">
|
|
132
|
+
<option value="US">United States</option>
|
|
133
|
+
<option value="UK">United Kingdom</option>
|
|
134
|
+
</select>),
|
|
135
|
+
stateField: (<select name="state" data-testid="state-field">
|
|
136
|
+
<option value="CA">California</option>
|
|
137
|
+
<option value="NY">New York</option>
|
|
138
|
+
</select>),
|
|
139
|
+
zipField: <input name="zip" data-testid="zip-field"/>,
|
|
140
|
+
estimated: true,
|
|
141
|
+
destinationText: '12345',
|
|
142
|
+
onEstimate: mockOnEstimate,
|
|
143
|
+
estimateButton: <button>Estimate</button>,
|
|
144
|
+
};
|
|
145
|
+
test('renders estimate form when fields are provided', () => {
|
|
146
|
+
render(<PriceSummary {...baseProps} shipping={shippingProps}/>);
|
|
147
|
+
const countryField = screen.queryByTestId('country-field');
|
|
148
|
+
expect(countryField).toBeTruthy();
|
|
149
|
+
const zipField = screen.queryByTestId('zip-field');
|
|
150
|
+
expect(zipField).toBeTruthy();
|
|
151
|
+
// State field should not be rendered on default render
|
|
152
|
+
const stateField = screen.queryByTestId('state-field');
|
|
153
|
+
expect(stateField).not.toBeTruthy();
|
|
154
|
+
const estimateButton = screen.queryByText('Estimate');
|
|
155
|
+
expect(estimateButton).toBeTruthy();
|
|
156
|
+
});
|
|
157
|
+
test('toggles between fields when alternate field link is clicked', () => {
|
|
158
|
+
render(<PriceSummary {...baseProps} shipping={shippingProps}/>);
|
|
159
|
+
const link = screen.queryByTestId('shipping-alternate-field-link');
|
|
160
|
+
expect(link).toBeTruthy();
|
|
161
|
+
act(() => {
|
|
162
|
+
link?.click();
|
|
163
|
+
});
|
|
164
|
+
// Zip field should no longer be rendered
|
|
165
|
+
let zipField = screen.queryByTestId('zip-field');
|
|
166
|
+
expect(zipField).not.toBeTruthy();
|
|
167
|
+
let stateField = screen.queryByTestId('state-field');
|
|
168
|
+
expect(stateField).toBeTruthy();
|
|
169
|
+
// Toggle again
|
|
170
|
+
act(() => {
|
|
171
|
+
link?.click();
|
|
172
|
+
});
|
|
173
|
+
zipField = screen.queryByTestId('zip-field');
|
|
174
|
+
expect(zipField).toBeTruthy();
|
|
175
|
+
stateField = screen.queryByTestId('state-field');
|
|
176
|
+
expect(stateField).not.toBeTruthy();
|
|
177
|
+
});
|
|
178
|
+
test('hides estimate form when destination link is clicked', () => {
|
|
179
|
+
render(<PriceSummary {...baseProps} shipping={shippingProps}/>);
|
|
180
|
+
const destinationLink = screen.queryByTestId('shipping-destination-link');
|
|
181
|
+
expect(destinationLink).toBeTruthy();
|
|
182
|
+
act(() => {
|
|
183
|
+
destinationLink?.click();
|
|
184
|
+
});
|
|
185
|
+
const estimateForm = screen.queryByTestId('shipping-estimate-form');
|
|
186
|
+
expect(estimateForm?.classList).toContain('dropin-price-summary__shipping--hide');
|
|
187
|
+
});
|
|
188
|
+
test('calls onEstimate when estimate button is clicked', () => {
|
|
189
|
+
render(<PriceSummary {...baseProps} shipping={shippingProps}/>);
|
|
190
|
+
const estimateButton = screen.queryByText('Estimate');
|
|
191
|
+
expect(estimateButton).toBeTruthy();
|
|
192
|
+
const countryField = screen.queryByTestId('country-field');
|
|
193
|
+
const zipField = screen.queryByTestId('zip-field');
|
|
194
|
+
act(() => {
|
|
195
|
+
fireEvent.select(countryField, {
|
|
196
|
+
target: { value: 'UK' },
|
|
197
|
+
});
|
|
198
|
+
fireEvent.input(zipField, {
|
|
199
|
+
target: { value: '54321' },
|
|
200
|
+
});
|
|
201
|
+
estimateButton?.click();
|
|
202
|
+
});
|
|
203
|
+
expect(countryField?.value).toEqual('UK');
|
|
204
|
+
expect(zipField?.value).toEqual('54321');
|
|
205
|
+
expect(mockOnEstimate).toHaveBeenCalledTimes(1);
|
|
206
|
+
expect(mockOnEstimate.mock.calls[0][0]).toMatchInlineSnapshot(`
|
|
207
|
+
Object {
|
|
208
|
+
"country": "UK",
|
|
209
|
+
"zip": "54321",
|
|
210
|
+
}
|
|
211
|
+
`);
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
describe('Total', () => {
|
|
216
|
+
test('renders padded estimate if isEstimated is true', () => {
|
|
217
|
+
const total = {
|
|
218
|
+
price: <Price amount={100} currency="USD"/>,
|
|
219
|
+
estimated: true,
|
|
220
|
+
};
|
|
221
|
+
render(<PriceSummary {...baseProps} total={total}/>);
|
|
222
|
+
const divider = screen.queryByTestId('total-divider');
|
|
223
|
+
expect(divider).toBeFalsy();
|
|
224
|
+
const totalContent = screen.queryByTestId('total-content');
|
|
225
|
+
expect(totalContent?.classList).toContain('dropin-price-summary__total--padded');
|
|
226
|
+
const label = totalContent?.getElementsByTagName('span')[0];
|
|
227
|
+
expect(label?.textContent).toMatchInlineSnapshot(`"Estimated Total"`);
|
|
228
|
+
});
|
|
229
|
+
test('render total without tax if data is provided', () => {
|
|
230
|
+
const total = {
|
|
231
|
+
price: <Price amount={100} currency="USD"/>,
|
|
232
|
+
priceWithoutTax: <Price amount={90} currency="USD"/>,
|
|
233
|
+
};
|
|
234
|
+
render(<PriceSummary {...baseProps} total={total}/>);
|
|
235
|
+
const totalWithoutTax = screen.queryByTestId('total-without-tax');
|
|
236
|
+
expect(totalWithoutTax).toBeTruthy();
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
describe('Subtotal', () => {
|
|
240
|
+
test('renders subtotal with tax if isTaxIncluded is true', () => {
|
|
241
|
+
const subTotal = {
|
|
242
|
+
price: <Price amount={90} currency="USD"/>,
|
|
243
|
+
taxIncluded: true,
|
|
244
|
+
};
|
|
245
|
+
render(<PriceSummary {...baseProps} subTotal={subTotal}/>);
|
|
246
|
+
const subTotalTaxCaption = screen.queryByTestId('sub-total-tax-caption');
|
|
247
|
+
expect(subTotalTaxCaption).toBeTruthy();
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
describe('Discounts', () => {
|
|
251
|
+
test('renders discounts if provided', () => {
|
|
252
|
+
const discounts = [
|
|
253
|
+
{
|
|
254
|
+
label: 'Discount-1',
|
|
255
|
+
price: <Price amount={-10} currency="USD"/>,
|
|
256
|
+
caption: <span>Discount Caption</span>,
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
label: 'Discount-2',
|
|
260
|
+
price: <Price amount={-10} currency="USD"/>,
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
label: 'Discount-3',
|
|
264
|
+
price: <Price amount={-10} currency="USD"/>,
|
|
265
|
+
caption: <span>Discount Caption</span>,
|
|
266
|
+
},
|
|
267
|
+
];
|
|
268
|
+
render(<PriceSummary {...baseProps} discounts={discounts}/>);
|
|
269
|
+
const discountLabel = screen.queryAllByText('Discount-', {
|
|
270
|
+
exact: false,
|
|
271
|
+
});
|
|
272
|
+
expect(discountLabel).toHaveLength(3);
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PriceSummary/index.ts"],"names":[],"mappings":"AAAA,cAAc,mDAAmD,CAAC;AAClE,OAAO,EAAE,YAAY,IAAI,OAAO,EAAE,MAAM,mDAAmD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
import '@adobe/elsie/components/ProgressSpinner/ProgressSpinner.css';
|
|
4
|
+
/**
|
|
5
|
+
* @param size this is the size of the spinner ranging in [12px, 24px, 36px, 48px]
|
|
6
|
+
* @param stroke this is the stroke of the spinner ranging in [1px, 2px, 3px, 4px]
|
|
7
|
+
*/
|
|
8
|
+
export interface ProgressSpinnerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'size'> {
|
|
9
|
+
ariaLabel?: string;
|
|
10
|
+
size?: 'small' | 'medium' | 'big' | 'large';
|
|
11
|
+
stroke?: '1' | '2' | '3' | '4';
|
|
12
|
+
}
|
|
13
|
+
export declare const ProgressSpinner: FunctionComponent<ProgressSpinnerProps>;
|
|
14
|
+
//# sourceMappingURL=ProgressSpinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressSpinner.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressSpinner/ProgressSpinner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C,OAAO,6DAA6D,CAAC;AAErE;;;GAGG;AACH,MAAM,WAAW,oBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;IAC5C,MAAM,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAChC;AAED,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,CA0DnE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useText } from '@adobe/elsie/i18n';
|
|
2
|
+
import { classes } from '@adobe/elsie/lib';
|
|
3
|
+
import '@adobe/elsie/components/ProgressSpinner/ProgressSpinner.css';
|
|
4
|
+
export const ProgressSpinner = ({ ariaLabel, size = 'small', stroke = '4', children, className, style, ...props }) => {
|
|
5
|
+
const commonClasses = [
|
|
6
|
+
'dropin-progress-spinner',
|
|
7
|
+
`dropin-progress-spinner--shape-size-${size}`,
|
|
8
|
+
`dropin-progress-spinner--shape-stroke-${stroke}`,
|
|
9
|
+
];
|
|
10
|
+
const translations = useText({
|
|
11
|
+
updating: 'Dropin.ProgressSpinner.updating.label',
|
|
12
|
+
updatingChildren: 'Dropin.ProgressSpinner.updatingChildren.label',
|
|
13
|
+
});
|
|
14
|
+
const handleAriaLabel = () => {
|
|
15
|
+
if (ariaLabel)
|
|
16
|
+
return ariaLabel;
|
|
17
|
+
return children ? translations.updatingChildren : translations.updating;
|
|
18
|
+
};
|
|
19
|
+
return children ? (
|
|
20
|
+
// if we provide children to this component, it should act as a provider in order to add background with low opacity
|
|
21
|
+
<div {...props} className={classes(['dropin-progress-spinner-provider'])} aria-live="polite" role="status">
|
|
22
|
+
<div aria-hidden={true}>{children}</div>
|
|
23
|
+
<div aria-label={handleAriaLabel()} role="status" className={classes(['dropin-progress-spinner-background', className])} style={style}/>
|
|
24
|
+
<div className={classes([
|
|
25
|
+
'dropin-progress-spinner-with-provider',
|
|
26
|
+
...commonClasses,
|
|
27
|
+
])} aria-hidden={true}/>
|
|
28
|
+
</div>) : (
|
|
29
|
+
// if there are no children, it should be able to be standalone and have no background
|
|
30
|
+
<div {...props} className={classes([className, ...commonClasses])} aria-live="polite" role="status" aria-label={handleAriaLabel()}/>);
|
|
31
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/preact';
|
|
2
|
+
import { ProgressSpinnerProps } from '@adobe/elsie/components/ProgressSpinner';
|
|
3
|
+
/**
|
|
4
|
+
* Use Progress Spinners to display ongoing activity or loading status.
|
|
5
|
+
*/
|
|
6
|
+
declare const meta: Meta<ProgressSpinnerProps>;
|
|
7
|
+
export default meta;
|
|
8
|
+
type Story = StoryObj<ProgressSpinnerProps>;
|
|
9
|
+
/**
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { ProgressSpinner } from '@adobe/elsie/components/ProgressSpinner';
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare const SmallSpinner: Story;
|
|
15
|
+
export declare const LargeSpinnerWithCard: Story;
|
|
16
|
+
export declare const MediumSpinnerWithRadio: Story;
|
|
17
|
+
export declare const SmallSpinnerReplaceButton: Story;
|
|
18
|
+
export declare const SpinnerForBoxShadow: Story;
|
|
19
|
+
//# sourceMappingURL=ProgressSpinner.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressSpinner.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressSpinner/ProgressSpinner.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAwB,EAEtB,oBAAoB,EACrB,MAAM,yCAAyC,CAAC;AAIjD;;GAEG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,oBAAoB,CAsDpC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,oBAAoB,CAAC,CAAC;AAE5C;;;;GAIG;AAEH,eAAO,MAAM,YAAY,EAAE,KAe1B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KAwClC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,KAoDpC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,KA4DvC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAgDjC,CAAC"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
// https://storybook.js.org/docs/7.0/preact/writing-stories/introduction
|
|
2
|
+
import { expect } from '@storybook/jest';
|
|
3
|
+
import ProgressSpinner, { ProgressSpinner as component, } from '@adobe/elsie/components/ProgressSpinner';
|
|
4
|
+
import { Search } from '@adobe/elsie/icons';
|
|
5
|
+
import { ActionButton, Button, Card, Icon, RadioButton, ImageSwatch } from '..';
|
|
6
|
+
/**
|
|
7
|
+
* Use Progress Spinners to display ongoing activity or loading status.
|
|
8
|
+
*/
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'Components/ProgressSpinner',
|
|
11
|
+
component,
|
|
12
|
+
argTypes: {
|
|
13
|
+
size: {
|
|
14
|
+
control: {
|
|
15
|
+
type: 'select',
|
|
16
|
+
},
|
|
17
|
+
table: {
|
|
18
|
+
defaultValue: {
|
|
19
|
+
summary: 'small',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
options: ['small', 'medium', 'big', 'large'],
|
|
23
|
+
description: 'Size of the spinner',
|
|
24
|
+
},
|
|
25
|
+
stroke: {
|
|
26
|
+
control: {
|
|
27
|
+
type: 'select',
|
|
28
|
+
},
|
|
29
|
+
table: {
|
|
30
|
+
defaultValue: {
|
|
31
|
+
summary: '4',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
options: ['1', '2', '3', '4'],
|
|
35
|
+
description: 'Stroke of the spinner',
|
|
36
|
+
},
|
|
37
|
+
// added @ts-ignore because it is not a prop
|
|
38
|
+
//@ts-ignore
|
|
39
|
+
active: {
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
table: {
|
|
42
|
+
defaultValue: {
|
|
43
|
+
summary: 'true',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
options: [true, false],
|
|
47
|
+
description: 'Whether the spinner is active or not (not a prop, just for story).',
|
|
48
|
+
},
|
|
49
|
+
ariaLabel: {
|
|
50
|
+
type: {
|
|
51
|
+
required: false,
|
|
52
|
+
name: 'string',
|
|
53
|
+
},
|
|
54
|
+
table: {
|
|
55
|
+
defaultValue: {
|
|
56
|
+
summary: 'Updating',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
description: 'Aria label for the spinner',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
export default meta;
|
|
64
|
+
/**
|
|
65
|
+
* ```ts
|
|
66
|
+
* import { ProgressSpinner } from '@adobe/elsie/components/ProgressSpinner';
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export const SmallSpinner = {
|
|
70
|
+
args: {
|
|
71
|
+
ariaLabel: 'Updating',
|
|
72
|
+
size: 'small',
|
|
73
|
+
stroke: '4',
|
|
74
|
+
},
|
|
75
|
+
render: ({ ariaLabel, size, stroke }) => (<ProgressSpinner aria-label={ariaLabel} size={size} stroke={stroke}/>),
|
|
76
|
+
play: async () => {
|
|
77
|
+
const loaderIcon = document.querySelector('div[class*="dropin-progress-spinner"]');
|
|
78
|
+
await expect(loaderIcon).toBeVisible();
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
export const LargeSpinnerWithCard = {
|
|
82
|
+
args: {
|
|
83
|
+
ariaLabel: 'Updating',
|
|
84
|
+
size: 'large',
|
|
85
|
+
stroke: '4',
|
|
86
|
+
//@ts-ignore
|
|
87
|
+
active: true,
|
|
88
|
+
},
|
|
89
|
+
//@ts-ignore
|
|
90
|
+
render: ({ ariaLabel, size, stroke, active }) => {
|
|
91
|
+
const components = (<Card variant={'secondary'}>
|
|
92
|
+
<h2 style={{ font: 'var(--type-headline-2-strong-font)' }}>Title</h2>
|
|
93
|
+
<p style={{ font: 'var(--type-body-2-default-font)' }}>
|
|
94
|
+
This is a short description of the item and should be kept to two or
|
|
95
|
+
three lines as maximum.
|
|
96
|
+
</p>
|
|
97
|
+
<ActionButton disabled={active} children={'Action'}/>
|
|
98
|
+
</Card>);
|
|
99
|
+
return active ? (<ProgressSpinner aria-label={ariaLabel} size={size} stroke={stroke} style={{ backgroundColor: 'var(--color-neutral-200);' }}>
|
|
100
|
+
{components}
|
|
101
|
+
</ProgressSpinner>) : (components);
|
|
102
|
+
},
|
|
103
|
+
play: async () => {
|
|
104
|
+
const loaderIcon = document.querySelector('div[class*="dropin-progress-spinner"]');
|
|
105
|
+
await expect(loaderIcon).toBeVisible();
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
export const MediumSpinnerWithRadio = {
|
|
109
|
+
args: {
|
|
110
|
+
ariaLabel: 'Updating',
|
|
111
|
+
size: 'medium',
|
|
112
|
+
stroke: '4',
|
|
113
|
+
//@ts-ignore
|
|
114
|
+
active: true,
|
|
115
|
+
},
|
|
116
|
+
//@ts-ignore
|
|
117
|
+
render: ({ ariaLabel, size, stroke, active }) => {
|
|
118
|
+
const components = (<div>
|
|
119
|
+
<p style={{ font: 'var(--type-body-2-default-font)' }}>
|
|
120
|
+
This is a short description of the item and should be kept to two or
|
|
121
|
+
three lines as maximum.
|
|
122
|
+
</p>
|
|
123
|
+
<RadioButton label={'Option 1'} value={'1'} name={'radio'} description={'first option'} disabled={active}/>
|
|
124
|
+
<RadioButton label={'Option 2'} value={'2'} name={'radio'} description={'second option'} disabled={active}/>
|
|
125
|
+
</div>);
|
|
126
|
+
return (<Card variant={'secondary'}>
|
|
127
|
+
<h2 style={{ font: 'var(--type-headline-2-strong-font)' }}>Title</h2>
|
|
128
|
+
{active ? (<ProgressSpinner aria-label={ariaLabel} size={size} stroke={stroke}>
|
|
129
|
+
{components}
|
|
130
|
+
</ProgressSpinner>) : (components)}
|
|
131
|
+
</Card>);
|
|
132
|
+
},
|
|
133
|
+
play: async () => {
|
|
134
|
+
const loaderIcon = document.querySelector('div[class*="dropin-progress-spinner"]');
|
|
135
|
+
await expect(loaderIcon).toBeVisible();
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
export const SmallSpinnerReplaceButton = {
|
|
139
|
+
args: {
|
|
140
|
+
ariaLabel: 'Updating',
|
|
141
|
+
size: 'small',
|
|
142
|
+
stroke: '2',
|
|
143
|
+
//@ts-ignore
|
|
144
|
+
active: true,
|
|
145
|
+
},
|
|
146
|
+
//@ts-ignore
|
|
147
|
+
render: ({ ariaLabel, size, stroke, active }) => (<Card variant={'secondary'}>
|
|
148
|
+
<h2 style={{ font: 'var(--type-headline-2-strong-font)' }}>Title</h2>
|
|
149
|
+
<p style={{ font: 'var(--type-body-2-default-font)' }}>
|
|
150
|
+
This is a short description of the item and should be kept to two or
|
|
151
|
+
three lines as maximum.
|
|
152
|
+
</p>
|
|
153
|
+
<div>
|
|
154
|
+
<Button size="medium" style={{
|
|
155
|
+
width: '100%',
|
|
156
|
+
background: 'var(--color-brand-500) 0 0% no-repeat padding-box',
|
|
157
|
+
}} aria-hidden={active} aria-label={active ? 'loading' : 'Action'} disabled={active} children={active
|
|
158
|
+
? [
|
|
159
|
+
<ProgressSpinner aria-label={ariaLabel} tabIndex={-1} size={size} stroke={stroke} key="spinner"/>,
|
|
160
|
+
]
|
|
161
|
+
: [
|
|
162
|
+
'Action!',
|
|
163
|
+
<Icon source={Search} size="24" className="storybook_icon" stroke="1" viewBox="0 0 24 24" aria-label="Search" key={'4'}/>,
|
|
164
|
+
]}/>
|
|
165
|
+
</div>
|
|
166
|
+
</Card>),
|
|
167
|
+
play: async () => {
|
|
168
|
+
const loaderIcon = document.querySelector('div[class*="dropin-progress-spinner"]');
|
|
169
|
+
await expect(loaderIcon).toBeVisible();
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
export const SpinnerForBoxShadow = {
|
|
173
|
+
args: {
|
|
174
|
+
ariaLabel: 'Updating',
|
|
175
|
+
size: 'small',
|
|
176
|
+
stroke: '2',
|
|
177
|
+
},
|
|
178
|
+
render: ({ ariaLabel, size, stroke }) => {
|
|
179
|
+
return (<ProgressSpinner aria-label={ariaLabel} size={size} stroke={stroke}>
|
|
180
|
+
<div style={{
|
|
181
|
+
display: 'flex',
|
|
182
|
+
justifyContent: 'space-between',
|
|
183
|
+
gap: '20px',
|
|
184
|
+
}}>
|
|
185
|
+
<ImageSwatch name="imageSwatchField" id="imageSwatchExample1" src="https://picsum.photos/20/20" value="imageExample" disabled={true}/>
|
|
186
|
+
<ImageSwatch name="imageSwatchField" id="imageSwatchExample2" src="https://picsum.photos/20/20" value="imageExample" disabled={true}/>
|
|
187
|
+
<ImageSwatch name="imageSwatchField" id="imageSwatchExample3" src="https://picsum.photos/20/20" value="imageExample" selected={true} disabled={true}/>
|
|
188
|
+
</div>
|
|
189
|
+
</ProgressSpinner>);
|
|
190
|
+
},
|
|
191
|
+
play: async () => {
|
|
192
|
+
const loaderIcon = document.querySelector('div[class*="dropin-progress-spinner"]');
|
|
193
|
+
await expect(loaderIcon).toBeVisible();
|
|
194
|
+
},
|
|
195
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressSpinner.test.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressSpinner/ProgressSpinner.test.tsx"],"names":[],"mappings":"AAAA,6DAA6D"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** https://preactjs.com/guide/v10/preact-testing-library/ */
|
|
2
|
+
import { render } from '@adobe/elsie/lib/tests';
|
|
3
|
+
import { ProgressSpinner } from '@adobe/elsie/components/ProgressSpinner';
|
|
4
|
+
import { ActionButton, Button } from '..';
|
|
5
|
+
describe('Base/Components/ProgressSpinner', () => {
|
|
6
|
+
test('renders standalone', () => {
|
|
7
|
+
const { container } = render(<ProgressSpinner />);
|
|
8
|
+
const elem = container.querySelector('.dropin-progress-spinner');
|
|
9
|
+
expect(!!elem).toEqual(true);
|
|
10
|
+
expect(container).toMatchSnapshot();
|
|
11
|
+
});
|
|
12
|
+
test('renders with children', () => {
|
|
13
|
+
const { container } = render(<ProgressSpinner size={'medium'}>
|
|
14
|
+
<p style={{ font: 'var(--type-body-2-default-font)' }}>
|
|
15
|
+
This is a short description of the item and should be kept to two or
|
|
16
|
+
three lines as maximum.
|
|
17
|
+
</p>
|
|
18
|
+
<ActionButton children={'Action'}/>
|
|
19
|
+
</ProgressSpinner>);
|
|
20
|
+
const elem = container.querySelector('.dropin-progress-spinner');
|
|
21
|
+
expect(!!elem).toEqual(true);
|
|
22
|
+
expect(container).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
test('renders inside a button', () => {
|
|
25
|
+
const { container } = render(<Button size="medium" style={{ width: '100%' }} children={[
|
|
26
|
+
[
|
|
27
|
+
<ProgressSpinner tabIndex={-1} size={'small'} stroke={'2'} key="2"/>,
|
|
28
|
+
],
|
|
29
|
+
]}/>);
|
|
30
|
+
const elem = container.querySelector('.dropin-progress-spinner');
|
|
31
|
+
expect(!!elem).toEqual(true);
|
|
32
|
+
expect(container).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
test('renders with aria-label', () => {
|
|
35
|
+
const { container } = render(<ProgressSpinner ariaLabel="Updating"/>);
|
|
36
|
+
const elem = container.querySelector('.dropin-progress-spinner');
|
|
37
|
+
expect(!!elem).toEqual(true);
|
|
38
|
+
expect(container).toMatchSnapshot();
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressSpinner/index.ts"],"names":[],"mappings":"AAAA,cAAc,yDAAyD,CAAC;AACxE,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,yDAAyD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FunctionComponent, VNode } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
import '@adobe/elsie/components/RadioButton/RadioButton.css';
|
|
4
|
+
export interface RadioButtonProps extends Omit<HTMLAttributes<HTMLInputElement>, 'size' | 'label'> {
|
|
5
|
+
label: string | VNode<HTMLAttributes<HTMLElement>>;
|
|
6
|
+
name: string;
|
|
7
|
+
value: string;
|
|
8
|
+
size?: 'medium' | 'large';
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
error?: boolean;
|
|
12
|
+
description?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const RadioButton: FunctionComponent<RadioButtonProps>;
|
|
15
|
+
//# sourceMappingURL=RadioButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioButton.d.ts","sourceRoot":"","sources":["../../../src/components/RadioButton/RadioButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,qDAAqD,CAAC;AAE7D,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChE,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,CAwD3D,CAAC"}
|