summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2022-02-05 19:23:14 +0100
committerVolpeon <git@volpeon.ink>2022-02-05 19:23:14 +0100
commit3b7e35551b499a7b8887adb068d3a80e4088b0c2 (patch)
treee8aa73b422b7d112be2a9deb00c86e3b7cc77749 /src
parentAdded text field (diff)
downloadiro-design-3b7e35551b499a7b8887adb068d3a80e4088b0c2.tar.gz
iro-design-3b7e35551b499a7b8887adb068d3a80e4088b0c2.tar.bz2
iro-design-3b7e35551b499a7b8887adb068d3a80e4088b0c2.zip
Added field-label
Diffstat (limited to 'src')
-rw-r--r--src/index.scss1
-rw-r--r--src/layouts/_card.scss25
-rw-r--r--src/objects/_field-label.scss85
-rw-r--r--src/objects/_text-field.scss5
4 files changed, 102 insertions, 14 deletions
diff --git a/src/index.scss b/src/index.scss
index 5a6a94c..ad3b1af 100644
--- a/src/index.scss
+++ b/src/index.scss
@@ -11,6 +11,7 @@
11@import 'objects/rule'; 11@import 'objects/rule';
12@import 'objects/button'; 12@import 'objects/button';
13@import 'objects/text-field'; 13@import 'objects/text-field';
14@import 'objects/field-label';
14 15
15:root { 16:root {
16 @include iro.props-assign; 17 @include iro.props-assign;
diff --git a/src/layouts/_card.scss b/src/layouts/_card.scss
index f6b6b03..037b29f 100644
--- a/src/layouts/_card.scss
+++ b/src/layouts/_card.scss
@@ -1,35 +1,38 @@
1@include namespace('card') { 1@use 'iro-sass/src/index' as iro;
2 @include store(( 2@use 'include-media/dist/include-media' as media;
3
4@include iro.props-namespace('card') {
5 @include iro.props-store((
3 --dims: ( 6 --dims: (
4 --pad-x: iro-px-to-rem(11px), 7 --pad-x: iro.fn-px-to-rem(11px),
5 --pad-y: iro-px-to-rem(8px), 8 --pad-y: iro.fn-px-to-rem(8px),
6 --lg: ( 9 --lg: (
7 --pad-x: iro-px-to-rem(14px), 10 --pad-x: iro.fn-px-to-rem(14px),
8 --pad-y: iro-px-to-rem(11px), 11 --pad-y: iro.fn-px-to-rem(11px),
9 ) 12 )
10 ) 13 )
11 )); 14 ));
12 15
13 @include layout(namespace()) { 16 @include iro.bem-layout(iro.props-namespace()) {
14 display: flex; 17 display: flex;
15 align-items: center; 18 align-items: center;
16 padding: prop(--dims --pad-y) prop(--dims --pad-x); 19 padding: prop(--dims --pad-y) prop(--dims --pad-x);
17 gap: prop(--dims --pad-x); 20 gap: prop(--dims --pad-x);
18 line-height: 1.4; 21 line-height: 1.4;
19 22
20 @include modifier('lg') { 23 @include iro.bem-modifier('lg') {
21 padding: prop(--dims --lg --pad-y) prop(--dims --lg --pad-x); 24 padding: prop(--dims --lg --pad-y) prop(--dims --lg --pad-x);
22 gap: prop(--dims --lg --pad-x); 25 gap: prop(--dims --lg --pad-x);
23 } 26 }
24 27
25 @include modifier('flush') { 28 @include iro.bem-modifier('flush') {
26 padding: 0; 29 padding: 0;
27 } 30 }
28 31
29 @include element('block') { 32 @include iro.bem-elem('block') {
30 flex: 0 0 auto; 33 flex: 0 0 auto;
31 34
32 @include modifier('main') { 35 @include iro.bem-modifier('main') {
33 flex-shrink: 1; 36 flex-shrink: 1;
34 width: 100%; 37 width: 100%;
35 } 38 }
diff --git a/src/objects/_field-label.scss b/src/objects/_field-label.scss
new file mode 100644
index 0000000..341bf49
--- /dev/null
+++ b/src/objects/_field-label.scss
@@ -0,0 +1,85 @@
1@use 'iro-sass/src/index' as iro;
2@use '../vars';
3@use '../mixins/typography';
4
5@include iro.props-namespace('field-label') {
6 @include iro.props-store((
7 --dims: (
8 --spacing-x: iro.props-get(--dims --spacing --x --sm, $global: true),
9 --spacing-y: iro.props-get(--dims --spacing --y --xs, $global: true),
10 --label-font-size: iro.props-get(--dims --font-size --sm, $global: true),
11 --hint-font-size: iro.props-get(--dims --font-size --sm, $global: true),
12 ),
13 --colors: (
14 --label: iro.props-get(--colors --fg-hi, $global: true),
15 --hint: iro.props-get(--colors --fg, $global: true),
16 --error-hint: iro.props-get(--colors --accent --error, $global: true),
17 --disabled: iro.props-get(--colors --fg-hi3, $global: true),
18 ),
19 ));
20
21 @include iro.bem-object(iro.props-namespace()) {
22 display: inline-block;
23
24 @include iro.bem-elem('label') {
25 display: block;
26 padding-right: iro.props-get(--dims --spacing-x);
27 color: iro.props-get(--colors --label);
28 font-size: iro.props-get(--dims --label-font-size);
29 font-weight: 400;
30 line-height: 1.3;
31
32 @include iro.bem-next-elem('content') {
33 margin-top: iro.props-get(--dims --spacing-y);
34 }
35 }
36
37 @include iro.bem-elem('content') {
38 display: inline-block;
39 }
40
41 @include iro.bem-elem('hint') {
42 display: block;
43 margin-top: iro.props-get(--dims --spacing-y);
44 color: iro.props-get(--colors --hint);
45 font-size: iro.props-get(--dims --hint-font-size);
46 }
47
48 @include iro.bem-is('invalid') {
49 @include iro.bem-elem('hint') {
50 color: iro.props-get(--colors --error-hint);
51 }
52 }
53
54 @include iro.bem-is('disabled') {
55 @include iro.bem-elem('label', 'hint') {
56 color: iro.props-get(--colors --disabled);
57 }
58 }
59
60 @include iro.bem-modifier('left', 'right') {
61 display: inline-flex;
62 align-items: baseline;
63
64 @include iro.bem-elem('label') {
65 display: inline-block;
66
67 @include iro.bem-next-elem('content') {
68 margin-top: 0;
69 }
70 }
71 }
72
73 @include iro.bem-modifier('left') {
74 @include iro.bem-elem('label') {
75 text-align: left;
76 }
77 }
78
79 @include iro.bem-modifier('right') {
80 @include iro.bem-elem('label') {
81 text-align: right;
82 }
83 }
84 }
85}
diff --git a/src/objects/_text-field.scss b/src/objects/_text-field.scss
index f2c3678..ac48216 100644
--- a/src/objects/_text-field.scss
+++ b/src/objects/_text-field.scss
@@ -78,9 +78,8 @@
78 @include iro.bem-elem('input') { 78 @include iro.bem-elem('input') {
79 @include typography.set-font(vars.$font--main, (size: 1em, line-height: vars.$line-height)); 79 @include typography.set-font(vars.$font--main, (size: 1em, line-height: vars.$line-height));
80 80
81 display: block; 81 color: iro.props-get(--colors --text);
82 color: iro.props-get(--colors --text); 82 resize: none;
83 resize: none;
84 83
85 &::placeholder { 84 &::placeholder {
86 opacity: 1; 85 opacity: 1;