@danielgindi/selectbox 2.0.65 → 3.0.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 +50 -3
- package/css/droplist.css +1 -1
- package/css/droplist.css.map +1 -1
- package/css/selectbox.css +1 -1
- package/css/selectbox.css.map +1 -1
- package/dist/lib.cjs.js +240 -126
- package/dist/lib.cjs.js.map +1 -1
- package/dist/lib.cjs.min.js +2 -2
- package/dist/lib.cjs.min.js.map +1 -1
- package/dist/lib.es6.js +241 -126
- package/dist/lib.es6.js.map +1 -1
- package/dist/lib.es6.min.js +2 -2
- package/dist/lib.es6.min.js.map +1 -1
- package/dist/lib.umd.js +240 -126
- package/dist/lib.umd.js.map +1 -1
- package/dist/lib.umd.min.js +2 -2
- package/dist/lib.umd.min.js.map +1 -1
- package/dist/types/DropList.d.ts +13 -1
- package/dist/types/DropList.d.ts.map +1 -1
- package/dist/types/SelectBox.d.ts +7 -1
- package/dist/types/SelectBox.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +35 -0
- package/dist/types/types.d.ts.map +1 -1
- package/eslint.config.mjs +153 -151
- package/package.json +26 -16
- package/scss/droplist.scss +62 -71
- package/scss/selectbox.scss +126 -210
- package/vite.config.mjs +29 -0
- package/vue/DropList.vue +29 -15
- package/vue/SelectBox.vue +24 -15
- package/vue/component-types.d.ts +223 -217
- package/vue/utils/slots.js +17 -64
- package/vite.config.js +0 -9
package/scss/droplist.scss
CHANGED
|
@@ -19,15 +19,31 @@
|
|
|
19
19
|
--droplist-item-remove-spacing: 2px;
|
|
20
20
|
--droplist-checkbox-start: 6px;
|
|
21
21
|
|
|
22
|
+
--droplist-background-color: #fff;
|
|
23
|
+
--droplist-border-color: #b1b1b1;
|
|
24
|
+
--droplist-item-text-color: #3e3f48;
|
|
25
|
+
--droplist-item-focus-background-color: #c7c7c7;
|
|
26
|
+
--droplist-item-focus-text-color: var(--droplist-item-text-color);
|
|
27
|
+
--droplist-item-selected-background-color: #3e3f48;
|
|
28
|
+
--droplist-item-selected-text-color: #fff;
|
|
29
|
+
--droplist-item-selected-focus-background-color: #2e3038;
|
|
30
|
+
--droplist-item-selected-focus-color: #fff;
|
|
31
|
+
--droplist-item-remove-color: #fff;
|
|
32
|
+
--droplist-checkbox-border-color: #6ca1c6;
|
|
33
|
+
--droplist-checkbox-background-color: #dae7f1;
|
|
34
|
+
--droplist-checkbox-hover-background-color: #fff;
|
|
35
|
+
--droplist-checkbox-active-border-color: #396d93;
|
|
36
|
+
--droplist-checkbox-active-background-color: #b5cfe3;
|
|
37
|
+
|
|
22
38
|
box-sizing: border-box;
|
|
23
39
|
z-index: 10000;
|
|
24
40
|
float: left;
|
|
25
41
|
margin: 0;
|
|
26
42
|
padding: 0;
|
|
27
|
-
border: 1px solid
|
|
43
|
+
border: 1px solid var(--droplist-border-color);
|
|
28
44
|
outline: 0;
|
|
29
45
|
border-radius: var(--droplist-border-radius);
|
|
30
|
-
background:
|
|
46
|
+
background: var(--droplist-background-color);
|
|
31
47
|
max-height: 300px;
|
|
32
48
|
max-width: 100%;
|
|
33
49
|
line-height: 1.3;
|
|
@@ -83,10 +99,10 @@
|
|
|
83
99
|
margin: 0;
|
|
84
100
|
padding-top: var(--droplist-item-top-padding);
|
|
85
101
|
padding-bottom: var(--droplist-item-bottom-padding);
|
|
86
|
-
padding-
|
|
87
|
-
padding-
|
|
102
|
+
padding-inline-start: var(--droplist-item-start-padding);
|
|
103
|
+
padding-inline-end: var(--droplist-item-end-padding);
|
|
88
104
|
height: var(--droplist-item-height);
|
|
89
|
-
color:
|
|
105
|
+
color: var(--droplist-item-text-color);
|
|
90
106
|
white-space: nowrap;
|
|
91
107
|
cursor: pointer;
|
|
92
108
|
|
|
@@ -96,15 +112,16 @@
|
|
|
96
112
|
overflow: hidden;
|
|
97
113
|
|
|
98
114
|
&.droplist__item_focus {
|
|
99
|
-
background-color:
|
|
115
|
+
background-color: var(--droplist-item-focus-background-color);
|
|
116
|
+
color: var(--droplist-item-focus-text-color);
|
|
100
117
|
}
|
|
101
118
|
&.droplist__item_selected {
|
|
102
|
-
background-color:
|
|
103
|
-
color:
|
|
119
|
+
background-color: var(--droplist-item-selected-background-color);
|
|
120
|
+
color: var(--droplist-item-selected-text-color);
|
|
104
121
|
}
|
|
105
122
|
&.droplist__item_selected.droplist__item_focus {
|
|
106
|
-
background-color:
|
|
107
|
-
color:
|
|
123
|
+
background-color: var(--droplist-item-selected-focus-background-color);
|
|
124
|
+
color: var(--droplist-item-selected-focus-color);
|
|
108
125
|
}
|
|
109
126
|
}
|
|
110
127
|
|
|
@@ -113,41 +130,38 @@
|
|
|
113
130
|
position: absolute;
|
|
114
131
|
top: 50%;
|
|
115
132
|
transform: translateY(-50%);
|
|
116
|
-
|
|
133
|
+
inset-inline-start: var(--droplist-checkbox-start);
|
|
117
134
|
display: block;
|
|
135
|
+
box-sizing: border-box;
|
|
118
136
|
width: 16px;
|
|
119
137
|
height: 16px;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
background-
|
|
123
|
-
background-size: 100% 100%;
|
|
138
|
+
border: 1px solid var(--droplist-checkbox-border-color);
|
|
139
|
+
border-radius: 3.5px;
|
|
140
|
+
background-color: var(--droplist-checkbox-background-color);
|
|
124
141
|
}
|
|
125
142
|
|
|
126
143
|
&:not(:active):hover .checkbox {
|
|
127
|
-
|
|
128
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 448'%3E%3Crect x='14' y='14' width='420' height='420' rx='84' style='stroke-width: 28px; stroke: %236ca1c6; fill: %23fff;'%3E%3C/rect%3E%3C/svg%3E");
|
|
144
|
+
background-color: var(--droplist-checkbox-hover-background-color);
|
|
129
145
|
}
|
|
130
146
|
|
|
131
147
|
&:active .checkbox {
|
|
132
|
-
|
|
133
|
-
background-
|
|
148
|
+
border-color: var(--droplist-checkbox-active-border-color);
|
|
149
|
+
background-color: var(--droplist-checkbox-active-background-color);
|
|
134
150
|
}
|
|
135
151
|
}
|
|
136
152
|
|
|
137
153
|
li.droplist__item_multi.droplist__item_checked {
|
|
138
|
-
.checkbox {
|
|
139
|
-
/*
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 448'%3E%3Crect x='14' y='14' width='420' height='420' rx='84' style='stroke-width: 28px; stroke: %236ca1c6; fill: %23fff;'%3E%3C/rect%3E%3Cpath fill='%236ca1c6' d='m364.136 158.276-172.589 171.204c-4.705 4.667-12.303 4.637-16.97-.068l-90.781-91.516c-4.667-4.705-4.637-12.303.069-16.971l22.719-22.536c4.705-4.667 12.303-4.637 16.97.069l59.792 60.277 141.352-140.216c4.705-4.667 12.303-4.637 16.97.068l22.536 22.718c4.667 4.706 4.637 12.304-.068 16.971z'/%3E%3C/svg%3E%0A");
|
|
154
|
+
.checkbox::after {
|
|
155
|
+
/* the check mark, drawn in the checkbox's border color */
|
|
156
|
+
content: '';
|
|
157
|
+
position: absolute;
|
|
158
|
+
inset: -1px;
|
|
159
|
+
background-color: var(--droplist-checkbox-border-color);
|
|
160
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 448'%3E%3Cpath d='m364.136 158.276-172.589 171.204c-4.705 4.667-12.303 4.637-16.97-.068l-90.781-91.516c-4.667-4.705-4.637-12.303.069-16.971l22.719-22.536c4.705-4.667 12.303-4.637 16.97.069l59.792 60.277 141.352-140.216c4.705-4.667 12.303-4.637 16.97.068l22.536 22.718c4.667 4.706 4.637 12.304-.068 16.971z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
|
|
146
161
|
}
|
|
147
162
|
|
|
148
|
-
&:active .checkbox {
|
|
149
|
-
|
|
150
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 448'%3E%3Crect x='14' y='14' width='420' height='420' rx='84' style='stroke-width: 28px; stroke: %23396d93; fill: %23b5cfe3;'%3E%3C/rect%3E%3Cpath fill='%23396d93' d='m364.136 158.276-172.589 171.204c-4.705 4.667-12.303 4.637-16.97-.068l-90.781-91.516c-4.667-4.705-4.637-12.303.069-16.971l22.719-22.536c4.705-4.667 12.303-4.637 16.97.069l59.792 60.277 141.352-140.216c4.705-4.667 12.303-4.637 16.97.068l22.536 22.718c4.667 4.706 4.637 12.304-.068 16.971z'/%3E%3C/svg%3E%0A");
|
|
163
|
+
&:active .checkbox::after {
|
|
164
|
+
background-color: var(--droplist-checkbox-active-border-color);
|
|
151
165
|
}
|
|
152
166
|
}
|
|
153
167
|
|
|
@@ -158,13 +172,13 @@
|
|
|
158
172
|
li.droplist__item_multi:not(.droplist__item_multi_nocheck) {
|
|
159
173
|
padding-top: var(--droplist-item-multi-top-padding);
|
|
160
174
|
padding-bottom: var(--droplist-item-multi-bottom-padding);
|
|
161
|
-
padding-
|
|
162
|
-
padding-
|
|
175
|
+
padding-inline-start: var(--droplist-item-multi-start-padding);
|
|
176
|
+
padding-inline-end: var(--droplist-item-multi-end-padding);
|
|
163
177
|
|
|
164
178
|
.droplist__item_label {
|
|
165
179
|
display: block;
|
|
166
180
|
margin-top: var(--droplist-item-multi-label-top-padding);
|
|
167
|
-
margin-
|
|
181
|
+
margin-inline-start: var(--droplist-item-multi-label-start-padding);
|
|
168
182
|
}
|
|
169
183
|
}
|
|
170
184
|
|
|
@@ -173,12 +187,12 @@
|
|
|
173
187
|
}
|
|
174
188
|
|
|
175
189
|
li.droplist__item_child.droplist__item_multi:not(.droplist__item_multi_nocheck) {
|
|
176
|
-
padding-
|
|
190
|
+
padding-inline-start: var(--droplist-item-multi-child-start-padding);
|
|
177
191
|
}
|
|
178
192
|
|
|
179
193
|
li.droplist__item_child.droplist__item_single,
|
|
180
194
|
li.droplist__item_child.droplist__item_multi_nocheck {
|
|
181
|
-
padding-
|
|
195
|
+
padding-inline-start: var(--droplist-item-child-start-padding);
|
|
182
196
|
}
|
|
183
197
|
|
|
184
198
|
li.droplist__item_nointeraction {
|
|
@@ -209,7 +223,7 @@
|
|
|
209
223
|
&:before {
|
|
210
224
|
display: inline-block;
|
|
211
225
|
content: 'x';
|
|
212
|
-
color:
|
|
226
|
+
color: var(--droplist-item-remove-color);
|
|
213
227
|
}
|
|
214
228
|
}
|
|
215
229
|
|
|
@@ -218,45 +232,22 @@
|
|
|
218
232
|
}
|
|
219
233
|
}
|
|
220
234
|
|
|
221
|
-
|
|
222
|
-
|
|
235
|
+
// Layout mirrors automatically through logical properties, which follow the computed `direction`:
|
|
236
|
+
// set by the `direction` option (`.droplist__rtl` / `.droplist__ltr`), or inherited from the document.
|
|
237
|
+
&.droplist__rtl {
|
|
223
238
|
direction: rtl;
|
|
224
239
|
}
|
|
225
240
|
|
|
226
|
-
&.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
.checkbox {
|
|
230
|
-
left: auto;
|
|
231
|
-
right: var(--droplist-checkbox-start);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
li.droplist__item_multi:not(.droplist__item_multi_nocheck) {
|
|
236
|
-
padding-left: var(--droplist-item-multi-end-padding);
|
|
237
|
-
padding-right: var(--droplist-item-multi-start-padding);
|
|
238
|
-
|
|
239
|
-
.droplist__item_label {
|
|
240
|
-
margin-left: 0;
|
|
241
|
-
margin-right: var(--droplist-item-multi-label-start-padding);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
li.droplist__item_child.droplist__item_multi:not(.droplist__item_multi_nocheck) {
|
|
246
|
-
padding-left: var(--droplist-item-multi-end-padding);
|
|
247
|
-
padding-right: var(--droplist-item-multi-child-start-padding);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
li.droplist__item_child.droplist__item_single,
|
|
251
|
-
li.droplist__item_child.droplist__item_multi_nocheck {
|
|
252
|
-
padding-left: var(--droplist-item-end-padding);
|
|
253
|
-
padding-right: var(--droplist-item-child-start-padding);
|
|
254
|
-
}
|
|
241
|
+
&.droplist__ltr {
|
|
242
|
+
direction: ltr;
|
|
243
|
+
}
|
|
255
244
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
245
|
+
// `.remove` forces `direction: ltr` on itself, which would make logical insets resolve as LTR,
|
|
246
|
+
// so it is positioned physically. `:dir()` follows the nearest `dir` attribute; `:where()` keeps
|
|
247
|
+
// the specificity low, and its forgiving parsing just skips `:dir()` where it isn't supported.
|
|
248
|
+
&:where(.droplist__rtl, :dir(rtl):not(.droplist__ltr)) ul li .remove {
|
|
249
|
+
right: auto;
|
|
250
|
+
left: var(--droplist-item-remove-spacing);
|
|
260
251
|
}
|
|
261
252
|
}
|
|
262
253
|
|