@dropins/tools 0.21.1-beta1 → 0.21.2-alpha1
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,90 @@
|
|
|
1
|
+
import { IllustratedMessage as component, } from '@adobe/elsie/components/IllustratedMessage';
|
|
2
|
+
import { Placeholder } from '@adobe/elsie/icons';
|
|
3
|
+
import { Button, Icon } from '@adobe/elsie/components';
|
|
4
|
+
import { expect } from '@storybook/jest';
|
|
5
|
+
import { IconsList } from '@adobe/elsie/components/Icon/Icon.stories.helpers';
|
|
6
|
+
/**
|
|
7
|
+
* Use IllustratedMessages to display an illustration and a message, usually for an empty state or an error page.
|
|
8
|
+
*/
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'Components/IllustratedMessage',
|
|
11
|
+
component,
|
|
12
|
+
argTypes: {
|
|
13
|
+
icon: {
|
|
14
|
+
description: 'Icon to display in the IllustratedMessage.',
|
|
15
|
+
table: {
|
|
16
|
+
type: { summary: 'FunctionComponent', required: false },
|
|
17
|
+
},
|
|
18
|
+
options: Object.keys(IconsList),
|
|
19
|
+
mapping: IconsList,
|
|
20
|
+
control: { type: 'select', defaultValue: 'Placeholder' },
|
|
21
|
+
},
|
|
22
|
+
heading: {
|
|
23
|
+
description: 'Heading text to display in the IllustratedMessage.',
|
|
24
|
+
control: { type: 'text' },
|
|
25
|
+
type: { name: 'string', required: false },
|
|
26
|
+
},
|
|
27
|
+
headingLevel: {
|
|
28
|
+
description: 'Heading level to display in the IllustratedMessage.',
|
|
29
|
+
control: { type: 'select', default: 2 },
|
|
30
|
+
options: [1, 2, 3, 4, 5, 6],
|
|
31
|
+
type: { name: 'string', required: false },
|
|
32
|
+
},
|
|
33
|
+
message: {
|
|
34
|
+
description: 'Message to display in the IllustratedMessage.',
|
|
35
|
+
options: ['Short', 'Long'],
|
|
36
|
+
mapping: {
|
|
37
|
+
Short: <div>Short message</div>,
|
|
38
|
+
Long: (<div>
|
|
39
|
+
Illustrated message with an extremely extremely long message
|
|
40
|
+
</div>),
|
|
41
|
+
},
|
|
42
|
+
control: {
|
|
43
|
+
type: 'select',
|
|
44
|
+
labels: {
|
|
45
|
+
Short: 'Short message',
|
|
46
|
+
Long: 'Long message',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
table: {
|
|
50
|
+
type: { summary: 'FunctionComponent', required: false },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
action: {
|
|
54
|
+
description: 'Action to display in the IllustratedMessage.',
|
|
55
|
+
control: { type: 'function' },
|
|
56
|
+
table: {
|
|
57
|
+
type: { summary: 'FunctionComponent', required: false },
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
variant: {
|
|
61
|
+
description: 'Variant to display in the IllustratedMessage.',
|
|
62
|
+
control: { type: 'radio', default: 'secondary' },
|
|
63
|
+
options: ['primary', 'secondary'],
|
|
64
|
+
type: { name: 'string', required: false },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
export default meta;
|
|
69
|
+
export const IllustratedMessage = {
|
|
70
|
+
args: {
|
|
71
|
+
icon: <Icon source={Placeholder} size="80"/>,
|
|
72
|
+
heading: 'Illustrated Message heading',
|
|
73
|
+
headingLevel: 3,
|
|
74
|
+
message: <p>Illustrated Message text content</p>,
|
|
75
|
+
action: <Button>Illustrated Message action</Button>,
|
|
76
|
+
variant: 'secondary',
|
|
77
|
+
},
|
|
78
|
+
play: async () => {
|
|
79
|
+
const illustratedMessage = document.querySelector('div[class*="dropin-illustrated-message"]');
|
|
80
|
+
await expect(illustratedMessage).toBeVisible();
|
|
81
|
+
const icon = illustratedMessage.querySelector('.dropin-illustrated-message__icon');
|
|
82
|
+
await expect(icon).toBeVisible();
|
|
83
|
+
const heading = illustratedMessage.querySelector('.dropin-illustrated-message__heading');
|
|
84
|
+
await expect(heading).toBeVisible();
|
|
85
|
+
const message = illustratedMessage.querySelector('.dropin-illustrated-message__message');
|
|
86
|
+
await expect(message).toBeVisible();
|
|
87
|
+
const action = illustratedMessage.querySelector('.dropin-illustrated-message__action');
|
|
88
|
+
await expect(action).toBeVisible();
|
|
89
|
+
},
|
|
90
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IllustratedMessage.test.d.ts","sourceRoot":"","sources":["../../../src/components/IllustratedMessage/IllustratedMessage.test.tsx"],"names":[],"mappings":"AAAA,6DAA6D"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** https://preactjs.com/guide/v10/preact-testing-library/ */
|
|
2
|
+
import { render } from '@adobe/elsie/lib/tests';
|
|
3
|
+
import { IllustratedMessage } from '@adobe/elsie/components/IllustratedMessage';
|
|
4
|
+
import { Button } from '@adobe/elsie/components';
|
|
5
|
+
describe('Base/Components/IllustratedMessage', () => {
|
|
6
|
+
test('renders', () => {
|
|
7
|
+
const { container } = render(<IllustratedMessage />);
|
|
8
|
+
expect(!!container).toEqual(true);
|
|
9
|
+
expect(container).toMatchSnapshot();
|
|
10
|
+
const component = container.querySelector('.dropin-illustrated-message');
|
|
11
|
+
expect(component).not.toBeNull();
|
|
12
|
+
});
|
|
13
|
+
test('renders with icon, heading and message', () => {
|
|
14
|
+
const { container } = render(<IllustratedMessage icon={<svg />} heading={'heading'} message={<p>message</p>} action={<Button>action</Button>}/>);
|
|
15
|
+
expect(!!container).toEqual(true);
|
|
16
|
+
expect(container).toMatchSnapshot();
|
|
17
|
+
const icon = container.querySelector('.dropin-illustrated-message__icon');
|
|
18
|
+
expect(icon).not.toBeNull();
|
|
19
|
+
const heading = container.querySelector('.dropin-illustrated-message__heading');
|
|
20
|
+
expect(heading).not.toBeNull();
|
|
21
|
+
const message = container.querySelector('.dropin-illustrated-message__message');
|
|
22
|
+
expect(message).not.toBeNull();
|
|
23
|
+
const action = container.querySelector('.dropin-illustrated-message__action');
|
|
24
|
+
expect(action).not.toBeNull();
|
|
25
|
+
});
|
|
26
|
+
test('renders H1 when heading level is 1', () => {
|
|
27
|
+
const { container } = render(<IllustratedMessage heading={'heading'} headingLevel={1}/>);
|
|
28
|
+
expect(!!container).toEqual(true);
|
|
29
|
+
expect(container).toMatchSnapshot();
|
|
30
|
+
const heading = container.querySelector('.dropin-illustrated-message__heading');
|
|
31
|
+
expect(heading?.tagName).toEqual('H1');
|
|
32
|
+
});
|
|
33
|
+
test('renders H2 when heading level is unknown', () => {
|
|
34
|
+
const { container } = render(
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
<IllustratedMessage heading={'heading'} headingLevel={0}/>);
|
|
37
|
+
expect(!!container).toEqual(true);
|
|
38
|
+
expect(container).toMatchSnapshot();
|
|
39
|
+
const heading = container.querySelector('.dropin-illustrated-message__heading');
|
|
40
|
+
expect(heading?.tagName).toEqual('H2');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/IllustratedMessage/index.ts"],"names":[],"mappings":"AAAA,cAAc,+DAA+D,CAAC;AAC9E,OAAO,EAAE,kBAAkB,IAAI,OAAO,EAAE,MAAM,+DAA+D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
import { ResolveImageUrlOptions } from '@adobe/elsie/lib';
|
|
4
|
+
import '@adobe/elsie/components/Image/Image.css';
|
|
5
|
+
export interface ImageProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
params?: ResolveImageUrlOptions;
|
|
7
|
+
src: string;
|
|
8
|
+
onLoad?: (e: any) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const Image: FunctionComponent<ImageProps>;
|
|
11
|
+
//# sourceMappingURL=Image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/components/Image/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAqB,MAAM,eAAe,CAAC;AAClE,OAAO,EAGL,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,yCAAyC,CAAC;AAEjD,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,cAAc,CAAC;IAChE,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;CAC3B;AACD,eAAO,MAAM,KAAK,EAAE,iBAAiB,CAAC,UAAU,CA0C/C,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useMemo, useState } from 'preact/compat';
|
|
2
|
+
import { classes, generateSrcset, } from '@adobe/elsie/lib';
|
|
3
|
+
import '@adobe/elsie/components/Image/Image.css';
|
|
4
|
+
export const Image = ({ className, src, params, loading = 'lazy', srcSet, onLoad, ...props }) => {
|
|
5
|
+
const [loaded, setLoaded] = useState(false);
|
|
6
|
+
const _srcSet = useMemo(() => {
|
|
7
|
+
// If srcSet is provided, use it
|
|
8
|
+
if (srcSet)
|
|
9
|
+
return srcSet;
|
|
10
|
+
// If src is not provided, return "undefined"
|
|
11
|
+
if (!src || !params)
|
|
12
|
+
return;
|
|
13
|
+
// Otherwise, generate srcSet based on params
|
|
14
|
+
return generateSrcset(src, { ...params });
|
|
15
|
+
}, [params, src, srcSet]);
|
|
16
|
+
// Add class at image onLoad
|
|
17
|
+
const onLoadHandler = (e) => {
|
|
18
|
+
setLoaded(true);
|
|
19
|
+
onLoad?.(e);
|
|
20
|
+
};
|
|
21
|
+
return (<img {...props} className={classes([
|
|
22
|
+
'dropin-image',
|
|
23
|
+
['dropin-image--loaded', loaded],
|
|
24
|
+
className,
|
|
25
|
+
])} loading={loading} onLoad={onLoadHandler} src={src} srcSet={_srcSet}/>);
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/preact';
|
|
2
|
+
import { ImageProps } from '@adobe/elsie/components/Image';
|
|
3
|
+
/**
|
|
4
|
+
* Use Images to display visual content like photos and illustrations.
|
|
5
|
+
*/
|
|
6
|
+
declare const meta: Meta<ImageProps>;
|
|
7
|
+
export default meta;
|
|
8
|
+
type Story = StoryObj<ImageProps>;
|
|
9
|
+
export declare const Primary: Story;
|
|
10
|
+
export declare const WithParams: Story;
|
|
11
|
+
//# sourceMappingURL=Image.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Image/Image.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAS,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAMlE;;GAEG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UAAU,CA+B1B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;AAElC,eAAO,MAAM,OAAO,EAAE,KAgBrB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KASxB,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Image } from '@adobe/elsie/components/Image';
|
|
2
|
+
import { expect } from '@storybook/jest';
|
|
3
|
+
const defaultWidth = 384;
|
|
4
|
+
const defaultHeight = 288;
|
|
5
|
+
/**
|
|
6
|
+
* Use Images to display visual content like photos and illustrations.
|
|
7
|
+
*/
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Components/Image',
|
|
10
|
+
component: Image,
|
|
11
|
+
argTypes: {
|
|
12
|
+
width: {
|
|
13
|
+
description: 'Image width',
|
|
14
|
+
type: 'number',
|
|
15
|
+
},
|
|
16
|
+
height: {
|
|
17
|
+
description: 'Image height',
|
|
18
|
+
type: 'number',
|
|
19
|
+
},
|
|
20
|
+
loading: {
|
|
21
|
+
description: 'Loading strategy',
|
|
22
|
+
control: {
|
|
23
|
+
type: 'select',
|
|
24
|
+
},
|
|
25
|
+
table: {
|
|
26
|
+
defaultValue: {
|
|
27
|
+
summary: 'lazy',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
options: ['lazy', 'eager'],
|
|
31
|
+
},
|
|
32
|
+
params: {
|
|
33
|
+
description: 'Parameters appened to the image URL',
|
|
34
|
+
control: {
|
|
35
|
+
type: 'object',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export default meta;
|
|
41
|
+
export const Primary = {
|
|
42
|
+
args: {
|
|
43
|
+
src: `https://picsum.photos/${defaultWidth}/${defaultHeight}`,
|
|
44
|
+
alt: 'Some alternative text',
|
|
45
|
+
loading: 'lazy',
|
|
46
|
+
width: defaultWidth,
|
|
47
|
+
height: defaultHeight,
|
|
48
|
+
},
|
|
49
|
+
play: async () => {
|
|
50
|
+
const elem = document.querySelector('.dropin-image');
|
|
51
|
+
await expect(elem).toBeVisible();
|
|
52
|
+
// Without this wait test failing intermittently as Simulate loading delay (adjust the timeout as needed)
|
|
53
|
+
await new Promise((resolve) => setTimeout(resolve, 3500));
|
|
54
|
+
await expect(elem).toHaveClass('dropin-image--loaded');
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
export const WithParams = {
|
|
58
|
+
args: {
|
|
59
|
+
src: `https://picsum.photos/${defaultWidth}/${defaultHeight}`,
|
|
60
|
+
params: { width: defaultWidth },
|
|
61
|
+
alt: 'Some alternative text',
|
|
62
|
+
loading: 'lazy',
|
|
63
|
+
width: defaultWidth,
|
|
64
|
+
height: defaultHeight,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.test.d.ts","sourceRoot":"","sources":["../../../src/components/Image/Image.test.tsx"],"names":[],"mappings":"AAAA,6DAA6D"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/** https://preactjs.com/guide/v10/preact-testing-library/ */
|
|
2
|
+
import { render, waitFor } from '@adobe/elsie/lib/tests';
|
|
3
|
+
import { Image } from '@adobe/elsie/components/Image';
|
|
4
|
+
import { fireEvent } from '@storybook/testing-library';
|
|
5
|
+
describe('Image', () => {
|
|
6
|
+
test('renders plain', () => {
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
const { container } = render(<Image />);
|
|
9
|
+
const elem = container.querySelector('.dropin-image');
|
|
10
|
+
expect(elem).toMatchInlineSnapshot(`
|
|
11
|
+
<img
|
|
12
|
+
class="dropin-image"
|
|
13
|
+
loading="lazy"
|
|
14
|
+
/>
|
|
15
|
+
`);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
describe('onLoad of image', () => {
|
|
19
|
+
test('adds class', async () => {
|
|
20
|
+
const onLoadHandler = jest.fn();
|
|
21
|
+
const { container } = render(<Image src="/test.jpg" onLoad={onLoadHandler}/>);
|
|
22
|
+
const elem = container.querySelector('.dropin-image');
|
|
23
|
+
expect(elem.classList.contains('dropin-image--loaded')).toEqual(false);
|
|
24
|
+
await waitFor(() => {
|
|
25
|
+
fireEvent.load(elem);
|
|
26
|
+
});
|
|
27
|
+
expect(onLoadHandler).toHaveBeenCalledTimes(1);
|
|
28
|
+
expect(elem.classList.contains('dropin-image--loaded')).toEqual(true);
|
|
29
|
+
expect(elem).toMatchInlineSnapshot(`
|
|
30
|
+
<img
|
|
31
|
+
class="dropin-image dropin-image--loaded"
|
|
32
|
+
loading="lazy"
|
|
33
|
+
src="/test.jpg"
|
|
34
|
+
/>
|
|
35
|
+
`);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
describe('renders with src', () => {
|
|
39
|
+
test('renders', () => {
|
|
40
|
+
const { container } = render(<Image src="/test2.jpg"/>);
|
|
41
|
+
const elem = container.querySelector('.dropin-image');
|
|
42
|
+
expect(elem).toMatchInlineSnapshot(`
|
|
43
|
+
<img
|
|
44
|
+
class="dropin-image"
|
|
45
|
+
loading="lazy"
|
|
46
|
+
src="/test2.jpg"
|
|
47
|
+
/>
|
|
48
|
+
`);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
describe('renders with properties and custom srcSet', () => {
|
|
52
|
+
test('renders', () => {
|
|
53
|
+
const { container } = render(<Image src="/test3.jpg" alt="This is a test" width="900" height="600" loading="eager" srcSet="/test3.jpg 900w, /test3.jpg 1200w, /test3.jpg 1800w"/>);
|
|
54
|
+
const elem = container.querySelector('.dropin-image');
|
|
55
|
+
expect(elem).toMatchInlineSnapshot(`
|
|
56
|
+
<img
|
|
57
|
+
alt="This is a test"
|
|
58
|
+
class="dropin-image"
|
|
59
|
+
height="600"
|
|
60
|
+
loading="eager"
|
|
61
|
+
src="/test3.jpg"
|
|
62
|
+
srcset="/test3.jpg 900w, /test3.jpg 1200w, /test3.jpg 1800w"
|
|
63
|
+
width="900"
|
|
64
|
+
/>
|
|
65
|
+
`);
|
|
66
|
+
});
|
|
67
|
+
test('renders with params', () => {
|
|
68
|
+
const { container } = render(<Image src="/test4.jpg" params={{ width: 900 }}/>);
|
|
69
|
+
const elem = container.querySelector('.dropin-image');
|
|
70
|
+
expect(elem).toMatchInlineSnapshot(`
|
|
71
|
+
<img
|
|
72
|
+
class="dropin-image"
|
|
73
|
+
loading="lazy"
|
|
74
|
+
src="/test4.jpg"
|
|
75
|
+
srcset="/test4.jpg?auto=webp&quality=80&crop=false&fit=cover&width=360 768w,
|
|
76
|
+
/test4.jpg?auto=webp&quality=80&crop=false&fit=cover&width=480 1024w,
|
|
77
|
+
/test4.jpg?auto=webp&quality=80&crop=false&fit=cover&width=640.3125 1366w,
|
|
78
|
+
/test4.jpg?auto=webp&quality=80&crop=false&fit=cover&width=900 1920w"
|
|
79
|
+
/>
|
|
80
|
+
`);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Image/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@adobe/elsie/components/Image/Image';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
import '@adobe/elsie/components/ImageSwatch/ImageSwatch.css';
|
|
4
|
+
export interface ImageSwatchProps extends Omit<HTMLAttributes<HTMLInputElement>, 'label'> {
|
|
5
|
+
name?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
groupAriaLabel?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
src: string;
|
|
10
|
+
alt?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
selected?: boolean;
|
|
14
|
+
outOfStock?: boolean;
|
|
15
|
+
multi?: boolean;
|
|
16
|
+
onValue?: (value: any) => void;
|
|
17
|
+
onUpdateError?: (error: Error) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const ImageSwatch: FunctionComponent<ImageSwatchProps>;
|
|
20
|
+
//# sourceMappingURL=ImageSwatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageSwatch.d.ts","sourceRoot":"","sources":["../../../src/components/ImageSwatch/ImageSwatch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAe,MAAM,eAAe,CAAC;AAE5D,OAAO,qDAAqD,CAAC;AAI7D,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,CAsF3D,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useCallback } from 'preact/compat';
|
|
2
|
+
import { classes } from '@adobe/elsie/lib';
|
|
3
|
+
import '@adobe/elsie/components/ImageSwatch/ImageSwatch.css';
|
|
4
|
+
import { Image } from '@adobe/elsie/components/Image';
|
|
5
|
+
import { useText } from '@adobe/elsie/i18n';
|
|
6
|
+
export const ImageSwatch = ({ className, name, value, id, label, groupAriaLabel, src, alt, disabled = false, selected = false, outOfStock = false, multi = false, onValue, onUpdateError, ...props }) => {
|
|
7
|
+
const outOfStockLabel = useText('Dropin.Swatches.outOfStock.label').label;
|
|
8
|
+
const selectedLabel = useText('Dropin.Swatches.selected.label').label;
|
|
9
|
+
const swatchLabel = useText('Dropin.Swatches.swatch.label').label;
|
|
10
|
+
const onValueHandler = useCallback(async (newValue) => {
|
|
11
|
+
if (onValue) {
|
|
12
|
+
try {
|
|
13
|
+
await onValue(newValue);
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
if (onUpdateError) {
|
|
17
|
+
onUpdateError(e);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}, [onValue, onUpdateError]);
|
|
22
|
+
const handleOnValue = (e) => {
|
|
23
|
+
const input = e.target;
|
|
24
|
+
onValueHandler(input.value);
|
|
25
|
+
};
|
|
26
|
+
const handleAriaLabel = () => {
|
|
27
|
+
if (outOfStock)
|
|
28
|
+
return `${groupAriaLabel}: ${label} ${outOfStockLabel}`;
|
|
29
|
+
if (selected)
|
|
30
|
+
return `${groupAriaLabel}: ${label} ${selectedLabel}`;
|
|
31
|
+
return `${groupAriaLabel}: ${label} ${swatchLabel}`;
|
|
32
|
+
};
|
|
33
|
+
return (<label className={classes(['dropin-image-swatch__container', className])}>
|
|
34
|
+
<input type={multi ? 'checkbox' : 'radio'} name={name} id={id} value={value} aria-label={handleAriaLabel()} checked={selected} disabled={disabled} onChange={handleOnValue} {...props} className={classes([
|
|
35
|
+
'dropin-image-swatch',
|
|
36
|
+
['dropin-image-swatch--selected', selected],
|
|
37
|
+
['dropin-image-swatch--disabled', disabled],
|
|
38
|
+
className,
|
|
39
|
+
])}/>
|
|
40
|
+
|
|
41
|
+
<span className={classes([
|
|
42
|
+
'dropin-image-swatch__span',
|
|
43
|
+
['dropin-image-swatch__span--out-of-stock', outOfStock],
|
|
44
|
+
className,
|
|
45
|
+
])}>
|
|
46
|
+
<Image src={src} className={classes(['dropin-image-swatch__content'])} params={{ width: 100, fit: 'bounds', crop: true }} alt={alt} loading={'lazy'} onError={(e) => (e.target.style.display = 'none')}/>
|
|
47
|
+
</span>
|
|
48
|
+
</label>);
|
|
49
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/preact';
|
|
2
|
+
import { ImageSwatchProps } from '@adobe/elsie/components/ImageSwatch';
|
|
3
|
+
/**
|
|
4
|
+
* Use Image Swatches to display thumbnails of photos or illustrations.
|
|
5
|
+
*/
|
|
6
|
+
declare const meta: Meta<ImageSwatchProps>;
|
|
7
|
+
export default meta;
|
|
8
|
+
type Story = StoryObj<ImageSwatchProps>;
|
|
9
|
+
/**
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { ImageSwatch } from '@adobe/elsie/components/ImageSwatch';
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare const DefaultImageSwatch: Story;
|
|
15
|
+
export declare const ImageSwatchSelected: Story;
|
|
16
|
+
export declare const ImageSwatchDisabled: Story;
|
|
17
|
+
export declare const OutOfStockImageSwatch: Story;
|
|
18
|
+
export declare const SelectedOutOfStockImageSwatch: Story;
|
|
19
|
+
export declare const MultiImageSwatch: Story;
|
|
20
|
+
//# sourceMappingURL=ImageSwatch.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageSwatch.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ImageSwatch/ImageSwatch.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAIxD,OAAO,EAEL,gBAAgB,EACjB,MAAM,qCAAqC,CAAC;AAK7C;;GAEG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,gBAAgB,CA2EhC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AAExC;;;;GAIG;AAEH,eAAO,MAAM,kBAAkB,EAAE,KAuBhC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KA4BjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAkBjC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KAcnC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,KAe3C,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAqB9B,CAAC"}
|