@solibo/solibo-ui 1.0.15 → 1.0.16
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/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index24.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index29.css +1 -1
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index31.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/assets/index35.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index37.css +1 -1
- package/dist/assets/index39.css +1 -1
- package/dist/assets/index4.css +1 -1
- package/dist/assets/index43.css +1 -1
- package/dist/assets/index44.css +1 -1
- package/dist/assets/index45.css +1 -1
- package/dist/assets/index47.css +1 -1
- package/dist/assets/index48.css +1 -1
- package/dist/assets/index49.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index8.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/assets/menu-popover.css +1 -1
- package/dist/components/app-link/index.cjs +1 -1
- package/dist/components/app-link/index.js +8 -8
- package/dist/components/aside/index.cjs +1 -1
- package/dist/components/aside/index.js +11 -11
- package/dist/components/avatar/index.cjs +1 -1
- package/dist/components/avatar/index.cjs.map +1 -1
- package/dist/components/avatar/index.js +58 -58
- package/dist/components/badge/index.cjs +1 -1
- package/dist/components/badge/index.js +27 -27
- package/dist/components/banner/index.cjs +1 -1
- package/dist/components/banner/index.js +14 -14
- package/dist/components/button/index.cjs +1 -1
- package/dist/components/button/index.js +18 -18
- package/dist/components/card/index.cjs +1 -1
- package/dist/components/card/index.js +46 -46
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +7 -7
- package/dist/components/collapsible/index.cjs +1 -1
- package/dist/components/collapsible/index.cjs.map +1 -1
- package/dist/components/collapsible/index.js +18 -37
- package/dist/components/collapsible/index.js.map +1 -1
- package/dist/components/controls/index.cjs +1 -1
- package/dist/components/controls/index.cjs.map +1 -1
- package/dist/components/controls/index.js +110 -90
- package/dist/components/controls/index.js.map +1 -1
- package/dist/components/croppable/index.cjs +1 -1
- package/dist/components/croppable/index.js +181 -181
- package/dist/components/dialog/index.cjs +1 -1
- package/dist/components/dialog/index.js +31 -31
- package/dist/components/dropdown/index.cjs +1 -1
- package/dist/components/dropdown/index.js +80 -80
- package/dist/components/editor/index.cjs +16 -16
- package/dist/components/editor/index.cjs.map +1 -1
- package/dist/components/editor/index.js +196 -196
- package/dist/components/file/index.cjs +1 -1
- package/dist/components/file/index.js +24 -24
- package/dist/components/header/index.cjs +1 -1
- package/dist/components/header/index.cjs.map +1 -1
- package/dist/components/header/index.js +14 -14
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.js +20 -20
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +1 -1
- package/dist/components/list/index.cjs +1 -1
- package/dist/components/list/index.js +24 -24
- package/dist/components/loading/index.cjs +1 -1
- package/dist/components/loading/index.js +11 -11
- package/dist/components/menu/index.cjs +1 -1
- package/dist/components/menu/index.js +1 -1
- package/dist/components/message/index.cjs +1 -1
- package/dist/components/message/index.cjs.map +1 -1
- package/dist/components/message/index.js +26 -26
- package/dist/components/messages/index.cjs +1 -1
- package/dist/components/messages/index.js +20 -20
- package/dist/components/nav/index.cjs +1 -1
- package/dist/components/nav/index.js +12 -12
- package/dist/components/popover/index.cjs +1 -1
- package/dist/components/popover/index.js +38 -38
- package/dist/components/portal/index.cjs +1 -1
- package/dist/components/portal/index.js +7 -7
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.cjs.map +1 -1
- package/dist/components/search/index.js +36 -36
- package/dist/components/sortable/index.cjs +1 -1
- package/dist/components/sortable/index.js +74 -74
- package/dist/components/textarea/index.cjs +1 -1
- package/dist/components/textarea/index.js +15 -15
- package/dist/components/toasts/index.cjs +1 -1
- package/dist/components/toasts/index.js +4 -4
- package/dist/components/toggle/index.cjs +1 -1
- package/dist/components/toggle/index.js +6 -6
- package/dist/components/tooltip/index.cjs +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/{index-DE2nzqL5.js → index-BIV5OwVJ.js} +23 -23
- package/dist/{index-DE2nzqL5.js.map → index-BIV5OwVJ.js.map} +1 -1
- package/dist/index-CQNlYa2P.cjs +2 -0
- package/dist/{index-DF8JisYI.cjs.map → index-CQNlYa2P.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/{menu-popover-jTTxzTGZ.cjs → menu-popover-D1ALaiV5.cjs} +2 -2
- package/dist/{menu-popover-jTTxzTGZ.cjs.map → menu-popover-D1ALaiV5.cjs.map} +1 -1
- package/dist/{menu-popover-SiOOwab-.js → menu-popover-DQHDIw-8.js} +12 -12
- package/dist/{menu-popover-SiOOwab-.js.map → menu-popover-DQHDIw-8.js.map} +1 -1
- package/dist/tokens.json +1 -1
- package/package.json +1 -1
- package/dist/index-DF8JisYI.cjs +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index37.css');const l=require("react/jsx-runtime"),g=require("../../classix-5H4IWnMA.cjs"),a=require("react"),F=require("../button/index.cjs"),de=require("../../icons-DaZGJzI0.cjs"),X=require("../../index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index37.css');const l=require("react/jsx-runtime"),g=require("../../classix-5H4IWnMA.cjs"),a=require("react"),F=require("../button/index.cjs"),de=require("../../icons-DaZGJzI0.cjs"),X=require("../../index-CQNlYa2P.cjs"),pe=require("../list/index.cjs"),E=require("../../index-Dn1v0qm6.cjs");function V(t){return typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(V).join(" "):a.isValidElement(t)?V(t.props.children):""}function fe(t){return a.isValidElement(t)&&t.type==="option"}function me(t){return a.isValidElement(t)&&t.type==="optgroup"}function be(t){return a.isValidElement(t)&&t.type===a.Fragment}function _e(t){return a.isValidElement(t)&&t.type===E.Select}function W(t,i,r=!1){const s=[];return a.Children.forEach(t,n=>{if(be(n))s.push(...W(n.props.children,i,r));else if(fe(n)){const c=V(n.props.children).trim(),f=n.props.value!=null?String(n.props.value):c;s.push({disabled:r||!!n.props.disabled,groupLabel:i,hidden:!!n.props.hidden,isPlaceholder:!!(n.props.hidden&&f===""),label:n.props.children,selected:!!n.props.selected,text:c,value:f})}else me(n)&&s.push(...W(n.props.children,n.props.label,r||!!n.props.disabled))}),s}function he(t){const i=t.trim();if(!i)return null;const s=[.../[*?]/.test(i)?i:`*${i}*`].map(n=>n==="*"?".*":n==="?"?".":n.replace(/[|\\{}()[\]^$+.,]/g,"\\$&")).join("");return new RegExp(`^${s}$`,"i")}function ye(t,i){const r=he(i),s=t.filter(n=>!n.hidden&&!n.isPlaceholder);return r?s.filter(n=>r.test([n.groupLabel,n.text,n.value].filter(Boolean).join(" "))):s}function xe(t,i){return t.find(r=>r.value===i)??t.find(r=>r.isPlaceholder)??t[0]}function ge(t,i,r){var s,n;return i!=null?String(i):r!=null?String(r):((s=t.find(c=>c.selected))==null?void 0:s.value)??((n=t[0])==null?void 0:n.value)??""}function je(t){if(_e(t)){const{children:i,placeholder:r,...s}=t.props;return{children:l.jsxs(l.Fragment,{children:[r&&l.jsx("option",{hidden:!0,value:"",children:r}),i]}),props:s}}return{children:t.props.children,props:t.props}}const ve="_combobox_jkdyb_3",we="_dropdown_jkdyb_27",ke="_empty_jkdyb_30",Se="_group_jkdyb_31",Ne="_placeholder_jkdyb_32",Ce="_filter_jkdyb_40",Ee="_native_jkdyb_52",Ve="_option_jkdyb_62",Le="_options_jkdyb_84",Re="_panel_jkdyb_108",$e="_selected_jkdyb_132",Be="_text_jkdyb_136",Ie="_trigger_jkdyb_144",qe="_minimal_jkdyb_180",Pe="_inline_jkdyb_235",De="_label_jkdyb_267",o={combobox:ve,"combobox-input":"_combobox-input_jkdyb_12",dropdown:we,empty:ke,group:Se,placeholder:Ne,filter:Ce,native:Ee,option:Ve,options:Le,panel:Re,selected:$e,text:Be,trigger:Ie,minimal:qe,inline:Pe,label:De,"inline-field":"_inline-field_jkdyb_273"};function Y(t,i){return{"--icon-svg":de.iconSVG(t).replace("currentColor",i)}}const Fe=({children:t,className:i,combobox:r=!1,createOption:s,emptyLabel:n="No matches found",label:c,renderOption:f,searchPlaceholder:L="Filter",selectedItems:Z,variant:h="default",...ee})=>{const R=je(t),{defaultValue:te,onChange:$,value:B,...ne}=R.props,j=E.sanitizeSelectProps(ne),{className:re,...se}=j,M=a.useRef(null),Q=a.useRef(null),v=a.useId(),z=a.useRef(null),m=a.useRef(null),y=W(R.children),x=B!=null,I=ge(y,B,te),[q,P]=a.useState(()=>I),[u,p]=a.useState(!1),[w,k]=a.useState(""),S=x?String(B):q,O={default:E.resolveColor("--colors-semantic-content-secondary"),white:E.resolveColor("--color-white","white")},T=h==="minimal"?O.white:O.default,N=xe(y,S),le=Y("chevron",T),oe=Y("search",T),A=ye(y,w),b=w.trim(),C=!!(r&&s&&b&&s.isValid(b)),ie=c&&h==="inline"?X.formatInlineLabel(c):c,G=e=>e?(f==null?void 0:f({groupLabel:e.groupLabel,isSelected:e.value===S,label:e.label,text:e.text,value:e.value}))??e.label:"Select an option";a.useEffect(()=>{!x&&!y.some(e=>e.value===q)&&P(I)},[I,q,x,y]),a.useEffect(()=>{var e;if(!u){k("");return}(e=m.current)==null||e.focus()},[u]),a.useEffect(()=>{if(!u)return;const e=d=>{var _;(_=Q.current)!=null&&_.contains(d.target)||p(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[u]);const ae=e=>{x||P(e.target.value),$==null||$(e)},D=()=>{var e;p(!1),r||(e=M.current)==null||e.focus()},K=()=>{var e;k(""),p(!0),(e=m.current)==null||e.focus()},H=()=>{!s||!C||(s.onCreate(b),K())},ce=e=>{var U;x||P(e);const d=z.current;if(!d){D();return}const _=(U=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value"))==null?void 0:U.set;_==null||_.call(d,e),d.dispatchEvent(new Event("change",{bubbles:!0})),r?K():D()},ue=e=>{e.key==="Escape"&&D(),e.key==="Enter"&&e.target===m.current&&C&&(e.preventDefault(),H())},J=l.jsxs("div",{className:g.t(o.dropdown,h==="inline"&&o.inline,h==="minimal"&&o.minimal,i),onKeyDown:ue,ref:Q,...ee,children:[l.jsx("select",{...se,"aria-hidden":"true",className:g.t(o.native,re),onChange:ae,ref:z,tabIndex:-1,value:S,children:R.children}),r?l.jsxs("div",{className:o.combobox,onClick:()=>{var e;return(e=m.current)==null?void 0:e.focus()},children:[Z,l.jsx("input",{"aria-autocomplete":"list","aria-expanded":u,"aria-label":j["aria-label"]??c??L,className:o["combobox-input"],disabled:j.disabled,onChange:e=>{k(e.target.value),p(!0)},onClick:()=>p(!0),onFocus:()=>p(!0),placeholder:L||void 0,ref:m,role:"combobox",type:"text",value:w})]}):l.jsx(F.Button,{"aria-expanded":u,"aria-haspopup":"dialog","aria-labelledby":c?`${v} ${v}-value`:void 0,className:g.t(o.trigger,(N==null?void 0:N.isPlaceholder)&&o.placeholder),"data-open":u?"true":void 0,disabled:j.disabled,onClick:()=>p(e=>!e),ref:M,style:le,variant:"tertiary",children:l.jsx("span",{className:o.text,id:`${v}-value`,children:G(N)})}),u&&l.jsxs("div",{className:o.panel,children:[!r&&l.jsx(X.Input,{"aria-label":"Filter",className:o.filter,icon:"search",onChange:e=>k(e.target.value),placeholder:L,ref:m,style:oe,type:"search",value:w}),l.jsxs(pe.List,{"aria-label":"Dropdown",className:o.options,children:[A.map(e=>{const d=e.value===S;return l.jsx("li",{"data-component":"dropdown",children:l.jsxs(F.Button,{"aria-label":d?`${e.text}, selected`:e.text,className:g.t(o.option,d&&o.selected),disabled:e.disabled,onClick:()=>ce(e.value),variant:"tertiary",children:[l.jsx("span",{className:o.text,children:G(e)}),e.groupLabel&&l.jsx("small",{className:o.group,children:e.groupLabel})]})},`${e.groupLabel??"root"}-${e.value}`)}),C&&s&&l.jsx("li",{children:l.jsx(F.Button,{"aria-label":V(s.render(b))||b,className:o.option,onClick:H,variant:"tertiary",children:l.jsx("span",{className:o.text,children:s.render(b)})})}),A.length===0&&!C&&l.jsx("li",{className:o.empty,children:n})]})]})]});return c?l.jsxs("div",{className:g.t(o.label,h==="inline"&&o["inline-field"]),"data-component":"dropdown",children:[l.jsx("span",{id:v,children:ie}),J]}):J};exports.Dropdown=Fe;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { jsxs as p, Fragment as me, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { t as v } from "../../classix-DG18itHa.js";
|
|
3
|
-
import be, { Children as he, isValidElement as x, useRef as
|
|
4
|
-
import { Button as
|
|
3
|
+
import be, { Children as he, isValidElement as x, useRef as V, useId as _e, useState as Q, useEffect as z } from "react";
|
|
4
|
+
import { Button as M } from "../button/index.js";
|
|
5
5
|
import { i as ye } from "../../icons-Dj0vEOCB.js";
|
|
6
|
-
import { f as ge, I as ve } from "../../index-
|
|
6
|
+
import { f as ge, I as ve } from "../../index-BIV5OwVJ.js";
|
|
7
7
|
import { List as xe } from "../list/index.js";
|
|
8
|
-
import { S as
|
|
9
|
-
import '../../assets/index37.css';function
|
|
10
|
-
return typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(
|
|
8
|
+
import { S as ke, s as we, r as ee } from "../../index-CgA0NUMD.js";
|
|
9
|
+
import '../../assets/index37.css';function I(t) {
|
|
10
|
+
return typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(I).join(" ") : x(t) ? I(t.props.children) : "";
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function je(t) {
|
|
13
13
|
return x(t) && t.type === "option";
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function Ne(t) {
|
|
16
16
|
return x(t) && t.type === "optgroup";
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function Se(t) {
|
|
19
19
|
return x(t) && t.type === be.Fragment;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return x(t) && t.type ===
|
|
21
|
+
function Ce(t) {
|
|
22
|
+
return x(t) && t.type === ke;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function A(t, s, r = !1) {
|
|
25
25
|
const l = [];
|
|
26
26
|
return he.forEach(t, (n) => {
|
|
27
|
-
if (
|
|
28
|
-
l.push(...
|
|
29
|
-
else if (
|
|
30
|
-
const a =
|
|
27
|
+
if (Se(n))
|
|
28
|
+
l.push(...A(n.props.children, s, r));
|
|
29
|
+
else if (je(n)) {
|
|
30
|
+
const a = I(n.props.children).trim(), f = n.props.value != null ? String(n.props.value) : a;
|
|
31
31
|
l.push({
|
|
32
32
|
disabled: r || !!n.props.disabled,
|
|
33
33
|
groupLabel: s,
|
|
@@ -38,28 +38,28 @@ function M(t, s, r = !1) {
|
|
|
38
38
|
text: a,
|
|
39
39
|
value: f
|
|
40
40
|
});
|
|
41
|
-
} else
|
|
41
|
+
} else Ne(n) && l.push(...A(n.props.children, n.props.label, r || !!n.props.disabled));
|
|
42
42
|
}), l;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Ee(t) {
|
|
45
45
|
const s = t.trim();
|
|
46
46
|
if (!s) return null;
|
|
47
47
|
const l = [.../[*?]/.test(s) ? s : `*${s}*`].map((n) => n === "*" ? ".*" : n === "?" ? "." : n.replace(/[|\\{}()[\]^$+.,]/g, "\\$&")).join("");
|
|
48
48
|
return new RegExp(`^${l}$`, "i");
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
const r =
|
|
50
|
+
function Ve(t, s) {
|
|
51
|
+
const r = Ee(s), l = t.filter((n) => !n.hidden && !n.isPlaceholder);
|
|
52
52
|
return r ? l.filter((n) => r.test([n.groupLabel, n.text, n.value].filter(Boolean).join(" "))) : l;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function Ie(t, s) {
|
|
55
55
|
return t.find((r) => r.value === s) ?? t.find((r) => r.isPlaceholder) ?? t[0];
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function Le(t, s, r) {
|
|
58
58
|
var l, n;
|
|
59
59
|
return s != null ? String(s) : r != null ? String(r) : ((l = t.find((a) => a.selected)) == null ? void 0 : l.value) ?? ((n = t[0]) == null ? void 0 : n.value) ?? "";
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
if (
|
|
61
|
+
function $e(t) {
|
|
62
|
+
if (Ce(t)) {
|
|
63
63
|
const {
|
|
64
64
|
children: s,
|
|
65
65
|
placeholder: r,
|
|
@@ -78,25 +78,25 @@ function Be(t) {
|
|
|
78
78
|
props: t.props
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
combobox:
|
|
83
|
-
"combobox-input": "_combobox-
|
|
84
|
-
dropdown:
|
|
81
|
+
const Be = "_combobox_jkdyb_3", Pe = "_dropdown_jkdyb_27", De = "_empty_jkdyb_30", Re = "_group_jkdyb_31", Fe = "_placeholder_jkdyb_32", We = "_filter_jkdyb_40", Qe = "_native_jkdyb_52", ze = "_option_jkdyb_62", Me = "_options_jkdyb_84", Ae = "_panel_jkdyb_108", Ge = "_selected_jkdyb_132", Ke = "_text_jkdyb_136", Oe = "_trigger_jkdyb_144", Te = "_minimal_jkdyb_180", qe = "_inline_jkdyb_235", He = "_label_jkdyb_267", o = {
|
|
82
|
+
combobox: Be,
|
|
83
|
+
"combobox-input": "_combobox-input_jkdyb_12",
|
|
84
|
+
dropdown: Pe,
|
|
85
85
|
empty: De,
|
|
86
86
|
group: Re,
|
|
87
|
-
placeholder:
|
|
88
|
-
filter:
|
|
89
|
-
native:
|
|
90
|
-
option:
|
|
91
|
-
options:
|
|
92
|
-
panel:
|
|
93
|
-
selected:
|
|
94
|
-
text:
|
|
95
|
-
trigger:
|
|
96
|
-
minimal:
|
|
97
|
-
inline:
|
|
87
|
+
placeholder: Fe,
|
|
88
|
+
filter: We,
|
|
89
|
+
native: Qe,
|
|
90
|
+
option: ze,
|
|
91
|
+
options: Me,
|
|
92
|
+
panel: Ae,
|
|
93
|
+
selected: Ge,
|
|
94
|
+
text: Ke,
|
|
95
|
+
trigger: Oe,
|
|
96
|
+
minimal: Te,
|
|
97
|
+
inline: qe,
|
|
98
98
|
label: He,
|
|
99
|
-
"inline-field": "_inline-
|
|
99
|
+
"inline-field": "_inline-field_jkdyb_273"
|
|
100
100
|
};
|
|
101
101
|
function te(t, s) {
|
|
102
102
|
return {
|
|
@@ -111,101 +111,101 @@ const rt = ({
|
|
|
111
111
|
emptyLabel: n = "No matches found",
|
|
112
112
|
label: a,
|
|
113
113
|
renderOption: f,
|
|
114
|
-
searchPlaceholder:
|
|
114
|
+
searchPlaceholder: L = "Filter",
|
|
115
115
|
selectedItems: ne,
|
|
116
116
|
variant: _ = "default",
|
|
117
117
|
...re
|
|
118
118
|
}) => {
|
|
119
|
-
const
|
|
119
|
+
const $ = $e(t), {
|
|
120
120
|
defaultValue: le,
|
|
121
|
-
onChange:
|
|
122
|
-
value:
|
|
121
|
+
onChange: B,
|
|
122
|
+
value: P,
|
|
123
123
|
...oe
|
|
124
|
-
} =
|
|
124
|
+
} = $.props, k = we(oe), {
|
|
125
125
|
className: se,
|
|
126
126
|
...ie
|
|
127
|
-
} =
|
|
127
|
+
} = k, G = V(null), K = V(null), w = _e(), O = V(null), m = V(null), y = A($.children), g = P != null, D = Le(y, P, le), [R, F] = Q(() => D), [c, u] = Q(!1), [j, N] = Q(""), S = g ? String(P) : R, T = {
|
|
128
128
|
default: ee("--colors-semantic-content-secondary"),
|
|
129
129
|
white: ee("--color-white", "white")
|
|
130
|
-
},
|
|
130
|
+
}, q = _ === "minimal" ? T.white : T.default, C = Ie(y, S), ae = te("chevron", q), ce = te("search", q), H = Ve(y, j), b = j.trim(), E = !!(r && l && b && l.isValid(b)), de = a && _ === "inline" ? ge(a) : a, J = (e) => e ? (f == null ? void 0 : f({
|
|
131
131
|
groupLabel: e.groupLabel,
|
|
132
|
-
isSelected: e.value ===
|
|
132
|
+
isSelected: e.value === S,
|
|
133
133
|
label: e.label,
|
|
134
134
|
text: e.text,
|
|
135
135
|
value: e.value
|
|
136
136
|
})) ?? e.label : "Select an option";
|
|
137
|
-
|
|
138
|
-
!g && !y.some((e) => e.value === R) &&
|
|
139
|
-
}, [D, R, g, y]),
|
|
137
|
+
z(() => {
|
|
138
|
+
!g && !y.some((e) => e.value === R) && F(D);
|
|
139
|
+
}, [D, R, g, y]), z(() => {
|
|
140
140
|
var e;
|
|
141
141
|
if (!c) {
|
|
142
|
-
|
|
142
|
+
N("");
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
(e = m.current) == null || e.focus();
|
|
146
|
-
}, [c]),
|
|
146
|
+
}, [c]), z(() => {
|
|
147
147
|
if (!c)
|
|
148
148
|
return;
|
|
149
|
-
const e = (
|
|
149
|
+
const e = (d) => {
|
|
150
150
|
var h;
|
|
151
|
-
(h =
|
|
151
|
+
(h = K.current) != null && h.contains(d.target) || u(!1);
|
|
152
152
|
};
|
|
153
153
|
return document.addEventListener("mousedown", e), () => {
|
|
154
154
|
document.removeEventListener("mousedown", e);
|
|
155
155
|
};
|
|
156
156
|
}, [c]);
|
|
157
|
-
const
|
|
158
|
-
g ||
|
|
159
|
-
},
|
|
157
|
+
const ue = (e) => {
|
|
158
|
+
g || F(e.target.value), B == null || B(e);
|
|
159
|
+
}, W = () => {
|
|
160
160
|
var e;
|
|
161
|
-
|
|
161
|
+
u(!1), r || (e = G.current) == null || e.focus();
|
|
162
162
|
}, U = () => {
|
|
163
163
|
var e;
|
|
164
|
-
|
|
164
|
+
N(""), u(!0), (e = m.current) == null || e.focus();
|
|
165
165
|
}, X = () => {
|
|
166
|
-
!l || !
|
|
166
|
+
!l || !E || (l.onCreate(b), U());
|
|
167
167
|
}, pe = (e) => {
|
|
168
168
|
var Z;
|
|
169
|
-
g ||
|
|
170
|
-
const
|
|
171
|
-
if (!
|
|
172
|
-
|
|
169
|
+
g || F(e);
|
|
170
|
+
const d = O.current;
|
|
171
|
+
if (!d) {
|
|
172
|
+
W();
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
175
175
|
const h = (Z = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value")) == null ? void 0 : Z.set;
|
|
176
|
-
h == null || h.call(
|
|
176
|
+
h == null || h.call(d, e), d.dispatchEvent(new Event("change", {
|
|
177
177
|
bubbles: !0
|
|
178
|
-
})), r ? U() :
|
|
178
|
+
})), r ? U() : W();
|
|
179
179
|
}, fe = (e) => {
|
|
180
|
-
e.key === "Escape" &&
|
|
181
|
-
}, Y = /* @__PURE__ */ p("div", { className: v(o.dropdown, _ === "inline" && o.inline, _ === "minimal" && o.minimal, s), onKeyDown: fe, ref:
|
|
182
|
-
/* @__PURE__ */ i("select", { ...ie, "aria-hidden": "true", className: v(o.native, se), onChange:
|
|
180
|
+
e.key === "Escape" && W(), e.key === "Enter" && e.target === m.current && E && (e.preventDefault(), X());
|
|
181
|
+
}, Y = /* @__PURE__ */ p("div", { className: v(o.dropdown, _ === "inline" && o.inline, _ === "minimal" && o.minimal, s), onKeyDown: fe, ref: K, ...re, children: [
|
|
182
|
+
/* @__PURE__ */ i("select", { ...ie, "aria-hidden": "true", className: v(o.native, se), onChange: ue, ref: O, tabIndex: -1, value: S, children: $.children }),
|
|
183
183
|
r ? /* @__PURE__ */ p("div", { className: o.combobox, onClick: () => {
|
|
184
184
|
var e;
|
|
185
185
|
return (e = m.current) == null ? void 0 : e.focus();
|
|
186
186
|
}, children: [
|
|
187
187
|
ne,
|
|
188
|
-
/* @__PURE__ */ i("input", { "aria-autocomplete": "list", "aria-expanded": c, "aria-label":
|
|
189
|
-
|
|
190
|
-
}, onClick: () =>
|
|
191
|
-
] }) : /* @__PURE__ */ i(
|
|
188
|
+
/* @__PURE__ */ i("input", { "aria-autocomplete": "list", "aria-expanded": c, "aria-label": k["aria-label"] ?? a ?? L, className: o["combobox-input"], disabled: k.disabled, onChange: (e) => {
|
|
189
|
+
N(e.target.value), u(!0);
|
|
190
|
+
}, onClick: () => u(!0), onFocus: () => u(!0), placeholder: L || void 0, ref: m, role: "combobox", type: "text", value: j })
|
|
191
|
+
] }) : /* @__PURE__ */ i(M, { "aria-expanded": c, "aria-haspopup": "dialog", "aria-labelledby": a ? `${w} ${w}-value` : void 0, className: v(o.trigger, (C == null ? void 0 : C.isPlaceholder) && o.placeholder), "data-open": c ? "true" : void 0, disabled: k.disabled, onClick: () => u((e) => !e), ref: G, style: ae, variant: "tertiary", children: /* @__PURE__ */ i("span", { className: o.text, id: `${w}-value`, children: J(C) }) }),
|
|
192
192
|
c && /* @__PURE__ */ p("div", { className: o.panel, children: [
|
|
193
|
-
!r && /* @__PURE__ */ i(ve, { "aria-label": "Filter", className: o.filter, icon: "search", onChange: (e) =>
|
|
193
|
+
!r && /* @__PURE__ */ i(ve, { "aria-label": "Filter", className: o.filter, icon: "search", onChange: (e) => N(e.target.value), placeholder: L, ref: m, style: ce, type: "search", value: j }),
|
|
194
194
|
/* @__PURE__ */ p(xe, { "aria-label": "Dropdown", className: o.options, children: [
|
|
195
195
|
H.map((e) => {
|
|
196
|
-
const
|
|
197
|
-
return /* @__PURE__ */ i("li", { "data-component": "dropdown", children: /* @__PURE__ */ p(
|
|
196
|
+
const d = e.value === S;
|
|
197
|
+
return /* @__PURE__ */ i("li", { "data-component": "dropdown", children: /* @__PURE__ */ p(M, { "aria-label": d ? `${e.text}, selected` : e.text, className: v(o.option, d && o.selected), disabled: e.disabled, onClick: () => pe(e.value), variant: "tertiary", children: [
|
|
198
198
|
/* @__PURE__ */ i("span", { className: o.text, children: J(e) }),
|
|
199
199
|
e.groupLabel && /* @__PURE__ */ i("small", { className: o.group, children: e.groupLabel })
|
|
200
200
|
] }) }, `${e.groupLabel ?? "root"}-${e.value}`);
|
|
201
201
|
}),
|
|
202
|
-
|
|
203
|
-
H.length === 0 && !
|
|
202
|
+
E && l && /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(M, { "aria-label": I(l.render(b)) || b, className: o.option, onClick: X, variant: "tertiary", children: /* @__PURE__ */ i("span", { className: o.text, children: l.render(b) }) }) }),
|
|
203
|
+
H.length === 0 && !E && /* @__PURE__ */ i("li", { className: o.empty, children: n })
|
|
204
204
|
] })
|
|
205
205
|
] })
|
|
206
206
|
] });
|
|
207
207
|
return a ? /* @__PURE__ */ p("div", { className: v(o.label, _ === "inline" && o["inline-field"]), "data-component": "dropdown", children: [
|
|
208
|
-
/* @__PURE__ */ i("span", { id:
|
|
208
|
+
/* @__PURE__ */ i("span", { id: w, children: de }),
|
|
209
209
|
Y
|
|
210
210
|
] }) : Y;
|
|
211
211
|
};
|