ecars-web-lib 1.0.0
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/README.md +50 -0
- package/dist/PaginationComponent-BM_GD3t6.cjs +2 -0
- package/dist/PaginationComponent-BM_GD3t6.cjs.map +1 -0
- package/dist/PaginationComponent-_iwGlFdM.js +65 -0
- package/dist/PaginationComponent-_iwGlFdM.js.map +1 -0
- package/dist/SelectComponent-CGBwJBns.cjs +2 -0
- package/dist/SelectComponent-CGBwJBns.cjs.map +1 -0
- package/dist/SelectComponent-DJi5yeVI.js +98 -0
- package/dist/SelectComponent-DJi5yeVI.js.map +1 -0
- package/dist/_commonjsHelpers-DKOUU3wS.cjs +2 -0
- package/dist/_commonjsHelpers-DKOUU3wS.cjs.map +1 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js +9 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js.map +1 -0
- package/dist/assets/index.css +1 -0
- package/dist/chunk-KNED5TY2-9zjBD6gF.js +1659 -0
- package/dist/chunk-KNED5TY2-9zjBD6gF.js.map +1 -0
- package/dist/chunk-KNED5TY2-BcFuRn3Q.cjs +13 -0
- package/dist/chunk-KNED5TY2-BcFuRn3Q.cjs.map +1 -0
- package/dist/components/Accordion/AccordionComponent.d.ts +9 -0
- package/dist/components/Accordion/AccordionComponent.js +6 -0
- package/dist/components/Accordion/AccordionComponent.js.map +1 -0
- package/dist/components/Accordion/AccordionComponent.test.d.ts +1 -0
- package/dist/components/Accordion/AccordionComponent.test.js +32 -0
- package/dist/components/Accordion/AccordionComponent.test.js.map +1 -0
- package/dist/components/Accordion/components/AccordionArrow.d.ts +2 -0
- package/dist/components/Accordion/components/AccordionArrow.js +7 -0
- package/dist/components/Accordion/components/AccordionArrow.js.map +1 -0
- package/dist/components/Accordion/components/AccordionBlock.d.ts +6 -0
- package/dist/components/Accordion/components/AccordionBlock.js +6 -0
- package/dist/components/Accordion/components/AccordionBlock.js.map +1 -0
- package/dist/components/Accordion/components/AccordionButton.d.ts +6 -0
- package/dist/components/Accordion/components/AccordionButton.js +14 -0
- package/dist/components/Accordion/components/AccordionButton.js.map +1 -0
- package/dist/components/Accordion/components/AccordionContent.d.ts +6 -0
- package/dist/components/Accordion/components/AccordionContent.js +24 -0
- package/dist/components/Accordion/components/AccordionContent.js.map +1 -0
- package/dist/components/Accordion/components/AccordionLayout.d.ts +7 -0
- package/dist/components/Accordion/components/AccordionLayout.js +17 -0
- package/dist/components/Accordion/components/AccordionLayout.js.map +1 -0
- package/dist/components/Accordion/components/AccordionTitle.d.ts +5 -0
- package/dist/components/Accordion/components/AccordionTitle.js +6 -0
- package/dist/components/Accordion/components/AccordionTitle.js.map +1 -0
- package/dist/components/Accordion/constants.d.ts +1 -0
- package/dist/components/Accordion/constants.js +5 -0
- package/dist/components/Accordion/constants.js.map +1 -0
- package/dist/components/Accordion/index.d.ts +8 -0
- package/dist/components/Accordion/index.js +10 -0
- package/dist/components/Accordion/index.js.map +1 -0
- package/dist/components/Button/Button.d.ts +14 -0
- package/dist/components/Button/Button.js +34 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/Button.test.d.ts +1 -0
- package/dist/components/Button/Button.test.js +101 -0
- package/dist/components/Button/Button.test.js.map +1 -0
- package/dist/components/Button/constants.d.ts +15 -0
- package/dist/components/Button/constants.js +15 -0
- package/dist/components/Button/constants.js.map +1 -0
- package/dist/components/ButtonWithIcon/ButtonWithIcon.d.ts +13 -0
- package/dist/components/ButtonWithIcon/ButtonWithIcon.js +37 -0
- package/dist/components/ButtonWithIcon/ButtonWithIcon.js.map +1 -0
- package/dist/components/ButtonWithIcon/ButtonWithIcon.test.d.ts +1 -0
- package/dist/components/ButtonWithIcon/ButtonWithIcon.test.js +55 -0
- package/dist/components/ButtonWithIcon/ButtonWithIcon.test.js.map +1 -0
- package/dist/components/ButtonWithIcon/constants.d.ts +2 -0
- package/dist/components/ButtonWithIcon/constants.js +6 -0
- package/dist/components/ButtonWithIcon/constants.js.map +1 -0
- package/dist/components/Category/Category.d.ts +8 -0
- package/dist/components/Category/Category.js +18 -0
- package/dist/components/Category/Category.js.map +1 -0
- package/dist/components/Category/Category.test.d.ts +1 -0
- package/dist/components/Category/Category.test.js +14 -0
- package/dist/components/Category/Category.test.js.map +1 -0
- package/dist/components/Category/constants.d.ts +7 -0
- package/dist/components/Category/constants.js +10 -0
- package/dist/components/Category/constants.js.map +1 -0
- package/dist/components/Checkbox/CheckboxComponent.d.ts +3 -0
- package/dist/components/Checkbox/CheckboxComponent.js +6 -0
- package/dist/components/Checkbox/CheckboxComponent.js.map +1 -0
- package/dist/components/Checkbox/CheckboxComponent.test.d.ts +1 -0
- package/dist/components/Checkbox/CheckboxComponent.test.js +31 -0
- package/dist/components/Checkbox/CheckboxComponent.test.js.map +1 -0
- package/dist/components/Checkbox/components/CheckboxBlock.d.ts +7 -0
- package/dist/components/Checkbox/components/CheckboxBlock.js +19 -0
- package/dist/components/Checkbox/components/CheckboxBlock.js.map +1 -0
- package/dist/components/Checkbox/components/CheckboxIndicator.d.ts +2 -0
- package/dist/components/Checkbox/components/CheckboxIndicator.js +7 -0
- package/dist/components/Checkbox/components/CheckboxIndicator.js.map +1 -0
- package/dist/components/Checkbox/components/CheckboxInput.d.ts +3 -0
- package/dist/components/Checkbox/components/CheckboxInput.js +34 -0
- package/dist/components/Checkbox/components/CheckboxInput.js.map +1 -0
- package/dist/components/Checkbox/constants.d.ts +11 -0
- package/dist/components/Checkbox/constants.js +6 -0
- package/dist/components/Checkbox/constants.js.map +1 -0
- package/dist/components/Checkbox/index.d.ts +5 -0
- package/dist/components/Checkbox/index.js +8 -0
- package/dist/components/Checkbox/index.js.map +1 -0
- package/dist/components/Dropdown/Dropdown.test.d.ts +1 -0
- package/dist/components/Dropdown/Dropdown.test.js +57 -0
- package/dist/components/Dropdown/Dropdown.test.js.map +1 -0
- package/dist/components/Dropdown/DropdownComponent.d.ts +9 -0
- package/dist/components/Dropdown/DropdownComponent.js +9 -0
- package/dist/components/Dropdown/DropdownComponent.js.map +1 -0
- package/dist/components/Dropdown/components/DropdownBlock.d.ts +5 -0
- package/dist/components/Dropdown/components/DropdownBlock.js +6 -0
- package/dist/components/Dropdown/components/DropdownBlock.js.map +1 -0
- package/dist/components/Dropdown/components/DropdownCategory.d.ts +7 -0
- package/dist/components/Dropdown/components/DropdownCategory.js +18 -0
- package/dist/components/Dropdown/components/DropdownCategory.js.map +1 -0
- package/dist/components/Dropdown/components/DropdownList.d.ts +3 -0
- package/dist/components/Dropdown/components/DropdownList.js +6 -0
- package/dist/components/Dropdown/components/DropdownList.js.map +1 -0
- package/dist/components/Dropdown/components/DropdownOption.d.ts +8 -0
- package/dist/components/Dropdown/components/DropdownOption.js +22 -0
- package/dist/components/Dropdown/components/DropdownOption.js.map +1 -0
- package/dist/components/Dropdown/constants.d.ts +11 -0
- package/dist/components/Dropdown/constants.js +5 -0
- package/dist/components/Dropdown/constants.js.map +1 -0
- package/dist/components/Dropdown/index.d.ts +6 -0
- package/dist/components/Dropdown/index.js +8 -0
- package/dist/components/Dropdown/index.js.map +1 -0
- package/dist/components/FavButton/FavButton.d.ts +11 -0
- package/dist/components/FavButton/FavButton.js +30 -0
- package/dist/components/FavButton/FavButton.js.map +1 -0
- package/dist/components/FavButton/FavButton.test.d.ts +1 -0
- package/dist/components/FavButton/FavButton.test.js +81 -0
- package/dist/components/FavButton/FavButton.test.js.map +1 -0
- package/dist/components/FavButton/constants.d.ts +6 -0
- package/dist/components/FavButton/constants.js +9 -0
- package/dist/components/FavButton/constants.js.map +1 -0
- package/dist/components/Field/FieldComponent.d.ts +9 -0
- package/dist/components/Field/FieldComponent.js +9 -0
- package/dist/components/Field/FieldComponent.js.map +1 -0
- package/dist/components/Field/FieldComponent.test.d.ts +1 -0
- package/dist/components/Field/FieldComponent.test.js +31 -0
- package/dist/components/Field/FieldComponent.test.js.map +1 -0
- package/dist/components/Field/components/FieldError.d.ts +5 -0
- package/dist/components/Field/components/FieldError.js +6 -0
- package/dist/components/Field/components/FieldError.js.map +1 -0
- package/dist/components/Field/components/FieldLabel.d.ts +6 -0
- package/dist/components/Field/components/FieldLabel.js +15 -0
- package/dist/components/Field/components/FieldLabel.js.map +1 -0
- package/dist/components/Field/constants.d.ts +2 -0
- package/dist/components/Field/constants.js +6 -0
- package/dist/components/Field/constants.js.map +1 -0
- package/dist/components/Field/index.d.ts +4 -0
- package/dist/components/Field/index.js +7 -0
- package/dist/components/Field/index.js.map +1 -0
- package/dist/components/FilterAccordion/FilterAccordionComponent.d.ts +9 -0
- package/dist/components/FilterAccordion/FilterAccordionComponent.js +7 -0
- package/dist/components/FilterAccordion/FilterAccordionComponent.js.map +1 -0
- package/dist/components/FilterAccordion/FilterAccordionComponent.test.d.ts +1 -0
- package/dist/components/FilterAccordion/FilterAccordionComponent.test.js +34 -0
- package/dist/components/FilterAccordion/FilterAccordionComponent.test.js.map +1 -0
- package/dist/components/FilterAccordion/components/FilterAccordionArrow.d.ts +5 -0
- package/dist/components/FilterAccordion/components/FilterAccordionArrow.js +14 -0
- package/dist/components/FilterAccordion/components/FilterAccordionArrow.js.map +1 -0
- package/dist/components/FilterAccordion/components/FilterAccordionBlock.d.ts +5 -0
- package/dist/components/FilterAccordion/components/FilterAccordionBlock.js +6 -0
- package/dist/components/FilterAccordion/components/FilterAccordionBlock.js.map +1 -0
- package/dist/components/FilterAccordion/components/FilterAccordionContent.d.ts +6 -0
- package/dist/components/FilterAccordion/components/FilterAccordionContent.js +18 -0
- package/dist/components/FilterAccordion/components/FilterAccordionContent.js.map +1 -0
- package/dist/components/FilterAccordion/components/FilterAccordionLayout.d.ts +7 -0
- package/dist/components/FilterAccordion/components/FilterAccordionLayout.js +17 -0
- package/dist/components/FilterAccordion/components/FilterAccordionLayout.js.map +1 -0
- package/dist/components/FilterAccordion/components/FilterAccordionReset.d.ts +3 -0
- package/dist/components/FilterAccordion/components/FilterAccordionReset.js +16 -0
- package/dist/components/FilterAccordion/components/FilterAccordionReset.js.map +1 -0
- package/dist/components/FilterAccordion/constants.d.ts +3 -0
- package/dist/components/FilterAccordion/constants.js +9 -0
- package/dist/components/FilterAccordion/constants.js.map +1 -0
- package/dist/components/FilterAccordion/index.d.ts +7 -0
- package/dist/components/FilterAccordion/index.js +10 -0
- package/dist/components/FilterAccordion/index.js.map +1 -0
- package/dist/components/FilterButton/FilterButton.d.ts +8 -0
- package/dist/components/FilterButton/FilterButton.js +20 -0
- package/dist/components/FilterButton/FilterButton.js.map +1 -0
- package/dist/components/FilterButton/FilterButton.test.d.ts +1 -0
- package/dist/components/FilterButton/FilterButton.test.js +18 -0
- package/dist/components/FilterButton/FilterButton.test.js.map +1 -0
- package/dist/components/Gallery/Gallery.d.ts +8 -0
- package/dist/components/Gallery/Gallery.js +1094 -0
- package/dist/components/Gallery/Gallery.js.map +1 -0
- package/dist/components/Gallery/Gallery.test.d.ts +0 -0
- package/dist/components/Gallery/Gallery.test.js +25 -0
- package/dist/components/Gallery/Gallery.test.js.map +1 -0
- package/dist/components/Gallery/constants.d.ts +1 -0
- package/dist/components/Gallery/constants.js +5 -0
- package/dist/components/Gallery/constants.js.map +1 -0
- package/dist/components/Input/Input.d.ts +15 -0
- package/dist/components/Input/Input.js +43 -0
- package/dist/components/Input/Input.js.map +1 -0
- package/dist/components/Input/Input.test.d.ts +1 -0
- package/dist/components/Input/Input.test.js +46 -0
- package/dist/components/Input/Input.test.js.map +1 -0
- package/dist/components/Input/constants.d.ts +1 -0
- package/dist/components/Input/constants.js +5 -0
- package/dist/components/Input/constants.js.map +1 -0
- package/dist/components/LinkWithIcon/LinkWithIcon.d.ts +9 -0
- package/dist/components/LinkWithIcon/LinkWithIcon.js +19 -0
- package/dist/components/LinkWithIcon/LinkWithIcon.js.map +1 -0
- package/dist/components/LinkWithIcon/LinkWithIcon.test.d.ts +1 -0
- package/dist/components/LinkWithIcon/LinkWithIcon.test.js +55 -0
- package/dist/components/LinkWithIcon/LinkWithIcon.test.js.map +1 -0
- package/dist/components/LinkWithIcon/constants.d.ts +2 -0
- package/dist/components/LinkWithIcon/constants.js +6 -0
- package/dist/components/LinkWithIcon/constants.js.map +1 -0
- package/dist/components/NavLink/NavLink.d.ts +8 -0
- package/dist/components/NavLink/NavLink.js +20 -0
- package/dist/components/NavLink/NavLink.js.map +1 -0
- package/dist/components/NavLink/NavLink.test.d.ts +1 -0
- package/dist/components/NavLink/NavLink.test.js +30 -0
- package/dist/components/NavLink/NavLink.test.js.map +1 -0
- package/dist/components/NavLink/constants.d.ts +1 -0
- package/dist/components/NavLink/constants.js +5 -0
- package/dist/components/NavLink/constants.js.map +1 -0
- package/dist/components/Pagination/Pagination.test.d.ts +1 -0
- package/dist/components/Pagination/Pagination.test.js +79 -0
- package/dist/components/Pagination/Pagination.test.js.map +1 -0
- package/dist/components/Pagination/PaginationComponent.d.ts +6 -0
- package/dist/components/Pagination/PaginationComponent.js +8 -0
- package/dist/components/Pagination/PaginationComponent.js.map +1 -0
- package/dist/components/Pagination/components/PaginationArrow.d.ts +8 -0
- package/dist/components/Pagination/components/PaginationArrow.js +29 -0
- package/dist/components/Pagination/components/PaginationArrow.js.map +1 -0
- package/dist/components/Pagination/components/PaginationBody.d.ts +3 -0
- package/dist/components/Pagination/components/PaginationBody.js +6 -0
- package/dist/components/Pagination/components/PaginationBody.js.map +1 -0
- package/dist/components/Pagination/components/PaginationPage.d.ts +8 -0
- package/dist/components/Pagination/components/PaginationPage.js +17 -0
- package/dist/components/Pagination/components/PaginationPage.js.map +1 -0
- package/dist/components/Pagination/constants.d.ts +16 -0
- package/dist/components/Pagination/constants.js +11 -0
- package/dist/components/Pagination/constants.js.map +1 -0
- package/dist/components/Pagination/index.d.ts +5 -0
- package/dist/components/Pagination/index.js +7 -0
- package/dist/components/Pagination/index.js.map +1 -0
- package/dist/components/RangeSlider/RangeSlider.d.ts +7 -0
- package/dist/components/RangeSlider/RangeSlider.js +1072 -0
- package/dist/components/RangeSlider/RangeSlider.js.map +1 -0
- package/dist/components/RangeSlider/RangeSlider.test.d.ts +1 -0
- package/dist/components/RangeSlider/RangeSlider.test.js +15 -0
- package/dist/components/RangeSlider/RangeSlider.test.js.map +1 -0
- package/dist/components/RouterLink/RouterLink.d.ts +11 -0
- package/dist/components/RouterLink/RouterLink.js +32 -0
- package/dist/components/RouterLink/RouterLink.js.map +1 -0
- package/dist/components/RouterLink/RouterLink.test.d.ts +1 -0
- package/dist/components/RouterLink/RouterLink.test.js +68 -0
- package/dist/components/RouterLink/RouterLink.test.js.map +1 -0
- package/dist/components/RouterLink/constants.d.ts +8 -0
- package/dist/components/RouterLink/constants.js +11 -0
- package/dist/components/RouterLink/constants.js.map +1 -0
- package/dist/components/Select/Select.test.d.ts +1 -0
- package/dist/components/Select/Select.test.js +100 -0
- package/dist/components/Select/Select.test.js.map +1 -0
- package/dist/components/Select/SelectComponent.d.ts +13 -0
- package/dist/components/Select/SelectComponent.js +7 -0
- package/dist/components/Select/SelectComponent.js.map +1 -0
- package/dist/components/Select/components/SelectArrow.d.ts +2 -0
- package/dist/components/Select/components/SelectArrow.js +7 -0
- package/dist/components/Select/components/SelectArrow.js.map +1 -0
- package/dist/components/Select/components/SelectBlock.d.ts +6 -0
- package/dist/components/Select/components/SelectBlock.js +13 -0
- package/dist/components/Select/components/SelectBlock.js.map +1 -0
- package/dist/components/Select/components/SelectInput.d.ts +6 -0
- package/dist/components/Select/components/SelectInput.js +15 -0
- package/dist/components/Select/components/SelectInput.js.map +1 -0
- package/dist/components/Select/components/SelectList.d.ts +7 -0
- package/dist/components/Select/components/SelectList.js +6 -0
- package/dist/components/Select/components/SelectList.js.map +1 -0
- package/dist/components/Select/components/SelectOption.d.ts +7 -0
- package/dist/components/Select/components/SelectOption.js +16 -0
- package/dist/components/Select/components/SelectOption.js.map +1 -0
- package/dist/components/Select/components/SelectWrapper.d.ts +9 -0
- package/dist/components/Select/components/SelectWrapper.js +23 -0
- package/dist/components/Select/components/SelectWrapper.js.map +1 -0
- package/dist/components/Select/constants.d.ts +2 -0
- package/dist/components/Select/constants.js +8 -0
- package/dist/components/Select/constants.js.map +1 -0
- package/dist/components/Select/index.d.ts +8 -0
- package/dist/components/Select/index.js +10 -0
- package/dist/components/Select/index.js.map +1 -0
- package/dist/components/Slider/SliderComponent.d.ts +16 -0
- package/dist/components/Slider/SliderComponent.js +7 -0
- package/dist/components/Slider/SliderComponent.js.map +1 -0
- package/dist/components/Slider/constants.d.ts +4 -0
- package/dist/components/Slider/constants.js +2803 -0
- package/dist/components/Slider/constants.js.map +1 -0
- package/dist/components/SliderNavigate/SliderNavigate.d.ts +2 -0
- package/dist/components/SliderNavigate/SliderNavigate.js +21 -0
- package/dist/components/SliderNavigate/SliderNavigate.js.map +1 -0
- package/dist/components/SliderNavigate/SliderNavigate.test.d.ts +1 -0
- package/dist/components/SliderNavigate/SliderNavigate.test.js +24 -0
- package/dist/components/SliderNavigate/SliderNavigate.test.js.map +1 -0
- package/dist/components/SliderNavigate/components/NavigateButton.d.ts +7 -0
- package/dist/components/SliderNavigate/components/NavigateButton.js +19 -0
- package/dist/components/SliderNavigate/components/NavigateButton.js.map +1 -0
- package/dist/components/SliderNavigate/constants.d.ts +7 -0
- package/dist/components/SliderNavigate/constants.js +10 -0
- package/dist/components/SliderNavigate/constants.js.map +1 -0
- package/dist/iconBase-C4boY5mo.cjs +2 -0
- package/dist/iconBase-C4boY5mo.cjs.map +1 -0
- package/dist/iconBase-DSKTHwal.js +113 -0
- package/dist/iconBase-DSKTHwal.js.map +1 -0
- package/dist/index-6k1-qYX7.cjs +2 -0
- package/dist/index-6k1-qYX7.cjs.map +1 -0
- package/dist/index-BHJQkg-z.js +39 -0
- package/dist/index-BHJQkg-z.js.map +1 -0
- package/dist/index-BeUY6TnM.js +68 -0
- package/dist/index-BeUY6TnM.js.map +1 -0
- package/dist/index-C55-7-85.cjs +2 -0
- package/dist/index-C55-7-85.cjs.map +1 -0
- package/dist/index-C9UV8B4g.cjs +2 -0
- package/dist/index-C9UV8B4g.cjs.map +1 -0
- package/dist/index-CGl3Xo_k.js +19135 -0
- package/dist/index-CGl3Xo_k.js.map +1 -0
- package/dist/index-D9bMq-6v.cjs +2 -0
- package/dist/index-D9bMq-6v.cjs.map +1 -0
- package/dist/index-DgPeknFG.cjs +2 -0
- package/dist/index-DgPeknFG.cjs.map +1 -0
- package/dist/index-DpGIQZJ3.js +35 -0
- package/dist/index-DpGIQZJ3.js.map +1 -0
- package/dist/index-DtO1atyA.js +30 -0
- package/dist/index-DtO1atyA.js.map +1 -0
- package/dist/index-YTr4A0AR.js +25 -0
- package/dist/index-YTr4A0AR.js.map +1 -0
- package/dist/index-vOj_CXk2.cjs +175 -0
- package/dist/index-vOj_CXk2.cjs.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/react.esm-C2dSWZxI.cjs +91 -0
- package/dist/react.esm-C2dSWZxI.cjs.map +1 -0
- package/dist/react.esm-DeOc63_l.js +11455 -0
- package/dist/react.esm-DeOc63_l.js.map +1 -0
- package/dist/services/helpers.d.ts +2 -0
- package/dist/services/helpers.js +21 -0
- package/dist/services/helpers.js.map +1 -0
- package/dist/services/hoc/withBlockClass.d.ts +7 -0
- package/dist/services/hoc/withBlockClass.js +22 -0
- package/dist/services/hoc/withBlockClass.js.map +1 -0
- package/dist/services/hooks/useAccordionHeight.d.ts +9 -0
- package/dist/services/hooks/useAccordionHeight.js +17 -0
- package/dist/services/hooks/useAccordionHeight.js.map +1 -0
- package/dist/services/hooks/useClickOutside.d.ts +5 -0
- package/dist/services/hooks/useClickOutside.js +17 -0
- package/dist/services/hooks/useClickOutside.js.map +1 -0
- package/dist/services/hooks/useMatchMedia.d.ts +1 -0
- package/dist/services/hooks/useMatchMedia.js +18 -0
- package/dist/services/hooks/useMatchMedia.js.map +1 -0
- package/dist/services/icons.d.ts +7 -0
- package/dist/services/icons.js +27 -0
- package/dist/services/icons.js.map +1 -0
- package/dist/services/mocks.d.ts +12 -0
- package/dist/services/mocks.js +21 -0
- package/dist/services/mocks.js.map +1 -0
- package/dist/services/types.d.ts +7 -0
- package/dist/services/types.js +2 -0
- package/dist/services/types.js.map +1 -0
- package/dist/setupTests.d.ts +0 -0
- package/dist/setupTests.js +10217 -0
- package/dist/setupTests.js.map +1 -0
- package/package.json +115 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ElementProps } from '../../services/types';
|
|
3
|
+
export interface Props extends ElementProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
textContent: string;
|
|
6
|
+
title: string;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const AccordionComponent: FC<Props>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionComponent.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { s as t, f as x, r as d } from "../../react.esm-DeOc63_l.js";
|
|
3
|
+
import { ACCORDION_TEST_ID as i } from "./constants.js";
|
|
4
|
+
import { A as m } from "../../index-BHJQkg-z.js";
|
|
5
|
+
const o = {
|
|
6
|
+
isOpen: !1,
|
|
7
|
+
textContent: "Test content",
|
|
8
|
+
title: "Test title",
|
|
9
|
+
onClick: jest.fn()
|
|
10
|
+
};
|
|
11
|
+
describe("Accordion Component", () => {
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
jest.clearAllMocks();
|
|
14
|
+
});
|
|
15
|
+
const a = [!0, !1], n = (e = {}) => {
|
|
16
|
+
const c = { ...o, ...e };
|
|
17
|
+
return d(/* @__PURE__ */ p(m, { ...c }));
|
|
18
|
+
};
|
|
19
|
+
test("renders the accordion component and title, text correctly", () => {
|
|
20
|
+
const { container: e } = n();
|
|
21
|
+
expect(t.getByText(o.title)).toBeInTheDocument(), expect(t.getByText(o.textContent)).toBeInTheDocument(), expect(t.getByTestId(i)).toBeInTheDocument(), expect(e).toMatchSnapshot();
|
|
22
|
+
}), a.forEach((e) => {
|
|
23
|
+
const c = `should ${e ? "open" : "close"} the content`;
|
|
24
|
+
test(c, () => {
|
|
25
|
+
const { container: l } = n({ isOpen: e }), s = t.getByText(o.textContent), r = t.getByTestId(i);
|
|
26
|
+
e ? (expect(s).toBeVisible(), expect(r).toHaveClass("_active")) : (expect(s.offsetHeight).toBe(0), expect(r).not.toHaveClass("_active"), expect(l).toMatchSnapshot());
|
|
27
|
+
});
|
|
28
|
+
}), test("triggers onClick handler when title is clicked", () => {
|
|
29
|
+
n(), x.click(t.getByText(o.title)), expect(o.onClick).toHaveBeenCalledTimes(1);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=AccordionComponent.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionComponent.test.js","sources":["../../../lib/components/Accordion/AccordionComponent.test.tsx"],"sourcesContent":["import {fireEvent, render, screen} from '@testing-library/react';\r\nimport {ACCORDION_TEST_ID} from '@/components/Accordion/constants';\r\nimport {Accordion} from '@/components/Accordion';\r\n\r\nconst defaultProps = {\r\n isOpen: false,\r\n textContent: 'Test content',\r\n title: 'Test title',\r\n onClick: jest.fn(),\r\n};\r\ndescribe('Accordion Component', () => {\r\n beforeEach(() => {\r\n jest.clearAllMocks();\r\n });\r\n const isOpenValues = [true, false];\r\n const renderAccordion = (props = {}) => {\r\n const mergedProps = {...defaultProps, ...props};\r\n return render(<Accordion {...mergedProps} />);\r\n };\r\n\r\n test('renders the accordion component and title, text correctly', () => {\r\n const {container} = renderAccordion();\r\n expect(screen.getByText(defaultProps.title)).toBeInTheDocument();\r\n expect(screen.getByText(defaultProps.textContent)).toBeInTheDocument();\r\n expect(screen.getByTestId(ACCORDION_TEST_ID)).toBeInTheDocument();\r\n expect(container).toMatchSnapshot();\r\n });\r\n\r\n isOpenValues.forEach((isOpen) => {\r\n const isOpenString = `should ${isOpen ? 'open' : 'close'} the content`;\r\n test(isOpenString, () => {\r\n const {container} = renderAccordion({isOpen});\r\n const content = screen.getByText(defaultProps.textContent);\r\n const accordionElement = screen.getByTestId(ACCORDION_TEST_ID);\r\n if (isOpen) {\r\n expect(content).toBeVisible();\r\n expect(accordionElement).toHaveClass('_active');\r\n } else {\r\n expect(content.offsetHeight).toBe(0);\r\n expect(accordionElement).not.toHaveClass('_active');\r\n expect(container).toMatchSnapshot();\r\n }\r\n });\r\n });\r\n test('triggers onClick handler when title is clicked', () => {\r\n renderAccordion();\r\n fireEvent.click(screen.getByText(defaultProps.title));\r\n expect(defaultProps.onClick).toHaveBeenCalledTimes(1);\r\n });\r\n});\r\n"],"names":["defaultProps","isOpenValues","renderAccordion","props","mergedProps","render","jsx","Accordion","container","screen","ACCORDION_TEST_ID","isOpen","isOpenString","content","accordionElement","fireEvent"],"mappings":";;;;AAIA,MAAMA,IAAe;AAAA,EACnB,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,OAAO;AAAA,EACP,SAAS,KAAK,GAAG;AACnB;AACA,SAAS,uBAAuB,MAAM;AACpC,aAAW,MAAM;AACf,SAAK,cAAc;AAAA,EAAA,CACpB;AACK,QAAAC,IAAe,CAAC,IAAM,EAAK,GAC3BC,IAAkB,CAACC,IAAQ,OAAO;AACtC,UAAMC,IAAc,EAAC,GAAGJ,GAAc,GAAGG,EAAK;AAC9C,WAAOE,EAAO,gBAAAC,EAACC,GAAW,EAAA,GAAGH,EAAa,CAAA,CAAE;AAAA,EAC9C;AAEA,OAAK,6DAA6D,MAAM;AAChE,UAAA,EAAC,WAAAI,EAAS,IAAIN,EAAgB;AACpC,WAAOO,EAAO,UAAUT,EAAa,KAAK,CAAC,EAAE,kBAAkB,GAC/D,OAAOS,EAAO,UAAUT,EAAa,WAAW,CAAC,EAAE,kBAAkB,GACrE,OAAOS,EAAO,YAAYC,CAAiB,CAAC,EAAE,kBAAkB,GACzD,OAAAF,CAAS,EAAE,gBAAgB;AAAA,EAAA,CACnC,GAEYP,EAAA,QAAQ,CAACU,MAAW;AAC/B,UAAMC,IAAe,UAAUD,IAAS,SAAS,OAAO;AACxD,SAAKC,GAAc,MAAM;AACvB,YAAM,EAAC,WAAAJ,EAAS,IAAIN,EAAgB,EAAC,QAAAS,GAAO,GACtCE,IAAUJ,EAAO,UAAUT,EAAa,WAAW,GACnDc,IAAmBL,EAAO,YAAYC,CAAiB;AAC7D,MAAIC,KACK,OAAAE,CAAO,EAAE,YAAY,GACrB,OAAAC,CAAgB,EAAE,YAAY,SAAS,MAE9C,OAAOD,EAAQ,YAAY,EAAE,KAAK,CAAC,GACnC,OAAOC,CAAgB,EAAE,IAAI,YAAY,SAAS,GAC3C,OAAAN,CAAS,EAAE,gBAAgB;AAAA,IACpC,CACD;AAAA,EAAA,CACF,GACD,KAAK,kDAAkD,MAAM;AAC3C,IAAAN,EAAA,GAChBa,EAAU,MAAMN,EAAO,UAAUT,EAAa,KAAK,CAAC,GACpD,OAAOA,EAAa,OAAO,EAAE,sBAAsB,CAAC;AAAA,EAAA,CACrD;AACH,CAAC;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Icons as r } from "../../../services/icons.js";
|
|
3
|
+
const m = () => /* @__PURE__ */ o(r.ArrowNarrowDown, { className: "accordion__arrow" });
|
|
4
|
+
export {
|
|
5
|
+
m as AccordionArrow
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=AccordionArrow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionArrow.js","sources":["../../../../lib/components/Accordion/components/AccordionArrow.tsx"],"sourcesContent":["import type {FC} from 'react';\nimport {Icons} from '@/services/icons';\n\nexport const AccordionArrow: FC = () => <Icons.ArrowNarrowDown className=\"accordion__arrow\" />;\n"],"names":["AccordionArrow","jsx","Icons"],"mappings":";;AAGO,MAAMA,IAAqB,MAAM,gBAAAC,EAACC,EAAM,iBAAN,EAAsB,WAAU,mBAAmB,CAAA;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
const r = ({ onClick: o, children: t }) => /* @__PURE__ */ n(
|
|
3
|
+
"button",
|
|
4
|
+
{
|
|
5
|
+
onClick: o,
|
|
6
|
+
type: "button",
|
|
7
|
+
className: "accordion__button",
|
|
8
|
+
children: t
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
export {
|
|
12
|
+
r as AccordionButton
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=AccordionButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionButton.js","sources":["../../../../lib/components/Accordion/components/AccordionButton.tsx"],"sourcesContent":["import type {FC, ReactNode} from 'react';\n\nexport interface Props {\n children: ReactNode;\n onClick: () => void;\n}\n\nexport const AccordionButton: FC<Props> = ({onClick, children}) => (\n <button\n onClick={onClick}\n type=\"button\"\n className=\"accordion__button\"\n >\n {children}\n </button>\n);\n"],"names":["AccordionButton","onClick","children","jsx"],"mappings":";AAOO,MAAMA,IAA6B,CAAC,EAAC,SAAAC,GAAS,UAAAC,EACnD,MAAA,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,SAAAF;AAAA,IACA,MAAK;AAAA,IACL,WAAU;AAAA,IAET,UAAAC;AAAA,EAAA;AACH;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useAccordionHeight as r } from "../../../services/hooks/useAccordionHeight.js";
|
|
3
|
+
const a = ({ isOpen: t, children: c }) => {
|
|
4
|
+
const { style: e, contentRef: n } = r(t);
|
|
5
|
+
return /* @__PURE__ */ o(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
style: e,
|
|
9
|
+
className: "accordion__content",
|
|
10
|
+
children: /* @__PURE__ */ o(
|
|
11
|
+
"p",
|
|
12
|
+
{
|
|
13
|
+
className: "accordion__text",
|
|
14
|
+
ref: n,
|
|
15
|
+
children: c
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
a as AccordionContent
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=AccordionContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionContent.js","sources":["../../../../lib/components/Accordion/components/AccordionContent.tsx"],"sourcesContent":["import type {FC} from 'react';\r\nimport {useAccordionHeight} from '@/services/hooks/useAccordionHeight';\r\n\r\nexport interface Props {\r\n isOpen: boolean;\r\n children: string;\r\n}\r\n\r\nexport const AccordionContent: FC<Props> = ({isOpen, children}) => {\r\n const {style, contentRef} = useAccordionHeight(isOpen);\r\n return (\r\n <div\r\n style={style}\r\n className=\"accordion__content\"\r\n >\r\n <p\r\n className=\"accordion__text\"\r\n ref={contentRef}\r\n >\r\n {children}\r\n </p>\r\n </div>\r\n );\r\n};\r\n"],"names":["AccordionContent","isOpen","children","style","contentRef","useAccordionHeight","jsx"],"mappings":";;AAQO,MAAMA,IAA8B,CAAC,EAAC,QAAAC,GAAQ,UAAAC,QAAc;AACjE,QAAM,EAAC,OAAAC,GAAO,YAAAC,MAAcC,EAAmBJ,CAAM;AAEnD,SAAA,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAAH;AAAA,MACA,WAAU;AAAA,MAEV,UAAA,gBAAAG;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAU;AAAA,UACV,KAAKF;AAAA,UAEJ,UAAAF;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EACF;AAEJ;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { cn as i } from "../../../services/helpers.js";
|
|
3
|
+
import { ACCORDION_TEST_ID as a } from "../constants.js";
|
|
4
|
+
const e = ({ block: o, isOpen: t, children: r }) => /* @__PURE__ */ c(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
"data-testid": a,
|
|
8
|
+
className: i(o, "accordion", {
|
|
9
|
+
_active: t
|
|
10
|
+
}),
|
|
11
|
+
children: r
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
export {
|
|
15
|
+
e as AccordionLayout
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=AccordionLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionLayout.js","sources":["../../../../lib/components/Accordion/components/AccordionLayout.tsx"],"sourcesContent":["import type {FC, ReactNode} from 'react';\nimport {cn} from '@/services/helpers';\nimport type {ElementProps} from '@/services/types';\nimport {ACCORDION_TEST_ID} from '@/components/Accordion/constants';\n\nexport interface Props extends ElementProps {\n children: ReactNode;\n isOpen: boolean;\n}\n\nexport const AccordionLayout: FC<Props> = ({block, isOpen, children}) => (\n <div\n data-testid={ACCORDION_TEST_ID}\n className={cn(block, 'accordion', {\n '_active': isOpen,\n })}\n >\n {children}\n </div>\n);\n"],"names":["AccordionLayout","block","isOpen","children","jsx","ACCORDION_TEST_ID","cn"],"mappings":";;;AAUO,MAAMA,IAA6B,CAAC,EAAC,OAAAC,GAAO,QAAAC,GAAQ,UAAAC,EACzD,MAAA,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,eAAaC;AAAA,IACb,WAAWC,EAAGL,GAAO,aAAa;AAAA,MAChC,SAAWC;AAAA,IAAA,CACZ;AAAA,IAEA,UAAAC;AAAA,EAAA;AACH;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionTitle.js","sources":["../../../../lib/components/Accordion/components/AccordionTitle.tsx"],"sourcesContent":["import type {FC} from 'react';\n\nexport interface AccordionTitleProps {\n title: string;\n}\n\nexport const AccordionTitle: FC<AccordionTitleProps> = ({title}) => <h3 className=\"accordion__title\">{title}</h3>;\n"],"names":["AccordionTitle","title","jsx"],"mappings":";AAMa,MAAAA,IAA0C,CAAC,EAAC,OAAAC,EAAA,MAAY,gBAAAC,EAAA,MAAA,EAAG,WAAU,oBAAoB,UAAMD,EAAA,CAAA;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ACCORDION_TEST_ID = "accordionTestId";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../lib/components/Accordion/constants.ts"],"sourcesContent":["export const ACCORDION_TEST_ID = 'accordionTestId';\r\n"],"names":["ACCORDION_TEST_ID"],"mappings":"AAAO,MAAMA,IAAoB;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const Accordion: import('react').FC<import('./AccordionComponent').Props> & {
|
|
2
|
+
Content: import('react').FC<import('./components/AccordionContent').Props>;
|
|
3
|
+
Arrow: import('react').FC;
|
|
4
|
+
Title: import('react').FC<import('./components/AccordionTitle').AccordionTitleProps>;
|
|
5
|
+
Block: import('react').FC<import('./components/AccordionBlock').Props>;
|
|
6
|
+
Layout: import('react').FC<import('./components/AccordionLayout').Props>;
|
|
7
|
+
Button: import('react').FC<import('./components/AccordionButton').Props>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { A } from "../../index-BHJQkg-z.js";
|
|
2
|
+
import "./components/AccordionContent.js";
|
|
3
|
+
import "./components/AccordionArrow.js";
|
|
4
|
+
import "./components/AccordionTitle.js";
|
|
5
|
+
import "./components/AccordionLayout.js";
|
|
6
|
+
import "./components/AccordionButton.js";
|
|
7
|
+
export {
|
|
8
|
+
A as Accordion
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FC, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { ButtonAttributesType, ButtonColorType, ButtonSizeType } from './constants';
|
|
3
|
+
import { ElementProps } from '../../services/types';
|
|
4
|
+
export interface ButtonProps extends ElementProps {
|
|
5
|
+
size: ButtonSizeType;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
color: ButtonColorType;
|
|
8
|
+
type?: ButtonAttributesType;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
11
|
+
isTransparent?: boolean;
|
|
12
|
+
withIcon?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const Button: FC<ButtonProps>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { BUTTON_TEST_ID as f } from "./constants.js";
|
|
3
|
+
import { cn as i } from "../../services/helpers.js";
|
|
4
|
+
const N = ({
|
|
5
|
+
children: t,
|
|
6
|
+
size: o,
|
|
7
|
+
color: n,
|
|
8
|
+
onClick: s,
|
|
9
|
+
type: a = "button",
|
|
10
|
+
disabled: r = !1,
|
|
11
|
+
isTransparent: e = !1,
|
|
12
|
+
withIcon: u = !1,
|
|
13
|
+
block: m
|
|
14
|
+
}) => {
|
|
15
|
+
const b = i(m, "button", `button--${o} button--${n}`, {
|
|
16
|
+
"button--transparent": e,
|
|
17
|
+
"button--icon": u
|
|
18
|
+
});
|
|
19
|
+
return /* @__PURE__ */ c(
|
|
20
|
+
"button",
|
|
21
|
+
{
|
|
22
|
+
"data-testid": f,
|
|
23
|
+
disabled: r,
|
|
24
|
+
type: a,
|
|
25
|
+
className: b,
|
|
26
|
+
onClick: s,
|
|
27
|
+
children: t
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
N as Button
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../lib/components/Button/Button.tsx"],"sourcesContent":["import type {FC, MouseEvent, ReactNode} from 'react';\nimport type {ButtonAttributesType, ButtonColorType, ButtonSizeType} from '@/components/Button/constants';\nimport {BUTTON_TEST_ID} from '@/components/Button/constants';\nimport {cn} from '@/services/helpers';\nimport type {ElementProps} from '@/services/types';\n\nexport interface ButtonProps extends ElementProps {\n size: ButtonSizeType;\n children: ReactNode;\n color: ButtonColorType;\n type?: ButtonAttributesType;\n disabled?: boolean;\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void;\n isTransparent?: boolean;\n withIcon?: boolean;\n}\n\nexport const Button: FC<ButtonProps> = ({\n children,\n size,\n color,\n onClick,\n type = 'button',\n disabled = false,\n isTransparent = false,\n withIcon = false,\n block,\n}) => {\n const classNames = cn(block, 'button', `button--${size} button--${color}`, {\n 'button--transparent': isTransparent,\n 'button--icon': withIcon,\n });\n return (\n <button\n data-testid={BUTTON_TEST_ID}\n disabled={disabled}\n type={type}\n className={classNames}\n onClick={onClick}\n >\n {children}\n </button>\n );\n};\n"],"names":["Button","children","size","color","onClick","type","disabled","isTransparent","withIcon","block","classNames","cn","jsx","BUTTON_TEST_ID"],"mappings":";;;AAiBO,MAAMA,IAA0B,CAAC;AAAA,EACtC,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,UAAAC,IAAW;AAAA,EACX,eAAAC,IAAgB;AAAA,EAChB,UAAAC,IAAW;AAAA,EACX,OAAAC;AACF,MAAM;AACE,QAAAC,IAAaC,EAAGF,GAAO,UAAU,WAAWP,CAAI,YAAYC,CAAK,IAAI;AAAA,IACzE,uBAAuBI;AAAA,IACvB,gBAAgBC;AAAA,EAAA,CACjB;AAEC,SAAA,gBAAAI;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAaC;AAAA,MACb,UAAAP;AAAA,MACA,MAAAD;AAAA,MACA,WAAWK;AAAA,MACX,SAAAN;AAAA,MAEC,UAAAH;AAAA,IAAA;AAAA,EACH;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { c as v, r, s as u, f as h } from "../../react.esm-DeOc63_l.js";
|
|
3
|
+
import { BUTTON_COLOR as l, BUTTON_SIZE as b, BUTTON_TEST_ID as p } from "./constants.js";
|
|
4
|
+
import { Button as s } from "./Button.js";
|
|
5
|
+
describe("Button component", () => {
|
|
6
|
+
afterEach(v);
|
|
7
|
+
const d = Object.values(l), x = Object.values(b), f = ["submit", "reset", "button"], a = {
|
|
8
|
+
color: l.GRAY,
|
|
9
|
+
size: b.BIG
|
|
10
|
+
}, T = [!0, !1];
|
|
11
|
+
d.forEach((t) => {
|
|
12
|
+
x.forEach((e) => {
|
|
13
|
+
f.forEach((n) => {
|
|
14
|
+
T.forEach((o) => {
|
|
15
|
+
const B = `renders button with color ${t}, size ${e}, type ${n ?? "button"} and disabled`;
|
|
16
|
+
test(B, () => {
|
|
17
|
+
const { container: m } = r(
|
|
18
|
+
/* @__PURE__ */ c(
|
|
19
|
+
s,
|
|
20
|
+
{
|
|
21
|
+
color: t,
|
|
22
|
+
size: e,
|
|
23
|
+
type: n,
|
|
24
|
+
disabled: o,
|
|
25
|
+
children: "button"
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
), i = u.getByTestId(p);
|
|
29
|
+
expect(i).toBeInTheDocument(), expect(i).toHaveClass(`button--${t}`), expect(i).toHaveClass(`button--${e}`), expect(i.disabled).toBe(o), expect(i).toHaveStyle("cursor: default"), expect(m).toMatchSnapshot();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}), test("changes button text according to the children text", () => {
|
|
35
|
+
const { container: t, getByText: e, rerender: n } = r(/* @__PURE__ */ c(s, { ...a, children: "button" }));
|
|
36
|
+
let o = e("button");
|
|
37
|
+
expect(o).toBeInTheDocument(), n(/* @__PURE__ */ c(s, { ...a, children: "Confirm" })), o = e("Confirm"), expect(o).toBeInTheDocument(), expect(t).toMatchSnapshot();
|
|
38
|
+
}), test("handles the click event", () => {
|
|
39
|
+
const t = jest.fn(), { container: e, getByText: n } = r(
|
|
40
|
+
/* @__PURE__ */ c(
|
|
41
|
+
s,
|
|
42
|
+
{
|
|
43
|
+
...a,
|
|
44
|
+
onClick: t,
|
|
45
|
+
children: "button"
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
h.click(n("button")), expect(t).toHaveBeenCalledTimes(1), expect(e).toMatchSnapshot();
|
|
50
|
+
}), test("the onClick event does not fire when button is disabled", () => {
|
|
51
|
+
const t = jest.fn(), { container: e, getByText: n } = r(
|
|
52
|
+
/* @__PURE__ */ c(
|
|
53
|
+
s,
|
|
54
|
+
{
|
|
55
|
+
...a,
|
|
56
|
+
disabled: !0,
|
|
57
|
+
onClick: t,
|
|
58
|
+
children: "button"
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
), o = n("button");
|
|
62
|
+
h.click(o), expect(t).not.toHaveBeenCalled(), expect(e).toMatchSnapshot();
|
|
63
|
+
}), test("additional classes are not applied if the button is disabled", () => {
|
|
64
|
+
const { container: t, getByText: e } = r(
|
|
65
|
+
/* @__PURE__ */ c(
|
|
66
|
+
s,
|
|
67
|
+
{
|
|
68
|
+
...a,
|
|
69
|
+
disabled: !0,
|
|
70
|
+
children: "button"
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
), n = e("button");
|
|
74
|
+
expect(n).toHaveClass("button"), expect(t).toMatchSnapshot();
|
|
75
|
+
}), test("button has button-transparent if receive prop isTransparent", () => {
|
|
76
|
+
const { container: t } = r(
|
|
77
|
+
/* @__PURE__ */ c(
|
|
78
|
+
s,
|
|
79
|
+
{
|
|
80
|
+
...a,
|
|
81
|
+
isTransparent: !0,
|
|
82
|
+
children: "button"
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
), e = u.getByTestId(p);
|
|
86
|
+
expect(e).toHaveClass("button--transparent"), expect(t).toMatchSnapshot();
|
|
87
|
+
}), test("button has button-icon if receive prop withIcon", () => {
|
|
88
|
+
const { container: t } = r(
|
|
89
|
+
/* @__PURE__ */ c(
|
|
90
|
+
s,
|
|
91
|
+
{
|
|
92
|
+
...a,
|
|
93
|
+
withIcon: !0,
|
|
94
|
+
children: "button"
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
), e = u.getByTestId(p);
|
|
98
|
+
expect(e).toHaveClass("button--icon"), expect(t).toMatchSnapshot();
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
//# sourceMappingURL=Button.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.test.js","sources":["../../../lib/components/Button/Button.test.tsx"],"sourcesContent":["import {cleanup, fireEvent, render, screen} from '@testing-library/react';\nimport type {ButtonAttributesType} from '@/components/Button/constants';\nimport {BUTTON_COLOR, BUTTON_SIZE, BUTTON_TEST_ID} from '@/components/Button/constants';\nimport {Button} from '@/components/Button/Button';\n\ndescribe('Button component', () => {\n afterEach(cleanup);\n\n const colors = Object.values(BUTTON_COLOR);\n const sizes = Object.values(BUTTON_SIZE);\n const types: ButtonAttributesType[] = ['submit', 'reset', 'button'];\n const props = {\n color: BUTTON_COLOR.GRAY,\n size: BUTTON_SIZE.BIG,\n };\n const disabledOptions = [true, false];\n\n colors.forEach((color) => {\n sizes.forEach((size) => {\n types.forEach((type) => {\n disabledOptions.forEach((disabled) => {\n const testName = `renders button with color ${color}, size ${size}, type ${type ?? 'button'} and disabled`;\n test(testName, () => {\n const {container} = render(\n <Button\n color={color}\n size={size}\n type={type}\n disabled={disabled}\n >\n button\n </Button>,\n );\n const buttonElement: HTMLButtonElement = screen.getByTestId(BUTTON_TEST_ID);\n expect(buttonElement).toBeInTheDocument();\n expect(buttonElement).toHaveClass(`button--${color}`);\n expect(buttonElement).toHaveClass(`button--${size}`);\n expect(buttonElement.disabled).toBe(disabled);\n expect(buttonElement).toHaveStyle('cursor: default');\n expect(container).toMatchSnapshot();\n });\n });\n });\n });\n });\n\n test('changes button text according to the children text', () => {\n const {container, getByText, rerender} = render(<Button {...props}>button</Button>);\n let button = getByText('button');\n expect(button).toBeInTheDocument();\n\n rerender(<Button {...props}>Confirm</Button>);\n button = getByText('Confirm');\n expect(button).toBeInTheDocument();\n expect(container).toMatchSnapshot();\n });\n\n test('handles the click event', () => {\n const onClick = jest.fn();\n const {container, getByText} = render(\n <Button\n {...props}\n onClick={onClick}\n >\n button\n </Button>,\n );\n fireEvent.click(getByText('button'));\n expect(onClick).toHaveBeenCalledTimes(1);\n expect(container).toMatchSnapshot();\n });\n\n test('the onClick event does not fire when button is disabled', () => {\n const onClick = jest.fn();\n const {container, getByText} = render(\n <Button\n {...props}\n disabled\n onClick={onClick}\n >\n button\n </Button>,\n );\n const button = getByText('button');\n fireEvent.click(button);\n expect(onClick).not.toHaveBeenCalled();\n expect(container).toMatchSnapshot();\n });\n\n test('additional classes are not applied if the button is disabled', () => {\n const {container, getByText} = render(\n <Button\n {...props}\n disabled\n >\n button\n </Button>,\n );\n const button = getByText('button');\n expect(button).toHaveClass('button');\n expect(container).toMatchSnapshot();\n });\n\n test('button has button-transparent if receive prop isTransparent', () => {\n const {container} = render(\n <Button\n {...props}\n isTransparent\n >\n button\n </Button>,\n );\n const button = screen.getByTestId(BUTTON_TEST_ID);\n expect(button).toHaveClass('button--transparent');\n expect(container).toMatchSnapshot();\n });\n\n test('button has button-icon if receive prop withIcon', () => {\n const {container} = render(\n <Button\n {...props}\n withIcon\n >\n button\n </Button>,\n );\n const button = screen.getByTestId(BUTTON_TEST_ID);\n expect(button).toHaveClass('button--icon');\n expect(container).toMatchSnapshot();\n });\n});\n"],"names":["cleanup","colors","BUTTON_COLOR","sizes","BUTTON_SIZE","types","props","disabledOptions","color","size","type","disabled","testName","container","render","jsx","Button","buttonElement","screen","BUTTON_TEST_ID","getByText","rerender","button","onClick","fireEvent"],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
export declare const BUTTON_SIZE: Readonly<{
|
|
3
|
+
BIG: "big";
|
|
4
|
+
MEDIUM: "medium";
|
|
5
|
+
SMALL: "small";
|
|
6
|
+
}>;
|
|
7
|
+
export declare const BUTTON_COLOR: Readonly<{
|
|
8
|
+
GREEN: "green";
|
|
9
|
+
WHITE: "white";
|
|
10
|
+
GRAY: "gray";
|
|
11
|
+
}>;
|
|
12
|
+
export type ButtonAttributesType = ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
13
|
+
export type ButtonSizeType = (typeof BUTTON_SIZE)[keyof typeof BUTTON_SIZE];
|
|
14
|
+
export type ButtonColorType = (typeof BUTTON_COLOR)[keyof typeof BUTTON_COLOR];
|
|
15
|
+
export declare const BUTTON_TEST_ID = "buttonTestId";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const e = Object.freeze({
|
|
2
|
+
BIG: "big",
|
|
3
|
+
MEDIUM: "medium",
|
|
4
|
+
SMALL: "small"
|
|
5
|
+
}), t = Object.freeze({
|
|
6
|
+
GREEN: "green",
|
|
7
|
+
WHITE: "white",
|
|
8
|
+
GRAY: "gray"
|
|
9
|
+
}), T = "buttonTestId";
|
|
10
|
+
export {
|
|
11
|
+
t as BUTTON_COLOR,
|
|
12
|
+
e as BUTTON_SIZE,
|
|
13
|
+
T as BUTTON_TEST_ID
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../lib/components/Button/constants.ts"],"sourcesContent":["import type {ButtonHTMLAttributes} from 'react';\n\nexport const BUTTON_SIZE = Object.freeze({\n BIG: 'big',\n MEDIUM: 'medium',\n SMALL: 'small',\n});\n\nexport const BUTTON_COLOR = Object.freeze({\n GREEN: 'green',\n WHITE: 'white',\n GRAY: 'gray',\n});\n\nexport type ButtonAttributesType = ButtonHTMLAttributes<HTMLButtonElement>['type'];\nexport type ButtonSizeType = (typeof BUTTON_SIZE)[keyof typeof BUTTON_SIZE];\nexport type ButtonColorType = (typeof BUTTON_COLOR)[keyof typeof BUTTON_COLOR];\n\nexport const BUTTON_TEST_ID = 'buttonTestId';\n"],"names":["BUTTON_SIZE","BUTTON_COLOR","BUTTON_TEST_ID"],"mappings":"AAEa,MAAAA,IAAc,OAAO,OAAO;AAAA,EACvC,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,OAAO;AACT,CAAC,GAEYC,IAAe,OAAO,OAAO;AAAA,EACxC,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AACR,CAAC,GAMYC,IAAiB;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentType, FC, ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps } from '../Button/Button';
|
|
3
|
+
interface IconProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ButtonIconProps<T> extends ButtonProps {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
RightIcon?: ComponentType<T>;
|
|
9
|
+
LeftIcon?: ComponentType<T>;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const ButtonWithIcon: FC<ButtonIconProps<IconProps>>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsxs as d, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { Button as m } from "../Button/Button.js";
|
|
3
|
+
import { LEFT_ICON_BUTTON_TEST_ID as I, RIGHT_ICON_BUTTON_TEST_ID as n } from "./constants.js";
|
|
4
|
+
const O = ({
|
|
5
|
+
RightIcon: t,
|
|
6
|
+
LeftIcon: o,
|
|
7
|
+
children: _,
|
|
8
|
+
className: T,
|
|
9
|
+
...i
|
|
10
|
+
}) => /* @__PURE__ */ d(
|
|
11
|
+
m,
|
|
12
|
+
{
|
|
13
|
+
withIcon: !0,
|
|
14
|
+
...i,
|
|
15
|
+
children: [
|
|
16
|
+
!!o && /* @__PURE__ */ r(
|
|
17
|
+
o,
|
|
18
|
+
{
|
|
19
|
+
className: T,
|
|
20
|
+
"data-testid": I
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
_,
|
|
24
|
+
!!t && /* @__PURE__ */ r(
|
|
25
|
+
t,
|
|
26
|
+
{
|
|
27
|
+
className: T,
|
|
28
|
+
"data-testid": n
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
export {
|
|
35
|
+
O as ButtonWithIcon
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=ButtonWithIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonWithIcon.js","sources":["../../../lib/components/ButtonWithIcon/ButtonWithIcon.tsx"],"sourcesContent":["import type {ComponentType, FC, ReactNode} from 'react';\nimport type {ButtonProps} from '@/components/Button/Button';\nimport {Button} from '@/components/Button/Button';\nimport {LEFT_ICON_BUTTON_TEST_ID, RIGHT_ICON_BUTTON_TEST_ID} from '@/components/ButtonWithIcon/constants';\n\ninterface IconProps {\n className?: string;\n}\n\nexport interface ButtonIconProps<T> extends ButtonProps {\n children: ReactNode;\n RightIcon?: ComponentType<T>;\n LeftIcon?: ComponentType<T>;\n className?: string;\n}\n\nexport const ButtonWithIcon: FC<ButtonIconProps<IconProps>> = ({\n RightIcon,\n LeftIcon,\n children,\n className,\n ...props\n}) => (\n <Button\n withIcon\n {...props}\n >\n {!!LeftIcon && (\n <LeftIcon\n className={className}\n data-testid={LEFT_ICON_BUTTON_TEST_ID}\n />\n )}\n {children}\n {!!RightIcon && (\n <RightIcon\n className={className}\n data-testid={RIGHT_ICON_BUTTON_TEST_ID}\n />\n )}\n </Button>\n);\n"],"names":["ButtonWithIcon","RightIcon","LeftIcon","children","className","props","jsxs","Button","jsx","LEFT_ICON_BUTTON_TEST_ID","RIGHT_ICON_BUTTON_TEST_ID"],"mappings":";;;AAgBO,MAAMA,IAAiD,CAAC;AAAA,EAC7D,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,MACE,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,UAAQ;AAAA,IACP,GAAGF;AAAA,IAEH,UAAA;AAAA,MAAA,CAAC,CAACH,KACD,gBAAAM;AAAA,QAACN;AAAA,QAAA;AAAA,UACC,WAAAE;AAAA,UACA,eAAaK;AAAA,QAAA;AAAA,MACf;AAAA,MAEDN;AAAA,MACA,CAAC,CAACF,KACD,gBAAAO;AAAA,QAACP;AAAA,QAAA;AAAA,UACC,WAAAG;AAAA,UACA,eAAaM;AAAA,QAAA;AAAA,MAAA;AAAA,IACf;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { c as p, r as c, s as t } from "../../react.esm-DeOc63_l.js";
|
|
3
|
+
import { BUTTON_SIZE as I, BUTTON_COLOR as T } from "../Button/constants.js";
|
|
4
|
+
import { ButtonWithIcon as r } from "./ButtonWithIcon.js";
|
|
5
|
+
import { Icons as i } from "../../services/icons.js";
|
|
6
|
+
import { LEFT_ICON_BUTTON_TEST_ID as s, RIGHT_ICON_BUTTON_TEST_ID as h } from "./constants.js";
|
|
7
|
+
describe("ButtonWithIcon component", () => {
|
|
8
|
+
afterEach(p);
|
|
9
|
+
const o = {
|
|
10
|
+
color: T.GRAY,
|
|
11
|
+
size: I.BIG
|
|
12
|
+
};
|
|
13
|
+
test("renders component correctly", () => {
|
|
14
|
+
const { container: e } = c(/* @__PURE__ */ n(r, { ...o, children: "Click me" }));
|
|
15
|
+
expect(t.getByText("Click me")).toBeInTheDocument(), expect(e).toMatchSnapshot();
|
|
16
|
+
}), test("renders LeftIcon when provided", () => {
|
|
17
|
+
const { container: e } = c(
|
|
18
|
+
/* @__PURE__ */ n(
|
|
19
|
+
r,
|
|
20
|
+
{
|
|
21
|
+
LeftIcon: i.ArrowNarrowLeft,
|
|
22
|
+
...o,
|
|
23
|
+
children: "Click"
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
);
|
|
27
|
+
expect(t.getByTestId(s)).toBeInTheDocument(), expect(e).toMatchSnapshot();
|
|
28
|
+
}), test("renders RightIcon when provided", () => {
|
|
29
|
+
const { container: e } = c(
|
|
30
|
+
/* @__PURE__ */ n(
|
|
31
|
+
r,
|
|
32
|
+
{
|
|
33
|
+
RightIcon: i.ArrowNarrowRight,
|
|
34
|
+
...o,
|
|
35
|
+
children: "Click"
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
expect(t.getByTestId(h)).toBeInTheDocument(), expect(e).toMatchSnapshot();
|
|
40
|
+
}), test("renders both LeftIcon and RightIcon when provided", () => {
|
|
41
|
+
const { container: e } = c(
|
|
42
|
+
/* @__PURE__ */ n(
|
|
43
|
+
r,
|
|
44
|
+
{
|
|
45
|
+
LeftIcon: i.ArrowNarrowLeft,
|
|
46
|
+
RightIcon: i.ArrowNarrowRight,
|
|
47
|
+
...o,
|
|
48
|
+
children: "Click"
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
);
|
|
52
|
+
expect(t.getByTestId(s)).toBeInTheDocument(), expect(t.getByTestId(h)).toBeInTheDocument(), expect(e).toMatchSnapshot();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=ButtonWithIcon.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonWithIcon.test.js","sources":["../../../lib/components/ButtonWithIcon/ButtonWithIcon.test.tsx"],"sourcesContent":["import {cleanup, render, screen} from '@testing-library/react';\nimport {BUTTON_COLOR, BUTTON_SIZE} from '@/components/Button/constants';\nimport {ButtonWithIcon} from '@/components/ButtonWithIcon/ButtonWithIcon';\nimport {Icons} from '@/services/icons';\nimport {LEFT_ICON_BUTTON_TEST_ID, RIGHT_ICON_BUTTON_TEST_ID} from '@/components/ButtonWithIcon/constants';\n\ndescribe('ButtonWithIcon component', () => {\n afterEach(cleanup);\n const props = {\n color: BUTTON_COLOR.GRAY,\n size: BUTTON_SIZE.BIG,\n };\n test('renders component correctly', () => {\n const {container} = render(<ButtonWithIcon {...props}>Click me</ButtonWithIcon>);\n expect(screen.getByText('Click me')).toBeInTheDocument();\n expect(container).toMatchSnapshot();\n });\n test('renders LeftIcon when provided', () => {\n const {container} = render(\n <ButtonWithIcon\n LeftIcon={Icons.ArrowNarrowLeft}\n {...props}\n >\n Click\n </ButtonWithIcon>,\n );\n expect(screen.getByTestId(LEFT_ICON_BUTTON_TEST_ID)).toBeInTheDocument();\n expect(container).toMatchSnapshot();\n });\n\n test('renders RightIcon when provided', () => {\n const {container} = render(\n <ButtonWithIcon\n RightIcon={Icons.ArrowNarrowRight}\n {...props}\n >\n Click\n </ButtonWithIcon>,\n );\n expect(screen.getByTestId(RIGHT_ICON_BUTTON_TEST_ID)).toBeInTheDocument();\n expect(container).toMatchSnapshot();\n });\n\n test('renders both LeftIcon and RightIcon when provided', () => {\n const {container} = render(\n <ButtonWithIcon\n LeftIcon={Icons.ArrowNarrowLeft}\n RightIcon={Icons.ArrowNarrowRight}\n {...props}\n >\n Click\n </ButtonWithIcon>,\n );\n expect(screen.getByTestId(LEFT_ICON_BUTTON_TEST_ID)).toBeInTheDocument();\n expect(screen.getByTestId(RIGHT_ICON_BUTTON_TEST_ID)).toBeInTheDocument();\n expect(container).toMatchSnapshot();\n });\n});\n"],"names":["cleanup","props","BUTTON_COLOR","BUTTON_SIZE","container","render","ButtonWithIcon","screen","jsx","Icons","LEFT_ICON_BUTTON_TEST_ID","RIGHT_ICON_BUTTON_TEST_ID"],"mappings":";;;;;;AAMA,SAAS,4BAA4B,MAAM;AACzC,YAAUA,CAAO;AACjB,QAAMC,IAAQ;AAAA,IACZ,OAAOC,EAAa;AAAA,IACpB,MAAMC,EAAY;AAAA,EACpB;AACA,OAAK,+BAA+B,MAAM;AAClC,UAAA,EAAC,WAAAC,MAAaC,oBAAQC,GAAgB,EAAA,GAAGL,GAAO,UAAA,WAAA,CAAQ,CAAiB;AAC/E,WAAOM,EAAO,UAAU,UAAU,CAAC,EAAE,kBAAkB,GAChD,OAAAH,CAAS,EAAE,gBAAgB;AAAA,EAAA,CACnC,GACD,KAAK,kCAAkC,MAAM;AACrC,UAAA,EAAC,WAAAA,MAAaC;AAAA,MAClB,gBAAAG;AAAA,QAACF;AAAA,QAAA;AAAA,UACC,UAAUG,EAAM;AAAA,UACf,GAAGR;AAAA,UACL,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAGH;AACA,WAAOM,EAAO,YAAYG,CAAwB,CAAC,EAAE,kBAAkB,GAChE,OAAAN,CAAS,EAAE,gBAAgB;AAAA,EAAA,CACnC,GAED,KAAK,mCAAmC,MAAM;AACtC,UAAA,EAAC,WAAAA,MAAaC;AAAA,MAClB,gBAAAG;AAAA,QAACF;AAAA,QAAA;AAAA,UACC,WAAWG,EAAM;AAAA,UAChB,GAAGR;AAAA,UACL,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAGH;AACA,WAAOM,EAAO,YAAYI,CAAyB,CAAC,EAAE,kBAAkB,GACjE,OAAAP,CAAS,EAAE,gBAAgB;AAAA,EAAA,CACnC,GAED,KAAK,qDAAqD,MAAM;AACxD,UAAA,EAAC,WAAAA,MAAaC;AAAA,MAClB,gBAAAG;AAAA,QAACF;AAAA,QAAA;AAAA,UACC,UAAUG,EAAM;AAAA,UAChB,WAAWA,EAAM;AAAA,UAChB,GAAGR;AAAA,UACL,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAGH;AACA,WAAOM,EAAO,YAAYG,CAAwB,CAAC,EAAE,kBAAkB,GACvE,OAAOH,EAAO,YAAYI,CAAyB,CAAC,EAAE,kBAAkB,GACjE,OAAAP,CAAS,EAAE,gBAAgB;AAAA,EAAA,CACnC;AACH,CAAC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../lib/components/ButtonWithIcon/constants.ts"],"sourcesContent":["export const LEFT_ICON_BUTTON_TEST_ID = 'leftIconButtonTestId';\nexport const RIGHT_ICON_BUTTON_TEST_ID = 'rightIconButtonTestId';\n"],"names":["LEFT_ICON_BUTTON_TEST_ID","RIGHT_ICON_BUTTON_TEST_ID"],"mappings":"AAAO,MAAMA,IAA2B,wBAC3BC,IAA4B;"}
|