@orangesk/orange-design-system 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/BodyBanner/style.css +1 -1
- package/build/components/BodyBanner/style.css.map +1 -1
- package/build/components/List/style.css +1 -1
- package/build/components/List/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 +16 -4
- package/build/components/types/src/components/Carousel/Carousel.d.ts +10 -3
- package/build/components/types/src/components/index.d.ts +2 -2
- 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/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/utilities.css +1 -1
- package/build/lib/utilities.css.map +1 -1
- package/build/search-index.json +2 -2
- package/build/sprite.svg +1 -1
- package/package.json +8 -8
- package/src/assets/icons/add.svg +4 -1
- package/src/assets/icons/close.svg +3 -3
- package/src/assets/icons/menu.svg +4 -1
- package/src/assets/icons/pause.svg +3 -3
- package/src/assets/icons/play.svg +2 -2
- package/src/assets/icons/remove.svg +4 -1
- package/src/assets/icons/search.svg +4 -1
- package/src/components/BodyBanner/styles/mixins.scss +5 -1
- package/src/components/Carousel/Carousel.tsx +27 -8
- package/src/components/Carousel/tests/Carousel.unit.test.jsx +29 -0
- package/src/components/Forms/Autocomplete/styles/mixins.scss +3 -2
- package/src/components/Forms/Autocomplete/tests/Autocomplete.styles.unit.test.jsx +20 -0
- package/src/components/List/styles/config.scss +1 -1
- package/src/components/index.ts +2 -1
- package/src/styles/typography/mixins.scss +4 -0
- package/src/styles/utilities/text.scss +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orangesk/orange-design-system",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.x"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@cloudfour/transition-hidden-element": "^2.0.2",
|
|
56
56
|
"@mdx-js/loader": "^3.1.1",
|
|
57
57
|
"@mdx-js/react": "^3.1.1",
|
|
58
|
-
"@next/mdx": "16.2.
|
|
58
|
+
"@next/mdx": "16.2.10",
|
|
59
59
|
"@orangesk/accessible-autocomplete": "3.2.2",
|
|
60
60
|
"@popperjs/core": "^2.11.8",
|
|
61
61
|
"@types/mdx": "^2.0.14",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"html-react-parser": "6.1.3",
|
|
68
68
|
"lorem-ipsum": "3.0.0",
|
|
69
69
|
"minisearch": "7.2.0",
|
|
70
|
-
"next": "16.2.
|
|
70
|
+
"next": "16.2.10",
|
|
71
71
|
"normalize.css": "^8.0.1",
|
|
72
72
|
"nouislider": "^15.8.1",
|
|
73
73
|
"prism-react-renderer": "^2.4.1",
|
|
74
|
-
"query-string": "^9.4.
|
|
74
|
+
"query-string": "^9.4.1",
|
|
75
75
|
"react": "^19.2.7",
|
|
76
76
|
"react-dom": "^19.2.7",
|
|
77
77
|
"react-element-to-jsx-string": "^17.0.1",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"rehype-slug": "^6.0.0",
|
|
81
81
|
"remark-gemoji": "^8.0.0",
|
|
82
82
|
"remark-gfm": "^4.0.1",
|
|
83
|
-
"swiper": "
|
|
83
|
+
"swiper": "14.0.1",
|
|
84
84
|
"tabbable": "^6.5.0",
|
|
85
85
|
"unescape-html": "^1.1.0",
|
|
86
86
|
"wnumb": "^1.2.0"
|
|
@@ -114,15 +114,15 @@
|
|
|
114
114
|
"@vitest/coverage-v8": "^4.1.9",
|
|
115
115
|
"@vitest/ui": "^4.1.9",
|
|
116
116
|
"canvas": "^3.2.3",
|
|
117
|
-
"fs-extra": "^11.3.
|
|
117
|
+
"fs-extra": "^11.3.6",
|
|
118
118
|
"glob": "13.0.6",
|
|
119
|
-
"html-validate": "11.5.
|
|
119
|
+
"html-validate": "11.5.4",
|
|
120
120
|
"husky": "^9.1.7",
|
|
121
121
|
"identity-obj-proxy": "^3.0.0",
|
|
122
122
|
"jsdom": "29.1.1",
|
|
123
123
|
"lint-staged": "17.0.8",
|
|
124
124
|
"playwright": "^1.61.1",
|
|
125
|
-
"prettier": "^3.
|
|
125
|
+
"prettier": "^3.9.4",
|
|
126
126
|
"rollup": "^4.62.2",
|
|
127
127
|
"rollup-plugin-copy": "^3.5.0",
|
|
128
128
|
"rollup-plugin-dts": "^6.4.1",
|
package/src/assets/icons/add.svg
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
<svg width="
|
|
1
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none"
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="M27 21H40V27H27V40H21V27H8V21H21V8H27V21Z" fill="currentColor"/>
|
|
4
|
+
</svg>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<svg width="
|
|
1
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none"
|
|
2
2
|
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<path d="
|
|
4
|
-
<path d="
|
|
3
|
+
<path d="M36 40L20 24L36 8L40 12L28 24L40 36L36 40Z" fill="currentColor"/>
|
|
4
|
+
<path d="M12 8L28 24L12 40L8 36L20 24L8 12L12 8Z" fill="currentColor"/>
|
|
5
5
|
</svg>
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
<svg
|
|
1
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none"
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="M6 8H42V13.9998H6V8ZM6 21H42V27H6V21ZM6 34.0002H42V40H6V34.0002Z" fill="currentColor"/>
|
|
4
|
+
</svg>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<svg width="
|
|
1
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none"
|
|
2
2
|
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<path d="
|
|
4
|
-
<path d="
|
|
3
|
+
<path d="M33 11L33 37H27L27 11L33 11Z" fill="currentColor"/>
|
|
4
|
+
<path d="M21 11L21 37H15L15 11L21 11Z" fill="currentColor"/>
|
|
5
5
|
</svg>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<svg width="
|
|
1
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none"
|
|
2
2
|
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<path d="
|
|
3
|
+
<path d="M37 24.0003L16 36.1247L16 11.876L37 24.0003Z" fill="currentColor"/>
|
|
4
4
|
</svg>
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
<svg width="
|
|
1
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none"
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="M8 21H40V27H8V21Z" fill="currentColor"/>
|
|
4
|
+
</svg>
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
<svg width="
|
|
1
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none"
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M22 5C31.3888 5 39 12.6112 39 22C39 25.6106 37.8725 28.9569 35.9531 31.71L43.8496 39.6064L39.6064 43.8496L31.7109 35.9531C28.9578 37.8728 25.6109 39 22 39C12.6112 39 5 31.3888 5 22C5 12.6112 12.6112 5 22 5ZM22 11C15.9249 11 11 15.9249 11 22C11 28.0751 15.9249 33 22 33C28.0751 33 33 28.0751 33 22C33 15.9249 28.0751 11 22 11Z" fill="currentColor"/>
|
|
4
|
+
</svg>
|
|
@@ -17,7 +17,11 @@
|
|
|
17
17
|
[style*="--color-fill"],
|
|
18
18
|
[style*="--color-surface"]
|
|
19
19
|
) {
|
|
20
|
-
border: 1px solid var(--color-border-
|
|
20
|
+
border: 1px solid var(--color-border-strong);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.background-accent {
|
|
24
|
+
border: 1px solid var(--color-border-accent);
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
&.grid {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import cx from "classnames";
|
|
4
|
-
import React, { HTMLAttributes, ReactNode } from "react";
|
|
4
|
+
import React, { HTMLAttributes, ReactElement, ReactNode } from "react";
|
|
5
5
|
import { useStatic } from "@/utils/hooks";
|
|
6
6
|
import { Icon } from "../Icon";
|
|
7
7
|
import CarouselStatic from "./Carousel.static";
|
|
@@ -18,11 +18,15 @@ import {
|
|
|
18
18
|
CLASS_VIEWPORT_WRAPPER,
|
|
19
19
|
} from "./constants";
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
type CarouselRenderItem<T> = (item: T, index: number) => ReactNode;
|
|
22
|
+
|
|
23
|
+
interface CarouselProps<T = ReactNode> extends HTMLAttributes<HTMLDivElement> {
|
|
22
24
|
/** Swiper.js (https://swiperjs.com/) options object */
|
|
23
25
|
swiperOptions?: Record<string, any>;
|
|
24
26
|
/** Carousel items */
|
|
25
|
-
items:
|
|
27
|
+
items: T[];
|
|
28
|
+
/** Render carousel item content */
|
|
29
|
+
renderItems?: CarouselRenderItem<T>;
|
|
26
30
|
/** Always show scrollbar and hide dots */
|
|
27
31
|
showScrollbar?: boolean;
|
|
28
32
|
/** Make carousel bleed to the right edge of screen while keeping left aligned with container */
|
|
@@ -30,23 +34,37 @@ interface CarouselProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
30
34
|
className?: string;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
|
-
const
|
|
37
|
+
const isCarouselItemElement = (
|
|
38
|
+
item: ReactNode,
|
|
39
|
+
): item is ReactElement<React.ComponentProps<typeof CarouselItem>> =>
|
|
40
|
+
React.isValidElement(item) && item.type === CarouselItem;
|
|
41
|
+
|
|
42
|
+
const Carousel = <T,>({
|
|
34
43
|
className,
|
|
35
44
|
swiperOptions,
|
|
36
45
|
items,
|
|
46
|
+
renderItems,
|
|
37
47
|
showScrollbar = false,
|
|
38
48
|
bleedRight = false,
|
|
39
49
|
...other
|
|
40
|
-
}) => {
|
|
50
|
+
}: CarouselProps<T>) => {
|
|
41
51
|
const [carouselRef] = useStatic(CarouselStatic);
|
|
42
52
|
const { ["data-swiper-options"]: _dataSwiperOptionsAttr, ...domProps } =
|
|
43
53
|
other as HTMLAttributes<HTMLDivElement> & {
|
|
44
54
|
"data-swiper-options"?: string;
|
|
45
55
|
};
|
|
46
56
|
|
|
47
|
-
const carouselItems = items.map((item, i) =>
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
const carouselItems = items.map((item, i) => {
|
|
58
|
+
const content = renderItems ? renderItems(item, i) : (item as ReactNode);
|
|
59
|
+
|
|
60
|
+
if (isCarouselItemElement(content)) {
|
|
61
|
+
return React.cloneElement(content, {
|
|
62
|
+
key: content.key ?? i.toString(),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return <CarouselItem key={i.toString()}>{content}</CarouselItem>;
|
|
67
|
+
});
|
|
50
68
|
|
|
51
69
|
const classes = cx(CLASS_ROOT, className, {
|
|
52
70
|
[`${CLASS_ROOT}--scrollbar`]: showScrollbar,
|
|
@@ -113,4 +131,5 @@ const Carousel: React.FC<CarouselProps> = ({
|
|
|
113
131
|
|
|
114
132
|
Carousel.displayName = "Carousel";
|
|
115
133
|
|
|
134
|
+
export type { CarouselProps };
|
|
116
135
|
export { Carousel };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { render } from "@testing-library/react";
|
|
2
2
|
|
|
3
3
|
import { Carousel } from "../Carousel";
|
|
4
|
+
import { CarouselItem } from "../CarouselItem";
|
|
4
5
|
|
|
5
6
|
//items is required
|
|
6
7
|
describe("rendering Carousel", () => {
|
|
@@ -137,6 +138,34 @@ describe("rendering Carousel", () => {
|
|
|
137
138
|
expect(slides[i].querySelector("p").textContent).toBe(`item${i + 1}`);
|
|
138
139
|
}
|
|
139
140
|
});
|
|
141
|
+
it("uses renderItems callback when provided", () => {
|
|
142
|
+
const data = [{ title: "item1" }, { title: "item2" }, { title: "item3" }];
|
|
143
|
+
const { container } = render(
|
|
144
|
+
<Carousel
|
|
145
|
+
items={data}
|
|
146
|
+
renderItems={(item, index) => <p>{`${index + 1}-${item.title}`}</p>}
|
|
147
|
+
/>,
|
|
148
|
+
);
|
|
149
|
+
const slides = container.getElementsByClassName("carousel__slide");
|
|
150
|
+
for (let i = 0; i < data.length; i++) {
|
|
151
|
+
expect(slides[i].querySelector("p").textContent).toBe(
|
|
152
|
+
`${i + 1}-${data[i].title}`,
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
it("does not double-wrap CarouselItem elements", () => {
|
|
157
|
+
const items = [
|
|
158
|
+
<CarouselItem key="item1" data-testid="slide-1">
|
|
159
|
+
item1
|
|
160
|
+
</CarouselItem>,
|
|
161
|
+
];
|
|
162
|
+
const { container, getByTestId } = render(<Carousel items={items} />);
|
|
163
|
+
|
|
164
|
+
expect(container.getElementsByClassName("carousel__slide").length).toBe(
|
|
165
|
+
1,
|
|
166
|
+
);
|
|
167
|
+
expect(getByTestId("slide-1").textContent).toBe("item1");
|
|
168
|
+
});
|
|
140
169
|
});
|
|
141
170
|
describe("swiperOptions prop", () => {
|
|
142
171
|
const items = [
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
position: absolute;
|
|
8
8
|
top: 100%;
|
|
9
9
|
left: 0;
|
|
10
|
-
z-index:
|
|
10
|
+
z-index: 1;
|
|
11
11
|
float: left;
|
|
12
12
|
width: 100%;
|
|
13
13
|
max-height: $height;
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
top: 0;
|
|
57
57
|
width: 100%;
|
|
58
58
|
height: 100%;
|
|
59
|
-
z-index:
|
|
59
|
+
z-index: 2;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
&:first-child {
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
|
|
74
74
|
@mixin wrapper {
|
|
75
75
|
position: relative;
|
|
76
|
+
isolation: isolate;
|
|
76
77
|
width: 100%;
|
|
77
78
|
max-width: convert.to-rem(350px);
|
|
78
79
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import sass from "sass";
|
|
3
|
+
|
|
4
|
+
describe("Autocomplete styles", () => {
|
|
5
|
+
it("keeps autocomplete menu inside local stacking context", () => {
|
|
6
|
+
const result = sass.compile(
|
|
7
|
+
path.resolve(
|
|
8
|
+
process.cwd(),
|
|
9
|
+
"src/components/Forms/Autocomplete/styles/style.scss",
|
|
10
|
+
),
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
expect(result.css).toContain(".autocomplete__wrapper");
|
|
14
|
+
expect(result.css).toContain("isolation: isolate;");
|
|
15
|
+
expect(result.css).toContain(".autocomplete__menu");
|
|
16
|
+
expect(result.css).toContain("z-index: 1;");
|
|
17
|
+
expect(result.css).toContain(".autocomplete__option::before");
|
|
18
|
+
expect(result.css).toContain("z-index: 2;");
|
|
19
|
+
});
|
|
20
|
+
});
|
package/src/components/index.ts
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from "./Button";
|
|
20
20
|
import { Buttons } from "./Buttons";
|
|
21
21
|
import { Card, CardProductHeader, CardSection } from "./Card";
|
|
22
|
-
import { Carousel } from "./Carousel";
|
|
22
|
+
import { Carousel, CarouselItem } from "./Carousel";
|
|
23
23
|
import { CarouselHero, CarouselHeroItem } from "./CarouselHero";
|
|
24
24
|
import { CarouselPromotions } from "./CarouselPromotions";
|
|
25
25
|
import { CartTable } from "./CartTable";
|
|
@@ -121,6 +121,7 @@ export {
|
|
|
121
121
|
Carousel,
|
|
122
122
|
CarouselHero,
|
|
123
123
|
CarouselHeroItem,
|
|
124
|
+
CarouselItem,
|
|
124
125
|
CarouselPromotions,
|
|
125
126
|
CartTable,
|
|
126
127
|
Checkbox,
|