@oscarpalmer/oui 0.35.0 → 0.36.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/combobox.css +1 -1
- package/dist/css/listbox.css +152 -0
- package/dist/js/combobox/constants.combobox.d.mts +2 -2
- package/dist/js/combobox/constants.combobox.mjs +40 -33
- package/dist/js/combobox/dom.combobox.d.mts +8 -91
- package/dist/js/combobox/dom.combobox.mjs +204 -2
- package/dist/js/combobox/event.combobox.d.mts +14 -8
- package/dist/js/combobox/event.combobox.mjs +2 -2
- package/dist/js/combobox/index.d.mts +1 -1
- package/dist/js/combobox/index.mjs +20 -18
- package/dist/js/combobox/misc.combobox.d.mts +2 -2
- package/dist/js/combobox/misc.combobox.mjs +2 -2
- package/dist/js/combobox/models.combobox.d.mts +44 -2
- package/dist/js/combobox/state.combobox.d.mts +9 -10
- package/dist/js/combobox/state.combobox.mjs +2 -2
- package/dist/js/constants.combobox-DmRAMC64.d.mts +26 -0
- package/dist/js/constants.listbox-DRsXUxd3.d.mts +14 -0
- package/dist/js/index-EfkUSals.d.mts +139 -0
- package/dist/js/index.d.mts +4 -2
- package/dist/js/index.mjs +4 -2
- package/dist/js/internal/attributable.mjs +4 -3
- package/dist/js/internal/listbox/listbox.constants.d.mts +11 -0
- package/dist/js/internal/listbox/listbox.constants.mjs +23 -0
- package/dist/js/internal/listbox/listbox.data.d.mts +20 -0
- package/dist/js/internal/listbox/listbox.data.mjs +2 -0
- package/dist/js/internal/listbox/listbox.dom.d.mts +66 -0
- package/dist/js/internal/listbox/listbox.dom.mjs +2 -0
- package/dist/js/internal/listbox/listbox.event.d.mts +5 -0
- package/dist/js/internal/listbox/listbox.event.mjs +63 -0
- package/dist/js/internal/listbox/listbox.form.d.mts +6 -0
- package/dist/js/internal/listbox/listbox.form.mjs +52 -0
- package/dist/js/internal/listbox/listbox.misc.d.mts +12 -0
- package/dist/js/internal/listbox/listbox.misc.mjs +2 -0
- package/dist/js/internal/listbox/listbox.model.d.mts +2 -0
- package/dist/js/internal/listbox/listbox.model.mjs +1 -0
- package/dist/js/internal/listbox/listbox.state.d.mts +7 -0
- package/dist/js/internal/listbox/listbox.state.mjs +40 -0
- package/dist/js/internal/misc.d.mts +6 -0
- package/dist/js/internal/misc.mjs +13 -0
- package/dist/js/l10n-Bn-7RcwR.d.mts +20 -0
- package/dist/js/l10n.d.mts +2 -20
- package/dist/js/listbox/constants.listbox.d.mts +2 -0
- package/dist/js/listbox/constants.listbox.mjs +40 -0
- package/dist/js/listbox/event.listbox.d.mts +8 -0
- package/dist/js/listbox/event.listbox.mjs +2 -0
- package/dist/js/listbox/index.d.mts +116 -0
- package/dist/js/listbox/index.mjs +189 -0
- package/dist/js/listbox/misc.listbox.d.mts +2 -0
- package/dist/js/listbox/misc.listbox.mjs +2 -0
- package/dist/js/listbox/state.listbox.d.mts +11 -0
- package/dist/js/listbox/state.listbox.mjs +2 -0
- package/dist/js/listbox.data-BWd0PCy7.mjs +424 -0
- package/dist/js/listbox.model-CRReGOmu.d.mts +125 -0
- package/dist/js/misc.listbox-BI-XsTOf.mjs +197 -0
- package/dist/js/misc.listbox-gnoJhrTr.d.mts +20 -0
- package/dist/js/sortable/sortable.embedded.mjs +4 -2
- package/dist/js/state.combobox-4xq0FPCF.mjs +365 -0
- package/package.json +7 -3
- package/src/css/combobox.scss +1 -1
- package/src/css/listbox.scss +149 -0
- package/src/js/combobox/constants.combobox.ts +46 -25
- package/src/js/combobox/dom.combobox.ts +36 -454
- package/src/js/combobox/event.combobox.ts +129 -218
- package/src/js/combobox/index.ts +37 -30
- package/src/js/combobox/misc.combobox.ts +30 -114
- package/src/js/combobox/models.combobox.ts +7 -47
- package/src/js/combobox/state.combobox.ts +126 -127
- package/src/js/index.ts +1 -0
- package/src/js/internal/listbox/listbox.constants.ts +25 -0
- package/src/js/{combobox/data.combobox.ts → internal/listbox/listbox.data.ts} +94 -43
- package/src/js/internal/listbox/listbox.dom.ts +445 -0
- package/src/js/internal/listbox/listbox.event.ts +129 -0
- package/src/js/{combobox/form.combobox.ts → internal/listbox/listbox.form.ts} +12 -13
- package/src/js/internal/listbox/listbox.misc.ts +135 -0
- package/src/js/internal/listbox/listbox.model.ts +169 -0
- package/src/js/internal/listbox/listbox.state.ts +82 -0
- package/src/js/internal/misc.ts +27 -0
- package/src/js/l10n.ts +8 -8
- package/src/js/listbox/constants.listbox.ts +61 -0
- package/src/js/listbox/event.listbox.ts +106 -0
- package/src/js/listbox/index.ts +302 -0
- package/src/js/listbox/misc.listbox.ts +70 -0
- package/src/js/listbox/state.listbox.ts +196 -0
- package/dist/js/combobox/data.combobox.d.mts +0 -18
- package/dist/js/combobox/data.combobox.mjs +0 -2
- package/dist/js/combobox/form.combobox.d.mts +0 -6
- package/dist/js/combobox/form.combobox.mjs +0 -2
- package/dist/js/constants.combobox-h_kyDegw.d.mts +0 -248
- package/dist/js/data.combobox-B8HMkDOh.mjs +0 -1030
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/*! https://github.com/oscarpalmer/oui */
|
|
2
|
+
|
|
3
|
+
@use './mixins.scss' as mixins;
|
|
4
|
+
|
|
5
|
+
:where(oui-listbox, [oui-listbox-content]) {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-flow: column nowrap;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:where([oui-listbox-content]) {
|
|
11
|
+
flex: 1;
|
|
12
|
+
background-color: var(--oui-absolute);
|
|
13
|
+
border: 1px solid var(--oui-gray-3);
|
|
14
|
+
border-radius: 0.5em;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:where([oui-listbox-filter], [oui-listbox-header]) {
|
|
18
|
+
&::after {
|
|
19
|
+
content: '';
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 0.25em;
|
|
22
|
+
background-image: linear-gradient(to bottom, rgb(0 0 0 / 12.5%), transparent);
|
|
23
|
+
position: absolute;
|
|
24
|
+
bottom: -0.25em;
|
|
25
|
+
left: 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:where([oui-listbox-filter]) {
|
|
30
|
+
padding: 1em;
|
|
31
|
+
background-color: var(--oui-yellow-0);
|
|
32
|
+
border-radius: 0.5em 0.5em 0 0;
|
|
33
|
+
position: relative;
|
|
34
|
+
z-index: 2;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[oui-listbox-filter-input] {
|
|
38
|
+
:where(&) {
|
|
39
|
+
@include mixins.input;
|
|
40
|
+
|
|
41
|
+
--oui-background-value: var(--oui-absolute);
|
|
42
|
+
|
|
43
|
+
width: 100%;
|
|
44
|
+
padding: 0.5em 0.75em;
|
|
45
|
+
border-radius: 0.25em;
|
|
46
|
+
position: relative;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:where(&:not([disabled], [readonly], [aria-disabled='true' i]):focus) {
|
|
50
|
+
@include mixins.input-focus;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@media (hover: hover) {
|
|
54
|
+
:where(
|
|
55
|
+
&:not([disabled], [readonly], [aria-disabled='true' i], [aria-readonly='true' i]):hover
|
|
56
|
+
) {
|
|
57
|
+
@include mixins.input-hover;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:where(&:is([disabled], [readonly], [aria-disabled='true' i], [aria-readonly='true' i])) {
|
|
62
|
+
--oui-foreground-percentage: 25%;
|
|
63
|
+
|
|
64
|
+
font-style: italic;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:where(&:is([disabled], [readonly], [aria-disabled='true' i], [aria-readonly='true' i]):focus) {
|
|
68
|
+
--oui-outline-percentage: 75%;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:where(&:is([disabled], [aria-disabled='true' i])) {
|
|
72
|
+
--oui-background-percentage: 50%;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:where([oui-listbox-header]) {
|
|
77
|
+
padding: 0.5em calc(0.75em / 0.75);
|
|
78
|
+
background-color: var(--oui-gray-0);
|
|
79
|
+
font-size: 0.75em;
|
|
80
|
+
font-weight: bold;
|
|
81
|
+
position: sticky;
|
|
82
|
+
top: 0;
|
|
83
|
+
z-index: 1;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
:where([oui-listbox-hidden]) {
|
|
87
|
+
@include mixins.visually-hidden;
|
|
88
|
+
|
|
89
|
+
position: absolute;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:where([oui-listbox-list]) {
|
|
93
|
+
height: fit-content;
|
|
94
|
+
max-height: max(25vh, 32rem);
|
|
95
|
+
flex: 1;
|
|
96
|
+
overflow: auto;
|
|
97
|
+
border-radius: 0 0 0.5em 0.5em;
|
|
98
|
+
position: relative;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:where([oui-listbox-list-empty]) {
|
|
102
|
+
display: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
:where([oui-listbox-message]) {
|
|
106
|
+
padding: 1em;
|
|
107
|
+
flex: 1;
|
|
108
|
+
align-content: center;
|
|
109
|
+
text-align: center;
|
|
110
|
+
font-style: italic;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
[oui-listbox-option] {
|
|
114
|
+
:where(&) {
|
|
115
|
+
padding: 0.5em 0.75em;
|
|
116
|
+
outline: 4px solid transparent;
|
|
117
|
+
outline-offset: -4px;
|
|
118
|
+
line-height: 1.25;
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
transition: 0.125s ease-in-out;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:where(&[aria-selected='true' i]) {
|
|
124
|
+
background-color: var(--oui-blue-3);
|
|
125
|
+
color: var(--oui-blue-9);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
:where(oui-listbox[multiple] &[aria-selected='true' i])::before {
|
|
129
|
+
content: '✓';
|
|
130
|
+
margin: 0 0.75em 0 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
:where(
|
|
134
|
+
oui-listbox:not([disabled], [readonly], [aria-disabled='true' i], [aria-readonly='true' i]) &
|
|
135
|
+
) {
|
|
136
|
+
@media (hover: hover) {
|
|
137
|
+
:where(&:hover) {
|
|
138
|
+
background-color: var(--oui-blue-1);
|
|
139
|
+
color: var(--oui-blue-8);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:where(oui-listbox:focus-within [oui-listbox-option-active]) {
|
|
146
|
+
background-color: var(--oui-blue-1);
|
|
147
|
+
outline-color: var(--oui-blue-4);
|
|
148
|
+
color: var(--oui-blue-8);
|
|
149
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
OuiListboxAttributes,
|
|
3
|
+
OuiListboxAutoCompleteType,
|
|
4
|
+
} from '../internal/listbox/listbox.model';
|
|
2
5
|
|
|
3
6
|
// #region Variables
|
|
4
7
|
|
|
@@ -6,57 +9,75 @@ export const COMBOBOX_TAGNAME = 'oui-combobox';
|
|
|
6
9
|
|
|
7
10
|
export const COMBOBOX_ATTRIBUTE_ANCHOR = `${COMBOBOX_TAGNAME}-anchor`;
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
const attributeContent = `${COMBOBOX_TAGNAME}-content`;
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
const attributeFilter = `${COMBOBOX_TAGNAME}-filter`;
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
const attributeFilterInput = `${attributeFilter}-input`;
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
const attributeGroup = `${COMBOBOX_TAGNAME}-group`;
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
const attributeHeader = `${COMBOBOX_TAGNAME}-header`;
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
const attributeHidden = `${COMBOBOX_TAGNAME}-hidden`;
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
const attributeList = `${COMBOBOX_TAGNAME}-list`;
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
const attributeListEmpty = `${attributeList}-empty`;
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
const attributeMessage = `${COMBOBOX_TAGNAME}-message`;
|
|
29
|
+
|
|
30
|
+
const attributeOption = `${COMBOBOX_TAGNAME}-option`;
|
|
31
|
+
|
|
32
|
+
const attributeOptionActive = `${COMBOBOX_TAGNAME}-option-active`;
|
|
26
33
|
|
|
27
34
|
export const COMBOBOX_ATTRIBUTE_SELECTION = `${COMBOBOX_TAGNAME}-selection`;
|
|
28
35
|
|
|
29
36
|
export const COMBOBOX_ATTRIBUTE_SELECTION_ITEM = `${COMBOBOX_TAGNAME}-selection-item`;
|
|
30
37
|
|
|
31
|
-
export const COMBOBOX_AUTOCOMPLETES = new Set<
|
|
38
|
+
export const COMBOBOX_AUTOCOMPLETES = new Set<OuiListboxAutoCompleteType>([
|
|
32
39
|
'both',
|
|
33
40
|
'inline',
|
|
34
41
|
'list',
|
|
35
42
|
'none',
|
|
36
43
|
]);
|
|
37
44
|
|
|
38
|
-
export const
|
|
39
|
-
|
|
40
|
-
export const COMBOBOX_KEYS_NAVIGATION = new Set(['ArrowDown', 'ArrowUp', 'PageDown', 'PageUp']);
|
|
45
|
+
export const messageLabel = `<${COMBOBOX_TAGNAME}> must contain a <label> element for the <select> element`;
|
|
41
46
|
|
|
42
|
-
export const
|
|
47
|
+
export const messageSelect = `<${COMBOBOX_TAGNAME}> must contain a valid <select> element`;
|
|
43
48
|
|
|
44
|
-
export const
|
|
49
|
+
export const selectorAnchor = `[${COMBOBOX_ATTRIBUTE_ANCHOR}]`;
|
|
45
50
|
|
|
46
|
-
export const
|
|
51
|
+
export const selectorContent = `[${attributeContent}]`;
|
|
47
52
|
|
|
48
|
-
export const
|
|
53
|
+
export const selectorOption = `[${attributeOption}]`;
|
|
49
54
|
|
|
50
|
-
export const
|
|
55
|
+
export const selectorSelectionItem = `[${COMBOBOX_ATTRIBUTE_SELECTION_ITEM}]`;
|
|
51
56
|
|
|
52
|
-
export const
|
|
57
|
+
export const COMBOBOX_ATTRIBUTES: OuiListboxAttributes = {
|
|
58
|
+
active: attributeOptionActive,
|
|
59
|
+
content: attributeContent,
|
|
60
|
+
empty: attributeListEmpty,
|
|
61
|
+
filter: attributeFilter,
|
|
62
|
+
group: attributeGroup,
|
|
63
|
+
header: attributeHeader,
|
|
64
|
+
hidden: attributeHidden,
|
|
65
|
+
input: attributeFilterInput,
|
|
66
|
+
list: attributeList,
|
|
67
|
+
message: attributeMessage,
|
|
68
|
+
option: attributeOption,
|
|
69
|
+
};
|
|
53
70
|
|
|
54
|
-
export const
|
|
71
|
+
export const COMBOBOX_MESSAGES = {
|
|
72
|
+
label: messageLabel,
|
|
73
|
+
select: messageSelect,
|
|
74
|
+
};
|
|
55
75
|
|
|
56
|
-
export const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
76
|
+
export const COMBOBOX_SELECTORS = {
|
|
77
|
+
anchor: selectorAnchor,
|
|
78
|
+
content: selectorContent,
|
|
79
|
+
selectionItem: selectorSelectionItem,
|
|
80
|
+
option: selectorOption,
|
|
60
81
|
};
|
|
61
82
|
|
|
62
83
|
// #endregion
|