@dropins/tools 0.21.2-alpha3 → 0.21.2-alpha389
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/event-bus.js +1 -49
- package/fetch-graphql.js +1 -62
- package/initializer.js +1 -64
- package/package.json +1 -1
- package/preact-compat.js +1 -93
- package/preact-hooks.js +1 -40
- package/preact-jsx-runtime.js +1 -35
- package/preact.js +1 -21
- package/runtime.js +1 -69
- package/components/Accordion/Accordion.d.ts +0 -25
- package/components/Accordion/Accordion.d.ts.map +0 -1
- package/components/Accordion/Accordion.jsx +0 -59
- package/components/Accordion/Accordion.stories.d.ts +0 -22
- package/components/Accordion/Accordion.stories.d.ts.map +0 -1
- package/components/Accordion/Accordion.stories.jsx +0 -320
- package/components/Accordion/Accordion.test.d.ts +0 -3
- package/components/Accordion/Accordion.test.d.ts.map +0 -1
- package/components/Accordion/Accordion.test.jsx +0 -79
- package/components/Accordion/index.d.ts +0 -3
- package/components/Accordion/index.d.ts.map +0 -1
- package/components/Accordion/index.js +0 -2
- package/components/ActionButton/ActionButton.d.ts +0 -11
- package/components/ActionButton/ActionButton.d.ts.map +0 -1
- package/components/ActionButton/ActionButton.jsx +0 -14
- package/components/ActionButton/ActionButton.stories.d.ts +0 -16
- package/components/ActionButton/ActionButton.stories.d.ts.map +0 -1
- package/components/ActionButton/ActionButton.stories.jsx +0 -119
- package/components/ActionButton/ActionButton.test.d.ts +0 -3
- package/components/ActionButton/ActionButton.test.d.ts.map +0 -1
- package/components/ActionButton/ActionButton.test.jsx +0 -47
- package/components/ActionButton/index.d.ts +0 -2
- package/components/ActionButton/index.d.ts.map +0 -1
- package/components/ActionButton/index.js +0 -1
- package/components/ActionButtonGroup/ActionButtonGroup.d.ts +0 -20
- package/components/ActionButtonGroup/ActionButtonGroup.d.ts.map +0 -1
- package/components/ActionButtonGroup/ActionButtonGroup.jsx +0 -39
- package/components/ActionButtonGroup/ActionButtonGroup.stories.d.ts +0 -16
- package/components/ActionButtonGroup/ActionButtonGroup.stories.d.ts.map +0 -1
- package/components/ActionButtonGroup/ActionButtonGroup.stories.jsx +0 -72
- package/components/ActionButtonGroup/ActionButtonGroup.test.d.ts +0 -3
- package/components/ActionButtonGroup/ActionButtonGroup.test.d.ts.map +0 -1
- package/components/ActionButtonGroup/ActionButtonGroup.test.jsx +0 -78
- package/components/ActionButtonGroup/index.d.ts +0 -2
- package/components/ActionButtonGroup/index.d.ts.map +0 -1
- package/components/ActionButtonGroup/index.js +0 -1
- package/components/AlertBanner/AlertBanner.d.ts +0 -15
- package/components/AlertBanner/AlertBanner.d.ts.map +0 -1
- package/components/AlertBanner/AlertBanner.jsx +0 -30
- package/components/AlertBanner/AlertBanner.stories.d.ts +0 -17
- package/components/AlertBanner/AlertBanner.stories.d.ts.map +0 -1
- package/components/AlertBanner/AlertBanner.stories.jsx +0 -128
- package/components/AlertBanner/AlertBanner.test.d.ts +0 -3
- package/components/AlertBanner/AlertBanner.test.d.ts.map +0 -1
- package/components/AlertBanner/AlertBanner.test.jsx +0 -40
- package/components/AlertBanner/index.d.ts +0 -3
- package/components/AlertBanner/index.d.ts.map +0 -1
- package/components/AlertBanner/index.js +0 -2
- package/components/Breadcrumbs/Breadcrumbs.d.ts +0 -9
- package/components/Breadcrumbs/Breadcrumbs.d.ts.map +0 -1
- package/components/Breadcrumbs/Breadcrumbs.jsx +0 -26
- package/components/Breadcrumbs/Breadcrumbs.stories.d.ts +0 -15
- package/components/Breadcrumbs/Breadcrumbs.stories.d.ts.map +0 -1
- package/components/Breadcrumbs/Breadcrumbs.stories.jsx +0 -110
- package/components/Breadcrumbs/Breadcrumbs.test.d.ts +0 -3
- package/components/Breadcrumbs/Breadcrumbs.test.d.ts.map +0 -1
- package/components/Breadcrumbs/Breadcrumbs.test.jsx +0 -67
- package/components/Breadcrumbs/index.d.ts +0 -3
- package/components/Breadcrumbs/index.d.ts.map +0 -1
- package/components/Breadcrumbs/index.js +0 -2
- package/components/Button/Button.d.ts +0 -15
- package/components/Button/Button.d.ts.map +0 -1
- package/components/Button/Button.jsx +0 -59
- package/components/Button/Button.stories.d.ts +0 -135
- package/components/Button/Button.stories.d.ts.map +0 -1
- package/components/Button/Button.stories.jsx +0 -354
- package/components/Button/Button.test.d.ts +0 -2
- package/components/Button/Button.test.d.ts.map +0 -1
- package/components/Button/Button.test.jsx +0 -134
- package/components/Button/index.d.ts +0 -3
- package/components/Button/index.d.ts.map +0 -1
- package/components/Button/index.js +0 -2
- package/components/Card/Card.d.ts +0 -9
- package/components/Card/Card.d.ts.map +0 -1
- package/components/Card/Card.jsx +0 -7
- package/components/Card/Card.stories.d.ts +0 -16
- package/components/Card/Card.stories.d.ts.map +0 -1
- package/components/Card/Card.stories.jsx +0 -47
- package/components/Card/Card.test.d.ts +0 -3
- package/components/Card/Card.test.d.ts.map +0 -1
- package/components/Card/Card.test.jsx +0 -26
- package/components/Card/index.d.ts +0 -2
- package/components/Card/index.d.ts.map +0 -1
- package/components/Card/index.js +0 -1
- package/components/CartItem/CartItem.d.ts +0 -25
- package/components/CartItem/CartItem.d.ts.map +0 -1
- package/components/CartItem/CartItem.jsx +0 -124
- package/components/CartItem/CartItem.stories.d.ts +0 -54
- package/components/CartItem/CartItem.stories.d.ts.map +0 -1
- package/components/CartItem/CartItem.stories.jsx +0 -309
- package/components/CartItem/CartItem.test.d.ts +0 -3
- package/components/CartItem/CartItem.test.d.ts.map +0 -1
- package/components/CartItem/CartItem.test.jsx +0 -71
- package/components/CartItem/CartItemSkeleton.d.ts +0 -3
- package/components/CartItem/CartItemSkeleton.d.ts.map +0 -1
- package/components/CartItem/CartItemSkeleton.jsx +0 -25
- package/components/CartItem/CartItemSkeleton.test.d.ts +0 -3
- package/components/CartItem/CartItemSkeleton.test.d.ts.map +0 -1
- package/components/CartItem/CartItemSkeleton.test.jsx +0 -11
- package/components/CartItem/index.d.ts +0 -4
- package/components/CartItem/index.d.ts.map +0 -1
- package/components/CartItem/index.js +0 -3
- package/components/CartList/CartList.d.ts +0 -7
- package/components/CartList/CartList.d.ts.map +0 -1
- package/components/CartList/CartList.jsx +0 -14
- package/components/CartList/CartList.stories.d.ts +0 -17
- package/components/CartList/CartList.stories.d.ts.map +0 -1
- package/components/CartList/CartList.stories.jsx +0 -54
- package/components/CartList/CartList.test.d.ts +0 -3
- package/components/CartList/CartList.test.d.ts.map +0 -1
- package/components/CartList/CartList.test.jsx +0 -12
- package/components/CartList/index.d.ts +0 -3
- package/components/CartList/index.d.ts.map +0 -1
- package/components/CartList/index.js +0 -2
- package/components/Checkbox/Checkbox.d.ts +0 -13
- package/components/Checkbox/Checkbox.d.ts.map +0 -1
- package/components/Checkbox/Checkbox.jsx +0 -51
- package/components/Checkbox/Checkbox.stories.d.ts +0 -22
- package/components/Checkbox/Checkbox.stories.d.ts.map +0 -1
- package/components/Checkbox/Checkbox.stories.jsx +0 -157
- package/components/Checkbox/Checkbox.test.d.ts +0 -3
- package/components/Checkbox/Checkbox.test.d.ts.map +0 -1
- package/components/Checkbox/Checkbox.test.jsx +0 -136
- package/components/Checkbox/index.d.ts +0 -2
- package/components/Checkbox/index.d.ts.map +0 -1
- package/components/Checkbox/index.js +0 -1
- package/components/ColorSwatch/ColorSwatch.d.ts +0 -20
- package/components/ColorSwatch/ColorSwatch.d.ts.map +0 -1
- package/components/ColorSwatch/ColorSwatch.jsx +0 -57
- package/components/ColorSwatch/ColorSwatch.stories.d.ts +0 -20
- package/components/ColorSwatch/ColorSwatch.stories.d.ts.map +0 -1
- package/components/ColorSwatch/ColorSwatch.stories.jsx +0 -206
- package/components/ColorSwatch/ColorSwatch.test.d.ts +0 -3
- package/components/ColorSwatch/ColorSwatch.test.d.ts.map +0 -1
- package/components/ColorSwatch/ColorSwatch.test.jsx +0 -87
- package/components/ColorSwatch/index.d.ts +0 -3
- package/components/ColorSwatch/index.d.ts.map +0 -1
- package/components/ColorSwatch/index.js +0 -2
- package/components/Divider/Divider.d.ts +0 -8
- package/components/Divider/Divider.d.ts.map +0 -1
- package/components/Divider/Divider.jsx +0 -9
- package/components/Divider/Divider.stories.d.ts +0 -11
- package/components/Divider/Divider.stories.d.ts.map +0 -1
- package/components/Divider/Divider.stories.jsx +0 -43
- package/components/Divider/Divider.test.d.ts +0 -2
- package/components/Divider/Divider.test.d.ts.map +0 -1
- package/components/Divider/Divider.test.jsx +0 -19
- package/components/Divider/index.d.ts +0 -3
- package/components/Divider/index.d.ts.map +0 -1
- package/components/Divider/index.js +0 -2
- package/components/Field/Field.d.ts +0 -14
- package/components/Field/Field.d.ts.map +0 -1
- package/components/Field/Field.jsx +0 -29
- package/components/Field/Field.stories.d.ts +0 -37
- package/components/Field/Field.stories.d.ts.map +0 -1
- package/components/Field/Field.stories.jsx +0 -174
- package/components/Field/Field.test.d.ts +0 -3
- package/components/Field/Field.test.d.ts.map +0 -1
- package/components/Field/Field.test.jsx +0 -91
- package/components/Field/index.d.ts +0 -2
- package/components/Field/index.d.ts.map +0 -1
- package/components/Field/index.js +0 -1
- package/components/Icon/Icon.d.ts +0 -11
- package/components/Icon/Icon.d.ts.map +0 -1
- package/components/Icon/Icon.jsx +0 -57
- package/components/Icon/Icon.stories.d.ts +0 -16
- package/components/Icon/Icon.stories.d.ts.map +0 -1
- package/components/Icon/Icon.stories.helpers.d.ts +0 -4
- package/components/Icon/Icon.stories.helpers.d.ts.map +0 -1
- package/components/Icon/Icon.stories.helpers.jsx +0 -7
- package/components/Icon/Icon.stories.jsx +0 -48
- package/components/Icon/Icon.test.d.ts +0 -3
- package/components/Icon/Icon.test.d.ts.map +0 -1
- package/components/Icon/Icon.test.jsx +0 -67
- package/components/Icon/index.d.ts +0 -2
- package/components/Icon/index.d.ts.map +0 -1
- package/components/Icon/index.js +0 -1
- package/components/IllustratedMessage/IllustratedMessage.d.ts +0 -13
- package/components/IllustratedMessage/IllustratedMessage.d.ts.map +0 -1
- package/components/IllustratedMessage/IllustratedMessage.jsx +0 -21
- package/components/IllustratedMessage/IllustratedMessage.stories.d.ts +0 -10
- package/components/IllustratedMessage/IllustratedMessage.stories.d.ts.map +0 -1
- package/components/IllustratedMessage/IllustratedMessage.stories.jsx +0 -90
- package/components/IllustratedMessage/IllustratedMessage.test.d.ts +0 -3
- package/components/IllustratedMessage/IllustratedMessage.test.d.ts.map +0 -1
- package/components/IllustratedMessage/IllustratedMessage.test.jsx +0 -42
- package/components/IllustratedMessage/index.d.ts +0 -3
- package/components/IllustratedMessage/index.d.ts.map +0 -1
- package/components/IllustratedMessage/index.js +0 -2
- package/components/Image/Image.d.ts +0 -11
- package/components/Image/Image.d.ts.map +0 -1
- package/components/Image/Image.jsx +0 -26
- package/components/Image/Image.stories.d.ts +0 -11
- package/components/Image/Image.stories.d.ts.map +0 -1
- package/components/Image/Image.stories.jsx +0 -66
- package/components/Image/Image.test.d.ts +0 -3
- package/components/Image/Image.test.d.ts.map +0 -1
- package/components/Image/Image.test.jsx +0 -82
- package/components/Image/index.d.ts +0 -2
- package/components/Image/index.d.ts.map +0 -1
- package/components/Image/index.js +0 -1
- package/components/ImageSwatch/ImageSwatch.d.ts +0 -20
- package/components/ImageSwatch/ImageSwatch.d.ts.map +0 -1
- package/components/ImageSwatch/ImageSwatch.jsx +0 -49
- package/components/ImageSwatch/ImageSwatch.stories.d.ts +0 -20
- package/components/ImageSwatch/ImageSwatch.stories.d.ts.map +0 -1
- package/components/ImageSwatch/ImageSwatch.stories.jsx +0 -206
- package/components/ImageSwatch/ImageSwatch.test.d.ts +0 -3
- package/components/ImageSwatch/ImageSwatch.test.d.ts.map +0 -1
- package/components/ImageSwatch/ImageSwatch.test.jsx +0 -64
- package/components/ImageSwatch/index.d.ts +0 -3
- package/components/ImageSwatch/index.d.ts.map +0 -1
- package/components/ImageSwatch/index.js +0 -2
- package/components/InLineAlert/InLineAlert.d.ts +0 -16
- package/components/InLineAlert/InLineAlert.d.ts.map +0 -1
- package/components/InLineAlert/InLineAlert.jsx +0 -38
- package/components/InLineAlert/InLineAlert.stories.d.ts +0 -86
- package/components/InLineAlert/InLineAlert.stories.d.ts.map +0 -1
- package/components/InLineAlert/InLineAlert.stories.jsx +0 -193
- package/components/InLineAlert/InLineAlert.test.d.ts +0 -3
- package/components/InLineAlert/InLineAlert.test.d.ts.map +0 -1
- package/components/InLineAlert/InLineAlert.test.jsx +0 -77
- package/components/InLineAlert/index.d.ts +0 -3
- package/components/InLineAlert/index.d.ts.map +0 -1
- package/components/InLineAlert/index.js +0 -2
- package/components/Incrementer/Incrementer.d.ts +0 -17
- package/components/Incrementer/Incrementer.d.ts.map +0 -1
- package/components/Incrementer/Incrementer.jsx +0 -87
- package/components/Incrementer/Incrementer.stories.d.ts +0 -10
- package/components/Incrementer/Incrementer.stories.d.ts.map +0 -1
- package/components/Incrementer/Incrementer.stories.jsx +0 -68
- package/components/Incrementer/Incrementer.test.d.ts +0 -3
- package/components/Incrementer/Incrementer.test.d.ts.map +0 -1
- package/components/Incrementer/Incrementer.test.jsx +0 -112
- package/components/Incrementer/index.d.ts +0 -2
- package/components/Incrementer/index.d.ts.map +0 -1
- package/components/Incrementer/index.js +0 -1
- package/components/Input/Input.d.ts +0 -19
- package/components/Input/Input.d.ts.map +0 -1
- package/components/Input/Input.jsx +0 -73
- package/components/Input/Input.stories.d.ts +0 -11
- package/components/Input/Input.stories.d.ts.map +0 -1
- package/components/Input/Input.stories.jsx +0 -115
- package/components/Input/Input.test.d.ts +0 -3
- package/components/Input/Input.test.d.ts.map +0 -1
- package/components/Input/Input.test.jsx +0 -111
- package/components/Input/index.d.ts +0 -3
- package/components/Input/index.d.ts.map +0 -1
- package/components/Input/index.js +0 -2
- package/components/Modal/Modal.d.ts +0 -15
- package/components/Modal/Modal.d.ts.map +0 -1
- package/components/Modal/Modal.jsx +0 -93
- package/components/Modal/Modal.stories.d.ts +0 -56
- package/components/Modal/Modal.stories.d.ts.map +0 -1
- package/components/Modal/Modal.stories.jsx +0 -189
- package/components/Modal/Modal.test.d.ts +0 -3
- package/components/Modal/Modal.test.d.ts.map +0 -1
- package/components/Modal/Modal.test.jsx +0 -85
- package/components/Modal/index.d.ts +0 -2
- package/components/Modal/index.d.ts.map +0 -1
- package/components/Modal/index.js +0 -14
- package/components/Picker/Picker.d.ts +0 -26
- package/components/Picker/Picker.d.ts.map +0 -1
- package/components/Picker/Picker.jsx +0 -81
- package/components/Picker/Picker.stories.d.ts +0 -22
- package/components/Picker/Picker.stories.d.ts.map +0 -1
- package/components/Picker/Picker.stories.jsx +0 -236
- package/components/Picker/Picker.test.d.ts +0 -2
- package/components/Picker/Picker.test.d.ts.map +0 -1
- package/components/Picker/Picker.test.jsx +0 -190
- package/components/Picker/index.d.ts +0 -2
- package/components/Picker/index.d.ts.map +0 -1
- package/components/Picker/index.js +0 -1
- package/components/Price/Price.d.ts +0 -17
- package/components/Price/Price.d.ts.map +0 -1
- package/components/Price/Price.jsx +0 -24
- package/components/Price/Price.stories.d.ts +0 -17
- package/components/Price/Price.stories.d.ts.map +0 -1
- package/components/Price/Price.stories.jsx +0 -78
- package/components/Price/Price.test.d.ts +0 -3
- package/components/Price/Price.test.d.ts.map +0 -1
- package/components/Price/Price.test.jsx +0 -68
- package/components/Price/index.d.ts +0 -2
- package/components/Price/index.d.ts.map +0 -1
- package/components/Price/index.js +0 -1
- package/components/PriceRange/PriceRange.d.ts +0 -17
- package/components/PriceRange/PriceRange.d.ts.map +0 -1
- package/components/PriceRange/PriceRange.jsx +0 -75
- package/components/PriceRange/PriceRange.stories.d.ts +0 -107
- package/components/PriceRange/PriceRange.stories.d.ts.map +0 -1
- package/components/PriceRange/PriceRange.stories.jsx +0 -210
- package/components/PriceRange/PriceRange.test.d.ts +0 -3
- package/components/PriceRange/PriceRange.test.d.ts.map +0 -1
- package/components/PriceRange/PriceRange.test.jsx +0 -188
- package/components/PriceRange/index.d.ts +0 -3
- package/components/PriceRange/index.d.ts.map +0 -1
- package/components/PriceRange/index.js +0 -2
- package/components/PriceSummary/PriceSummary.d.ts +0 -43
- package/components/PriceSummary/PriceSummary.d.ts.map +0 -1
- package/components/PriceSummary/PriceSummary.jsx +0 -228
- package/components/PriceSummary/PriceSummary.stories.d.ts +0 -127
- package/components/PriceSummary/PriceSummary.stories.d.ts.map +0 -1
- package/components/PriceSummary/PriceSummary.stories.jsx +0 -456
- package/components/PriceSummary/PriceSummary.test.d.ts +0 -3
- package/components/PriceSummary/PriceSummary.test.d.ts.map +0 -1
- package/components/PriceSummary/PriceSummary.test.jsx +0 -275
- package/components/PriceSummary/index.d.ts +0 -3
- package/components/PriceSummary/index.d.ts.map +0 -1
- package/components/PriceSummary/index.js +0 -2
- package/components/ProgressSpinner/ProgressSpinner.d.ts +0 -14
- package/components/ProgressSpinner/ProgressSpinner.d.ts.map +0 -1
- package/components/ProgressSpinner/ProgressSpinner.jsx +0 -31
- package/components/ProgressSpinner/ProgressSpinner.stories.d.ts +0 -19
- package/components/ProgressSpinner/ProgressSpinner.stories.d.ts.map +0 -1
- package/components/ProgressSpinner/ProgressSpinner.stories.jsx +0 -195
- package/components/ProgressSpinner/ProgressSpinner.test.d.ts +0 -3
- package/components/ProgressSpinner/ProgressSpinner.test.d.ts.map +0 -1
- package/components/ProgressSpinner/ProgressSpinner.test.jsx +0 -40
- package/components/ProgressSpinner/index.d.ts +0 -3
- package/components/ProgressSpinner/index.d.ts.map +0 -1
- package/components/ProgressSpinner/index.js +0 -2
- package/components/RadioButton/RadioButton.d.ts +0 -15
- package/components/RadioButton/RadioButton.d.ts.map +0 -1
- package/components/RadioButton/RadioButton.jsx +0 -31
- package/components/RadioButton/RadioButton.stories.d.ts +0 -15
- package/components/RadioButton/RadioButton.stories.d.ts.map +0 -1
- package/components/RadioButton/RadioButton.stories.jsx +0 -92
- package/components/RadioButton/RadioButton.test.d.ts +0 -3
- package/components/RadioButton/RadioButton.test.d.ts.map +0 -1
- package/components/RadioButton/RadioButton.test.jsx +0 -62
- package/components/RadioButton/index.d.ts +0 -3
- package/components/RadioButton/index.d.ts.map +0 -1
- package/components/RadioButton/index.js +0 -2
- package/components/Skeleton/Skeleton.d.ts +0 -17
- package/components/Skeleton/Skeleton.d.ts.map +0 -1
- package/components/Skeleton/Skeleton.jsx +0 -52
- package/components/Skeleton/Skeleton.stories.d.ts +0 -67
- package/components/Skeleton/Skeleton.stories.d.ts.map +0 -1
- package/components/Skeleton/Skeleton.stories.jsx +0 -184
- package/components/Skeleton/Skeleton.test.d.ts +0 -3
- package/components/Skeleton/Skeleton.test.d.ts.map +0 -1
- package/components/Skeleton/Skeleton.test.jsx +0 -62
- package/components/Skeleton/index.d.ts +0 -2
- package/components/Skeleton/index.d.ts.map +0 -1
- package/components/Skeleton/index.js +0 -1
- package/components/TextSwatch/TextSwatch.d.ts +0 -18
- package/components/TextSwatch/TextSwatch.d.ts.map +0 -1
- package/components/TextSwatch/TextSwatch.jsx +0 -56
- package/components/TextSwatch/TextSwatch.stories.d.ts +0 -21
- package/components/TextSwatch/TextSwatch.stories.d.ts.map +0 -1
- package/components/TextSwatch/TextSwatch.stories.jsx +0 -211
- package/components/TextSwatch/TextSwatch.test.d.ts +0 -3
- package/components/TextSwatch/TextSwatch.test.d.ts.map +0 -1
- package/components/TextSwatch/TextSwatch.test.jsx +0 -85
- package/components/TextSwatch/index.d.ts +0 -3
- package/components/TextSwatch/index.d.ts.map +0 -1
- package/components/TextSwatch/index.js +0 -2
- package/components/UIProvider/UIProvider.d.ts +0 -18
- package/components/UIProvider/UIProvider.d.ts.map +0 -1
- package/components/UIProvider/UIProvider.jsx +0 -26
- package/components/UIProvider/UIProvider.test.d.ts +0 -2
- package/components/UIProvider/UIProvider.test.d.ts.map +0 -1
- package/components/UIProvider/UIProvider.test.jsx +0 -9
- package/components/UIProvider/index.d.ts +0 -2
- package/components/UIProvider/index.d.ts.map +0 -1
- package/components/UIProvider/index.js +0 -1
- package/components/index.d.ts +0 -34
- package/components/index.d.ts.map +0 -1
- package/components/index.js +0 -33
- package/docs/Design/designBlocks.d.ts +0 -21
- package/docs/Design/designBlocks.d.ts.map +0 -1
- package/docs/Design/designBlocks.jsx +0 -59
- package/docs/Design/getTokenData.d.ts +0 -7
- package/docs/Design/getTokenData.d.ts.map +0 -1
- package/docs/Design/getTokenData.js +0 -18
- package/docs/Design/getTokenData.test.d.ts +0 -2
- package/docs/Design/getTokenData.test.d.ts.map +0 -1
- package/docs/Design/getTokenData.test.js +0 -92
- package/i18n/en_US.json +0 -112
- package/i18n/index.d.ts +0 -341
- package/i18n/index.d.ts.map +0 -1
- package/i18n/index.js +0 -12
- package/i18n/index.test.d.ts +0 -2
- package/i18n/index.test.d.ts.map +0 -1
- package/i18n/index.test.js +0 -11
- package/icons/index.d.ts +0 -35
- package/icons/index.d.ts.map +0 -1
- package/icons/index.js +0 -34
- package/lib/classes.d.ts +0 -5
- package/lib/classes.d.ts.map +0 -1
- package/lib/classes.js +0 -16
- package/lib/classes.test.d.ts +0 -2
- package/lib/classes.test.d.ts.map +0 -1
- package/lib/classes.test.js +0 -18
- package/lib/config.d.ts +0 -7
- package/lib/config.d.ts.map +0 -1
- package/lib/config.js +0 -12
- package/lib/config.test.d.ts +0 -2
- package/lib/config.test.d.ts.map +0 -1
- package/lib/config.test.js +0 -12
- package/lib/debounce.d.ts +0 -2
- package/lib/debounce.d.ts.map +0 -1
- package/lib/debounce.js +0 -7
- package/lib/debounce.test.d.ts +0 -2
- package/lib/debounce.test.d.ts.map +0 -1
- package/lib/debounce.test.js +0 -40
- package/lib/deepmerge.d.ts +0 -2
- package/lib/deepmerge.d.ts.map +0 -1
- package/lib/deepmerge.js +0 -1
- package/lib/form-values.d.ts +0 -5
- package/lib/form-values.d.ts.map +0 -1
- package/lib/form-values.js +0 -17
- package/lib/form-values.test.d.ts +0 -2
- package/lib/form-values.test.d.ts.map +0 -1
- package/lib/form-values.test.jsx +0 -29
- package/lib/i18n.d.ts +0 -8
- package/lib/i18n.d.ts.map +0 -1
- package/lib/i18n.js +0 -9
- package/lib/i18n.test.d.ts +0 -2
- package/lib/i18n.test.d.ts.map +0 -1
- package/lib/i18n.test.jsx +0 -8
- package/lib/image-params-keymap.d.ts +0 -4
- package/lib/image-params-keymap.d.ts.map +0 -1
- package/lib/image-params-keymap.js +0 -19
- package/lib/image-params-keymap.test.d.ts +0 -2
- package/lib/image-params-keymap.test.d.ts.map +0 -1
- package/lib/image-params-keymap.test.js +0 -7
- package/lib/index.d.ts +0 -14
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -13
- package/lib/initializer.d.ts +0 -81
- package/lib/initializer.d.ts.map +0 -1
- package/lib/initializer.js +0 -96
- package/lib/initializer.test.d.ts +0 -2
- package/lib/initializer.test.d.ts.map +0 -1
- package/lib/initializer.test.js +0 -64
- package/lib/render.d.ts +0 -10
- package/lib/render.d.ts.map +0 -1
- package/lib/render.jsx +0 -34
- package/lib/render.test.d.ts +0 -2
- package/lib/render.test.d.ts.map +0 -1
- package/lib/render.test.jsx +0 -70
- package/lib/resolve-image.d.ts +0 -10
- package/lib/resolve-image.d.ts.map +0 -1
- package/lib/resolve-image.js +0 -57
- package/lib/resolve-image.test.d.ts +0 -2
- package/lib/resolve-image.test.d.ts.map +0 -1
- package/lib/resolve-image.test.jsx +0 -146
- package/lib/slot.d.ts +0 -43
- package/lib/slot.d.ts.map +0 -1
- package/lib/slot.jsx +0 -184
- package/lib/slot.test.d.ts +0 -2
- package/lib/slot.test.d.ts.map +0 -1
- package/lib/slot.test.jsx +0 -325
- package/lib/tests.d.ts +0 -4
- package/lib/tests.d.ts.map +0 -1
- package/lib/tests.jsx +0 -19
- package/lib/tests.test.d.ts +0 -2
- package/lib/tests.test.d.ts.map +0 -1
- package/lib/tests.test.jsx +0 -13
- package/lib/types.d.ts +0 -9
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js +0 -1
- package/lib/vcomponent.d.ts +0 -8
- package/lib/vcomponent.d.ts.map +0 -1
- package/lib/vcomponent.jsx +0 -27
- package/lib/vcomponent.test.d.ts +0 -2
- package/lib/vcomponent.test.d.ts.map +0 -1
- package/lib/vcomponent.test.jsx +0 -51
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { Icon } from '@adobe/elsie/components';
|
|
2
|
-
import '@adobe/elsie/components/Picker/Picker.css';
|
|
3
|
-
import { ChevronDown } from '@adobe/elsie/icons';
|
|
4
|
-
import { classes } from '@adobe/elsie/lib';
|
|
5
|
-
import { useEffect, useState } from 'preact/compat';
|
|
6
|
-
import { useRef } from 'preact/hooks';
|
|
7
|
-
export const Picker = ({ name, value = null, options, variant = 'primary', floatingLabel, size = 'medium', handleSelect = () => { }, disabled = false, error = false, placeholder, defaultOption, icon, className, ...props }) => {
|
|
8
|
-
const id = props?.id || name || `dropin-picker-${Math.random().toString(36)}`;
|
|
9
|
-
// find the first option that is not disabled
|
|
10
|
-
const firstAvailableeOption = options?.find((option) => !option.disabled);
|
|
11
|
-
const [selectedValue, setSelectedValue] = useState({
|
|
12
|
-
value,
|
|
13
|
-
text: defaultOption?.text || placeholder || firstAvailableeOption?.text,
|
|
14
|
-
icon,
|
|
15
|
-
});
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const selected = options?.find((option) => option.value === value);
|
|
18
|
-
setSelectedValue(selected ?? {
|
|
19
|
-
value: defaultOption?.value ||
|
|
20
|
-
(placeholder || floatingLabel
|
|
21
|
-
? null
|
|
22
|
-
: firstAvailableeOption?.value),
|
|
23
|
-
text: defaultOption?.text || placeholder || firstAvailableeOption?.text,
|
|
24
|
-
icon,
|
|
25
|
-
});
|
|
26
|
-
}, [value, options, placeholder, icon, defaultOption, floatingLabel]);
|
|
27
|
-
const handleOptionClick = (event) => {
|
|
28
|
-
const { options, value } = event.target;
|
|
29
|
-
for (const element of options) {
|
|
30
|
-
if (element.selected) {
|
|
31
|
-
setSelectedValue({ value, text: element.text, icon });
|
|
32
|
-
handleSelect(event);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const optionsListItems = options?.map((option) => {
|
|
37
|
-
const { value, text, disabled } = option;
|
|
38
|
-
const selected = value === selectedValue.value;
|
|
39
|
-
return (<option value={value} key={value} selected={selected} disabled={disabled} className={classes(['dropin-picker__option'])}>
|
|
40
|
-
{text}
|
|
41
|
-
</option>);
|
|
42
|
-
});
|
|
43
|
-
const placeholderOptionRef = useRef(null);
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
const selected = !placeholderOptionRef.current?.selected || !!defaultOption;
|
|
46
|
-
return (<div className={classes([
|
|
47
|
-
className,
|
|
48
|
-
'dropin-picker',
|
|
49
|
-
`dropin-picker__${size}`,
|
|
50
|
-
['dropin-picker__floating', !!floatingLabel],
|
|
51
|
-
['dropin-picker__selected', selected],
|
|
52
|
-
['dropin-picker__error', error],
|
|
53
|
-
['dropin-picker__disabled', disabled],
|
|
54
|
-
['dropin-picker__icon', icon],
|
|
55
|
-
])}>
|
|
56
|
-
{icon && (
|
|
57
|
-
// @ts-ignore
|
|
58
|
-
<icon.type {...icon.props} className={'dropin-picker__icon--placeholder'}/>)}
|
|
59
|
-
|
|
60
|
-
<select id={id} className={classes([
|
|
61
|
-
'dropin-picker__select',
|
|
62
|
-
`dropin-picker__select--${variant}`,
|
|
63
|
-
`dropin-picker__select--${size}`,
|
|
64
|
-
['dropin-picker__select--floating', !!floatingLabel],
|
|
65
|
-
])} name={name} aria-label={name} disabled={disabled} onChange={handleOptionClick} {...props}>
|
|
66
|
-
{!defaultOption && (floatingLabel || placeholder) && (<option value={''} key={value} ref={placeholderOptionRef} className={classes([
|
|
67
|
-
'dropin-picker__option dropin-picker__placeholder',
|
|
68
|
-
])}>
|
|
69
|
-
{floatingLabel ?? placeholder}
|
|
70
|
-
</option>)}
|
|
71
|
-
|
|
72
|
-
{optionsListItems}
|
|
73
|
-
</select>
|
|
74
|
-
|
|
75
|
-
<Icon source={ChevronDown} size="24" stroke="2" className="dropin-picker__chevronDown"/>
|
|
76
|
-
|
|
77
|
-
{floatingLabel && selected && (<label htmlFor={id} className={classes(['dropin-picker__floatingLabel', !!floatingLabel])}>
|
|
78
|
-
{floatingLabel}
|
|
79
|
-
</label>)}
|
|
80
|
-
</div>);
|
|
81
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/preact';
|
|
2
|
-
import { PickerProps } from '@adobe/elsie/components/Picker';
|
|
3
|
-
/**
|
|
4
|
-
* Use Pickers to let users select values or items from predefined lists.
|
|
5
|
-
*/
|
|
6
|
-
declare const meta: Meta<PickerProps>;
|
|
7
|
-
export default meta;
|
|
8
|
-
interface StoryProps extends PickerProps {
|
|
9
|
-
handleSubmit?: (e: Event) => void;
|
|
10
|
-
}
|
|
11
|
-
type Story = StoryObj<StoryProps>;
|
|
12
|
-
/**
|
|
13
|
-
* ```ts
|
|
14
|
-
* import { Picker } from '@/checkout/components/Picker';
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export declare const Primary: Story;
|
|
18
|
-
export declare const SecondaryWithIcon: Story;
|
|
19
|
-
export declare const PlaceholderText: Story;
|
|
20
|
-
export declare const FloatingLabel: Story;
|
|
21
|
-
export declare const FloatingLabelWithDefaultOption: Story;
|
|
22
|
-
//# sourceMappingURL=Picker.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Picker/Picker.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAU,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAKrE;;GAEG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,WAAW,CAsF3B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,UAAU,UAAW,SAAQ,WAAW;IACtC,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;CACnC;AAED,KAAK,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;AAElC;;;;GAIG;AAEH,eAAO,MAAM,OAAO,EAAE,KAwCrB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KA2B/B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAuB7B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAsB3B,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,KA0B5C,CAAC"}
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
import { Picker } from '@adobe/elsie/components/Picker';
|
|
2
|
-
import { userEvent, within } from '@storybook/testing-library';
|
|
3
|
-
import { expect } from '@storybook/jest';
|
|
4
|
-
import { Placeholder } from '@adobe/elsie/icons';
|
|
5
|
-
/**
|
|
6
|
-
* Use Pickers to let users select values or items from predefined lists.
|
|
7
|
-
*/
|
|
8
|
-
const meta = {
|
|
9
|
-
title: 'Components/Picker',
|
|
10
|
-
component: Picker,
|
|
11
|
-
argTypes: {
|
|
12
|
-
name: {
|
|
13
|
-
description: 'Field name (used for mapping the value in a form)',
|
|
14
|
-
type: {
|
|
15
|
-
required: false,
|
|
16
|
-
name: 'string',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
value: {
|
|
20
|
-
description: 'Field value',
|
|
21
|
-
type: 'string',
|
|
22
|
-
},
|
|
23
|
-
variant: {
|
|
24
|
-
description: 'Variant of the picker',
|
|
25
|
-
control: { type: 'radio' },
|
|
26
|
-
type: 'string',
|
|
27
|
-
defaultValue: { summary: 'primary' },
|
|
28
|
-
options: ['primary', 'secondary'],
|
|
29
|
-
},
|
|
30
|
-
size: {
|
|
31
|
-
description: 'Size of the picker',
|
|
32
|
-
control: 'radio',
|
|
33
|
-
options: ['medium', 'large'],
|
|
34
|
-
defaultValue: { summary: 'medium' },
|
|
35
|
-
},
|
|
36
|
-
floatingLabel: {
|
|
37
|
-
description: 'Floating label text',
|
|
38
|
-
type: {
|
|
39
|
-
required: false,
|
|
40
|
-
name: 'string',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
placeholder: {
|
|
44
|
-
description: 'Placeholder text (will be overridden by floatingLabel if provided)',
|
|
45
|
-
type: {
|
|
46
|
-
required: false,
|
|
47
|
-
name: 'string',
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
defaultOption: {
|
|
51
|
-
description: 'Default available option from the options array',
|
|
52
|
-
type: {
|
|
53
|
-
required: false,
|
|
54
|
-
/* @ts-ignore */
|
|
55
|
-
name: 'object',
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
error: {
|
|
59
|
-
description: 'Whether or not the field has an error',
|
|
60
|
-
type: 'boolean',
|
|
61
|
-
defaultValue: {
|
|
62
|
-
summary: false,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
options: {
|
|
66
|
-
description: 'Array of options',
|
|
67
|
-
type: {
|
|
68
|
-
required: true,
|
|
69
|
-
/* @ts-ignore */
|
|
70
|
-
name: 'Array',
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
disabled: {
|
|
74
|
-
description: 'Whether or not the field is disabled',
|
|
75
|
-
type: 'boolean',
|
|
76
|
-
defaultValue: {
|
|
77
|
-
summary: false,
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
icon: {
|
|
81
|
-
description: 'Icon to display in the Picker',
|
|
82
|
-
},
|
|
83
|
-
handleSelect: {
|
|
84
|
-
description: 'Callback function for when a value is selected',
|
|
85
|
-
type: 'function',
|
|
86
|
-
defaultValue: {
|
|
87
|
-
summary: '() => {}',
|
|
88
|
-
},
|
|
89
|
-
action: 'Value Selected',
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
decorators: [(Story) => <div style={{ width: '300px' }}>{Story()}</div>],
|
|
93
|
-
};
|
|
94
|
-
export default meta;
|
|
95
|
-
/**
|
|
96
|
-
* ```ts
|
|
97
|
-
* import { Picker } from '@/checkout/components/Picker';
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
|
-
export const Primary = {
|
|
101
|
-
args: {
|
|
102
|
-
name: 'pickerField',
|
|
103
|
-
variant: 'primary',
|
|
104
|
-
defaultOption: {
|
|
105
|
-
value: 'option1',
|
|
106
|
-
text: 'A Option 1',
|
|
107
|
-
},
|
|
108
|
-
placeholder: 'Select an option',
|
|
109
|
-
options: [
|
|
110
|
-
{
|
|
111
|
-
value: 'option1',
|
|
112
|
-
text: 'A Option 1',
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
value: 'option2',
|
|
116
|
-
text: 'B Option 2',
|
|
117
|
-
disabled: true,
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
value: 'option3',
|
|
121
|
-
text: 'C Option 3',
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
},
|
|
125
|
-
play: async ({ canvasElement }) => {
|
|
126
|
-
const canvas = within(canvasElement);
|
|
127
|
-
userEvent.click(canvas.getByText('A Option 1'));
|
|
128
|
-
expect(canvas.getByText('A Option 1')).toBeVisible();
|
|
129
|
-
expect(canvas.getByText('B Option 2')).toBeVisible();
|
|
130
|
-
const select = document.querySelector('.dropin-picker__select');
|
|
131
|
-
userEvent.selectOptions(select, 'option3');
|
|
132
|
-
expect(select.textContent).toContain('C Option 3');
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
export const SecondaryWithIcon = {
|
|
136
|
-
name: 'Secondary with icon',
|
|
137
|
-
args: {
|
|
138
|
-
name: 'pickerField',
|
|
139
|
-
variant: 'secondary',
|
|
140
|
-
defaultOption: {
|
|
141
|
-
value: 'option2',
|
|
142
|
-
text: 'B Option 2',
|
|
143
|
-
},
|
|
144
|
-
placeholder: 'Select an option',
|
|
145
|
-
icon: <Placeholder />,
|
|
146
|
-
options: [
|
|
147
|
-
{
|
|
148
|
-
value: 'option1',
|
|
149
|
-
text: 'A Option 1',
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
value: 'option2',
|
|
153
|
-
text: 'B Option 2',
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
value: 'option3',
|
|
157
|
-
text: 'C Option 3',
|
|
158
|
-
disabled: true,
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
},
|
|
162
|
-
};
|
|
163
|
-
export const PlaceholderText = {
|
|
164
|
-
name: 'Secondary with placeholder',
|
|
165
|
-
args: {
|
|
166
|
-
name: 'pickerField',
|
|
167
|
-
variant: 'primary',
|
|
168
|
-
placeholder: 'Select an option',
|
|
169
|
-
icon: <Placeholder />,
|
|
170
|
-
options: [
|
|
171
|
-
{
|
|
172
|
-
value: 'option1',
|
|
173
|
-
text: 'A Option 1',
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
value: 'option2',
|
|
177
|
-
text: 'B Option 2',
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
value: 'option3',
|
|
181
|
-
text: 'C Option 3',
|
|
182
|
-
disabled: true,
|
|
183
|
-
},
|
|
184
|
-
],
|
|
185
|
-
},
|
|
186
|
-
};
|
|
187
|
-
export const FloatingLabel = {
|
|
188
|
-
name: 'Floating label',
|
|
189
|
-
args: {
|
|
190
|
-
name: 'pickerField',
|
|
191
|
-
variant: 'primary',
|
|
192
|
-
floatingLabel: 'Floating label',
|
|
193
|
-
options: [
|
|
194
|
-
{
|
|
195
|
-
value: 'option1',
|
|
196
|
-
text: 'A Option 1',
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
value: 'option2',
|
|
200
|
-
text: 'B Option 2',
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
value: 'option3',
|
|
204
|
-
text: 'C Option 3',
|
|
205
|
-
disabled: true,
|
|
206
|
-
},
|
|
207
|
-
],
|
|
208
|
-
},
|
|
209
|
-
};
|
|
210
|
-
export const FloatingLabelWithDefaultOption = {
|
|
211
|
-
name: 'Floating label with default option',
|
|
212
|
-
args: {
|
|
213
|
-
name: 'pickerField',
|
|
214
|
-
variant: 'primary',
|
|
215
|
-
floatingLabel: 'Floating label',
|
|
216
|
-
defaultOption: {
|
|
217
|
-
value: 'option2',
|
|
218
|
-
text: 'B Option 2',
|
|
219
|
-
},
|
|
220
|
-
options: [
|
|
221
|
-
{
|
|
222
|
-
value: 'option1',
|
|
223
|
-
text: 'A Option 1',
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
value: 'option2',
|
|
227
|
-
text: 'B Option 2',
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
value: 'option3',
|
|
231
|
-
text: 'C Option 3',
|
|
232
|
-
disabled: true,
|
|
233
|
-
},
|
|
234
|
-
],
|
|
235
|
-
},
|
|
236
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.test.d.ts","sourceRoot":"","sources":["../../../src/components/Picker/Picker.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
/** https://preactjs.com/guide/v10/preact-testing-library/ */
|
|
2
|
-
import { fireEvent, render, screen } from '@adobe/elsie/lib/tests';
|
|
3
|
-
import { Picker } from '@adobe/elsie/components';
|
|
4
|
-
import { Placeholder } from '@adobe/elsie/icons';
|
|
5
|
-
describe('Selection controls/Picker', () => {
|
|
6
|
-
const DEFAULT_PROPS = {
|
|
7
|
-
name: 'testPicker',
|
|
8
|
-
placeholder: 'Select an option',
|
|
9
|
-
options: [
|
|
10
|
-
{
|
|
11
|
-
value: 'option1',
|
|
12
|
-
text: 'Option 1',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
value: 'option2',
|
|
16
|
-
text: 'Option 2',
|
|
17
|
-
disabled: true,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
value: 'option3',
|
|
21
|
-
text: 'Option 3',
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
handleSelect: jest.fn(),
|
|
25
|
-
};
|
|
26
|
-
const Second_Props = {
|
|
27
|
-
name: 'secondPicker',
|
|
28
|
-
options: [
|
|
29
|
-
{
|
|
30
|
-
value: 'option5',
|
|
31
|
-
text: 'Option 5',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
value: 'option6',
|
|
35
|
-
text: 'Option 6',
|
|
36
|
-
disabled: true,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
value: 'option3',
|
|
40
|
-
text: 'Option 3',
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
handleSelect: jest.fn(),
|
|
44
|
-
};
|
|
45
|
-
describe('renders', () => {
|
|
46
|
-
test.each([
|
|
47
|
-
{ name: 'primary', props: { ...DEFAULT_PROPS, variant: 'primary' } },
|
|
48
|
-
{ name: 'secondary', props: { ...DEFAULT_PROPS, variant: 'secondary' } },
|
|
49
|
-
{ name: 'medium', props: { ...DEFAULT_PROPS, size: 'medium' } },
|
|
50
|
-
{ name: 'large', props: { ...DEFAULT_PROPS, size: 'large' } },
|
|
51
|
-
])('$name component', ({ props }) => {
|
|
52
|
-
const { container } = render(<Picker {...DEFAULT_PROPS}/>);
|
|
53
|
-
expect(!!container).toEqual(true);
|
|
54
|
-
expect(container).toMatchSnapshot();
|
|
55
|
-
// Test that the component container is rendered
|
|
56
|
-
const component = container.querySelector('.dropin-picker');
|
|
57
|
-
expect(component).toBeTruthy();
|
|
58
|
-
// Test that the placeholder is rendered
|
|
59
|
-
const placeholder = screen.getByText(props.placeholder?.toString());
|
|
60
|
-
expect(placeholder).toBeTruthy();
|
|
61
|
-
// Test that the variant class is applied
|
|
62
|
-
const variantField = container.querySelector(`.dropin-picker__selected--${props.variant}`);
|
|
63
|
-
expect(variantField).toBeDefined();
|
|
64
|
-
// Test that the size class is applied
|
|
65
|
-
const sizeField = container.querySelector(`.dropin-picker__select--${props.size}`);
|
|
66
|
-
expect(sizeField).toBeDefined();
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
describe('when options are provided', () => {
|
|
70
|
-
test('options exist and placeholder is selected by default', () => {
|
|
71
|
-
const { container } = render(<Picker {...DEFAULT_PROPS}/>);
|
|
72
|
-
const options = container.querySelectorAll('.dropin-picker__option');
|
|
73
|
-
// Placeholder option is included
|
|
74
|
-
expect(options.length).toBe(4);
|
|
75
|
-
expect(screen.getByText(DEFAULT_PROPS.placeholder?.toString()).selected).toBe(true);
|
|
76
|
-
});
|
|
77
|
-
test('user to change default option', () => {
|
|
78
|
-
render(<Picker {...DEFAULT_PROPS}/>);
|
|
79
|
-
const select = screen.getByRole('combobox');
|
|
80
|
-
fireEvent.change(select, { target: { value: 'option2' } });
|
|
81
|
-
expect(screen.getByText('Option 2').selected).toBe(true);
|
|
82
|
-
expect(screen.getByRole('option', { name: 'Option 2' })
|
|
83
|
-
.selected).toBe(true);
|
|
84
|
-
expect(select.value).toBe('option2');
|
|
85
|
-
expect(screen.getByRole('option', { name: 'Option 3' })
|
|
86
|
-
.selected).toBe(false);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
describe('when floating label is provided', () => {
|
|
90
|
-
test('floating label is displayed as placeholder', () => {
|
|
91
|
-
const { container } = render(<Picker {...DEFAULT_PROPS} floatingLabel={'Floating label'}/>);
|
|
92
|
-
const selectedContent = container.querySelector('.dropin-picker__placeholder');
|
|
93
|
-
expect(selectedContent?.textContent).toBe('Floating label');
|
|
94
|
-
});
|
|
95
|
-
test('floating label is displayed when option is selected', () => {
|
|
96
|
-
const { container } = render(<Picker {...DEFAULT_PROPS} floatingLabel={'Floating label'}/>);
|
|
97
|
-
const select = screen.getByRole('combobox');
|
|
98
|
-
fireEvent.change(select, { target: { value: 'option2' } });
|
|
99
|
-
const label = container.querySelector('.dropin-picker__floatingLabel');
|
|
100
|
-
expect(label.textContent).toBe('Floating label');
|
|
101
|
-
expect(label).not.toBeNull();
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
describe('when icon is provided', () => {
|
|
105
|
-
test('icon is displayed', () => {
|
|
106
|
-
const { container } = render(<Picker {...DEFAULT_PROPS} icon={<Placeholder />}/>);
|
|
107
|
-
const icon = container.querySelector('.dropin-picker__icon--placeholder');
|
|
108
|
-
expect(icon).not.toBeNull();
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
describe('when handleSelect is called', () => {
|
|
112
|
-
test('calls the handleSelect callback with the correct value', () => {
|
|
113
|
-
jest.resetAllMocks();
|
|
114
|
-
render(<Picker {...DEFAULT_PROPS}/>);
|
|
115
|
-
// Test that the handleSelect callback is not called on initial render
|
|
116
|
-
expect(DEFAULT_PROPS.handleSelect).not.toHaveBeenCalled();
|
|
117
|
-
const select = screen.getByRole('combobox');
|
|
118
|
-
fireEvent.change(select, { target: { value: 'option2' } });
|
|
119
|
-
expect(DEFAULT_PROPS.handleSelect).toHaveBeenCalled();
|
|
120
|
-
});
|
|
121
|
-
test('handleSelect is undefined', () => {
|
|
122
|
-
jest.resetAllMocks();
|
|
123
|
-
const DEFAULT_PROPS = {
|
|
124
|
-
placeholder: 'Select an option',
|
|
125
|
-
options: [
|
|
126
|
-
{
|
|
127
|
-
value: 'option1',
|
|
128
|
-
text: 'Option 1',
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
value: 'option2',
|
|
132
|
-
text: 'Option 2',
|
|
133
|
-
disabled: true,
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
value: 'option3',
|
|
137
|
-
text: 'Option 3',
|
|
138
|
-
},
|
|
139
|
-
],
|
|
140
|
-
handleSelect: undefined,
|
|
141
|
-
};
|
|
142
|
-
render(<Picker {...DEFAULT_PROPS}/>);
|
|
143
|
-
const select = screen.getByRole('combobox');
|
|
144
|
-
fireEvent.change(select, { target: { value: 'option2' } });
|
|
145
|
-
expect(screen.getByText('Option 2').selected).toBe(true);
|
|
146
|
-
expect(screen.getByRole('option', { name: 'Option 2' })
|
|
147
|
-
.selected).toBe(true);
|
|
148
|
-
expect(select.value).toBe('option2');
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
describe('display priority sequence with defaultOption and placeholder', () => {
|
|
152
|
-
test('display priority sequence', () => {
|
|
153
|
-
// when defaultOption is not provided, placeholder is displayed
|
|
154
|
-
render(<Picker {...DEFAULT_PROPS}/>);
|
|
155
|
-
expect(screen.getByText('Select an option')).toBeTruthy();
|
|
156
|
-
// when defaultOption is provided, defaultOption is displayed
|
|
157
|
-
const { container } = render(<Picker {...DEFAULT_PROPS} defaultOption={{
|
|
158
|
-
value: 'option3',
|
|
159
|
-
text: 'Option 3',
|
|
160
|
-
}}/>);
|
|
161
|
-
const selected = container.querySelector('.dropin-picker__select');
|
|
162
|
-
expect(selected?.textContent).toContain('Option 3');
|
|
163
|
-
});
|
|
164
|
-
test('when defaultOption and placeholder are not provided, first option is displayed', () => {
|
|
165
|
-
const { container } = render(<Picker {...Second_Props}/>);
|
|
166
|
-
const selectedContent = container.querySelector('.dropin-picker__select');
|
|
167
|
-
expect(selectedContent?.textContent).toContain('Option 5');
|
|
168
|
-
});
|
|
169
|
-
test('when defaultOption is provided, it is selected by default', () => {
|
|
170
|
-
render(<Picker {...DEFAULT_PROPS} defaultOption={{
|
|
171
|
-
value: 'option3',
|
|
172
|
-
text: 'Option 3',
|
|
173
|
-
}}/>);
|
|
174
|
-
expect(screen.getByText('Option 3').selected).toBe(true);
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
describe('when defaultOption is provided with floating label', () => {
|
|
178
|
-
test('defaultOption is displayed', () => {
|
|
179
|
-
const { container } = render(<Picker {...DEFAULT_PROPS} defaultOption={{
|
|
180
|
-
value: 'option3',
|
|
181
|
-
text: 'Option 3',
|
|
182
|
-
}} floatingLabel={'Floating label'}/>);
|
|
183
|
-
const selected = container.querySelector('.dropin-picker__select');
|
|
184
|
-
expect(selected?.textContent).toContain('Option 3');
|
|
185
|
-
// Test that the floating label is displayed
|
|
186
|
-
const label = container.querySelector('.dropin-picker__floatingLabel');
|
|
187
|
-
expect(label.textContent).toBe('Floating label');
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Picker/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@adobe/elsie/components/Picker/Picker';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent } from 'preact';
|
|
2
|
-
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
-
import '@adobe/elsie/components/Price/Price.css';
|
|
4
|
-
export interface PriceProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'size'> {
|
|
5
|
-
amount?: number;
|
|
6
|
-
currency?: string;
|
|
7
|
-
locale?: string;
|
|
8
|
-
formatOptions?: {
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
};
|
|
11
|
-
variant?: 'default' | 'strikethrough';
|
|
12
|
-
weight?: 'bold' | 'normal';
|
|
13
|
-
sale?: boolean;
|
|
14
|
-
size?: 'small' | 'medium' | 'large';
|
|
15
|
-
}
|
|
16
|
-
export declare const Price: FunctionComponent<PriceProps>;
|
|
17
|
-
//# sourceMappingURL=Price.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Price.d.ts","sourceRoot":"","sources":["../../../src/components/Price/Price.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAW,MAAM,eAAe,CAAC;AAExD,OAAO,yCAAyC,CAAC;AAEjD,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,OAAO,CAAC,EAAE,SAAS,GAAG,eAAe,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;CACrC;AAED,eAAO,MAAM,KAAK,EAAE,iBAAiB,CAAC,UAAU,CA2C/C,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'preact/compat';
|
|
2
|
-
import { classes } from '@adobe/elsie/lib';
|
|
3
|
-
import '@adobe/elsie/components/Price/Price.css';
|
|
4
|
-
export const Price = ({ amount = 0, currency, locale = undefined, variant = 'default', weight = 'bold', className, children, sale = false, formatOptions = {}, size = 'small', ...props }) => {
|
|
5
|
-
const formatter = useMemo(() => new Intl.NumberFormat(locale, {
|
|
6
|
-
style: 'currency',
|
|
7
|
-
currency: currency || 'USD',
|
|
8
|
-
// These options are needed to round to whole numbers if that's what you want.
|
|
9
|
-
minimumFractionDigits: 2,
|
|
10
|
-
maximumFractionDigits: 2,
|
|
11
|
-
...formatOptions,
|
|
12
|
-
}), [locale, currency, formatOptions]);
|
|
13
|
-
const formattedAmount = useMemo(() => formatter.format(amount), [amount, formatter]);
|
|
14
|
-
return (<span {...props} className={classes([
|
|
15
|
-
'dropin-price',
|
|
16
|
-
`dropin-price--${variant}`,
|
|
17
|
-
`dropin-price--${size}`,
|
|
18
|
-
`dropin-price--${weight}`,
|
|
19
|
-
['dropin-price--sale', sale],
|
|
20
|
-
className,
|
|
21
|
-
])}>
|
|
22
|
-
{formattedAmount}
|
|
23
|
-
</span>);
|
|
24
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/preact';
|
|
2
|
-
import { PriceProps } from '@adobe/elsie/components/Price';
|
|
3
|
-
/**
|
|
4
|
-
* Use Price components to display the cost of an item or service.
|
|
5
|
-
*/
|
|
6
|
-
declare const meta: Meta<PriceProps>;
|
|
7
|
-
export default meta;
|
|
8
|
-
type Story = StoryObj<PriceProps>;
|
|
9
|
-
/**
|
|
10
|
-
* ```ts
|
|
11
|
-
* import { Price } from '@adobe/elsie/components/Price';
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export declare const Primary: Story;
|
|
15
|
-
export declare const SpecialDefault: Story;
|
|
16
|
-
export declare const HighContrast: Story;
|
|
17
|
-
//# sourceMappingURL=Price.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Price.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Price/Price.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAS,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAIlE;;GAEG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UAAU,CAoC1B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;AAElC;;;;GAIG;AAEH,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAU5B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAU1B,CAAC"}
|