diff options
Diffstat (limited to 'src/objects/_tabbar.scss')
-rw-r--r-- | src/objects/_tabbar.scss | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/src/objects/_tabbar.scss b/src/objects/_tabbar.scss new file mode 100644 index 0000000..aaa6f07 --- /dev/null +++ b/src/objects/_tabbar.scss | |||
@@ -0,0 +1,112 @@ | |||
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 'tabbar.vars'; | ||
9 | @use 'tabbar.vars' as vars; | ||
10 | |||
11 | @mixin styles { | ||
12 | @include materialize-at-root(meta.module-variables('vars')); | ||
13 | |||
14 | @include bem.object('tabbar') { | ||
15 | min-inline-size: 0; | ||
16 | block-size: props.get(vars.$block-size); | ||
17 | |||
18 | &::after { | ||
19 | display: block; | ||
20 | block-size: props.get(vars.$indicator--width); | ||
21 | margin-block-start: calc(-1 * props.get(vars.$indicator--width)); | ||
22 | content: ''; | ||
23 | background-color: props.get(vars.$railing--bg-color); | ||
24 | } | ||
25 | |||
26 | @include bem.elem('tabs') { | ||
27 | display: flex; | ||
28 | block-size: 100%; | ||
29 | margin-inline: calc(-.5 * props.get(vars.$spacing)); | ||
30 | overflow-inline: auto; | ||
31 | } | ||
32 | |||
33 | @include bem.modifier('quiet') { | ||
34 | box-shadow: none; | ||
35 | } | ||
36 | |||
37 | @include bem.modifier('adapt') { | ||
38 | block-size: 100%; | ||
39 | } | ||
40 | |||
41 | @include bem.elem('tab') { | ||
42 | position: relative; | ||
43 | display: flex; | ||
44 | align-items: center; | ||
45 | padding-inline: calc(.5 * props.get(vars.$spacing)); | ||
46 | color: props.get(vars.$tab--text-color); | ||
47 | white-space: nowrap; | ||
48 | |||
49 | &::before { | ||
50 | position: absolute; | ||
51 | inset-block-start: 50%; | ||
52 | inset-inline: calc(-1 * props.get(vars.$tab--pad-i) + .5 * props.get(vars.$spacing)); | ||
53 | z-index: -10; | ||
54 | block-size: 1.5em; | ||
55 | content: ''; | ||
56 | border-radius: props.get(vars.$rounding); | ||
57 | transform: translateY(-50%); | ||
58 | } | ||
59 | |||
60 | &::after { | ||
61 | position: absolute; | ||
62 | inset-block-end: 0; | ||
63 | inset-inline: calc(.5 * props.get(vars.$spacing)); | ||
64 | z-index: 10; | ||
65 | display: none; | ||
66 | block-size: props.get(vars.$indicator--width); | ||
67 | content: ''; | ||
68 | background-color: props.get(vars.$tab--selected--text-color); | ||
69 | } | ||
70 | |||
71 | &:link, | ||
72 | &:visited { | ||
73 | &:hover, | ||
74 | &:active, | ||
75 | &:focus-visible { | ||
76 | color: props.get(vars.$tab--selected--text-color); | ||
77 | } | ||
78 | |||
79 | &:focus-visible { | ||
80 | &::before { | ||
81 | color: props.get(vars.$key-focus--text-color); | ||
82 | text-decoration: none; | ||
83 | outline: props.get(vars.$key-focus--border-color) solid props.get(vars.$key-focus--border-width); | ||
84 | box-shadow: 0 0 0 | ||
85 | calc(props.get(vars.$key-focus--border-width) + props.get(vars.$key-focus--outline-width)) | ||
86 | props.get(vars.$key-focus--outline-color); | ||
87 | } | ||
88 | } | ||
89 | } | ||
90 | |||
91 | @include bem.is('selected') { | ||
92 | color: props.get(vars.$tab--selected--text-color); | ||
93 | |||
94 | &::after { | ||
95 | display: block; | ||
96 | } | ||
97 | } | ||
98 | } | ||
99 | |||
100 | @include bem.modifier('accent') { | ||
101 | @include bem.elem('tab') { | ||
102 | &::after { | ||
103 | background-color: props.get(vars.$tab--accent--text-color); | ||
104 | } | ||
105 | |||
106 | @include bem.is('selected') { | ||
107 | color: props.get(vars.$tab--accent--text-color); | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | } | ||
112 | } | ||