@starasia/dropdown 5.0.0 → 5.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/dist/dropdown.es.js +69 -66
- package/dist/dropdown.umd.js +30 -27
- package/package.json +1 -1
package/dist/dropdown.es.js
CHANGED
|
@@ -114,7 +114,7 @@ const pn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
114
114
|
/* --- Outline variant --- */
|
|
115
115
|
.sa-input-dropdown-container.outline {
|
|
116
116
|
background-color: transparent;
|
|
117
|
-
border:
|
|
117
|
+
border: 1px solid var(--sa-dropdown-border-subtle);
|
|
118
118
|
border-radius: var(--borderRadius);
|
|
119
119
|
outline: none;
|
|
120
120
|
}
|
|
@@ -124,7 +124,7 @@ const pn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
124
124
|
}
|
|
125
125
|
.sa-input-dropdown-container.outline.error {
|
|
126
126
|
background-color: transparent;
|
|
127
|
-
border:
|
|
127
|
+
border: 1px solid var(--sa-dropdown-border-error-subtle);
|
|
128
128
|
}
|
|
129
129
|
.sa-input-dropdown-container.outline.disable {
|
|
130
130
|
background-color: var(--sa-dropdown-bg-disabled);
|
|
@@ -138,7 +138,7 @@ const pn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
138
138
|
.sa-input-dropdown-container.flushed {
|
|
139
139
|
background-color: transparent;
|
|
140
140
|
border: none;
|
|
141
|
-
border-bottom:
|
|
141
|
+
border-bottom: 1px solid var(--sa-dropdown-border-subtle);
|
|
142
142
|
border-radius: 0;
|
|
143
143
|
}
|
|
144
144
|
.sa-input-dropdown-container.flushed.active {
|
|
@@ -146,7 +146,7 @@ const pn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
146
146
|
box-shadow: none;
|
|
147
147
|
}
|
|
148
148
|
.sa-input-dropdown-container.flushed.error {
|
|
149
|
-
border-bottom:
|
|
149
|
+
border-bottom: 1px solid var(--sa-dropdown-border-error-subtle);
|
|
150
150
|
}
|
|
151
151
|
.sa-input-dropdown-container.flushed.disable {
|
|
152
152
|
cursor: not-allowed;
|
|
@@ -175,7 +175,7 @@ const pn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
.sa-input-dropdown-preview-item {
|
|
178
|
-
border:
|
|
178
|
+
border: 1px solid var(--sa-dropdown-border-subtle);
|
|
179
179
|
padding-inline: 8px;
|
|
180
180
|
padding-block: 2px;
|
|
181
181
|
border-radius: 4px;
|
|
@@ -205,7 +205,7 @@ const pn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
205
205
|
background-color: var(--sa-dropdown-bg);
|
|
206
206
|
border-radius: var(--sa-dropdown-radius);
|
|
207
207
|
box-shadow: var(--sa-dropdown-shadow-panel);
|
|
208
|
-
max-height: min(
|
|
208
|
+
max-height: min(360px, calc(100vh - 80px));
|
|
209
209
|
overflow: hidden;
|
|
210
210
|
z-index: 999;
|
|
211
211
|
width: 100%;
|
|
@@ -221,7 +221,7 @@ const pn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
221
221
|
align-items: center;
|
|
222
222
|
height: 32px;
|
|
223
223
|
min-height: 32px;
|
|
224
|
-
border-bottom:
|
|
224
|
+
border-bottom: 1px solid var(--sa-dropdown-border-subtle);
|
|
225
225
|
gap: 8px;
|
|
226
226
|
padding-inline: 12px;
|
|
227
227
|
padding-block: 8px;
|
|
@@ -244,7 +244,7 @@ const pn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
/* === LIST SCROLL AREA === */
|
|
247
|
-
.sa-input-
|
|
247
|
+
.sa-input-dropdown-item-container {
|
|
248
248
|
flex: 1 1 auto;
|
|
249
249
|
overflow-y: auto;
|
|
250
250
|
min-height: 0;
|
|
@@ -284,8 +284,8 @@ const pn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
/* === LIST ITEMS === */
|
|
287
|
-
.sa-input-
|
|
288
|
-
min-height:
|
|
287
|
+
.sa-input-dropdown-item {
|
|
288
|
+
min-height: 32px;
|
|
289
289
|
box-sizing: border-box;
|
|
290
290
|
padding: 4px 12px 4px 8px;
|
|
291
291
|
display: flex;
|
|
@@ -298,32 +298,37 @@ const pn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
298
298
|
font-size: 14px;
|
|
299
299
|
transition: background-color 0.12s ease;
|
|
300
300
|
}
|
|
301
|
-
.sa-input-
|
|
301
|
+
.sa-input-dropdown-item.has-description {
|
|
302
302
|
min-height: 32px;
|
|
303
303
|
font-size: 12px;
|
|
304
304
|
}
|
|
305
|
-
.sa-input-
|
|
305
|
+
.sa-input-dropdown-size-sm .sa-input-dropdown-item,
|
|
306
|
+
.sa-input-dropdown-size-md .sa-input-dropdown-item {
|
|
307
|
+
font-size: 12px;
|
|
308
|
+
font-weight: 500;
|
|
309
|
+
}
|
|
310
|
+
.sa-input-dropdown-item:hover:not(.sa-input-dropdown-item-disable) {
|
|
306
311
|
background-color: var(--sa-dropdown-bg-hover);
|
|
307
312
|
}
|
|
308
|
-
.sa-input-
|
|
313
|
+
.sa-input-dropdown-item.active {
|
|
309
314
|
background-color: var(--sa-dropdown-bg-selected);
|
|
310
315
|
}
|
|
311
|
-
.sa-input-
|
|
316
|
+
.sa-input-dropdown-item.active:hover {
|
|
312
317
|
background-color: var(--sa-dropdown-bg-selected);
|
|
313
318
|
}
|
|
314
|
-
.sa-input-
|
|
319
|
+
.sa-input-dropdown-item.highlight {
|
|
315
320
|
background-color: var(--sa-dropdown-bg-selected);
|
|
316
321
|
outline: 1.2px solid var(--sa-dropdown-border-active);
|
|
317
322
|
outline-offset: -1.2px;
|
|
318
323
|
}
|
|
319
|
-
.sa-input-
|
|
324
|
+
.sa-input-dropdown-item-disable {
|
|
320
325
|
color: var(--sa-dropdown-color-disable) !important;
|
|
321
326
|
pointer-events: none;
|
|
322
327
|
cursor: not-allowed;
|
|
323
328
|
}
|
|
324
329
|
|
|
325
330
|
/* check indicator for selected items in single-select mode */
|
|
326
|
-
.sa-input-
|
|
331
|
+
.sa-input-dropdown-item-check {
|
|
327
332
|
flex-shrink: 0;
|
|
328
333
|
width: 20px;
|
|
329
334
|
height: 20px;
|
|
@@ -333,7 +338,7 @@ const pn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
333
338
|
color: var(--sa-dropdown-brand);
|
|
334
339
|
}
|
|
335
340
|
|
|
336
|
-
.sa-input-
|
|
341
|
+
.sa-input-dropdown-item-text {
|
|
337
342
|
color: var(--sa-dropdown-text-primary);
|
|
338
343
|
font-size: inherit;
|
|
339
344
|
font-weight: 500;
|
|
@@ -342,7 +347,7 @@ const pn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
342
347
|
white-space: nowrap;
|
|
343
348
|
line-height: normal;
|
|
344
349
|
}
|
|
345
|
-
.sa-input-
|
|
350
|
+
.sa-input-dropdown-item-text-description {
|
|
346
351
|
color: var(--sa-dropdown-text-secondary);
|
|
347
352
|
font-size: 12px;
|
|
348
353
|
font-weight: 400;
|
|
@@ -358,7 +363,7 @@ const pn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
358
363
|
flex-shrink: 0;
|
|
359
364
|
background: var(--sa-dropdown-bg);
|
|
360
365
|
padding: 8px;
|
|
361
|
-
border-top:
|
|
366
|
+
border-top: 1px solid var(--sa-dropdown-border-subtle);
|
|
362
367
|
}
|
|
363
368
|
|
|
364
369
|
/* === SELECT FIELD WRAPPER === */
|
|
@@ -417,16 +422,14 @@ const pn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
417
422
|
.sa-select-field-optional-badge {
|
|
418
423
|
display: inline-flex;
|
|
419
424
|
align-items: center;
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
border: 0.8px solid var(--sa-dropdown-border-subtle);
|
|
425
|
+
padding: 0 8px;
|
|
426
|
+
border: 1px solid var(--sa-dropdown-border-subtle);
|
|
423
427
|
border-radius: 4px;
|
|
424
|
-
background
|
|
428
|
+
background: var(--sa-dropdown-bg-neutral);
|
|
425
429
|
font-size: 10px;
|
|
426
430
|
font-weight: 500;
|
|
427
|
-
color: var(--sa-dropdown-text-
|
|
431
|
+
color: var(--sa-dropdown-text-primary);
|
|
428
432
|
line-height: 18px;
|
|
429
|
-
text-transform: lowercase;
|
|
430
433
|
}
|
|
431
434
|
.sa-select-field-helper-top {
|
|
432
435
|
font-size: 12px;
|
|
@@ -523,15 +526,15 @@ const un = ({ ...e }) => /* @__PURE__ */ l(
|
|
|
523
526
|
searchValue: F,
|
|
524
527
|
highlightedIndex: m,
|
|
525
528
|
footer: I,
|
|
526
|
-
groupLabel:
|
|
527
|
-
onSelectAll:
|
|
529
|
+
groupLabel: A,
|
|
530
|
+
onSelectAll: D
|
|
528
531
|
}, H) => {
|
|
529
|
-
const
|
|
532
|
+
const L = B([]);
|
|
530
533
|
g(() => {
|
|
531
534
|
var a;
|
|
532
|
-
m >= 0 &&
|
|
535
|
+
m >= 0 && L.current[m] && ((a = L.current[m]) == null || a.scrollIntoView({ block: "nearest" }));
|
|
533
536
|
}, [m]);
|
|
534
|
-
const
|
|
537
|
+
const j = s ? /* @__PURE__ */ l("div", { className: "sa-input-dropdown-container-dropdown-search", children: [
|
|
535
538
|
/* @__PURE__ */ n(un, { strokeWidth: 2, width: 16, style: { flexShrink: 0, color: "var(--sa-dropdown-placeholder-subtle)" } }),
|
|
536
539
|
/* @__PURE__ */ n(
|
|
537
540
|
"input",
|
|
@@ -552,51 +555,51 @@ const un = ({ ...e }) => /* @__PURE__ */ l(
|
|
|
552
555
|
onClick: (a) => a.stopPropagation(),
|
|
553
556
|
ref: H,
|
|
554
557
|
children: [
|
|
555
|
-
e !== "top" &&
|
|
558
|
+
e !== "top" && j,
|
|
556
559
|
/* @__PURE__ */ l(
|
|
557
560
|
"div",
|
|
558
561
|
{
|
|
559
|
-
className: `sa-input-
|
|
562
|
+
className: `sa-input-dropdown-item-container ${u ? "multi" : ""}`,
|
|
560
563
|
children: [
|
|
561
|
-
|
|
562
|
-
/* @__PURE__ */ n("span", { className: "sa-input-dropdown-section-label", children:
|
|
563
|
-
u &&
|
|
564
|
+
A && /* @__PURE__ */ l("div", { className: "sa-input-dropdown-section-header", children: [
|
|
565
|
+
/* @__PURE__ */ n("span", { className: "sa-input-dropdown-section-label", children: A }),
|
|
566
|
+
u && D && /* @__PURE__ */ n(
|
|
564
567
|
"button",
|
|
565
568
|
{
|
|
566
569
|
className: "sa-input-dropdown-section-select-all",
|
|
567
570
|
onClick: (a) => {
|
|
568
|
-
a.stopPropagation(),
|
|
571
|
+
a.stopPropagation(), D();
|
|
569
572
|
},
|
|
570
573
|
children: "Select all"
|
|
571
574
|
}
|
|
572
575
|
)
|
|
573
576
|
] }),
|
|
574
|
-
p.map((a,
|
|
577
|
+
p.map((a, R) => {
|
|
575
578
|
const O = !!(o != null && o.find((k) => k.value === a.value)), M = !!a.description;
|
|
576
579
|
return /* @__PURE__ */ l(
|
|
577
580
|
"div",
|
|
578
581
|
{
|
|
579
582
|
className: [
|
|
580
|
-
"sa-input-
|
|
583
|
+
"sa-input-dropdown-item",
|
|
581
584
|
M ? "has-description" : "",
|
|
582
585
|
O ? "active" : "",
|
|
583
|
-
|
|
584
|
-
a.disable ? "sa-input-
|
|
586
|
+
R === m ? "highlight" : "",
|
|
587
|
+
a.disable ? "sa-input-dropdown-item-disable" : ""
|
|
585
588
|
].filter(Boolean).join(" "),
|
|
586
589
|
ref: (k) => {
|
|
587
|
-
|
|
590
|
+
L.current[R] = k;
|
|
588
591
|
},
|
|
589
592
|
onClick: () => N(a.label, a.value),
|
|
590
593
|
children: [
|
|
591
|
-
u && /* @__PURE__ */ n("div", { className: "sa-input-
|
|
594
|
+
u && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-item-check", children: O && /* @__PURE__ */ n(wn, { width: 16 }) }),
|
|
592
595
|
a.icon && /* @__PURE__ */ n("div", { style: { flexShrink: 0, display: "flex" }, children: T.cloneElement(a.icon, { width: 16 }) }),
|
|
593
596
|
/* @__PURE__ */ l("div", { style: { minWidth: 0, flex: 1 }, children: [
|
|
594
597
|
/* @__PURE__ */ n(
|
|
595
598
|
"p",
|
|
596
599
|
{
|
|
597
600
|
className: [
|
|
598
|
-
"sa-input-
|
|
599
|
-
a.disable ? "sa-input-
|
|
601
|
+
"sa-input-dropdown-item-text",
|
|
602
|
+
a.disable ? "sa-input-dropdown-item-disable" : ""
|
|
600
603
|
].filter(Boolean).join(" "),
|
|
601
604
|
children: a.label
|
|
602
605
|
}
|
|
@@ -605,8 +608,8 @@ const un = ({ ...e }) => /* @__PURE__ */ l(
|
|
|
605
608
|
"p",
|
|
606
609
|
{
|
|
607
610
|
className: [
|
|
608
|
-
"sa-input-
|
|
609
|
-
a.disable ? "sa-input-
|
|
611
|
+
"sa-input-dropdown-item-text-description",
|
|
612
|
+
a.disable ? "sa-input-dropdown-item-disable" : ""
|
|
610
613
|
].filter(Boolean).join(" "),
|
|
611
614
|
children: a.description
|
|
612
615
|
}
|
|
@@ -614,13 +617,13 @@ const un = ({ ...e }) => /* @__PURE__ */ l(
|
|
|
614
617
|
] })
|
|
615
618
|
]
|
|
616
619
|
},
|
|
617
|
-
|
|
620
|
+
R
|
|
618
621
|
);
|
|
619
622
|
})
|
|
620
623
|
]
|
|
621
624
|
}
|
|
622
625
|
),
|
|
623
|
-
e === "top" &&
|
|
626
|
+
e === "top" && j,
|
|
624
627
|
I && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-footer", onClick: (a) => a.stopPropagation(), children: I })
|
|
625
628
|
]
|
|
626
629
|
}
|
|
@@ -669,13 +672,13 @@ const yn = ({
|
|
|
669
672
|
placeholder: F,
|
|
670
673
|
onSearch: m,
|
|
671
674
|
error: I,
|
|
672
|
-
onBlur:
|
|
673
|
-
onFocus:
|
|
675
|
+
onBlur: A,
|
|
676
|
+
onFocus: D,
|
|
674
677
|
disable: H,
|
|
675
|
-
searchValue:
|
|
676
|
-
variant:
|
|
678
|
+
searchValue: L,
|
|
679
|
+
variant: j = "outline",
|
|
677
680
|
footer: a,
|
|
678
|
-
groupLabel:
|
|
681
|
+
groupLabel: R,
|
|
679
682
|
onSelectAll: O,
|
|
680
683
|
fullWidth: M = !0,
|
|
681
684
|
/* field wrapper */
|
|
@@ -690,28 +693,28 @@ const yn = ({
|
|
|
690
693
|
const $ = [
|
|
691
694
|
"sa-select-field",
|
|
692
695
|
M ? "sa-select-field-fullwidth" : ""
|
|
693
|
-
].filter(Boolean).join(" "),
|
|
694
|
-
|
|
696
|
+
].filter(Boolean).join(" "), z = s !== void 0, V = B(), en = I || !!w, [c, S] = P(
|
|
697
|
+
z ? s || [] : d || []
|
|
695
698
|
), [on, X] = P(""), [x, q] = P(-1), h = B(null), { isComponentVisible: f, ref: G, setIsComponentVisible: W } = cn(!1), rn = () => {
|
|
696
699
|
W((t) => !t);
|
|
697
700
|
}, J = (t, i) => {
|
|
698
701
|
if (o)
|
|
699
702
|
if (c == null ? void 0 : c.find((b) => b.value === i)) {
|
|
700
703
|
const b = c.filter((dn) => dn.value !== i);
|
|
701
|
-
|
|
704
|
+
z || S(b), p(b);
|
|
702
705
|
} else {
|
|
703
706
|
const b = [...c, { label: t, value: i }];
|
|
704
|
-
|
|
707
|
+
z || S(b), p(b);
|
|
705
708
|
}
|
|
706
709
|
else {
|
|
707
710
|
const v = [{ label: t, value: i }];
|
|
708
|
-
|
|
711
|
+
z || S(v), p(v), W(!1);
|
|
709
712
|
}
|
|
710
713
|
};
|
|
711
714
|
g(() => {
|
|
712
|
-
|
|
715
|
+
z && S(s || []);
|
|
713
716
|
}, [s]), g(() => {
|
|
714
|
-
|
|
717
|
+
z || JSON.stringify(V.current) === JSON.stringify(d) || (V.current = d, S(V.current || []));
|
|
715
718
|
}, [d]);
|
|
716
719
|
const an = () => c.length ? o ? c == null ? void 0 : c.map((t, i) => /* @__PURE__ */ l("div", { className: "sa-input-dropdown-preview-item", children: [
|
|
717
720
|
/* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children: t == null ? void 0 : t.label }),
|
|
@@ -777,7 +780,7 @@ const yn = ({
|
|
|
777
780
|
{
|
|
778
781
|
className: [
|
|
779
782
|
"sa-input-dropdown-container",
|
|
780
|
-
|
|
783
|
+
j,
|
|
781
784
|
`sa-input-dropdown-size-${r}`,
|
|
782
785
|
f ? "active" : "",
|
|
783
786
|
en ? "error" : "",
|
|
@@ -787,8 +790,8 @@ const yn = ({
|
|
|
787
790
|
onClick: rn,
|
|
788
791
|
onKeyDown: tn,
|
|
789
792
|
tabIndex: 0,
|
|
790
|
-
onBlur:
|
|
791
|
-
onFocus:
|
|
793
|
+
onBlur: A,
|
|
794
|
+
onFocus: D,
|
|
792
795
|
children: [
|
|
793
796
|
/* @__PURE__ */ l("div", { className: "sa-input-dropdown-preview-container", children: [
|
|
794
797
|
u ? T.cloneElement(u, {
|
|
@@ -810,10 +813,10 @@ const yn = ({
|
|
|
810
813
|
onSearch: m,
|
|
811
814
|
ref: h,
|
|
812
815
|
multiSelect: o,
|
|
813
|
-
searchValue:
|
|
816
|
+
searchValue: L,
|
|
814
817
|
highlightedIndex: x,
|
|
815
818
|
footer: a,
|
|
816
|
-
groupLabel:
|
|
819
|
+
groupLabel: R,
|
|
817
820
|
onSelectAll: O
|
|
818
821
|
}
|
|
819
822
|
)
|
package/dist/dropdown.umd.js
CHANGED
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
/* --- Outline variant --- */
|
|
113
113
|
.sa-input-dropdown-container.outline {
|
|
114
114
|
background-color: transparent;
|
|
115
|
-
border:
|
|
115
|
+
border: 1px solid var(--sa-dropdown-border-subtle);
|
|
116
116
|
border-radius: var(--borderRadius);
|
|
117
117
|
outline: none;
|
|
118
118
|
}
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
}
|
|
123
123
|
.sa-input-dropdown-container.outline.error {
|
|
124
124
|
background-color: transparent;
|
|
125
|
-
border:
|
|
125
|
+
border: 1px solid var(--sa-dropdown-border-error-subtle);
|
|
126
126
|
}
|
|
127
127
|
.sa-input-dropdown-container.outline.disable {
|
|
128
128
|
background-color: var(--sa-dropdown-bg-disabled);
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
.sa-input-dropdown-container.flushed {
|
|
137
137
|
background-color: transparent;
|
|
138
138
|
border: none;
|
|
139
|
-
border-bottom:
|
|
139
|
+
border-bottom: 1px solid var(--sa-dropdown-border-subtle);
|
|
140
140
|
border-radius: 0;
|
|
141
141
|
}
|
|
142
142
|
.sa-input-dropdown-container.flushed.active {
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
box-shadow: none;
|
|
145
145
|
}
|
|
146
146
|
.sa-input-dropdown-container.flushed.error {
|
|
147
|
-
border-bottom:
|
|
147
|
+
border-bottom: 1px solid var(--sa-dropdown-border-error-subtle);
|
|
148
148
|
}
|
|
149
149
|
.sa-input-dropdown-container.flushed.disable {
|
|
150
150
|
cursor: not-allowed;
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
.sa-input-dropdown-preview-item {
|
|
176
|
-
border:
|
|
176
|
+
border: 1px solid var(--sa-dropdown-border-subtle);
|
|
177
177
|
padding-inline: 8px;
|
|
178
178
|
padding-block: 2px;
|
|
179
179
|
border-radius: 4px;
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
background-color: var(--sa-dropdown-bg);
|
|
204
204
|
border-radius: var(--sa-dropdown-radius);
|
|
205
205
|
box-shadow: var(--sa-dropdown-shadow-panel);
|
|
206
|
-
max-height: min(
|
|
206
|
+
max-height: min(360px, calc(100vh - 80px));
|
|
207
207
|
overflow: hidden;
|
|
208
208
|
z-index: 999;
|
|
209
209
|
width: 100%;
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
align-items: center;
|
|
220
220
|
height: 32px;
|
|
221
221
|
min-height: 32px;
|
|
222
|
-
border-bottom:
|
|
222
|
+
border-bottom: 1px solid var(--sa-dropdown-border-subtle);
|
|
223
223
|
gap: 8px;
|
|
224
224
|
padding-inline: 12px;
|
|
225
225
|
padding-block: 8px;
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
/* === LIST SCROLL AREA === */
|
|
245
|
-
.sa-input-
|
|
245
|
+
.sa-input-dropdown-item-container {
|
|
246
246
|
flex: 1 1 auto;
|
|
247
247
|
overflow-y: auto;
|
|
248
248
|
min-height: 0;
|
|
@@ -282,8 +282,8 @@
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
/* === LIST ITEMS === */
|
|
285
|
-
.sa-input-
|
|
286
|
-
min-height:
|
|
285
|
+
.sa-input-dropdown-item {
|
|
286
|
+
min-height: 32px;
|
|
287
287
|
box-sizing: border-box;
|
|
288
288
|
padding: 4px 12px 4px 8px;
|
|
289
289
|
display: flex;
|
|
@@ -296,32 +296,37 @@
|
|
|
296
296
|
font-size: 14px;
|
|
297
297
|
transition: background-color 0.12s ease;
|
|
298
298
|
}
|
|
299
|
-
.sa-input-
|
|
299
|
+
.sa-input-dropdown-item.has-description {
|
|
300
300
|
min-height: 32px;
|
|
301
301
|
font-size: 12px;
|
|
302
302
|
}
|
|
303
|
-
.sa-input-
|
|
303
|
+
.sa-input-dropdown-size-sm .sa-input-dropdown-item,
|
|
304
|
+
.sa-input-dropdown-size-md .sa-input-dropdown-item {
|
|
305
|
+
font-size: 12px;
|
|
306
|
+
font-weight: 500;
|
|
307
|
+
}
|
|
308
|
+
.sa-input-dropdown-item:hover:not(.sa-input-dropdown-item-disable) {
|
|
304
309
|
background-color: var(--sa-dropdown-bg-hover);
|
|
305
310
|
}
|
|
306
|
-
.sa-input-
|
|
311
|
+
.sa-input-dropdown-item.active {
|
|
307
312
|
background-color: var(--sa-dropdown-bg-selected);
|
|
308
313
|
}
|
|
309
|
-
.sa-input-
|
|
314
|
+
.sa-input-dropdown-item.active:hover {
|
|
310
315
|
background-color: var(--sa-dropdown-bg-selected);
|
|
311
316
|
}
|
|
312
|
-
.sa-input-
|
|
317
|
+
.sa-input-dropdown-item.highlight {
|
|
313
318
|
background-color: var(--sa-dropdown-bg-selected);
|
|
314
319
|
outline: 1.2px solid var(--sa-dropdown-border-active);
|
|
315
320
|
outline-offset: -1.2px;
|
|
316
321
|
}
|
|
317
|
-
.sa-input-
|
|
322
|
+
.sa-input-dropdown-item-disable {
|
|
318
323
|
color: var(--sa-dropdown-color-disable) !important;
|
|
319
324
|
pointer-events: none;
|
|
320
325
|
cursor: not-allowed;
|
|
321
326
|
}
|
|
322
327
|
|
|
323
328
|
/* check indicator for selected items in single-select mode */
|
|
324
|
-
.sa-input-
|
|
329
|
+
.sa-input-dropdown-item-check {
|
|
325
330
|
flex-shrink: 0;
|
|
326
331
|
width: 20px;
|
|
327
332
|
height: 20px;
|
|
@@ -331,7 +336,7 @@
|
|
|
331
336
|
color: var(--sa-dropdown-brand);
|
|
332
337
|
}
|
|
333
338
|
|
|
334
|
-
.sa-input-
|
|
339
|
+
.sa-input-dropdown-item-text {
|
|
335
340
|
color: var(--sa-dropdown-text-primary);
|
|
336
341
|
font-size: inherit;
|
|
337
342
|
font-weight: 500;
|
|
@@ -340,7 +345,7 @@
|
|
|
340
345
|
white-space: nowrap;
|
|
341
346
|
line-height: normal;
|
|
342
347
|
}
|
|
343
|
-
.sa-input-
|
|
348
|
+
.sa-input-dropdown-item-text-description {
|
|
344
349
|
color: var(--sa-dropdown-text-secondary);
|
|
345
350
|
font-size: 12px;
|
|
346
351
|
font-weight: 400;
|
|
@@ -356,7 +361,7 @@
|
|
|
356
361
|
flex-shrink: 0;
|
|
357
362
|
background: var(--sa-dropdown-bg);
|
|
358
363
|
padding: 8px;
|
|
359
|
-
border-top:
|
|
364
|
+
border-top: 1px solid var(--sa-dropdown-border-subtle);
|
|
360
365
|
}
|
|
361
366
|
|
|
362
367
|
/* === SELECT FIELD WRAPPER === */
|
|
@@ -415,16 +420,14 @@
|
|
|
415
420
|
.sa-select-field-optional-badge {
|
|
416
421
|
display: inline-flex;
|
|
417
422
|
align-items: center;
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
border: 0.8px solid var(--sa-dropdown-border-subtle);
|
|
423
|
+
padding: 0 8px;
|
|
424
|
+
border: 1px solid var(--sa-dropdown-border-subtle);
|
|
421
425
|
border-radius: 4px;
|
|
422
|
-
background
|
|
426
|
+
background: var(--sa-dropdown-bg-neutral);
|
|
423
427
|
font-size: 10px;
|
|
424
428
|
font-weight: 500;
|
|
425
|
-
color: var(--sa-dropdown-text-
|
|
429
|
+
color: var(--sa-dropdown-text-primary);
|
|
426
430
|
line-height: 18px;
|
|
427
|
-
text-transform: lowercase;
|
|
428
431
|
}
|
|
429
432
|
.sa-select-field-helper-top {
|
|
430
433
|
font-size: 12px;
|
|
@@ -448,4 +451,4 @@
|
|
|
448
451
|
margin: 0;
|
|
449
452
|
}
|
|
450
453
|
|
|
451
|
-
`;function _(e){const[p,i]=d.useState(e),l=d.useRef(null),r=o=>{l.current&&!l.current.contains(o.target)&&i(!1)};return d.useEffect(()=>(document.addEventListener("click",r,!0),()=>{document.removeEventListener("click",r,!0)}),[]),{ref:l,isComponentVisible:p,setIsComponentVisible:i}}const R=({...e})=>n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",...e,viewBox:"0 0 20 20",fill:"none",children:[n.jsx("circle",{cx:"9.80547",cy:"9.8055",r:"7.49047",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M15.0153 15.4043L17.9519 18.3333",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),nn=({width:e=16})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 16 16",fill:"none",children:n.jsx("path",{d:"M3.5 8L6.5 11L12.5 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),en=d.forwardRef(({positionDropdown:e,dropdownLists:p,isComponentVisible:i,searchAble:l,onSearch:r,value:o,handleChangeValue:E,multiSelect:f,searchValue:W,highlightedIndex:k,footer:j,groupLabel:I,onSelectAll:D},F)=>{const
|
|
454
|
+
`;function _(e){const[p,i]=d.useState(e),l=d.useRef(null),r=o=>{l.current&&!l.current.contains(o.target)&&i(!1)};return d.useEffect(()=>(document.addEventListener("click",r,!0),()=>{document.removeEventListener("click",r,!0)}),[]),{ref:l,isComponentVisible:p,setIsComponentVisible:i}}const R=({...e})=>n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",...e,viewBox:"0 0 20 20",fill:"none",children:[n.jsx("circle",{cx:"9.80547",cy:"9.8055",r:"7.49047",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M15.0153 15.4043L17.9519 18.3333",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),nn=({width:e=16})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 16 16",fill:"none",children:n.jsx("path",{d:"M3.5 8L6.5 11L12.5 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),en=d.forwardRef(({positionDropdown:e,dropdownLists:p,isComponentVisible:i,searchAble:l,onSearch:r,value:o,handleChangeValue:E,multiSelect:f,searchValue:W,highlightedIndex:k,footer:j,groupLabel:I,onSelectAll:D},F)=>{const z=d.useRef([]);d.useEffect(()=>{var a;k>=0&&z.current[k]&&((a=z.current[k])==null||a.scrollIntoView({block:"nearest"}))},[k]);const A=l?n.jsxs("div",{className:"sa-input-dropdown-container-dropdown-search",children:[n.jsx(R,{strokeWidth:2,width:16,style:{flexShrink:0,color:"var(--sa-dropdown-placeholder-subtle)"}}),n.jsx("input",{onChange:a=>{r&&r(a.target.value)},value:W,autoFocus:!0,placeholder:"Search..."})]}):null;return n.jsx(n.Fragment,{children:i?n.jsxs("div",{className:"sa-input-dropdown-lists-container",onClick:a=>a.stopPropagation(),ref:F,children:[e!=="top"&&A,n.jsxs("div",{className:`sa-input-dropdown-item-container ${f?"multi":""}`,children:[I&&n.jsxs("div",{className:"sa-input-dropdown-section-header",children:[n.jsx("span",{className:"sa-input-dropdown-section-label",children:I}),f&&D&&n.jsx("button",{className:"sa-input-dropdown-section-select-all",onClick:a=>{a.stopPropagation(),D()},children:"Select all"})]}),p.map((a,L)=>{const O=!!(o!=null&&o.find(m=>m.value===a.value)),H=!!a.description;return n.jsxs("div",{className:["sa-input-dropdown-item",H?"has-description":"",O?"active":"",L===k?"highlight":"",a.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),ref:m=>{z.current[L]=m},onClick:()=>E(a.label,a.value),children:[f&&n.jsx("div",{className:"sa-input-dropdown-item-check",children:O&&n.jsx(nn,{width:16})}),a.icon&&n.jsx("div",{style:{flexShrink:0,display:"flex"},children:d.cloneElement(a.icon,{width:16})}),n.jsxs("div",{style:{minWidth:0,flex:1},children:[n.jsx("p",{className:["sa-input-dropdown-item-text",a.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),children:a.label}),a.description&&n.jsx("p",{className:["sa-input-dropdown-item-text-description",a.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),children:a.description})]})]},L)})]}),e==="top"&&A,j&&n.jsx("div",{className:"sa-input-dropdown-footer",onClick:a=>a.stopPropagation(),children:j})]}):null})}),on=({children:e,handleChangePosition:p})=>{const i=d.useRef(null);d.useEffect(()=>{var E;const r=()=>{if(i.current){let f=i.current.parentElement;for(;f&&!l(f);)f=f.parentElement;f&&p()}};let o=(E=i.current)==null?void 0:E.parentElement;for(;o&&!l(o);)o=o.parentElement;return o&&o.addEventListener("scroll",r),r(),()=>{o&&o.removeEventListener("scroll",r)}},[]);const l=r=>r&&(r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth);return n.jsx("div",{ref:i,children:e})},U="sa-input-dropdown-styles";(e=>{if(!document.getElementById(U)){const p=document.createElement("style");p.id=U,p.textContent=e,document.head.appendChild(p)}})(Y);const rn=({dropdownLists:e,onChange:p,defaultValue:i,value:l,size:r="md",multiSelect:o,searchAble:E,iconLeft:f,placeholder:W,onSearch:k,error:j,onBlur:I,onFocus:D,disable:F,searchValue:z,variant:A="outline",footer:a,groupLabel:L,onSelectAll:O,fullWidth:H=!0,label:m,labelPosition:tn="outside-top",required:Z,optional:Q,description:N,helperText:C,errorText:w})=>{const M=["sa-select-field",H?"sa-select-field-fullwidth":""].filter(Boolean).join(" "),S=l!==void 0,$=d.useRef(),ln=j||!!w,[c,B]=d.useState(S?l||[]:i||[]),[pn,X]=d.useState(""),[x,q]=d.useState(-1),h=d.useRef(null),{isComponentVisible:u,ref:V,setIsComponentVisible:P}=_(!1),cn=()=>{P(s=>!s)},G=(s,t)=>{if(o)if(c==null?void 0:c.find(b=>b.value===t)){const b=c.filter(hn=>hn.value!==t);S||B(b),p(b)}else{const b=[...c,{label:s,value:t}];S||B(b),p(b)}else{const v=[{label:s,value:t}];S||B(v),p(v),P(!1)}};d.useEffect(()=>{S&&B(l||[])},[l]),d.useEffect(()=>{S||JSON.stringify($.current)===JSON.stringify(i)||($.current=i,B($.current||[]))},[i]);const fn=()=>c.length?o?c==null?void 0:c.map((s,t)=>n.jsxs("div",{className:"sa-input-dropdown-preview-item",children:[n.jsx("p",{style:{minWidth:"max-content"},children:s==null?void 0:s.label}),n.jsx(an,{onClick:v=>{v.stopPropagation(),G(s.label,s.value)}})]},t)):n.jsx("p",{style:{minWidth:"max-content"},children:c==null?void 0:c[0].label}):n.jsx("p",{className:"sa-input-dropdown-placeholder",children:W}),y=()=>{if(V.current&&h.current){const s=window.innerHeight,t=V.current.getBoundingClientRect(),v=h.current.getBoundingClientRect(),b=t.bottom+v.height;h.current.style.left=`${t.left}px`,h.current.style.width=`${t.width}px`,b>=s-10?(h.current.style.top=`${t.top-v.height-5}px`,X("top")):(h.current.style.top=`${t.top+t.height+4}px`,X("bottom"))}};d.useEffect(()=>(window.addEventListener("scroll",y),window.addEventListener("resize",y),()=>{window.removeEventListener("scroll",y),window.removeEventListener("resize",y)}),[]),d.useEffect(()=>{y()},[u]),d.useEffect(()=>{if(!u||!h.current)return;const s=new ResizeObserver(()=>{y()});return s.observe(h.current),()=>s.disconnect()},[u]),d.useEffect(()=>{u||q(-1)},[u]);const wn=s=>{if(!u){(s.key==="ArrowDown"||s.key==="Enter")&&(s.preventDefault(),P(!0));return}switch(s.key){case"ArrowDown":{s.preventDefault();const t=T(e,x,1);t!==-1&&q(t);break}case"ArrowUp":{s.preventDefault();const t=T(e,x,-1);t!==-1&&q(t);break}case"Enter":{s.preventDefault(),x>=0&&e[x]&&!e[x].disable&&G(e[x].label,e[x].value);break}case"Escape":P(!1);break}},J=r==="lg"||r==="xl"?20:16,K=n.jsx(on,{handleChangePosition:y,children:n.jsxs("div",{className:["sa-input-dropdown-container",A,`sa-input-dropdown-size-${r}`,u?"active":"",ln?"error":"",F?"disable":""].filter(Boolean).join(" "),ref:V,onClick:cn,onKeyDown:wn,tabIndex:0,onBlur:I,onFocus:D,children:[n.jsxs("div",{className:"sa-input-dropdown-preview-container",children:[f?d.cloneElement(f,{width:J,style:{color:"var(--sa-dropdown-placeholder)",flexShrink:0}}):null,n.jsx("div",{className:"sa-input-dropdown-container-preview-item",children:fn()}),u?n.jsx(dn,{width:J}):n.jsx(sn,{width:J})]}),n.jsx(en,{dropdownLists:e,handleChangeValue:G,isComponentVisible:u,positionDropdown:pn,searchAble:!!E,value:c,onSearch:k,ref:h,multiSelect:o,searchValue:z,highlightedIndex:x,footer:a,groupLabel:L,onSelectAll:O})]})});return m?tn==="outside-left"?n.jsxs("div",{className:`${M} sa-select-field-left`,children:[n.jsxs("div",{className:"sa-select-field-left-label",children:[n.jsxs("div",{className:"sa-select-field-label-row",children:[n.jsx("span",{className:"sa-select-field-label-text",children:m}),Q&&n.jsx("span",{className:"sa-select-field-optional-badge",children:"Optional"}),Z&&n.jsx("span",{className:"sa-select-field-required",children:"*"})]}),N&&n.jsx("p",{className:"sa-select-field-helper-top",children:N})]}),n.jsxs("div",{className:"sa-select-field-input-wrap",children:[K,C&&!w&&n.jsx("p",{className:"sa-select-field-helper",children:C}),w&&n.jsx("p",{className:"sa-select-field-error-msg",children:w})]})]}):n.jsxs("div",{className:M,children:[n.jsxs("div",{className:"sa-select-field-label-row",children:[n.jsx("span",{className:"sa-select-field-label-text",children:m}),Q&&n.jsx("span",{className:"sa-select-field-optional-badge",children:"Optional"}),Z&&n.jsx("span",{className:"sa-select-field-required",children:"*"})]}),N&&n.jsx("p",{className:"sa-select-field-helper-top",children:N}),K,C&&!w&&n.jsx("p",{className:"sa-select-field-helper",children:C}),w&&n.jsx("p",{className:"sa-select-field-error-msg",children:w})]}):n.jsxs("div",{className:M,children:[N&&n.jsx("p",{className:"sa-select-field-helper-top",children:N}),K,C&&!w&&n.jsx("p",{className:"sa-select-field-helper",children:C}),w&&n.jsx("p",{className:"sa-select-field-error-msg",children:w})]})},T=(e,p,i)=>{const l=e.length;let r=p+i;for(;r>=0&&r<l;){if(!e[r].disable)return r;r+=i}if(i===1){for(let o=0;o<l;o++)if(!e[o].disable)return o}else for(let o=l-1;o>=0;o--)if(!e[o].disable)return o;return-1},an=e=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 18 18",fill:"none",style:{flexShrink:0,cursor:"pointer"},...e,children:n.jsx("path",{d:"M12 6L6 12M6.00001 6L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),sn=({width:e=16})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 16 16",fill:"none",style:{color:"var(--sa-dropdown-placeholder)",flexShrink:0},children:n.jsx("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),dn=({width:e=16})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 16 16",fill:"none",style:{color:"var(--sa-dropdown-placeholder)",flexShrink:0},children:n.jsx("path",{d:"M4 10L8 6L12 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});g.Dropdown=rn,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|