@oscarpalmer/oui 0.11.0 → 0.13.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/dist/css/badge.css +14 -7
- package/dist/css/button.css +6 -4
- package/dist/css/color.css +25 -25
- package/dist/css/content.css +193 -0
- package/dist/css/form.css +128 -66
- package/dist/css/message.css +23 -16
- package/dist/css/reset.css +3 -1
- package/dist/css/table.css +26 -9
- package/dist/css/tooltip.css +14 -0
- package/dist/js/attributable.cjs +51 -0
- package/dist/js/attributable.js +51 -0
- package/dist/js/focus-trap.cjs +19 -62
- package/dist/js/focus-trap.js +19 -62
- package/dist/js/tooltip.cjs +203 -0
- package/dist/js/tooltip.js +202 -0
- package/package.json +17 -7
- package/src/css/badge.scss +17 -10
- package/src/css/button.scss +5 -3
- package/src/css/color.scss +25 -25
- package/src/css/content.scss +156 -0
- package/src/css/form.scss +124 -56
- package/src/css/message.scss +29 -21
- package/src/css/mixins.scss +38 -6
- package/src/css/reset.scss +3 -2
- package/src/css/table.scss +32 -7
- package/src/css/tooltip.scss +14 -0
- package/src/js/attributable.ts +70 -0
- package/src/js/focus-trap.ts +16 -64
- package/src/js/tooltip.ts +289 -0
- package/types/attributable.d.cts +5 -0
- package/types/attributable.d.ts +1 -0
- package/types/tooltip.d.cts +3 -0
- package/types/tooltip.d.ts +1 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { isNullableOrWhitespace } from "@oscarpalmer/atoms/is";
|
|
2
|
+
import { on } from "@oscarpalmer/toretto/event";
|
|
3
|
+
import { attributable } from "./attributable.js";
|
|
4
|
+
class Tooltip {
|
|
5
|
+
constructor(parent) {
|
|
6
|
+
this.parent = parent;
|
|
7
|
+
this.element = getContent(parent);
|
|
8
|
+
if (this.element != null) {
|
|
9
|
+
parent.insertAdjacentElement("afterend", this.element);
|
|
10
|
+
initialize(this);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
abortController = new AbortController();
|
|
14
|
+
activate;
|
|
15
|
+
active = false;
|
|
16
|
+
deactivate;
|
|
17
|
+
element;
|
|
18
|
+
frame;
|
|
19
|
+
destroy() {
|
|
20
|
+
deactivate(this);
|
|
21
|
+
this.abortController.abort();
|
|
22
|
+
this.abortController = void 0;
|
|
23
|
+
this.activate = void 0;
|
|
24
|
+
this.deactivate = void 0;
|
|
25
|
+
this.element = void 0;
|
|
26
|
+
this.frame = void 0;
|
|
27
|
+
this.parent = void 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function activate(tooltip) {
|
|
31
|
+
stop(tooltip);
|
|
32
|
+
if (tooltip.active) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
tooltip.activate = +setTimeout(() => {
|
|
36
|
+
tooltip.active = true;
|
|
37
|
+
active.add(tooltip);
|
|
38
|
+
document.body.append(tooltip.element);
|
|
39
|
+
tooltip.element.hidden = false;
|
|
40
|
+
update(tooltip);
|
|
41
|
+
}, 250);
|
|
42
|
+
}
|
|
43
|
+
function addTooltip(element) {
|
|
44
|
+
if (!tooltips.has(element)) {
|
|
45
|
+
tooltips.set(element, new Tooltip(element));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function deactivate(tooltip, time) {
|
|
49
|
+
stop(tooltip);
|
|
50
|
+
if (!tooltip.active) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
tooltip.deactivate = +setTimeout(() => {
|
|
54
|
+
tooltip.active = false;
|
|
55
|
+
active.delete(tooltip);
|
|
56
|
+
tooltip.element.hidden = true;
|
|
57
|
+
tooltip.parent.insertAdjacentElement("afterend", tooltip.element);
|
|
58
|
+
}, time ?? 250);
|
|
59
|
+
}
|
|
60
|
+
function getContent(parent) {
|
|
61
|
+
const wrapper = getWrapper(parent);
|
|
62
|
+
const ids = (parent.getAttribute("aria-describedby") ?? "").split(/\s+/);
|
|
63
|
+
parent.setAttribute("aria-describedby", wrapper.id);
|
|
64
|
+
const elements = ids.map(
|
|
65
|
+
(id) => isNullableOrWhitespace(id) ? void 0 : document.querySelector(`#${id}`)
|
|
66
|
+
).filter((element) => element instanceof HTMLElement);
|
|
67
|
+
if (elements.length > 0) {
|
|
68
|
+
for (const element of elements) {
|
|
69
|
+
element.hidden = false;
|
|
70
|
+
wrapper.append(element);
|
|
71
|
+
}
|
|
72
|
+
return wrapper;
|
|
73
|
+
}
|
|
74
|
+
let content = parent.getAttribute("aria-description");
|
|
75
|
+
if (isNullableOrWhitespace(content)) {
|
|
76
|
+
content = parent.getAttribute("aria-label");
|
|
77
|
+
if (isNullableOrWhitespace(content)) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const paragraph = document.createElement("p");
|
|
82
|
+
paragraph.textContent = content;
|
|
83
|
+
wrapper.append(paragraph);
|
|
84
|
+
return wrapper;
|
|
85
|
+
}
|
|
86
|
+
function getTop(parent, content) {
|
|
87
|
+
let top = parent.top - content.height - margin;
|
|
88
|
+
if (top - margin >= 0) {
|
|
89
|
+
return top;
|
|
90
|
+
}
|
|
91
|
+
top = parent.bottom + margin;
|
|
92
|
+
if (top + content.height + margin <= window.innerHeight) {
|
|
93
|
+
return top;
|
|
94
|
+
}
|
|
95
|
+
return parent.top + (parent.height - content.height) / 2;
|
|
96
|
+
}
|
|
97
|
+
function getWrapper(parent) {
|
|
98
|
+
const wrapper = document.createElement("div");
|
|
99
|
+
wrapper.setAttribute(`${selector}-content`, "");
|
|
100
|
+
wrapper.className = parent.getAttribute(`${selector}-class`) ?? "";
|
|
101
|
+
wrapper.hidden = true;
|
|
102
|
+
wrapper.id = `${selector}-${++index}`;
|
|
103
|
+
wrapper.role = "tooltip";
|
|
104
|
+
wrapper.tabIndex = -1;
|
|
105
|
+
return wrapper;
|
|
106
|
+
}
|
|
107
|
+
function getX(parent, content) {
|
|
108
|
+
if (content.width + 2 * margin >= window.innerWidth) {
|
|
109
|
+
return {
|
|
110
|
+
left: margin,
|
|
111
|
+
right: margin
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const left = parent.left + (parent.width - content.width) / 2;
|
|
115
|
+
const right = window.innerWidth - margin;
|
|
116
|
+
if (left < margin) {
|
|
117
|
+
return {
|
|
118
|
+
left: margin
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
if (left + content.width > right) {
|
|
122
|
+
return {
|
|
123
|
+
right: margin
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
left
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function initialize(tooltip) {
|
|
131
|
+
const elements = [tooltip.parent, tooltip.element];
|
|
132
|
+
for (const element of elements) {
|
|
133
|
+
for (const event of activateEvents) {
|
|
134
|
+
on(
|
|
135
|
+
element,
|
|
136
|
+
event,
|
|
137
|
+
() => {
|
|
138
|
+
activate(tooltip);
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
signal: tooltip.abortController.signal
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
for (const event of deactivateEvents) {
|
|
146
|
+
on(
|
|
147
|
+
element,
|
|
148
|
+
event,
|
|
149
|
+
() => {
|
|
150
|
+
deactivate(tooltip);
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
signal: tooltip.abortController.signal
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function removeTooltip(element) {
|
|
160
|
+
tooltips.get(element)?.destroy();
|
|
161
|
+
tooltips.delete(element);
|
|
162
|
+
}
|
|
163
|
+
function stop(tooltip) {
|
|
164
|
+
if (tooltip.frame != null) {
|
|
165
|
+
cancelAnimationFrame(tooltip.frame);
|
|
166
|
+
tooltip.frame = void 0;
|
|
167
|
+
}
|
|
168
|
+
if (tooltip.activate != null) {
|
|
169
|
+
clearTimeout(tooltip.activate);
|
|
170
|
+
tooltip.activate = void 0;
|
|
171
|
+
}
|
|
172
|
+
if (tooltip.deactivate != null) {
|
|
173
|
+
clearTimeout(tooltip.deactivate);
|
|
174
|
+
tooltip.deactivate = void 0;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function update(tooltip) {
|
|
178
|
+
function run() {
|
|
179
|
+
const parentRect = tooltip.parent.getBoundingClientRect();
|
|
180
|
+
const contentRect = tooltip.element.getBoundingClientRect();
|
|
181
|
+
const top = getTop(parentRect, contentRect);
|
|
182
|
+
const { left, right } = getX(parentRect, contentRect);
|
|
183
|
+
tooltip.element.style.inset = `${top}px ${right == null ? "auto" : `${right}px`} auto ${left == null ? "auto" : `${left}px`}`;
|
|
184
|
+
tooltip.frame = requestAnimationFrame(run);
|
|
185
|
+
}
|
|
186
|
+
tooltip.frame = requestAnimationFrame(run);
|
|
187
|
+
}
|
|
188
|
+
const active = /* @__PURE__ */ new Set();
|
|
189
|
+
const activateEvents = ["focus", "mouseenter", "touchstart"];
|
|
190
|
+
const deactivateEvents = ["blur", "mouseleave"];
|
|
191
|
+
const margin = Number.parseInt(getComputedStyle(document.documentElement).fontSize, 10) / 4;
|
|
192
|
+
const selector = "oui-tooltip";
|
|
193
|
+
const tooltips = /* @__PURE__ */ new WeakMap();
|
|
194
|
+
let index = 0;
|
|
195
|
+
attributable(selector, addTooltip, removeTooltip);
|
|
196
|
+
on(document, "keydown", (event) => {
|
|
197
|
+
if (event.key === "Escape") {
|
|
198
|
+
for (const tooltip of active) {
|
|
199
|
+
deactivate(tooltip, 0);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
});
|
package/package.json
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
"url": "https://oscarpalmer.se"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@oscarpalmer/atoms": "^0.
|
|
7
|
+
"@oscarpalmer/atoms": "^0.104",
|
|
8
8
|
"@oscarpalmer/toretto": "^0.20"
|
|
9
9
|
},
|
|
10
10
|
"description": "Styles, components, and utilities for building websites and applications.",
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@biomejs/biome": "^1
|
|
12
|
+
"@biomejs/biome": "^2.1",
|
|
13
13
|
"@rollup/plugin-node-resolve": "^16",
|
|
14
14
|
"@rollup/plugin-typescript": "^12.1",
|
|
15
15
|
"@types/node": "^24",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"postcss-input-range": "^6",
|
|
23
23
|
"postcss-scss": "^4",
|
|
24
24
|
"sass": "^1.89",
|
|
25
|
-
"stylelint": "^16.
|
|
25
|
+
"stylelint": "^16.21",
|
|
26
26
|
"tslib": "^2.8",
|
|
27
27
|
"typescript": "^5.8",
|
|
28
|
-
"vite": "^
|
|
28
|
+
"vite": "^7",
|
|
29
29
|
"vitest": "^3.2"
|
|
30
30
|
},
|
|
31
31
|
"exports": {
|
|
@@ -48,6 +48,16 @@
|
|
|
48
48
|
"types": "./types/focus-trap.d.cts",
|
|
49
49
|
"default": "./dist/js/focus-trap.cjs"
|
|
50
50
|
}
|
|
51
|
+
},
|
|
52
|
+
"./tooltip": {
|
|
53
|
+
"import": {
|
|
54
|
+
"types": "./types/tooltip.d.ts",
|
|
55
|
+
"default": "./dist/js/tooltip.js"
|
|
56
|
+
},
|
|
57
|
+
"require": {
|
|
58
|
+
"types": "./types/tooltip.d.cts",
|
|
59
|
+
"default": "./dist/js/tooltip.cjs"
|
|
60
|
+
}
|
|
51
61
|
}
|
|
52
62
|
},
|
|
53
63
|
"files": ["dist", "src", "types"],
|
|
@@ -75,14 +85,14 @@
|
|
|
75
85
|
"build:postcss": "npx postcss ./src/css/*.scss -d ./postcss -u autoprefixer postcss-input-range --parser postcss-scss",
|
|
76
86
|
"build:js": "npx vite build && npm run types",
|
|
77
87
|
"clean": "rm -rf ./dist && rm -rf ./types && rm -f ./tsconfig.tsbuildinfo",
|
|
78
|
-
"rollup": "npx rollup -c
|
|
88
|
+
"rollup": "npx rollup -c",
|
|
79
89
|
"test": "npx vitest --coverage",
|
|
80
90
|
"types": "npx tsc && npx dts-bundle-generator --config ./dts.config.cts --silent",
|
|
81
|
-
"watch:css": "npx sass ./
|
|
91
|
+
"watch:css": "npx sass ./postcss:./dist/css --no-source-map --watch",
|
|
82
92
|
"watch:postcss": "npx postcss ./src/css/*.scss -d ./postcss -u autoprefixer postcss-input-range --parser postcss-scss --watch",
|
|
83
93
|
"watch:js": "npx vite build --watch"
|
|
84
94
|
},
|
|
85
95
|
"type": "module",
|
|
86
96
|
"types": "types/index.d.cts",
|
|
87
|
-
"version": "0.
|
|
97
|
+
"version": "0.13.0"
|
|
88
98
|
}
|
package/src/css/badge.scss
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/*! https://github.com/oscarpalmer/oui */
|
|
2
2
|
|
|
3
|
+
@use './mixins.scss' as mixins;
|
|
4
|
+
|
|
3
5
|
.oui {
|
|
4
6
|
:where(&-pill, &-tag) {
|
|
5
|
-
--oui-shadow-
|
|
6
|
-
in
|
|
7
|
+
--oui-shadow-mixed: color-mix(
|
|
8
|
+
in oklab,
|
|
7
9
|
var(--oui-shadow, var(--oui-gray-6)),
|
|
8
|
-
transparent
|
|
10
|
+
transparent 92.5%
|
|
9
11
|
);
|
|
10
12
|
|
|
13
|
+
@include mixins.shadow(var(--oui-shadow-mixed));
|
|
14
|
+
|
|
11
15
|
display: inline-flex;
|
|
12
16
|
flex-flow: row nowrap;
|
|
13
17
|
gap: .5em;
|
|
14
18
|
background-color: color-mix(in oklab, var(--oui-background, var(--oui-gray-0)), transparent 25%);
|
|
15
|
-
box-shadow:
|
|
16
|
-
0 0 0 1px var(--oui-shadow-value),
|
|
17
|
-
0 1px 2px 0 var(--oui-shadow-value),
|
|
18
|
-
0 2px 4px 0 var(--oui-shadow-value);
|
|
19
19
|
color: var(--oui-foreground, var(--oui-gray-8));
|
|
20
20
|
line-height: 1.25;
|
|
21
21
|
}
|
|
@@ -37,11 +37,18 @@
|
|
|
37
37
|
:where(&-pill-tiny, &-tag-tiny) {
|
|
38
38
|
color: color-mix(in oklab, var(--oui-foreground, var(--oui-gray-8)), transparent 12.5%);
|
|
39
39
|
font-size: .75em;
|
|
40
|
-
font-weight: bold;
|
|
41
|
-
letter-spacing: .1em;
|
|
42
|
-
text-transform: uppercase;
|
|
43
40
|
}
|
|
44
41
|
|
|
42
|
+
:where(&-pill-tiny) {
|
|
43
|
+
padding: .25em .75em;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:where(&-tag-tiny) {
|
|
47
|
+
padding: .25em .5em;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Colors
|
|
51
|
+
|
|
45
52
|
:where(&-pill-blue, &-tag-blue) {
|
|
46
53
|
--oui-background: var(--oui-blue-0);
|
|
47
54
|
--oui-foreground: var(--oui-blue-8);
|
package/src/css/button.scss
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/*! https://github.com/oscarpalmer/oui */
|
|
2
|
+
|
|
1
3
|
@use './mixins' as mixins;
|
|
2
4
|
|
|
3
5
|
.oui-button {
|
|
@@ -75,9 +77,9 @@
|
|
|
75
77
|
|
|
76
78
|
:where(&:not([disabled], [aria-disabled='true' i]):active) {
|
|
77
79
|
box-shadow:
|
|
78
|
-
0 0 0 1px var(--oui-shadow-
|
|
79
|
-
inset 0 1px 2px 0 var(--oui-shadow-
|
|
80
|
-
inset 0 2px 4px 0 var(--oui-shadow-
|
|
80
|
+
0 0 0 1px var(--oui-shadow-value),
|
|
81
|
+
inset 0 1px 2px 0 var(--oui-shadow-value),
|
|
82
|
+
inset 0 2px 4px 0 var(--oui-shadow-value);
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
:where(&[disabled], &[aria-disabled='true' i]) {
|
package/src/css/color.scss
CHANGED
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
--oui-green-9: light-dark(oklch(0.35 0.1 141), oklch(0.9 0.03 149));
|
|
30
30
|
--oui-green-10: light-dark(oklch(0.3 0.09 140), oklch(0.95 0.02 150));
|
|
31
31
|
|
|
32
|
-
--oui-orange-0: light-dark(oklch(0.
|
|
33
|
-
--oui-orange-1: light-dark(oklch(0.
|
|
32
|
+
--oui-orange-0: light-dark(oklch(0.99 0.02 60), oklch(0.2 0.08 50));
|
|
33
|
+
--oui-orange-1: light-dark(oklch(0.985 0.035 59), oklch(0.25 0.09 51));
|
|
34
34
|
--oui-orange-2: light-dark(oklch(0.97 0.05 58), oklch(0.32 0.1 52));
|
|
35
35
|
--oui-orange-3: light-dark(oklch(0.93 0.07 57), oklch(0.4 0.09 53));
|
|
36
|
-
--oui-orange-4: light-dark(oklch(0.
|
|
37
|
-
--oui-orange-5: light-dark(oklch(0.
|
|
38
|
-
--oui-orange-6: light-dark(oklch(0.
|
|
39
|
-
--oui-orange-7: light-dark(oklch(0.
|
|
40
|
-
--oui-orange-8: light-dark(oklch(0.
|
|
41
|
-
--oui-orange-9: light-dark(oklch(0.
|
|
36
|
+
--oui-orange-4: light-dark(oklch(0.87 0.1 56), oklch(0.5 0.08 54));
|
|
37
|
+
--oui-orange-5: light-dark(oklch(0.76 0.11 55), oklch(0.6 0.07 55));
|
|
38
|
+
--oui-orange-6: light-dark(oklch(0.65 0.12 54), oklch(0.7 0.06 56));
|
|
39
|
+
--oui-orange-7: light-dark(oklch(0.55 0.14 53), oklch(0.8 0.05 57));
|
|
40
|
+
--oui-orange-8: light-dark(oklch(0.45 0.12 52), oklch(0.85 0.04 58));
|
|
41
|
+
--oui-orange-9: light-dark(oklch(0.375 0.11 51), oklch(0.9 0.03 59));
|
|
42
42
|
--oui-orange-10: light-dark(oklch(0.3 0.09 50), oklch(0.95 0.02 60));
|
|
43
43
|
|
|
44
44
|
--oui-purple-0: light-dark(oklch(0.99 0.02 300), oklch(0.2 0.08 290));
|
|
@@ -53,28 +53,28 @@
|
|
|
53
53
|
--oui-purple-9: light-dark(oklch(0.35 0.11 291), oklch(0.9 0.03 299));
|
|
54
54
|
--oui-purple-10: light-dark(oklch(0.3 0.09 290), oklch(0.95 0.02 300));
|
|
55
55
|
|
|
56
|
-
--oui-red-0: light-dark(oklch(0.
|
|
57
|
-
--oui-red-1: light-dark(oklch(0.
|
|
58
|
-
--oui-red-2: light-dark(oklch(0.
|
|
56
|
+
--oui-red-0: light-dark(oklch(0.99 0.024 25), oklch(0.2 0.08 25));
|
|
57
|
+
--oui-red-1: light-dark(oklch(0.985 0.032 24), oklch(0.25 0.09 24));
|
|
58
|
+
--oui-red-2: light-dark(oklch(0.97 0.05 23), oklch(0.32 0.1 23));
|
|
59
59
|
--oui-red-3: light-dark(oklch(0.93 0.07 22), oklch(0.4 0.09 22));
|
|
60
|
-
--oui-red-4: light-dark(oklch(0.
|
|
61
|
-
--oui-red-5: light-dark(oklch(0.
|
|
62
|
-
--oui-red-6: light-dark(oklch(0.
|
|
63
|
-
--oui-red-7: light-dark(oklch(0.
|
|
64
|
-
--oui-red-8: light-dark(oklch(0.
|
|
65
|
-
--oui-red-9: light-dark(oklch(0.
|
|
60
|
+
--oui-red-4: light-dark(oklch(0.87 0.1 21), oklch(0.5 0.08 21));
|
|
61
|
+
--oui-red-5: light-dark(oklch(0.76 0.11 20), oklch(0.6 0.07 20));
|
|
62
|
+
--oui-red-6: light-dark(oklch(0.65 0.12 19), oklch(0.7 0.06 19));
|
|
63
|
+
--oui-red-7: light-dark(oklch(0.55 0.14 18), oklch(0.8 0.05 18));
|
|
64
|
+
--oui-red-8: light-dark(oklch(0.45 0.12 17), oklch(0.85 0.04 17));
|
|
65
|
+
--oui-red-9: light-dark(oklch(0.375 0.11 16), oklch(0.9 0.03 16));
|
|
66
66
|
--oui-red-10: light-dark(oklch(0.3 0.09 15), oklch(0.95 0.02 15));
|
|
67
67
|
|
|
68
|
-
--oui-yellow-0: light-dark(oklch(0.
|
|
69
|
-
--oui-yellow-1: light-dark(oklch(0.
|
|
68
|
+
--oui-yellow-0: light-dark(oklch(0.99 0.02 100), oklch(0.2 0.08 90));
|
|
69
|
+
--oui-yellow-1: light-dark(oklch(0.985 0.035 99), oklch(0.25 0.09 91));
|
|
70
70
|
--oui-yellow-2: light-dark(oklch(0.97 0.05 98), oklch(0.33 0.1 92));
|
|
71
71
|
--oui-yellow-3: light-dark(oklch(0.93 0.07 97), oklch(0.4 0.09 93));
|
|
72
|
-
--oui-yellow-4: light-dark(oklch(0.
|
|
73
|
-
--oui-yellow-5: light-dark(oklch(
|
|
74
|
-
--oui-yellow-6: light-dark(oklch(0.
|
|
75
|
-
--oui-yellow-7: light-dark(oklch(0.
|
|
76
|
-
--oui-yellow-8: light-dark(oklch(0.
|
|
77
|
-
--oui-yellow-9: light-dark(oklch(0.
|
|
72
|
+
--oui-yellow-4: light-dark(oklch(0.87 0.1 96), oklch(0.5 0.08 94));
|
|
73
|
+
--oui-yellow-5: light-dark(oklch(.78 0.11 95), oklch(0.6 0.07 95));
|
|
74
|
+
--oui-yellow-6: light-dark(oklch(0.65 0.12 94), oklch(0.7 0.06 96));
|
|
75
|
+
--oui-yellow-7: light-dark(oklch(0.55 0.14 93), oklch(0.8 0.05 97));
|
|
76
|
+
--oui-yellow-8: light-dark(oklch(0.45 0.12 92), oklch(0.85 0.04 98));
|
|
77
|
+
--oui-yellow-9: light-dark(oklch(0.375 0.11 91), oklch(0.9 0.03 99));
|
|
78
78
|
--oui-yellow-10: light-dark(oklch(0.3 0.09 90), oklch(0.95 0.02 100));
|
|
79
79
|
|
|
80
80
|
--oui-gray-0: light-dark(oklch(0.98 0 0), oklch(0.22 0 0));
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/*! https://github.com/oscarpalmer/oui */
|
|
2
|
+
|
|
3
|
+
@use './mixins' as mixins;
|
|
4
|
+
|
|
5
|
+
@mixin thumb($background, $shadow) {
|
|
6
|
+
@include mixins.shadow(
|
|
7
|
+
color-mix(in oklab, $shadow, transparent 33%),
|
|
8
|
+
color-mix(in oklab, white, transparent 82.5%)
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
appearance: none;
|
|
12
|
+
min-width: 0.5em;
|
|
13
|
+
background-color: $background;
|
|
14
|
+
background-image: none;
|
|
15
|
+
border-radius: 0.25em;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@mixin track {
|
|
19
|
+
appearance: none;
|
|
20
|
+
height: 0.75em;
|
|
21
|
+
padding: 0.125em;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
background-color: var(--oui-absolute);
|
|
24
|
+
background-image: none;
|
|
25
|
+
border: 1px solid var(--oui-gray-3);
|
|
26
|
+
border-radius: 0.375em;
|
|
27
|
+
box-shadow: inset 0 1px 2px 0 var(--oui-gray-3);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.oui-card {
|
|
31
|
+
:where(&) {
|
|
32
|
+
@include mixins.card;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.oui-details {
|
|
37
|
+
:where(& > summary) {
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
list-style: none;
|
|
41
|
+
outline: 4px solid
|
|
42
|
+
color-mix(
|
|
43
|
+
in oklab,
|
|
44
|
+
var(--oui-blue-6),
|
|
45
|
+
transparent var(--oui-outline-percentage, 100%)
|
|
46
|
+
);
|
|
47
|
+
outline-offset: 0.25em;
|
|
48
|
+
border-radius: 0.125em;
|
|
49
|
+
transition: 0.125s ease-in-out, margin 0s;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
|
|
52
|
+
&::before {
|
|
53
|
+
content: '';
|
|
54
|
+
width: 1em;
|
|
55
|
+
height: 1em;
|
|
56
|
+
margin: 0 0.5em 0 0;
|
|
57
|
+
background-color: currentColor;
|
|
58
|
+
mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='4'%3E%3Cpath d='M4 0h6L7 4'/%3E%3C/svg%3E");
|
|
59
|
+
mask-size: contain;
|
|
60
|
+
mask-position: center;
|
|
61
|
+
mask-repeat: no-repeat;
|
|
62
|
+
transition: 0.125s ease-in-out;
|
|
63
|
+
transform: rotate(-90deg);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:focus-visible {
|
|
67
|
+
--oui-outline-percentage: 50%;
|
|
68
|
+
|
|
69
|
+
padding: 0 0.5em 0 0.25em;
|
|
70
|
+
color: var(--oui-blue-8);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@media (hover: hover) {
|
|
74
|
+
&:hover {
|
|
75
|
+
color: var(--oui-blue-8);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:where(&[open] > summary) {
|
|
81
|
+
margin: 0 0 1em;
|
|
82
|
+
|
|
83
|
+
&::before {
|
|
84
|
+
transform: rotate(0deg);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.oui-formatted {
|
|
90
|
+
:where(&) {
|
|
91
|
+
@include mixins.card;
|
|
92
|
+
|
|
93
|
+
color: var(--oui-gray-8);
|
|
94
|
+
font-family: monospace, monospace;
|
|
95
|
+
font-size: 0.875rem;
|
|
96
|
+
line-height: 1.5;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.oui-meter {
|
|
101
|
+
:where(&) {
|
|
102
|
+
@include track;
|
|
103
|
+
|
|
104
|
+
&::-moz-meter-bar {
|
|
105
|
+
@include thumb(var(--oui-blue-5), var(--oui-blue-6));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&:-moz-meter-optimum::-moz-meter-bar {
|
|
109
|
+
@include thumb(var(--oui-green-5), var(--oui-green-6));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&:-moz-meter-sub-optimum::-moz-meter-bar {
|
|
113
|
+
@include thumb(var(--oui-yellow-5), var(--oui-yellow-6));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&:-moz-meter-sub-sub-optimum::-moz-meter-bar {
|
|
117
|
+
@include thumb(var(--oui-red-5), var(--oui-red-6));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&::-webkit-meter-bar {
|
|
121
|
+
appearance: none;
|
|
122
|
+
background: none;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&::-webkit-meter-even-less-good-value {
|
|
126
|
+
@include thumb(var(--oui-red-5), var(--oui-red-6));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&::-webkit-meter-optimum-value {
|
|
130
|
+
@include thumb(var(--oui-green-5), var(--oui-green-6));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&::-webkit-meter-suboptimum-value {
|
|
134
|
+
@include thumb(var(--oui-yellow-5), var(--oui-yellow-6));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.oui-progress {
|
|
140
|
+
:where(&) {
|
|
141
|
+
@include track;
|
|
142
|
+
|
|
143
|
+
&::-moz-progress-bar {
|
|
144
|
+
@include thumb(var(--oui-blue-5), var(--oui-blue-6));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&::-webkit-progress-bar {
|
|
148
|
+
appearance: none;
|
|
149
|
+
background: none;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&::-webkit-progress-value {
|
|
153
|
+
@include thumb(var(--oui-blue-5), var(--oui-blue-6));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|