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

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 (63) hide show
  1. package/build/components/Breadcrumbs/style.css +1 -1
  2. package/build/components/Breadcrumbs/style.css.map +1 -1
  3. package/build/components/Carousel/style.css +1 -1
  4. package/build/components/Carousel/style.css.map +1 -1
  5. package/build/components/Footer/style.css +1 -1
  6. package/build/components/Footer/style.css.map +1 -1
  7. package/build/components/Link/style.css +1 -1
  8. package/build/components/Link/style.css.map +1 -1
  9. package/build/components/Megamenu/style.css +1 -1
  10. package/build/components/Megamenu/style.css.map +1 -1
  11. package/build/components/Stepbar/style.css +1 -1
  12. package/build/components/Stepbar/style.css.map +1 -1
  13. package/build/components/Tabs/style.css +1 -1
  14. package/build/components/Tabs/style.css.map +1 -1
  15. package/build/components/index.js +1 -1
  16. package/build/components/index.js.map +1 -1
  17. package/build/components/tsconfig.tsbuildinfo +1 -1
  18. package/build/components/types/index.d.ts +0 -4
  19. package/build/components/types/src/components/Preview/CodeExample.d.ts +1 -0
  20. package/build/components/types/src/components/Preview/PreviewGenerator.d.ts +1 -0
  21. package/build/components/types/src/components/Preview/getElementDisplayName.d.ts +1 -0
  22. package/build/components/types/src/components/Tabs/Tabs.d.ts +0 -4
  23. package/build/components/types/src/components/Tabs/Tabs.static.d.ts +12 -0
  24. package/build/lib/base.css +1 -1
  25. package/build/lib/base.css.map +1 -1
  26. package/build/lib/components.css +1 -1
  27. package/build/lib/components.css.map +1 -1
  28. package/build/lib/footer.css +1 -1
  29. package/build/lib/footer.css.map +1 -1
  30. package/build/lib/megamenu.css +1 -1
  31. package/build/lib/megamenu.css.map +1 -1
  32. package/build/lib/scripts.js +1 -1
  33. package/build/lib/scripts.js.map +1 -1
  34. package/build/lib/style.css +1 -1
  35. package/build/lib/style.css.map +1 -1
  36. package/build/lib/utilities.css +1 -1
  37. package/build/lib/utilities.css.map +1 -1
  38. package/build/search-index.json +2 -2
  39. package/package.json +12 -12
  40. package/src/components/Breadcrumbs/styles/mixins.scss +15 -8
  41. package/src/components/Carousel/styles/mixins.scss +22 -2
  42. package/src/components/Footer/styles/mixins.scss +2 -1
  43. package/src/components/Forms/Checkbox/styles/style.scss +13 -6
  44. package/src/components/Forms/InputStepper/styles/style.scss +15 -8
  45. package/src/components/Link/styles/mixins.scss +0 -1
  46. package/src/components/Megamenu/Megamenu.tsx +2 -2
  47. package/src/components/Megamenu/MegamenuBlog.tsx +2 -2
  48. package/src/components/Megamenu/styles/mixins.scss +20 -12
  49. package/src/components/Preview/CodeExample.tsx +66 -25
  50. package/src/components/Preview/Preview.tsx +26 -13
  51. package/src/components/Preview/PreviewGenerator.tsx +57 -32
  52. package/src/components/Preview/getElementDisplayName.ts +25 -0
  53. package/src/components/Stepbar/styles/config.scss +34 -17
  54. package/src/components/Stepbar/styles/mixins.scss +5 -3
  55. package/src/components/Tabs/Tabs.static.ts +157 -30
  56. package/src/components/Tabs/Tabs.tsx +62 -67
  57. package/src/components/Tabs/styles/config.scss +18 -25
  58. package/src/components/Tabs/styles/mixins.scss +93 -28
  59. package/src/components/Tabs/styles/style.scss +4 -15
  60. package/src/components/Tabs/tests/Tabs.unit.test.jsx +111 -0
  61. package/src/styles/base/globals.scss +2 -0
  62. package/src/styles/utilities/horizontal-scroll.scss +7 -2
  63. package/src/styles/utilities/text.scss +0 -1
@@ -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", () => {
@@ -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
@@ -15,14 +15,16 @@
15
15
 
16
16
  @supports selector(::-webkit-scrollbar) {
17
17
  &::-webkit-scrollbar {
18
- height: convert.to-rem(6px);
18
+ height: convert.to-rem(8px);
19
19
  appearance: none;
20
- background-color: var(--color-surface-moderate);
20
+ background-color: transparent;
21
21
  border-radius: 99px;
22
22
  }
23
23
 
24
24
  &::-webkit-scrollbar-track {
25
+ border: convert.to-rem(1px) solid transparent;
25
26
  background-color: var(--color-surface-moderate);
27
+ background-clip: content-box;
26
28
  border-radius: 99px;
27
29
  }
28
30
 
@@ -30,12 +32,15 @@
30
32
  opacity: 1;
31
33
  background-color: var(--color-fill-contrast);
32
34
  border-radius: 99px;
35
+ border: convert.to-rem(1px) solid transparent;
36
+ background-clip: content-box;
33
37
  }
34
38
 
35
39
  &:hover::-webkit-scrollbar-thumb,
36
40
  &:active::-webkit-scrollbar-thumb,
37
41
  &::-webkit-scrollbar-thumb:hover,
38
42
  &::-webkit-scrollbar-thumb:active {
43
+ border-width: 0;
39
44
  background-color: var(--color-fill-secondary) !important;
40
45
  }
41
46
  }
@@ -29,7 +29,6 @@
29
29
 
30
30
  .underline {
31
31
  text-decoration: underline !important;
32
- text-underline-offset: 0.1em !important;
33
32
  }
34
33
 
35
34
  .no-underline {