@orangesk/orange-design-system 3.2.0 → 3.3.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.
Files changed (118) hide show
  1. package/build/components/Avatar/style.css +2 -0
  2. package/build/components/Avatar/style.css.map +1 -0
  3. package/build/components/Carousel/style.css +1 -1
  4. package/build/components/Carousel/style.css.map +1 -1
  5. package/build/components/Countdown/style.css +2 -0
  6. package/build/components/Countdown/style.css.map +1 -0
  7. package/build/components/DocumentationSidebar/style.css +1 -1
  8. package/build/components/DocumentationSidebar/style.css.map +1 -1
  9. package/build/components/Footer/style.css +1 -1
  10. package/build/components/Footer/style.css.map +1 -1
  11. package/build/components/Megamenu/style.css +1 -1
  12. package/build/components/Megamenu/style.css.map +1 -1
  13. package/build/components/Pill/style.css +1 -1
  14. package/build/components/Pill/style.css.map +1 -1
  15. package/build/components/Preview/style.css +1 -1
  16. package/build/components/Preview/style.css.map +1 -1
  17. package/build/components/StarRating/style.css +2 -0
  18. package/build/components/StarRating/style.css.map +1 -0
  19. package/build/components/index.js +1 -1
  20. package/build/components/index.js.map +1 -1
  21. package/build/components/tsconfig.tsbuildinfo +1 -1
  22. package/build/components/types/index.d.ts +50 -12
  23. package/build/components/types/src/components/Avatar/Avatar.d.ts +7 -0
  24. package/build/components/types/src/components/Avatar/index.d.ts +2 -0
  25. package/build/components/types/src/components/Carousel/constants.d.ts +2 -0
  26. package/build/components/types/src/components/Countdown/Countdown.d.ts +10 -0
  27. package/build/components/types/src/components/Countdown/Countdown.react.d.ts +8 -0
  28. package/build/components/types/src/components/Countdown/Countdown.shared.d.ts +54 -0
  29. package/build/components/types/src/components/Countdown/Countdown.static.d.ts +21 -0
  30. package/build/components/types/src/components/Countdown/CountdownTag.d.ts +9 -0
  31. package/build/components/types/src/components/Countdown/CountdownTag.static.d.ts +16 -0
  32. package/build/components/types/src/components/Countdown/constants.d.ts +28 -0
  33. package/build/components/types/src/components/Countdown/index.d.ts +3 -0
  34. package/build/components/types/src/components/DocumentationSidebar/DocumentationSidebar.d.ts +1 -0
  35. package/build/components/types/src/components/Preview/PreviewGenerator.d.ts +1 -0
  36. package/build/components/types/src/components/PromoBanner/PromoBanner.d.ts +5 -1
  37. package/build/components/types/src/components/StarRating/StarRating.d.ts +9 -0
  38. package/build/components/types/src/components/StarRating/index.d.ts +1 -0
  39. package/build/components/types/src/components/index.d.ts +4 -2
  40. package/build/components/types/src/scripts/index.d.ts +10 -0
  41. package/build/components/types/src/styles/export/color.d.ts +2 -0
  42. package/build/lib/base.css +1 -1
  43. package/build/lib/base.css.map +1 -1
  44. package/build/lib/components.css +1 -1
  45. package/build/lib/components.css.map +1 -1
  46. package/build/lib/footer.css +1 -1
  47. package/build/lib/footer.css.map +1 -1
  48. package/build/lib/megamenu.css +1 -1
  49. package/build/lib/megamenu.css.map +1 -1
  50. package/build/lib/scripts.js +1 -1
  51. package/build/lib/scripts.js.map +1 -1
  52. package/build/lib/style.css +1 -1
  53. package/build/lib/style.css.map +1 -1
  54. package/build/lib/tsconfig.tsbuildinfo +1 -1
  55. package/build/lib/utilities.css +1 -1
  56. package/build/lib/utilities.css.map +1 -1
  57. package/build/sprite.svg +1 -1
  58. package/package.json +29 -28
  59. package/src/assets/icons/quote.svg +1 -1
  60. package/src/assets/icons/star-empty-thin.svg +4 -0
  61. package/src/components/Avatar/Avatar.tsx +36 -0
  62. package/src/components/Avatar/index.ts +2 -0
  63. package/src/components/Avatar/styles/config.scss +11 -0
  64. package/src/components/Avatar/styles/mixins.scss +53 -0
  65. package/src/components/Avatar/styles/style.scss +20 -0
  66. package/src/components/Avatar/tests/Avatar.conformance.test.jsx +23 -0
  67. package/src/components/Avatar/tests/Avatar.unit.test.jsx +45 -0
  68. package/src/components/Carousel/Carousel.static.ts +17 -3
  69. package/src/components/Carousel/Carousel.tsx +28 -24
  70. package/src/components/Carousel/constants.ts +2 -0
  71. package/src/components/Carousel/styles/config.scss +5 -8
  72. package/src/components/Carousel/styles/mixins.scss +48 -78
  73. package/src/components/Carousel/styles/style.scss +8 -21
  74. package/src/components/Carousel/tests/Carousel.unit.test.jsx +48 -5
  75. package/src/components/Countdown/Countdown.react.ts +67 -0
  76. package/src/components/Countdown/Countdown.shared.ts +228 -0
  77. package/src/components/Countdown/Countdown.static.ts +201 -0
  78. package/src/components/Countdown/Countdown.tsx +105 -0
  79. package/src/components/Countdown/CountdownTag.static.ts +140 -0
  80. package/src/components/Countdown/CountdownTag.tsx +99 -0
  81. package/src/components/Countdown/constants.ts +36 -0
  82. package/src/components/Countdown/index.ts +3 -0
  83. package/src/components/Countdown/styles/config.scss +17 -0
  84. package/src/components/Countdown/styles/mixins.scss +193 -0
  85. package/src/components/Countdown/styles/style.scss +82 -0
  86. package/src/components/{Testimonial/tests/Testimonial.conformance.test.jsx → Countdown/tests/Countdown.conformance.test.jsx} +7 -2
  87. package/src/components/Countdown/tests/Countdown.static.test.jsx +117 -0
  88. package/src/components/Countdown/tests/Countdown.unit.test.jsx +101 -0
  89. package/src/components/Countdown/tests/CountdownTag.conformance.test.jsx +21 -0
  90. package/src/components/Countdown/tests/CountdownTag.static.test.jsx +30 -0
  91. package/src/components/Countdown/tests/CountdownTag.unit.test.jsx +67 -0
  92. package/src/components/DocumentationSidebar/DocumentationSidebar.tsx +14 -1
  93. package/src/components/DocumentationSidebar/styles/style.scss +11 -0
  94. package/src/components/Forms/Autocomplete/Autocomplete.static.ts +14 -1
  95. package/src/components/Pill/styles/style.scss +2 -1
  96. package/src/components/Preview/PreviewGenerator.tsx +137 -103
  97. package/src/components/Preview/styles/style.scss +15 -9
  98. package/src/components/PromoBanner/PromoBanner.tsx +24 -7
  99. package/src/components/PromoBanner/tests/PromoBanner.unit.test.jsx +31 -0
  100. package/src/components/StarRating/StarRating.tsx +52 -0
  101. package/src/components/StarRating/index.ts +1 -0
  102. package/src/components/StarRating/styles/style.scss +28 -0
  103. package/src/components/StarRating/tests/StarRating.unit.test.jsx +62 -0
  104. package/src/components/index.ts +7 -2
  105. package/src/styles/export/color.js +2 -0
  106. package/src/styles/tokens/color.scss +2 -0
  107. package/src/styles/utilities/text.scss +6 -0
  108. package/build/components/Testimonial/style.css +0 -2
  109. package/build/components/Testimonial/style.css.map +0 -1
  110. package/build/components/types/src/components/Testimonial/Testimonial.d.ts +0 -10
  111. package/build/components/types/src/components/Testimonial/index.d.ts +0 -1
  112. package/build/search-index.json +0 -430
  113. package/src/components/Testimonial/Testimonial.tsx +0 -38
  114. package/src/components/Testimonial/index.ts +0 -1
  115. package/src/components/Testimonial/styles/config.scss +0 -42
  116. package/src/components/Testimonial/styles/mixins.scss +0 -44
  117. package/src/components/Testimonial/styles/style.scss +0 -16
  118. package/src/components/Testimonial/tests/Testimonial.unit.test.jsx +0 -43
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangesk/orange-design-system",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "private": false,
5
5
  "engines": {
6
6
  "node": ">=20.x"
@@ -24,9 +24,10 @@
24
24
  "./public/*": "./public/*"
25
25
  },
26
26
  "scripts": {
27
- "dev": "npm run build:scss-exports && npm run build:search-index && next dev",
28
- "build": "npm run build:scss-exports && npm run build:search-index && next build && npm run sprite",
27
+ "dev": "npm run build:scss-exports && npm run build:search-index && npm run build:preview-iframe && next dev",
28
+ "build": "npm run build:scss-exports && npm run build:search-index && npm run build:preview-iframe && next build && npm run sprite",
29
29
  "build:bundle": "npm run build:scss-exports && pnpm exec rollup -c && npm run build:megamenu && npm run build:footer",
30
+ "build:preview-iframe": "node scripts/build-preview-iframe-bundle.mjs",
30
31
  "build:megamenu": "npm run build:scss-exports && pnpm exec rollup -c rollup.megamenu.config.mjs",
31
32
  "dev:megamenu": "npm run build:scss-exports && pnpm exec rollup -c rollup.megamenu.config.mjs --watch",
32
33
  "build:footer": "npm run build:scss-exports && pnpm exec rollup -c rollup.footer.config.mjs",
@@ -55,7 +56,7 @@
55
56
  "@cloudfour/transition-hidden-element": "^2.0.2",
56
57
  "@mdx-js/loader": "^3.1.1",
57
58
  "@mdx-js/react": "^3.1.1",
58
- "@next/mdx": "16.2.10",
59
+ "@next/mdx": "16.2.12",
59
60
  "@orangesk/accessible-autocomplete": "3.2.2",
60
61
  "@popperjs/core": "^2.11.8",
61
62
  "@types/mdx": "^2.0.14",
@@ -63,24 +64,24 @@
63
64
  "classnames": "^2.5.1",
64
65
  "daypickr": "^0.3.4",
65
66
  "diff2html": "^3.4.56",
66
- "dompurify": "^3.4.11",
67
- "html-react-parser": "6.1.3",
67
+ "dompurify": "^3.4.12",
68
+ "html-react-parser": "6.1.5",
68
69
  "lorem-ipsum": "3.0.0",
69
70
  "minisearch": "7.2.0",
70
- "next": "16.2.10",
71
+ "next": "16.2.12",
71
72
  "normalize.css": "^8.0.1",
72
73
  "nouislider": "^15.8.1",
73
74
  "prism-react-renderer": "^2.4.1",
74
75
  "query-string": "^9.4.1",
75
- "react": "^19.2.7",
76
- "react-dom": "^19.2.7",
76
+ "react": "^19.2.8",
77
+ "react-dom": "^19.2.8",
77
78
  "react-element-to-jsx-string": "^17.0.1",
78
- "react-is": "^19.2.7",
79
+ "react-is": "^19.2.8",
79
80
  "rehype-autolink-headings": "^7.1.0",
80
81
  "rehype-slug": "^6.0.0",
81
82
  "remark-gemoji": "^8.0.0",
82
83
  "remark-gfm": "^4.0.1",
83
- "swiper": "14.0.1",
84
+ "swiper": "14.0.7",
84
85
  "tabbable": "^6.5.0",
85
86
  "unescape-html": "^1.1.0",
86
87
  "wnumb": "^1.2.0"
@@ -99,38 +100,38 @@
99
100
  "@rollup/plugin-terser": "1.0.0",
100
101
  "@rollup/plugin-typescript": "^12.3.0",
101
102
  "@rollup/plugin-url": "^8.0.2",
102
- "@rollup/rollup-darwin-arm64": "^4.62.2",
103
+ "@rollup/rollup-darwin-arm64": "^4.62.3",
103
104
  "@testing-library/dom": "^10.4.1",
104
- "@testing-library/jest-dom": "^6.9.1",
105
+ "@testing-library/jest-dom": "7.0.0",
105
106
  "@testing-library/react": "^16.3.2",
106
107
  "@testing-library/user-event": "^14.6.1",
107
- "@types/node": "26.0.1",
108
+ "@types/node": "26.1.2",
108
109
  "@types/react": "19.2.17",
109
110
  "@types/react-dom": "19.2.3",
110
111
  "@types/wnumb": "^1.2.3",
111
- "@vitejs/plugin-react": "6.0.3",
112
- "@vitest/browser": "^4.1.9",
113
- "@vitest/browser-playwright": "^4.1.9",
114
- "@vitest/coverage-v8": "^4.1.9",
115
- "@vitest/ui": "^4.1.9",
112
+ "@vitejs/plugin-react": "6.0.4",
113
+ "@vitest/browser": "^4.1.10",
114
+ "@vitest/browser-playwright": "^4.1.10",
115
+ "@vitest/coverage-v8": "^4.1.10",
116
+ "@vitest/ui": "^4.1.10",
116
117
  "canvas": "^3.2.3",
117
- "fs-extra": "^11.3.6",
118
+ "fs-extra": "^11.4.0",
118
119
  "glob": "13.0.6",
119
- "html-validate": "11.5.4",
120
+ "html-validate": "11.6.0",
120
121
  "husky": "^9.1.7",
121
122
  "identity-obj-proxy": "^3.0.0",
122
- "jsdom": "29.1.1",
123
- "lint-staged": "17.0.8",
124
- "playwright": "^1.61.1",
125
- "prettier": "^3.9.4",
126
- "rollup": "^4.62.2",
123
+ "jsdom": "30.0.1",
124
+ "lint-staged": "17.2.0",
125
+ "playwright": "^1.62.0",
126
+ "prettier": "^3.9.6",
127
+ "rollup": "^4.62.3",
127
128
  "rollup-plugin-copy": "^3.5.0",
128
129
  "rollup-plugin-dts": "^6.4.1",
129
130
  "rollup-plugin-postcss": "^4.0.2",
130
- "sass": "^1.101.0",
131
+ "sass": "^1.102.0",
131
132
  "svg-sprite": "^2.0.4",
132
133
  "typescript": "6.0.3",
133
- "vitest": "^4.1.9",
134
+ "vitest": "^4.1.10",
134
135
  "vitest-axe": "^0.1.0",
135
136
  "vitest-browser-react": "^2.2.0"
136
137
  },
@@ -1,4 +1,4 @@
1
1
  <svg width="80" height="80" viewBox="0 0 80 80" fill="none"
2
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"/>
3
+ <path d="M31.8256 67.9366H8.3335V44.4446C8.3335 40.2118 8.75685 36.2612 9.60341 32.5927C10.5911 28.7832 12.002 25.4675 13.8362 22.6457C15.8115 19.8238 18.2807 17.5663 21.2436 15.8732C24.2066 14.1801 27.6633 13.3335 31.6139 13.3335V23.9155C29.2153 23.9155 27.24 24.5504 25.688 25.8203C24.136 26.949 22.8662 28.501 21.8785 30.4763C20.8909 32.4517 20.1854 34.7091 19.7621 37.2488C19.4799 39.6474 19.3388 42.046 19.3388 44.4446H31.8256V67.9366ZM70.5557 67.9366H47.0637V44.4446C47.0637 40.2118 47.4869 36.2612 48.3335 32.5927C49.3212 28.7832 50.7321 25.4675 52.5663 22.6457C54.5416 19.8238 57.0108 17.5663 59.9737 15.8732C62.9367 14.1801 66.3935 13.3335 70.3441 13.3335V23.9155C67.9455 23.9155 65.9701 24.5504 64.4181 25.8203C62.8661 26.949 61.5963 28.501 60.6086 30.4763C59.621 32.4517 58.9155 34.7091 58.4922 37.2488C58.21 39.6474 58.0689 42.046 58.0689 44.4446H70.5557V67.9366Z" fill="currentColor"/>
4
4
  </svg>
@@ -0,0 +1,4 @@
1
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none"
2
+ xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M19.5175 11.5451L19.6298 11.7785L19.8857 11.8215L28.454 13.2482L22.0361 18.9543L21.8095 19.1555L21.8827 19.4494L24.0058 27.9426L16.2079 23.6887L15.9677 23.5588L15.7284 23.6887L7.92961 27.9426L10.0536 19.4494L10.1269 19.1555L9.90031 18.9543L3.48137 13.2482L12.0507 11.8215L12.3066 11.7785L12.4189 11.5451L15.9677 4.16132L19.5175 11.5451Z" stroke="currentColor"/>
4
+ </svg>
@@ -0,0 +1,36 @@
1
+ import cx from "classnames";
2
+ import React, { HTMLAttributes } from "react";
3
+
4
+ import { Icon } from "../Icon";
5
+
6
+ const CLASS_ROOT = "avatar";
7
+
8
+ export interface AvatarProps extends HTMLAttributes<HTMLDivElement> {
9
+ alt?: string;
10
+ iconName?: string;
11
+ src: string;
12
+ }
13
+
14
+ export const Avatar: React.FC<AvatarProps> = ({
15
+ alt = "",
16
+ className,
17
+ iconName,
18
+ src,
19
+ ...other
20
+ }) => {
21
+ const hasDecoration = Boolean(iconName);
22
+ const classes = cx(CLASS_ROOT, className);
23
+
24
+ return (
25
+ <div className={classes} {...other}>
26
+ {hasDecoration && (
27
+ <span className={`${CLASS_ROOT}__icon`} aria-hidden="true">
28
+ <Icon name={iconName!} size="small" />
29
+ </span>
30
+ )}
31
+ <img className={`${CLASS_ROOT}__image`} src={src} alt={alt} />
32
+ </div>
33
+ );
34
+ };
35
+
36
+ Avatar.displayName = "Avatar";
@@ -0,0 +1,2 @@
1
+ export type { AvatarProps } from "./Avatar";
2
+ export { Avatar } from "./Avatar";
@@ -0,0 +1,11 @@
1
+ @use "sass:math";
2
+ @use "../../../styles/tools/convert";
3
+
4
+ $avatar-size: convert.to-rem(64px);
5
+ $badge-size: convert.to-rem(24px);
6
+ $badge-offset: convert.to-rem(4px);
7
+ $badge-top: -$badge-offset;
8
+ $badge-right: -$badge-offset;
9
+ $badge-anchor-x: math.div($badge-size, 2) - $badge-offset;
10
+ $badge-anchor-y: math.div($badge-size, 2) - $badge-offset;
11
+ $badge-cutout-radius: convert.to-rem(12px);
@@ -0,0 +1,53 @@
1
+ @use "./config";
2
+
3
+ @mixin base {
4
+ position: relative;
5
+ display: inline-flex;
6
+ width: config.$avatar-size;
7
+ height: config.$avatar-size;
8
+ flex-shrink: 0;
9
+ vertical-align: top;
10
+ border-radius: 50%;
11
+ }
12
+
13
+ @mixin image {
14
+ display: block;
15
+ width: 100%;
16
+ height: 100%;
17
+ border-radius: 50%;
18
+ object-fit: cover;
19
+ object-position: center;
20
+ }
21
+
22
+ @mixin image-with-decoration {
23
+ -webkit-mask-image: radial-gradient(
24
+ circle at calc(100% - #{config.$badge-anchor-x}) #{config.$badge-anchor-y},
25
+ transparent #{config.$badge-cutout-radius},
26
+ black calc(#{config.$badge-cutout-radius} + 1px)
27
+ );
28
+ mask-image: radial-gradient(
29
+ circle at calc(100% - #{config.$badge-anchor-x}) #{config.$badge-anchor-y},
30
+ transparent #{config.$badge-cutout-radius},
31
+ black calc(#{config.$badge-cutout-radius} + 1px)
32
+ );
33
+ }
34
+
35
+ @mixin icon {
36
+ display: inline-flex;
37
+ align-items: center;
38
+ justify-content: center;
39
+ width: config.$badge-size;
40
+ height: config.$badge-size;
41
+ background-color: transparent;
42
+ color: var(--color-icon-default);
43
+ line-height: 1;
44
+ }
45
+
46
+ @mixin badge {
47
+ position: absolute;
48
+ top: config.$badge-top;
49
+ right: config.$badge-right;
50
+ z-index: 1;
51
+ width: config.$badge-size;
52
+ height: config.$badge-size;
53
+ }
@@ -0,0 +1,20 @@
1
+ @use "./mixins";
2
+
3
+ @layer components {
4
+ .avatar {
5
+ @include mixins.base;
6
+
7
+ &__image {
8
+ @include mixins.image;
9
+ }
10
+
11
+ &__icon {
12
+ @include mixins.icon;
13
+ @include mixins.badge;
14
+ }
15
+
16
+ &__icon ~ &__image {
17
+ @include mixins.image-with-decoration;
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,23 @@
1
+ import { render } from "@testing-library/react";
2
+ import { axe } from "vitest-axe";
3
+
4
+ import { Avatar } from "../";
5
+
6
+ const example = (
7
+ <Avatar
8
+ className="surface-secondary"
9
+ src="/avatar.png"
10
+ alt="Person avatar"
11
+ iconName="quote"
12
+ />
13
+ );
14
+
15
+ it("is valid html", () => {
16
+ const { container } = render(example);
17
+ expect(container).toHTMLValidate();
18
+ });
19
+
20
+ it("is accessible", async () => {
21
+ const { container } = render(example);
22
+ expect(await axe(container)).toHaveNoViolations();
23
+ });
@@ -0,0 +1,45 @@
1
+ import { render } from "@testing-library/react";
2
+
3
+ import { Avatar } from "../Avatar";
4
+
5
+ describe("rendering Avatar", () => {
6
+ it("has default avatar class", () => {
7
+ const { getByTestId } = render(
8
+ <Avatar src="/avatar.png" alt="Person avatar" data-testid="test-id" />,
9
+ );
10
+ expect(getByTestId("test-id")).toHaveClass("avatar");
11
+ });
12
+
13
+ it("renders image when src is set", () => {
14
+ const { getByAltText } = render(
15
+ <Avatar src="/avatar.png" alt="Person avatar" />,
16
+ );
17
+ expect(getByAltText("Person avatar")).toHaveAttribute("src", "/avatar.png");
18
+ });
19
+
20
+ it("does not render decoration by default", () => {
21
+ const { container } = render(
22
+ <Avatar src="/avatar.png" alt="Person avatar" />,
23
+ );
24
+ expect(container.getElementsByClassName("avatar__icon").length).toBe(0);
25
+ });
26
+
27
+ it("renders decoration when image and iconName are set", () => {
28
+ const { container } = render(
29
+ <Avatar src="/avatar.png" alt="Person avatar" iconName="quote" />,
30
+ );
31
+ expect(container.getElementsByClassName("avatar__icon").length).toBe(1);
32
+ });
33
+
34
+ it("passes custom classes through", () => {
35
+ const { getByTestId } = render(
36
+ <Avatar
37
+ src="/avatar.png"
38
+ alt="Person avatar"
39
+ data-testid="test-id"
40
+ className="surface-secondary"
41
+ />,
42
+ );
43
+ expect(getByTestId("test-id")).toHaveClass("surface-secondary");
44
+ });
45
+ });
@@ -177,6 +177,19 @@ export default class Carousel {
177
177
  }
178
178
 
179
179
  constructor(element: HTMLElement, config?: Partial<SwiperOptions>) {
180
+ const scrollbarEl = element.querySelector(
181
+ SELECTOR_SCROLLBAR,
182
+ ) as HTMLElement | null;
183
+ const configScrollbar =
184
+ typeof config?.scrollbar === "object" && config.scrollbar !== null
185
+ ? config.scrollbar
186
+ : undefined;
187
+ const defaultScrollbar =
188
+ typeof defaultConfig.scrollbar === "object" &&
189
+ defaultConfig.scrollbar !== null
190
+ ? defaultConfig.scrollbar
191
+ : undefined;
192
+
180
193
  this.element = element;
181
194
  this.config = {
182
195
  ...defaultConfig,
@@ -184,9 +197,10 @@ export default class Carousel {
184
197
  scrollbar: {
185
198
  ...((defaultConfig.scrollbar ?? {}) as object),
186
199
  ...((config?.scrollbar ?? {}) as object),
187
- el: this.element.querySelector(
188
- SELECTOR_SCROLLBAR,
189
- ) as HTMLElement | null,
200
+ el: scrollbarEl,
201
+ enabled: scrollbarEl
202
+ ? (configScrollbar?.enabled ?? defaultScrollbar?.enabled)
203
+ : false,
190
204
  },
191
205
  };
192
206
 
@@ -3,11 +3,13 @@
3
3
  import cx from "classnames";
4
4
  import React, { HTMLAttributes, ReactElement, ReactNode } from "react";
5
5
  import { useStatic } from "@/utils/hooks";
6
- import { Icon } from "../Icon";
6
+ import { Controls } from "../Controls";
7
7
  import CarouselStatic from "./Carousel.static";
8
8
  import { CarouselItem } from "./CarouselItem";
9
9
  import {
10
+ CLASS_CONTROLS,
10
11
  CLASS_DOTS,
12
+ CLASS_NAVIGATION,
11
13
  CLASS_NEXT,
12
14
  CLASS_PREV,
13
15
  CLASS_ROOT,
@@ -72,9 +74,11 @@ const Carousel = <T,>({
72
74
  });
73
75
 
74
76
  const elementClasses = {
77
+ navigation: cx(CLASS_NAVIGATION),
78
+ controls: cx(CLASS_CONTROLS),
75
79
  prev: cx(CLASS_PREV),
76
80
  next: cx(CLASS_NEXT),
77
- dots: cx(CLASS_DOTS, showScrollbar ? "hide" : "show-md"),
81
+ dots: cx(CLASS_DOTS),
78
82
  };
79
83
 
80
84
  const customSwiperOptions = showScrollbar
@@ -100,31 +104,31 @@ const Carousel = <T,>({
100
104
  <div className={CLASS_VIEWPORT}>
101
105
  <div className={CLASS_TRACK}>{carouselItems}</div>
102
106
  </div>
103
- {showScrollbar ? null : (
104
- <>
105
- <button
106
- type="button"
107
- aria-label="Naspäť"
108
- className={elementClasses.prev}
109
- >
110
- <Icon size="medium" name="chevron-left" />
111
- </button>
112
- <button
113
- type="button"
114
- aria-label="Ďalej"
115
- className={elementClasses.next}
116
- >
117
- <Icon size="medium" name="chevron-right" />
118
- </button>
119
- </>
120
- )}
121
107
  </div>
122
108
 
123
- {!showScrollbar && <div role="tablist" className={elementClasses.dots} />}
109
+ {!showScrollbar && (
110
+ <div className={elementClasses.navigation}>
111
+ <div role="tablist" className={elementClasses.dots} />
112
+ <div className={elementClasses.controls}>
113
+ <Controls
114
+ className={elementClasses.prev}
115
+ icon="chevron-left"
116
+ aria-label="Naspäť"
117
+ />
118
+ <Controls
119
+ className={elementClasses.next}
120
+ icon="chevron-right"
121
+ aria-label="Ďalej"
122
+ />
123
+ </div>
124
+ </div>
125
+ )}
124
126
 
125
- <div className={cx(CLASS_SCROLLBAR, !showScrollbar && "hide-md")}>
126
- <div className={CLASS_SCROLLBAR_DRAG} />
127
- </div>
127
+ {showScrollbar && (
128
+ <div className={CLASS_SCROLLBAR}>
129
+ <div className={CLASS_SCROLLBAR_DRAG} />
130
+ </div>
131
+ )}
128
132
  </div>
129
133
  );
130
134
  };
@@ -9,6 +9,8 @@ export const CLASS_SLIDE_PREV = `${CLASS_ROOT}__slide-prev`;
9
9
  export const CLASS_PREV = `${CLASS_ROOT}__prev`;
10
10
  export const CLASS_NEXT = `${CLASS_ROOT}__next`;
11
11
  export const CLASS_DOTS = `${CLASS_ROOT}__pagination`;
12
+ export const CLASS_NAVIGATION = `${CLASS_ROOT}__navigation`;
13
+ export const CLASS_CONTROLS = `${CLASS_ROOT}__controls`;
12
14
  export const CLASS_DOT = `${CLASS_ROOT}__pagination-item`;
13
15
  export const CLASS_SCROLLBAR = `${CLASS_ROOT}__scrollbar`;
14
16
  export const CLASS_SCROLLBAR_HORIZONTAL = `${CLASS_ROOT}__scrollbar-horizontal`;
@@ -6,11 +6,13 @@
6
6
  $space: space.get();
7
7
 
8
8
  $dot-layout: (
9
- width: space.get("medium"),
10
- height: space.get("medium"),
11
- margin: space.get("small"),
9
+ width: convert.to-rem(10px),
10
+ height: convert.to-rem(10px),
11
+ margin: convert.to-rem(8px),
12
12
  );
13
13
 
14
+ $navigation-gap: convert.to-rem(16px);
15
+
14
16
  $dot: (
15
17
  default: var(--color-icon-default),
16
18
  hover: var(--color-icon-brand),
@@ -23,8 +25,3 @@ $breakout-buttons-breakpoints: (
23
25
  (1340px, 1379px),
24
26
  (1460px)
25
27
  );
26
-
27
- $viewport-horizontal-spacing: (
28
- // button dimension + space - slide padding,
29
- "md": convert.to-rem(50px)
30
- );