@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.
Files changed (38) hide show
  1. package/build/components/BodyBanner/style.css +1 -1
  2. package/build/components/BodyBanner/style.css.map +1 -1
  3. package/build/components/List/style.css +1 -1
  4. package/build/components/List/style.css.map +1 -1
  5. package/build/components/index.js +1 -1
  6. package/build/components/index.js.map +1 -1
  7. package/build/components/tsconfig.tsbuildinfo +1 -1
  8. package/build/components/types/index.d.ts +16 -4
  9. package/build/components/types/src/components/Carousel/Carousel.d.ts +10 -3
  10. package/build/components/types/src/components/index.d.ts +2 -2
  11. package/build/lib/base.css.map +1 -1
  12. package/build/lib/components.css +1 -1
  13. package/build/lib/components.css.map +1 -1
  14. package/build/lib/scripts.js +1 -1
  15. package/build/lib/scripts.js.map +1 -1
  16. package/build/lib/style.css +1 -1
  17. package/build/lib/style.css.map +1 -1
  18. package/build/lib/utilities.css +1 -1
  19. package/build/lib/utilities.css.map +1 -1
  20. package/build/search-index.json +2 -2
  21. package/build/sprite.svg +1 -1
  22. package/package.json +8 -8
  23. package/src/assets/icons/add.svg +4 -1
  24. package/src/assets/icons/close.svg +3 -3
  25. package/src/assets/icons/menu.svg +4 -1
  26. package/src/assets/icons/pause.svg +3 -3
  27. package/src/assets/icons/play.svg +2 -2
  28. package/src/assets/icons/remove.svg +4 -1
  29. package/src/assets/icons/search.svg +4 -1
  30. package/src/components/BodyBanner/styles/mixins.scss +5 -1
  31. package/src/components/Carousel/Carousel.tsx +27 -8
  32. package/src/components/Carousel/tests/Carousel.unit.test.jsx +29 -0
  33. package/src/components/Forms/Autocomplete/styles/mixins.scss +3 -2
  34. package/src/components/Forms/Autocomplete/tests/Autocomplete.styles.unit.test.jsx +20 -0
  35. package/src/components/List/styles/config.scss +1 -1
  36. package/src/components/index.ts +2 -1
  37. package/src/styles/typography/mixins.scss +4 -0
  38. 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.1.0",
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.9",
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.9",
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.0",
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": "12.2.0",
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.5",
117
+ "fs-extra": "^11.3.6",
118
118
  "glob": "13.0.6",
119
- "html-validate": "11.5.3",
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.8.4",
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",
@@ -1 +1,4 @@
1
- <svg width="80" height="80" viewbox="0 0 80 80" xmlns="http://www.w3.org/2000/svg"><path d="M46.667 33.333h18A4.333 4.333 0 0 1 69 37.667V42a4.331 4.331 0 0 1-4.333 4.667h-18v18A4.333 4.333 0 0 1 42.333 69h-4.666a4.333 4.333 0 0 1-4.334-4.333v-18h-18A4.335 4.335 0 0 1 11 42v-4.333c0-2.334 2-4.334 4.334-4.334h18v-18c0-2.666 2-4.666 4.333-4.666h4.666a4.333 4.333 0 0 1 4.334 4.666v18Z" /></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="M27 21H40V27H27V40H21V27H8V21H21V8H27V21Z" fill="currentColor"/>
4
+ </svg>
@@ -1,5 +1,5 @@
1
- <svg width="80" height="80" viewBox="0 0 80 80"
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="M59.9997 66.6666L33.333 39.9999L59.9997 13.3333L66.6663 19.9999L46.6663 39.9999L66.6663 59.9999L59.9997 66.6666Z" />
4
- <path d="M19.9997 13.3333L46.6663 39.9999L19.9997 66.6666L13.333 59.9999L33.333 39.9999L13.333 19.9999L19.9997 13.3333Z" />
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 xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewbox="0 0 80 80" ><path d="M13.333 16.667h53.333v6.666H13.333v-6.666ZM13.333 36.667h53.333v6.666H13.333v-6.666ZM13.333 56.667h53.333v6.666H13.333v-6.666Z"/></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="24" height="24" viewBox="0 0 24 24" fill="none"
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="M16.5 5.5L16.5 18.5H13.5L13.5 5.5L16.5 5.5Z" fill="currentColor"/>
4
- <path d="M10.5 5.5L10.5 18.5H7.5L7.5 5.5L10.5 5.5Z" fill="currentColor"/>
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="24" height="24" viewBox="0 0 24 24" fill="none"
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="M18.5 11.9997L8 18.0619L8 5.9375L18.5 11.9997Z" fill="currentColor"/>
3
+ <path d="M37 24.0003L16 36.1247L16 11.876L37 24.0003Z" fill="currentColor"/>
4
4
  </svg>
@@ -1 +1,4 @@
1
- <svg width="80" height="80" viewbox="0 0 80 80" xmlns="http://www.w3.org/2000/svg"><path d="M64.634 32.667H15.367C12.9 32.667 10.9 34.7 10.9 37.2v4.533c0 2.5 2 4.5 4.467 4.5h49.3c2.467 0 4.467-2 4.467-4.5V37.2c0-2.5-2-4.533-4.467-4.533h-.033Z" /></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="M8 21H40V27H8V21Z" fill="currentColor"/>
4
+ </svg>
@@ -1 +1,4 @@
1
- <svg width="80" height="80" viewbox="0 0 80 80" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M77.66 70.66 55.996 49A29.984 29.984 0 1 0 49 56l21.664 21.66a2.405 2.405 0 0 0 3.392 0l3.608-3.608c.447-.451.698-1.06.698-1.696 0-.635-.255-1.245-.702-1.696ZM31.584 51.976a20.39 20.39 0 1 1 0-40.78 20.39 20.39 0 0 1 0 40.78Z" /></svg>
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-subtle);
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
- interface CarouselProps extends HTMLAttributes<HTMLDivElement> {
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: ReactNode[];
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 Carousel: React.FC<CarouselProps> = ({
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
- <CarouselItem key={i.toString()}>{item}</CarouselItem>
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: 1000;
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: 1001;
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
+ });
@@ -18,7 +18,7 @@ $color-palette: (
18
18
  ),
19
19
 
20
20
  gray: (
21
- background-color: var(--color-surface-subtle),
21
+ background-color: var(--color-background-secondary),
22
22
  border-color: var(--color-border-strong),
23
23
  ),
24
24
  );
@@ -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,
@@ -19,6 +19,10 @@
19
19
  max-width: none;
20
20
  }
21
21
 
22
+ @mixin text-relaxed {
23
+ max-inline-size: clamp(40rem, 75vw, 70rem);
24
+ }
25
+
22
26
  @mixin headings-base($heading-config, $selector-pattern, $base-styles) {
23
27
  $selector: ();
24
28
 
@@ -152,4 +152,7 @@
152
152
  .text-narrow {
153
153
  @include typographyMixins.text-narrow;
154
154
  }
155
+ .text-relaxed {
156
+ @include typographyMixins.text-relaxed;
157
+ }
155
158
  }