@orangesk/orange-design-system 2.0.0-beta.19 → 2.0.0-beta.20
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 +346 -19
- package/build/components/Accordion/style.css +1 -1
- package/build/components/Accordion/style.css.map +1 -1
- package/build/components/Alert/style.css +1 -1
- package/build/components/Alert/style.css.map +1 -1
- package/build/components/AnchorNavigation/style.css +1 -1
- package/build/components/AnchorNavigation/style.css.map +1 -1
- package/build/components/BlockAction/style.css +1 -1
- package/build/components/BlockAction/style.css.map +1 -1
- package/build/components/CarouselPromotions/style.css +1 -1
- package/build/components/CarouselPromotions/style.css.map +1 -1
- package/build/components/FeatureAccordion/style.css +1 -1
- package/build/components/FeatureAccordion/style.css.map +1 -1
- package/build/components/Footer/style.css +1 -1
- package/build/components/Footer/style.css.map +1 -1
- package/build/components/Hero/style.css +1 -1
- package/build/components/Hero/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/Modal/style.css +1 -1
- package/build/components/Modal/style.css.map +1 -1
- package/build/components/Progress/style.css +1 -1
- package/build/components/Progress/style.css.map +1 -1
- package/build/components/PromoBanner/style.css +1 -1
- package/build/components/PromoBanner/style.css.map +1 -1
- package/build/components/PromotionCard/style.css +1 -1
- package/build/components/PromotionCard/style.css.map +1 -1
- package/build/components/Tag/style.css +1 -1
- package/build/components/Tag/style.css.map +1 -1
- package/build/components/Tile/style.css +1 -1
- package/build/components/Tile/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 +5 -40
- package/build/components/types/src/components/Alert/Alert.d.ts +0 -2
- package/build/components/types/src/components/AnchorNavigation/AnchorNavigation.d.ts +1 -2
- package/build/components/types/src/components/BlockAction/BlockAction.d.ts +2 -0
- package/build/components/types/src/components/BlockAction/Context.d.ts +2 -0
- package/build/components/types/src/components/Breadcrumbs/Breadcrumbs.d.ts +0 -2
- package/build/components/types/src/components/Button/Button.d.ts +0 -1
- package/build/components/types/src/components/Card/index.d.ts +1 -0
- package/build/components/types/src/components/Carousel/Carousel.d.ts +0 -2
- package/build/components/types/src/components/CarouselHero/CarouselHero.d.ts +0 -1
- package/build/components/types/src/components/CarouselPromotions/CarouselPromotions.d.ts +0 -1
- package/build/components/types/src/components/Controls/Controls.d.ts +0 -1
- package/build/components/types/src/components/Expander/Expander.d.ts +0 -3
- package/build/components/types/src/components/FeatureAccordion/FeatureAccordion.d.ts +0 -2
- package/build/components/types/src/components/Forms/InputStepper/InputStepper.d.ts +0 -1
- package/build/components/types/src/components/Hero/Hero.d.ts +0 -3
- package/build/components/types/src/components/Icon/iconSearchTags.d.ts +167 -166
- package/build/components/types/src/components/Link/Link.d.ts +0 -2
- package/build/components/types/src/components/Megamenu/static.d.ts +2 -3
- package/build/components/types/src/components/Modal/Modal.d.ts +0 -2
- package/build/components/types/src/components/Pagination/Pagination.d.ts +0 -2
- package/build/components/types/src/components/Pill/Pill.d.ts +0 -1
- package/build/components/types/src/components/Progress/Progress.d.ts +0 -1
- package/build/components/types/src/components/PromoBanner/PromoBanner.d.ts +1 -2
- package/build/components/types/src/components/PromotionCard/PromotionCard.d.ts +2 -2
- package/build/components/types/src/components/Stepbar/Stepbar.d.ts +0 -2
- package/build/components/types/src/components/Table/Table.d.ts +0 -2
- package/build/components/types/src/components/Tabs/Tabs.d.ts +0 -2
- package/build/components/types/src/components/Tooltip/Tooltip.d.ts +0 -1
- package/build/components/types/src/scripts/index.d.ts +2 -3
- package/build/components/types/src/styles/export/color.d.ts +102 -20
- package/build/lib/base.css +1 -1
- package/build/lib/base.css.map +1 -1
- package/build/lib/components.css +1 -1
- package/build/lib/components.css.map +1 -1
- package/build/lib/footer.css +1 -1
- package/build/lib/footer.css.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/lib/utilities.css +1 -1
- package/build/lib/utilities.css.map +1 -1
- package/build/sprite.svg +1 -1
- package/package.json +13 -13
- package/src/assets/icons/quote.svg +4 -0
- package/src/components/Accordion/styles/mixins.scss +2 -0
- package/src/components/Alert/Alert.tsx +0 -6
- package/src/components/Alert/styles/mixins.scss +3 -1
- package/src/components/Alert/tests/Alert.test.js +0 -14
- package/src/components/AnchorNavigation/AnchorNavigation.tsx +1 -10
- package/src/components/AnchorNavigation/tests/AnchorNavigation.conformance.test.js +0 -9
- package/src/components/BlockAction/BlockAction.tsx +10 -3
- package/src/components/BlockAction/Context.tsx +4 -0
- package/src/components/BlockAction/styles/mixins.scss +6 -0
- package/src/components/BlockAction/styles/style.scss +5 -0
- package/src/components/Breadcrumbs/BreadcrumbItem.tsx +16 -7
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +4 -12
- package/src/components/Breadcrumbs/tests/BreadcrumbItem.unit.test.js +14 -8
- package/src/components/Breadcrumbs/tests/Breadcrumbs.integration.test.js +14 -37
- package/src/components/Breadcrumbs/tests/Breadcrumbs.unit.test.js +19 -23
- package/src/components/Button/Button.tsx +0 -4
- package/src/components/Button/tests/Button.test.js +0 -10
- package/src/components/Card/index.ts +1 -0
- package/src/components/Carousel/Carousel.static.ts +5 -0
- package/src/components/Carousel/Carousel.tsx +0 -5
- package/src/components/Carousel/tests/Carousel.unit.test.js +0 -21
- package/src/components/CarouselHero/CarouselHero.tsx +1 -9
- package/src/components/CarouselHero/tests/CarouselHero.conformance.test.js +0 -1
- package/src/components/CarouselHero/tests/CarouselHero.unit.test.js +0 -14
- package/src/components/CarouselPromotions/CarouselPromotions.tsx +1 -6
- package/src/components/CarouselPromotions/styles/mixins.scss +6 -3
- package/src/components/CarouselPromotions/tests/CarouselPromotions.unit.test.js +0 -17
- package/src/components/Controls/Controls.tsx +2 -7
- package/src/components/Controls/tests/Controls.test.js +0 -23
- package/src/components/Expander/Expander.tsx +0 -6
- package/src/components/Expander/tests/Expander.conformance.test.js +8 -12
- package/src/components/Expander/tests/Expander.unit.test.js +37 -47
- package/src/components/FeatureAccordion/FeatureAccordion.tsx +2 -12
- package/src/components/FeatureAccordion/styles/mixins.scss +6 -14
- package/src/components/FeatureAccordion/styles/style.scss +2 -4
- package/src/components/FeatureAccordion/tests/FeatureAccordion.unit.test.js +0 -5
- package/src/components/Footer/styles/mixins.scss +1 -0
- package/src/components/Forms/InputStepper/InputStepper.tsx +0 -4
- package/src/components/Forms/Label/styles/config.scss +3 -0
- package/src/components/Hero/Hero.tsx +2 -16
- package/src/components/Hero/styles/style.scss +0 -14
- package/src/components/Hero/tests/Hero.unit.test.js +109 -119
- package/src/components/Icon/iconSearchTags.ts +167 -166
- package/src/components/Link/Link.tsx +0 -5
- package/src/components/Link/tests/Link.conformance.test.js +1 -7
- package/src/components/Link/tests/Link.unit.test.js +0 -20
- package/src/components/Megamenu/static.ts +5 -2
- package/src/components/Modal/Modal.tsx +0 -5
- package/src/components/Modal/styles/mixins.scss +7 -0
- package/src/components/Modal/styles/style.scss +1 -0
- package/src/components/Modal/tests/Modal.unit.test.js +0 -22
- package/src/components/Pagination/Pagination.tsx +1 -11
- package/src/components/Pill/Pill.tsx +0 -4
- package/src/components/Pill/tests/Pill.conformance.test.js +0 -4
- package/src/components/Pill/tests/Pill.unit.test.js +0 -18
- package/src/components/Progress/Progress.tsx +1 -13
- package/src/components/Progress/styles/mixins.scss +9 -7
- package/src/components/PromoBanner/PromoBanner.tsx +1 -10
- package/src/components/PromoBanner/styles/mixins.scss +0 -3
- package/src/components/PromoBanner/tests/PromoBanner.conformance.test.js +0 -30
- package/src/components/PromoBanner/tests/PromoBanner.unit.test.js +1 -33
- package/src/components/PromotionCard/PromotionCard.tsx +4 -6
- package/src/components/PromotionCard/styles/mixins.scss +1 -0
- package/src/components/PromotionCard/tests/PromotionCard.conformance.test.js +18 -19
- package/src/components/PromotionCard/tests/PromotionCard.unit.test.js +12 -74
- package/src/components/Stepbar/Stepbar.tsx +0 -5
- package/src/components/Table/Table.tsx +0 -5
- package/src/components/Table/tests/Table.unit.test.js +0 -31
- package/src/components/Tabs/Tabs.tsx +0 -5
- package/src/components/Tabs/tests/Tabs.unit.test.js +0 -8
- package/src/components/Tag/styles/config.scss +1 -1
- package/src/components/Tag/styles/style.scss +10 -9
- package/src/components/Tile/styles/mixins.scss +1 -0
- package/src/components/Tooltip/Tooltip.tsx +1 -10
- package/src/components/Tooltip/tests/Tooltip.unit.test.js +0 -29
- package/src/styles/base/globals.scss +9 -0
- package/src/styles/base/styleguide.scss +6 -2
- package/src/styles/export/color.js +102 -20
- package/src/styles/export/color.scss +10 -20
- package/src/styles/typography/config.scss +83 -37
- package/src/styles/typography/mixins.scss +3 -3
- package/src/styles/utilities/text.scss +26 -2
- package/src/components/Pagination/tests/utils.js +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orangesk/orange-design-system",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.20",
|
|
4
4
|
"private": false,
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.x"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@cloudfour/transition-hidden-element": "^2.0.2",
|
|
36
36
|
"@mdx-js/loader": "^3.1.1",
|
|
37
37
|
"@mdx-js/react": "^3.1.1",
|
|
38
|
-
"@next/mdx": "16.0.
|
|
38
|
+
"@next/mdx": "16.0.3",
|
|
39
39
|
"@orangesk/accessible-autocomplete": "^3.1.2",
|
|
40
40
|
"@popperjs/core": "^2.11.8",
|
|
41
41
|
"@types/mdx": "^2.0.13",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"daypickr": "^0.3.4",
|
|
45
45
|
"diff2html": "^3.4.52",
|
|
46
46
|
"dompurify": "^3.3.0",
|
|
47
|
-
"html-react-parser": "^5.2.
|
|
47
|
+
"html-react-parser": "^5.2.10",
|
|
48
48
|
"jest-environment-jsdom": "^30.2.0",
|
|
49
49
|
"lorem-ipsum": "^2.0.8",
|
|
50
50
|
"minisearch": "7.2.0",
|
|
51
|
-
"next": "16.0.
|
|
51
|
+
"next": "16.0.3",
|
|
52
52
|
"normalize.css": "^8.0.1",
|
|
53
53
|
"nouislider": "^15.8.1",
|
|
54
54
|
"pretty": "^2.0.0",
|
|
@@ -85,31 +85,31 @@
|
|
|
85
85
|
"@testing-library/jest-dom": "^6.9.1",
|
|
86
86
|
"@testing-library/react": "^16.3.0",
|
|
87
87
|
"@testing-library/user-event": "^14.6.1",
|
|
88
|
-
"@types/node": "^24.10.
|
|
88
|
+
"@types/node": "^24.10.1",
|
|
89
89
|
"@types/pretty": "^2.0.3",
|
|
90
|
-
"@types/react": "19.2.
|
|
91
|
-
"@types/react-dom": "19.2.
|
|
90
|
+
"@types/react": "19.2.6",
|
|
91
|
+
"@types/react-dom": "19.2.3",
|
|
92
92
|
"@types/wnumb": "^1.2.3",
|
|
93
93
|
"babel-jest": "30.2.0",
|
|
94
94
|
"eslint": "latest",
|
|
95
|
-
"eslint-config-next": "16.0.
|
|
95
|
+
"eslint-config-next": "16.0.3",
|
|
96
96
|
"eslint-config-prettier": "^10.1.8",
|
|
97
97
|
"eslint-plugin-unused-imports": "^4.3.0",
|
|
98
98
|
"fs-extra": "^11.3.2",
|
|
99
|
-
"glob": "
|
|
100
|
-
"html-validate": "10.
|
|
99
|
+
"glob": "13.0.0",
|
|
100
|
+
"html-validate": "10.4.0",
|
|
101
101
|
"husky": "^9.1.7",
|
|
102
102
|
"identity-obj-proxy": "^3.0.0",
|
|
103
103
|
"jest": "30.2.0",
|
|
104
104
|
"jest-axe": "10.0.0",
|
|
105
105
|
"jest-snapshot": "^30.2.0",
|
|
106
|
-
"lint-staged": "16.2.
|
|
106
|
+
"lint-staged": "16.2.7",
|
|
107
107
|
"prettier": "^3.6.2",
|
|
108
108
|
"rollup-plugin-copy": "^3.5.0",
|
|
109
109
|
"rollup-plugin-dts": "^6.2.3",
|
|
110
110
|
"rollup-plugin-postcss": "^4.0.2",
|
|
111
|
-
"sass": "^1.
|
|
111
|
+
"sass": "^1.94.2",
|
|
112
112
|
"svg-sprite": "^2.0.4",
|
|
113
|
-
"typescript": "5.9.3"
|
|
113
|
+
"typescript": "^5.9.3"
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="80" height="80" viewBox="0 0 80 80" fill="none"
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="M33.8776 61.8775H15V43C15 39.5986 15.3402 36.424 16.0205 33.4762C16.8141 30.415 17.9479 27.7506 19.4218 25.483C21.0091 23.2154 22.9933 21.4014 25.3742 20.0408C27.7552 18.6803 30.5329 18 33.7075 18V26.5034C31.78 26.5034 30.1928 27.0136 28.9456 28.034C27.6984 28.941 26.678 30.1882 25.8844 31.7755C25.0907 33.3628 24.5238 35.1769 24.1837 37.2177C23.957 39.1451 23.8436 41.0725 23.8436 43H33.8776V61.8775ZM65 61.8775H46.1225V43C46.1225 39.5986 46.4626 36.424 47.1429 33.4762C47.9365 30.415 49.0703 27.7506 50.5442 25.483C52.1315 23.2154 54.1157 21.4014 56.4966 20.0408C58.8776 18.6803 61.6554 18 64.83 18V26.5034C62.9025 26.5034 61.3152 27.0136 60.068 28.034C58.8208 28.941 57.8004 30.1882 57.0068 31.7755C56.2131 33.3628 55.6462 35.1769 55.3061 37.2177C55.0794 39.1451 54.966 41.0725 54.966 43H65V61.8775Z" fill="currentColor"/>
|
|
4
|
+
</svg>
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
margin-bottom: 0;
|
|
46
46
|
width: 100%;
|
|
47
47
|
max-width: none;
|
|
48
|
+
font-weight: 700;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
@mixin header-size($size, $config: config.$spacing) {
|
|
@@ -79,6 +80,7 @@
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
@mixin body {
|
|
83
|
+
margin-top: space.get();
|
|
82
84
|
margin-bottom: space.get("large");
|
|
83
85
|
|
|
84
86
|
p:last-child {
|
|
@@ -27,8 +27,6 @@ interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
27
27
|
/** Type of alert, sets icon and color */
|
|
28
28
|
type?: AlertType;
|
|
29
29
|
className?: string;
|
|
30
|
-
/** Sets Alert to use specific color scheme */
|
|
31
|
-
colorScheme?: "dark" | "light";
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
const CLASS_ROOT = "alert";
|
|
@@ -42,7 +40,6 @@ const Alert: React.FC<AlertProps> = ({
|
|
|
42
40
|
headingLevel = 3,
|
|
43
41
|
actionButtons,
|
|
44
42
|
isFullWidth,
|
|
45
|
-
colorScheme,
|
|
46
43
|
onClose,
|
|
47
44
|
...other
|
|
48
45
|
}) => {
|
|
@@ -52,8 +49,6 @@ const Alert: React.FC<AlertProps> = ({
|
|
|
52
49
|
{
|
|
53
50
|
[`${CLASS_ROOT}--${type}`]: type,
|
|
54
51
|
[`${CLASS_ROOT}--full-width`]: isFullWidth,
|
|
55
|
-
"is-dark": colorScheme === "dark",
|
|
56
|
-
"is-light": colorScheme === "light",
|
|
57
52
|
},
|
|
58
53
|
className,
|
|
59
54
|
);
|
|
@@ -69,7 +64,6 @@ const Alert: React.FC<AlertProps> = ({
|
|
|
69
64
|
headingLevel,
|
|
70
65
|
actionButtons,
|
|
71
66
|
isFullWidth,
|
|
72
|
-
colorScheme,
|
|
73
67
|
onClose,
|
|
74
68
|
...other,
|
|
75
69
|
})) ||
|
|
@@ -86,20 +86,6 @@ describe("rendering", () => {
|
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
describe("palette and theme logic", () => {
|
|
89
|
-
it("should have is-dark class when colorScheme is 'dark'", () => {
|
|
90
|
-
const { getByTestId } = render(
|
|
91
|
-
<Alert data-testid="test" colorScheme="dark" />,
|
|
92
|
-
);
|
|
93
|
-
expect(getByTestId("test")).toHaveClass("is-dark");
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it("should have is-light class when colorScheme is 'light'", () => {
|
|
97
|
-
const { getByTestId } = render(
|
|
98
|
-
<Alert data-testid="test" colorScheme="light" />,
|
|
99
|
-
);
|
|
100
|
-
expect(getByTestId("test")).toHaveClass("is-light");
|
|
101
|
-
});
|
|
102
|
-
|
|
103
89
|
it("should inherit color variables from parent theme", () => {
|
|
104
90
|
const { getByTestId } = render(
|
|
105
91
|
<div className="is-dark">
|
|
@@ -16,7 +16,6 @@ interface AnchorNavigationItem {
|
|
|
16
16
|
interface AnchorNavigationProps {
|
|
17
17
|
items: AnchorNavigationItem[];
|
|
18
18
|
className?: string;
|
|
19
|
-
colorScheme?: "light" | "dark";
|
|
20
19
|
children?: React.ReactNode;
|
|
21
20
|
}
|
|
22
21
|
|
|
@@ -25,18 +24,10 @@ const CLASS_ROOT = "anchor-navigation";
|
|
|
25
24
|
const AnchorNavigation = ({
|
|
26
25
|
items,
|
|
27
26
|
className,
|
|
28
|
-
colorScheme,
|
|
29
27
|
children,
|
|
30
28
|
...other
|
|
31
29
|
}: AnchorNavigationProps) => {
|
|
32
|
-
const classes = cx(
|
|
33
|
-
CLASS_ROOT,
|
|
34
|
-
{
|
|
35
|
-
"is-light": colorScheme === "light",
|
|
36
|
-
"is-dark": colorScheme === "dark",
|
|
37
|
-
},
|
|
38
|
-
className,
|
|
39
|
-
);
|
|
30
|
+
const classes = cx(CLASS_ROOT, className);
|
|
40
31
|
|
|
41
32
|
const [anchorNavRef] = useStatic(AnchorNavigationStatic);
|
|
42
33
|
|
|
@@ -15,17 +15,9 @@ const example = (
|
|
|
15
15
|
{/* Basic usage */}
|
|
16
16
|
<AnchorNavigation items={basicItems} aria-label="Basic navigation" />
|
|
17
17
|
|
|
18
|
-
{/* With color scheme */}
|
|
19
|
-
<AnchorNavigation
|
|
20
|
-
items={basicItems}
|
|
21
|
-
colorScheme="light"
|
|
22
|
-
aria-label="Light navigation"
|
|
23
|
-
/>
|
|
24
|
-
|
|
25
18
|
{/* With additional content */}
|
|
26
19
|
<AnchorNavigation
|
|
27
20
|
items={basicItems}
|
|
28
|
-
colorScheme="dark"
|
|
29
21
|
aria-label="Dark navigation with content"
|
|
30
22
|
>
|
|
31
23
|
<div className="bold">
|
|
@@ -45,7 +37,6 @@ const example = (
|
|
|
45
37
|
{ label: "Examples", href: "#examples" },
|
|
46
38
|
{ label: "Support", href: "#support" },
|
|
47
39
|
]}
|
|
48
|
-
colorScheme="light"
|
|
49
40
|
aria-label="Extended navigation"
|
|
50
41
|
/>
|
|
51
42
|
</div>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { ReactElement } from "react";
|
|
2
|
+
import cx from "classnames";
|
|
2
3
|
|
|
3
4
|
import { CloneElementWithClassName } from "./CloneElementWithClassName";
|
|
4
5
|
import { Provider } from "./Context";
|
|
@@ -7,15 +8,21 @@ export interface BlockActionProps {
|
|
|
7
8
|
/** 1 and only one single element */
|
|
8
9
|
children: ReactElement;
|
|
9
10
|
className?: string;
|
|
11
|
+
/** Add border on hover */
|
|
12
|
+
hasBorderOnHover?: boolean;
|
|
10
13
|
[key: string]: any;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
const BlockAction: React.FC<BlockActionProps> = (props) => {
|
|
17
|
+
const { hasBorderOnHover, className, ...restProps } = props;
|
|
18
|
+
|
|
14
19
|
return (
|
|
15
|
-
<Provider>
|
|
20
|
+
<Provider hasBorderOnHover={hasBorderOnHover}>
|
|
16
21
|
<CloneElementWithClassName
|
|
17
|
-
{...
|
|
18
|
-
className="block-action"
|
|
22
|
+
{...restProps}
|
|
23
|
+
className={cx("block-action", className, {
|
|
24
|
+
"block-action--border-on-hover": hasBorderOnHover,
|
|
25
|
+
})}
|
|
19
26
|
data-block-action
|
|
20
27
|
/>
|
|
21
28
|
</Provider>
|
|
@@ -7,6 +7,7 @@ interface ContextType {
|
|
|
7
7
|
isActive: boolean;
|
|
8
8
|
setIsActive: Dispatch<SetStateAction<boolean>>;
|
|
9
9
|
setIsIndicating: Dispatch<SetStateAction<boolean>>;
|
|
10
|
+
hasBorderOnHover?: boolean;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export const Context = React.createContext<ContextType>({
|
|
@@ -14,10 +15,12 @@ export const Context = React.createContext<ContextType>({
|
|
|
14
15
|
isActive: false,
|
|
15
16
|
setIsActive: () => {},
|
|
16
17
|
setIsIndicating: () => {},
|
|
18
|
+
hasBorderOnHover: undefined,
|
|
17
19
|
});
|
|
18
20
|
|
|
19
21
|
interface ProviderProps {
|
|
20
22
|
children: ReactNode;
|
|
23
|
+
hasBorderOnHover?: boolean;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
export const Provider: React.FC<ProviderProps> = (props) => {
|
|
@@ -31,6 +34,7 @@ export const Provider: React.FC<ProviderProps> = (props) => {
|
|
|
31
34
|
setIsIndicating,
|
|
32
35
|
isActive,
|
|
33
36
|
setIsActive,
|
|
37
|
+
hasBorderOnHover: props.hasBorderOnHover,
|
|
34
38
|
}}
|
|
35
39
|
>
|
|
36
40
|
{props.children}
|
|
@@ -26,22 +26,31 @@ const BreadcrumbItem: React.FC<BreadcrumbItemProps> = ({
|
|
|
26
26
|
}) => {
|
|
27
27
|
const itemClasses = cx(ITEM_CLASS_ROOT, className);
|
|
28
28
|
|
|
29
|
-
//
|
|
29
|
+
// If current page, don't render as anchor even if URL is provided
|
|
30
|
+
if (isCurrent) {
|
|
31
|
+
return (
|
|
32
|
+
<li
|
|
33
|
+
className={itemClasses}
|
|
34
|
+
{...(isCurrent ? { "aria-current": "page" } : {})}
|
|
35
|
+
{...other}
|
|
36
|
+
>
|
|
37
|
+
{text}
|
|
38
|
+
</li>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// If URL provided and not current, render as anchor
|
|
30
43
|
if (url) {
|
|
31
44
|
return (
|
|
32
45
|
<li className={itemClasses}>
|
|
33
|
-
<a
|
|
34
|
-
href={url}
|
|
35
|
-
className={LINK_CLASS_ROOT}
|
|
36
|
-
{...(isCurrent ? { "aria-current": "page" } : {})}
|
|
37
|
-
{...other}
|
|
38
|
-
>
|
|
46
|
+
<a href={url} className={LINK_CLASS_ROOT} {...other}>
|
|
39
47
|
{text}
|
|
40
48
|
</a>
|
|
41
49
|
</li>
|
|
42
50
|
);
|
|
43
51
|
}
|
|
44
52
|
|
|
53
|
+
// No URL, no current status - just text
|
|
45
54
|
return (
|
|
46
55
|
<li className={itemClasses} {...other}>
|
|
47
56
|
{text}
|
|
@@ -12,8 +12,6 @@ interface BreadcrumbItemData {
|
|
|
12
12
|
interface BreadcrumbsProps {
|
|
13
13
|
/** Additional CSS classes */
|
|
14
14
|
className?: string;
|
|
15
|
-
/** Use white breadcrumbs on dark background */
|
|
16
|
-
colorScheme?: "dark" | "light";
|
|
17
15
|
/** Breadcrumb items */
|
|
18
16
|
items: BreadcrumbItemData[];
|
|
19
17
|
/** Navigation label */
|
|
@@ -28,18 +26,12 @@ const Breadcrumbs: React.FC<BreadcrumbsProps> = ({
|
|
|
28
26
|
className,
|
|
29
27
|
label,
|
|
30
28
|
items,
|
|
31
|
-
colorScheme,
|
|
32
29
|
...other
|
|
33
30
|
}) => {
|
|
34
|
-
const classes = cx(CLASS_ROOT, className
|
|
35
|
-
"is-dark": colorScheme === "dark",
|
|
36
|
-
"is-light": colorScheme === "light",
|
|
37
|
-
});
|
|
31
|
+
const classes = cx(CLASS_ROOT, className);
|
|
38
32
|
|
|
39
|
-
//
|
|
40
|
-
const
|
|
41
|
-
const lastAnchorIndex =
|
|
42
|
-
lastUrlIndex === -1 ? -1 : items.length - 1 - lastUrlIndex;
|
|
33
|
+
// Mark the last item as current
|
|
34
|
+
const lastIndex = items.length - 1;
|
|
43
35
|
|
|
44
36
|
return (
|
|
45
37
|
<nav aria-label={label} className={classes} {...other}>
|
|
@@ -48,7 +40,7 @@ const Breadcrumbs: React.FC<BreadcrumbsProps> = ({
|
|
|
48
40
|
<BreadcrumbItem
|
|
49
41
|
{...item}
|
|
50
42
|
key={item.text}
|
|
51
|
-
isCurrent={
|
|
43
|
+
isCurrent={index === lastIndex}
|
|
52
44
|
/>
|
|
53
45
|
))}
|
|
54
46
|
</ol>
|
|
@@ -85,13 +85,13 @@ describe("rendering BreadcrumbItem", () => {
|
|
|
85
85
|
expect(anchor).toHaveAttribute("href", "/test-url");
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
-
it("
|
|
88
|
+
it("li element has aria-current attribute set to 'page' when isCurrent prop is passed", () => {
|
|
89
89
|
const { container } = render(
|
|
90
90
|
<BreadcrumbItem text="test" url="/test" isCurrent />,
|
|
91
91
|
);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
);
|
|
92
|
+
const li = container.querySelector("li");
|
|
93
|
+
expect(li).toHaveAttribute("aria-current", "page");
|
|
94
|
+
expect(li.querySelector("a")).not.toBeInTheDocument();
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
it("does not render anchor when isCurrent is true but no URL provided", () => {
|
|
@@ -192,12 +192,14 @@ describe("rendering BreadcrumbItem", () => {
|
|
|
192
192
|
expect(li).toContainElement(anchor);
|
|
193
193
|
});
|
|
194
194
|
|
|
195
|
-
it("aria-current is only applied when
|
|
195
|
+
it("aria-current is only applied when isCurrent is true", () => {
|
|
196
196
|
const { container } = render(
|
|
197
197
|
<BreadcrumbItem text="test" url="/test" isCurrent />,
|
|
198
198
|
);
|
|
199
|
+
const li = container.querySelector("li");
|
|
199
200
|
const anchor = container.querySelector("a");
|
|
200
|
-
expect(
|
|
201
|
+
expect(li).toHaveAttribute("aria-current", "page");
|
|
202
|
+
expect(anchor).not.toBeInTheDocument();
|
|
201
203
|
});
|
|
202
204
|
|
|
203
205
|
it("aria-current is not applied when isCurrent is false", () => {
|
|
@@ -205,13 +207,17 @@ describe("rendering BreadcrumbItem", () => {
|
|
|
205
207
|
<BreadcrumbItem text="test" url="/test" isCurrent={false} />,
|
|
206
208
|
);
|
|
207
209
|
const anchor = container.querySelector("a");
|
|
208
|
-
|
|
210
|
+
const li = container.querySelector("li");
|
|
211
|
+
expect(anchor).toBeInTheDocument();
|
|
212
|
+
expect(li).not.toHaveAttribute("aria-current");
|
|
209
213
|
});
|
|
210
214
|
|
|
211
|
-
it("aria-current is
|
|
215
|
+
it("aria-current is applied to li when isCurrent is true and no URL is provided", () => {
|
|
212
216
|
const { container } = render(<BreadcrumbItem text="test" isCurrent />);
|
|
213
217
|
const anchor = container.querySelector("a");
|
|
218
|
+
const li = container.querySelector("li");
|
|
214
219
|
expect(anchor).not.toBeInTheDocument();
|
|
220
|
+
expect(li).toHaveAttribute("aria-current", "page");
|
|
215
221
|
});
|
|
216
222
|
});
|
|
217
223
|
|
|
@@ -25,15 +25,12 @@ describe("Breadcrumbs Integration Tests", () => {
|
|
|
25
25
|
const anchors = container.querySelectorAll("a");
|
|
26
26
|
|
|
27
27
|
expect(listItems).toHaveLength(6);
|
|
28
|
-
expect(anchors).toHaveLength(5); // Last item
|
|
28
|
+
expect(anchors).toHaveLength(5); // Last item is not an anchor (current page)
|
|
29
29
|
|
|
30
|
-
// Last
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
);
|
|
35
|
-
// Last item should be plain text
|
|
36
|
-
expect(listItems[listItems.length - 1].querySelector("a")).toBeNull();
|
|
30
|
+
// Last item should have aria-current and be plain text
|
|
31
|
+
const lastItem = listItems[listItems.length - 1];
|
|
32
|
+
expect(lastItem).toHaveAttribute("aria-current", "page");
|
|
33
|
+
expect(lastItem.querySelector("a")).toBeNull();
|
|
37
34
|
});
|
|
38
35
|
|
|
39
36
|
it("handles e-commerce navigation correctly", () => {
|
|
@@ -72,16 +69,11 @@ describe("Breadcrumbs Integration Tests", () => {
|
|
|
72
69
|
];
|
|
73
70
|
|
|
74
71
|
const { container } = render(
|
|
75
|
-
<Breadcrumbs
|
|
76
|
-
items={multilingualNav}
|
|
77
|
-
label="Navigation"
|
|
78
|
-
colorScheme="dark"
|
|
79
|
-
/>,
|
|
72
|
+
<Breadcrumbs items={multilingualNav} label="Navigation" />,
|
|
80
73
|
);
|
|
81
74
|
|
|
82
75
|
const nav = container.querySelector("nav");
|
|
83
76
|
expect(nav).toHaveClass("osk-breadcrumbs");
|
|
84
|
-
expect(nav).toHaveClass("is-dark");
|
|
85
77
|
expect(nav).toHaveAttribute("aria-label", "Navigation");
|
|
86
78
|
|
|
87
79
|
const listItems = container.querySelectorAll("li");
|
|
@@ -105,6 +97,7 @@ describe("Breadcrumbs Integration Tests", () => {
|
|
|
105
97
|
|
|
106
98
|
const nav = container.querySelector("nav");
|
|
107
99
|
const ol = container.querySelector("ol");
|
|
100
|
+
const listItems = container.querySelectorAll("li");
|
|
108
101
|
const anchors = container.querySelectorAll("a");
|
|
109
102
|
|
|
110
103
|
// Check navigation structure
|
|
@@ -113,17 +106,16 @@ describe("Breadcrumbs Integration Tests", () => {
|
|
|
113
106
|
expect(ol).toHaveClass("osk-breadcrumbs__container");
|
|
114
107
|
|
|
115
108
|
// Check anchor accessibility
|
|
116
|
-
anchors.forEach((anchor
|
|
109
|
+
anchors.forEach((anchor) => {
|
|
117
110
|
expect(anchor).toHaveAttribute("href");
|
|
118
111
|
expect(anchor).toHaveClass("osk-breadcrumbs__link");
|
|
119
|
-
|
|
120
|
-
// Last anchor should have aria-current
|
|
121
|
-
if (index === anchors.length - 1) {
|
|
122
|
-
expect(anchor).toHaveAttribute("aria-current", "page");
|
|
123
|
-
} else {
|
|
124
|
-
expect(anchor).not.toHaveAttribute("aria-current");
|
|
125
|
-
}
|
|
112
|
+
expect(anchor).not.toHaveAttribute("aria-current");
|
|
126
113
|
});
|
|
114
|
+
|
|
115
|
+
// Last item should have aria-current on li, not anchor
|
|
116
|
+
const lastItem = listItems[listItems.length - 1];
|
|
117
|
+
expect(lastItem).toHaveAttribute("aria-current", "page");
|
|
118
|
+
expect(lastItem.querySelector("a")).toBeNull();
|
|
127
119
|
});
|
|
128
120
|
|
|
129
121
|
it("provides proper keyboard navigation support", () => {
|
|
@@ -145,21 +137,6 @@ describe("Breadcrumbs Integration Tests", () => {
|
|
|
145
137
|
});
|
|
146
138
|
|
|
147
139
|
describe("styling integration", () => {
|
|
148
|
-
it("applies dark mode styling correctly", () => {
|
|
149
|
-
const items = [
|
|
150
|
-
{ url: "/home", text: "Domov" },
|
|
151
|
-
{ text: "Aktuálna stránka" },
|
|
152
|
-
];
|
|
153
|
-
|
|
154
|
-
const { container } = render(
|
|
155
|
-
<Breadcrumbs items={items} colorScheme="dark" />,
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
const nav = container.querySelector("nav");
|
|
159
|
-
expect(nav).toHaveClass("osk-breadcrumbs");
|
|
160
|
-
expect(nav).toHaveClass("is-dark");
|
|
161
|
-
});
|
|
162
|
-
|
|
163
140
|
it("combines custom classes with default classes", () => {
|
|
164
141
|
const items = [{ text: "Test" }];
|
|
165
142
|
|
|
@@ -73,16 +73,6 @@ describe("rendering Breadcrumbs", () => {
|
|
|
73
73
|
);
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
it('has class osk-breadcrumbs--dark when colorScheme="dark" is passed', () => {
|
|
77
|
-
const { container } = render(
|
|
78
|
-
<Breadcrumbs items={[]} colorScheme="dark" />,
|
|
79
|
-
);
|
|
80
|
-
expect(container.getElementsByClassName("osk-breadcrumbs").length).toBe(
|
|
81
|
-
1,
|
|
82
|
-
);
|
|
83
|
-
expect(container.getElementsByClassName("is-dark").length).toBe(1);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
76
|
it("combines multiple CSS classes correctly", () => {
|
|
87
77
|
const { getByTestId } = render(
|
|
88
78
|
<Breadcrumbs
|
|
@@ -104,12 +94,16 @@ describe("rendering Breadcrumbs", () => {
|
|
|
104
94
|
|
|
105
95
|
itemsArr.map(({ url, text }, index) => {
|
|
106
96
|
it(`renders BreadcrumbItem with text ${text} ${
|
|
107
|
-
url
|
|
97
|
+
url && index !== itemsArr.length - 1
|
|
98
|
+
? "inside anchor element with url " + url
|
|
99
|
+
: ""
|
|
108
100
|
}`, () => {
|
|
109
101
|
const { container } = render(<Breadcrumbs items={itemsArr} />);
|
|
110
102
|
const listElements = container.querySelectorAll("li");
|
|
111
103
|
expect(listElements[index].textContent).toBe(text);
|
|
112
|
-
|
|
104
|
+
|
|
105
|
+
// Only non-last items with URL should have anchors
|
|
106
|
+
if (url && index !== itemsArr.length - 1) {
|
|
113
107
|
expect(listElements[index].children[0].getAttribute("href")).toBe(
|
|
114
108
|
url,
|
|
115
109
|
);
|
|
@@ -117,18 +111,18 @@ describe("rendering Breadcrumbs", () => {
|
|
|
117
111
|
});
|
|
118
112
|
});
|
|
119
113
|
|
|
120
|
-
it("
|
|
114
|
+
it("last item does not render as anchor element", () => {
|
|
121
115
|
const items = [
|
|
122
116
|
{ url: "/test1", text: "test1-text" },
|
|
123
117
|
{ url: "/test2", text: "test2-text" },
|
|
124
118
|
{ url: "/test3", text: "test3-text" },
|
|
125
119
|
];
|
|
126
120
|
const { container } = render(<Breadcrumbs items={items} />);
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
);
|
|
121
|
+
const listItems = container.querySelectorAll("li");
|
|
122
|
+
const lastItem = listItems[listItems.length - 1];
|
|
123
|
+
|
|
124
|
+
expect(lastItem).toHaveAttribute("aria-current", "page");
|
|
125
|
+
expect(lastItem.querySelector("a")).not.toBeInTheDocument();
|
|
132
126
|
});
|
|
133
127
|
|
|
134
128
|
it("marks last item as current page even without URL", () => {
|
|
@@ -167,6 +161,7 @@ describe("rendering Breadcrumbs", () => {
|
|
|
167
161
|
const { container } = render(<Breadcrumbs items={complexItemsArr} />);
|
|
168
162
|
const anchors = container.querySelectorAll("a");
|
|
169
163
|
|
|
164
|
+
// Only non-last items should have anchors (last item is current page, plain text)
|
|
170
165
|
anchors.forEach((anchor) => {
|
|
171
166
|
expect(anchor).toHaveClass("osk-breadcrumbs__link");
|
|
172
167
|
});
|
|
@@ -187,7 +182,7 @@ describe("rendering Breadcrumbs", () => {
|
|
|
187
182
|
expect(nav).toContainElement(ol);
|
|
188
183
|
});
|
|
189
184
|
|
|
190
|
-
it('last item has aria-current="page"
|
|
185
|
+
it('last item has aria-current="page" and is not an anchor', () => {
|
|
191
186
|
const itemsWithLastUrl = [
|
|
192
187
|
{ url: "/home", text: "Domov" },
|
|
193
188
|
{ url: "/current", text: "Aktuálna stránka" },
|
|
@@ -196,9 +191,9 @@ describe("rendering Breadcrumbs", () => {
|
|
|
196
191
|
const { container } = render(<Breadcrumbs items={itemsWithLastUrl} />);
|
|
197
192
|
const listElements = container.querySelectorAll("li");
|
|
198
193
|
const lastItem = listElements[listElements.length - 1];
|
|
199
|
-
const lastAnchor = lastItem.querySelector("a");
|
|
200
194
|
|
|
201
|
-
expect(
|
|
195
|
+
expect(lastItem).toHaveAttribute("aria-current", "page");
|
|
196
|
+
expect(lastItem.querySelector("a")).not.toBeInTheDocument();
|
|
202
197
|
});
|
|
203
198
|
|
|
204
199
|
it("last item without URL is still marked as current", () => {
|
|
@@ -229,8 +224,9 @@ describe("rendering Breadcrumbs", () => {
|
|
|
229
224
|
const anchor = container.querySelector("a");
|
|
230
225
|
|
|
231
226
|
expect(listItems).toHaveLength(1);
|
|
232
|
-
|
|
233
|
-
expect(anchor).
|
|
227
|
+
// Single item is the last (current) item, so no anchor
|
|
228
|
+
expect(anchor).not.toBeInTheDocument();
|
|
229
|
+
expect(listItems[0]).toHaveAttribute("aria-current", "page");
|
|
234
230
|
});
|
|
235
231
|
|
|
236
232
|
it("handles items with special characters in text", () => {
|
|
@@ -10,7 +10,6 @@ interface CommonProps {
|
|
|
10
10
|
isActive?: boolean;
|
|
11
11
|
isDefault?: boolean;
|
|
12
12
|
isDisabled?: boolean;
|
|
13
|
-
colorScheme?: "dark" | "light";
|
|
14
13
|
isSquare?: boolean;
|
|
15
14
|
size?: ButtonSize;
|
|
16
15
|
type?: ButtonType;
|
|
@@ -47,7 +46,6 @@ const Button = React.forwardRef<any, ButtonProps>((props, ref) => {
|
|
|
47
46
|
href,
|
|
48
47
|
isActive,
|
|
49
48
|
isDisabled,
|
|
50
|
-
colorScheme,
|
|
51
49
|
size,
|
|
52
50
|
isSquare,
|
|
53
51
|
type,
|
|
@@ -62,8 +60,6 @@ const Button = React.forwardRef<any, ButtonProps>((props, ref) => {
|
|
|
62
60
|
[`${CLASS_ROOT}--${size}`]: size,
|
|
63
61
|
[`${CLASS_ROOT}--${type}`]: type,
|
|
64
62
|
[`${CLASS_ROOT}--preserve-width`]: props.preserveWidth,
|
|
65
|
-
"is-dark": colorScheme === "dark",
|
|
66
|
-
"is-light": colorScheme === "light",
|
|
67
63
|
"is-active": isActive,
|
|
68
64
|
},
|
|
69
65
|
className,
|