@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.
- package/build/components/index.js +5 -5
- package/build/components/index.js.map +1 -1
- package/build/components/tsconfig.tsbuildinfo +1 -1
- package/build/components/types/index.d.ts +8 -5
- package/build/components/types/src/components/Carousel/Carousel.static.d.ts +34 -1
- package/build/components/types/src/components/Cover/Cover.d.ts +3 -3
- package/build/components/types/src/components/Pill/Pill.d.ts +1 -1
- package/build/components/types/src/components/PromoBanner/PromoBanner.d.ts +1 -1
- package/build/components/types/src/components/Table/Table.d.ts +2 -0
- package/build/components/types/src/components/Table/docsData.d.ts +2 -0
- package/build/components/types/src/components/Table/types.d.ts +1 -0
- package/build/components/types/src/components/Tile/Tile.d.ts +2 -1
- package/build/lib/after-components.css +1 -1
- package/build/lib/after-components.css.map +1 -1
- package/build/lib/before-components.css +1 -1
- package/build/lib/before-components.css.map +1 -1
- package/build/lib/components.css +1 -1
- package/build/lib/components.css.map +1 -1
- package/build/lib/megamenu.css +1 -1
- package/build/lib/megamenu.css.map +1 -1
- package/build/lib/scripts.js +4 -4
- 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/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -13
- package/src/components/Accordion/styles/mixins.scss +5 -1
- package/src/components/AnchorNavigation/AnchorNavigation.static.ts +3 -0
- package/src/components/AnchorNavigation/styles/mixins.scss +1 -1
- package/src/components/Button/styles/config.scss +5 -4
- package/src/components/Carousel/Carousel.static.ts +204 -1
- package/src/components/Carousel/tests/Carousel.static.test.js +403 -0
- package/src/components/Carousel/tests/Carousel.unit.test.js +68 -0
- package/src/components/Cover/Cover.tsx +22 -20
- package/src/components/Cover/styles/config.scss +23 -12
- package/src/components/Cover/styles/mixins.scss +6 -5
- package/src/components/Cover/tests/Cover.unit.test.js +52 -52
- package/src/components/Expander/styles/style.scss +3 -1
- package/src/components/Forms/Group/styles/mixins.scss +14 -0
- package/src/components/Pill/Pill.tsx +10 -2
- package/src/components/Pill/styles/config.scss +2 -21
- package/src/components/Pill/styles/style.scss +16 -6
- package/src/components/Pill/tests/Pill.conformance.test.js +8 -2
- package/src/components/Pill/tests/Pill.unit.test.js +69 -11
- package/src/components/PromoBanner/PromoBanner.tsx +19 -2
- package/src/components/PromoBanner/styles/mixins.scss +1 -1
- package/src/components/PromoBanner/tests/PromoBanner.conformance.test.js +32 -0
- package/src/components/PromoBanner/tests/PromoBanner.unit.test.js +52 -0
- package/src/components/Table/Row.tsx +9 -3
- package/src/components/Table/Table.tsx +11 -1
- package/src/components/Table/TableContext.ts +1 -0
- package/src/components/Table/docsData.ts +25 -0
- package/src/components/Table/styles/mixins.scss +40 -4
- package/src/components/Table/styles/style.scss +6 -0
- package/src/components/Table/types.ts +1 -0
- package/src/components/Tile/CHANGELOG.md +15 -1
- package/src/components/Tile/Tile.tsx +11 -3
- package/src/components/Tile/styles/config.scss +0 -11
- package/src/components/Tile/styles/style.scss +0 -4
- package/src/components/Tile/tests/Tile.unit.test.js +10 -3
- package/src/components/Tooltip/InfoTooltip.tsx +1 -5
- package/src/styles/base/globals.scss +7 -2
- package/src/styles/tokens/color.scss +1 -1
- package/src/styles/typography/mixins.scss +18 -0
- package/src/styles/typography/style.scss +6 -3
- package/src/styles/utilities/text.scss +1 -0
|
@@ -204,4 +204,72 @@ describe("rendering Carousel", () => {
|
|
|
204
204
|
expect(carousel).not.toHaveClass("is-light");
|
|
205
205
|
});
|
|
206
206
|
});
|
|
207
|
+
|
|
208
|
+
describe("external controls integration", () => {
|
|
209
|
+
const items = [
|
|
210
|
+
<p key="item1">item1</p>,
|
|
211
|
+
<p key="item2">item2</p>,
|
|
212
|
+
<p key="item3">item3</p>,
|
|
213
|
+
];
|
|
214
|
+
|
|
215
|
+
it("should render with data-carousel-id when id is provided", () => {
|
|
216
|
+
const { container } = render(
|
|
217
|
+
<Carousel id="test-carousel" items={items} />,
|
|
218
|
+
);
|
|
219
|
+
const carousel = container.querySelector(".carousel");
|
|
220
|
+
expect(carousel).toHaveAttribute("id", "test-carousel");
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
it("should support external controls via data attributes", () => {
|
|
224
|
+
const { container } = render(
|
|
225
|
+
<div>
|
|
226
|
+
<Carousel id="external-carousel" items={items} />
|
|
227
|
+
<button
|
|
228
|
+
data-carousel-controls="external-carousel"
|
|
229
|
+
data-carousel-action="prev"
|
|
230
|
+
data-testid="external-prev"
|
|
231
|
+
>
|
|
232
|
+
Previous
|
|
233
|
+
</button>
|
|
234
|
+
<button
|
|
235
|
+
data-carousel-controls="external-carousel"
|
|
236
|
+
data-carousel-action="next"
|
|
237
|
+
data-testid="external-next"
|
|
238
|
+
>
|
|
239
|
+
Next
|
|
240
|
+
</button>
|
|
241
|
+
</div>,
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
const carousel = container.querySelector(".carousel");
|
|
245
|
+
const prevButton = container.querySelector(
|
|
246
|
+
'[data-testid="external-prev"]',
|
|
247
|
+
);
|
|
248
|
+
const nextButton = container.querySelector(
|
|
249
|
+
'[data-testid="external-next"]',
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
expect(carousel).toHaveAttribute("id", "external-carousel");
|
|
253
|
+
expect(prevButton).toHaveAttribute(
|
|
254
|
+
"data-carousel-controls",
|
|
255
|
+
"external-carousel",
|
|
256
|
+
);
|
|
257
|
+
expect(prevButton).toHaveAttribute("data-carousel-action", "prev");
|
|
258
|
+
expect(nextButton).toHaveAttribute(
|
|
259
|
+
"data-carousel-controls",
|
|
260
|
+
"external-carousel",
|
|
261
|
+
);
|
|
262
|
+
expect(nextButton).toHaveAttribute("data-carousel-action", "next");
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
it("should work with both id and data-carousel-id", () => {
|
|
266
|
+
const { container } = render(
|
|
267
|
+
<Carousel id="test-id" data-carousel-id="test-data-id" items={items} />,
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
const carousel = container.querySelector(".carousel");
|
|
271
|
+
expect(carousel).toHaveAttribute("id", "test-id");
|
|
272
|
+
expect(carousel).toHaveAttribute("data-carousel-id", "test-data-id");
|
|
273
|
+
});
|
|
274
|
+
});
|
|
207
275
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import cx from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import cx from "classnames";
|
|
3
3
|
|
|
4
|
-
import { Image } from
|
|
4
|
+
import { Image } from "../Image";
|
|
5
5
|
|
|
6
6
|
interface CoverProps {
|
|
7
7
|
/** Background image source. URL string or an object of breakpoint: url pairs
|
|
@@ -19,22 +19,24 @@ interface CoverProps {
|
|
|
19
19
|
}
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
bgSrc:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
bgSrc:
|
|
23
|
+
| string
|
|
24
|
+
| {
|
|
25
|
+
default: string;
|
|
26
|
+
xs?: string;
|
|
27
|
+
sm?: string;
|
|
28
|
+
md?: string;
|
|
29
|
+
lg?: string;
|
|
30
|
+
xl?: string;
|
|
31
|
+
xxl?: string;
|
|
32
|
+
xxxl?: string;
|
|
33
|
+
};
|
|
32
34
|
/** Set vertical position of image */
|
|
33
|
-
bgPosition?:
|
|
35
|
+
bgPosition?: "top" | "center" | "bottom";
|
|
34
36
|
/** Applies custom classNames to overlay content */
|
|
35
37
|
contentClass?: string;
|
|
36
38
|
/** Cover size */
|
|
37
|
-
size?:
|
|
39
|
+
size?: "small" | "medium" | "large" | "xlarge";
|
|
38
40
|
/** Additional className for the cover container */
|
|
39
41
|
className?: string;
|
|
40
42
|
/** Children content */
|
|
@@ -43,13 +45,13 @@ interface CoverProps {
|
|
|
43
45
|
[key: string]: any;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
const CLASS_ROOT =
|
|
48
|
+
const CLASS_ROOT = "cover";
|
|
47
49
|
|
|
48
50
|
const Cover: React.FC<CoverProps> = ({
|
|
49
51
|
className,
|
|
50
52
|
children,
|
|
51
53
|
contentClass,
|
|
52
|
-
bgPosition =
|
|
54
|
+
bgPosition = "center",
|
|
53
55
|
bgSrc,
|
|
54
56
|
size,
|
|
55
57
|
...other
|
|
@@ -59,13 +61,13 @@ const Cover: React.FC<CoverProps> = ({
|
|
|
59
61
|
{
|
|
60
62
|
[`${CLASS_ROOT}--${size}`]: size,
|
|
61
63
|
},
|
|
62
|
-
className
|
|
64
|
+
className,
|
|
63
65
|
);
|
|
64
66
|
|
|
65
67
|
const contentClasses = cx(`${CLASS_ROOT}__content`, contentClass);
|
|
66
68
|
|
|
67
69
|
const bgImgClassName = cx(`${CLASS_ROOT}__image`, {
|
|
68
|
-
[`${CLASS_ROOT}__image--${bgPosition}`]: bgPosition !==
|
|
70
|
+
[`${CLASS_ROOT}__image--${bgPosition}`]: bgPosition !== "center",
|
|
69
71
|
});
|
|
70
72
|
|
|
71
73
|
return (
|
|
@@ -76,6 +78,6 @@ const Cover: React.FC<CoverProps> = ({
|
|
|
76
78
|
);
|
|
77
79
|
};
|
|
78
80
|
|
|
79
|
-
Cover.displayName =
|
|
81
|
+
Cover.displayName = "Cover";
|
|
80
82
|
|
|
81
83
|
export { Cover };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
@use
|
|
2
|
-
@use
|
|
1
|
+
@use "../../../styles/tokens/space";
|
|
2
|
+
@use "../../../styles/tools/convert";
|
|
3
3
|
|
|
4
4
|
$sizes: (
|
|
5
5
|
small: (
|
|
@@ -8,7 +8,7 @@ $sizes: (
|
|
|
8
8
|
),
|
|
9
9
|
md: (
|
|
10
10
|
min-height: convert.to-rem(255px),
|
|
11
|
-
)
|
|
11
|
+
),
|
|
12
12
|
),
|
|
13
13
|
medium: (
|
|
14
14
|
default: (
|
|
@@ -19,7 +19,7 @@ $sizes: (
|
|
|
19
19
|
),
|
|
20
20
|
lg: (
|
|
21
21
|
min-height: convert.to-rem(295px),
|
|
22
|
-
)
|
|
22
|
+
),
|
|
23
23
|
),
|
|
24
24
|
large: (
|
|
25
25
|
default: (
|
|
@@ -30,13 +30,24 @@ $sizes: (
|
|
|
30
30
|
),
|
|
31
31
|
lg: (
|
|
32
32
|
min-height: convert.to-rem(460px),
|
|
33
|
-
)
|
|
33
|
+
),
|
|
34
|
+
),
|
|
35
|
+
xlarge: (
|
|
36
|
+
default: (
|
|
37
|
+
min-height: convert.to-rem(600px),
|
|
38
|
+
),
|
|
39
|
+
md: (
|
|
40
|
+
min-height: convert.to-rem(760px),
|
|
41
|
+
),
|
|
42
|
+
lg: (
|
|
43
|
+
min-height: convert.to-rem(760px),
|
|
44
|
+
),
|
|
34
45
|
),
|
|
35
46
|
);
|
|
36
47
|
|
|
37
48
|
$spacing: (
|
|
38
49
|
default: (
|
|
39
|
-
padding-top: space.get(
|
|
50
|
+
padding-top: space.get("small"),
|
|
40
51
|
padding-bottom: 0.1px,
|
|
41
52
|
),
|
|
42
53
|
md: (
|
|
@@ -44,12 +55,12 @@ $spacing: (
|
|
|
44
55
|
padding-bottom: space.get(),
|
|
45
56
|
),
|
|
46
57
|
lg: (
|
|
47
|
-
padding-top: space.get(
|
|
48
|
-
padding-bottom: space.get(
|
|
49
|
-
)
|
|
58
|
+
padding-top: space.get("large"),
|
|
59
|
+
padding-bottom: space.get("large"),
|
|
60
|
+
),
|
|
50
61
|
);
|
|
51
62
|
|
|
52
63
|
$positions: (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
);
|
|
64
|
+
"top": 50% 0,
|
|
65
|
+
"bottom": 50% 100%,
|
|
66
|
+
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@use "sass:map";
|
|
2
|
-
@use
|
|
3
|
-
@use
|
|
4
|
-
@use
|
|
2
|
+
@use "../../../styles/tokens/color";
|
|
3
|
+
@use "../../../styles/tools/generate";
|
|
4
|
+
@use "./config";
|
|
5
5
|
|
|
6
6
|
@mixin base {
|
|
7
7
|
position: relative;
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
position: relative;
|
|
13
13
|
transform: translate3d(0, 0, 0);
|
|
14
14
|
z-index: 1;
|
|
15
|
+
width: 100%;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
@mixin content-size($size, $config: config.$sizes) {
|
|
@@ -34,10 +35,10 @@
|
|
|
34
35
|
img {
|
|
35
36
|
width: 100%;
|
|
36
37
|
height: 100%;
|
|
37
|
-
object-fit: cover;
|
|
38
|
+
object-fit: cover;
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
@mixin image-position($position, $config: config.$positions) {
|
|
42
43
|
object-position: map.get($config, $position);
|
|
43
|
-
}
|
|
44
|
+
}
|
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
3
|
|
|
4
|
-
import { Cover } from
|
|
4
|
+
import { Cover } from "../Cover";
|
|
5
5
|
|
|
6
|
-
const image =
|
|
6
|
+
const image = "/test-image.jpg";
|
|
7
7
|
const picture = {
|
|
8
|
-
default:
|
|
9
|
-
md:
|
|
10
|
-
xl:
|
|
8
|
+
default: "/test-picture.jpg",
|
|
9
|
+
md: "/test-picture-md.jpg",
|
|
10
|
+
xl: "/test-picture-xl.jpg",
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
// bgSrc prop is required
|
|
14
|
-
describe(
|
|
15
|
-
describe(
|
|
16
|
-
it(
|
|
14
|
+
describe("rendering Cover", () => {
|
|
15
|
+
describe("initial state", () => {
|
|
16
|
+
it("has default class cover", () => {
|
|
17
17
|
const { container } = render(<Cover bgSrc={image} />);
|
|
18
|
-
expect(container.getElementsByClassName(
|
|
18
|
+
expect(container.getElementsByClassName("cover").length).toBe(1);
|
|
19
19
|
});
|
|
20
|
-
it(
|
|
20
|
+
it("has default class cover__image", () => {
|
|
21
21
|
const { container } = render(<Cover bgSrc={image} />);
|
|
22
|
-
expect(container.getElementsByClassName(
|
|
22
|
+
expect(container.getElementsByClassName("cover__image").length).toBe(1);
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
|
-
describe(
|
|
26
|
-
it(
|
|
25
|
+
describe("passed props", () => {
|
|
26
|
+
it("passes other props", () => {
|
|
27
27
|
const { getByTestId } = render(
|
|
28
|
-
<Cover data-testid="test" bgSrc={image}
|
|
28
|
+
<Cover data-testid="test" bgSrc={image} />,
|
|
29
29
|
);
|
|
30
|
-
expect(getByTestId(
|
|
30
|
+
expect(getByTestId("test")).toBeInTheDocument();
|
|
31
31
|
});
|
|
32
|
-
it(
|
|
32
|
+
it("renders children", () => {
|
|
33
33
|
const { getByText } = render(<Cover bgSrc={image}>test-text</Cover>);
|
|
34
|
-
expect(getByText(
|
|
34
|
+
expect(getByText("test-text")).toBeInTheDocument();
|
|
35
35
|
});
|
|
36
|
-
it(
|
|
36
|
+
it("has additional class when className is set", () => {
|
|
37
37
|
const { container } = render(
|
|
38
|
-
<Cover bgSrc={image} className="test-class"
|
|
38
|
+
<Cover bgSrc={image} className="test-class" />,
|
|
39
39
|
);
|
|
40
|
-
expect(container.getElementsByClassName(
|
|
41
|
-
expect(container.getElementsByClassName(
|
|
40
|
+
expect(container.getElementsByClassName("cover").length).toBe(1);
|
|
41
|
+
expect(container.getElementsByClassName("test-class").length).toBe(1);
|
|
42
42
|
});
|
|
43
|
-
it(
|
|
43
|
+
it("has class cover__content when children are set", () => {
|
|
44
44
|
const { container } = render(<Cover bgSrc={image}>test</Cover>);
|
|
45
|
-
expect(container.getElementsByClassName(
|
|
45
|
+
expect(container.getElementsByClassName("cover__content").length).toBe(1);
|
|
46
46
|
});
|
|
47
|
-
it(
|
|
47
|
+
it("has additional class when contentClass and children are set", () => {
|
|
48
48
|
const { container } = render(
|
|
49
49
|
<Cover bgSrc={image} contentClass="test-content-class">
|
|
50
50
|
test
|
|
51
|
-
</Cover
|
|
51
|
+
</Cover>,
|
|
52
52
|
);
|
|
53
53
|
expect(
|
|
54
|
-
container.getElementsByClassName(
|
|
54
|
+
container.getElementsByClassName("test-content-class").length,
|
|
55
55
|
).toBe(1);
|
|
56
56
|
});
|
|
57
|
-
[
|
|
57
|
+
["small", "medium", "large", "xlarge"].map((size) => {
|
|
58
58
|
it(`has cover--${size} class when size is set to ${size}`, () => {
|
|
59
59
|
const { container } = render(<Cover bgSrc={image} size={size} />);
|
|
60
60
|
expect(container.getElementsByClassName(`cover--${size}`).length).toBe(
|
|
61
|
-
1
|
|
61
|
+
1,
|
|
62
62
|
);
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
|
-
[
|
|
65
|
+
["top", "bottom"].map((position) => {
|
|
66
66
|
it(`has cover__image--${position} class when bgPosition is set to ${position}`, () => {
|
|
67
67
|
const { container } = render(
|
|
68
|
-
<Cover bgSrc={image} bgPosition={position}
|
|
68
|
+
<Cover bgSrc={image} bgPosition={position} />,
|
|
69
69
|
);
|
|
70
70
|
expect(
|
|
71
|
-
container.getElementsByClassName(`cover__image--${position}`).length
|
|
71
|
+
container.getElementsByClassName(`cover__image--${position}`).length,
|
|
72
72
|
).toBe(1);
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
|
-
it(
|
|
75
|
+
it("doesnt have cover__image--center class when bgPosition is set to center", () => {
|
|
76
76
|
const { container } = render(<Cover bgSrc={image} bgPosition="center" />);
|
|
77
77
|
expect(
|
|
78
|
-
container.getElementsByClassName(
|
|
78
|
+
container.getElementsByClassName("cover__image--center").length,
|
|
79
79
|
).toBe(0);
|
|
80
80
|
});
|
|
81
|
-
it(
|
|
81
|
+
it("renders img element, not picture, when bgSrc is set to string", () => {
|
|
82
82
|
const { container } = render(<Cover bgSrc={image} />);
|
|
83
|
-
expect(container.querySelectorAll(
|
|
84
|
-
expect(container.querySelectorAll(
|
|
83
|
+
expect(container.querySelectorAll("img").length).toBe(1);
|
|
84
|
+
expect(container.querySelectorAll("picture").length).toBe(0);
|
|
85
85
|
});
|
|
86
|
-
it(
|
|
86
|
+
it("img element has src set to bgSrc when bgSrc is string", () => {
|
|
87
87
|
const { container } = render(<Cover bgSrc={image} />);
|
|
88
|
-
expect(container.querySelector(
|
|
89
|
-
|
|
88
|
+
expect(container.querySelector("img").getAttribute("src")).toBe(
|
|
89
|
+
"/test-image.jpg",
|
|
90
90
|
);
|
|
91
91
|
});
|
|
92
|
-
it(
|
|
92
|
+
it("renders picture element with source and img elements when bgSrc is set to object with multiple properties", () => {
|
|
93
93
|
const { container } = render(<Cover bgSrc={picture} />);
|
|
94
|
-
expect(container.querySelectorAll(
|
|
95
|
-
expect(container.querySelectorAll(
|
|
96
|
-
expect(container.querySelectorAll(
|
|
94
|
+
expect(container.querySelectorAll("picture").length).toBe(1);
|
|
95
|
+
expect(container.querySelectorAll("img").length).toBe(1);
|
|
96
|
+
expect(container.querySelectorAll("source").length > 0).toBeTruthy();
|
|
97
97
|
});
|
|
98
|
-
it(
|
|
98
|
+
it("img element has src set to bgSrc.default when bgSrc is object", () => {
|
|
99
99
|
const { container } = render(<Cover bgSrc={picture} />);
|
|
100
|
-
expect(container.querySelector(
|
|
101
|
-
picture.default
|
|
100
|
+
expect(container.querySelector("img").getAttribute("src")).toBe(
|
|
101
|
+
picture.default,
|
|
102
102
|
);
|
|
103
103
|
});
|
|
104
104
|
Object.keys(picture)
|
|
105
|
-
.filter(el => el !==
|
|
106
|
-
.map(key => {
|
|
107
|
-
it(
|
|
105
|
+
.filter((el) => el !== "default")
|
|
106
|
+
.map((key) => {
|
|
107
|
+
it("srcSet of source element has correct value from bgSrc object", () => {
|
|
108
108
|
const { container } = render(<Cover bgSrc={picture} />);
|
|
109
109
|
const correctSource = container.querySelector(
|
|
110
|
-
`source[srcset="${picture[key]}"]
|
|
110
|
+
`source[srcset="${picture[key]}"]`,
|
|
111
111
|
);
|
|
112
112
|
expect(correctSource).toBeInTheDocument();
|
|
113
113
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@use "sass:math";
|
|
2
|
+
@use "../../../styles/tools/convert";
|
|
2
3
|
@use "../../../styles/tokens/base";
|
|
3
4
|
@use "../../../styles/tokens/color";
|
|
4
5
|
@use "../../../styles/tokens/space";
|
|
@@ -6,10 +7,11 @@
|
|
|
6
7
|
@layer components {
|
|
7
8
|
.expander {
|
|
8
9
|
margin-bottom: space.get();
|
|
10
|
+
font-size: convert.to-rem(18px);
|
|
9
11
|
|
|
10
12
|
summary {
|
|
11
13
|
font-weight: 700;
|
|
12
|
-
line-height:
|
|
14
|
+
line-height: normal;
|
|
13
15
|
display: flex;
|
|
14
16
|
align-items: center;
|
|
15
17
|
|
|
@@ -34,6 +34,20 @@
|
|
|
34
34
|
border-top-left-radius: 0;
|
|
35
35
|
border-bottom-left-radius: 0;
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
> *:not(:first-child):not(:last-child) {
|
|
39
|
+
border-radius: 0 !important;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
> *:first-child:not(:last-child) {
|
|
43
|
+
border-top-right-radius: 0 !important;
|
|
44
|
+
border-bottom-right-radius: 0 !important;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
> *:last-child:not(:first-child) {
|
|
48
|
+
border-top-left-radius: 0 !important;
|
|
49
|
+
border-bottom-left-radius: 0 !important;
|
|
50
|
+
}
|
|
37
51
|
}
|
|
38
52
|
|
|
39
53
|
@mixin item($config: config.$item) {
|
|
@@ -3,7 +3,15 @@ import cx from "classnames";
|
|
|
3
3
|
|
|
4
4
|
const CLASS_ROOT = "pill";
|
|
5
5
|
|
|
6
|
-
export const pillColors = [
|
|
6
|
+
export const pillColors = [
|
|
7
|
+
"surface-primary",
|
|
8
|
+
"surface-secondary",
|
|
9
|
+
"surface-tertiary",
|
|
10
|
+
"surface-subtle",
|
|
11
|
+
"surface-moderate",
|
|
12
|
+
"surface-accent",
|
|
13
|
+
"transparent",
|
|
14
|
+
] as const;
|
|
7
15
|
export type PillColor = (typeof pillColors)[number];
|
|
8
16
|
|
|
9
17
|
interface PillProps extends HTMLAttributes<HTMLSpanElement> {
|
|
@@ -26,11 +34,11 @@ const Pill: React.FC<PillProps> = ({
|
|
|
26
34
|
className={cx(
|
|
27
35
|
CLASS_ROOT,
|
|
28
36
|
{
|
|
29
|
-
[`${CLASS_ROOT}--${color}`]: color, // Only apply modifier if color is specified
|
|
30
37
|
"is-light": colorScheme === "light",
|
|
31
38
|
"is-dark": colorScheme === "dark",
|
|
32
39
|
[CLASS_ROOT + "--" + size]: size,
|
|
33
40
|
},
|
|
41
|
+
color,
|
|
34
42
|
className,
|
|
35
43
|
)}
|
|
36
44
|
{...other}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
$base: (
|
|
6
6
|
font-weight: bold,
|
|
7
|
-
background-color:
|
|
8
|
-
color: color
|
|
7
|
+
background-color: var(--color-surface-contrast),
|
|
8
|
+
color: var(--color-text-inverse),
|
|
9
9
|
);
|
|
10
10
|
|
|
11
11
|
$sizes: (
|
|
@@ -21,22 +21,3 @@ $sizes: (
|
|
|
21
21
|
xxlarge: convert.to-rem(64px),
|
|
22
22
|
),
|
|
23
23
|
);
|
|
24
|
-
|
|
25
|
-
$colors: (
|
|
26
|
-
"white": (
|
|
27
|
-
background-color: color.$white,
|
|
28
|
-
color: color.$black,
|
|
29
|
-
),
|
|
30
|
-
"gray": (
|
|
31
|
-
background-color: var(--color-surface-subtle),
|
|
32
|
-
color: var(--color-text-default),
|
|
33
|
-
),
|
|
34
|
-
"orange": (
|
|
35
|
-
background-color: var(--color-icon-brand),
|
|
36
|
-
color: var(--color-text-inverse),
|
|
37
|
-
),
|
|
38
|
-
"transparent": (
|
|
39
|
-
background-color: rgba(#ffffff, 0.5),
|
|
40
|
-
color: var(--color-text-default),
|
|
41
|
-
),
|
|
42
|
-
);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use "../../../styles/tokens/color";
|
|
1
2
|
@use "../../../styles/tools/generate";
|
|
2
3
|
@use "./config";
|
|
3
4
|
@use "./mixins";
|
|
@@ -8,12 +9,21 @@
|
|
|
8
9
|
@include mixins.base();
|
|
9
10
|
@include mixins.sizes();
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
&.surface-primary,
|
|
13
|
+
&.surface-subtle,
|
|
14
|
+
&.surface-moderate,
|
|
15
|
+
&.surface-accent {
|
|
16
|
+
color: var(--color-text-default);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.surface-secondary,
|
|
20
|
+
&.surface-tertiary {
|
|
21
|
+
color: color.$white;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.transparent {
|
|
25
|
+
background-color: rgba(#ffffff, 0.5);
|
|
26
|
+
color: var(--color-text-default);
|
|
17
27
|
}
|
|
18
28
|
}
|
|
19
29
|
}
|
|
@@ -19,13 +19,19 @@ const example = (
|
|
|
19
19
|
</p>
|
|
20
20
|
<p>
|
|
21
21
|
<Pill color="transparent">T</Pill>
|
|
22
|
-
<Pill color="
|
|
23
|
-
<Pill color="
|
|
22
|
+
<Pill color="surface-secondary">S</Pill>
|
|
23
|
+
<Pill color="surface-tertiary">T</Pill>
|
|
24
|
+
<Pill color="surface-subtle">Su</Pill>
|
|
25
|
+
<Pill color="surface-moderate">M</Pill>
|
|
26
|
+
<Pill color="surface-contrast">C</Pill>
|
|
27
|
+
<Pill color="surface-accent">A</Pill>
|
|
24
28
|
</p>
|
|
25
29
|
<p>
|
|
26
30
|
<Pill size="small">S</Pill>
|
|
27
31
|
<Pill size="medium">M</Pill>
|
|
28
32
|
<Pill size="large">L</Pill>
|
|
33
|
+
<Pill size="xlarge">XL</Pill>
|
|
34
|
+
<Pill size="xxlarge">XXL</Pill>
|
|
29
35
|
</p>
|
|
30
36
|
<p>
|
|
31
37
|
<Pill colorScheme="light">Light</Pill>
|