diff options
author | Volpeon <git@volpeon.ink> | 2024-06-25 19:17:42 +0200 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2024-06-25 19:17:42 +0200 |
commit | bfd2f3750498826f457f96b7dd89476589fa31cd (patch) | |
tree | 4bdc8cdc3eb33fcf283353e42c3b596e990e213b | |
parent | Focus indicator style (diff) | |
download | iro-design-bfd2f3750498826f457f96b7dd89476589fa31cd.tar.gz iro-design-bfd2f3750498826f457f96b7dd89476589fa31cd.tar.bz2 iro-design-bfd2f3750498826f457f96b7dd89476589fa31cd.zip |
Fix form
-rw-r--r-- | src/layouts/_form.scss | 20 | ||||
-rw-r--r-- | src/objects/_field-label.scss | 4 | ||||
-rw-r--r-- | src/objects/_switch.scss | 6 | ||||
-rw-r--r-- | tpl/objects/form.pug | 4 | ||||
-rw-r--r-- | tpl/views/form.pug | 43 |
5 files changed, 39 insertions, 38 deletions
diff --git a/src/layouts/_form.scss b/src/layouts/_form.scss index 9c741ec..f6b60ea 100644 --- a/src/layouts/_form.scss +++ b/src/layouts/_form.scss | |||
@@ -6,8 +6,8 @@ | |||
6 | @include iro.props-namespace('form') { | 6 | @include iro.props-namespace('form') { |
7 | @include iro.props-store(( | 7 | @include iro.props-store(( |
8 | --dims: ( | 8 | --dims: ( |
9 | --item-spacing-y: fn.global-dim(--size --325), | 9 | --item-spacing-b: fn.global-dim(--size --325), |
10 | --label-spacing-x: fn.global-dim(--size --325), | 10 | --label-spacing-i: fn.global-dim(--size --325), |
11 | --hint-font-size: fn.global-dim(--font-size --75), | 11 | --hint-font-size: fn.global-dim(--font-size --75), |
12 | ), | 12 | ), |
13 | )); | 13 | )); |
@@ -15,7 +15,7 @@ | |||
15 | @include iro.bem-layout(iro.props-namespace()) { | 15 | @include iro.bem-layout(iro.props-namespace()) { |
16 | display: flex; | 16 | display: flex; |
17 | flex-direction: column; | 17 | flex-direction: column; |
18 | gap: fn.dim(--item-spacing-y) fn.dim(--label-spacing-x); | 18 | gap: fn.dim(--item-spacing-b) fn.dim(--label-spacing-i); |
19 | 19 | ||
20 | @include iro.bem-elem('item') { | 20 | @include iro.bem-elem('item') { |
21 | display: block; | 21 | display: block; |
@@ -32,7 +32,7 @@ | |||
32 | align-items: flex-end; | 32 | align-items: flex-end; |
33 | } | 33 | } |
34 | 34 | ||
35 | @include iro.bem-modifier('labels-left', 'labels-right') { | 35 | @include iro.bem-modifier('labels-start', 'labels-end') { |
36 | display: grid; | 36 | display: grid; |
37 | grid-template-columns: auto 1fr; | 37 | grid-template-columns: auto 1fr; |
38 | grid-template-rows: auto; | 38 | grid-template-rows: auto; |
@@ -43,19 +43,19 @@ | |||
43 | } | 43 | } |
44 | 44 | ||
45 | @include iro.bem-elem('item-label') { | 45 | @include iro.bem-elem('item-label') { |
46 | grid-column: 1; | 46 | grid-column: 1; |
47 | padding-right: 0; | 47 | padding-inline-end: 0; |
48 | } | 48 | } |
49 | 49 | ||
50 | @include iro.bem-elem('item-content') { | 50 | @include iro.bem-elem('item-content') { |
51 | grid-column: 2; | 51 | grid-column: 2; |
52 | margin-top: 0; | 52 | margin-block-start: 0; |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | @include iro.bem-modifier('labels-right') { | 56 | @include iro.bem-modifier('labels-end') { |
57 | @include iro.bem-elem('item-label') { | 57 | @include iro.bem-elem('item-label') { |
58 | text-align: right; | 58 | text-align: end; |
59 | } | 59 | } |
60 | } | 60 | } |
61 | } | 61 | } |
diff --git a/src/objects/_field-label.scss b/src/objects/_field-label.scss index 9f267cb..1518ea6 100644 --- a/src/objects/_field-label.scss +++ b/src/objects/_field-label.scss | |||
@@ -35,8 +35,8 @@ | |||
35 | } | 35 | } |
36 | 36 | ||
37 | @include iro.bem-elem('content') { | 37 | @include iro.bem-elem('content') { |
38 | display: block; | 38 | display: block; |
39 | inline-size: 100%; | 39 | flex: 1 1 auto; |
40 | } | 40 | } |
41 | 41 | ||
42 | @include iro.bem-elem('hint') { | 42 | @include iro.bem-elem('hint') { |
diff --git a/src/objects/_switch.scss b/src/objects/_switch.scss index a67aa8d..e1f1132 100644 --- a/src/objects/_switch.scss +++ b/src/objects/_switch.scss | |||
@@ -16,17 +16,17 @@ | |||
16 | --key-focus: ( | 16 | --key-focus: ( |
17 | --border: fn.global-dim(--key-focus --border), | 17 | --border: fn.global-dim(--key-focus --border), |
18 | --border-offset: fn.global-dim(--key-focus --border-offset), | 18 | --border-offset: fn.global-dim(--key-focus --border-offset), |
19 | --outline: fn.global-dim(--key-focus --border), | 19 | --outline: fn.global-dim(--key-focus --outline), |
20 | ), | 20 | ), |
21 | ), | 21 | ), |
22 | --colors: ( | 22 | --colors: ( |
23 | --track-bg: fn.global-color(--border), | 23 | --track-bg: fn.global-color(--border), |
24 | --handle-border: fn.global-color(--text-mute), | 24 | --handle-border: fn.global-color(--text-mute-more), |
25 | --handle-bg: fn.global-color(--base --50), | 25 | --handle-bg: fn.global-color(--base --50), |
26 | 26 | ||
27 | --hover: ( | 27 | --hover: ( |
28 | --label: fn.global-color(--heading), | 28 | --label: fn.global-color(--heading), |
29 | --handle-border: fn.global-color(--text), | 29 | --handle-border: fn.global-color(--text-mute), |
30 | ), | 30 | ), |
31 | --accent: ( | 31 | --accent: ( |
32 | --handle-border: fn.global-color(--accent --900), | 32 | --handle-border: fn.global-color(--accent --900), |
diff --git a/tpl/objects/form.pug b/tpl/objects/form.pug index 24ac3f0..cbb1758 100644 --- a/tpl/objects/form.pug +++ b/tpl/objects/form.pug | |||
@@ -3,8 +3,8 @@ include field-label.pug | |||
3 | mixin form | 3 | mixin form |
4 | form(class={ | 4 | form(class={ |
5 | 'l-form': true, | 5 | 'l-form': true, |
6 | 'l-form--labels-left': attributes.labelsAlign === 'left', | 6 | 'l-form--labels-start': attributes.labelsAlign === 'start', |
7 | 'l-form--labels-right': attributes.labelsAlign === 'right', | 7 | 'l-form--labels-end': attributes.labelsAlign === 'end', |
8 | 'l-form--labels-above': attributes.labelsAlign === 'above' | 8 | 'l-form--labels-above': attributes.labelsAlign === 'above' |
9 | }) | 9 | }) |
10 | block | 10 | block |
diff --git a/tpl/views/form.pug b/tpl/views/form.pug index 859e9a6..5b24757 100644 --- a/tpl/views/form.pug +++ b/tpl/views/form.pug | |||
@@ -1,29 +1,30 @@ | |||
1 | mixin view-form | 1 | mixin view-form |
2 | +view('form', 'Form') | 2 | +view('form', 'Form') |
3 | .c-box | 3 | each align in ['above', 'start', 'end'] |
4 | +form(labelsAlign="left") | 4 | .c-box |
5 | +form-item('Username') | 5 | +form(labelsAlign=align) |
6 | +text-field(placeholder='Example: Volpeon') | 6 | +form-item('Username') |
7 | +text-field(placeholder='Example: Volpeon') | ||
7 | 8 | ||
8 | +form-item('Password', 'At least 6 characters, all characters allowed') | 9 | +form-item('Password', 'At least 6 characters, all characters allowed') |
9 | +text-field(placeholder='Example: hunter2' type='password') | 10 | +text-field(placeholder='Example: hunter2' type='password') |
10 | 11 | ||
11 | +form-item('Bio') | 12 | +form-item('Bio') |
12 | +text-field(placeholder='Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam...') | 13 | +text-field(placeholder='Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam...') |
13 | 14 | ||
14 | +form-item('Favorite animal') | 15 | +form-item('Favorite animal') |
15 | +radio(name="form-demo-1" checked=true)= 'Foxes' | 16 | +radio(name="form-demo-1" checked=true)= 'Foxes' |
16 | +radio(name="form-demo-1")= 'Other' | 17 | +radio(name="form-demo-1")= 'Other' |
17 | 18 | ||
18 | +form-item('Notification settings') | 19 | +form-item('Notification settings') |
19 | +switch= 'In-app notifications' | 20 | +switch= 'In-app notifications' |
20 | br | 21 | br |
21 | +switch= 'Desktop notifications' | 22 | +switch= 'Desktop notifications' |
22 | br | 23 | br |
23 | +switch= 'Email notifications' | 24 | +switch= 'Email notifications' |
24 | 25 | ||
25 | +form-item('') | 26 | +form-item('') |
26 | +checkbox= 'I\'ve read and accept the terms and conditions' | 27 | +checkbox= 'I\'ve read and accept the terms and conditions' |
27 | 28 | ||
28 | +form-item('') | 29 | +form-item('') |
29 | +a-button(variant='primary')= 'Register' | 30 | +a-button(variant='primary')= 'Register' |