diff options
Diffstat (limited to 'src/objects/_field-label.scss')
-rw-r--r-- | src/objects/_field-label.scss | 76 |
1 files changed, 33 insertions, 43 deletions
diff --git a/src/objects/_field-label.scss b/src/objects/_field-label.scss index 1518ea6..564ab2b 100644 --- a/src/objects/_field-label.scss +++ b/src/objects/_field-label.scss | |||
@@ -1,84 +1,74 @@ | |||
1 | @use 'iro-sass/src/index' as iro; | 1 | @use 'sass:meta'; |
2 | @use '../functions' as fn; | 2 | @use 'iro-sass/src/bem'; |
3 | @use 'iro-sass/src/props'; | ||
4 | @use '../props' as *; | ||
3 | 5 | ||
4 | @include iro.props-namespace('field-label') { | 6 | @forward 'field-label.vars'; |
5 | @include iro.props-store(( | 7 | @use 'field-label.vars' as vars; |
6 | --dims: ( | ||
7 | --spacing-i: fn.global-dim(--size --150), | ||
8 | --spacing-b: fn.global-dim(--size --85), | ||
9 | --label-font-size: fn.global-dim(--font-size --75), | ||
10 | --hint-font-size: fn.global-dim(--font-size --75), | ||
11 | ), | ||
12 | --colors: ( | ||
13 | --label: fn.global-color(--text-mute), | ||
14 | --hint: fn.global-color(--text-mute), | ||
15 | --error-hint: fn.global-color(--negative --900), | ||
16 | --disabled: fn.global-color(--text-disabled), | ||
17 | ), | ||
18 | )); | ||
19 | 8 | ||
20 | @include iro.bem-object(iro.props-namespace()) { | 9 | @mixin styles { |
21 | display: block; | 10 | @include materialize-at-root(meta.module-variables('vars')); |
22 | 11 | ||
23 | @include iro.bem-elem('label') { | 12 | @include bem.object('field-label') { |
13 | @include bem.elem('label') { | ||
24 | display: block; | 14 | display: block; |
25 | flex: 0 0 auto; | 15 | flex: 0 0 auto; |
26 | padding-inline-end: fn.dim(--spacing-i); | 16 | padding-inline-end: props.get(vars.$spacing-i); |
27 | color: fn.color(--label); | 17 | font-size: props.get(vars.$label-font-size); |
28 | font-size: fn.dim(--label-font-size); | ||
29 | font-weight: 400; | 18 | font-weight: 400; |
30 | line-height: 1.3; | 19 | line-height: 1.3; |
20 | color: props.get(vars.$label-color); | ||
31 | 21 | ||
32 | @include iro.bem-next-elem('content') { | 22 | @include bem.next-elem('content') { |
33 | margin-block-start: fn.dim(--spacing-b); | 23 | margin-block-start: props.get(vars.$spacing-b); |
34 | } | 24 | } |
35 | } | 25 | } |
36 | 26 | ||
37 | @include iro.bem-elem('content') { | 27 | @include bem.elem('content') { |
38 | display: block; | 28 | display: block; |
39 | flex: 1 1 auto; | 29 | flex: 1 1 auto; |
40 | } | 30 | } |
41 | 31 | ||
42 | @include iro.bem-elem('hint') { | 32 | @include bem.elem('hint') { |
43 | display: block; | 33 | display: block; |
44 | margin-block-start: fn.dim(--spacing-b); | 34 | margin-block-start: props.get(vars.$spacing-b); |
45 | color: fn.color(--hint); | 35 | font-size: props.get(vars.$hint-font-size); |
46 | font-size: fn.dim(--hint-font-size); | 36 | color: props.get(vars.$hint-color); |
47 | } | 37 | } |
48 | 38 | ||
49 | @include iro.bem-is('invalid') { | 39 | @include bem.is('invalid') { |
50 | @include iro.bem-elem('hint') { | 40 | @include bem.elem('hint') { |
51 | color: fn.color(--error-hint); | 41 | color: props.get(vars.$error-hint-color); |
52 | } | 42 | } |
53 | } | 43 | } |
54 | 44 | ||
55 | @include iro.bem-is('disabled') { | 45 | @include bem.is('disabled') { |
56 | @include iro.bem-elem('label', 'hint') { | 46 | @include bem.elem('label', 'hint') { |
57 | color: fn.color(--disabled); | 47 | color: props.get(vars.$disabled-color); |
58 | } | 48 | } |
59 | } | 49 | } |
60 | 50 | ||
61 | @include iro.bem-modifier('align-start', 'align-end') { | 51 | @include bem.modifier('align-start', 'align-end') { |
62 | display: flex; | 52 | display: flex; |
63 | align-items: baseline; | 53 | align-items: baseline; |
64 | 54 | ||
65 | @include iro.bem-elem('label') { | 55 | @include bem.elem('label') { |
66 | display: inline-block; | 56 | display: inline-block; |
67 | 57 | ||
68 | @include iro.bem-next-elem('content') { | 58 | @include bem.next-elem('content') { |
69 | margin-block-start: 0; | 59 | margin-block-start: 0; |
70 | } | 60 | } |
71 | } | 61 | } |
72 | } | 62 | } |
73 | 63 | ||
74 | @include iro.bem-modifier('align-start') { | 64 | @include bem.modifier('align-start') { |
75 | @include iro.bem-elem('label') { | 65 | @include bem.elem('label') { |
76 | text-align: start; | 66 | text-align: start; |
77 | } | 67 | } |
78 | } | 68 | } |
79 | 69 | ||
80 | @include iro.bem-modifier('align-end') { | 70 | @include bem.modifier('align-end') { |
81 | @include iro.bem-elem('label') { | 71 | @include bem.elem('label') { |
82 | text-align: end; | 72 | text-align: end; |
83 | } | 73 | } |
84 | } | 74 | } |