@orangesk/orange-design-system 2.0.0-beta.10 → 2.0.0-beta.12

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 (66) hide show
  1. package/build/components/index.js +5 -5
  2. package/build/components/index.js.map +1 -1
  3. package/build/components/tsconfig.tsbuildinfo +1 -1
  4. package/build/components/types/index.d.ts +8 -5
  5. package/build/components/types/src/components/Carousel/Carousel.static.d.ts +34 -1
  6. package/build/components/types/src/components/Cover/Cover.d.ts +3 -3
  7. package/build/components/types/src/components/Pill/Pill.d.ts +1 -1
  8. package/build/components/types/src/components/PromoBanner/PromoBanner.d.ts +1 -1
  9. package/build/components/types/src/components/Table/Table.d.ts +2 -0
  10. package/build/components/types/src/components/Table/docsData.d.ts +2 -0
  11. package/build/components/types/src/components/Table/types.d.ts +1 -0
  12. package/build/components/types/src/components/Tile/Tile.d.ts +2 -1
  13. package/build/lib/after-components.css +1 -1
  14. package/build/lib/after-components.css.map +1 -1
  15. package/build/lib/before-components.css +1 -1
  16. package/build/lib/before-components.css.map +1 -1
  17. package/build/lib/components.css +1 -1
  18. package/build/lib/components.css.map +1 -1
  19. package/build/lib/megamenu.css +1 -1
  20. package/build/lib/megamenu.css.map +1 -1
  21. package/build/lib/scripts.js +4 -4
  22. package/build/lib/scripts.js.map +1 -1
  23. package/build/lib/style.css +1 -1
  24. package/build/lib/style.css.map +1 -1
  25. package/build/lib/tsconfig.tsbuildinfo +1 -1
  26. package/package.json +13 -13
  27. package/src/components/Accordion/styles/mixins.scss +5 -1
  28. package/src/components/AnchorNavigation/AnchorNavigation.static.ts +3 -0
  29. package/src/components/AnchorNavigation/styles/mixins.scss +1 -1
  30. package/src/components/Button/styles/config.scss +5 -4
  31. package/src/components/Carousel/Carousel.static.ts +204 -1
  32. package/src/components/Carousel/tests/Carousel.static.test.js +403 -0
  33. package/src/components/Carousel/tests/Carousel.unit.test.js +68 -0
  34. package/src/components/Cover/Cover.tsx +22 -20
  35. package/src/components/Cover/styles/config.scss +23 -12
  36. package/src/components/Cover/styles/mixins.scss +6 -5
  37. package/src/components/Cover/tests/Cover.unit.test.js +52 -52
  38. package/src/components/Expander/styles/style.scss +3 -1
  39. package/src/components/Forms/Group/styles/mixins.scss +14 -0
  40. package/src/components/Pill/Pill.tsx +10 -2
  41. package/src/components/Pill/styles/config.scss +2 -21
  42. package/src/components/Pill/styles/style.scss +16 -6
  43. package/src/components/Pill/tests/Pill.conformance.test.js +8 -2
  44. package/src/components/Pill/tests/Pill.unit.test.js +69 -11
  45. package/src/components/PromoBanner/PromoBanner.tsx +19 -2
  46. package/src/components/PromoBanner/styles/mixins.scss +1 -1
  47. package/src/components/PromoBanner/tests/PromoBanner.conformance.test.js +32 -0
  48. package/src/components/PromoBanner/tests/PromoBanner.unit.test.js +52 -0
  49. package/src/components/Table/Row.tsx +9 -3
  50. package/src/components/Table/Table.tsx +11 -1
  51. package/src/components/Table/TableContext.ts +1 -0
  52. package/src/components/Table/docsData.ts +25 -0
  53. package/src/components/Table/styles/mixins.scss +40 -4
  54. package/src/components/Table/styles/style.scss +6 -0
  55. package/src/components/Table/types.ts +1 -0
  56. package/src/components/Tile/CHANGELOG.md +15 -1
  57. package/src/components/Tile/Tile.tsx +11 -3
  58. package/src/components/Tile/styles/config.scss +0 -11
  59. package/src/components/Tile/styles/style.scss +0 -4
  60. package/src/components/Tile/tests/Tile.unit.test.js +10 -3
  61. package/src/components/Tooltip/InfoTooltip.tsx +1 -5
  62. package/src/styles/base/globals.scss +7 -2
  63. package/src/styles/tokens/color.scss +1 -1
  64. package/src/styles/typography/mixins.scss +18 -0
  65. package/src/styles/typography/style.scss +6 -3
  66. package/src/styles/utilities/text.scss +1 -0
@@ -35,28 +35,78 @@ describe("rendering Pill", () => {
35
35
  expect(getByTestId("test-id")).toHaveClass("pill--large");
36
36
  });
37
37
 
38
- it("has default black styling without modifier", () => {
38
+ it("supports all available sizes", () => {
39
+ const sizes = ["small", "medium", "large", "xlarge", "xxlarge"];
40
+
41
+ sizes.forEach((size) => {
42
+ const { getByTestId } = render(
43
+ <Pill size={size} data-testid={`test-${size}`}>
44
+ {size}
45
+ </Pill>,
46
+ );
47
+
48
+ expect(getByTestId(`test-${size}`)).toHaveClass(`pill--${size}`);
49
+ });
50
+ });
51
+
52
+ it("has default styling without color modifier", () => {
39
53
  const { getByTestId } = render(<Pill data-testid="test-id">pill</Pill>);
40
54
  expect(getByTestId("test-id")).toHaveClass("pill");
41
- expect(getByTestId("test-id")).not.toHaveClass("pill--black");
55
+ expect(getByTestId("test-id")).not.toHaveClass("surface-secondary");
56
+ });
57
+
58
+ it("has surface-secondary class when color is surface-secondary", () => {
59
+ const { getByTestId } = render(
60
+ <Pill color="surface-secondary" data-testid="test-id">
61
+ pill
62
+ </Pill>,
63
+ );
64
+ expect(getByTestId("test-id")).toHaveClass("surface-secondary");
65
+ });
66
+
67
+ it("has surface-tertiary class when color is surface-tertiary", () => {
68
+ const { getByTestId } = render(
69
+ <Pill color="surface-tertiary" data-testid="test-id">
70
+ pill
71
+ </Pill>,
72
+ );
73
+ expect(getByTestId("test-id")).toHaveClass("surface-tertiary");
74
+ });
75
+
76
+ it("has surface-subtle class when color is surface-subtle", () => {
77
+ const { getByTestId } = render(
78
+ <Pill color="surface-subtle" data-testid="test-id">
79
+ pill
80
+ </Pill>,
81
+ );
82
+ expect(getByTestId("test-id")).toHaveClass("surface-subtle");
83
+ });
84
+
85
+ it("has surface-moderate class when color is surface-moderate", () => {
86
+ const { getByTestId } = render(
87
+ <Pill color="surface-moderate" data-testid="test-id">
88
+ pill
89
+ </Pill>,
90
+ );
91
+ expect(getByTestId("test-id")).toHaveClass("surface-moderate");
42
92
  });
43
93
 
44
- it("has white class when color is white", () => {
94
+ it("has surface-contrast class when color is surface-contrast", () => {
45
95
  const { getByTestId } = render(
46
- <Pill color="white" data-testid="test-id">
96
+ <Pill color="surface-contrast" data-testid="test-id">
47
97
  pill
48
98
  </Pill>,
49
99
  );
50
- expect(getByTestId("test-id")).toHaveClass("pill--white");
100
+ expect(getByTestId("test-id")).toHaveClass("surface-contrast");
51
101
  });
52
102
 
53
- it("has gray class when color is gray", () => {
103
+ it("has surface-accent class when color is surface-accent", () => {
54
104
  const { getByTestId } = render(
55
- <Pill color="gray" data-testid="test-id">
105
+ <Pill color="surface-accent" data-testid="test-id">
56
106
  pill
57
107
  </Pill>,
58
108
  );
59
- expect(getByTestId("test-id")).toHaveClass("pill--gray");
109
+ expect(getByTestId("test-id")).toHaveClass("surface-accent");
60
110
  });
61
111
 
62
112
  it("has transparent class when color is transparent", () => {
@@ -65,11 +115,19 @@ describe("rendering Pill", () => {
65
115
  pill
66
116
  </Pill>,
67
117
  );
68
- expect(getByTestId("test-id")).toHaveClass("pill--transparent");
118
+ expect(getByTestId("test-id")).toHaveClass("transparent");
69
119
  });
70
120
 
71
121
  it("supports all available colors", () => {
72
- const colors = ["white", "gray", "transparent"];
122
+ const colors = [
123
+ "surface-secondary",
124
+ "surface-tertiary",
125
+ "surface-subtle",
126
+ "surface-moderate",
127
+ "surface-contrast",
128
+ "surface-accent",
129
+ "transparent",
130
+ ];
73
131
 
74
132
  colors.forEach((color) => {
75
133
  const { getByTestId } = render(
@@ -78,7 +136,7 @@ describe("rendering Pill", () => {
78
136
  </Pill>,
79
137
  );
80
138
 
81
- expect(getByTestId(`test-${color}`)).toHaveClass(`pill--${color}`);
139
+ expect(getByTestId(`test-${color}`)).toHaveClass(color);
82
140
  });
83
141
  });
84
142
 
@@ -14,7 +14,7 @@ interface PromoBannerProps {
14
14
  children?: React.ReactNode;
15
15
  itemClassName?: string;
16
16
  imageClassName?: string;
17
- variant?: "vertical";
17
+ variant?: "vertical" | "reverse";
18
18
  }
19
19
 
20
20
  const CLASS_ROOT = "promo-banner";
@@ -40,6 +40,23 @@ export const PromoBanner = ({
40
40
  );
41
41
  return (
42
42
  <Grid className={classes}>
43
+ {variant === "reverse" && image && (
44
+ <GridCol
45
+ size={{ xs: 12, md: 6 }}
46
+ className={cx(
47
+ `${CLASS_ROOT}__image`,
48
+ "align-center align-md-left",
49
+ imageClassName,
50
+ )}
51
+ >
52
+ <Image
53
+ src={image}
54
+ alt="Obrázok"
55
+ className={cx("mb-none", { fullwidth: imageFullWidth })}
56
+ />
57
+ </GridCol>
58
+ )}
59
+
43
60
  <GridCol
44
61
  size={
45
62
  variant === "vertical"
@@ -58,7 +75,7 @@ export const PromoBanner = ({
58
75
  {children}
59
76
  </GridCol>
60
77
 
61
- {image && (
78
+ {image && variant !== "reverse" && (
62
79
  <GridCol
63
80
  size={variant === "vertical" ? { xs: 12 } : { xs: 12, md: 6 }}
64
81
  className={cx(
@@ -12,7 +12,7 @@
12
12
 
13
13
  @include breakpoint.get("md", "down") {
14
14
  padding-top: space.get("large");
15
- padding-bottom: space.get("medium");
15
+ padding-bottom: space.get("large");
16
16
  }
17
17
 
18
18
  display: flex;
@@ -178,6 +178,16 @@ describe("PromoBanner Component Conformance Tests", () => {
178
178
  );
179
179
  expect(container).toHTMLValidate();
180
180
  });
181
+
182
+ it("is valid HTML with reverse variant", () => {
183
+ const { container } = render(
184
+ <PromoBanner variant="reverse" image="https://example.com/reverse.jpg">
185
+ <h2>Reverse Layout</h2>
186
+ <p>Content with reverse layout</p>
187
+ </PromoBanner>,
188
+ );
189
+ expect(container).toHTMLValidate();
190
+ });
181
191
  });
182
192
 
183
193
  describe("Accessibility (A11y)", () => {
@@ -307,6 +317,17 @@ describe("PromoBanner Component Conformance Tests", () => {
307
317
  );
308
318
  expect(await axe(container)).toHaveNoViolations();
309
319
  });
320
+
321
+ it("is accessible with reverse variant", async () => {
322
+ const { container } = render(
323
+ <PromoBanner variant="reverse" image="https://example.com/test.jpg">
324
+ <h2>Accessible Reverse Layout</h2>
325
+ <p>This content is accessible in reverse layout</p>
326
+ <button type="button">Action Button</button>
327
+ </PromoBanner>,
328
+ );
329
+ expect(await axe(container)).toHaveNoViolations();
330
+ });
310
331
  });
311
332
 
312
333
  describe("Functional Behavior", () => {
@@ -343,6 +364,11 @@ describe("PromoBanner Component Conformance Tests", () => {
343
364
  const { container: verticalContainer } = render(
344
365
  <PromoBanner variant="vertical">Vertical Content</PromoBanner>,
345
366
  );
367
+ const { container: reverseContainer } = render(
368
+ <PromoBanner variant="reverse" image="test.jpg">
369
+ Reverse Content
370
+ </PromoBanner>,
371
+ );
346
372
 
347
373
  const horizontalItem = horizontalContainer.querySelector(
348
374
  ".promo-banner__item",
@@ -350,6 +376,7 @@ describe("PromoBanner Component Conformance Tests", () => {
350
376
  const verticalItem = verticalContainer.querySelector(
351
377
  ".promo-banner__item",
352
378
  );
379
+ const reverseItem = reverseContainer.querySelector(".promo-banner__item");
353
380
 
354
381
  expect(horizontalItem).not.toHaveClass(
355
382
  "align-items-center",
@@ -361,6 +388,11 @@ describe("PromoBanner Component Conformance Tests", () => {
361
388
  "align-center",
362
389
  "align-self-center",
363
390
  );
391
+ expect(reverseItem).not.toHaveClass(
392
+ "align-items-center",
393
+ "align-center",
394
+ "align-self-center",
395
+ );
364
396
  });
365
397
 
366
398
  it("applies image-related classes correctly", () => {
@@ -217,6 +217,58 @@ describe("PromoBanner", () => {
217
217
  expect(imageElement).toHaveClass("align-center");
218
218
  });
219
219
  });
220
+
221
+ describe("reverse variant", () => {
222
+ it("applies reverse variant column layout", () => {
223
+ render(
224
+ <PromoBanner variant="reverse" image="test.jpg">
225
+ Content
226
+ </PromoBanner>,
227
+ );
228
+ const contentCol = document
229
+ .querySelector(".promo-banner__item")
230
+ .closest(".grid__col");
231
+ const imageCol = document
232
+ .querySelector(".promo-banner__image")
233
+ .closest(".grid__col");
234
+ expect(contentCol).toHaveClass("grid__col");
235
+ expect(imageCol).toHaveClass("grid__col");
236
+ });
237
+
238
+ it("renders image before content in DOM order", () => {
239
+ render(
240
+ <PromoBanner variant="reverse" image="test.jpg">
241
+ Content
242
+ </PromoBanner>,
243
+ );
244
+ const grid = document.querySelector(".grid");
245
+ const children = Array.from(grid.children);
246
+ const imageCol = document
247
+ .querySelector(".promo-banner__image")
248
+ .closest(".grid__col");
249
+ const contentCol = document
250
+ .querySelector(".promo-banner__item")
251
+ .closest(".grid__col");
252
+
253
+ expect(children.indexOf(imageCol)).toBeLessThan(
254
+ children.indexOf(contentCol),
255
+ );
256
+ });
257
+
258
+ it("does not apply vertical-specific classes", () => {
259
+ render(
260
+ <PromoBanner variant="reverse" image="test.jpg">
261
+ Content
262
+ </PromoBanner>,
263
+ );
264
+ const item = document.querySelector(".promo-banner__item");
265
+ expect(item).not.toHaveClass(
266
+ "align-items-center",
267
+ "align-center",
268
+ "align-self-center",
269
+ );
270
+ });
271
+ });
220
272
  });
221
273
 
222
274
  describe("image", () => {
@@ -14,8 +14,9 @@ interface RowProps {
14
14
  }
15
15
 
16
16
  const Row = ({ row }: RowProps) => {
17
- const { headers, expandableRows } = React.useContext(TableContext);
18
- return headers.map(({ key, cellProps }, index, array) => {
17
+ const { headers, expandableRows, isResponsive } =
18
+ React.useContext(TableContext);
19
+ return headers.map(({ key, label, cellProps }, index, array) => {
19
20
  const cell = row[key];
20
21
  const isObject = typeof cell === "object" && cell !== null;
21
22
  const value = isObject && "value" in cell ? cell.value : cell;
@@ -26,9 +27,14 @@ const Row = ({ row }: RowProps) => {
26
27
  .reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {})
27
28
  : {};
28
29
  const rl = row?.expand?.length || 0;
30
+
29
31
  return (
30
32
  <React.Fragment key={key}>
31
- <Cell {...cellProps} {...props}>
33
+ <Cell
34
+ {...cellProps}
35
+ {...props}
36
+ {...(isResponsive && { "data-label": label })}
37
+ >
32
38
  {value ? (value as React.ReactNode) : ""}
33
39
  </Cell>
34
40
  {index === array.length - 1 &&
@@ -23,6 +23,8 @@ interface TableProps extends React.TableHTMLAttributes<HTMLTableElement> {
23
23
  headers: TableHeader[];
24
24
  /** Compact table only takes spaced needed to display its content */
25
25
  isCompact?: boolean;
26
+ /** Enable responsive card layout below md breakpoint for better accessibility */
27
+ isResponsive?: boolean;
26
28
  /** If table has horizontal scrollbar */
27
29
  isScrollable?: boolean;
28
30
  /** Different colors for even and odd rows. */
@@ -43,6 +45,7 @@ const Table: React.FC<TableProps> = ({
43
45
  rows,
44
46
  footers,
45
47
  isCompact,
48
+ isResponsive,
46
49
  isStriped,
47
50
  isScrollable,
48
51
  colorScheme,
@@ -60,6 +63,7 @@ const Table: React.FC<TableProps> = ({
60
63
  {
61
64
  [`${CLASS_ROOT}--striped`]: isStriped,
62
65
  [`${CLASS_ROOT}--compact`]: isCompact,
66
+ [`${CLASS_ROOT}--responsive`]: isResponsive,
63
67
  "is-dark": colorScheme === "dark",
64
68
  "is-light": colorScheme === "light",
65
69
  },
@@ -94,6 +98,7 @@ const Table: React.FC<TableProps> = ({
94
98
  footers,
95
99
  rows: customRows,
96
100
  expandableRows,
101
+ isResponsive,
97
102
  };
98
103
 
99
104
  const table = (
@@ -108,7 +113,12 @@ const Table: React.FC<TableProps> = ({
108
113
  />
109
114
  }
110
115
  >
111
- <table ref={tableRef} className={classes} {...other}>
116
+ <table
117
+ ref={tableRef}
118
+ className={classes}
119
+ {...(isResponsive && { "data-table": "responsive" })}
120
+ {...other}
121
+ >
112
122
  {caption && (
113
123
  <caption {...(isScrollable && { id: captionId })}>
114
124
  {caption}
@@ -6,6 +6,7 @@ import { TableContextType } from "./types";
6
6
  const TableContext = React.createContext<TableContextType>({
7
7
  headers: [],
8
8
  rows: [],
9
+ isResponsive: false,
9
10
  });
10
11
 
11
12
  export default TableContext;
@@ -208,3 +208,28 @@ export const fillRows: TableRow[] = [
208
208
  col2: "3",
209
209
  },
210
210
  ];
211
+
212
+ export const responsiveHeaders: TableHeader[] = [
213
+ {
214
+ key: "account",
215
+ label: "Účel spracovania",
216
+ },
217
+ {
218
+ key: "legal",
219
+ label: "Právny základ a doba spracovania",
220
+ },
221
+ ];
222
+
223
+ export const responsiveRows: TableRow[] = [
224
+ {
225
+ account: "Mesačný poplatok (bez Digitálnej odmeny)",
226
+ legal:
227
+ "Právny základ - Súhlas (čl. 6 ods. 1 písm. a) GDPR) a zmluva (čl. 6 ods. 1 písm. b) GDPR) a oprávnený záujem (čl. 6 ods. 1 písm. f) GDPR). Všeobecná doba uchovávania – Počas trvania zmluvného vzťahu.",
228
+ },
229
+ {
230
+ account:
231
+ "Online predaj tovarov a poskytovanie doplnkových a asistenčných služieb",
232
+ legal:
233
+ "Právny základ - Zmluva (čl. 6 ods. 1 písm. b) GDPR) a oprávnený záujem (čl. 6 ods. 1 písm. f) GDPR). Všeobecná doba uchovávania – Počas trvania zmluvného vzťahu a uplynutia záručnej doby na predaný tovar.",
234
+ },
235
+ ];
@@ -7,11 +7,10 @@
7
7
  width: 100%;
8
8
  margin-bottom: space.get();
9
9
  color: var(--color-text-default);
10
- background-color: var(--color-background-primary);
11
10
  }
12
11
 
13
12
  @mixin cells {
14
- padding: space.get("small") space.get("small") space.get("small") 0;
13
+ padding: space.get("medium");
15
14
  vertical-align: middle;
16
15
  font-size: inherit;
17
16
  line-height: inherit;
@@ -20,7 +19,7 @@
20
19
  @mixin header-cells {
21
20
  vertical-align: bottom;
22
21
  text-align: left;
23
- border-bottom: config.$fat-border-size solid var(--color-border-strong);
22
+ border-bottom: config.$fat-border-size solid var(--color-border-contrast);
24
23
  font-weight: 700;
25
24
  }
26
25
 
@@ -38,7 +37,7 @@
38
37
  }
39
38
 
40
39
  @mixin rows-first-cell {
41
- padding-left: space.get("small");
40
+ padding-left: 0;
42
41
  }
43
42
 
44
43
  @mixin body-sibling {
@@ -113,3 +112,40 @@
113
112
  @mixin compact {
114
113
  width: auto;
115
114
  }
115
+
116
+ @mixin responsive-table {
117
+ thead {
118
+ display: none;
119
+ }
120
+
121
+ tbody,
122
+ tbody tr,
123
+ tbody td {
124
+ display: block;
125
+ }
126
+
127
+ tbody tr {
128
+ padding: space.get("small") 0;
129
+
130
+ &:last-child {
131
+ margin-bottom: 0;
132
+ }
133
+ }
134
+
135
+ tbody td {
136
+ padding: space.get("medium") 0;
137
+ border-bottom: none;
138
+ text-align: left !important;
139
+
140
+ &:before {
141
+ content: attr(data-label);
142
+ display: block;
143
+ font-weight: 700;
144
+ margin-bottom: space.get("xsmall");
145
+ }
146
+
147
+ &:first-child {
148
+ padding-left: 0;
149
+ }
150
+ }
151
+ }
@@ -47,6 +47,12 @@
47
47
  @include mixins.compact;
48
48
  }
49
49
 
50
+ &--responsive {
51
+ @include breakpoint.get("md", "down") {
52
+ @include mixins.responsive-table;
53
+ }
54
+ }
55
+
50
56
  @each $breakpoint in ("default", "sm", "md", "lg", "xl", "xxl") {
51
57
  @include breakpoint.get($breakpoint, "down") {
52
58
  &-scrollable#{generate.variant-name($breakpoint)} {
@@ -37,4 +37,5 @@ export interface TableContextType {
37
37
  rows: TableRow[];
38
38
  footers?: TableRow[];
39
39
  expandableRows?: ExpandableRows;
40
+ isResponsive?: boolean;
40
41
  }
@@ -2,11 +2,25 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ### Breaking Changes
6
+
7
+ - **Refactored color prop**: The `color` prop now uses global utility classes instead of component-specific color modifiers:
8
+ - Old: `color="white"` applied `.tile--white` class with custom CSS
9
+ - New: Uses global classes like `surface-primary`, `surface-secondary`, `background-contrast`, etc.
10
+ - Removed `"default"` and `"white"` color options
11
+ - Added support for: `"surface-primary"`, `"surface-secondary"`, `"surface-tertiary"`, `"surface-subtle"`, `"surface-moderate"`, `"surface-contrast"`, `"background-primary"`, `"background-secondary"`, `"background-contrast"`, `"background-accent"`
12
+
13
+ ### Migration Guide
14
+
15
+ - Replace `color="white"` with `color="surface-primary"`
16
+ - Replace any custom styling that relied on `.tile--white` with global surface utility classes
17
+ - The new color system provides consistent styling across all components in the design system
18
+
5
19
  ### Changed
6
20
 
7
21
  - Update `Tile` component documentation and usage examples:
8
22
  - Expanded usage examples in `Tile.mdx` and `/app/components/tile/page.mdx` to demonstrate:
9
- - New color options (including `black`)
23
+ - New color options using global utility classes
10
24
  - Background image and icon support
11
25
  - Alignment options with `hAlign` and `vAlign` props
12
26
  - Block link and action variants
@@ -5,7 +5,12 @@ import { Image } from "../Image";
5
5
  import { Icon } from "../Icon";
6
6
  import { IconProps } from "../Icon/Icon";
7
7
 
8
- export type TileColor = "default" | "white";
8
+ export const tileColors = [
9
+ "surface-primary",
10
+ "surface-subtle",
11
+ "surface-contrast",
12
+ ] as const;
13
+ export type TileColor = (typeof tileColors)[number];
9
14
  export type TileHAlign = "center";
10
15
  export type TileVAlign = "center" | "end" | "space-between";
11
16
 
@@ -35,7 +40,7 @@ const Tile: React.FC<TileProps> = ({
35
40
  backgroundImage,
36
41
  vAlign,
37
42
  hAlign,
38
- color = "default",
43
+ color,
39
44
  space,
40
45
  ...other
41
46
  }) => {
@@ -43,7 +48,10 @@ const Tile: React.FC<TileProps> = ({
43
48
  CLASS_ROOT,
44
49
  {
45
50
  [`${CLASS_ROOT}--${variant}`]: variant,
46
- [`tile--${color}`]: color !== "default",
51
+ ...(color && color !== "surface-contrast" ? { [color]: true } : {}),
52
+ ...(color === "surface-contrast"
53
+ ? { [`${color} text-inverse`]: true }
54
+ : {}),
47
55
  },
48
56
  className,
49
57
  );
@@ -1,17 +1,6 @@
1
1
  @use "../../../styles/tokens/space";
2
2
  @use "../../../styles/tools/convert";
3
3
 
4
- $colors: (
5
- default: (
6
- background-color: transparent,
7
- color: var(--color-text-default),
8
- ),
9
- white: (
10
- background-color: var(--color-surface-primary),
11
- color: var(--color-text-default),
12
- ),
13
- );
14
-
15
4
  $spacing: (
16
5
  xs: convert.to-rem(15px),
17
6
  md: space.get("large"),
@@ -1,5 +1,3 @@
1
- @use "../../../styles/tools/generate";
2
- @use "./config";
3
1
  @use "./mixins";
4
2
 
5
3
  @layer components {
@@ -10,8 +8,6 @@
10
8
  @include mixins.tile-image-aspect;
11
9
  }
12
10
 
13
- @include generate.variants(config.$colors);
14
-
15
11
  &::after {
16
12
  content: "";
17
13
  position: absolute;
@@ -87,11 +87,18 @@ describe("rendering Tile", () => {
87
87
  expect(container.querySelector("img")).toHaveClass("tile__bg");
88
88
  expect(container.querySelector("img")).toHaveClass("test-class");
89
89
  });
90
- it("has class tile--black when color is set to black", () => {
90
+ it("has surface class when color prop is set", () => {
91
91
  const { getByTestId } = render(
92
- <Tile data-testid="test-id" color="black" />,
92
+ <Tile data-testid="test-id" color="surface-secondary" />,
93
93
  );
94
- expect(getByTestId("test-id")).toHaveClass("tile--black");
94
+ expect(getByTestId("test-id")).toHaveClass("surface-secondary");
95
+ });
96
+ it("applies surface-contrast and text-inverse classes when color is surface-contrast", () => {
97
+ const { getByTestId } = render(
98
+ <Tile data-testid="test-id" color="surface-contrast" />,
99
+ );
100
+ expect(getByTestId("test-id")).toHaveClass("surface-contrast");
101
+ expect(getByTestId("test-id")).toHaveClass("text-inverse");
95
102
  });
96
103
  it("applies hAlign and vAlign classes to body", () => {
97
104
  const { getByTestId } = render(
@@ -26,11 +26,7 @@ const InfoTooltip: React.FC<InfoTooltipProps> = ({
26
26
  )}
27
27
  {...other}
28
28
  >
29
- <Icon
30
- name="assistance"
31
- color="info"
32
- className={cx(`${CLASS_ROOT}__icon`, className)}
33
- />
29
+ <Icon name="assistance" className={cx(`${CLASS_ROOT}__icon`, className)} />
34
30
  <span className="sr-only">Info</span>
35
31
  </Tooltip>
36
32
  );
@@ -4,6 +4,8 @@
4
4
 
5
5
  // Consider to add more conditions for light and dark themes
6
6
  :root,
7
+ :host,
8
+ :host(.is-light),
7
9
  .is-light,
8
10
  .bg-white,
9
11
  #root.is-light,
@@ -16,6 +18,7 @@
16
18
  color: var(--color-text-default);
17
19
  }
18
20
 
21
+ :host(.is-dark),
19
22
  .is-dark,
20
23
  .bg-black,
21
24
  #root.is-dark,
@@ -28,13 +31,15 @@
28
31
  color: var(--color-text-default);
29
32
  }
30
33
 
31
- :root {
34
+ :root,
35
+ :host {
32
36
  --extra-scroll-margin: 0;
33
37
  --header-height: 80px;
34
38
  }
35
39
 
36
40
  @media screen and (min-width: 992px) {
37
- :root {
41
+ :root,
42
+ :host {
38
43
  --header-height: 120px;
39
44
  }
40
45
  }
@@ -112,7 +112,7 @@ $colors-dark: (
112
112
  $orange: map.get($colors-light, icon-brand);
113
113
  $orange-dark: map.get($colors-light, surface-tertiary);
114
114
  $black: map.get($colors-light, icon-default);
115
- $white: map.get($colors-light, icon-inverse);
115
+ $white: map.get($colors-light, text-inverse);
116
116
  $blue: map.get($colors-light, fill-accent1);
117
117
  $green: map.get($colors-light, fill-accent2);
118
118
  $pink: map.get($colors-light, fill-accent3);