@orangesk/orange-design-system 2.0.0-beta.46 → 2.0.0-beta.48

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 (129) hide show
  1. package/build/components/BlockAction/style.css +1 -1
  2. package/build/components/BlockAction/style.css.map +1 -1
  3. package/build/components/Breadcrumbs/style.css +1 -1
  4. package/build/components/Breadcrumbs/style.css.map +1 -1
  5. package/build/components/Carousel/style.css +1 -1
  6. package/build/components/Carousel/style.css.map +1 -1
  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/Icon/style.css +1 -1
  12. package/build/components/Icon/style.css.map +1 -1
  13. package/build/components/Link/style.css +1 -1
  14. package/build/components/Link/style.css.map +1 -1
  15. package/build/components/Loader/style.css +1 -1
  16. package/build/components/Loader/style.css.map +1 -1
  17. package/build/components/Megamenu/style.css +1 -1
  18. package/build/components/Megamenu/style.css.map +1 -1
  19. package/build/components/Pagination/style.css +1 -1
  20. package/build/components/Pagination/style.css.map +1 -1
  21. package/build/components/PromotionCard/style.css +1 -1
  22. package/build/components/PromotionCard/style.css.map +1 -1
  23. package/build/components/Section/style.css +1 -1
  24. package/build/components/Section/style.css.map +1 -1
  25. package/build/components/SocialButton/style.css +1 -1
  26. package/build/components/SocialButton/style.css.map +1 -1
  27. package/build/components/Stepbar/style.css +1 -1
  28. package/build/components/Stepbar/style.css.map +1 -1
  29. package/build/components/Table/style.css +1 -1
  30. package/build/components/Table/style.css.map +1 -1
  31. package/build/components/Tabs/style.css +1 -1
  32. package/build/components/Tabs/style.css.map +1 -1
  33. package/build/components/Tag/style.css +1 -1
  34. package/build/components/Tag/style.css.map +1 -1
  35. package/build/components/Tile/style.css +1 -1
  36. package/build/components/Tile/style.css.map +1 -1
  37. package/build/components/index.js +1 -1
  38. package/build/components/index.js.map +1 -1
  39. package/build/components/tsconfig.tsbuildinfo +1 -1
  40. package/build/components/types/index.d.ts +4 -15
  41. package/build/components/types/src/components/Carousel/Carousel.static.d.ts +4 -1
  42. package/build/components/types/src/components/Forms/Autocomplete/Autocomplete.static.d.ts +11 -0
  43. package/build/components/types/src/components/Forms/Group/Group.d.ts +1 -1
  44. package/build/components/types/src/components/Preview/CodeExample.d.ts +1 -0
  45. package/build/components/types/src/components/Preview/PreviewGenerator.d.ts +1 -0
  46. package/build/components/types/src/components/Preview/getElementDisplayName.d.ts +1 -0
  47. package/build/components/types/src/components/Tabs/Tabs.d.ts +0 -4
  48. package/build/components/types/src/components/Tabs/Tabs.static.d.ts +12 -0
  49. package/build/components/types/src/components/Tile/Tile.d.ts +3 -11
  50. package/build/lib/base.css +1 -1
  51. package/build/lib/base.css.map +1 -1
  52. package/build/lib/components.css +1 -1
  53. package/build/lib/components.css.map +1 -1
  54. package/build/lib/footer.css +1 -1
  55. package/build/lib/footer.css.map +1 -1
  56. package/build/lib/megamenu.css +1 -1
  57. package/build/lib/megamenu.css.map +1 -1
  58. package/build/lib/scripts.js +1 -1
  59. package/build/lib/scripts.js.map +1 -1
  60. package/build/lib/style.css +1 -1
  61. package/build/lib/style.css.map +1 -1
  62. package/build/lib/tsconfig.tsbuildinfo +1 -1
  63. package/build/lib/utilities.css +1 -1
  64. package/build/lib/utilities.css.map +1 -1
  65. package/build/search-index.json +6 -6
  66. package/package.json +24 -24
  67. package/src/components/BlockAction/styles/style.scss +6 -4
  68. package/src/components/Breadcrumbs/styles/mixins.scss +15 -8
  69. package/src/components/Breadcrumbs/styles/style.scss +2 -1
  70. package/src/components/Carousel/Carousel.static.ts +29 -1
  71. package/src/components/Carousel/styles/mixins.scss +22 -2
  72. package/src/components/Carousel/tests/Carousel.static.test.jsx +50 -0
  73. package/src/components/DocumentationSidebar/DocumentationSidebar.tsx +21 -34
  74. package/src/components/DocumentationSidebar/styles/style.scss +0 -6
  75. package/src/components/Footer/styles/mixins.scss +2 -1
  76. package/src/components/Forms/Autocomplete/Autocomplete.static.ts +190 -14
  77. package/src/components/Forms/Autocomplete/styles/style.scss +61 -8
  78. package/src/components/Forms/Autocomplete/tests/Autocomplete.static.test.ts +187 -0
  79. package/src/components/Forms/Checkbox/styles/style.scss +13 -6
  80. package/src/components/Forms/DatePicker/styles/style.scss +1 -2
  81. package/src/components/Forms/Group/Group.tsx +4 -1
  82. package/src/components/Forms/Group/styles/config.scss +1 -1
  83. package/src/components/Forms/Group/styles/mixins.scss +17 -0
  84. package/src/components/Forms/Group/tests/Group.unit.test.jsx +9 -0
  85. package/src/components/Forms/InputStepper/styles/style.scss +15 -8
  86. package/src/components/Forms/TextArea/styles/config.scss +1 -0
  87. package/src/components/Forms/TextArea/styles/mixins.scss +7 -1
  88. package/src/components/Forms/TextInput/styles/config.scss +3 -1
  89. package/src/components/Forms/TextInput/styles/mixins.scss +7 -1
  90. package/src/components/Forms/TextInput/styles/style.scss +17 -12
  91. package/src/components/Forms/styles/config.scss +3 -2
  92. package/src/components/Icon/styles/style.scss +2 -1
  93. package/src/components/Link/styles/mixins.scss +0 -1
  94. package/src/components/Loader/styles/style.scss +0 -2
  95. package/src/components/Megamenu/Megamenu.tsx +2 -2
  96. package/src/components/Megamenu/MegamenuBlog.tsx +2 -2
  97. package/src/components/Megamenu/styles/mixins.scss +20 -12
  98. package/src/components/Pagination/styles/mixins.scss +8 -6
  99. package/src/components/Pagination/styles/style.scss +0 -4
  100. package/src/components/Preview/CodeExample.tsx +66 -25
  101. package/src/components/Preview/Preview.tsx +26 -13
  102. package/src/components/Preview/PreviewGenerator.tsx +72 -34
  103. package/src/components/Preview/getElementDisplayName.ts +25 -0
  104. package/src/components/PromotionCard/styles/mixins.scss +2 -1
  105. package/src/components/Section/styles/mixins.scss +27 -5
  106. package/src/components/SocialButton/styles/config.scss +2 -2
  107. package/src/components/Stepbar/styles/config.scss +34 -17
  108. package/src/components/Stepbar/styles/mixins.scss +5 -3
  109. package/src/components/Stepbar/styles/style.scss +4 -2
  110. package/src/components/Table/styles/mixins.scss +6 -3
  111. package/src/components/Tabs/Tabs.static.ts +157 -30
  112. package/src/components/Tabs/Tabs.tsx +62 -67
  113. package/src/components/Tabs/styles/config.scss +18 -25
  114. package/src/components/Tabs/styles/mixins.scss +93 -28
  115. package/src/components/Tabs/styles/style.scss +4 -15
  116. package/src/components/Tabs/tests/Tabs.unit.test.jsx +111 -0
  117. package/src/components/Tag/styles/config.scss +1 -1
  118. package/src/components/Tag/styles/style.scss +22 -5
  119. package/src/components/Tile/Tile.tsx +18 -42
  120. package/src/components/Tile/styles/mixins.scss +45 -47
  121. package/src/components/Tile/styles/style.scss +5 -17
  122. package/src/components/Tile/tests/Tile.unit.test.jsx +9 -78
  123. package/src/styles/base/globals.scss +2 -0
  124. package/src/styles/tokens/color-vars.scss +0 -2
  125. package/src/styles/utilities/color.scss +0 -153
  126. package/src/styles/utilities/horizontal-scroll.scss +7 -2
  127. package/src/styles/utilities/text.scss +0 -1
  128. package/src/components/Tile/CHANGELOG.md +0 -28
  129. package/src/components/Tile/styles/config.scss +0 -7
@@ -5,6 +5,10 @@
5
5
  @use "../../../styles/typography/mixins" as typography;
6
6
 
7
7
  @layer components {
8
+ .tab-list__viewport {
9
+ @include mixins.list-viewport;
10
+ }
11
+
8
12
  .tab-list {
9
13
  $this: &;
10
14
 
@@ -21,10 +25,6 @@
21
25
  #{$this}--equal & {
22
26
  @include mixins.list-equal-item;
23
27
  }
24
-
25
- #{$this}--light & {
26
- @include mixins.underline-light;
27
- }
28
28
  }
29
29
 
30
30
  &__tab {
@@ -36,21 +36,10 @@
36
36
  @include mixins.tab-size($size);
37
37
  }
38
38
  }
39
- #{$this}--light & {
40
- @include mixins.tab-light;
41
- }
42
-
43
- #{$this}--light#{$this}--equal & {
44
- @include mixins.tab-centered;
45
- }
46
39
  }
47
40
 
48
41
  &__hr {
49
42
  @include mixins.underline;
50
-
51
- #{$this}--light & {
52
- @include mixins.underline-light;
53
- }
54
43
  }
55
44
  }
56
45
  }
@@ -2,6 +2,7 @@ import { fireEvent, render, screen } from "@testing-library/react";
2
2
  import userEvent from "@testing-library/user-event";
3
3
  import { TabPanel } from "../TabPanel";
4
4
  import { Tabs } from "../Tabs";
5
+ import TabsStatic from "../Tabs.static";
5
6
 
6
7
  const arr = [1, 2, 3, 4];
7
8
 
@@ -98,6 +99,116 @@ describe("rendering Tabs", () => {
98
99
  }
99
100
  }
100
101
  });
102
+
103
+ it("toggles left and right overflow classes based on scroll position", () => {
104
+ const { getByTestId } = render(<TabsExample />);
105
+ const tabList = getByTestId("test-id");
106
+ const viewport = tabList.parentElement;
107
+ const tabsStatic = TabsStatic.getInstance(tabList);
108
+
109
+ let scrollLeft = 0;
110
+ Object.defineProperty(tabList, "clientWidth", {
111
+ configurable: true,
112
+ value: 200,
113
+ });
114
+ Object.defineProperty(tabList, "scrollWidth", {
115
+ configurable: true,
116
+ value: 500,
117
+ });
118
+ Object.defineProperty(tabList, "scrollLeft", {
119
+ configurable: true,
120
+ get: () => scrollLeft,
121
+ set: (value) => {
122
+ scrollLeft = value;
123
+ },
124
+ });
125
+
126
+ tabsStatic?.update();
127
+
128
+ expect(viewport).not.toHaveClass("has-left-overflow");
129
+ expect(viewport).toHaveClass("has-right-overflow");
130
+
131
+ scrollLeft = 300;
132
+ fireEvent.scroll(tabList);
133
+
134
+ expect(viewport).toHaveClass("has-left-overflow");
135
+ expect(viewport).not.toHaveClass("has-right-overflow");
136
+ });
137
+
138
+ it("centers clicked active tab inside the scroll container", () => {
139
+ const { getByTestId, container } = render(<TabsExample />);
140
+ const tabList = getByTestId("test-id");
141
+ const secondTab = container.querySelector(
142
+ 'button[aria-controls="tabpanel-2"]',
143
+ );
144
+ const scrollToSpy = vi.fn();
145
+
146
+ Object.defineProperty(tabList, "clientWidth", {
147
+ configurable: true,
148
+ value: 200,
149
+ });
150
+ Object.defineProperty(tabList, "scrollWidth", {
151
+ configurable: true,
152
+ value: 600,
153
+ });
154
+ Object.defineProperty(tabList, "scrollLeft", {
155
+ configurable: true,
156
+ value: 180,
157
+ writable: true,
158
+ });
159
+ Object.defineProperty(tabList, "getBoundingClientRect", {
160
+ configurable: true,
161
+ value: () => ({
162
+ top: 0,
163
+ bottom: 0,
164
+ left: 0,
165
+ right: 200,
166
+ width: 200,
167
+ height: 0,
168
+ x: 0,
169
+ y: 0,
170
+ toJSON: () => ({}),
171
+ }),
172
+ });
173
+ Object.defineProperty(secondTab, "getBoundingClientRect", {
174
+ configurable: true,
175
+ value: () => ({
176
+ top: 0,
177
+ bottom: 0,
178
+ left: 40,
179
+ right: 120,
180
+ width: 80,
181
+ height: 0,
182
+ x: 40,
183
+ y: 0,
184
+ toJSON: () => ({}),
185
+ }),
186
+ });
187
+ tabList.scrollTo = scrollToSpy;
188
+
189
+ fireEvent.click(secondTab);
190
+
191
+ expect(scrollToSpy).toHaveBeenCalledWith({
192
+ left: 160,
193
+ behavior: "smooth",
194
+ });
195
+ });
196
+
197
+ it("does not center on pointer-style focus before click activation", () => {
198
+ const { getByTestId, container } = render(<TabsExample />);
199
+ const tabList = getByTestId("test-id");
200
+ const secondTab = container.querySelector(
201
+ 'button[aria-controls="tabpanel-2"]',
202
+ );
203
+ const scrollToSpy = vi.fn();
204
+
205
+ secondTab.matches = vi.fn((selector) => selector !== ":focus-visible");
206
+ tabList.scrollTo = scrollToSpy;
207
+
208
+ fireEvent.focus(secondTab);
209
+
210
+ expect(scrollToSpy).not.toHaveBeenCalled();
211
+ });
101
212
  });
102
213
  describe("checking fireEvents", () => {
103
214
  it("click in disabled tab button doesnt cause change", () => {
@@ -38,7 +38,7 @@ $icon-sizes: (
38
38
  padding: convert.to-rem(7px),
39
39
  ),
40
40
  large: (
41
- padding: convert.to-rem(9.5px),
41
+ padding: convert.to-rem(8px),
42
42
  ),
43
43
  );
44
44
 
@@ -51,11 +51,6 @@
51
51
  }
52
52
  }
53
53
  }
54
-
55
- // TODO: This is a temporary solution to make transparent tags work on gray backgrounds, we need to find a better way to handle this in the future.
56
- &--transparent {
57
- background-color: var(--color-surface-primary);
58
- }
59
54
  }
60
55
 
61
56
  // Transparent class is a special variant of color, it's not possible to make transparent variant for each color at the moment.
@@ -121,6 +116,28 @@
121
116
  border-radius: 9999px;
122
117
  z-index: 2;
123
118
 
119
+ .background-secondary & {
120
+ background-color: var(--color-border-strong);
121
+
122
+ &:not([disabled]):not([aria-disabled="true"]) {
123
+ &:focus-visible,
124
+ &:hover {
125
+ background-color: color.$gray-600;
126
+ }
127
+
128
+ &:active,
129
+ &.is-active {
130
+ color: var(--color-text-inverse);
131
+ background-color: var(--color-background-contrast);
132
+ }
133
+ }
134
+
135
+ &[aria-disabled="true"],
136
+ &[disabled] {
137
+ background-color: var(--color-border-strong);
138
+ }
139
+ }
140
+
124
141
  @each $name, $props in config.$icon-sizes {
125
142
  &#{generate.variant-name($name)} {
126
143
  $padding: sass-map.get($props, padding);
@@ -2,30 +2,18 @@ import cx from "classnames";
2
2
  import React, { ReactNode } from "react";
3
3
  import { Icon } from "../Icon";
4
4
  import { IconProps } from "../Icon/Icon";
5
- import { Image } from "../Image";
6
5
 
7
- export const tileColors = [
8
- "surface-primary",
9
- "surface-subtle",
10
- "surface-contrast",
11
- ] as const;
12
- export type TileColor = (typeof tileColors)[number];
13
6
  export type TileHAlign = "center";
14
7
  export type TileVAlign = "center" | "end" | "space-between";
8
+ export type TileVariant = "compact" | "action";
15
9
 
16
10
  export interface TileProps extends React.HTMLAttributes<HTMLDivElement> {
17
- /** Tile color. */
18
- color?: TileColor;
19
11
  /** Horizontal alignment of the tile content. */
20
12
  hAlign?: TileHAlign;
21
13
  /** Vertical alignment of the tile content. */
22
14
  vAlign?: TileVAlign;
23
- /** variant can be "image" or "action" */
24
- variant?: "image" | "action";
25
- /** Alt and src attributes are required */
26
- backgroundImage?: React.ComponentProps<typeof Image>;
27
- /** Use small spacing */
28
- space?: "small";
15
+ /** Tile variant. */
16
+ variant?: TileVariant;
29
17
  children?: ReactNode;
30
18
  className?: string;
31
19
  }
@@ -36,54 +24,42 @@ const Tile: React.FC<TileProps> = ({
36
24
  className,
37
25
  children,
38
26
  variant,
39
- backgroundImage,
40
27
  vAlign,
41
28
  hAlign,
42
- color,
43
- space,
44
29
  ...other
45
30
  }) => {
31
+ const isCompact = variant === "compact";
32
+ const isAction = variant === "action";
33
+
46
34
  const classesWrapper = cx(
47
35
  CLASS_ROOT,
48
36
  {
49
- [`${CLASS_ROOT}--${variant}`]: variant,
50
- ...(color && color !== "surface-contrast" ? { [color]: true } : {}),
51
- ...(color === "surface-contrast"
52
- ? { [`${color} text-inverse`]: true }
53
- : {}),
37
+ [`${CLASS_ROOT}--compact`]: isCompact,
38
+ [`${CLASS_ROOT}--action`]: isAction,
54
39
  },
55
40
  className,
56
41
  );
57
42
 
58
43
  const classesBody = cx(
59
44
  `${CLASS_ROOT}__body`,
60
- vAlign && `justify-content-${vAlign}`,
61
- hAlign && `align-items-${hAlign}`,
62
- space && `${CLASS_ROOT}__body--space-${space}`,
45
+ !isAction && vAlign && `justify-content-${vAlign}`,
46
+ !isAction && hAlign && `align-items-${hAlign}`,
63
47
  );
64
48
 
65
- const iconProps =
66
- variant === "action"
67
- ? ({
68
- name: "chevron-right",
69
- size: "medium",
70
- color: "orange",
71
- } as IconProps)
72
- : null;
49
+ const iconProps = isAction
50
+ ? ({
51
+ name: "chevron-right",
52
+ size: "medium",
53
+ color: "orange",
54
+ } as IconProps)
55
+ : null;
73
56
 
74
57
  return (
75
58
  <div className={classesWrapper} {...other}>
76
59
  <div className={classesBody}>
77
- {iconProps && <Icon {...iconProps} />}
78
60
  {children}
61
+ {iconProps && <Icon {...iconProps} />}
79
62
  </div>
80
- {backgroundImage && (
81
- // eslint-disable-next-line jsx-a11y/alt-text
82
- <Image
83
- {...backgroundImage}
84
- className={cx(`${CLASS_ROOT}__bg`, backgroundImage.className)}
85
- />
86
- )}
87
63
  </div>
88
64
  );
89
65
  };
@@ -1,81 +1,79 @@
1
1
  @use "../../../styles/tokens/space";
2
2
  @use "../../../styles/tokens/breakpoint";
3
3
  @use "../../../styles/tools/convert";
4
- @use "./config";
5
4
 
6
5
  @mixin tile-base {
7
6
  display: flex;
8
7
  position: relative;
9
8
  overflow: hidden;
10
9
  width: 100%;
11
- border-radius: convert.to-rem(10px);
12
- border: 1px solid var(--color-border-strong);
10
+ border-radius: convert.to-rem(5px);
11
+ border: 1px solid var(--color-border-subtle);
12
+ background-color: var(--color-fill-primary);
13
+ color: var(--color-text-default);
13
14
  word-break: break-word;
14
15
  }
15
16
 
16
- @mixin tile-image-aspect {
17
- aspect-ratio: 310 / 466 !important;
18
- }
19
-
20
17
  @mixin tile-body {
21
18
  flex: 1;
22
19
  display: flex;
23
20
  flex-direction: column;
21
+ align-items: flex-start;
22
+ gap: space.get("medium");
23
+ padding: space.get("medium");
24
24
  z-index: 1;
25
+
25
26
  *:last-child {
26
27
  margin-bottom: 0;
27
28
  }
28
- @each $breakpoint, $space in config.$spacing {
29
- @include breakpoint.get($breakpoint) {
30
- padding: $space;
31
- }
32
- }
33
- }
34
29
 
35
- @mixin tile-body-space-small {
36
- padding: space.get("medium");
37
- }
38
-
39
- @mixin tile-bg {
40
- position: absolute;
41
- top: 0;
42
- right: 0;
43
- bottom: 0;
44
- left: 0;
45
- object-fit: cover;
46
- object-position: center center;
47
- height: 100%;
48
- margin-bottom: 0 !important;
30
+ @include breakpoint.get("md") {
31
+ flex-direction: column;
32
+ padding: space.get("large");
33
+ }
49
34
  }
50
35
 
51
- @mixin tile-image-gradient {
52
- background: linear-gradient(
53
- 180deg,
54
- rgba(0, 0, 0, 1) 0%,
55
- rgba(0, 0, 0, 0.75) 40%,
56
- rgba(0, 0, 0, 0) 70%
57
- );
58
- color: #fff;
59
- }
36
+ @mixin tile-body-compact {
37
+ flex-direction: row;
38
+ align-items: center;
39
+ justify-content: flex-start;
40
+ gap: space.get("xsmall");
41
+ padding: convert.to-rem(15px);
42
+ flex-shrink: 0;
43
+ text-wrap: nowrap;
60
44
 
61
- @mixin tile-image-gradient-end {
62
- background: linear-gradient(
63
- 0deg,
64
- rgba(0, 0, 0, 1) 0%,
65
- rgba(0, 0, 0, 0.75) 40%,
66
- rgba(0, 0, 0, 0) 70%
67
- );
45
+ @include breakpoint.get("md") {
46
+ flex-direction: column;
47
+ padding: space.get("medium");
48
+ }
68
49
  }
69
50
 
70
51
  @mixin tile-action {
71
52
  flex-direction: row;
72
- justify-content: space-between;
73
53
  align-items: center;
74
- order: 1;
54
+ justify-content: space-between;
55
+ gap: convert.to-rem(15px);
56
+ padding: space.get("large") space.get("medium");
57
+
58
+ @include breakpoint.get("sm") {
59
+ gap: space.get("medium");
60
+ padding: space.get("large");
61
+ }
62
+ }
63
+
64
+ @mixin tile-action-shell {
65
+ background-color: transparent;
66
+ color: var(--color-text-inverse);
67
+ border-color: var(--color-border-strong);
75
68
  }
76
69
 
77
70
  @mixin tile-action-icon {
78
- order: 2;
79
- margin-left: space.get("small");
80
71
  flex-shrink: 0;
72
+ width: convert.to-rem(24px);
73
+ height: convert.to-rem(24px);
74
+
75
+ @include breakpoint.get("sm") {
76
+ width: convert.to-rem(32px);
77
+ height: convert.to-rem(32px);
78
+ }
81
79
  }
@@ -4,33 +4,21 @@
4
4
  .tile {
5
5
  @include mixins.tile-base;
6
6
 
7
- &--image {
8
- @include mixins.tile-image-aspect;
9
- }
10
-
11
7
  &__body {
12
8
  @include mixins.tile-body;
13
9
  }
14
10
 
15
- &__body--space-small {
16
- @include mixins.tile-body-space-small;
17
- }
18
-
19
- &__bg {
20
- @include mixins.tile-bg;
21
- }
22
-
23
- &--image .tile__body {
24
- @include mixins.tile-image-gradient;
25
- &.justify-content-end {
26
- @include mixins.tile-image-gradient-end;
27
- }
11
+ &--compact .tile__body {
12
+ @include mixins.tile-body-compact;
28
13
  }
29
14
 
30
15
  &--action {
16
+ @include mixins.tile-action-shell;
17
+
31
18
  .tile__body {
32
19
  @include mixins.tile-action;
33
20
  }
21
+
34
22
  .icon {
35
23
  @include mixins.tile-action-icon;
36
24
  }
@@ -8,6 +8,7 @@ describe("rendering Tile", () => {
8
8
  const { getByTestId } = render(<Tile data-testid="test-id" />);
9
9
  expect(getByTestId("test-id").tagName).toBe("DIV");
10
10
  expect(getByTestId("test-id")).toHaveClass("tile");
11
+ expect(getByTestId("test-id")).not.toHaveClass("surface-primary");
11
12
  });
12
13
  it("renders child div with class tile__body", () => {
13
14
  const { getByTestId } = render(<Tile data-testid="test-id" />);
@@ -28,78 +29,6 @@ describe("rendering Tile", () => {
28
29
  expect(getByTestId("test-id")).toHaveClass("tile");
29
30
  expect(getByTestId("test-id")).toHaveClass("test-class");
30
31
  });
31
- it("renders Image when backgroundImage is object of Image props and src is string", () => {
32
- const { container } = render(
33
- <Tile
34
- data-testid="test-id"
35
- backgroundImage={{ src: "./test.png", alt: "test" }}
36
- />,
37
- );
38
- expect(container.querySelector("img")).toBeInTheDocument();
39
- // The Image component may add the 'img' class, but always has 'tile__bg'
40
- expect(container.querySelector("img")).toHaveClass("tile__bg");
41
- });
42
- it("renders image inside picture when backgroundImage is object of Image props and src is object", () => {
43
- const { container } = render(
44
- <Tile
45
- data-testid="test-id"
46
- backgroundImage={{ src: { default: "./test.png" }, alt: "test" }}
47
- />,
48
- );
49
- expect(container.querySelector("picture")).toBeInTheDocument();
50
- const img = container.querySelector("picture").querySelector("img");
51
- expect(img).toBeInTheDocument();
52
- // Update: Only check for class if it exists, otherwise check for no class
53
- // If the implementation no longer adds 'tile__bg', this should pass
54
- expect(img.className === "" || img.className === undefined).toBe(true);
55
- });
56
- it("background image has src set to backgroundImage.src", () => {
57
- const { container } = render(
58
- <Tile
59
- data-testid="test-id"
60
- backgroundImage={{ src: "./test.png", alt: "test" }}
61
- />,
62
- );
63
- expect(new URL(container.querySelector("img").src).pathname).toBe(
64
- "/test.png",
65
- );
66
- });
67
- it("background image has alt set to backgroundImage.alt", () => {
68
- const { container } = render(
69
- <Tile
70
- data-testid="test-id"
71
- backgroundImage={{ src: "./test.png", alt: "test" }}
72
- />,
73
- );
74
- expect(container.querySelector("img").alt).toBe("test");
75
- });
76
- it("background image has additional class when backgroundImage.className is set", () => {
77
- const { container } = render(
78
- <Tile
79
- data-testid="test-id"
80
- backgroundImage={{
81
- src: "./test.png",
82
- alt: "test",
83
- className: "test-class",
84
- }}
85
- />,
86
- );
87
- expect(container.querySelector("img")).toHaveClass("tile__bg");
88
- expect(container.querySelector("img")).toHaveClass("test-class");
89
- });
90
- it("has surface class when color prop is set", () => {
91
- const { getByTestId } = render(
92
- <Tile data-testid="test-id" color="surface-secondary" />,
93
- );
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");
102
- });
103
32
  it("applies hAlign and vAlign classes to body", () => {
104
33
  const { getByTestId } = render(
105
34
  <Tile data-testid="test-id" hAlign="center" vAlign="space-between" />,
@@ -108,26 +37,28 @@ describe("rendering Tile", () => {
108
37
  expect(body).toHaveClass("align-items-center");
109
38
  expect(body).toHaveClass("justify-content-space-between");
110
39
  });
111
- it("applies space class to body when space prop is set", () => {
40
+ it("applies compact wrapper class when variant is compact", () => {
112
41
  const { getByTestId } = render(
113
- <Tile data-testid="test-id" space="small" />,
42
+ <Tile data-testid="test-id" variant="compact" />,
114
43
  );
44
+ expect(getByTestId("test-id")).toHaveClass("tile--compact");
115
45
  const body = getByTestId("test-id").querySelector(".tile__body");
116
- expect(body).toHaveClass("tile__body--space-small");
46
+ expect(body).not.toHaveClass("tile__body--compact");
117
47
  });
118
48
  it("applies variant class to wrapper when variant is set", () => {
119
49
  const { getByTestId } = render(
120
- <Tile data-testid="test-id" variant="image" />,
50
+ <Tile data-testid="test-id" variant="action" />,
121
51
  );
122
- expect(getByTestId("test-id")).toHaveClass("tile--image");
52
+ expect(getByTestId("test-id")).toHaveClass("tile--action");
123
53
  });
124
54
  it("renders Icon when variant is 'action'", () => {
125
55
  const { getByTestId } = render(
126
56
  <Tile data-testid="test-id" variant="action" />,
127
57
  );
128
- // The Icon should be rendered as the first child of .tile__body
129
58
  const body = getByTestId("test-id").querySelector(".tile__body");
130
59
  expect(body.querySelector("svg")).toBeInTheDocument();
60
+ expect(body.lastElementChild.tagName).toBe("svg");
61
+ expect(body).not.toHaveClass("tile__body--action");
131
62
  });
132
63
  });
133
64
  });
@@ -106,6 +106,8 @@ button:not(:disabled) {
106
106
 
107
107
  a {
108
108
  text-decoration: none;
109
+ text-underline-offset: 2px;
110
+ text-decoration-thickness: auto;
109
111
  }
110
112
 
111
113
  // stylelint-disable-next-line no-descending-specificity
@@ -7,7 +7,6 @@
7
7
  :host,
8
8
  :host(.is-light),
9
9
  .is-light,
10
- .bg-white,
11
10
  #root.is-light,
12
11
  #root-modals.is-light,
13
12
  #root-tooltips.is-light,
@@ -24,7 +23,6 @@
24
23
  // Dark theme CSS variables
25
24
  :host(.is-dark),
26
25
  .is-dark,
27
- .bg-black,
28
26
  #root.is-dark,
29
27
  #root-modals.is-dark,
30
28
  #root-tooltips.is-dark,