diff options
Diffstat (limited to 'src/objects/_tabs.scss')
-rw-r--r-- | src/objects/_tabs.scss | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/src/objects/_tabs.scss b/src/objects/_tabs.scss new file mode 100644 index 0000000..25894d5 --- /dev/null +++ b/src/objects/_tabs.scss | |||
@@ -0,0 +1,90 @@ | |||
1 | @use 'sass:map'; | ||
2 | @use 'sass:meta'; | ||
3 | @use 'sass:string'; | ||
4 | @use 'iro-sass/src/bem'; | ||
5 | @use 'iro-sass/src/props'; | ||
6 | @use '../props' as *; | ||
7 | |||
8 | @forward 'tabs.vars'; | ||
9 | @use 'tabs.vars' as vars; | ||
10 | |||
11 | @mixin styles { | ||
12 | @include materialize-at-root(meta.module-variables('vars')); | ||
13 | |||
14 | @include bem.object('tabs') { | ||
15 | display: flex; | ||
16 | gap: props.get(vars.$spacing); | ||
17 | |||
18 | @include bem.elem('tab') { | ||
19 | position: relative; | ||
20 | display: flex; | ||
21 | align-items: center; | ||
22 | padding-inline: props.get(vars.$tab--pad-i); | ||
23 | margin-inline: calc(-1 * props.get(vars.$tab--pad-i)); | ||
24 | color: props.get(vars.$tab--text-color); | ||
25 | |||
26 | &::before, | ||
27 | &::after { | ||
28 | position: absolute; | ||
29 | z-index: -10; | ||
30 | content: ''; | ||
31 | } | ||
32 | |||
33 | &::before { | ||
34 | inset-block-start: 50%; | ||
35 | inset-inline: 0; | ||
36 | block-size: 1.5em; | ||
37 | border-radius: props.get(vars.$rounding); | ||
38 | transform: translateY(-50%); | ||
39 | } | ||
40 | |||
41 | &::after { | ||
42 | inset-block-end: 0; | ||
43 | inset-inline: props.get(vars.$tab--pad-i); | ||
44 | display: none; | ||
45 | block-size: props.get(vars.$indicator--width); | ||
46 | background-color: props.get(vars.$tab--selected--text-color); | ||
47 | } | ||
48 | |||
49 | &:link, | ||
50 | &:visited { | ||
51 | &:hover, | ||
52 | &:active, | ||
53 | &:focus-visible { | ||
54 | color: props.get(vars.$tab--selected--text-color); | ||
55 | } | ||
56 | |||
57 | &:focus-visible { | ||
58 | &::before { | ||
59 | color: props.get(vars.$key-focus--text-color); | ||
60 | text-decoration: none; | ||
61 | outline: props.get(vars.$key-focus--border-color) solid props.get(vars.$key-focus--border-width); | ||
62 | box-shadow: 0 0 0 | ||
63 | calc(props.get(vars.$key-focus--border-width) + props.get(vars.$key-focus--outline-width)) | ||
64 | props.get(vars.$key-focus--outline-color); | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | |||
69 | @include bem.is('selected') { | ||
70 | color: props.get(vars.$tab--selected--text-color); | ||
71 | |||
72 | &::after { | ||
73 | display: block; | ||
74 | } | ||
75 | } | ||
76 | } | ||
77 | |||
78 | @include bem.modifier('accent') { | ||
79 | @include bem.elem('tab') { | ||
80 | &::after { | ||
81 | background-color: props.get(vars.$tab--accent--text-color); | ||
82 | } | ||
83 | |||
84 | @include bem.is('selected') { | ||
85 | color: props.get(vars.$tab--accent--text-color); | ||
86 | } | ||
87 | } | ||
88 | } | ||
89 | } | ||
90 | } | ||