summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--package.json2
-rw-r--r--src/_objects.scss1
-rw-r--r--src/layouts/_flex.scss4
-rw-r--r--src/objects/_action-button.scss38
-rw-r--r--src/objects/_icon-nav.scss68
-rw-r--r--src/objects/_menu.scss16
-rw-r--r--tpl/index.pug3
-rw-r--r--tpl/objects/icon-nav.pug29
-rw-r--r--tpl/objects/menu.pug6
-rw-r--r--tpl/views/icon-nav.pug17
10 files changed, 168 insertions, 16 deletions
diff --git a/package.json b/package.json
index 5f463b1..6b07da6 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
11 "build": "npm run build:app && npm run build:style && npm run build:icons && npm run build:assets", 11 "build": "npm run build:app && npm run build:style && npm run build:icons && npm run build:assets",
12 "build:assets": "cp -r static/* public/", 12 "build:assets": "cp -r static/* public/",
13 "build:app": "pug tpl/index.pug -p tpl --out public/", 13 "build:app": "pug tpl/index.pug -p tpl --out public/",
14 "build:icons": "node node_modules/iro-icons/scripts/create_sprite.js check trash bookmark tags lock user chevron-left chevron-right hash x send smile public/icons.svg", 14 "build:icons": "node node_modules/iro-icons/scripts/create_sprite.js check trash bookmark cog logout tags lock user chevron-left chevron-right hash x send smile public/icons.svg",
15 "build:style": "sass --load-path=node_modules src_demo/index.scss public/style.css", 15 "build:style": "sass --load-path=node_modules src_demo/index.scss public/style.css",
16 "lint:style": "stylelint \"src/**/*.scss\"", 16 "lint:style": "stylelint \"src/**/*.scss\"",
17 "fix:style": "stylelint \"src/**/*.scss\" --fix", 17 "fix:style": "stylelint \"src/**/*.scss\" --fix",
diff --git a/src/_objects.scss b/src/_objects.scss
index e2551ad..3e09104 100644
--- a/src/_objects.scss
+++ b/src/_objects.scss
@@ -14,6 +14,7 @@
14@use 'objects/bubble'; 14@use 'objects/bubble';
15@use 'objects/action-menu'; 15@use 'objects/action-menu';
16@use 'objects/menu'; 16@use 'objects/menu';
17@use 'objects/icon-nav';
17@use 'objects/backdrop'; 18@use 'objects/backdrop';
18@use 'objects/dialog'; 19@use 'objects/dialog';
19@use 'objects/lightbox'; 20@use 'objects/lightbox';
diff --git a/src/layouts/_flex.scss b/src/layouts/_flex.scss
index e8cdbaa..d3f4f9c 100644
--- a/src/layouts/_flex.scss
+++ b/src/layouts/_flex.scss
@@ -19,5 +19,9 @@
19 @include iro.bem-modifier('align-end') { 19 @include iro.bem-modifier('align-end') {
20 align-items: flex-end; 20 align-items: flex-end;
21 } 21 }
22
23 @include iro.bem-modifier('column') {
24 flex-direction: column;
25 }
22 } 26 }
23} 27}
diff --git a/src/objects/_action-button.scss b/src/objects/_action-button.scss
index 2dcbb12..1cce94f 100644
--- a/src/objects/_action-button.scss
+++ b/src/objects/_action-button.scss
@@ -103,6 +103,13 @@
103 background-color: fn.color(--active --bg); 103 background-color: fn.color(--active --bg);
104 color: fn.color(--active --label); 104 color: fn.color(--active --label);
105 } 105 }
106
107 @include iro.bem-at-theme('keyboard') {
108 &:focus {
109 background-color: fn.color(--hover --bg);
110 color: fn.color(--hover --label);
111 }
112 }
106 } 113 }
107 114
108 @include iro.bem-is('selected') { 115 @include iro.bem-is('selected') {
@@ -119,6 +126,13 @@
119 background-color: fn.color(--selected --bg); 126 background-color: fn.color(--selected --bg);
120 color: fn.color(--selected --hover --label); 127 color: fn.color(--selected --hover --label);
121 } 128 }
129
130 @include iro.bem-at-theme('keyboard') {
131 &:focus {
132 background-color: fn.color(--selected --bg);
133 color: fn.color(--selected --hover --label);
134 }
135 }
122 } 136 }
123 } 137 }
124 138
@@ -149,6 +163,13 @@
149 box-shadow: none; 163 box-shadow: none;
150 color: fn.color(--quiet --active --label); 164 color: fn.color(--quiet --active --label);
151 } 165 }
166
167 @include iro.bem-at-theme('keyboard') {
168 &:focus {
169 background-color: fn.color(--quiet --hover --bg);
170 color: fn.color(--quiet --hover --label);
171 }
172 }
152 } 173 }
153 174
154 @include iro.bem-is('selected') { 175 @include iro.bem-is('selected') {
@@ -170,18 +191,21 @@
170 box-shadow: none; 191 box-shadow: none;
171 color: fn.color(--quiet --selected --hover --label); 192 color: fn.color(--quiet --selected --hover --label);
172 } 193 }
194
195 @include iro.bem-at-theme('keyboard') {
196 &:focus {
197 background-color: fn.color(--quiet --selected --bg);
198 color: fn.color(--quiet --selected --hover --label);
199 }
200 }
173 } 201 }
174 } 202 }
175 } 203 }
176 204
177 @include iro.bem-at-theme('keyboard') { 205 @include iro.bem-at-theme('keyboard') {
178 &:link, 206 &:focus {
179 &:visited, 207 border-color: fn.color(--key-focus --border);
180 &:enabled { 208 box-shadow: inset 0 0 0 1px fn.color(--key-focus --border), fn.color(--key-focus --shadow);
181 &:focus {
182 border-color: fn.color(--key-focus --border);
183 box-shadow: inset 0 0 0 1px fn.color(--key-focus --border), fn.color(--key-focus --shadow);
184 }
185 } 209 }
186 } 210 }
187 211
diff --git a/src/objects/_icon-nav.scss b/src/objects/_icon-nav.scss
new file mode 100644
index 0000000..25f4a57
--- /dev/null
+++ b/src/objects/_icon-nav.scss
@@ -0,0 +1,68 @@
1@use 'iro-sass/src/index' as iro;
2@use '../functions' as fn;
3
4@include iro.props-namespace('icon-nav') {
5 @include iro.props-store((
6 --dims: (
7 --spacing: fn.global-dim(--size --100),
8 --item: (
9 --pad: fn.global-dim(--size --125),
10 )
11 )
12 ), 'dims');
13
14 @include iro.props-store((
15 --colors: (
16 --item: (
17 --hover: (
18 --bg: fn.global-color(--obj-hi),
19 --label: fn.global-color(--fg-lo),
20 ),
21 --disabled: (
22 --label: fn.global-color(--fg-hi3),
23 ),
24 --key-focus: (
25 --border: fn.global-color(--focus --fill),
26 --shadow: fn.global-color(--focus --shadow),
27 ),
28 ),
29 ),
30 ), 'colors');
31
32 @include iro.bem-object(iro.props-namespace()) {
33 display: flex;
34 align-items: center;
35 gap: fn.dim(--spacing);
36
37 @include iro.bem-elem('item') {
38 padding: fn.dim(--item --pad);
39 border: 2px solid transparent;
40 border-radius: 10em;
41 color: fn.color(--item --disabled --label);
42
43 &:link,
44 &:visited,
45 &:enabled {
46 color: currentColor;
47
48 @include iro.bem-multi('&:hover, &:active', 'is' 'selected') {
49 background-color: fn.color(--item --hover --bg);
50 color: fn.color(--item --hover --label);
51 }
52
53 @include iro.bem-at-theme('keyboard') {
54 &:focus {
55 border-color: fn.color(--item --key-focus --border);
56 background-color: fn.color(--item --hover --bg);
57 box-shadow: fn.color(--item --key-focus --shadow);
58 color: fn.color(--item --hover --label);
59 }
60 }
61 }
62 }
63
64 @include iro.bem-modifier('vertical') {
65 flex-direction: column;
66 }
67 }
68}
diff --git a/src/objects/_menu.scss b/src/objects/_menu.scss
index f732ab7..fae3207 100644
--- a/src/objects/_menu.scss
+++ b/src/objects/_menu.scss
@@ -4,6 +4,7 @@
4@include iro.props-namespace('menu') { 4@include iro.props-namespace('menu') {
5 @include iro.props-store(( 5 @include iro.props-store((
6 --dims: ( 6 --dims: (
7 --spacing: fn.global-dim(--size --25),
7 --header: ( 8 --header: (
8 --font-size: fn.global-dim(--font-size --50), 9 --font-size: fn.global-dim(--font-size --50),
9 ), 10 ),
@@ -30,8 +31,6 @@
30 --label: fn.global-color(--fg-hi3), 31 --label: fn.global-color(--fg-hi3),
31 ), 32 ),
32 --key-focus: ( 33 --key-focus: (
33 --bg: fn.global-color(--obj-hi),
34 --label: fn.global-color(--fg-lo),
35 --border: fn.global-color(--focus --fill), 34 --border: fn.global-color(--focus --fill),
36 --shadow: fn.global-color(--focus --shadow), 35 --shadow: fn.global-color(--focus --shadow),
37 ), 36 ),
@@ -40,6 +39,10 @@
40 ), 'colors'); 39 ), 'colors');
41 40
42 @include iro.bem-object(iro.props-namespace()) { 41 @include iro.bem-object(iro.props-namespace()) {
42 display: flex;
43 flex-direction: column;
44 gap: fn.dim(--spacing);
45
43 @include iro.bem-elem('header') { 46 @include iro.bem-elem('header') {
44 padding: fn.dim(--item --pad-y) fn.dim(--item --pad-x); 47 padding: fn.dim(--item --pad-y) fn.dim(--item --pad-x);
45 color: fn.color(--header --label); 48 color: fn.color(--header --label);
@@ -50,9 +53,6 @@
50 } 53 }
51 54
52 @include iro.bem-elem('item') { 55 @include iro.bem-elem('item') {
53 display: block;
54 box-sizing: border-box;
55 width: 100%;
56 padding: calc(fn.dim(--item --pad-y) - 2px) calc(fn.dim(--item --pad-x) - 2px); 56 padding: calc(fn.dim(--item --pad-y) - 2px) calc(fn.dim(--item --pad-x) - 2px);
57 border: 2px solid transparent; 57 border: 2px solid transparent;
58 border-radius: fn.dim(--item --rounding); 58 border-radius: fn.dim(--item --rounding);
@@ -70,11 +70,11 @@
70 70
71 @include iro.bem-at-theme('keyboard') { 71 @include iro.bem-at-theme('keyboard') {
72 &:focus { 72 &:focus {
73 border-radius: 2px; 73 border-radius: calc(fn.dim(--item --rounding) - 1px);
74 border-color: fn.color(--item --key-focus --border); 74 border-color: fn.color(--item --key-focus --border);
75 background-color: fn.color(--item --key-focus --bg); 75 background-color: fn.color(--item --hover --bg);
76 box-shadow: fn.color(--item --key-focus --shadow); 76 box-shadow: fn.color(--item --key-focus --shadow);
77 color: fn.color(--item --key-focus --label); 77 color: fn.color(--item --hover --label);
78 } 78 }
79 } 79 }
80 } 80 }
diff --git a/tpl/index.pug b/tpl/index.pug
index 4ed1ae3..6565589 100644
--- a/tpl/index.pug
+++ b/tpl/index.pug
@@ -21,6 +21,7 @@ include objects/status-indicator.pug
21include objects/avatar.pug 21include objects/avatar.pug
22include objects/action-menu.pug 22include objects/action-menu.pug
23include objects/menu.pug 23include objects/menu.pug
24include objects/icon-nav.pug
24include objects/backdrop.pug 25include objects/backdrop.pug
25include objects/dialog.pug 26include objects/dialog.pug
26include objects/lightbox.pug 27include objects/lightbox.pug
@@ -64,6 +65,7 @@ include views/status-indicator.pug
64include views/avatar.pug 65include views/avatar.pug
65include views/action-menu.pug 66include views/action-menu.pug
66include views/menu.pug 67include views/menu.pug
68include views/icon-nav.pug
67include views/backdrop.pug 69include views/backdrop.pug
68include views/dialog.pug 70include views/dialog.pug
69include views/lightbox.pug 71include views/lightbox.pug
@@ -101,6 +103,7 @@ html
101 +view-avatar 103 +view-avatar
102 +view-action-menu 104 +view-action-menu
103 +view-menu 105 +view-menu
106 +view-icon-nav
104 +view-backdrop 107 +view-backdrop
105 +view-dialog 108 +view-dialog
106 +view-lightbox 109 +view-lightbox
diff --git a/tpl/objects/icon-nav.pug b/tpl/objects/icon-nav.pug
new file mode 100644
index 0000000..6f45bf6
--- /dev/null
+++ b/tpl/objects/icon-nav.pug
@@ -0,0 +1,29 @@
1include icon.pug
2include status-indicator.pug
3include action-button.pug
4
5mixin icon-nav
6 -
7 let classes = {
8 'o-icon-nav': true,
9 'o-icon-nav--vertical': attributes.vertical,
10 }
11 if (attributes.class) {
12 classes[attributes.class] = true;
13 }
14
15 div(class=classes)&attributes(attributes)
16 block
17
18mixin icon-nav-item(icon)
19 -
20 let classes = {
21 'o-icon-nav__item': true,
22 'is-selected': attributes.selected,
23 }
24 if (attributes.class) {
25 classes[attributes.class] = true;
26 }
27
28 button(class=classes)&attributes(attributes)
29 +icon(icon)(block=true)
diff --git a/tpl/objects/menu.pug b/tpl/objects/menu.pug
index c6e8223..f9d59b8 100644
--- a/tpl/objects/menu.pug
+++ b/tpl/objects/menu.pug
@@ -7,6 +7,9 @@ mixin menu
7 let classes = { 7 let classes = {
8 'o-menu': true, 8 'o-menu': true,
9 } 9 }
10 if (attributes.class) {
11 classes[attributes.class] = true;
12 }
10 13
11 div(class=classes)&attributes(attributes) 14 div(class=classes)&attributes(attributes)
12 block 15 block
@@ -17,6 +20,9 @@ mixin menu-item
17 'o-menu__item': true, 20 'o-menu__item': true,
18 'is-selected': attributes.selected, 21 'is-selected': attributes.selected,
19 } 22 }
23 if (attributes.class) {
24 classes[attributes.class] = true;
25 }
20 26
21 #{!!attributes.tag ? attributes.tag : 'button'}(class=classes)&attributes(attributes) 27 #{!!attributes.tag ? attributes.tag : 'button'}(class=classes)&attributes(attributes)
22 .l-card.l-card--flush.l-card--75 28 .l-card.l-card--flush.l-card--75
diff --git a/tpl/views/icon-nav.pug b/tpl/views/icon-nav.pug
new file mode 100644
index 0000000..e71229d
--- /dev/null
+++ b/tpl/views/icon-nav.pug
@@ -0,0 +1,17 @@
1mixin view-icon-nav
2 +view('icon-nav', 'Icon nav')
3 .c-box
4 +icon-nav
5 +icon-nav-item('hash')
6 +icon-nav-item('bookmark')(selected=true)
7 +icon-nav-item('tags')
8 +icon-nav-item('cog')(class='u-ml-auto')
9 +icon-nav-item('logout')
10
11 .c-box
12 +icon-nav(vertical=true style={ height: '20em' })
13 +icon-nav-item('hash')
14 +icon-nav-item('bookmark')(selected=true)
15 +icon-nav-item('tags')
16 +icon-nav-item('cog')(class='u-mt-auto')
17 +icon-nav-item('logout')