@adobe-commerce/elsie 1.0.0-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/.elsie.js +12 -0
- package/.eslintrc.js +9 -0
- package/README.md +52 -0
- package/__mocks__/svg.js +1 -0
- package/bin/builders/build/index.js +20 -0
- package/bin/builders/generate/api/index.js +65 -0
- package/bin/builders/generate/api/templates/function.js +9 -0
- package/bin/builders/generate/api/templates/index.js +7 -0
- package/bin/builders/generate/api/templates/story.js +23 -0
- package/bin/builders/generate/api/templates/unit-test.js +15 -0
- package/bin/builders/generate/component/index.js +87 -0
- package/bin/builders/generate/component/templates/Component.js +43 -0
- package/bin/builders/generate/component/templates/css.js +24 -0
- package/bin/builders/generate/component/templates/index.js +8 -0
- package/bin/builders/generate/component/templates/stories.js +46 -0
- package/bin/builders/generate/component/templates/unit-test.js +19 -0
- package/bin/builders/generate/config/index.js +54 -0
- package/bin/builders/generate/config/templates/elsie.js +29 -0
- package/bin/builders/generate/container/index.js +65 -0
- package/bin/builders/generate/container/templates/Component.js +18 -0
- package/bin/builders/generate/container/templates/index.js +8 -0
- package/bin/builders/generate/container/templates/stories.js +34 -0
- package/bin/builders/generate/container/templates/unit-test.js +19 -0
- package/bin/builders/generate/index.js +283 -0
- package/bin/builders/gql/createOrClearDirectory.js +33 -0
- package/bin/builders/gql/getSchemaRef.js +25 -0
- package/bin/builders/gql/index.js +71 -0
- package/bin/builders/lint/index.js +5 -0
- package/bin/builders/serve/index.js +44 -0
- package/bin/builders/storybook/index.js +5 -0
- package/bin/builders/test/index.js +5 -0
- package/bin/index.js +26 -0
- package/bin/lib/cli.js +8 -0
- package/bin/lib/config.js +12 -0
- package/bin/lib/log-message.js +11 -0
- package/bin/lib/string.js +26 -0
- package/bin/lib/validate-typeof.js +19 -0
- package/bin/lib/write-file.js +21 -0
- package/bin/lib/write-parent-index.js +36 -0
- package/config/eslint.js +103 -0
- package/config/jest.js +81 -0
- package/config/prettier.js +7 -0
- package/config/setEnvVars.js +5 -0
- package/config/storybook/addon.js +121 -0
- package/config/storybook/components/FileTree/FileTree.jsx +183 -0
- package/config/storybook/components/FileTree/index.js +1 -0
- package/config/storybook/components/Flex/Flex.jsx +12 -0
- package/config/storybook/components/Flex/Flex.module.css +20 -0
- package/config/storybook/components/Flex/index.js +1 -0
- package/config/storybook/components/OptionsTable/OptionsTable.jsx +79 -0
- package/config/storybook/components/OptionsTable/OptionsTable.module.css +95 -0
- package/config/storybook/components/OptionsTable/index.js +1 -0
- package/config/storybook/components/Panel/Panel.module.css +47 -0
- package/config/storybook/components/Panel/Panel.tsx +37 -0
- package/config/storybook/components/Panel/index.ts +1 -0
- package/config/storybook/components/Screenshot/Screenshot.jsx +14 -0
- package/config/storybook/components/Screenshot/Screenshot.module.css +19 -0
- package/config/storybook/components/Screenshot/index.js +1 -0
- package/config/storybook/components/Steps/Steps.jsx +12 -0
- package/config/storybook/components/Steps/Steps.module.css +34 -0
- package/config/storybook/components/Steps/index.js +1 -0
- package/config/storybook/components/StoryWrapper/StoryWrapper.jsx +9 -0
- package/config/storybook/components/StoryWrapper/StoryWrapper.module.css +13 -0
- package/config/storybook/components/StoryWrapper/index.js +1 -0
- package/config/storybook/components/Summary/Summary.jsx +10 -0
- package/config/storybook/components/Summary/Summary.module.css +11 -0
- package/config/storybook/components/Summary/index.js +1 -0
- package/config/storybook/components/Variants/Variants.js +48 -0
- package/config/storybook/components/Variants/docs.css +39 -0
- package/config/storybook/components/Variants/index.js +1 -0
- package/config/storybook/components/video/index.jsx +19 -0
- package/config/storybook/manager.js +14 -0
- package/config/storybook/preview.jsx +79 -0
- package/config/storybook/theming/fonts.css +59 -0
- package/config/storybook/theming/logo.svg +19 -0
- package/config/storybook/theming/manager.css +54 -0
- package/config/storybook/theming/preview.css +84 -0
- package/config/storybook/theming/theme.js +52 -0
- package/config/tsconfig-base.json +16 -0
- package/config/tsconfig-preact.json +15 -0
- package/config/vite.mjs +297 -0
- package/dist/chunks/deviceUtils.js +14 -0
- package/dist/chunks/icons/Add.js +3 -0
- package/dist/chunks/icons/AddressBook.js +3 -0
- package/dist/chunks/icons/Bulk.js +3 -0
- package/dist/chunks/icons/Burger.js +3 -0
- package/dist/chunks/icons/Card.js +3 -0
- package/dist/chunks/icons/Cart.js +3 -0
- package/dist/chunks/icons/Check.js +3 -0
- package/dist/chunks/icons/CheckWithCircle.js +3 -0
- package/dist/chunks/icons/ChevronDown.js +3 -0
- package/dist/chunks/icons/ChevronRight.js +3 -0
- package/dist/chunks/icons/ChevronUp.js +3 -0
- package/dist/chunks/icons/Close.js +3 -0
- package/dist/chunks/icons/Coupon.js +3 -0
- package/dist/chunks/icons/Date.js +3 -0
- package/dist/chunks/icons/Delivery.js +3 -0
- package/dist/chunks/icons/EmptyBox.js +3 -0
- package/dist/chunks/icons/Eye.js +3 -0
- package/dist/chunks/icons/EyeClose.js +3 -0
- package/dist/chunks/icons/Gift.js +3 -0
- package/dist/chunks/icons/GiftCard.js +3 -0
- package/dist/chunks/icons/Heart.js +3 -0
- package/dist/chunks/icons/HeartFilled.js +3 -0
- package/dist/chunks/icons/InfoFilled.js +3 -0
- package/dist/chunks/icons/Locker.js +3 -0
- package/dist/chunks/icons/Minus.js +3 -0
- package/dist/chunks/icons/Order.js +3 -0
- package/dist/chunks/icons/OrderError.js +3 -0
- package/dist/chunks/icons/OrderSuccess.js +3 -0
- package/dist/chunks/icons/PaymentError.js +3 -0
- package/dist/chunks/icons/Placeholder.js +3 -0
- package/dist/chunks/icons/PlaceholderFilled.js +3 -0
- package/dist/chunks/icons/Search.js +3 -0
- package/dist/chunks/icons/SearchFilled.js +3 -0
- package/dist/chunks/icons/Sort.js +3 -0
- package/dist/chunks/icons/Star.js +3 -0
- package/dist/chunks/icons/Trash.js +3 -0
- package/dist/chunks/icons/User.js +3 -0
- package/dist/chunks/icons/View.js +3 -0
- package/dist/chunks/icons/Wallet.js +3 -0
- package/dist/chunks/icons/Warning.js +3 -0
- package/dist/chunks/icons/WarningFilled.js +3 -0
- package/dist/chunks/icons/WarningWithCircle.js +3 -0
- package/dist/chunks/image-params-keymap.js +3 -0
- package/dist/chunks/initializer.js +5 -0
- package/dist/components.d.ts +1 -0
- package/dist/components.js +3 -0
- package/dist/event-bus.d.ts +1 -0
- package/dist/event-bus.js +3 -0
- package/dist/fetch-graphql.d.ts +1 -0
- package/dist/fetch-graphql.js +3 -0
- package/dist/i18n.d.ts +1 -0
- package/dist/i18n.js +5 -0
- package/dist/initializer.d.ts +1 -0
- package/dist/initializer.js +5 -0
- package/dist/lib.d.ts +1 -0
- package/dist/lib.js +3 -0
- package/dist/preact-compat.d.ts +1 -0
- package/dist/preact-compat.js +3 -0
- package/dist/preact-hooks.d.ts +1 -0
- package/dist/preact-hooks.js +3 -0
- package/dist/preact-jsx-runtime.d.ts +1 -0
- package/dist/preact-jsx-runtime.js +3 -0
- package/dist/preact.d.ts +1 -0
- package/dist/preact.js +3 -0
- package/dist/recaptcha.d.ts +1 -0
- package/dist/recaptcha.js +14 -0
- package/dist/signals.d.ts +1 -0
- package/dist/signals.js +3 -0
- package/dist/types/elsie/src/components/Accordion/Accordion.d.ts +27 -0
- package/dist/types/elsie/src/components/Accordion/index.d.ts +3 -0
- package/dist/types/elsie/src/components/ActionButton/ActionButton.d.ts +11 -0
- package/dist/types/elsie/src/components/ActionButton/index.d.ts +2 -0
- package/dist/types/elsie/src/components/ActionButtonGroup/ActionButtonGroup.d.ts +20 -0
- package/dist/types/elsie/src/components/ActionButtonGroup/index.d.ts +2 -0
- package/dist/types/elsie/src/components/AlertBanner/AlertBanner.d.ts +15 -0
- package/dist/types/elsie/src/components/AlertBanner/index.d.ts +3 -0
- package/dist/types/elsie/src/components/Breadcrumbs/Breadcrumbs.d.ts +9 -0
- package/dist/types/elsie/src/components/Breadcrumbs/index.d.ts +3 -0
- package/dist/types/elsie/src/components/Button/Button.d.ts +15 -0
- package/dist/types/elsie/src/components/Button/index.d.ts +3 -0
- package/dist/types/elsie/src/components/Card/Card.d.ts +9 -0
- package/dist/types/elsie/src/components/Card/index.d.ts +2 -0
- package/dist/types/elsie/src/components/CartItem/CartItem.d.ts +36 -0
- package/dist/types/elsie/src/components/CartItem/CartItemSkeleton.d.ts +4 -0
- package/dist/types/elsie/src/components/CartItem/index.d.ts +4 -0
- package/dist/types/elsie/src/components/CartList/CartList.d.ts +7 -0
- package/dist/types/elsie/src/components/CartList/index.d.ts +3 -0
- package/dist/types/elsie/src/components/Checkbox/Checkbox.d.ts +13 -0
- package/dist/types/elsie/src/components/Checkbox/index.d.ts +2 -0
- package/dist/types/elsie/src/components/ColorSwatch/ColorSwatch.d.ts +20 -0
- package/dist/types/elsie/src/components/ColorSwatch/index.d.ts +3 -0
- package/dist/types/elsie/src/components/ContentGrid/ContentGrid.d.ts +10 -0
- package/dist/types/elsie/src/components/ContentGrid/index.d.ts +19 -0
- package/dist/types/elsie/src/components/Divider/Divider.d.ts +8 -0
- package/dist/types/elsie/src/components/Divider/index.d.ts +3 -0
- package/dist/types/elsie/src/components/Field/Field.d.ts +14 -0
- package/dist/types/elsie/src/components/Field/index.d.ts +2 -0
- package/dist/types/elsie/src/components/Header/Header.d.ts +11 -0
- package/dist/types/elsie/src/components/Header/index.d.ts +3 -0
- package/dist/types/elsie/src/components/Icon/Icon.d.ts +18 -0
- package/dist/types/elsie/src/components/Icon/index.d.ts +2 -0
- package/dist/types/elsie/src/components/IllustratedMessage/IllustratedMessage.d.ts +13 -0
- package/dist/types/elsie/src/components/IllustratedMessage/index.d.ts +3 -0
- package/dist/types/elsie/src/components/Image/Image.d.ts +11 -0
- package/dist/types/elsie/src/components/Image/index.d.ts +2 -0
- package/dist/types/elsie/src/components/ImageSwatch/ImageSwatch.d.ts +20 -0
- package/dist/types/elsie/src/components/ImageSwatch/index.d.ts +3 -0
- package/dist/types/elsie/src/components/InLineAlert/InLineAlert.d.ts +19 -0
- package/dist/types/elsie/src/components/InLineAlert/index.d.ts +3 -0
- package/dist/types/elsie/src/components/Incrementer/Incrementer.d.ts +17 -0
- package/dist/types/elsie/src/components/Incrementer/index.d.ts +2 -0
- package/dist/types/elsie/src/components/Input/Input.d.ts +19 -0
- package/dist/types/elsie/src/components/Input/index.d.ts +3 -0
- package/dist/types/elsie/src/components/InputDate/InputDate.d.ts +11 -0
- package/dist/types/elsie/src/components/InputDate/index.d.ts +3 -0
- package/dist/types/elsie/src/components/InputPassword/InputPassword.d.ts +19 -0
- package/dist/types/elsie/src/components/InputPassword/PasswordStatusIndicator/PasswordStatusIndicator.d.ts +18 -0
- package/dist/types/elsie/src/components/InputPassword/PasswordStatusIndicator/index.d.ts +3 -0
- package/dist/types/elsie/src/components/InputPassword/index.d.ts +3 -0
- package/dist/types/elsie/src/components/Modal/Modal.d.ts +15 -0
- package/dist/types/elsie/src/components/Modal/index.d.ts +2 -0
- package/dist/types/elsie/src/components/Pagination/Pagination.d.ts +15 -0
- package/dist/types/elsie/src/components/Pagination/index.d.ts +3 -0
- package/dist/types/elsie/src/components/Picker/Picker.d.ts +28 -0
- package/dist/types/elsie/src/components/Picker/index.d.ts +2 -0
- package/dist/types/elsie/src/components/Price/Price.d.ts +17 -0
- package/dist/types/elsie/src/components/Price/index.d.ts +2 -0
- package/dist/types/elsie/src/components/PriceRange/PriceRange.d.ts +17 -0
- package/dist/types/elsie/src/components/PriceRange/index.d.ts +3 -0
- package/dist/types/elsie/src/components/ProgressSpinner/ProgressSpinner.d.ts +14 -0
- package/dist/types/elsie/src/components/ProgressSpinner/index.d.ts +3 -0
- package/dist/types/elsie/src/components/RadioButton/RadioButton.d.ts +16 -0
- package/dist/types/elsie/src/components/RadioButton/index.d.ts +3 -0
- package/dist/types/elsie/src/components/Skeleton/Skeleton.d.ts +17 -0
- package/dist/types/elsie/src/components/Skeleton/index.d.ts +2 -0
- package/dist/types/elsie/src/components/Tag/Tag.d.ts +9 -0
- package/dist/types/elsie/src/components/Tag/index.d.ts +3 -0
- package/dist/types/elsie/src/components/TextArea/TextArea.d.ts +11 -0
- package/dist/types/elsie/src/components/TextArea/index.d.ts +3 -0
- package/dist/types/elsie/src/components/TextSwatch/TextSwatch.d.ts +18 -0
- package/dist/types/elsie/src/components/TextSwatch/index.d.ts +3 -0
- package/dist/types/elsie/src/components/ToggleButton/ToggleButton.d.ts +14 -0
- package/dist/types/elsie/src/components/ToggleButton/index.d.ts +3 -0
- package/dist/types/elsie/src/components/UIProvider/UIProvider.d.ts +19 -0
- package/dist/types/elsie/src/components/UIProvider/index.d.ts +2 -0
- package/dist/types/elsie/src/components/index.d.ts +41 -0
- package/dist/types/elsie/src/i18n/en_US.json.d.ts +149 -0
- package/dist/types/elsie/src/i18n/index.d.ts +443 -0
- package/dist/types/elsie/src/icons/index.d.ts +43 -0
- package/dist/types/elsie/src/lib/classes.d.ts +6 -0
- package/dist/types/elsie/src/lib/config.d.ts +7 -0
- package/dist/types/elsie/src/lib/debounce.d.ts +2 -0
- package/dist/types/elsie/src/lib/deepmerge.d.ts +5 -0
- package/dist/types/elsie/src/lib/deviceUtils.d.ts +2 -0
- package/dist/types/elsie/src/lib/form-values.d.ts +5 -0
- package/dist/types/elsie/src/lib/i18n.d.ts +8 -0
- package/dist/types/elsie/src/lib/image-params-keymap.d.ts +4 -0
- package/dist/types/elsie/src/lib/index.d.ts +16 -0
- package/dist/types/elsie/src/lib/initializer.d.ts +81 -0
- package/dist/types/elsie/src/lib/is-number.d.ts +2 -0
- package/dist/types/elsie/src/lib/render.d.ts +42 -0
- package/dist/types/elsie/src/lib/resolve-image.d.ts +10 -0
- package/dist/types/elsie/src/lib/signals.d.ts +2 -0
- package/dist/types/elsie/src/lib/slot.d.ts +45 -0
- package/dist/types/elsie/src/lib/tests.d.ts +5 -0
- package/dist/types/elsie/src/lib/types.d.ts +10 -0
- package/dist/types/elsie/src/lib/vcomponent.d.ts +9 -0
- package/package.json +114 -0
- package/src/components/Accordion/Accordion.css +79 -0
- package/src/components/Accordion/Accordion.stories.tsx +566 -0
- package/src/components/Accordion/Accordion.tsx +166 -0
- package/src/components/Accordion/index.ts +2 -0
- package/src/components/ActionButton/ActionButton.css +91 -0
- package/src/components/ActionButton/ActionButton.stories.tsx +160 -0
- package/src/components/ActionButton/ActionButton.tsx +44 -0
- package/src/components/ActionButton/index.ts +1 -0
- package/src/components/ActionButtonGroup/ActionButtonGroup.css +68 -0
- package/src/components/ActionButtonGroup/ActionButtonGroup.stories.tsx +88 -0
- package/src/components/ActionButtonGroup/ActionButtonGroup.tsx +82 -0
- package/src/components/ActionButtonGroup/index.ts +1 -0
- package/src/components/AlertBanner/AlertBanner.css +135 -0
- package/src/components/AlertBanner/AlertBanner.stories.tsx +156 -0
- package/src/components/AlertBanner/AlertBanner.tsx +81 -0
- package/src/components/AlertBanner/index.ts +2 -0
- package/src/components/Breadcrumbs/Breadcrumbs.css +51 -0
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +186 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +62 -0
- package/src/components/Breadcrumbs/index.ts +2 -0
- package/src/components/Button/Button.css +204 -0
- package/src/components/Button/Button.mdx +133 -0
- package/src/components/Button/Button.stories.tsx +389 -0
- package/src/components/Button/Button.tsx +112 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Card/Card.css +25 -0
- package/src/components/Card/Card.stories.tsx +67 -0
- package/src/components/Card/Card.tsx +25 -0
- package/src/components/Card/index.ts +1 -0
- package/src/components/CartItem/CartItem.css +474 -0
- package/src/components/CartItem/CartItem.stories.tsx +588 -0
- package/src/components/CartItem/CartItem.tsx +444 -0
- package/src/components/CartItem/CartItemSkeleton.tsx +29 -0
- package/src/components/CartItem/index.ts +3 -0
- package/src/components/CartList/CartList.css +26 -0
- package/src/components/CartList/CartList.stories.tsx +102 -0
- package/src/components/CartList/CartList.tsx +31 -0
- package/src/components/CartList/index.ts +2 -0
- package/src/components/Checkbox/Checkbox.css +246 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +281 -0
- package/src/components/Checkbox/Checkbox.tsx +129 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/ColorSwatch/ColorSwatch.css +123 -0
- package/src/components/ColorSwatch/ColorSwatch.stories.tsx +265 -0
- package/src/components/ColorSwatch/ColorSwatch.tsx +118 -0
- package/src/components/ColorSwatch/index.ts +2 -0
- package/src/components/ContentGrid/ContentGrid.css +62 -0
- package/src/components/ContentGrid/ContentGrid.stories.tsx +145 -0
- package/src/components/ContentGrid/ContentGrid.tsx +65 -0
- package/src/components/ContentGrid/index.ts +19 -0
- package/src/components/Divider/Divider.css +13 -0
- package/src/components/Divider/Divider.stories.tsx +53 -0
- package/src/components/Divider/Divider.tsx +24 -0
- package/src/components/Divider/index.ts +2 -0
- package/src/components/Field/Field.css +74 -0
- package/src/components/Field/Field.stories.tsx +229 -0
- package/src/components/Field/Field.tsx +75 -0
- package/src/components/Field/index.ts +1 -0
- package/src/components/Header/Header.css +47 -0
- package/src/components/Header/Header.stories.tsx +128 -0
- package/src/components/Header/Header.tsx +53 -0
- package/src/components/Header/index.ts +2 -0
- package/src/components/Icon/Icon.css +17 -0
- package/src/components/Icon/Icon.stories.helpers.jsx +12 -0
- package/src/components/Icon/Icon.stories.tsx +88 -0
- package/src/components/Icon/Icon.tsx +103 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/IllustratedMessage/IllustratedMessage.css +52 -0
- package/src/components/IllustratedMessage/IllustratedMessage.stories.tsx +117 -0
- package/src/components/IllustratedMessage/IllustratedMessage.tsx +69 -0
- package/src/components/IllustratedMessage/index.ts +2 -0
- package/src/components/Image/Image.css +43 -0
- package/src/components/Image/Image.stories.tsx +80 -0
- package/src/components/Image/Image.tsx +57 -0
- package/src/components/Image/index.ts +1 -0
- package/src/components/ImageSwatch/ImageSwatch.css +145 -0
- package/src/components/ImageSwatch/ImageSwatch.stories.tsx +252 -0
- package/src/components/ImageSwatch/ImageSwatch.tsx +111 -0
- package/src/components/ImageSwatch/index.ts +2 -0
- package/src/components/InLineAlert/InLineAlert.css +107 -0
- package/src/components/InLineAlert/InLineAlert.stories.tsx +317 -0
- package/src/components/InLineAlert/InLineAlert.tsx +119 -0
- package/src/components/InLineAlert/index.ts +2 -0
- package/src/components/Incrementer/Incrementer.css +156 -0
- package/src/components/Incrementer/Incrementer.stories.tsx +163 -0
- package/src/components/Incrementer/Incrementer.tsx +183 -0
- package/src/components/Incrementer/index.ts +1 -0
- package/src/components/Input/Input.css +295 -0
- package/src/components/Input/Input.stories.tsx +146 -0
- package/src/components/Input/Input.tsx +157 -0
- package/src/components/Input/index.ts +2 -0
- package/src/components/InputDate/InputDate.css +47 -0
- package/src/components/InputDate/InputDate.stories.tsx +108 -0
- package/src/components/InputDate/InputDate.tsx +111 -0
- package/src/components/InputDate/index.ts +2 -0
- package/src/components/InputPassword/InputPassword.css +22 -0
- package/src/components/InputPassword/InputPassword.stories.tsx +139 -0
- package/src/components/InputPassword/InputPassword.tsx +126 -0
- package/src/components/InputPassword/PasswordStatusIndicator/PasswordStatusIndicator.css +22 -0
- package/src/components/InputPassword/PasswordStatusIndicator/PasswordStatusIndicator.tsx +87 -0
- package/src/components/InputPassword/PasswordStatusIndicator/index.ts +2 -0
- package/src/components/InputPassword/index.ts +2 -0
- package/src/components/Modal/Modal.css +130 -0
- package/src/components/Modal/Modal.stories.tsx +255 -0
- package/src/components/Modal/Modal.tsx +162 -0
- package/src/components/Modal/index.ts +15 -0
- package/src/components/Pagination/Pagination.css +86 -0
- package/src/components/Pagination/Pagination.stories.tsx +108 -0
- package/src/components/Pagination/Pagination.tsx +140 -0
- package/src/components/Pagination/index.ts +2 -0
- package/src/components/Picker/Picker.css +211 -0
- package/src/components/Picker/Picker.stories.tsx +309 -0
- package/src/components/Picker/Picker.tsx +194 -0
- package/src/components/Picker/index.ts +1 -0
- package/src/components/Price/Price.css +48 -0
- package/src/components/Price/Price.stories.tsx +101 -0
- package/src/components/Price/Price.tsx +66 -0
- package/src/components/Price/index.ts +1 -0
- package/src/components/PriceRange/PriceRange.css +57 -0
- package/src/components/PriceRange/PriceRange.stories.tsx +231 -0
- package/src/components/PriceRange/PriceRange.tsx +239 -0
- package/src/components/PriceRange/index.ts +2 -0
- package/src/components/ProgressSpinner/ProgressSpinner.css +82 -0
- package/src/components/ProgressSpinner/ProgressSpinner.stories.tsx +291 -0
- package/src/components/ProgressSpinner/ProgressSpinner.tsx +77 -0
- package/src/components/ProgressSpinner/index.ts +2 -0
- package/src/components/RadioButton/RadioButton.css +125 -0
- package/src/components/RadioButton/RadioButton.stories.tsx +117 -0
- package/src/components/RadioButton/RadioButton.tsx +77 -0
- package/src/components/RadioButton/index.ts +2 -0
- package/src/components/Skeleton/Skeleton.css +136 -0
- package/src/components/Skeleton/Skeleton.stories.tsx +256 -0
- package/src/components/Skeleton/Skeleton.tsx +124 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/Tag/Tag.css +17 -0
- package/src/components/Tag/Tag.stories.tsx +94 -0
- package/src/components/Tag/Tag.tsx +29 -0
- package/src/components/Tag/index.ts +2 -0
- package/src/components/TextArea/TextArea.css +131 -0
- package/src/components/TextArea/TextArea.stories.tsx +121 -0
- package/src/components/TextArea/TextArea.tsx +80 -0
- package/src/components/TextArea/index.ts +2 -0
- package/src/components/TextSwatch/TextSwatch.css +143 -0
- package/src/components/TextSwatch/TextSwatch.stories.tsx +268 -0
- package/src/components/TextSwatch/TextSwatch.tsx +122 -0
- package/src/components/TextSwatch/index.ts +2 -0
- package/src/components/ToggleButton/ToggleButton.css +77 -0
- package/src/components/ToggleButton/ToggleButton.stories.tsx +146 -0
- package/src/components/ToggleButton/ToggleButton.tsx +67 -0
- package/src/components/ToggleButton/index.ts +2 -0
- package/src/components/UIProvider/UIProvider.css +131 -0
- package/src/components/UIProvider/UIProvider.tsx +52 -0
- package/src/components/UIProvider/debugger.css +38 -0
- package/src/components/UIProvider/index.ts +1 -0
- package/src/components/UIProvider/normalize.css +17 -0
- package/src/components/index.ts +40 -0
- package/src/docs/API/event-bus.mdx +52 -0
- package/src/docs/API/graphql.mdx +214 -0
- package/src/docs/API/initializer.mdx +110 -0
- package/src/docs/API/render.mdx +125 -0
- package/src/docs/Design/colors.mdx +202 -0
- package/src/docs/Design/designBlocks.jsx +87 -0
- package/src/docs/Design/getTokenData.ts +28 -0
- package/src/docs/Design/grid.mdx +365 -0
- package/src/docs/Design/overview.mdx +69 -0
- package/src/docs/Design/shapes.mdx +100 -0
- package/src/docs/Design/spacing.mdx +22 -0
- package/src/docs/Design/typography.mdx +126 -0
- package/src/docs/Utilities/classList.mdx +52 -0
- package/src/docs/Utilities/debounce.mdx +49 -0
- package/src/docs/Utilities/deepmerge.mdx +12 -0
- package/src/docs/Utilities/getFormErrors.mdx +41 -0
- package/src/docs/Utilities/getFormValues.mdx +38 -0
- package/src/docs/assets/Banner.png +0 -0
- package/src/docs/assets/Colors.png +0 -0
- package/src/docs/assets/DropinBanner.png +0 -0
- package/src/docs/assets/ShapeStyles.png +0 -0
- package/src/docs/assets/Spacing.png +0 -0
- package/src/docs/assets/Typography.png +0 -0
- package/src/docs/cli-usage.mdx +181 -0
- package/src/docs/components/overview.mdx +124 -0
- package/src/docs/quick-start.mdx +245 -0
- package/src/docs/slots.mdx +211 -0
- package/src/docs/welcome.mdx +52 -0
- package/src/i18n/en_US.json +146 -0
- package/src/i18n/index.ts +17 -0
- package/src/icons/Add.svg +9 -0
- package/src/icons/AddressBook.svg +3 -0
- package/src/icons/Bulk.svg +24 -0
- package/src/icons/Burger.svg +5 -0
- package/src/icons/Card.svg +7 -0
- package/src/icons/Cart.svg +11 -0
- package/src/icons/Check.svg +8 -0
- package/src/icons/CheckWithCircle.svg +4 -0
- package/src/icons/ChevronDown.svg +3 -0
- package/src/icons/ChevronRight.svg +8 -0
- package/src/icons/ChevronUp.svg +3 -0
- package/src/icons/Close.svg +4 -0
- package/src/icons/Coupon.svg +3 -0
- package/src/icons/Date.svg +4 -0
- package/src/icons/Delivery.svg +11 -0
- package/src/icons/EmptyBox.svg +3 -0
- package/src/icons/Eye.svg +3 -0
- package/src/icons/EyeClose.svg +3 -0
- package/src/icons/Gift.svg +3 -0
- package/src/icons/GiftCard.svg +3 -0
- package/src/icons/Heart.svg +3 -0
- package/src/icons/HeartFilled.svg +3 -0
- package/src/icons/InfoFilled.svg +3 -0
- package/src/icons/Locker.svg +11 -0
- package/src/icons/Minus.svg +3 -0
- package/src/icons/Order.svg +6 -0
- package/src/icons/OrderError.svg +15 -0
- package/src/icons/OrderSuccess.svg +15 -0
- package/src/icons/PaymentError.svg +16 -0
- package/src/icons/Placeholder.svg +3 -0
- package/src/icons/PlaceholderFilled.svg +4 -0
- package/src/icons/Search.svg +9 -0
- package/src/icons/SearchFilled.svg +10 -0
- package/src/icons/Sort.svg +12 -0
- package/src/icons/Star.svg +8 -0
- package/src/icons/Trash.svg +7 -0
- package/src/icons/User.svg +5 -0
- package/src/icons/View.svg +14 -0
- package/src/icons/Wallet.svg +6 -0
- package/src/icons/Warning.svg +12 -0
- package/src/icons/WarningFilled.svg +3 -0
- package/src/icons/WarningWithCircle.svg +4 -0
- package/src/icons/index.ts +42 -0
- package/src/lib/classes.ts +25 -0
- package/src/lib/config.ts +15 -0
- package/src/lib/debounce.ts +7 -0
- package/src/lib/deepmerge.ts +36 -0
- package/src/lib/deviceUtils.ts +7 -0
- package/src/lib/form-values.ts +22 -0
- package/src/lib/i18n.ts +9 -0
- package/src/lib/image-params-keymap.ts +25 -0
- package/src/lib/index.ts +15 -0
- package/src/lib/initializer.ts +122 -0
- package/src/lib/is-number.ts +3 -0
- package/src/lib/render.tsx +129 -0
- package/src/lib/resolve-image.ts +77 -0
- package/src/lib/signals.ts +2 -0
- package/src/lib/slot.tsx +425 -0
- package/src/lib/tests.tsx +38 -0
- package/src/lib/types.ts +7 -0
- package/src/lib/vcomponent.tsx +47 -0
- package/static/assets/images/Card.png +0 -0
- package/static/assets/images/example.jpg +0 -0
- package/static/assets/images/index.ts +2 -0
- package/static/dropin.png +0 -0
- package/static/favicon.svg +14 -0
- package/storybook-stories.js +12 -0
- package/tests/__mocks__/browserMocks.ts +19 -0
- package/tests/__mocks__/fileMocks.ts +3 -0
- package/tests/__mocks__/styleMock.ts +0 -0
- package/types/icons.d.ts +9 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// https://storybook.js.org/docs/7.0/preact/writing-stories/introduction
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/preact';
|
|
3
|
+
import {
|
|
4
|
+
Incrementer,
|
|
5
|
+
IncrementerProps,
|
|
6
|
+
} from '@adobe/elsie/components/Incrementer';
|
|
7
|
+
import { action } from '@storybook/addon-actions';
|
|
8
|
+
import { expect, userEvent, within } from '@storybook/test';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Use Incrementer to let users increase or decrease a value.
|
|
12
|
+
*/
|
|
13
|
+
const meta: Meta<IncrementerProps> = {
|
|
14
|
+
title: 'Components/Incrementer',
|
|
15
|
+
component: Incrementer,
|
|
16
|
+
argTypes: {
|
|
17
|
+
name: {
|
|
18
|
+
description: 'Field name (used for mapping the value in a form)',
|
|
19
|
+
type: {
|
|
20
|
+
required: false,
|
|
21
|
+
name: 'string',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
value: {
|
|
25
|
+
description: 'Field value',
|
|
26
|
+
type: 'string',
|
|
27
|
+
},
|
|
28
|
+
size: {
|
|
29
|
+
description: 'medium | large',
|
|
30
|
+
defaultValue: { summary: 'medium' },
|
|
31
|
+
options: ['medium', 'large'],
|
|
32
|
+
control: { type: 'radio' },
|
|
33
|
+
type: 'string',
|
|
34
|
+
},
|
|
35
|
+
min: {
|
|
36
|
+
description: 'Minimum value',
|
|
37
|
+
type: 'number',
|
|
38
|
+
},
|
|
39
|
+
max: {
|
|
40
|
+
description: 'Maximum value',
|
|
41
|
+
type: 'number',
|
|
42
|
+
},
|
|
43
|
+
disabled: {
|
|
44
|
+
description: 'Whether or not the field is disabled',
|
|
45
|
+
control: 'boolean',
|
|
46
|
+
defaultValue: false,
|
|
47
|
+
},
|
|
48
|
+
'aria-label': {
|
|
49
|
+
description: 'Aria label',
|
|
50
|
+
type: 'string',
|
|
51
|
+
},
|
|
52
|
+
onValue: {
|
|
53
|
+
description: 'Callback function to handle value change',
|
|
54
|
+
type: 'function',
|
|
55
|
+
},
|
|
56
|
+
onUpdateError: {
|
|
57
|
+
description: 'Callback function to handle error',
|
|
58
|
+
type: 'function',
|
|
59
|
+
},
|
|
60
|
+
error: {
|
|
61
|
+
description: 'Whether or not the field shows an error',
|
|
62
|
+
type: 'boolean',
|
|
63
|
+
},
|
|
64
|
+
success: {
|
|
65
|
+
description:
|
|
66
|
+
'Whether or not the field value has been updated successfully',
|
|
67
|
+
type: 'boolean',
|
|
68
|
+
},
|
|
69
|
+
maxLength: {
|
|
70
|
+
description: 'Maximum length of the input field',
|
|
71
|
+
type: 'number',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default meta;
|
|
77
|
+
|
|
78
|
+
type Story = StoryObj<IncrementerProps>;
|
|
79
|
+
|
|
80
|
+
export const Primary: Story = {
|
|
81
|
+
args: {
|
|
82
|
+
size: 'medium',
|
|
83
|
+
onValue: action('onValue'),
|
|
84
|
+
name: 'incrementerField',
|
|
85
|
+
value: '1',
|
|
86
|
+
min: 1,
|
|
87
|
+
max: 100,
|
|
88
|
+
disabled: false,
|
|
89
|
+
'aria-label': 'Quantity',
|
|
90
|
+
},
|
|
91
|
+
play: async () => {
|
|
92
|
+
const canvasElement = document.querySelector(
|
|
93
|
+
'#storybook-root'
|
|
94
|
+
) as HTMLElement;
|
|
95
|
+
const canvas = within(canvasElement);
|
|
96
|
+
const decreaseButton = document.querySelector(
|
|
97
|
+
'button[aria-label="Decrease Quantity"]'
|
|
98
|
+
) as HTMLElement;
|
|
99
|
+
const inputField = document.querySelector('input') as HTMLElement;
|
|
100
|
+
const increaseButton = document.querySelector(
|
|
101
|
+
'button[aria-label="Increase Quantity"]'
|
|
102
|
+
) as HTMLElement;
|
|
103
|
+
|
|
104
|
+
// Without this wait test failing intermittently as click event is triggering before even element fully loaded
|
|
105
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
106
|
+
await userEvent.click(increaseButton);
|
|
107
|
+
await expect(await canvas.findByDisplayValue('2')).toBeTruthy();
|
|
108
|
+
|
|
109
|
+
await userEvent.click(decreaseButton);
|
|
110
|
+
await expect(await canvas.findByDisplayValue('1')).toBeTruthy();
|
|
111
|
+
|
|
112
|
+
await userEvent.clear(inputField);
|
|
113
|
+
await userEvent.type(inputField, '99');
|
|
114
|
+
await expect(await canvas.findByDisplayValue('99')).toBeTruthy();
|
|
115
|
+
|
|
116
|
+
await userEvent.click(increaseButton);
|
|
117
|
+
await expect(await canvas.findByDisplayValue('100')).toBeTruthy();
|
|
118
|
+
|
|
119
|
+
await userEvent.click(increaseButton);
|
|
120
|
+
await expect(await canvas.findByDisplayValue('100')).toBeTruthy();
|
|
121
|
+
|
|
122
|
+
await userEvent.click(decreaseButton);
|
|
123
|
+
await expect(await canvas.findByDisplayValue('99')).toBeTruthy();
|
|
124
|
+
|
|
125
|
+
await userEvent.clear(inputField);
|
|
126
|
+
await userEvent.type(inputField, '1');
|
|
127
|
+
await expect(await canvas.findByDisplayValue('1')).toBeTruthy();
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const WithError = {
|
|
132
|
+
args: {
|
|
133
|
+
size: 'medium',
|
|
134
|
+
onValue: action('onValue'),
|
|
135
|
+
onBlur: action('onBlur'),
|
|
136
|
+
name: 'incrementerField',
|
|
137
|
+
value: '1001',
|
|
138
|
+
min: 1,
|
|
139
|
+
max: 100,
|
|
140
|
+
disabled: false,
|
|
141
|
+
'aria-label': 'Quantity',
|
|
142
|
+
},
|
|
143
|
+
play: async () => {
|
|
144
|
+
const canvasElement = document.querySelector(
|
|
145
|
+
'#storybook-root'
|
|
146
|
+
) as HTMLElement;
|
|
147
|
+
const canvas = within(canvasElement);
|
|
148
|
+
const increaseButton = document.querySelector(
|
|
149
|
+
'button[aria-label="Increase Quantity"]'
|
|
150
|
+
) as HTMLElement;
|
|
151
|
+
|
|
152
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
153
|
+
await userEvent.click(increaseButton);
|
|
154
|
+
await expect(await canvas.findByDisplayValue('1001')).toBeTruthy();
|
|
155
|
+
|
|
156
|
+
const error = document.querySelector(
|
|
157
|
+
'.dropin-incrementer__content--error-message'
|
|
158
|
+
) as HTMLElement;
|
|
159
|
+
|
|
160
|
+
await expect(error).toBeVisible();
|
|
161
|
+
await expect(error).toHaveTextContent('Maximum quantity is 100');
|
|
162
|
+
},
|
|
163
|
+
};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { useState, useCallback } from 'preact/hooks';
|
|
3
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
4
|
+
import { classes, debounce } from '@adobe/elsie/lib';
|
|
5
|
+
import { Add, Minus } from '@adobe/elsie/icons';
|
|
6
|
+
import { Icon } from '@adobe/elsie/components/Icon';
|
|
7
|
+
import { Localizer, Text } from '@adobe/elsie/i18n';
|
|
8
|
+
import '@adobe/elsie/components/Incrementer/Incrementer.css';
|
|
9
|
+
|
|
10
|
+
export interface IncrementerProps
|
|
11
|
+
extends Omit<HTMLAttributes<HTMLInputElement>, 'size'> {
|
|
12
|
+
name?: string;
|
|
13
|
+
size?: 'medium' | 'large';
|
|
14
|
+
onValue?: (value: any) => void;
|
|
15
|
+
onUpdateError?: (error: Error) => void;
|
|
16
|
+
error?: boolean;
|
|
17
|
+
success?: boolean;
|
|
18
|
+
min?: number;
|
|
19
|
+
max?: number;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
maxLength?: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const Incrementer: FunctionComponent<IncrementerProps> = ({
|
|
25
|
+
name,
|
|
26
|
+
value = '1',
|
|
27
|
+
className,
|
|
28
|
+
disabled,
|
|
29
|
+
error,
|
|
30
|
+
success,
|
|
31
|
+
min,
|
|
32
|
+
max,
|
|
33
|
+
onValue,
|
|
34
|
+
onUpdateError,
|
|
35
|
+
size = 'medium',
|
|
36
|
+
...props
|
|
37
|
+
}) => {
|
|
38
|
+
const [currentValue, setCurrentValue] = useState<number>(Number(value));
|
|
39
|
+
const minValue = Number(min);
|
|
40
|
+
const maxValue = Number(max);
|
|
41
|
+
const isInvalid = error || currentValue < minValue || currentValue > maxValue;
|
|
42
|
+
|
|
43
|
+
const errorMessage =
|
|
44
|
+
currentValue < minValue
|
|
45
|
+
? 'Dropin.Incrementer.minQuantityMessage'
|
|
46
|
+
: currentValue > maxValue
|
|
47
|
+
? 'Dropin.Incrementer.maxQuantityMessage'
|
|
48
|
+
: 'Dropin.Incrementer.errorMessage';
|
|
49
|
+
|
|
50
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
|
+
const debouncedOnValueHandler = useCallback(
|
|
52
|
+
debounce(async (newValue: any) => {
|
|
53
|
+
if (onValue) {
|
|
54
|
+
try {
|
|
55
|
+
onValue(newValue);
|
|
56
|
+
} catch (e) {
|
|
57
|
+
if (onUpdateError) {
|
|
58
|
+
onUpdateError(e as Error);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, 200),
|
|
63
|
+
[onValue, onUpdateError]
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const handleIncrementer = (_value: number) => {
|
|
67
|
+
let newValue = _value;
|
|
68
|
+
debouncedOnValueHandler(newValue);
|
|
69
|
+
setCurrentValue(newValue);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div
|
|
74
|
+
className={classes([
|
|
75
|
+
'dropin-incrementer',
|
|
76
|
+
`dropin-incrementer--${size}`,
|
|
77
|
+
className,
|
|
78
|
+
])}
|
|
79
|
+
>
|
|
80
|
+
<div
|
|
81
|
+
className={classes([
|
|
82
|
+
'dropin-incrementer__content',
|
|
83
|
+
`dropin-incrementer__content--${size}`,
|
|
84
|
+
[`dropin-incrementer__content--error`, isInvalid],
|
|
85
|
+
[`dropin-incrementer__content--success`, success],
|
|
86
|
+
[`dropin-incrementer__content--disabled`, disabled],
|
|
87
|
+
])}
|
|
88
|
+
>
|
|
89
|
+
{/* Minus Button */}
|
|
90
|
+
<div
|
|
91
|
+
className={classes([
|
|
92
|
+
'dropin-incrementer__button-container',
|
|
93
|
+
[`dropin-incrementer__button-container--disabled`, disabled],
|
|
94
|
+
])}
|
|
95
|
+
>
|
|
96
|
+
<Localizer>
|
|
97
|
+
<button
|
|
98
|
+
type="button"
|
|
99
|
+
className={classes([
|
|
100
|
+
'dropin-incrementer__decrease-button',
|
|
101
|
+
[`dropin-incrementer__decrease-button--disabled`, disabled],
|
|
102
|
+
])}
|
|
103
|
+
onClick={() => handleIncrementer(currentValue - 1)}
|
|
104
|
+
disabled={disabled || currentValue < minValue + 1}
|
|
105
|
+
aria-label={
|
|
106
|
+
(<Text id="Dropin.Incrementer.decreaseLabel" />) as any
|
|
107
|
+
}
|
|
108
|
+
>
|
|
109
|
+
<Icon
|
|
110
|
+
source={Minus}
|
|
111
|
+
size="16"
|
|
112
|
+
stroke="1"
|
|
113
|
+
viewBox="4 2 20 20"
|
|
114
|
+
className="dropin-incrementer__down"
|
|
115
|
+
/>
|
|
116
|
+
</button>
|
|
117
|
+
</Localizer>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
{/* Input Field */}
|
|
121
|
+
<input
|
|
122
|
+
className="dropin-incrementer__input"
|
|
123
|
+
max={max}
|
|
124
|
+
min={min}
|
|
125
|
+
step={1}
|
|
126
|
+
type="number"
|
|
127
|
+
name={name}
|
|
128
|
+
value={currentValue}
|
|
129
|
+
disabled={disabled}
|
|
130
|
+
onBlur={() => {
|
|
131
|
+
handleIncrementer(Number(currentValue));
|
|
132
|
+
}}
|
|
133
|
+
onChange={(e) => {
|
|
134
|
+
const newValue = e.currentTarget.value;
|
|
135
|
+
if (newValue !== '') {
|
|
136
|
+
handleIncrementer(Number(newValue));
|
|
137
|
+
}
|
|
138
|
+
}}
|
|
139
|
+
{...props}
|
|
140
|
+
/>
|
|
141
|
+
|
|
142
|
+
<div
|
|
143
|
+
className={classes([
|
|
144
|
+
'dropin-incrementer__button-container',
|
|
145
|
+
[`dropin-incrementer__button-container--disabled`, disabled],
|
|
146
|
+
])}
|
|
147
|
+
>
|
|
148
|
+
{/* Plus/Add button */}
|
|
149
|
+
<Localizer>
|
|
150
|
+
<button
|
|
151
|
+
type="button"
|
|
152
|
+
className={classes([
|
|
153
|
+
'dropin-incrementer__increase-button',
|
|
154
|
+
[`dropin-incrementer__increase-button--disabled`, disabled],
|
|
155
|
+
])}
|
|
156
|
+
onClick={() => handleIncrementer(currentValue + 1)}
|
|
157
|
+
disabled={disabled || currentValue > maxValue - 1}
|
|
158
|
+
aria-label={
|
|
159
|
+
(<Text id="Dropin.Incrementer.increaseLabel" />) as any
|
|
160
|
+
}
|
|
161
|
+
>
|
|
162
|
+
<Icon
|
|
163
|
+
source={Add}
|
|
164
|
+
size="16"
|
|
165
|
+
stroke="1"
|
|
166
|
+
viewBox="4 2 20 20"
|
|
167
|
+
className="dropin-incrementer__add"
|
|
168
|
+
/>
|
|
169
|
+
</button>
|
|
170
|
+
</Localizer>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
{isInvalid && (
|
|
174
|
+
<p className="dropin-incrementer__content--error-message">
|
|
175
|
+
<Text
|
|
176
|
+
id={errorMessage}
|
|
177
|
+
fields={{ minQuantity: min, maxQuantity: max }}
|
|
178
|
+
/>
|
|
179
|
+
</p>
|
|
180
|
+
)}
|
|
181
|
+
</div>
|
|
182
|
+
);
|
|
183
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@adobe/elsie/components/Incrementer/Incrementer';
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/* https://cssguidelin.es/#bem-like-naming */
|
|
2
|
+
|
|
3
|
+
/* Input */
|
|
4
|
+
.dropin-input {
|
|
5
|
+
background-color: transparent;
|
|
6
|
+
border-color: var(--color-neutral-600);
|
|
7
|
+
border-radius: var(--shape-border-radius-1);
|
|
8
|
+
border-style: inset solid;
|
|
9
|
+
color: var(--color-neutral-800);
|
|
10
|
+
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
|
|
11
|
+
-moz-box-sizing: border-box; /* Firefox, other Gecko */
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
width: 100%;
|
|
14
|
+
max-width: 100%;
|
|
15
|
+
z-index: 1;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.dropin-input[type='number'],
|
|
19
|
+
.dropin-input[type='text'] {
|
|
20
|
+
-moz-appearance: textfield;
|
|
21
|
+
appearance: textfield;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.dropin-input:focus {
|
|
25
|
+
outline: none;
|
|
26
|
+
box-shadow: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.dropin-input:disabled {
|
|
30
|
+
border-top-left-radius: var(--shape-border-radius-1);
|
|
31
|
+
border-top-right-radius: var(--shape-border-radius-1);
|
|
32
|
+
border-color: var(--color-neutral-500);
|
|
33
|
+
background-color: var(--color-neutral-300);
|
|
34
|
+
color: var(--color-neutral-500);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Placeholder */
|
|
38
|
+
.dropin-input::placeholder,
|
|
39
|
+
.dropin-input::-webkit-input-placeholder,
|
|
40
|
+
.dropin-input::-ms-input-placeholder {
|
|
41
|
+
color: var(--color-neutral-700);
|
|
42
|
+
opacity: 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.dropin-input:disabled::-webkit-input-placeholder {
|
|
46
|
+
/* WebKit browsers */
|
|
47
|
+
color: var(--color-neutral-500);
|
|
48
|
+
}
|
|
49
|
+
.dropin-input:disabled:-moz-placeholder {
|
|
50
|
+
/* Mozilla Firefox 4 to 18 */
|
|
51
|
+
color: var(--color-neutral-500);
|
|
52
|
+
}
|
|
53
|
+
.dropin-input:disabled::-moz-placeholder {
|
|
54
|
+
/* Mozilla Firefox 19+ */
|
|
55
|
+
color: var(--color-neutral-500);
|
|
56
|
+
}
|
|
57
|
+
.dropin-input:disabled:-ms-input-placeholder {
|
|
58
|
+
/* Internet Explorer 10+ */
|
|
59
|
+
color: var(--color-neutral-500);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Containers */
|
|
63
|
+
.dropin-input-container {
|
|
64
|
+
--icon-size: var(--spacing-small);
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
position: relative;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.dropin-input-label-container {
|
|
71
|
+
position: relative;
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-grow: 1;
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Primary variant */
|
|
78
|
+
.dropin-input--primary {
|
|
79
|
+
border: var(--shape-border-width-1) solid var(--color-neutral-600);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.dropin-input--primary:focus {
|
|
83
|
+
border-color: var(--color-neutral-800);
|
|
84
|
+
border-radius: var(--shape-border-radius-1);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
div.dropin-input-container--primary .dropin-input--disabled {
|
|
88
|
+
border: var(--shape-border-width-1) solid var(--color-neutral-500);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.dropin-input-container--primary .dropin-input--error {
|
|
92
|
+
border: var(--shape-border-width-2) solid var(--color-alert-500);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.dropin-input-container--primary .dropin-input--success {
|
|
96
|
+
border: var(--shape-border-width-2) solid var(--color-positive-500);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* Secondary variant */
|
|
100
|
+
.dropin-input--secondary {
|
|
101
|
+
border: 0;
|
|
102
|
+
border-radius: 0;
|
|
103
|
+
border-top: var(--shape-border-width-1) solid transparent;
|
|
104
|
+
border-bottom: var(--shape-border-width-1) solid var(--color-neutral-600);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.dropin-input--secondary:focus {
|
|
108
|
+
border-top-left-radius: var(--shape-border-radius-1);
|
|
109
|
+
border-top-right-radius: var(--shape-border-radius-1);
|
|
110
|
+
border-bottom-color: var(--color-neutral-800);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* Container Secondary */
|
|
114
|
+
div.dropin-input-container--secondary .dropin-input--disabled {
|
|
115
|
+
border: 0;
|
|
116
|
+
border-radius: 0;
|
|
117
|
+
border-bottom: var(--shape-border-width-1) solid var(--color-neutral-500);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.dropin-input-container--secondary .dropin-input--error {
|
|
121
|
+
border: 0;
|
|
122
|
+
border-radius: 0;
|
|
123
|
+
border-bottom: var(--shape-border-width-2) solid var(--color-alert-500);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.dropin-input-container--secondary .dropin-input--success {
|
|
127
|
+
border: 0;
|
|
128
|
+
border-radius: 0;
|
|
129
|
+
border-bottom: var(--shape-border-width-2) solid var(--color-positive-500);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* Size
|
|
133
|
+
Medium variant has a resulting height of 40px
|
|
134
|
+
Large variant has a resulting height of 48px
|
|
135
|
+
FloatingLabel variant has a resulting height of 56px in any variant
|
|
136
|
+
*/
|
|
137
|
+
.dropin-input--medium {
|
|
138
|
+
font: var(--type-body-2-default-font);
|
|
139
|
+
letter-spacing: var(--type-body-2-default-letter-spacing);
|
|
140
|
+
padding: 9px var(--spacing-small);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.dropin-input--medium ~ label {
|
|
144
|
+
font: var(--type-body-2-default-font);
|
|
145
|
+
letter-spacing: var(--type-body-2-default-letter-spacing);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.dropin-input--large {
|
|
149
|
+
font: var(--type-body-1-default-font);
|
|
150
|
+
letter-spacing: var(--type-body-1-default-letter-spacing);
|
|
151
|
+
padding: 11px var(--spacing-small);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.dropin-input--large ~ label {
|
|
155
|
+
font: var(--type-body-1-default-font);
|
|
156
|
+
letter-spacing: var(--type-body-1-default-letter-spacing);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* Floating Label */
|
|
160
|
+
.dropin-input__label--floating {
|
|
161
|
+
cursor: text;
|
|
162
|
+
color: var(--color-neutral-700);
|
|
163
|
+
padding-left: var(--spacing-small);
|
|
164
|
+
position: absolute;
|
|
165
|
+
pointer-events: none;
|
|
166
|
+
transform: translateY(-50%);
|
|
167
|
+
top: 50%;
|
|
168
|
+
transition: top 50ms ease-in, left 50ms ease-in, font-size 50ms ease-in;
|
|
169
|
+
z-index: 1;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.dropin-input__label--floating,
|
|
173
|
+
.dropin-input--floating {
|
|
174
|
+
transition: all 0.2s;
|
|
175
|
+
touch-action: manipulation;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.dropin-input--medium.dropin-input--floating {
|
|
179
|
+
padding-top: 17px;
|
|
180
|
+
padding-bottom: 17px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.dropin-input--medium.dropin-input--floating:focus,
|
|
184
|
+
.dropin-input--medium.dropin-input--floating:not(:placeholder-shown) {
|
|
185
|
+
padding-top: 26px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.dropin-input--large.dropin-input--floating {
|
|
189
|
+
padding-top: 15px;
|
|
190
|
+
padding-bottom: 15px;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.dropin-input--large.dropin-input--floating:focus,
|
|
194
|
+
.dropin-input--large.dropin-input--floating:not(:placeholder-shown) {
|
|
195
|
+
padding-top: 22px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.dropin-input--floating:focus,
|
|
199
|
+
.dropin-input--floating:not(:placeholder-shown) {
|
|
200
|
+
padding-bottom: calc(var(--spacing-small) - var(--spacing-xsmall));
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.dropin-input__label--floating--icon-left {
|
|
204
|
+
padding-left: calc(var(--icon-size) + (var(--spacing-small) * 2));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.dropin-input--floating:-webkit-autofill ~ .dropin-input__label--floating,
|
|
208
|
+
.dropin-input-container--floating:focus-within .dropin-input__label--floating {
|
|
209
|
+
color: var(--color-neutral-800);
|
|
210
|
+
transform: translate(0.1em, -1.5em);
|
|
211
|
+
font: var(--type-details-caption-1-font);
|
|
212
|
+
letter-spacing: var(--type-details-caption-1-letter-spacing);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.dropin-input--floating:not(:placeholder-shown)
|
|
216
|
+
~ .dropin-input__label--floating {
|
|
217
|
+
transform: translate(0.1em, -1.5em);
|
|
218
|
+
font: var(--type-details-caption-1-font);
|
|
219
|
+
letter-spacing: var(--type-details-caption-1-letter-spacing);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.dropin-input-container--disabled .dropin-icon,
|
|
223
|
+
.dropin-input-container--disabled .dropin-input__label--floating {
|
|
224
|
+
color: var(--color-neutral-500);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.dropin-input--floating::-webkit-input-placeholder,
|
|
228
|
+
.dropin-input--floating::placeholder {
|
|
229
|
+
opacity: 0;
|
|
230
|
+
transition: inherit;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.dropin-input--floating:focus::-webkit-input-placeholder,
|
|
234
|
+
.dropin-input--floating:focus::placeholder {
|
|
235
|
+
opacity: 1;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.dropin-input__label--floating--error {
|
|
239
|
+
color: var(--color-alert-500);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* Icon */
|
|
243
|
+
.dropin-input--icon-right,
|
|
244
|
+
.dropin-input--icon-left {
|
|
245
|
+
--icon-space: calc(var(--icon-size) + (var(--spacing-small) * 2));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.dropin-input--icon-right {
|
|
249
|
+
padding-right: var(--icon-space);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.dropin-input--icon-left {
|
|
253
|
+
padding-left: var(--icon-space);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.dropin-input__field-icon--left,
|
|
257
|
+
.dropin-input__field-icon--right {
|
|
258
|
+
position: absolute;
|
|
259
|
+
z-index: 2;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.dropin-input__field-icon--left {
|
|
263
|
+
left: var(--spacing-small);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.dropin-input__field-icon--right {
|
|
267
|
+
right: var(--spacing-small);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.dropin-input__field-icon--error,
|
|
271
|
+
.dropin-input__field-icon--success {
|
|
272
|
+
color: var(--color-neutral-100);
|
|
273
|
+
height: var(--icon-size);
|
|
274
|
+
width: var(--icon-size);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.dropin-input__field-icon--success {
|
|
278
|
+
color: var(--color-positive-500);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.dropin-input__field-icon--error {
|
|
282
|
+
color: var(--color-alert-500);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/* Medium (portrait tablets and large phones, 768px and up) */
|
|
286
|
+
/* @media only screen and (min-width: 768px) { } */
|
|
287
|
+
|
|
288
|
+
/* Large (landscape tablets, 1024px and up) */
|
|
289
|
+
/* @media only screen and (min-width: 1024px) { } */
|
|
290
|
+
|
|
291
|
+
/* XLarge (laptops/desktops, 1366px and up) */
|
|
292
|
+
/* @media only screen and (min-width: 1366px) { } */
|
|
293
|
+
|
|
294
|
+
/* XXlarge (large laptops and desktops, 1920px and up) */
|
|
295
|
+
/* @media only screen and (min-width: 1920px) { } */
|