@oscarpalmer/oui 0.30.0 → 0.31.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 +4 -4
- package/dist/css/combobox.css +139 -0
- package/dist/css/form.css +18 -14
- package/dist/js/combobox.d.mts +65 -1
- package/dist/js/combobox.mjs +428 -105
- package/dist/js/focus-trap/focus-trap.embedded.mjs +3 -4
- package/dist/js/internal/draggable.mjs +7 -15
- package/dist/js/menu.mjs +5 -2
- package/dist/js/movable/movable.embedded.mjs +6 -10
- package/dist/js/resizable/resizable.embedded.mjs +9 -16
- package/dist/js/sortable/sortable.embedded.mjs +21 -26
- package/package.json +3 -3
- package/src/css/badge.scss +1 -18
- package/src/css/combobox.scss +113 -2
- package/src/css/form.scss +18 -80
- package/src/css/mixins.scss +86 -0
- package/src/js/combobox.ts +714 -152
- package/src/js/focus-trap/focus-trap.embedded.ts +3 -7
- package/src/js/internal/draggable.ts +4 -10
- package/src/js/menu.ts +5 -2
- package/src/js/movable/movable.embedded.ts +3 -6
- package/src/js/resizable/resizable.embedded.ts +6 -19
- package/src/js/sortable/sortable.embedded.ts +17 -14
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { attributable } from "../internal/attributable.mjs";
|
|
2
2
|
import { clamp } from "@oscarpalmer/atoms/number";
|
|
3
3
|
import { setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
4
|
-
import { on } from "@oscarpalmer/toretto/event";
|
|
4
|
+
import { dispatch, on } from "@oscarpalmer/toretto/event";
|
|
5
5
|
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
6
6
|
import { isPlainObject } from "@oscarpalmer/atoms/is";
|
|
7
7
|
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
@@ -172,10 +172,9 @@ function onTab(event) {
|
|
|
172
172
|
const element = findAncestor(event, SELECTOR);
|
|
173
173
|
const instance = instances.get(element);
|
|
174
174
|
if (instance == null) return;
|
|
175
|
-
const
|
|
176
|
-
element.dispatchEvent(dispatch);
|
|
175
|
+
const dispatched = dispatch(element, "focus-trap");
|
|
177
176
|
setTimeout(() => {
|
|
178
|
-
if (
|
|
177
|
+
if (dispatched.defaultPrevented) return;
|
|
179
178
|
if (!instance.disabled) event.preventDefault();
|
|
180
179
|
const elements = getFocusable(element);
|
|
181
180
|
const index = elements.indexOf(event.target);
|
|
@@ -130,16 +130,12 @@ function onPointerdown(event) {
|
|
|
130
130
|
};
|
|
131
131
|
globals.offset = item.state.options.position.getOffset(globals, item, element, position);
|
|
132
132
|
globals.original = item.state.options.position.getOriginal(globals, item, position);
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
},
|
|
138
|
-
cancelable: true
|
|
139
|
-
});
|
|
140
|
-
item.state.element.dispatchEvent(dispatch);
|
|
133
|
+
const dispatched = dispatch(item.state.element, `${item.state.name}:begin`, { detail: {
|
|
134
|
+
element,
|
|
135
|
+
position: { ...globals.original }
|
|
136
|
+
} });
|
|
141
137
|
setTimeout(() => {
|
|
142
|
-
if (
|
|
138
|
+
if (dispatched.defaultPrevented) {
|
|
143
139
|
item.state.options.drag.onCancel?.(globals, item);
|
|
144
140
|
reset();
|
|
145
141
|
return;
|
|
@@ -165,13 +161,9 @@ function onPointermove(event) {
|
|
|
165
161
|
calculated: next,
|
|
166
162
|
original: position
|
|
167
163
|
});
|
|
168
|
-
const
|
|
169
|
-
detail,
|
|
170
|
-
cancelable: true
|
|
171
|
-
});
|
|
172
|
-
current.state.element.dispatchEvent(dispatch);
|
|
164
|
+
const dispatched = dispatch(current.state.element, `${current.state.name}:move`, { detail });
|
|
173
165
|
setTimeout(() => {
|
|
174
|
-
if (
|
|
166
|
+
if (dispatched.defaultPrevented) cancelDrag(current);
|
|
175
167
|
});
|
|
176
168
|
}
|
|
177
169
|
function onPointerup(event) {
|
package/dist/js/menu.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { createEmbeddedFloatable, getOnBeforeToggleListener } from "./floatable/
|
|
|
2
2
|
import { attributable } from "./internal/attributable.mjs";
|
|
3
3
|
import { NAVIGABLE_KEYS_HORIZONTAL, NAVIGABLE_KEYS_VERTICAL, getNavigable, updateNavigableFocus } from "./internal/navigable.mjs";
|
|
4
4
|
import { setAria, setRole } from "@oscarpalmer/toretto/aria";
|
|
5
|
-
import { setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
5
|
+
import { setAttribute, setAttributes } from "@oscarpalmer/toretto/attribute";
|
|
6
6
|
import { on } from "@oscarpalmer/toretto/event";
|
|
7
7
|
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
8
8
|
//#region src/js/menu.ts
|
|
@@ -104,7 +104,10 @@ function initializeMenu(menu) {
|
|
|
104
104
|
expanded: "false",
|
|
105
105
|
haspopup: "menu"
|
|
106
106
|
});
|
|
107
|
-
|
|
107
|
+
setAttributes(menu.content, {
|
|
108
|
+
popover: "",
|
|
109
|
+
tabindex: "-1"
|
|
110
|
+
});
|
|
108
111
|
setRole(menu.content, "menu");
|
|
109
112
|
}
|
|
110
113
|
function onDeactivate(_, navigable) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { attributable } from "../internal/attributable.mjs";
|
|
2
2
|
import { OuiDraggable, addDraggable, getDraggableStates, removeDraggable } from "../internal/draggable.mjs";
|
|
3
3
|
import { setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
4
|
-
import { getPosition, on } from "@oscarpalmer/toretto/event";
|
|
4
|
+
import { dispatch, getPosition, on } from "@oscarpalmer/toretto/event";
|
|
5
5
|
import { getStyles, setStyle, setStyles } from "@oscarpalmer/toretto/style";
|
|
6
6
|
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
7
7
|
//#region src/js/movable/movable.embedded.ts
|
|
@@ -110,16 +110,12 @@ function onEnd(event, globals, item, reset) {
|
|
|
110
110
|
}
|
|
111
111
|
const container = state.container?.getBoundingClientRect();
|
|
112
112
|
if (container != null) setOffset(state, container);
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
},
|
|
118
|
-
cancelable: true
|
|
119
|
-
});
|
|
120
|
-
state.element.dispatchEvent(end);
|
|
113
|
+
const dispatched = dispatch(state.element, "movable:end", { detail: {
|
|
114
|
+
from: { ...globals.original },
|
|
115
|
+
to: getPosition(event)
|
|
116
|
+
} });
|
|
121
117
|
setTimeout(() => {
|
|
122
|
-
if (
|
|
118
|
+
if (dispatched.defaultPrevented) onCancel(globals, item);
|
|
123
119
|
reset();
|
|
124
120
|
});
|
|
125
121
|
}
|
|
@@ -18,7 +18,6 @@ var OuiResizable = class {
|
|
|
18
18
|
}
|
|
19
19
|
set() {
|
|
20
20
|
const [width, height] = getAndSetDimensions(this.#state.element, this.#state.options);
|
|
21
|
-
console.log("set", width, height);
|
|
22
21
|
this.#state.width = width;
|
|
23
22
|
this.#state.height = height;
|
|
24
23
|
}
|
|
@@ -131,10 +130,9 @@ function onPointerdown(event) {
|
|
|
131
130
|
const position = getPosition(event);
|
|
132
131
|
if (stored == null || position == null) return;
|
|
133
132
|
if (supportsTouch.value) event.preventDefault();
|
|
134
|
-
const
|
|
135
|
-
element.dispatchEvent(dispatch);
|
|
133
|
+
const dispatched = dispatch(element, "resizable:begin");
|
|
136
134
|
setTimeout(() => {
|
|
137
|
-
if (
|
|
135
|
+
if (dispatched.defaultPrevented) return;
|
|
138
136
|
current = stored;
|
|
139
137
|
start = position;
|
|
140
138
|
current.state.styles.set();
|
|
@@ -151,24 +149,19 @@ function onPointermove(event) {
|
|
|
151
149
|
height,
|
|
152
150
|
width
|
|
153
151
|
});
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
width
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
current.state.element.dispatchEvent(dispatch);
|
|
152
|
+
const dispatched = dispatch(current.state.element, "resizable:resize", { detail: {
|
|
153
|
+
height,
|
|
154
|
+
width
|
|
155
|
+
} });
|
|
162
156
|
setTimeout(() => {
|
|
163
|
-
if (
|
|
157
|
+
if (dispatched.defaultPrevented) cancelResize(current);
|
|
164
158
|
});
|
|
165
159
|
}
|
|
166
160
|
function onPointerup() {
|
|
167
161
|
if (current == null) return;
|
|
168
|
-
const
|
|
169
|
-
current.state.element.dispatchEvent(dispatch);
|
|
162
|
+
const dispatched = dispatch(current.state.element, "resizable:end");
|
|
170
163
|
setTimeout(() => {
|
|
171
|
-
if (current == null ||
|
|
164
|
+
if (current == null || dispatched.defaultPrevented) {
|
|
172
165
|
cancelResize(current);
|
|
173
166
|
return;
|
|
174
167
|
}
|
|
@@ -2,7 +2,7 @@ import { attributable } from "../internal/attributable.mjs";
|
|
|
2
2
|
import { OuiDraggable, addDraggable, getDraggableStates, removeDraggable } from "../internal/draggable.mjs";
|
|
3
3
|
import { getAttribute, setAttribute, setAttributes } from "@oscarpalmer/toretto/attribute";
|
|
4
4
|
import { createElement } from "@oscarpalmer/toretto/create";
|
|
5
|
-
import { getPosition } from "@oscarpalmer/toretto/event";
|
|
5
|
+
import { dispatch, getPosition } from "@oscarpalmer/toretto/event";
|
|
6
6
|
import { findAncestor, getElementFromPosition } from "@oscarpalmer/toretto/find";
|
|
7
7
|
import { setStyle } from "@oscarpalmer/toretto/style";
|
|
8
8
|
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
@@ -35,7 +35,7 @@ function afterEnd(insert, from, events, elements, position, valid) {
|
|
|
35
35
|
elements.origin?.removeAttribute(ATTRIBUTE_ORIGIN);
|
|
36
36
|
from.state.origin = void 0;
|
|
37
37
|
resetPlaceholders();
|
|
38
|
-
if (!valid || events.some((event) => event
|
|
38
|
+
if (!valid || events.some((event) => event?.defaultPrevented)) return;
|
|
39
39
|
if (insert !== "insert") {
|
|
40
40
|
elements.target.append(elements.origin);
|
|
41
41
|
return;
|
|
@@ -130,12 +130,11 @@ function onEnd(event, globals, item, reset) {
|
|
|
130
130
|
bubbles: false,
|
|
131
131
|
cancelable: true
|
|
132
132
|
};
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
item.instance.element
|
|
136
|
-
if (item.instance !== toInstance) toInstance?.element.dispatchEvent(toEvent);
|
|
133
|
+
const dispatchedFrom = dispatch(item.instance.element, "sortable:end", options);
|
|
134
|
+
let dispatchedTo;
|
|
135
|
+
if (item.instance !== toInstance && toInstance != null) dispatchedTo = dispatch(toInstance.element, "sortable:end", options);
|
|
137
136
|
setTimeout(() => {
|
|
138
|
-
afterEnd(insert, item, [
|
|
137
|
+
afterEnd(insert, item, [dispatchedFrom, dispatchedTo], {
|
|
139
138
|
origin,
|
|
140
139
|
target: element
|
|
141
140
|
}, position, valid);
|
|
@@ -193,27 +192,23 @@ function setPlaceholder(state, item, origin) {
|
|
|
193
192
|
const element = getDragPlaceholder();
|
|
194
193
|
placeholder.drag.default.innerHTML = "";
|
|
195
194
|
updatePlaceholder(item, element);
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
node: element
|
|
210
|
-
};
|
|
211
|
-
}
|
|
195
|
+
const dispatched = dispatch(item.instance.element, "sortable:placeholder", { detail: {
|
|
196
|
+
origin,
|
|
197
|
+
parent: item.state.element,
|
|
198
|
+
placeholder: element,
|
|
199
|
+
create: (value) => {
|
|
200
|
+
if (!isHTMLOrSVGElement(value)) return;
|
|
201
|
+
const element = value;
|
|
202
|
+
placeholder.drag.custom = element;
|
|
203
|
+
updatePlaceholder(item, element);
|
|
204
|
+
state.element = {
|
|
205
|
+
rectangle: element.getBoundingClientRect(),
|
|
206
|
+
node: element
|
|
207
|
+
};
|
|
212
208
|
}
|
|
213
|
-
});
|
|
214
|
-
item.instance.element.dispatchEvent(event);
|
|
209
|
+
} });
|
|
215
210
|
setTimeout(() => {
|
|
216
|
-
if (!
|
|
211
|
+
if (!dispatched.defaultPrevented && placeholder.drag.custom == null) placeholder.drag.default?.append(element.cloneNode(true));
|
|
217
212
|
document.body.append(placeholder.drag.custom ?? placeholder.drag.default ?? "");
|
|
218
213
|
});
|
|
219
214
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oscarpalmer/oui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "Styles, components, and utilities for building websites and applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -95,10 +95,10 @@
|
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"@oscarpalmer/atoms": "^0.188.1",
|
|
98
|
-
"@oscarpalmer/toretto": "^0.
|
|
98
|
+
"@oscarpalmer/toretto": "^0.48.0"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"@oxlint/plugins": "^1.
|
|
101
|
+
"@oxlint/plugins": "^1.75",
|
|
102
102
|
"@vitest/coverage-istanbul": "^4.1",
|
|
103
103
|
"autoprefixer": "^10.5",
|
|
104
104
|
"concurrently": "^10",
|
package/src/css/badge.scss
CHANGED
|
@@ -4,24 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
.oui {
|
|
6
6
|
:where(&-pill, &-tag) {
|
|
7
|
-
|
|
8
|
-
in oklab,
|
|
9
|
-
var(--oui-shadow, var(--oui-gray-6)),
|
|
10
|
-
transparent 92.5%
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
@include mixins.shadow(var(--oui-shadow-mixed));
|
|
14
|
-
|
|
15
|
-
display: inline-flex;
|
|
16
|
-
flex-flow: row nowrap;
|
|
17
|
-
gap: 0.5em;
|
|
18
|
-
background-color: color-mix(
|
|
19
|
-
in oklab,
|
|
20
|
-
var(--oui-background, var(--oui-gray-0)),
|
|
21
|
-
transparent 25%
|
|
22
|
-
);
|
|
23
|
-
color: var(--oui-foreground, var(--oui-gray-8));
|
|
24
|
-
line-height: 1.25;
|
|
7
|
+
@include mixins.badge;
|
|
25
8
|
}
|
|
26
9
|
|
|
27
10
|
:where(&-pill) {
|
package/src/css/combobox.scss
CHANGED
|
@@ -2,7 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
@use './mixins.scss' as mixins;
|
|
4
4
|
|
|
5
|
+
[oui-combobox-anchor] {
|
|
6
|
+
:where(&) {
|
|
7
|
+
@include mixins.input;
|
|
8
|
+
|
|
9
|
+
--oui-background-value: var(--oui-absolute);
|
|
10
|
+
|
|
11
|
+
padding: 0.5em 2em .5em 0.75em;
|
|
12
|
+
border-radius: 0.25em;
|
|
13
|
+
background-image: 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");
|
|
14
|
+
background-position: right .5em center;
|
|
15
|
+
background-repeat: no-repeat;
|
|
16
|
+
background-size: 1em;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:where(&:not([disabled], [readonly], [aria-disabled='true' i]):focus),
|
|
20
|
+
:where([oui-combobox]:focus-within &:not([disabled], [readonly], [aria-disabled='true' i])) {
|
|
21
|
+
@include mixins.input-focus;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@media (hover: hover) {
|
|
25
|
+
:where(:not([disabled], [readonly], [aria-disabled='true' i]) &:hover) {
|
|
26
|
+
@include mixins.input-hover;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:where(:is([disabled], [readonly], [aria-disabled='true' i]) &) {
|
|
31
|
+
--oui-foreground-percentage: 25%;
|
|
32
|
+
|
|
33
|
+
font-style: italic;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
:where(:is([disabled], [readonly], [aria-disabled='true' i]) &:focus) {
|
|
37
|
+
--oui-outline-percentage: 75%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:where(:is([disabled], [aria-disabled='true' i]) &) {
|
|
41
|
+
--oui-background-percentage: 50%;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
5
45
|
:where([oui-combobox-content]) {
|
|
46
|
+
@include mixins.floatable;
|
|
6
47
|
@include mixins.shadow-overlay;
|
|
7
48
|
|
|
8
49
|
width: fit-content;
|
|
@@ -11,16 +52,86 @@
|
|
|
11
52
|
max-height: max(25vh, 32rem);
|
|
12
53
|
min-width: var(--oui-combobox-width, auto);
|
|
13
54
|
flex-flow: column nowrap;
|
|
55
|
+
border-radius: 0.25em;
|
|
14
56
|
|
|
15
57
|
&:popover-open {
|
|
16
58
|
display: flex !important;
|
|
17
59
|
}
|
|
18
60
|
}
|
|
19
61
|
|
|
62
|
+
:where([oui-combobox-empty]) {
|
|
63
|
+
padding: 1em;
|
|
64
|
+
text-align: center;
|
|
65
|
+
font-style: italic;
|
|
66
|
+
}
|
|
67
|
+
|
|
20
68
|
:where([oui-combobox-list]) {
|
|
21
69
|
overflow: auto;
|
|
22
70
|
}
|
|
23
71
|
|
|
24
|
-
|
|
25
|
-
|
|
72
|
+
[oui-combobox-option] {
|
|
73
|
+
:where(&) {
|
|
74
|
+
padding: 0.5em 0.75em;
|
|
75
|
+
outline: 4px solid transparent;
|
|
76
|
+
outline-offset: -4px;
|
|
77
|
+
line-height: 1.25;
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
transition: .125s ease-in-out;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:where(&[aria-selected='true' i]) {
|
|
83
|
+
background-color: var(--oui-blue-3);
|
|
84
|
+
color: var(--oui-blue-9);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:where(oui-combobox[multiple] &[aria-selected='true' i])::before {
|
|
88
|
+
content: '✓';
|
|
89
|
+
margin: 0 0.75em 0 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:where(oui-combobox:not([disabled], [readonly], [aria-disabled='true' i]) &) {
|
|
93
|
+
@media (hover: hover) {
|
|
94
|
+
:where(&:hover) {
|
|
95
|
+
background-color: var(--oui-blue-1);
|
|
96
|
+
color: var(--oui-blue-8);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:where([oui-combobox-option-active]) {
|
|
103
|
+
background-color: var(--oui-blue-1);
|
|
104
|
+
outline-color: var(--oui-blue-4);
|
|
105
|
+
color: var(--oui-blue-8);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
:where([oui-combobox-selection]) {
|
|
109
|
+
max-height: 8rem;
|
|
110
|
+
display: flex;
|
|
111
|
+
padding: .5em;
|
|
112
|
+
margin: -.5em -.5em -.5em -.75em;
|
|
113
|
+
flex-flow: row wrap;
|
|
114
|
+
gap: 0.5em;
|
|
115
|
+
overflow: auto;
|
|
116
|
+
list-style: none;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
[oui-combobox-selection-item] {
|
|
120
|
+
:where(&) {
|
|
121
|
+
@include mixins.badge;
|
|
122
|
+
|
|
123
|
+
border-radius: 3em;
|
|
124
|
+
padding: 0.5em 1em;
|
|
125
|
+
gap: .75em;
|
|
126
|
+
font-size: .875em;
|
|
127
|
+
transition: .125s ease-in-out;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@media (hover: hover) {
|
|
131
|
+
:where(oui-combobox:not([disabled], [readonly], [aria-disabled='true' i]) &:hover) {
|
|
132
|
+
--oui-background: var(--oui-red-0);
|
|
133
|
+
--oui-foreground: var(--oui-red-8);
|
|
134
|
+
--oui-shadow: var(--oui-red-6);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
26
137
|
}
|
package/src/css/form.scss
CHANGED
|
@@ -2,70 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
@use 'mixins.scss' as mixins;
|
|
4
4
|
|
|
5
|
-
@mixin focus() {
|
|
6
|
-
--oui-border-value: var(--oui-blue-5);
|
|
7
|
-
--oui-foreground-value: inherit;
|
|
8
|
-
--oui-outline-percentage: 75%;
|
|
9
|
-
--oui-outline-value: var(--oui-blue-6);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@mixin hover() {
|
|
13
|
-
--oui-border-value: var(--oui-blue-4);
|
|
14
|
-
--oui-foreground-percentage: 0%;
|
|
15
|
-
--oui-foreground-value: inherit;
|
|
16
|
-
--oui-outline-percentage: 90%;
|
|
17
|
-
--oui-outline-value: var(--oui-blue-6);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@mixin input {
|
|
21
|
-
--oui-background-percentage: 0%;
|
|
22
|
-
--oui-foreground-percentage: 0%;
|
|
23
|
-
|
|
24
|
-
@include outlined;
|
|
25
|
-
|
|
26
|
-
background-color: color-mix(
|
|
27
|
-
in oklab,
|
|
28
|
-
var(--oui-background-value),
|
|
29
|
-
transparent var(--oui-background-percentage)
|
|
30
|
-
);
|
|
31
|
-
border: 1px solid var(--oui-border-value, var(--oui-gray-3));
|
|
32
|
-
box-shadow: inset 0 2px 4px -1px var(--oui-gray-3);
|
|
33
|
-
color: color-mix(
|
|
34
|
-
in oklab,
|
|
35
|
-
var(--oui-foreground-value, inherit),
|
|
36
|
-
transparent var(--oui-foreground-percentage)
|
|
37
|
-
);
|
|
38
|
-
-webkit-text-fill-color: color-mix(
|
|
39
|
-
in oklab,
|
|
40
|
-
var(--oui-foreground-value, inherit),
|
|
41
|
-
transparent var(--oui-foreground-percentage)
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@mixin invalid() {
|
|
46
|
-
--oui-border-value: var(--oui-red-5);
|
|
47
|
-
--oui-foreground-value: var(--oui-red-9);
|
|
48
|
-
--oui-outline-percentage: 82.5%;
|
|
49
|
-
--oui-outline-value: var(--oui-red-6);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@mixin outlined {
|
|
53
|
-
--oui-outline-percentage: 100%;
|
|
54
|
-
--oui-outline-value: var(--oui-blue-6);
|
|
55
|
-
|
|
56
|
-
outline: 4px solid
|
|
57
|
-
color-mix(in oklab, var(--oui-outline-value), transparent var(--oui-outline-percentage));
|
|
58
|
-
outline-offset: 0;
|
|
59
|
-
transition: 0.125s ease-in-out;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
@mixin valid() {
|
|
63
|
-
--oui-border-value: var(--oui-green-5);
|
|
64
|
-
--oui-foreground-value: var(--oui-green-9);
|
|
65
|
-
--oui-outline-percentage: 82.5%;
|
|
66
|
-
--oui-outline-value: var(--oui-green-6);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
5
|
:where(.oui-fieldset) {
|
|
70
6
|
padding: 1em;
|
|
71
7
|
border: 1px solid var(--oui-gray-3);
|
|
@@ -78,7 +14,7 @@
|
|
|
78
14
|
}
|
|
79
15
|
|
|
80
16
|
:where(&:not([type='range' i])) {
|
|
81
|
-
@include input;
|
|
17
|
+
@include mixins.input;
|
|
82
18
|
|
|
83
19
|
padding: 0.5em 0.75em;
|
|
84
20
|
border-radius: 0.25em;
|
|
@@ -135,7 +71,7 @@
|
|
|
135
71
|
outline: none;
|
|
136
72
|
|
|
137
73
|
&::range-track {
|
|
138
|
-
@include input;
|
|
74
|
+
@include mixins.input;
|
|
139
75
|
|
|
140
76
|
appearance: none;
|
|
141
77
|
width: 100%;
|
|
@@ -148,7 +84,7 @@
|
|
|
148
84
|
--oui-background-percentage: 0%;
|
|
149
85
|
--oui-background-value: var(--oui-blue-6);
|
|
150
86
|
|
|
151
|
-
@include outlined;
|
|
87
|
+
@include mixins.input-outlined;
|
|
152
88
|
|
|
153
89
|
appearance: none;
|
|
154
90
|
width: 1.25em;
|
|
@@ -177,7 +113,7 @@
|
|
|
177
113
|
[aria-invalid='true' i]
|
|
178
114
|
)
|
|
179
115
|
) {
|
|
180
|
-
@include invalid;
|
|
116
|
+
@include mixins.input-invalid;
|
|
181
117
|
|
|
182
118
|
&::file-selector-button {
|
|
183
119
|
--oui-background-value: var(--oui-red-2);
|
|
@@ -190,7 +126,7 @@
|
|
|
190
126
|
}
|
|
191
127
|
|
|
192
128
|
&::range-track {
|
|
193
|
-
@include invalid;
|
|
129
|
+
@include mixins.input-invalid;
|
|
194
130
|
}
|
|
195
131
|
|
|
196
132
|
& > option:checked {
|
|
@@ -205,7 +141,7 @@
|
|
|
205
141
|
[aria-invalid='false' i]
|
|
206
142
|
)
|
|
207
143
|
) {
|
|
208
|
-
@include valid;
|
|
144
|
+
@include mixins.input-valid;
|
|
209
145
|
|
|
210
146
|
&::file-selector-button {
|
|
211
147
|
--oui-background-value: var(--oui-green-2);
|
|
@@ -214,7 +150,7 @@
|
|
|
214
150
|
}
|
|
215
151
|
|
|
216
152
|
&::range-track {
|
|
217
|
-
@include valid;
|
|
153
|
+
@include mixins.input-valid;
|
|
218
154
|
}
|
|
219
155
|
|
|
220
156
|
&::range-thumb {
|
|
@@ -249,7 +185,7 @@
|
|
|
249
185
|
|
|
250
186
|
:where(&:not([disabled], [readonly], [aria-disabled='true' i]):focus),
|
|
251
187
|
:where(&:not([disabled], [readonly], [aria-disabled='true' i]):focus-within) {
|
|
252
|
-
@include focus;
|
|
188
|
+
@include mixins.input-focus;
|
|
253
189
|
|
|
254
190
|
&::file-selector-button {
|
|
255
191
|
--oui-background-value: var(--oui-blue-2);
|
|
@@ -259,7 +195,7 @@
|
|
|
259
195
|
|
|
260
196
|
&::range-thumb,
|
|
261
197
|
&::range-track {
|
|
262
|
-
@include focus;
|
|
198
|
+
@include mixins.input-focus;
|
|
263
199
|
}
|
|
264
200
|
|
|
265
201
|
&::range-thumb {
|
|
@@ -271,7 +207,7 @@
|
|
|
271
207
|
|
|
272
208
|
@media (hover: hover) {
|
|
273
209
|
:where(&:not([disabled], [readonly], [aria-disabled='true' i]):hover) {
|
|
274
|
-
@include hover;
|
|
210
|
+
@include mixins.input-hover;
|
|
275
211
|
|
|
276
212
|
&::file-selector-button {
|
|
277
213
|
--oui-background-value: var(--oui-blue-2);
|
|
@@ -284,12 +220,12 @@
|
|
|
284
220
|
}
|
|
285
221
|
|
|
286
222
|
&::range-track {
|
|
287
|
-
@include hover;
|
|
223
|
+
@include mixins.input-hover;
|
|
288
224
|
}
|
|
289
225
|
}
|
|
290
226
|
}
|
|
291
227
|
|
|
292
|
-
:where(
|
|
228
|
+
:where(&:is([disabled], [readonly], [aria-disabled='true' i])) {
|
|
293
229
|
--oui-foreground-percentage: 25%;
|
|
294
230
|
|
|
295
231
|
font-style: italic;
|
|
@@ -311,7 +247,7 @@
|
|
|
311
247
|
--oui-outline-percentage: 75%;
|
|
312
248
|
}
|
|
313
249
|
|
|
314
|
-
:where(
|
|
250
|
+
:where(&:is([disabled], [aria-disabled='true' i])) {
|
|
315
251
|
--oui-background-percentage: 50%;
|
|
316
252
|
|
|
317
253
|
&::range-thumb {
|
|
@@ -383,9 +319,11 @@ select.oui-input:is([multiple]) {
|
|
|
383
319
|
font-weight: bold;
|
|
384
320
|
}
|
|
385
321
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
322
|
+
.oui-label {
|
|
323
|
+
:where(&) {
|
|
324
|
+
cursor: pointer;
|
|
325
|
+
transition: 0.125s ease-in-out;
|
|
326
|
+
}
|
|
389
327
|
|
|
390
328
|
@media (hover: hover) {
|
|
391
329
|
:where(&[for]:hover) {
|