|
7 | 7 | @use '../../../../internal/styles/tokens' as awsui;
|
8 | 8 | @use '@cloudscape-design/component-toolkit/internal/focus-visible' as focus-visible;
|
9 | 9 |
|
10 |
| -@mixin trigger-selected-styles { |
11 |
| - background: awsui.$color-background-layout-toggle-selected-default; |
12 |
| - color: awsui.$color-text-layout-toggle-selected; |
13 |
| - |
14 |
| - &:hover { |
15 |
| - background: awsui.$color-background-layout-toggle-selected-hover; |
16 |
| - } |
17 |
| - &:active { |
18 |
| - background: awsui.$color-background-layout-toggle-selected-active; |
19 |
| - } |
20 |
| -} |
| 10 | +.trigger { |
| 11 | + // reset native <button> tag styles |
| 12 | + all: initial; |
21 | 13 |
|
22 |
| -.trigger-button-styles { |
23 |
| - background: transparent; |
| 14 | + cursor: pointer; |
24 | 15 | color: awsui.$color-text-interactive-default;
|
25 | 16 | border-start-start-radius: 50%;
|
26 | 17 | border-start-end-radius: 50%;
|
27 | 18 | border-end-start-radius: 50%;
|
28 | 19 | border-end-end-radius: 50%;
|
29 | 20 | block-size: 30px;
|
30 | 21 | inline-size: 30px;
|
31 |
| - display: flex; |
32 |
| - align-items: center; |
33 |
| - justify-content: center; |
34 |
| - box-sizing: border-box; |
| 22 | + text-align: center; |
| 23 | + |
| 24 | + &-with-badge { |
| 25 | + clip-path: path( |
| 26 | + 'M29.2862 10.4145C28.7243 10.5998 28.1238 10.7 27.4999 10.7C24.3519 10.7 21.7999 8.14803 21.7999 5C21.7999 3.92883 22.0954 2.92667 22.6093 2.07057C20.3785 0.754846 17.7774 0 15 0C6.71573 0 0 6.71573 0 15C0 23.2843 6.71573 30 15 30C23.2843 30 30 23.2843 30 15C30 13.4007 29.7497 11.8599 29.2862 10.4145Z' |
| 27 | + ); |
| 28 | + |
| 29 | + @include styles.with-direction('rtl') { |
| 30 | + clip-path: path( |
| 31 | + 'M2.21384 10.4145C2.77569 10.5998 3.37617 10.7 4.00007 10.7C7.1481 10.7 9.70007 8.14803 9.70007 5C9.70007 3.92883 9.4046 2.92667 8.89071 2.07057C11.1215 0.754846 13.7226 0 16.5 0C24.7843 0 31.5 6.71573 31.5 15C31.5 23.2843 24.7843 30 16.5 30C8.21573 30 1.5 23.2843 1.5 15C1.5 13.4007 1.75029 11.8599 2.21384 10.4145Z' |
| 32 | + ); |
| 33 | + } |
| 34 | + } |
35 | 35 |
|
36 | 36 | &:hover {
|
37 | 37 | background: awsui.$color-background-input-disabled;
|
|
42 | 42 | background: awsui.$color-background-control-disabled;
|
43 | 43 | color: awsui.$color-text-interactive-hover;
|
44 | 44 | }
|
45 |
| -} |
46 |
| - |
47 |
| -.trigger-badge-wrapper { |
48 |
| - position: absolute; |
49 |
| - inset-block-start: 0; |
50 |
| - inset-inline-start: 0; |
51 |
| - display: flex; |
52 |
| - justify-content: center; |
53 |
| - align-items: center; |
54 |
| - clip-path: path( |
55 |
| - 'M29.2862 10.4145C28.7243 10.5998 28.1238 10.7 27.4999 10.7C24.3519 10.7 21.7999 8.14803 21.7999 5C21.7999 3.92883 22.0954 2.92667 22.6093 2.07057C20.3785 0.754846 17.7774 0 15 0C6.71573 0 0 6.71573 0 15C0 23.2843 6.71573 30 15 30C23.2843 30 30 23.2843 30 15C30 13.4007 29.7497 11.8599 29.2862 10.4145Z' |
56 |
| - ); |
57 |
| - |
58 |
| - @include styles.with-direction('rtl') { |
59 |
| - clip-path: path( |
60 |
| - 'M2.21384 10.4145C2.77569 10.5998 3.37617 10.7 4.00007 10.7C7.1481 10.7 9.70007 8.14803 9.70007 5C9.70007 3.92883 9.4046 2.92667 8.89071 2.07057C11.1215 0.754846 13.7226 0 16.5 0C24.7843 0 31.5 6.71573 31.5 15C31.5 23.2843 24.7843 30 16.5 30C8.21573 30 1.5 23.2843 1.5 15C1.5 13.4007 1.75029 11.8599 2.21384 10.4145Z' |
61 |
| - ); |
62 |
| - } |
63 |
| -} |
64 |
| - |
65 |
| -.trigger { |
66 |
| - border-block: none; |
67 |
| - border-inline: none; |
68 |
| - cursor: pointer; |
69 |
| - pointer-events: auto; |
70 |
| - |
71 |
| - @include focus-visible.when-visible { |
72 |
| - @include styles.focus-highlight(3px); |
73 |
| - } |
74 | 45 |
|
75 | 46 | &:focus {
|
| 47 | + // custom outline attached on the wrapping element |
76 | 48 | outline: none;
|
77 | 49 | }
|
78 | 50 |
|
79 | 51 | &.selected {
|
80 |
| - @include trigger-selected-styles(); |
| 52 | + background: awsui.$color-background-layout-toggle-selected-default; |
| 53 | + color: awsui.$color-text-layout-toggle-selected; |
81 | 54 |
|
82 |
| - > .trigger-badge-wrapper { |
83 |
| - @include trigger-selected-styles(); |
| 55 | + &:hover { |
| 56 | + background: awsui.$color-background-layout-toggle-selected-hover; |
| 57 | + } |
| 58 | + &:active { |
| 59 | + background: awsui.$color-background-layout-toggle-selected-active; |
84 | 60 | }
|
85 |
| - } |
86 |
| - |
87 |
| - &.badge, |
88 |
| - &.badge:hover, |
89 |
| - &.badge:active { |
90 |
| - background: transparent; |
91 | 61 | }
|
92 | 62 | }
|
93 | 63 |
|
94 | 64 | .trigger-wrapper {
|
95 | 65 | position: relative;
|
96 |
| - border-start-start-radius: 50%; |
97 |
| - border-start-end-radius: 50%; |
98 |
| - border-end-start-radius: 50%; |
99 |
| - border-end-end-radius: 50%; |
| 66 | + &:has(:focus-visible) { |
| 67 | + @include styles.focus-highlight(3px); |
| 68 | + } |
100 | 69 | }
|
101 | 70 |
|
102 | 71 | .dot {
|
|
0 commit comments