@orangesk/orange-design-system 2.0.0-beta.34 → 2.0.0-beta.35
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 +3 -3
- package/build/components/BodyBanner/style.css +1 -1
- package/build/components/BodyBanner/style.css.map +1 -1
- package/build/components/Megamenu/style.css +1 -1
- package/build/components/Megamenu/style.css.map +1 -1
- package/build/components/Table/style.css +1 -1
- package/build/components/Table/style.css.map +1 -1
- package/build/components/index.js +1 -1
- package/build/components/index.js.map +1 -1
- package/build/components/tsconfig.tsbuildinfo +1 -1
- package/build/components/types/index.d.ts +11 -1
- package/build/components/types/src/components/Forms/TextInput/TextInput.d.ts +3 -0
- package/build/components/types/src/components/Icon/index.d.ts +1 -0
- package/build/components/types/src/components/Megamenu/Megamenu.static.d.ts +2 -0
- package/build/components/types/src/components/Megamenu/constants.d.ts +3 -0
- package/build/components/types/src/components/index.d.ts +2 -2
- package/build/lib/components.css +1 -1
- package/build/lib/components.css.map +1 -1
- package/build/lib/footer.js.map +1 -1
- package/build/lib/megamenu.css +1 -1
- package/build/lib/megamenu.css.map +1 -1
- package/build/lib/megamenu.js +1 -1
- package/build/lib/megamenu.js.map +1 -1
- package/build/lib/scripts.js +1 -1
- package/build/lib/scripts.js.map +1 -1
- package/build/lib/style.css +1 -1
- package/build/lib/style.css.map +1 -1
- package/build/lib/tsconfig.tsbuildinfo +1 -1
- package/build/search-index.json +4 -4
- package/package.json +13 -12
- package/src/components/Accordion/tests/{Accordion.static.test.js → Accordion.static.test.jsx} +23 -23
- package/src/components/Accordion/tests/{Accordion.unit.test.js → Accordion.unit.test.jsx} +1 -1
- package/src/components/Alert/tests/{Alert.conformance.test.js → Alert.conformance.test.jsx} +1 -1
- package/src/components/Alert/tests/{Alert.test.js → Alert.test.jsx} +1 -1
- package/src/components/AnchorNavigation/tests/{AnchorNavigation.conformance.test.js → AnchorNavigation.conformance.test.jsx} +1 -1
- package/src/components/Bar/tests/{Bar.conformance.test.js → Bar.conformance.test.jsx} +1 -1
- package/src/components/BlockAction/tests/{BlockAction.conformance.test.js → BlockAction.conformance.test.jsx} +1 -1
- package/src/components/BlockAction/tests/{BlockActionControl.unit.test.js → BlockActionControl.unit.test.jsx} +2 -2
- package/src/components/BodyBanner/styles/mixins.scss +1 -5
- package/src/components/BodyBanner/tests/{BodyBanner.conformance.test.js → BodyBanner.conformance.test.jsx} +1 -1
- package/src/components/Breadcrumbs/tests/{Breadcrumbs.conformance.test.js → Breadcrumbs.conformance.test.jsx} +1 -1
- package/src/components/Button/tests/{Button.conformance.test.js → Button.conformance.test.jsx} +1 -1
- package/src/components/Button/tests/{Button.test.js → Button.test.jsx} +1 -1
- package/src/components/Buttons/tests/{Buttons.conformance.test.js → Buttons.conformance.test.jsx} +1 -1
- package/src/components/Card/tests/{Card.conformance.test.js → Card.conformance.test.jsx} +1 -1
- package/src/components/Carousel/tests/{Carousel.conformance.test.js → Carousel.conformance.test.jsx} +1 -1
- package/src/components/Carousel/tests/{Carousel.static.test.js → Carousel.static.test.jsx} +49 -42
- package/src/components/CarouselHero/tests/{CarouselHero.conformance.test.js → CarouselHero.conformance.test.jsx} +25 -9
- package/src/components/CarouselHero/tests/{CarouselHeroItem.conformance.test.js → CarouselHeroItem.conformance.test.jsx} +1 -1
- package/src/components/CarouselPromotions/tests/{CarouselPromotions.conformance.test.js → CarouselPromotions.conformance.test.jsx} +12 -3
- package/src/components/CarouselPromotions/tests/{CarouselPromotions.unit.test.js → CarouselPromotions.unit.test.jsx} +2 -3
- package/src/components/CartTable/tests/{CartTable.conformance.test.js → CartTable.conformance.test.jsx} +1 -1
- package/src/components/Container/tests/{Container.conformance.test.js → Container.conformance.test.jsx} +2 -6
- package/src/components/Container/tests/{Container.unit.test.js → Container.unit.test.jsx} +2 -2
- package/src/components/Controls/tests/{Controls.test.js → Controls.test.jsx} +12 -12
- package/src/components/Cover/tests/{Cover.conformance.test.js → Cover.conformance.test.jsx} +1 -1
- package/src/components/Divider/tests/{Divider.conformance.test.js → Divider.conformance.test.jsx} +1 -1
- package/src/components/Dropdown/tests/{Dropdown.conformance.test.js → Dropdown.conformance.test.jsx} +1 -1
- package/src/components/Expander/tests/{Expander.conformance.test.js → Expander.conformance.test.jsx} +1 -1
- package/src/components/FeatureAccordion/tests/{FeatureAccordion.conformance.test.js → FeatureAccordion.conformance.test.jsx} +1 -1
- package/src/components/Footer/tests/{Footer.conformance.test.js → Footer.conformance.test.jsx} +1 -5
- package/src/components/Forms/Autocomplete/Autocomplete.static.ts +36 -0
- package/src/components/Forms/Autocomplete/styles/style.scss +42 -0
- package/src/components/Forms/Field/tests/{Autocomplete.Field.conformance.test.js → Autocomplete.Field.conformance.test.jsx} +1 -1
- package/src/components/Forms/Field/tests/{Checkbox.Field.conformance.test.js → Checkbox.Field.conformance.test.jsx} +1 -1
- package/src/components/Forms/Field/tests/{File.Field.conformance.test.js → File.Field.conformance.test.jsx} +2 -2
- package/src/components/Forms/Field/tests/{Group.Field.conformance.test.js → Group.Field.conformance.test.jsx} +1 -1
- package/src/components/Forms/Field/tests/{Radio.Field.conformance.test.js → Radio.Field.conformance.test.jsx} +1 -1
- package/src/components/Forms/Field/tests/{Rangeslider.Field.test.js → Rangeslider.Field.test.jsx} +1 -1
- package/src/components/Forms/Field/tests/{Select.Field.conformance.test.js → Select.Field.conformance.test.jsx} +1 -1
- package/src/components/Forms/Field/tests/{Text.Field.conformance.test.js → Text.Field.conformance.test.jsx} +1 -1
- package/src/components/Forms/Field/tests/{Textarea.Field.conformance.test.js → Textarea.Field.conformance.test.jsx} +1 -1
- package/src/components/Forms/TextInput/TextInput.tsx +30 -3
- package/src/components/Forms/TextInput/styles/style.scss +62 -0
- package/src/components/Grid/tests/{GridCol.unit.test.js → GridCol.unit.test.jsx} +1 -1
- package/src/components/Hero/tests/{Hero.conformance.test.js → Hero.conformance.test.jsx} +1 -1
- package/src/components/Icon/index.ts +1 -0
- package/src/components/Icon/tests/{Icon.conformance.test.js → Icon.conformance.test.jsx} +1 -1
- package/src/components/Icon/tests/{Icon.unit.test.js → Icon.unit.test.jsx} +1 -1
- package/src/components/Icon/tests/{Pictogram.unit.test.js → Pictogram.unit.test.jsx} +2 -20
- package/src/components/IconList/tests/{IconList.conformance.test.js → IconList.conformance.test.jsx} +2 -2
- package/src/components/IconList/tests/{IconList.unit.test.js → IconList.unit.test.jsx} +1 -1
- package/src/components/IconList/tests/{Item.unit.test.js → Item.unit.test.jsx} +1 -1
- package/src/components/Image/tests/{Image.conformance.test.js → Image.conformance.test.jsx} +1 -1
- package/src/components/Image/tests/{Image.unit.test.js → Image.unit.test.jsx} +12 -3
- package/src/components/Link/tests/{Link.conformance.test.js → Link.conformance.test.jsx} +2 -2
- package/src/components/Link/tests/{Link.unit.test.js → Link.unit.test.jsx} +5 -5
- package/src/components/List/tests/{List.conformance.test.js → List.conformance.test.jsx} +1 -1
- package/src/components/Loader/tests/{Loader.conformance.test.js → Loader.conformance.test.jsx} +1 -1
- package/src/components/Megamenu/Megamenu.static.ts +59 -8
- package/src/components/Megamenu/MegamenuSearchContent.tsx +22 -14
- package/src/components/Megamenu/constants.ts +3 -0
- package/src/components/Megamenu/styles/mixins.scss +33 -2
- package/src/components/Megamenu/styles/style.scss +4 -0
- package/src/components/Modal/tests/{Modal.conformance.test.js → Modal.conformance.test.jsx} +2 -2
- package/src/components/Pagination/tests/{Item.unit.test.js → Item.unit.test.jsx} +1 -1
- package/src/components/Pagination/tests/{Pagination.conformance.test.js → Pagination.conformance.test.jsx} +1 -1
- package/src/components/Pagination/tests/{Separator.unit.test.js → Separator.unit.test.jsx} +1 -1
- package/src/components/Pill/tests/{Pill.conformance.test.js → Pill.conformance.test.jsx} +1 -1
- package/src/components/Progress/tests/{Progress.conformance.test.js → Progress.conformance.test.jsx} +1 -1
- package/src/components/PromoBanner/tests/{PromoBanner.conformance.test.js → PromoBanner.conformance.test.jsx} +7 -7
- package/src/components/PromoBanner/tests/{PromoBanner.unit.test.js → PromoBanner.unit.test.jsx} +1 -1
- package/src/components/PromotionCard/tests/{PromotionCard.conformance.test.js → PromotionCard.conformance.test.jsx} +4 -4
- package/src/components/PromotionCard/tests/{PromotionCard.unit.test.js → PromotionCard.unit.test.jsx} +1 -1
- package/src/components/Section/tests/{Section.conformance.test.js → Section.conformance.test.jsx} +4 -4
- package/src/components/Section/tests/{Section.unit.test.js → Section.unit.test.jsx} +1 -1
- package/src/components/Skeleton/tests/{Skeleton.conformance.test.js → Skeleton.conformance.test.jsx} +1 -1
- package/src/components/SkipLink/tests/{SkipLink.unit.test.js → SkipLink.unit.test.jsx} +2 -2
- package/src/components/SocialButton/tests/{SocialButton.unit.test.js → SocialButton.unit.test.jsx} +2 -2
- package/src/components/Stepbar/tests/{Stepbar.conformance.test.js → Stepbar.conformance.test.jsx} +1 -1
- package/src/components/Sticker/tests/{Sticker.conformance.test.js → Sticker.conformance.test.jsx} +1 -1
- package/src/components/Table/styles/mixins.scss +0 -4
- package/src/components/Table/styles/style.scss +0 -4
- package/src/components/Table/tests/{Table.conformance.test.js → Table.conformance.test.jsx} +1 -1
- package/src/components/Tabs/tests/{Tabs.unit.test.js → Tabs.unit.test.jsx} +1 -1
- package/src/components/Tag/tests/{Tag.conformance.test.js → Tag.conformance.test.jsx} +1 -1
- package/src/components/Tag/tests/{Tag.unit.test.js → Tag.unit.test.jsx} +4 -4
- package/src/components/Tag/tests/{TagButton.conformance.test.js → TagButton.conformance.test.jsx} +1 -1
- package/src/components/Tag/tests/{TagButton.unit.test.js → TagButton.unit.test.jsx} +3 -2
- package/src/components/Testimonial/tests/{Testimonial.conformance.test.js → Testimonial.conformance.test.jsx} +1 -1
- package/src/components/Tile/tests/{Tile.conformance.test.js → Tile.conformance.test.jsx} +1 -1
- package/src/components/Tile/tests/{Tile.unit.test.js → Tile.unit.test.jsx} +2 -2
- package/src/components/Tooltip/tests/{Tooltip.conformance.test.js → Tooltip.conformance.test.jsx} +1 -1
- package/src/components/Tooltip/tests/{Tooltip.unit.test.js → Tooltip.unit.test.jsx} +9 -5
- package/src/components/index.ts +3 -1
- /package/src/components/AnchorNavigation/tests/{AnchorNavigation.unit.test.js → AnchorNavigation.unit.test.jsx} +0 -0
- /package/src/components/Bar/tests/{Bar.unit.test.js → Bar.unit.test.jsx} +0 -0
- /package/src/components/Bar/tests/{BarBreak.unit.test.js → BarBreak.unit.test.jsx} +0 -0
- /package/src/components/Bar/tests/{BarItem.unit.test.js → BarItem.unit.test.jsx} +0 -0
- /package/src/components/BlockAction/tests/{BlockAction.unit.test.js → BlockAction.unit.test.jsx} +0 -0
- /package/src/components/BlockAction/tests/{BlockActionIndicator.unit.test.js → BlockActionIndicator.unit.test.jsx} +0 -0
- /package/src/components/BlockAction/tests/{CloneElementWithClassName.unit.test.js → CloneElementWithClassName.unit.test.jsx} +0 -0
- /package/src/components/BodyBanner/tests/{BodyBanner.unit.test.js → BodyBanner.unit.test.jsx} +0 -0
- /package/src/components/Breadcrumbs/tests/{BreadcrumbItem.unit.test.js → BreadcrumbItem.unit.test.jsx} +0 -0
- /package/src/components/Breadcrumbs/tests/{Breadcrumbs.integration.test.js → Breadcrumbs.integration.test.jsx} +0 -0
- /package/src/components/Breadcrumbs/tests/{Breadcrumbs.unit.test.js → Breadcrumbs.unit.test.jsx} +0 -0
- /package/src/components/Button/tests/{IconButton.unit.test.js → IconButton.unit.test.jsx} +0 -0
- /package/src/components/Buttons/tests/{Buttons.unit.test.js → Buttons.unit.test.jsx} +0 -0
- /package/src/components/Card/tests/{Card.unit.test.js → Card.unit.test.jsx} +0 -0
- /package/src/components/Card/tests/{CardProductHeader.unit.test.js → CardProductHeader.unit.test.jsx} +0 -0
- /package/src/components/Card/tests/{CardSection.unit.test.js → CardSection.unit.test.jsx} +0 -0
- /package/src/components/Carousel/tests/{Carousel.unit.test.js → Carousel.unit.test.jsx} +0 -0
- /package/src/components/Carousel/tests/{CarouselItem.unit.test.js → CarouselItem.unit.test.jsx} +0 -0
- /package/src/components/CarouselHero/tests/{CarouselHero.unit.test.js → CarouselHero.unit.test.jsx} +0 -0
- /package/src/components/CarouselHero/tests/{CarouselHeroItem.unit.test.js → CarouselHeroItem.unit.test.jsx} +0 -0
- /package/src/components/CarouselPromotions/tests/{CarouselPromotionsItem.unit.test.js → CarouselPromotionsItem.unit.test.jsx} +0 -0
- /package/src/components/Cover/tests/{Cover.unit.test.js → Cover.unit.test.jsx} +0 -0
- /package/src/components/Divider/tests/{Divider.unit.test.js → Divider.unit.test.jsx} +0 -0
- /package/src/components/Dropdown/tests/{Dropdown.unit.test.js → Dropdown.unit.test.jsx} +0 -0
- /package/src/components/Expander/tests/{Expander.unit.test.js → Expander.unit.test.jsx} +0 -0
- /package/src/components/FeatureAccordion/tests/{FeatureAccordion.unit.test.js → FeatureAccordion.unit.test.jsx} +0 -0
- /package/src/components/Footer/tests/{Footer.unit.test.js → Footer.unit.test.jsx} +0 -0
- /package/src/components/Forms/Checkbox/tests/{Checkbox.unit.test.js → Checkbox.unit.test.jsx} +0 -0
- /package/src/components/Forms/DatePicker/tests/{DatePicker.unit.test.js → DatePicker.unit.test.jsx} +0 -0
- /package/src/components/Forms/Field/tests/{Field.unit.test.js → Field.unit.test.jsx} +0 -0
- /package/src/components/Forms/Field/tests/{Label.unit.test.js → Label.unit.test.jsx} +0 -0
- /package/src/components/Forms/Field/tests/{Messages.unit.test.js → Messages.unit.test.jsx} +0 -0
- /package/src/components/Forms/Field/tests/{Tooltip.unit.test.js → Tooltip.unit.test.jsx} +0 -0
- /package/src/components/Forms/Fieldset/tests/{Fieldset.unit.test.js → Fieldset.unit.test.jsx} +0 -0
- /package/src/components/Forms/Group/tests/{Group.unit.test.js → Group.unit.test.jsx} +0 -0
- /package/src/components/Forms/Group/tests/{Item.unit.test.js → Item.unit.test.jsx} +0 -0
- /package/src/components/Forms/Hint/tests/{Hint.unit.test.js → Hint.unit.test.jsx} +0 -0
- /package/src/components/Forms/InputStepper/tests/{InputStepper.unit.test.js → InputStepper.unit.test.jsx} +0 -0
- /package/src/components/Forms/Label/tests/{Label.unit.test.js → Label.unit.test.jsx} +0 -0
- /package/src/components/Forms/Message/tests/{Message.unit.test.js → Message.unit.test.jsx} +0 -0
- /package/src/components/Forms/Radio/tests/{Radio.unit.test.js → Radio.unit.test.jsx} +0 -0
- /package/src/components/Forms/Select/tests/{Select.unit.test.js → Select.unit.test.jsx} +0 -0
- /package/src/components/Forms/TextArea/tests/{TextArea.unit.test.js → TextArea.unit.test.jsx} +0 -0
- /package/src/components/Forms/TextInput/tests/{TextInput.unit.test.js → TextInput.unit.test.jsx} +0 -0
- /package/src/components/Gauge/tests/{Gauge.conformance.test.js → Gauge.conformance.test.jsx} +0 -0
- /package/src/components/Gauge/tests/{Gauge.unit.test.js → Gauge.unit.test.jsx} +0 -0
- /package/src/components/Grid/tests/{Grid.unit.test.js → Grid.unit.test.jsx} +0 -0
- /package/src/components/Hero/tests/{Hero.unit.test.js → Hero.unit.test.jsx} +0 -0
- /package/src/components/List/tests/{ClickableControl.unit.test.js → ClickableControl.unit.test.jsx} +0 -0
- /package/src/components/List/tests/{List.unit.test.js → List.unit.test.jsx} +0 -0
- /package/src/components/List/tests/{ListItem.unit.test.js → ListItem.unit.test.jsx} +0 -0
- /package/src/components/Loader/tests/{Loader.unit.test.js → Loader.unit.test.jsx} +0 -0
- /package/src/components/Modal/tests/{Modal.unit.test.js → Modal.unit.test.jsx} +0 -0
- /package/src/components/Modal/tests/{ModalBody.unit.test.js → ModalBody.unit.test.jsx} +0 -0
- /package/src/components/Modal/tests/{ModalCloseButton.unit.test.js → ModalCloseButton.unit.test.jsx} +0 -0
- /package/src/components/Modal/tests/{ModalProductHeader.unit.test.js → ModalProductHeader.unit.test.jsx} +0 -0
- /package/src/components/Modal/tests/{ModalTitle.unit.test.js → ModalTitle.unit.test.jsx} +0 -0
- /package/src/components/Pagination/tests/{Pagination.unit.test.js → Pagination.unit.test.jsx} +0 -0
- /package/src/components/Pill/tests/{Pill.unit.test.js → Pill.unit.test.jsx} +0 -0
- /package/src/components/Progress/tests/{Progress.unit.test.js → Progress.unit.test.jsx} +0 -0
- /package/src/components/Skeleton/tests/{Skeleton.unit.test.js → Skeleton.unit.test.jsx} +0 -0
- /package/src/components/Stepbar/tests/{Stepbar.unit.test.js → Stepbar.unit.test.jsx} +0 -0
- /package/src/components/Sticker/tests/{Sticker.unit.test.js → Sticker.unit.test.jsx} +0 -0
- /package/src/components/Table/tests/{Cell.unit.test.js → Cell.unit.test.jsx} +0 -0
- /package/src/components/Table/tests/{Footer.unit.test.js → Footer.unit.test.jsx} +0 -0
- /package/src/components/Table/tests/{Header.unit.test.js → Header.unit.test.jsx} +0 -0
- /package/src/components/Table/tests/{Row.unit.test.js → Row.unit.test.jsx} +0 -0
- /package/src/components/Table/tests/{Rows.unit.test.js → Rows.unit.test.jsx} +0 -0
- /package/src/components/Table/tests/{Table.unit.test.js → Table.unit.test.jsx} +0 -0
- /package/src/components/Tabs/tests/{Tab.unit.test.js → Tab.unit.test.jsx} +0 -0
- /package/src/components/Tabs/tests/{TabPanel.unit.test.js → TabPanel.unit.test.jsx} +0 -0
- /package/src/components/Testimonial/tests/{Testimonial.unit.test.js → Testimonial.unit.test.jsx} +0 -0
- /package/src/components/Tooltip/tests/{InfoTooltip.unit.test.js → InfoTooltip.unit.test.jsx} +0 -0
package/src/components/Footer/tests/{Footer.conformance.test.js → Footer.conformance.test.jsx}
RENAMED
|
@@ -20,14 +20,10 @@
|
|
|
20
20
|
* - Tests dark theme context
|
|
21
21
|
*/
|
|
22
22
|
import { render } from "@testing-library/react";
|
|
23
|
-
import { axe
|
|
24
|
-
import "jest-axe/extend-expect";
|
|
23
|
+
import { axe } from "vitest-axe";
|
|
25
24
|
|
|
26
25
|
import { Footer } from "../Footer";
|
|
27
26
|
|
|
28
|
-
// Extension of expect for axe
|
|
29
|
-
expect.extend(toHaveNoViolations);
|
|
30
|
-
|
|
31
27
|
describe("Footer Conformance Tests", () => {
|
|
32
28
|
describe("HTML Validity", () => {
|
|
33
29
|
it("is valid html with default props", () => {
|
|
@@ -50,6 +50,42 @@ export default class Autocomplete {
|
|
|
50
50
|
}
|
|
51
51
|
this.config = { ...this.config, ...elementConfig };
|
|
52
52
|
|
|
53
|
+
const customInputClassName = this.config.customInputClassName || "";
|
|
54
|
+
const customInputClassTokens = customInputClassName
|
|
55
|
+
.split(/\s+/)
|
|
56
|
+
.filter(Boolean);
|
|
57
|
+
|
|
58
|
+
const hasSearchIcon = customInputClassTokens.includes("input--search-icon");
|
|
59
|
+
const hasSearchIconWithPlaceholder = customInputClassTokens.includes(
|
|
60
|
+
"input--search-icon-with-placeholder",
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
this.config.customInputClassName = customInputClassTokens
|
|
64
|
+
.filter(
|
|
65
|
+
(token) =>
|
|
66
|
+
token !== "input--search-icon" &&
|
|
67
|
+
token !== "input--search-icon-with-placeholder",
|
|
68
|
+
)
|
|
69
|
+
.join(" ");
|
|
70
|
+
|
|
71
|
+
if (hasSearchIcon) {
|
|
72
|
+
this.config.wrapperClassName = [
|
|
73
|
+
this.config.wrapperClassName,
|
|
74
|
+
"autocomplete__wrapper--search-icon",
|
|
75
|
+
]
|
|
76
|
+
.filter(Boolean)
|
|
77
|
+
.join(" ");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (hasSearchIconWithPlaceholder) {
|
|
81
|
+
this.config.wrapperClassName = [
|
|
82
|
+
this.config.wrapperClassName,
|
|
83
|
+
"autocomplete__wrapper--search-icon-with-placeholder",
|
|
84
|
+
]
|
|
85
|
+
.filter(Boolean)
|
|
86
|
+
.join(" ");
|
|
87
|
+
}
|
|
88
|
+
|
|
53
89
|
// Dynamic import to avoid SSR issues
|
|
54
90
|
const accessibleAutocomplete = (
|
|
55
91
|
await import("@orangesk/accessible-autocomplete")
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
@use "./config";
|
|
2
2
|
@use "./mixins";
|
|
3
3
|
@use "../../TextInput/styles/mixins" as textMixins;
|
|
4
|
+
@use "../../TextInput/styles/config" as textConfig;
|
|
4
5
|
@use "../../styles/config" as commonConfig;
|
|
5
6
|
@use "../../../../styles/tools/generate";
|
|
7
|
+
@use "../../../../styles/tools/convert";
|
|
6
8
|
|
|
7
9
|
@layer components {
|
|
8
10
|
.autocomplete {
|
|
@@ -15,6 +17,46 @@
|
|
|
15
17
|
|
|
16
18
|
&__wrapper {
|
|
17
19
|
@include mixins.wrapper();
|
|
20
|
+
|
|
21
|
+
&--search-icon,
|
|
22
|
+
&--search-icon-with-placeholder {
|
|
23
|
+
isolation: isolate;
|
|
24
|
+
|
|
25
|
+
&::before {
|
|
26
|
+
content: "";
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: 50%;
|
|
29
|
+
left: convert.to-rem(8px);
|
|
30
|
+
width: convert.to-rem(20px);
|
|
31
|
+
height: convert.to-rem(20px);
|
|
32
|
+
transform: translateY(-50%);
|
|
33
|
+
background-image: textConfig.$background-image-search-icon;
|
|
34
|
+
background-repeat: no-repeat;
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
z-index: 3;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.autocomplete__input {
|
|
40
|
+
background-image: none !important;
|
|
41
|
+
padding-left: convert.to-rem(40px);
|
|
42
|
+
position: relative;
|
|
43
|
+
z-index: 1;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.autocomplete__hint {
|
|
47
|
+
padding-left: convert.to-rem(40px);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&--search-icon {
|
|
52
|
+
&::before {
|
|
53
|
+
opacity: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:has(.autocomplete__input:not(:focus):placeholder-shown)::before {
|
|
57
|
+
opacity: 1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
18
60
|
}
|
|
19
61
|
|
|
20
62
|
&__input {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { render } from "@testing-library/react";
|
|
2
|
-
import { axe } from
|
|
2
|
+
import { axe } from 'vitest-axe';
|
|
3
3
|
|
|
4
4
|
import { Field } from "..";
|
|
5
5
|
|
|
@@ -28,7 +28,7 @@ const example = (
|
|
|
28
28
|
);
|
|
29
29
|
|
|
30
30
|
beforeAll(() => {
|
|
31
|
-
global.DataTransfer =
|
|
31
|
+
global.DataTransfer = vi.fn(() => ({ files: undefined }));
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
it("is valid html", () => {
|
|
@@ -15,8 +15,12 @@ export type TextInputType =
|
|
|
15
15
|
| "text"
|
|
16
16
|
| "url";
|
|
17
17
|
|
|
18
|
-
export
|
|
19
|
-
|
|
18
|
+
export type TextInputSearchIcon = "none" | "transient" | "persistent";
|
|
19
|
+
|
|
20
|
+
export interface TextInputProps extends Omit<
|
|
21
|
+
React.InputHTMLAttributes<HTMLInputElement>,
|
|
22
|
+
"size"
|
|
23
|
+
> {
|
|
20
24
|
/** Input html type. */
|
|
21
25
|
htmlType?: TextInputType;
|
|
22
26
|
/** Html id attribute. */
|
|
@@ -41,12 +45,15 @@ export interface TextInputProps
|
|
|
41
45
|
width?: TextInputWidth;
|
|
42
46
|
/** Additional CSS classes */
|
|
43
47
|
className?: string;
|
|
48
|
+
/** Search icon mode. `transient` shows icon only on empty unfocused input, `persistent` keeps it visible with placeholder. */
|
|
49
|
+
searchIcon?: TextInputSearchIcon;
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
const defaultProps = {
|
|
47
53
|
htmlType: "text" as TextInputType,
|
|
48
54
|
size: "default" as TextInputSize,
|
|
49
55
|
width: "default" as TextInputWidth,
|
|
56
|
+
searchIcon: "none" as TextInputSearchIcon,
|
|
50
57
|
};
|
|
51
58
|
|
|
52
59
|
const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(
|
|
@@ -62,11 +69,15 @@ const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(
|
|
|
62
69
|
size = defaultProps.size,
|
|
63
70
|
htmlType = defaultProps.htmlType,
|
|
64
71
|
width = defaultProps.width,
|
|
72
|
+
searchIcon = defaultProps.searchIcon,
|
|
65
73
|
name,
|
|
66
74
|
...other
|
|
67
75
|
},
|
|
68
76
|
ref,
|
|
69
77
|
) => {
|
|
78
|
+
const hasSearchIcon = searchIcon === "transient";
|
|
79
|
+
const hasSearchIconWithPlaceholder = searchIcon === "persistent";
|
|
80
|
+
|
|
70
81
|
const classes = cx(
|
|
71
82
|
CLASS_ROOT,
|
|
72
83
|
{
|
|
@@ -80,7 +91,7 @@ const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(
|
|
|
80
91
|
|
|
81
92
|
const inputName = name || id;
|
|
82
93
|
|
|
83
|
-
|
|
94
|
+
const inputElement = (
|
|
84
95
|
<input
|
|
85
96
|
className={classes}
|
|
86
97
|
id={id}
|
|
@@ -93,6 +104,22 @@ const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(
|
|
|
93
104
|
{...other}
|
|
94
105
|
/>
|
|
95
106
|
);
|
|
107
|
+
|
|
108
|
+
if (hasSearchIcon || hasSearchIconWithPlaceholder) {
|
|
109
|
+
return (
|
|
110
|
+
<span
|
|
111
|
+
className={cx("text-input__wrapper", {
|
|
112
|
+
"text-input__wrapper--search-icon": hasSearchIcon,
|
|
113
|
+
"text-input__wrapper--search-icon-with-placeholder":
|
|
114
|
+
hasSearchIconWithPlaceholder,
|
|
115
|
+
})}
|
|
116
|
+
>
|
|
117
|
+
{inputElement}
|
|
118
|
+
</span>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return inputElement;
|
|
96
123
|
},
|
|
97
124
|
);
|
|
98
125
|
|
|
@@ -3,6 +3,68 @@
|
|
|
3
3
|
@use "./mixins";
|
|
4
4
|
|
|
5
5
|
@layer components {
|
|
6
|
+
.text-input__wrapper {
|
|
7
|
+
position: relative;
|
|
8
|
+
|
|
9
|
+
&--search-icon,
|
|
10
|
+
&--search-icon-with-placeholder {
|
|
11
|
+
display: inline-block;
|
|
12
|
+
|
|
13
|
+
&:has(> .text-input--3ch) {
|
|
14
|
+
@include mixins.width(3ch);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&:has(> .text-input--8ch) {
|
|
18
|
+
@include mixins.width(8ch);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&:has(> .text-input--12ch) {
|
|
22
|
+
@include mixins.width(12ch);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&:has(> .text-input--fullwidth) {
|
|
26
|
+
@include mixins.width(fullwidth);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:has(
|
|
30
|
+
> .text-input:not(.text-input--3ch):not(.text-input--8ch):not(
|
|
31
|
+
.text-input--12ch
|
|
32
|
+
):not(.text-input--fullwidth)
|
|
33
|
+
) {
|
|
34
|
+
@include mixins.width(default);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&::before {
|
|
38
|
+
content: "";
|
|
39
|
+
position: absolute;
|
|
40
|
+
top: 50%;
|
|
41
|
+
left: 0.5rem;
|
|
42
|
+
width: 1.25rem;
|
|
43
|
+
height: 1.25rem;
|
|
44
|
+
transform: translateY(-50%);
|
|
45
|
+
background-image: config.$background-image-search-icon;
|
|
46
|
+
background-repeat: no-repeat;
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
z-index: 1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
> .text-input {
|
|
52
|
+
background-image: none !important;
|
|
53
|
+
padding-left: 2.5rem;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&--search-icon {
|
|
58
|
+
&::before {
|
|
59
|
+
opacity: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&:has(> .text-input:not(:focus):placeholder-shown)::before {
|
|
63
|
+
opacity: 1;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
6
68
|
.text-input {
|
|
7
69
|
@include mixins.base();
|
|
8
70
|
@include mixins.states();
|
|
@@ -1,28 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
const { container } = render(<Pictogram name="pictogram-skylink" />);
|
|
4
|
-
const lightUse = container.querySelector(".icon__use--light");
|
|
5
|
-
const darkUse = container.querySelector(".icon__use--dark");
|
|
6
|
-
|
|
7
|
-
expect(lightUse?.getAttribute("xlink:href")).toBe(
|
|
8
|
-
"/sprite.svg#pictogram-skylink",
|
|
9
|
-
);
|
|
10
|
-
expect(darkUse?.getAttribute("xlink:href")).toBe(
|
|
11
|
-
"/sprite.svg#pictogram-skylink--dark",
|
|
12
|
-
);
|
|
13
|
-
});nd dark use elements", () => {
|
|
14
|
-
const { container } = render(<Pictogram name="pictogram-skylink" />);
|
|
15
|
-
const lightUse = container.querySelector(".icon__use--light");
|
|
16
|
-
const darkUse = container.querySelector(".icon__use--dark");
|
|
17
|
-
|
|
18
|
-
expect(lightUse).toBeInTheDocument();
|
|
19
|
-
expect(darkUse).toBeInTheDocument();
|
|
20
|
-
});m
|
|
2
|
+
* Unit tests for the Pictogram component.
|
|
21
3
|
*/
|
|
22
4
|
|
|
23
5
|
import React from "react";
|
|
24
6
|
import { render } from "@testing-library/react";
|
|
25
|
-
import { axe } from
|
|
7
|
+
import { axe } from 'vitest-axe';
|
|
26
8
|
|
|
27
9
|
import { Pictogram } from "../Pictogram";
|
|
28
10
|
|
package/src/components/IconList/tests/{IconList.conformance.test.js → IconList.conformance.test.jsx}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render } from "@testing-library/react";
|
|
3
|
-
import { axe } from
|
|
3
|
+
import { axe } from 'vitest-axe';
|
|
4
4
|
|
|
5
5
|
// Mock Tooltip komponent
|
|
6
|
-
|
|
6
|
+
vi.mock("../../Tooltip", () => ({
|
|
7
7
|
InfoTooltip: ({ children, placement, ...props }) => (
|
|
8
8
|
<span className="tooltip" data-tooltip-placement={placement} {...props}>
|
|
9
9
|
<svg className="bold" />
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
// Mock Tooltip komponent
|
|
5
|
-
|
|
5
|
+
vi.mock('../../Tooltip', () => ({
|
|
6
6
|
InfoTooltip: ({ children, ...props }) => <div data-testid="info-tooltip" {...props}>{children}</div>,
|
|
7
7
|
}));
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { render } from "@testing-library/react";
|
|
2
2
|
|
|
3
3
|
// Mock Tooltip komponent
|
|
4
|
-
|
|
4
|
+
vi.mock("../../Tooltip", () => ({
|
|
5
5
|
InfoTooltip: ({ children, placement, className = "", ...props }) => (
|
|
6
6
|
<span
|
|
7
7
|
className={`tooltip ${className}`.trim()}
|
|
@@ -2,7 +2,16 @@ import React from "react";
|
|
|
2
2
|
import { render, screen } from "@testing-library/react";
|
|
3
3
|
|
|
4
4
|
// Mock breakpoints since SCSS modules don't work in tests
|
|
5
|
-
|
|
5
|
+
vi.mock("../../../styles/export/breakpoint", () => ({
|
|
6
|
+
default: {
|
|
7
|
+
xs: "0px",
|
|
8
|
+
sm: "480px",
|
|
9
|
+
md: "768px",
|
|
10
|
+
lg: "992px",
|
|
11
|
+
xl: "1240px",
|
|
12
|
+
xxl: "1380px",
|
|
13
|
+
xxxl: "1920px",
|
|
14
|
+
},
|
|
6
15
|
xs: "0px",
|
|
7
16
|
sm: "480px",
|
|
8
17
|
md: "768px",
|
|
@@ -105,8 +114,8 @@ describe("Image Component", () => {
|
|
|
105
114
|
|
|
106
115
|
it("renders with correct src attribute for string src", () => {
|
|
107
116
|
const { container } = render(<Image alt="test" src={singleSource} />);
|
|
108
|
-
expect(container.querySelector("img").src).toEqual(
|
|
109
|
-
|
|
117
|
+
expect(new URL(container.querySelector("img").src).pathname).toEqual(
|
|
118
|
+
singleSource,
|
|
110
119
|
);
|
|
111
120
|
});
|
|
112
121
|
|
|
@@ -19,8 +19,8 @@ Conformance tests for the Link component:
|
|
|
19
19
|
- Does not create unnecessary wrapper elements.
|
|
20
20
|
*/
|
|
21
21
|
import { render, screen } from "@testing-library/react";
|
|
22
|
-
import { axe } from
|
|
23
|
-
import "@testing-library/jest-dom";
|
|
22
|
+
import { axe } from 'vitest-axe';
|
|
23
|
+
import "@testing-library/jest-dom/vitest";
|
|
24
24
|
|
|
25
25
|
import { Link } from "../";
|
|
26
26
|
|
|
@@ -25,14 +25,14 @@ Unit tests for the Link component:
|
|
|
25
25
|
- Has correct display name 'Link'.
|
|
26
26
|
*/
|
|
27
27
|
import { render, screen, fireEvent } from "@testing-library/react";
|
|
28
|
-
import "@testing-library/jest-dom";
|
|
28
|
+
import "@testing-library/jest-dom/vitest";
|
|
29
29
|
|
|
30
30
|
import { Link } from "../";
|
|
31
31
|
|
|
32
32
|
// Mock console.warn to test warning messages
|
|
33
33
|
const originalWarn = console.warn;
|
|
34
34
|
beforeEach(() => {
|
|
35
|
-
console.warn =
|
|
35
|
+
console.warn = vi.fn();
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
afterEach(() => {
|
|
@@ -142,8 +142,8 @@ describe("Link Component", () => {
|
|
|
142
142
|
});
|
|
143
143
|
|
|
144
144
|
it("forwards event handlers", () => {
|
|
145
|
-
const handleClick =
|
|
146
|
-
const handleMouseEnter =
|
|
145
|
+
const handleClick = vi.fn();
|
|
146
|
+
const handleMouseEnter = vi.fn();
|
|
147
147
|
|
|
148
148
|
render(
|
|
149
149
|
<Link
|
|
@@ -242,7 +242,7 @@ describe("Link Component", () => {
|
|
|
242
242
|
});
|
|
243
243
|
|
|
244
244
|
it("supports keyboard navigation", () => {
|
|
245
|
-
const handleClick =
|
|
245
|
+
const handleClick = vi.fn();
|
|
246
246
|
|
|
247
247
|
render(
|
|
248
248
|
<Link href="/" onClick={handleClick} data-testid="link">
|
|
@@ -240,6 +240,40 @@ export default class Megamenu {
|
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
+
isInMobilePanel(element: HTMLElement | null) {
|
|
244
|
+
return Boolean(
|
|
245
|
+
element && this.mobilePanels.some((panel) => panel.contains(element)),
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
getFocusRestoreTarget() {
|
|
250
|
+
const lastFocused = this.lastFocusedElement;
|
|
251
|
+
if (
|
|
252
|
+
lastFocused &&
|
|
253
|
+
lastFocused.isConnected &&
|
|
254
|
+
!this.isInMobilePanel(lastFocused)
|
|
255
|
+
) {
|
|
256
|
+
return lastFocused;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const target = this.activeMobileTarget;
|
|
260
|
+
if (target) {
|
|
261
|
+
const matchingTrigger = this.mobileMenuButtons.find(
|
|
262
|
+
(button) =>
|
|
263
|
+
this.getTargetFromElement(button) === target &&
|
|
264
|
+
!this.isInMobilePanel(button),
|
|
265
|
+
);
|
|
266
|
+
if (matchingTrigger) {
|
|
267
|
+
return matchingTrigger;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return (
|
|
272
|
+
this.mobileMenuButtons.find((button) => !this.isInMobilePanel(button)) ||
|
|
273
|
+
null
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
|
|
243
277
|
setMobilePanelState(panel: HTMLElement, isOpen: boolean) {
|
|
244
278
|
panel.classList.toggle(this.config.activeClass, isOpen);
|
|
245
279
|
panel.setAttribute("aria-hidden", isOpen ? "false" : "true");
|
|
@@ -448,14 +482,26 @@ export default class Megamenu {
|
|
|
448
482
|
return;
|
|
449
483
|
}
|
|
450
484
|
|
|
485
|
+
// Store the element that opened the menu for focus restoration
|
|
486
|
+
// BEFORE changing panel states, so activeElement is captured correctly.
|
|
487
|
+
this.lastFocusedElement =
|
|
488
|
+
source || (document.activeElement as HTMLElement | null);
|
|
489
|
+
|
|
490
|
+
// Move focus out of any panel about to be hidden to prevent
|
|
491
|
+
// the browser from blocking aria-hidden on a focused descendant.
|
|
492
|
+
const focused = document.activeElement as HTMLElement | null;
|
|
493
|
+
if (
|
|
494
|
+
focused &&
|
|
495
|
+
focused !== panel &&
|
|
496
|
+
this.mobilePanels.some((p) => p !== panel && p.contains(focused))
|
|
497
|
+
) {
|
|
498
|
+
focused.blur();
|
|
499
|
+
}
|
|
500
|
+
|
|
451
501
|
// Keep one side panel active at a time.
|
|
452
502
|
this.mobilePanels.forEach((mobilePanel) => {
|
|
453
503
|
this.setMobilePanelState(mobilePanel, mobilePanel === panel);
|
|
454
504
|
});
|
|
455
|
-
|
|
456
|
-
// Store the element that opened the menu for focus restoration.
|
|
457
|
-
this.lastFocusedElement =
|
|
458
|
-
source || (document.activeElement as HTMLElement | null);
|
|
459
505
|
this.activeMobilePanel = panel;
|
|
460
506
|
this.activeMobileTarget = target;
|
|
461
507
|
this.syncMobileButtonState();
|
|
@@ -479,6 +525,15 @@ export default class Megamenu {
|
|
|
479
525
|
return;
|
|
480
526
|
}
|
|
481
527
|
|
|
528
|
+
// Move focus out of the panel BEFORE setting aria-hidden to prevent
|
|
529
|
+
// the browser from blocking aria-hidden on a focused descendant.
|
|
530
|
+
const restoreTarget = this.getFocusRestoreTarget();
|
|
531
|
+
if (restoreTarget) {
|
|
532
|
+
restoreTarget.focus();
|
|
533
|
+
} else {
|
|
534
|
+
(document.activeElement as HTMLElement | null)?.blur?.();
|
|
535
|
+
}
|
|
536
|
+
|
|
482
537
|
this.mobilePanels.forEach((panel) => {
|
|
483
538
|
this.setMobilePanelState(panel, false);
|
|
484
539
|
});
|
|
@@ -487,10 +542,6 @@ export default class Megamenu {
|
|
|
487
542
|
this.closeAllAccordions();
|
|
488
543
|
this.removeFocusTrap();
|
|
489
544
|
|
|
490
|
-
if (this.isKeyboardUser && this.lastFocusedElement) {
|
|
491
|
-
this.lastFocusedElement.focus();
|
|
492
|
-
}
|
|
493
|
-
|
|
494
545
|
this.activeMobilePanel = null;
|
|
495
546
|
this.activeMobileTarget = null;
|
|
496
547
|
this.lastFocusedElement = null;
|