@orangesk/orange-design-system 2.0.0-beta.11 → 2.0.0-beta.13
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/build/components/index.js +4 -4
- package/build/components/index.js.map +1 -1
- package/build/components/tsconfig.tsbuildinfo +1 -1
- package/build/components/types/index.d.ts +14 -8
- package/build/components/types/src/components/Carousel/Carousel.static.d.ts +34 -1
- package/build/components/types/src/components/Cover/Cover.d.ts +3 -3
- package/build/components/types/src/components/Modal/Modal.d.ts +0 -2
- package/build/components/types/src/components/Modal/index.d.ts +0 -1
- package/build/components/types/src/components/Pill/Pill.d.ts +1 -1
- package/build/components/types/src/components/Table/Table.d.ts +2 -0
- package/build/components/types/src/components/Table/docsData.d.ts +2 -0
- package/build/components/types/src/components/Table/types.d.ts +1 -0
- package/build/components/types/src/components/Tag/Tag.d.ts +0 -2
- package/build/components/types/src/components/index.d.ts +2 -2
- package/build/fonts/HelveticaNeue-Bold.woff2 +0 -0
- package/build/fonts/HelveticaNeue-Light.woff2 +0 -0
- package/build/fonts/HelveticaNeue-Roman.woff2 +0 -0
- package/build/lib/components.css +1 -1
- package/build/lib/components.css.map +1 -1
- package/build/lib/scripts.js +4 -4
- package/build/lib/scripts.js.map +1 -1
- package/build/lib/style.css +1 -1
- package/build/lib/style.css.map +1 -1
- package/package.json +9 -9
- package/public/fonts/HelveticaNeue-Bold.woff2 +0 -0
- package/public/fonts/HelveticaNeue-Light.woff2 +0 -0
- package/public/fonts/HelveticaNeue-Roman.woff2 +0 -0
- package/src/components/AnchorNavigation/AnchorNavigation.static.ts +3 -0
- package/src/components/AnchorNavigation/styles/mixins.scss +4 -4
- package/src/components/Button/styles/config.scss +5 -4
- package/src/components/Carousel/Carousel.static.ts +204 -1
- package/src/components/Carousel/tests/Carousel.static.test.js +403 -0
- package/src/components/Carousel/tests/Carousel.unit.test.js +68 -0
- package/src/components/Cover/Cover.tsx +22 -20
- package/src/components/Cover/styles/config.scss +23 -12
- package/src/components/Cover/styles/mixins.scss +6 -5
- package/src/components/Cover/tests/Cover.unit.test.js +52 -52
- package/src/components/Forms/Group/styles/mixins.scss +14 -0
- package/src/components/Modal/Modal.tsx +1 -9
- package/src/components/Modal/index.ts +0 -1
- package/src/components/Modal/styles/config.scss +4 -4
- package/src/components/Modal/styles/mixins.scss +13 -59
- package/src/components/Modal/styles/style.scss +0 -16
- package/src/components/Modal/tests/Modal.unit.test.js +0 -37
- package/src/components/Pill/Pill.tsx +13 -2
- package/src/components/Pill/styles/config.scss +2 -21
- package/src/components/Pill/styles/style.scss +18 -6
- package/src/components/Pill/tests/Pill.conformance.test.js +8 -2
- package/src/components/Pill/tests/Pill.unit.test.js +69 -11
- package/src/components/Table/Row.tsx +9 -3
- package/src/components/Table/Table.tsx +11 -1
- package/src/components/Table/TableContext.ts +1 -0
- package/src/components/Table/docsData.ts +25 -0
- package/src/components/Table/styles/mixins.scss +37 -0
- package/src/components/Table/styles/style.scss +6 -0
- package/src/components/Table/types.ts +1 -0
- package/src/components/Tag/Tag.tsx +0 -2
- package/src/components/Tag/styles/style.scss +32 -0
- package/src/components/Tooltip/InfoTooltip.tsx +1 -5
- package/src/components/index.ts +2 -0
- package/src/styles/tokens/color.scss +1 -1
- package/build/components/types/src/components/Modal/ModalProductBody.d.ts +0 -10
- package/src/components/Modal/ModalProductBody.tsx +0 -52
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orangesk/orange-design-system",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"engines": {
|
|
6
|
-
"node": ">=
|
|
6
|
+
"node": ">=20.x"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
9
|
"build/",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@cloudfour/transition-hidden-element": "^2.0.2",
|
|
35
35
|
"@mdx-js/loader": "^3.1.1",
|
|
36
36
|
"@mdx-js/react": "^3.1.1",
|
|
37
|
-
"@next/mdx": "^15.5.
|
|
37
|
+
"@next/mdx": "^15.5.6",
|
|
38
38
|
"@orangesk/accessible-autocomplete": "^3.1.2",
|
|
39
39
|
"@popperjs/core": "^2.11.8",
|
|
40
40
|
"@types/mdx": "^2.0.13",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"classnames": "^2.5.1",
|
|
43
43
|
"daypickr": "^0.3.4",
|
|
44
44
|
"diff2html": "^3.4.52",
|
|
45
|
-
"dompurify": "^3.
|
|
46
|
-
"html-react-parser": "^5.2.
|
|
45
|
+
"dompurify": "^3.3.0",
|
|
46
|
+
"html-react-parser": "^5.2.7",
|
|
47
47
|
"jest-environment-jsdom": "^30.2.0",
|
|
48
48
|
"lorem-ipsum": "^2.0.8",
|
|
49
|
-
"next": "15.5.
|
|
49
|
+
"next": "15.5.6",
|
|
50
50
|
"normalize.css": "^8.0.1",
|
|
51
51
|
"nouislider": "^15.8.1",
|
|
52
52
|
"pretty": "^2.0.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@eslint/eslintrc": "3.3.1",
|
|
72
72
|
"@rollup/plugin-alias": "^5.1.1",
|
|
73
73
|
"@rollup/plugin-babel": "^6.1.0",
|
|
74
|
-
"@rollup/plugin-commonjs": "^28.0.
|
|
74
|
+
"@rollup/plugin-commonjs": "^28.0.7",
|
|
75
75
|
"@rollup/plugin-json": "^6.1.0",
|
|
76
76
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
77
77
|
"@rollup/plugin-terser": "^0.4.4",
|
|
@@ -84,11 +84,11 @@
|
|
|
84
84
|
"@types/node": "^24.7.2",
|
|
85
85
|
"@types/pretty": "^2.0.3",
|
|
86
86
|
"@types/react": "19.2.2",
|
|
87
|
-
"@types/react-dom": "19.2.
|
|
87
|
+
"@types/react-dom": "19.2.2",
|
|
88
88
|
"@types/wnumb": "^1.2.3",
|
|
89
89
|
"babel-jest": "30.2.0",
|
|
90
90
|
"eslint": "latest",
|
|
91
|
-
"eslint-config-next": "^15.5.
|
|
91
|
+
"eslint-config-next": "^15.5.5",
|
|
92
92
|
"eslint-config-prettier": "^10.1.8",
|
|
93
93
|
"eslint-plugin-unused-imports": "^4.2.0",
|
|
94
94
|
"fs-extra": "^11.3.2",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -93,6 +93,9 @@ export default class AnchorNavigation {
|
|
|
93
93
|
if (targetElement) {
|
|
94
94
|
this.isAutoScrolling = true;
|
|
95
95
|
|
|
96
|
+
// Remove focus from clicked element to prevent focus state persistence
|
|
97
|
+
anchor.blur();
|
|
98
|
+
|
|
96
99
|
// Calculate scroll position
|
|
97
100
|
const scrollOffset = this.megamenuElement
|
|
98
101
|
? this.megamenuElement.offsetHeight
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
align-items: center;
|
|
64
64
|
position: relative;
|
|
65
65
|
|
|
66
|
-
@include breakpoint.get("
|
|
66
|
+
@include breakpoint.get("md", "down") {
|
|
67
67
|
overflow: hidden;
|
|
68
68
|
flex-direction: column;
|
|
69
69
|
}
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
@mixin anchor-navigation-content-left() {
|
|
73
73
|
display: flex;
|
|
74
74
|
|
|
75
|
-
@include breakpoint.get("
|
|
75
|
+
@include breakpoint.get("md", "down") {
|
|
76
76
|
width: 100%;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
flex-shrink: 0;
|
|
84
84
|
gap: space.get("medium");
|
|
85
85
|
position: relative;
|
|
86
|
-
padding: 0 convert.to-rem(25px);
|
|
86
|
+
padding: 0 0 0 convert.to-rem(25px);
|
|
87
87
|
z-index: 1;
|
|
88
88
|
|
|
89
89
|
&:before {
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
border-radius: inherit;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
@include breakpoint.get("
|
|
105
|
+
@include breakpoint.get("md", "down") {
|
|
106
106
|
&:before {
|
|
107
107
|
display: none;
|
|
108
108
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@use "../../../styles/tokens/space";
|
|
2
|
+
@use "../../../styles/tokens/color";
|
|
2
3
|
@use "../../../styles/tools/convert";
|
|
3
4
|
|
|
4
5
|
$base: (
|
|
@@ -46,7 +47,7 @@ $variants: (
|
|
|
46
47
|
border-color: transparent,
|
|
47
48
|
),
|
|
48
49
|
active: (
|
|
49
|
-
color:
|
|
50
|
+
color: color.$white,
|
|
50
51
|
background-color: var(--color-fill-tertiary),
|
|
51
52
|
border-color: transparent,
|
|
52
53
|
),
|
|
@@ -58,7 +59,7 @@ $variants: (
|
|
|
58
59
|
),
|
|
59
60
|
"primary": (
|
|
60
61
|
default: (
|
|
61
|
-
color:
|
|
62
|
+
color: color.$white,
|
|
62
63
|
background-color: var(--color-fill-tertiary),
|
|
63
64
|
border-color: transparent,
|
|
64
65
|
),
|
|
@@ -73,7 +74,7 @@ $variants: (
|
|
|
73
74
|
border-color: var(--color-border-contrast),
|
|
74
75
|
),
|
|
75
76
|
disabled: (
|
|
76
|
-
color:
|
|
77
|
+
color: color.$white,
|
|
77
78
|
background-color: var(--color-fill-disabled),
|
|
78
79
|
border-color: var(--color-fill-disabled),
|
|
79
80
|
),
|
|
@@ -90,7 +91,7 @@ $variants: (
|
|
|
90
91
|
border-color: var(--color-border-contrast),
|
|
91
92
|
),
|
|
92
93
|
active: (
|
|
93
|
-
color:
|
|
94
|
+
color: color.$white,
|
|
94
95
|
background-color: var(--color-fill-tertiary),
|
|
95
96
|
border-color: transparent,
|
|
96
97
|
),
|
|
@@ -84,6 +84,7 @@ export default class Carousel {
|
|
|
84
84
|
viewport!: HTMLElement;
|
|
85
85
|
track!: HTMLElement;
|
|
86
86
|
instance!: Swiper;
|
|
87
|
+
carouselId?: string;
|
|
87
88
|
|
|
88
89
|
constructor(element: HTMLElement, config?: Partial<SwiperOptions>) {
|
|
89
90
|
this.element = element;
|
|
@@ -123,6 +124,10 @@ export default class Carousel {
|
|
|
123
124
|
modules: [Navigation, Pagination, Scrollbar, A11y, Keyboard],
|
|
124
125
|
on: {
|
|
125
126
|
slideChange: this.handleSlideChange,
|
|
127
|
+
slideChangeTransitionEnd: () => {
|
|
128
|
+
// Update external controls after transition completes
|
|
129
|
+
this.updateExternalControlsState();
|
|
130
|
+
},
|
|
126
131
|
},
|
|
127
132
|
});
|
|
128
133
|
|
|
@@ -130,6 +135,9 @@ export default class Carousel {
|
|
|
130
135
|
if (this.element.classList.contains(CLASS_BLEED_RIGHT)) {
|
|
131
136
|
this.adjustConfigForBleedRight();
|
|
132
137
|
}
|
|
138
|
+
|
|
139
|
+
// Initialize external controls
|
|
140
|
+
this.initExternalControls();
|
|
133
141
|
}
|
|
134
142
|
|
|
135
143
|
getElements() {
|
|
@@ -241,7 +249,7 @@ export default class Carousel {
|
|
|
241
249
|
/**
|
|
242
250
|
* Handles the slide change event on the carousel.
|
|
243
251
|
* Updates the tooltip position for the active slide and hides tooltips for non-active slides.
|
|
244
|
-
* Also updates accessibility attributes for pagination buttons.
|
|
252
|
+
* Also updates accessibility attributes for pagination buttons and external controls state.
|
|
245
253
|
*/
|
|
246
254
|
handleSlideChange() {
|
|
247
255
|
const activeSlide = this.track.querySelector(SELECTOR_ACTIVE);
|
|
@@ -256,6 +264,9 @@ export default class Carousel {
|
|
|
256
264
|
if (nonActiveSlides.length > 0) {
|
|
257
265
|
this.hideAllTooltips(nonActiveSlides);
|
|
258
266
|
}
|
|
267
|
+
|
|
268
|
+
// Update external controls state based on current position
|
|
269
|
+
this.updateExternalControlsState();
|
|
259
270
|
}
|
|
260
271
|
|
|
261
272
|
/**
|
|
@@ -309,7 +320,187 @@ export default class Carousel {
|
|
|
309
320
|
});
|
|
310
321
|
}
|
|
311
322
|
|
|
323
|
+
/**
|
|
324
|
+
* Initialize external controls that reference this carousel
|
|
325
|
+
*/
|
|
326
|
+
initExternalControls() {
|
|
327
|
+
// Get carousel ID from data-carousel-id or element id
|
|
328
|
+
const carouselId = this.element.dataset.carouselId || this.element.id;
|
|
329
|
+
|
|
330
|
+
if (!carouselId) {
|
|
331
|
+
return; // No ID to reference, skip external controls
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// Store carousel ID for later use
|
|
335
|
+
this.carouselId = carouselId;
|
|
336
|
+
|
|
337
|
+
// Find all elements with data-carousel-controls matching this carousel's ID
|
|
338
|
+
const controlElements = document.querySelectorAll(
|
|
339
|
+
`[data-carousel-controls="${carouselId}"]`,
|
|
340
|
+
);
|
|
341
|
+
|
|
342
|
+
controlElements.forEach((control) => {
|
|
343
|
+
const htmlControl = control as HTMLElement;
|
|
344
|
+
|
|
345
|
+
// Skip if already initialized to avoid duplicate event listeners
|
|
346
|
+
if (htmlControl.hasAttribute("data-carousel-initialized")) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// Remove any existing event listener first (just in case)
|
|
351
|
+
if ((htmlControl as any)._carouselClickHandler) {
|
|
352
|
+
htmlControl.removeEventListener(
|
|
353
|
+
"click",
|
|
354
|
+
(htmlControl as any)._carouselClickHandler,
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const action = htmlControl.dataset.carouselAction;
|
|
359
|
+
|
|
360
|
+
// Create bound event handler to avoid multiple listeners
|
|
361
|
+
const clickHandler = (e: Event) => {
|
|
362
|
+
e.preventDefault();
|
|
363
|
+
if (htmlControl.hasAttribute("disabled")) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
if (action === "next") {
|
|
367
|
+
this.slideNext();
|
|
368
|
+
} else if (action === "prev") {
|
|
369
|
+
this.slidePrev();
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
if (action === "next" || action === "prev") {
|
|
374
|
+
htmlControl.addEventListener("click", clickHandler);
|
|
375
|
+
|
|
376
|
+
// Add ARIA attributes for accessibility
|
|
377
|
+
htmlControl.setAttribute(
|
|
378
|
+
"aria-label",
|
|
379
|
+
action === "next"
|
|
380
|
+
? this.config.a11y?.nextSlideMessage || "Nasledujúci snímok"
|
|
381
|
+
: this.config.a11y?.prevSlideMessage || "Predchádzajúci snímok",
|
|
382
|
+
);
|
|
383
|
+
htmlControl.setAttribute("type", "button");
|
|
384
|
+
|
|
385
|
+
// Store the handler reference for potential cleanup
|
|
386
|
+
(htmlControl as any)._carouselClickHandler = clickHandler;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// Mark as initialized to avoid duplicate event listeners
|
|
390
|
+
htmlControl.setAttribute("data-carousel-initialized", "true");
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
// Update initial state of external controls
|
|
394
|
+
this.updateExternalControlsState();
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Update the disabled state of external controls based on current slide position
|
|
399
|
+
*/
|
|
400
|
+
updateExternalControlsState() {
|
|
401
|
+
if (!this.carouselId || !this.instance) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
const isAtStart = this.instance.isBeginning;
|
|
406
|
+
const isAtEnd = this.instance.isEnd;
|
|
407
|
+
|
|
408
|
+
// Find all prev controls for this carousel
|
|
409
|
+
const prevControls = document.querySelectorAll(
|
|
410
|
+
`[data-carousel-controls="${this.carouselId}"][data-carousel-action="prev"]`,
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
// Find all next controls for this carousel
|
|
414
|
+
const nextControls = document.querySelectorAll(
|
|
415
|
+
`[data-carousel-controls="${this.carouselId}"][data-carousel-action="next"]`,
|
|
416
|
+
);
|
|
417
|
+
|
|
418
|
+
// Update prev controls
|
|
419
|
+
prevControls.forEach((control) => {
|
|
420
|
+
const htmlControl = control as HTMLElement;
|
|
421
|
+
if (isAtStart) {
|
|
422
|
+
htmlControl.setAttribute("disabled", "true");
|
|
423
|
+
htmlControl.setAttribute("aria-disabled", "true");
|
|
424
|
+
htmlControl.style.cursor = "not-allowed";
|
|
425
|
+
} else {
|
|
426
|
+
htmlControl.removeAttribute("disabled");
|
|
427
|
+
htmlControl.setAttribute("aria-disabled", "false");
|
|
428
|
+
htmlControl.style.cursor = "pointer";
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
// Update next controls
|
|
433
|
+
nextControls.forEach((control) => {
|
|
434
|
+
const htmlControl = control as HTMLElement;
|
|
435
|
+
if (isAtEnd) {
|
|
436
|
+
htmlControl.setAttribute("disabled", "true");
|
|
437
|
+
htmlControl.setAttribute("aria-disabled", "true");
|
|
438
|
+
htmlControl.style.cursor = "not-allowed";
|
|
439
|
+
} else {
|
|
440
|
+
htmlControl.removeAttribute("disabled");
|
|
441
|
+
htmlControl.setAttribute("aria-disabled", "false");
|
|
442
|
+
htmlControl.style.cursor = "pointer";
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Go to the next slide
|
|
449
|
+
*/
|
|
450
|
+
slideNext() {
|
|
451
|
+
if (this.instance) {
|
|
452
|
+
this.instance.slideNext();
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Go to the previous slide
|
|
458
|
+
*/
|
|
459
|
+
slidePrev() {
|
|
460
|
+
if (this.instance) {
|
|
461
|
+
this.instance.slidePrev();
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Get the current active slide index
|
|
467
|
+
* @returns {number} The current slide index
|
|
468
|
+
*/
|
|
469
|
+
getActiveIndex(): number {
|
|
470
|
+
return this.instance ? this.instance.activeIndex : 0;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Add event listener for slide changes
|
|
475
|
+
* @param {Function} callback - Callback function to execute on slide change
|
|
476
|
+
*/
|
|
477
|
+
onSlideChange(callback: (activeIndex: number) => void) {
|
|
478
|
+
if (this.instance) {
|
|
479
|
+
this.instance.on("slideChange", () => {
|
|
480
|
+
callback(this.instance.activeIndex);
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
312
485
|
destroy() {
|
|
486
|
+
// Clean up external controls
|
|
487
|
+
if (this.carouselId) {
|
|
488
|
+
const controlElements = document.querySelectorAll(
|
|
489
|
+
`[data-carousel-controls="${this.carouselId}"]`,
|
|
490
|
+
);
|
|
491
|
+
controlElements.forEach((control) => {
|
|
492
|
+
const htmlControl = control as HTMLElement;
|
|
493
|
+
if ((htmlControl as any)._carouselClickHandler) {
|
|
494
|
+
htmlControl.removeEventListener(
|
|
495
|
+
"click",
|
|
496
|
+
(htmlControl as any)._carouselClickHandler,
|
|
497
|
+
);
|
|
498
|
+
delete (htmlControl as any)._carouselClickHandler;
|
|
499
|
+
}
|
|
500
|
+
htmlControl.removeAttribute("data-carousel-initialized");
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
|
|
313
504
|
if (this.instance) {
|
|
314
505
|
this.instance.destroy();
|
|
315
506
|
}
|
|
@@ -324,4 +515,16 @@ export default class Carousel {
|
|
|
324
515
|
static getInstance(el: HTMLElement): Carousel | null {
|
|
325
516
|
return el && (el as any).ODS_Carousel ? (el as any).ODS_Carousel : null;
|
|
326
517
|
}
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Find carousel instance by ID or data attribute
|
|
521
|
+
* @param {string} carouselId - The ID or data attribute value of the carousel
|
|
522
|
+
* @returns {Carousel | null} The carousel instance or null
|
|
523
|
+
*/
|
|
524
|
+
static getInstanceById(carouselId: string): Carousel | null {
|
|
525
|
+
const element =
|
|
526
|
+
document.querySelector(`[data-carousel-id="${carouselId}"]`) ||
|
|
527
|
+
document.getElementById(carouselId);
|
|
528
|
+
return element ? this.getInstance(element as HTMLElement) : null;
|
|
529
|
+
}
|
|
327
530
|
}
|