nwl-components 1.8.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +132 -0
- package/base.css +63 -0
- package/dist/base.css +63 -0
- package/dist/nwl-components.es.js +683 -676
- package/dist/nwl-components.umd.js +6 -6
- package/dist/sort/style.css +14 -5
- package/dist/style.css +2 -1
- package/dist/tokens.css +9 -3
- package/dist/widgets.css +172 -0
- package/package.json +20 -2
- package/sort/style.css +14 -5
- package/tokens.css +9 -3
- package/widgets.css +172 -0
package/tokens.css
CHANGED
|
@@ -66,6 +66,8 @@
|
|
|
66
66
|
--nwl-text-3: var(--nwl-white-40);
|
|
67
67
|
--nwl-text-placeholder: var(--nwl-grey-cc);
|
|
68
68
|
--nwl-text-inverse: var(--nwl-black);
|
|
69
|
+
/* the text of push buttons (nwl-components/widgets.css), a little dimmer than --nwl-text */
|
|
70
|
+
--nwl-text-button: var(--nwl-grey-dd);
|
|
69
71
|
|
|
70
72
|
/* accent (selection, focus): the colour, hover or pressed, a tinted background, as text */
|
|
71
73
|
--nwl-accent: var(--nwl-cyan);
|
|
@@ -73,9 +75,13 @@
|
|
|
73
75
|
--nwl-accent-subtle: var(--nwl-cyan-15);
|
|
74
76
|
--nwl-accent-fg: var(--nwl-cyan);
|
|
75
77
|
|
|
76
|
-
/*
|
|
77
|
-
--nwl-
|
|
78
|
-
|
|
78
|
+
/* keyboard focus outline (base.css, :focus-visible); white for now, may become the accent */
|
|
79
|
+
--nwl-focus: var(--nwl-text);
|
|
80
|
+
|
|
81
|
+
/* links and status colours. Links are the text colour (decision U8): they must stay
|
|
82
|
+
distinguishable without colour, by an underline (the browser's default) */
|
|
83
|
+
--nwl-link: var(--nwl-text);
|
|
84
|
+
--nwl-link-hover: var(--nwl-text);
|
|
79
85
|
--nwl-danger: var(--nwl-red);
|
|
80
86
|
--nwl-success: var(--nwl-green);
|
|
81
87
|
--nwl-warning: var(--nwl-amber);
|
package/widgets.css
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
@layer nwl.base, nwl.widgets, nwl.components;
|
|
2
|
+
@layer nwl.widgets {
|
|
3
|
+
/* nwl-components widgets: `import 'nwl-components/widgets.css'` (after `nwl-components/tokens.css`
|
|
4
|
+
and `nwl-components/base.css`), or `<link>` the three files on a page with no bundle.
|
|
5
|
+
dist/style.css includes it.
|
|
6
|
+
|
|
7
|
+
Class-based widgets for markup that isn't Vue (Mustache pages, viewer tool panels), also used by
|
|
8
|
+
the library's own components. The build puts this file in `@layer nwl.widgets`, above
|
|
9
|
+
nwl.base and below nwl.components, and every selector is wrapped in :where(), so an app rule
|
|
10
|
+
with a single class (outside any layer) always wins.
|
|
11
|
+
|
|
12
|
+
State is carried by ARIA attributes, not classes, so screen readers get it too:
|
|
13
|
+
`aria-pressed="true"` on a tool button, `aria-selected="true"` on a table row,
|
|
14
|
+
`disabled` (or `aria-disabled="true"` on a link) on a button. */
|
|
15
|
+
|
|
16
|
+
/* Push button: a text button with a light outline (Save, Cancel, Create Project). Works on
|
|
17
|
+
<button>, <a>, <select> and <input type="button|submit">. */
|
|
18
|
+
:where(.nwl-push-button) {
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
vertical-align: middle;
|
|
24
|
+
-webkit-appearance: none;
|
|
25
|
+
appearance: none;
|
|
26
|
+
margin: 0;
|
|
27
|
+
padding: 5px 0;
|
|
28
|
+
border: 1px solid var(--nwl-border-strong);
|
|
29
|
+
border-radius: var(--nwl-radius-md);
|
|
30
|
+
background: transparent;
|
|
31
|
+
color: var(--nwl-text-button);
|
|
32
|
+
font-size: inherit;
|
|
33
|
+
font-weight: var(--nwl-weight-bold);
|
|
34
|
+
text-align: center;
|
|
35
|
+
text-decoration: none;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* hover on a text button: a lighter background, so the text keeps its contrast */
|
|
40
|
+
:where(.nwl-push-button:hover) {
|
|
41
|
+
background: var(--nwl-bg-pressed);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:where(.nwl-push-button:disabled, .nwl-push-button[aria-disabled="true"]) {
|
|
45
|
+
opacity: 0.4;
|
|
46
|
+
cursor: default;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* the options of a <select class="nwl-push-button"> keep the text colour */
|
|
50
|
+
:where(.nwl-push-button) :where(option) {
|
|
51
|
+
color: var(--nwl-text);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Tool button: a button of a viewer's tool panel, holding a short text or one icon. Like the
|
|
55
|
+
apps' div tools it replaces, it fills its container's width (the panel's layout sets it),
|
|
56
|
+
less its 1px margins, and is 24px high. */
|
|
57
|
+
:where(.nwl-tool-button) {
|
|
58
|
+
box-sizing: border-box;
|
|
59
|
+
display: block;
|
|
60
|
+
position: relative;
|
|
61
|
+
width: calc(100% - 2px);
|
|
62
|
+
height: 24px;
|
|
63
|
+
-webkit-appearance: none;
|
|
64
|
+
appearance: none;
|
|
65
|
+
margin: 1px;
|
|
66
|
+
padding: 0;
|
|
67
|
+
border: 1px solid var(--nwl-border);
|
|
68
|
+
border-radius: var(--nwl-radius-sm);
|
|
69
|
+
background: transparent;
|
|
70
|
+
color: var(--nwl-text);
|
|
71
|
+
font-size: inherit;
|
|
72
|
+
text-align: center;
|
|
73
|
+
user-select: none;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* in a group of tools (BrainBox `.a.sub`): no border, 22px */
|
|
78
|
+
:where(.nwl-tool-button--sub) {
|
|
79
|
+
width: 100%;
|
|
80
|
+
height: 22px;
|
|
81
|
+
margin: 0;
|
|
82
|
+
border: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* hover: a lighter background on a text button; half opacity on a button holding only an icon
|
|
86
|
+
(an img, svg or .nwl-icon as its only element) */
|
|
87
|
+
:where(.nwl-tool-button:hover) {
|
|
88
|
+
background: var(--nwl-bg-pressed);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
:where(.nwl-tool-button:has(> :is(img, svg, .nwl-icon):only-child):hover) {
|
|
92
|
+
background: transparent;
|
|
93
|
+
opacity: 0.5;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* the tool that is on: aria-pressed="true" (a toggle, or the current tool of a group) */
|
|
97
|
+
:where(.nwl-tool-button[aria-pressed="true"]) {
|
|
98
|
+
background: var(--nwl-bg-pressed);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:where(.nwl-tool-button:disabled, .nwl-tool-button[aria-disabled="true"]) {
|
|
102
|
+
opacity: 0.4;
|
|
103
|
+
cursor: default;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* Icon button: a button showing only an icon, with no border. It has no visible text, so it
|
|
107
|
+
needs an accessible name: aria-label="…" (or the icon's alt text). */
|
|
108
|
+
:where(.nwl-icon-button) {
|
|
109
|
+
box-sizing: border-box;
|
|
110
|
+
display: inline-flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: center;
|
|
113
|
+
vertical-align: middle;
|
|
114
|
+
-webkit-appearance: none;
|
|
115
|
+
appearance: none;
|
|
116
|
+
margin: 0;
|
|
117
|
+
padding: 0;
|
|
118
|
+
border: none;
|
|
119
|
+
background: transparent;
|
|
120
|
+
color: inherit;
|
|
121
|
+
font-size: inherit;
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:where(.nwl-icon-button:hover) {
|
|
126
|
+
opacity: 0.5;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
:where(.nwl-icon-button:disabled, .nwl-icon-button[aria-disabled="true"]) {
|
|
130
|
+
opacity: 0.4;
|
|
131
|
+
cursor: default;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Icon: a 16px image (img or svg) aligned with the text */
|
|
135
|
+
:where(.nwl-icon) {
|
|
136
|
+
width: 16px;
|
|
137
|
+
height: 16px;
|
|
138
|
+
vertical-align: middle;
|
|
139
|
+
user-select: none;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* Text field: <input> and <textarea>. Size and colour come from the parent. */
|
|
143
|
+
:where(.nwl-text-field) {
|
|
144
|
+
box-sizing: border-box;
|
|
145
|
+
margin: 0;
|
|
146
|
+
padding: 0;
|
|
147
|
+
border: 1px solid var(--nwl-border);
|
|
148
|
+
border-radius: var(--nwl-radius-sm);
|
|
149
|
+
background: var(--nwl-bg-input);
|
|
150
|
+
color: inherit;
|
|
151
|
+
font-size: inherit;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:where(.nwl-text-field)::placeholder {
|
|
155
|
+
color: var(--nwl-text-placeholder);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
:where(.nwl-text-field:disabled) {
|
|
159
|
+
color: var(--nwl-text-3);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* Keyboard focus on the widgets, also on pages without base.css's `.app`: as base.css */
|
|
163
|
+
:where(:is(.nwl-push-button, .nwl-tool-button, .nwl-icon-button, .nwl-text-field):focus-visible) {
|
|
164
|
+
outline: 2px solid var(--nwl-focus);
|
|
165
|
+
outline-offset: 2px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* Selected table row: aria-selected="true" on the <tr> */
|
|
169
|
+
:where(tr[aria-selected="true"]) {
|
|
170
|
+
background: var(--nwl-bg-elevated);
|
|
171
|
+
}
|
|
172
|
+
}
|