@solibo/solibo-ui 2.2.15 → 2.2.17
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/index13.css +1 -1
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index41.css +1 -1
- package/dist/assets/index42.css +1 -1
- package/dist/assets/index53.css +1 -1
- package/dist/assets/index54.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/components/card/index.cjs +1 -1
- package/dist/components/card/index.js +50 -50
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +24 -23
- package/dist/components/dropdown/index.cjs +1 -1
- package/dist/components/dropdown/index.js +211 -190
- package/dist/components/dropzone/index.cjs +1 -1
- package/dist/components/dropzone/index.js +84 -56
- package/dist/components/editor/index.cjs +1 -1
- package/dist/components/editor/index.js +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +1 -1
- package/dist/components/label/index.cjs +1 -1
- package/dist/components/label/index.js +16 -14
- package/dist/components/list/index.cjs +1 -1
- package/dist/components/list/index.js +20 -20
- package/dist/components/page-layout/index.cjs +1 -1
- package/dist/components/page-layout/index.js +13 -13
- package/dist/components/radio/index.cjs +1 -1
- package/dist/components/radio/index.js +13 -13
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.js +78 -70
- package/dist/components/textarea/index.cjs +1 -1
- package/dist/components/textarea/index.js +39 -32
- package/dist/components/toggle/index.cjs +1 -1
- package/dist/components/toggle/index.js +10 -10
- package/dist/index-6TyCExT0.js +87 -0
- package/dist/index-DEQcFR32.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +34 -9
- package/dist/index.js +1 -1
- package/dist/tokens.json +1 -1
- package/package.json +1 -1
- package/dist/index-Bre56YYa.js +0 -90
- package/dist/index-CHJNMNDr.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index41.css');const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index41.css');const n=require("react/jsx-runtime"),V=require("classix"),s=require("react"),B=require("../button/index.cjs"),Ze=require("../form/index.cjs"),et=require("../../icons-BIdcCH-v.cjs"),we=require("../../index-DEQcFR32.cjs"),tt=require("../label/index.cjs"),nt=require("../list/index.cjs"),Ee=require("../loading/index.cjs"),$=require("../../index-BQoXmNo3.cjs");function G(t){return typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(G).join(" "):s.isValidElement(t)?G(t.props.children):""}function st(t){return s.isValidElement(t)&&t.type==="option"}function it(t){return s.isValidElement(t)&&t.type==="optgroup"}function lt(t){return s.isValidElement(t)&&t.type===s.Fragment}function rt(t){return s.isValidElement(t)&&t.type===$.Select}function le(t,o,r=!1){const a=[];return s.Children.forEach(t,i=>{if(lt(i))a.push(...le(i.props.children,o,r));else if(st(i)){const x=G(i.props.children).trim(),k=i.props.value!=null?String(i.props.value):x;a.push({disabled:r||!!i.props.disabled,groupLabel:o,hidden:!!i.props.hidden,isPlaceholder:!!(i.props.hidden&&k===""),label:i.props.children,selected:!!i.props.selected,text:x,value:k})}else it(i)&&a.push(...le(i.props.children,i.props.label,r||!!i.props.disabled))}),a}function ot(t){const o=t.trim();if(!o)return null;const a=[.../[*?]/.test(o)?o:`*${o}*`].map(i=>i==="*"?".*":i==="?"?".":i.replace(/[|\\{}()[\]^$+.,]/g,"\\$&")).join("");return new RegExp(`^${a}$`,"i")}function at(t,o){const r=ot(o),a=t.filter(i=>!i.hidden&&!i.isPlaceholder);return r?a.filter(i=>r.test([i.groupLabel,i.text,i.value].filter(Boolean).join(" "))):a}function ct(t,o){return t.find(r=>r.value===o)??t.find(r=>r.isPlaceholder)??t[0]}function ut(t,o,r){var a,i;return o!=null?String(o):r!=null?String(r):((a=t.find(x=>x.selected))==null?void 0:a.value)??((i=t[0])==null?void 0:i.value)??""}function dt(t){if(rt(t)){const{children:o,placeholder:r,...a}=t.props;return{children:n.jsxs(n.Fragment,{children:[r&&n.jsx("option",{hidden:!0,value:"",children:r}),o]}),props:a}}return{children:t.props.children,props:t.props}}const ft="_combobox_7iy0q_3",pt="_dropdown_7iy0q_21",mt="_empty_7iy0q_29",_t="_group_7iy0q_30",bt="_placeholder_7iy0q_31",yt="_filter_7iy0q_39",vt="_native_7iy0q_71",xt="_option_7iy0q_81",ht="_options_7iy0q_107",jt="_panel_7iy0q_117",qt="_selected_7iy0q_142",gt="_text_7iy0q_146",wt="_trigger_7iy0q_154",Et="_minimal_7iy0q_199",St="_inline_7iy0q_259",Rt="_field_7iy0q_293",Nt="_label_7iy0q_297",l={combobox:ft,"combobox-input":"_combobox-input_7iy0q_12",dropdown:pt,empty:mt,group:_t,placeholder:bt,filter:yt,"filter-controls":"_filter-controls_7iy0q_46","loading-status":"_loading-status_7iy0q_57",native:vt,option:xt,options:ht,panel:jt,selected:qt,text:gt,trigger:wt,minimal:Et,inline:St,field:Rt,label:Nt,"inline-field":"_inline-field_7iy0q_302"};function Se(t,o){return{"--icon-svg":et.iconSVG(t,o)}}const It=({children:t,className:o,combobox:r=!1,description:a,errorMessage:i,invalid:x=!1,searchable:k,createOption:h,emptyLabel:Re="No matches found",errorLabel:m,onRetry:re,retryLabel:Ne="Retry",label:y,filterOptions:Ie=!0,hasNextPage:b=!1,loading:d=!1,loadingLabel:oe="Loading",loadMoreLabel:Ce="Load more",onLoadMore:R,onOpenChange:D,onSearchChange:F,searchValue:M,renderOption:A,searchPlaceholder:L="Filter",selectedItems:Ve,variant:j="default",...Be})=>{const O=dt(t),{defaultValue:$e,onChange:T,value:K,...ke}=O.props,c=$.sanitizeSelectProps(ke),{className:De,...Fe}=c,ae=s.useRef(null),ce=s.useRef(null),q=s.useId(),H=x&&i?`${q}-error`:void 0,ue=a?`${q}-description`:void 0,de=[c["aria-describedby"],ue,H].filter(Boolean).join(" ")||void 0,fe=x?!0:c["aria-invalid"],pe=s.useRef(null),g=s.useRef(null),P=s.useRef(null),me=s.useRef(null),J=s.useRef(!1),U=s.useRef(!1),X=s.useRef(R),_e=!!R,w=le(O.children),N=K!=null,Y=ut(w,K,$e),[Z,ee]=s.useState(()=>Y),[u,We]=s.useState(!1),[ze,be]=s.useState(!1),[Qe,Ge]=s.useState(null),[Me,Ae]=s.useState(""),v=M??Me,te=w.filter(e=>!e.hidden).length,Le=Qe??(d||!!m||b||te>8),E=k??(Le||ze||v.length>0),I=s.useCallback(e=>{M===void 0&&Ae(e),F==null||F(e)},[F,M]),_=s.useCallback(e=>{J.current===e||e&&c.disabled||(J.current=e,We(e),D==null||D(e),e||I(""))},[D,c.disabled,I]),W=N?String(K):Z,ye={default:$.resolveColor("--colors-semantic-content-secondary"),white:$.resolveColor("--color-white","white")},ve=c.disabled?$.resolveColor("--colors-semantic-content-disabled"):j==="minimal"?ye.white:ye.default,z=ct(w,W),Oe=Se("CaretDown",ve),Te=Se("MagnifyingGlass",ve),ne=at(w,Ie?v:""),S=v.trim(),Q=!!(r&&h&&S&&h.isValid(S)),Ke=y&&j==="inline"?we.formatInlineLabel(y):y,xe=e=>e?(A==null?void 0:A({groupLabel:e.groupLabel,isSelected:e.value===W,label:e.label,text:e.text,value:e.value}))??e.label:"Select an option";s.useEffect(()=>{u&&!v&&!d&&!m&&Ge(b||te>8)},[u,v,d,m,b,te]),s.useEffect(()=>{!N&&!w.some(e=>e.value===Z)&&ee(Y)},[Y,Z,N,w]),s.useEffect(()=>{u?E&&be(!0):be(!1)},[u,E]),s.useEffect(()=>{var e,f,p;u&&(r||E?(e=g.current)==null||e.focus():(p=(f=P.current)==null?void 0:f.querySelector("button:not(:disabled)"))==null||p.focus())},[u,r,E]),s.useEffect(()=>{if(!u)return;const e=f=>{var p;(p=ce.current)!=null&&p.contains(f.target)||_(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[_,u]),s.useEffect(()=>{X.current=R},[R]),s.useEffect(()=>{c.disabled&&_(!1)},[_,c.disabled]);const se=s.useCallback(()=>{!J.current||c.disabled||d||m||!b||!X.current||U.current||(U.current=!0,X.current())},[m,b,d,c.disabled]);s.useEffect(()=>{if(U.current=!1,!u||c.disabled||d||m||!b||!_e)return;const e=me.current,f=P.current;if(!e||!f||typeof IntersectionObserver>"u")return;let p=!0;const C=new IntersectionObserver(Xe=>{p&&Xe.some(Ye=>Ye.isIntersecting)&&se()},{root:f});return C.observe(e),()=>{p=!1,C.disconnect()}},[u,d,m,b,_e,se,ne.length,v,c.disabled]);const He=e=>{N||ee(e.target.value),T==null||T(e)},ie=()=>{var e;_(!1),r||(e=ae.current)==null||e.focus()},he=()=>{var e;I(""),_(!0),(e=g.current)==null||e.focus()},je=()=>{!h||!Q||(h.onCreate(S),he())},Pe=e=>{var C;N||ee(e);const f=pe.current;if(!f){ie();return}const p=(C=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value"))==null?void 0:C.set;p==null||p.call(f,e),f.dispatchEvent(new Event("change",{bubbles:!0})),r?he():ie()},Je=e=>{e.key==="Escape"&&ie(),e.key==="Enter"&&e.target===g.current&&Q&&(e.preventDefault(),je())},qe=n.jsx("div",{"aria-hidden":!d,"aria-label":oe,className:l["loading-status"],role:"status",children:d&&n.jsx(Ee.Loading,{size:"small"})}),ge=n.jsxs("div",{className:V(l.dropdown,j==="inline"&&l.inline,j==="minimal"&&l.minimal,o),onKeyDown:Je,ref:ce,...Be,children:[n.jsx("select",{...Fe,"aria-hidden":"true",className:V(l.native,De),onChange:He,ref:pe,tabIndex:-1,value:W,children:O.children}),r?n.jsxs("div",{className:l.combobox,onClick:()=>{var e;return(e=g.current)==null?void 0:e.focus()},children:[Ve,n.jsx("input",{"aria-describedby":de,"aria-invalid":fe,"aria-autocomplete":"list","aria-expanded":u,"aria-label":c["aria-label"]??y??L,className:l["combobox-input"],disabled:c.disabled,onChange:e=>{I(e.target.value),_(!0)},onClick:()=>_(!0),onFocus:()=>_(!0),placeholder:L||void 0,ref:g,role:"combobox",type:"text",value:v}),qe]}):n.jsx(B.Button,{"aria-describedby":de,"aria-invalid":fe,"aria-label":y?void 0:c["aria-label"],"aria-expanded":u,"aria-haspopup":"dialog","aria-labelledby":y?`${q} ${q}-value`:void 0,className:V(l.trigger,(z==null?void 0:z.isPlaceholder)&&l.placeholder),"data-open":u?"true":void 0,disabled:c.disabled,onClick:()=>_(!u),ref:ae,style:Oe,variant:"simple",children:n.jsx("span",{className:l.text,id:`${q}-value`,children:xe(z)})}),u&&n.jsxs("div",{className:l.panel,children:[!r&&E&&n.jsxs("div",{className:l["filter-controls"],children:[n.jsx(we.Input,{"aria-label":"Filter",className:l.filter,icon:"MagnifyingGlass",onChange:e=>I(e.target.value),placeholder:L,ref:g,style:Te,type:"search",value:v}),qe]}),n.jsxs(nt.List,{"aria-label":"Dropdown","aria-busy":d||void 0,className:l.options,ref:P,children:[ne.map(e=>{const f=e.value===W;return n.jsx("li",{"data-component":"dropdown",children:n.jsxs(B.Button,{"aria-label":f?`${e.text}, selected`:e.text,className:V(l.option,f&&l.selected),disabled:e.disabled,onClick:()=>Pe(e.value),variant:"tertiary",children:[n.jsx("span",{className:l.text,children:xe(e)}),e.groupLabel&&n.jsx("small",{className:l.group,children:e.groupLabel})]})},`${e.groupLabel??"root"}-${e.value}`)}),Q&&h&&n.jsx("li",{children:n.jsx(B.Button,{"aria-label":G(h.render(S))||S,className:l.option,onClick:je,variant:"tertiary",children:n.jsx("span",{className:l.text,children:h.render(S)})})}),ne.length===0&&!Q&&!d&&!m&&!b&&n.jsx("li",{className:l.empty,children:Re}),m&&n.jsxs("li",{className:l.empty,children:[n.jsx("span",{role:"alert",children:m}),re&&n.jsx(B.Button,{disabled:d,onClick:re,variant:"tertiary",children:Ne})]}),d&&!r&&!E&&n.jsx("li",{"aria-label":oe,className:l.empty,role:"status",children:n.jsx(Ee.Loading,{size:"small"})}),b&&R&&!m&&n.jsx("li",{ref:me,children:n.jsx(B.Button,{className:l.option,disabled:d,onClick:se,variant:"tertiary",children:Ce})})]})]})]}),Ue=y||a?n.jsxs("div",{className:V(l.label,j==="inline"&&l["inline-field"]),children:[n.jsx(tt.Label,{label:Ke,labelId:y?q:void 0,description:a,descriptionId:ue,inline:j==="inline"}),ge]}):ge;return n.jsxs("div",{className:l.field,"data-component":"dropdown",children:[Ue,H&&n.jsx(Ze.FieldError,{errorId:H,errorMessage:i})]})};exports.Dropdown=It;
|
|
@@ -1,77 +1,79 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Button as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
|
|
1
|
+
import { jsxs as b, Fragment as it, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import k from "classix";
|
|
3
|
+
import rt, { Children as lt, isValidElement as F, useRef as _, useId as st, useState as D, useCallback as oe, useEffect as g } from "react";
|
|
4
|
+
import { Button as j } from "../button/index.js";
|
|
5
|
+
import { FieldError as at } from "../form/index.js";
|
|
6
|
+
import { i as ot } from "../../icons-DVeBguFb.js";
|
|
7
|
+
import { f as ct, I as dt } from "../../index-6TyCExT0.js";
|
|
8
|
+
import { Label as ut } from "../label/index.js";
|
|
9
|
+
import { List as ft } from "../list/index.js";
|
|
10
|
+
import { Loading as Re } from "../loading/index.js";
|
|
11
|
+
import { S as pt, s as mt, r as ce } from "../../index-GPsHvb4d.js";
|
|
12
|
+
import '../../assets/index41.css';function K(t) {
|
|
13
|
+
return typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(K).join(" ") : F(t) ? K(t.props.children) : "";
|
|
12
14
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
15
|
+
function bt(t) {
|
|
16
|
+
return F(t) && t.type === "option";
|
|
15
17
|
}
|
|
16
|
-
function
|
|
17
|
-
return
|
|
18
|
+
function yt(t) {
|
|
19
|
+
return F(t) && t.type === "optgroup";
|
|
18
20
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
21
|
+
function _t(t) {
|
|
22
|
+
return F(t) && t.type === rt.Fragment;
|
|
21
23
|
}
|
|
22
|
-
function
|
|
23
|
-
return
|
|
24
|
+
function vt(t) {
|
|
25
|
+
return F(t) && t.type === pt;
|
|
24
26
|
}
|
|
25
|
-
function
|
|
26
|
-
const
|
|
27
|
-
return
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
else if (
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
disabled:
|
|
34
|
-
groupLabel:
|
|
27
|
+
function de(t, s, r = !1) {
|
|
28
|
+
const a = [];
|
|
29
|
+
return lt.forEach(t, (n) => {
|
|
30
|
+
if (_t(n))
|
|
31
|
+
a.push(...de(n.props.children, s, r));
|
|
32
|
+
else if (bt(n)) {
|
|
33
|
+
const w = K(n.props.children).trim(), W = n.props.value != null ? String(n.props.value) : w;
|
|
34
|
+
a.push({
|
|
35
|
+
disabled: r || !!n.props.disabled,
|
|
36
|
+
groupLabel: s,
|
|
35
37
|
hidden: !!n.props.hidden,
|
|
36
|
-
isPlaceholder: !!(n.props.hidden &&
|
|
38
|
+
isPlaceholder: !!(n.props.hidden && W === ""),
|
|
37
39
|
label: n.props.children,
|
|
38
40
|
selected: !!n.props.selected,
|
|
39
|
-
text:
|
|
40
|
-
value:
|
|
41
|
+
text: w,
|
|
42
|
+
value: W
|
|
41
43
|
});
|
|
42
|
-
} else
|
|
43
|
-
}),
|
|
44
|
+
} else yt(n) && a.push(...de(n.props.children, n.props.label, r || !!n.props.disabled));
|
|
45
|
+
}), a;
|
|
44
46
|
}
|
|
45
|
-
function
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
48
|
-
const
|
|
49
|
-
return new RegExp(`^${
|
|
47
|
+
function ht(t) {
|
|
48
|
+
const s = t.trim();
|
|
49
|
+
if (!s) return null;
|
|
50
|
+
const a = [.../[*?]/.test(s) ? s : `*${s}*`].map((n) => n === "*" ? ".*" : n === "?" ? "." : n.replace(/[|\\{}()[\]^$+.,]/g, "\\$&")).join("");
|
|
51
|
+
return new RegExp(`^${a}$`, "i");
|
|
50
52
|
}
|
|
51
|
-
function
|
|
52
|
-
const
|
|
53
|
-
return
|
|
53
|
+
function gt(t, s) {
|
|
54
|
+
const r = ht(s), a = t.filter((n) => !n.hidden && !n.isPlaceholder);
|
|
55
|
+
return r ? a.filter((n) => r.test([n.groupLabel, n.text, n.value].filter(Boolean).join(" "))) : a;
|
|
54
56
|
}
|
|
55
|
-
function
|
|
56
|
-
return t.find((
|
|
57
|
+
function wt(t, s) {
|
|
58
|
+
return t.find((r) => r.value === s) ?? t.find((r) => r.isPlaceholder) ?? t[0];
|
|
57
59
|
}
|
|
58
|
-
function
|
|
59
|
-
var
|
|
60
|
-
return
|
|
60
|
+
function qt(t, s, r) {
|
|
61
|
+
var a, n;
|
|
62
|
+
return s != null ? String(s) : r != null ? String(r) : ((a = t.find((w) => w.selected)) == null ? void 0 : a.value) ?? ((n = t[0]) == null ? void 0 : n.value) ?? "";
|
|
61
63
|
}
|
|
62
|
-
function
|
|
63
|
-
if (
|
|
64
|
+
function St(t) {
|
|
65
|
+
if (vt(t)) {
|
|
64
66
|
const {
|
|
65
|
-
children:
|
|
66
|
-
placeholder:
|
|
67
|
-
...
|
|
67
|
+
children: s,
|
|
68
|
+
placeholder: r,
|
|
69
|
+
...a
|
|
68
70
|
} = t.props;
|
|
69
71
|
return {
|
|
70
|
-
children: /* @__PURE__ */
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
children: /* @__PURE__ */ b(it, { children: [
|
|
73
|
+
r && /* @__PURE__ */ l("option", { hidden: !0, value: "", children: r }),
|
|
74
|
+
s
|
|
73
75
|
] }),
|
|
74
|
-
props:
|
|
76
|
+
props: a
|
|
75
77
|
};
|
|
76
78
|
}
|
|
77
79
|
return {
|
|
@@ -79,175 +81,194 @@ function rt(t) {
|
|
|
79
81
|
props: t.props
|
|
80
82
|
};
|
|
81
83
|
}
|
|
82
|
-
const
|
|
83
|
-
combobox:
|
|
84
|
-
"combobox-input": "_combobox-
|
|
85
|
-
dropdown:
|
|
86
|
-
empty:
|
|
87
|
-
group:
|
|
88
|
-
placeholder:
|
|
89
|
-
filter:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
84
|
+
const It = "_combobox_7iy0q_3", Nt = "_dropdown_7iy0q_21", xt = "_empty_7iy0q_29", Et = "_group_7iy0q_30", Ct = "_placeholder_7iy0q_31", Rt = "_filter_7iy0q_39", Vt = "_native_7iy0q_71", $t = "_option_7iy0q_81", Bt = "_options_7iy0q_107", kt = "_panel_7iy0q_117", Dt = "_selected_7iy0q_142", jt = "_text_7iy0q_146", Ft = "_trigger_7iy0q_154", Wt = "_minimal_7iy0q_199", zt = "_inline_7iy0q_259", Qt = "_field_7iy0q_293", Gt = "_label_7iy0q_297", i = {
|
|
85
|
+
combobox: It,
|
|
86
|
+
"combobox-input": "_combobox-input_7iy0q_12",
|
|
87
|
+
dropdown: Nt,
|
|
88
|
+
empty: xt,
|
|
89
|
+
group: Et,
|
|
90
|
+
placeholder: Ct,
|
|
91
|
+
filter: Rt,
|
|
92
|
+
"filter-controls": "_filter-controls_7iy0q_46",
|
|
93
|
+
"loading-status": "_loading-status_7iy0q_57",
|
|
94
|
+
native: Vt,
|
|
95
|
+
option: $t,
|
|
96
|
+
options: Bt,
|
|
97
|
+
panel: kt,
|
|
98
|
+
selected: Dt,
|
|
99
|
+
text: jt,
|
|
100
|
+
trigger: Ft,
|
|
101
|
+
minimal: Wt,
|
|
102
|
+
inline: zt,
|
|
103
|
+
field: Qt,
|
|
104
|
+
label: Gt,
|
|
105
|
+
"inline-field": "_inline-field_7iy0q_302"
|
|
101
106
|
};
|
|
102
|
-
function
|
|
107
|
+
function Ve(t, s) {
|
|
103
108
|
return {
|
|
104
|
-
"--icon-svg":
|
|
109
|
+
"--icon-svg": ot(t, s)
|
|
105
110
|
};
|
|
106
111
|
}
|
|
107
|
-
const
|
|
112
|
+
const Yt = ({
|
|
108
113
|
children: t,
|
|
109
|
-
className:
|
|
110
|
-
combobox:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
className: s,
|
|
115
|
+
combobox: r = !1,
|
|
116
|
+
description: a,
|
|
117
|
+
errorMessage: n,
|
|
118
|
+
invalid: w = !1,
|
|
119
|
+
searchable: W,
|
|
120
|
+
createOption: q,
|
|
121
|
+
emptyLabel: $e = "No matches found",
|
|
122
|
+
errorLabel: p,
|
|
123
|
+
onRetry: ue,
|
|
124
|
+
retryLabel: Be = "Retry",
|
|
116
125
|
label: v,
|
|
117
|
-
filterOptions:
|
|
126
|
+
filterOptions: ke = !0,
|
|
118
127
|
hasNextPage: y = !1,
|
|
119
|
-
loading:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
loading: d = !1,
|
|
129
|
+
loadingLabel: fe = "Loading",
|
|
130
|
+
loadMoreLabel: De = "Load more",
|
|
131
|
+
onLoadMore: R,
|
|
132
|
+
onOpenChange: z,
|
|
133
|
+
onSearchChange: Q,
|
|
134
|
+
searchValue: L,
|
|
135
|
+
renderOption: O,
|
|
136
|
+
searchPlaceholder: T = "Filter",
|
|
137
|
+
selectedItems: je,
|
|
128
138
|
variant: S = "default",
|
|
129
|
-
...
|
|
139
|
+
...Fe
|
|
130
140
|
}) => {
|
|
131
|
-
const
|
|
132
|
-
defaultValue:
|
|
133
|
-
onChange:
|
|
134
|
-
value:
|
|
135
|
-
...
|
|
136
|
-
} =
|
|
137
|
-
className:
|
|
138
|
-
...
|
|
139
|
-
} =
|
|
140
|
-
|
|
141
|
-
}, [
|
|
142
|
-
|
|
143
|
-
}, [
|
|
144
|
-
default:
|
|
145
|
-
white:
|
|
146
|
-
},
|
|
141
|
+
const H = St(t), {
|
|
142
|
+
defaultValue: We,
|
|
143
|
+
onChange: J,
|
|
144
|
+
value: P,
|
|
145
|
+
...ze
|
|
146
|
+
} = H.props, o = mt(ze), {
|
|
147
|
+
className: Qe,
|
|
148
|
+
...Ge
|
|
149
|
+
} = o, pe = _(null), me = _(null), I = st(), U = w && n ? `${I}-error` : void 0, be = a ? `${I}-description` : void 0, ye = [o["aria-describedby"], be, U].filter(Boolean).join(" ") || void 0, _e = w ? !0 : o["aria-invalid"], ve = _(null), N = _(null), X = _(null), he = _(null), Y = _(!1), Z = _(!1), ee = _(R), ge = !!R, x = de(H.children), V = P != null, te = qt(x, P, We), [ne, ie] = D(() => te), [c, Ae] = D(!1), [Me, we] = D(!1), [Ke, Le] = D(null), [Oe, Te] = D(""), h = L ?? Oe, re = x.filter((e) => !e.hidden).length, He = Ke ?? (d || !!p || y || re > 8), E = W ?? (He || Me || h.length > 0), $ = oe((e) => {
|
|
150
|
+
L === void 0 && Te(e), Q == null || Q(e);
|
|
151
|
+
}, [Q, L]), m = oe((e) => {
|
|
152
|
+
Y.current === e || e && o.disabled || (Y.current = e, Ae(e), z == null || z(e), e || $(""));
|
|
153
|
+
}, [z, o.disabled, $]), G = V ? String(P) : ne, qe = {
|
|
154
|
+
default: ce("--colors-semantic-content-secondary"),
|
|
155
|
+
white: ce("--color-white", "white")
|
|
156
|
+
}, Se = o.disabled ? ce("--colors-semantic-content-disabled") : S === "minimal" ? qe.white : qe.default, A = wt(x, G), Je = Ve("CaretDown", Se), Pe = Ve("MagnifyingGlass", Se), le = gt(x, ke ? h : ""), C = h.trim(), M = !!(r && q && C && q.isValid(C)), Ue = v && S === "inline" ? ct(v) : v, Ie = (e) => e ? (O == null ? void 0 : O({
|
|
147
157
|
groupLabel: e.groupLabel,
|
|
148
|
-
isSelected: e.value ===
|
|
158
|
+
isSelected: e.value === G,
|
|
149
159
|
label: e.label,
|
|
150
160
|
text: e.text,
|
|
151
161
|
value: e.value
|
|
152
162
|
})) ?? e.label : "Select an option";
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}, [
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
163
|
+
g(() => {
|
|
164
|
+
c && !h && !d && !p && Le(y || re > 8);
|
|
165
|
+
}, [c, h, d, p, y, re]), g(() => {
|
|
166
|
+
!V && !x.some((e) => e.value === ne) && ie(te);
|
|
167
|
+
}, [te, ne, V, x]), g(() => {
|
|
168
|
+
c ? E && we(!0) : we(!1);
|
|
169
|
+
}, [c, E]), g(() => {
|
|
170
|
+
var e, u, f;
|
|
171
|
+
c && (r || E ? (e = N.current) == null || e.focus() : (f = (u = X.current) == null ? void 0 : u.querySelector("button:not(:disabled)")) == null || f.focus());
|
|
172
|
+
}, [c, r, E]), g(() => {
|
|
173
|
+
if (!c)
|
|
160
174
|
return;
|
|
161
|
-
const e = (
|
|
162
|
-
var
|
|
163
|
-
(
|
|
175
|
+
const e = (u) => {
|
|
176
|
+
var f;
|
|
177
|
+
(f = me.current) != null && f.contains(u.target) || m(!1);
|
|
164
178
|
};
|
|
165
179
|
return document.addEventListener("mousedown", e), () => {
|
|
166
180
|
document.removeEventListener("mousedown", e);
|
|
167
181
|
};
|
|
168
|
-
}, [
|
|
169
|
-
|
|
170
|
-
}, [
|
|
171
|
-
|
|
172
|
-
}, [
|
|
173
|
-
const
|
|
174
|
-
!
|
|
175
|
-
}, [
|
|
176
|
-
|
|
177
|
-
if (
|
|
178
|
-
const e =
|
|
179
|
-
if (!e || !
|
|
180
|
-
let
|
|
181
|
-
const
|
|
182
|
-
|
|
182
|
+
}, [m, c]), g(() => {
|
|
183
|
+
ee.current = R;
|
|
184
|
+
}, [R]), g(() => {
|
|
185
|
+
o.disabled && m(!1);
|
|
186
|
+
}, [m, o.disabled]);
|
|
187
|
+
const se = oe(() => {
|
|
188
|
+
!Y.current || o.disabled || d || p || !y || !ee.current || Z.current || (Z.current = !0, ee.current());
|
|
189
|
+
}, [p, y, d, o.disabled]);
|
|
190
|
+
g(() => {
|
|
191
|
+
if (Z.current = !1, !c || o.disabled || d || p || !y || !ge) return;
|
|
192
|
+
const e = he.current, u = X.current;
|
|
193
|
+
if (!e || !u || typeof IntersectionObserver > "u") return;
|
|
194
|
+
let f = !0;
|
|
195
|
+
const B = new IntersectionObserver((tt) => {
|
|
196
|
+
f && tt.some((nt) => nt.isIntersecting) && se();
|
|
183
197
|
}, {
|
|
184
|
-
root:
|
|
198
|
+
root: u
|
|
185
199
|
});
|
|
186
|
-
return
|
|
187
|
-
|
|
200
|
+
return B.observe(e), () => {
|
|
201
|
+
f = !1, B.disconnect();
|
|
188
202
|
};
|
|
189
|
-
}, [
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
},
|
|
203
|
+
}, [c, d, p, y, ge, se, le.length, h, o.disabled]);
|
|
204
|
+
const Xe = (e) => {
|
|
205
|
+
V || ie(e.target.value), J == null || J(e);
|
|
206
|
+
}, ae = () => {
|
|
193
207
|
var e;
|
|
194
|
-
|
|
195
|
-
},
|
|
208
|
+
m(!1), r || (e = pe.current) == null || e.focus();
|
|
209
|
+
}, Ne = () => {
|
|
196
210
|
var e;
|
|
197
|
-
|
|
198
|
-
},
|
|
199
|
-
!
|
|
200
|
-
},
|
|
201
|
-
var
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
if (!
|
|
205
|
-
|
|
211
|
+
$(""), m(!0), (e = N.current) == null || e.focus();
|
|
212
|
+
}, xe = () => {
|
|
213
|
+
!q || !M || (q.onCreate(C), Ne());
|
|
214
|
+
}, Ye = (e) => {
|
|
215
|
+
var B;
|
|
216
|
+
V || ie(e);
|
|
217
|
+
const u = ve.current;
|
|
218
|
+
if (!u) {
|
|
219
|
+
ae();
|
|
206
220
|
return;
|
|
207
221
|
}
|
|
208
|
-
const
|
|
209
|
-
|
|
222
|
+
const f = (B = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value")) == null ? void 0 : B.set;
|
|
223
|
+
f == null || f.call(u, e), u.dispatchEvent(new Event("change", {
|
|
210
224
|
bubbles: !0
|
|
211
|
-
})),
|
|
212
|
-
},
|
|
213
|
-
e.key === "Escape" &&
|
|
214
|
-
},
|
|
215
|
-
/* @__PURE__ */
|
|
216
|
-
|
|
225
|
+
})), r ? Ne() : ae();
|
|
226
|
+
}, Ze = (e) => {
|
|
227
|
+
e.key === "Escape" && ae(), e.key === "Enter" && e.target === N.current && M && (e.preventDefault(), xe());
|
|
228
|
+
}, Ee = /* @__PURE__ */ l("div", { "aria-hidden": !d, "aria-label": fe, className: i["loading-status"], role: "status", children: d && /* @__PURE__ */ l(Re, { size: "small" }) }), Ce = /* @__PURE__ */ b("div", { className: k(i.dropdown, S === "inline" && i.inline, S === "minimal" && i.minimal, s), onKeyDown: Ze, ref: me, ...Fe, children: [
|
|
229
|
+
/* @__PURE__ */ l("select", { ...Ge, "aria-hidden": "true", className: k(i.native, Qe), onChange: Xe, ref: ve, tabIndex: -1, value: G, children: H.children }),
|
|
230
|
+
r ? /* @__PURE__ */ b("div", { className: i.combobox, onClick: () => {
|
|
217
231
|
var e;
|
|
218
|
-
return (e =
|
|
232
|
+
return (e = N.current) == null ? void 0 : e.focus();
|
|
219
233
|
}, children: [
|
|
220
|
-
|
|
221
|
-
/* @__PURE__ */
|
|
222
|
-
|
|
223
|
-
}, onClick: () =>
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
/* @__PURE__ */
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
234
|
+
je,
|
|
235
|
+
/* @__PURE__ */ l("input", { "aria-describedby": ye, "aria-invalid": _e, "aria-autocomplete": "list", "aria-expanded": c, "aria-label": o["aria-label"] ?? v ?? T, className: i["combobox-input"], disabled: o.disabled, onChange: (e) => {
|
|
236
|
+
$(e.target.value), m(!0);
|
|
237
|
+
}, onClick: () => m(!0), onFocus: () => m(!0), placeholder: T || void 0, ref: N, role: "combobox", type: "text", value: h }),
|
|
238
|
+
Ee
|
|
239
|
+
] }) : /* @__PURE__ */ l(j, { "aria-describedby": ye, "aria-invalid": _e, "aria-label": v ? void 0 : o["aria-label"], "aria-expanded": c, "aria-haspopup": "dialog", "aria-labelledby": v ? `${I} ${I}-value` : void 0, className: k(i.trigger, (A == null ? void 0 : A.isPlaceholder) && i.placeholder), "data-open": c ? "true" : void 0, disabled: o.disabled, onClick: () => m(!c), ref: pe, style: Je, variant: "simple", children: /* @__PURE__ */ l("span", { className: i.text, id: `${I}-value`, children: Ie(A) }) }),
|
|
240
|
+
c && /* @__PURE__ */ b("div", { className: i.panel, children: [
|
|
241
|
+
!r && E && /* @__PURE__ */ b("div", { className: i["filter-controls"], children: [
|
|
242
|
+
/* @__PURE__ */ l(dt, { "aria-label": "Filter", className: i.filter, icon: "MagnifyingGlass", onChange: (e) => $(e.target.value), placeholder: T, ref: N, style: Pe, type: "search", value: h }),
|
|
243
|
+
Ee
|
|
244
|
+
] }),
|
|
245
|
+
/* @__PURE__ */ b(ft, { "aria-label": "Dropdown", "aria-busy": d || void 0, className: i.options, ref: X, children: [
|
|
246
|
+
le.map((e) => {
|
|
247
|
+
const u = e.value === G;
|
|
248
|
+
return /* @__PURE__ */ l("li", { "data-component": "dropdown", children: /* @__PURE__ */ b(j, { "aria-label": u ? `${e.text}, selected` : e.text, className: k(i.option, u && i.selected), disabled: e.disabled, onClick: () => Ye(e.value), variant: "tertiary", children: [
|
|
249
|
+
/* @__PURE__ */ l("span", { className: i.text, children: Ie(e) }),
|
|
250
|
+
e.groupLabel && /* @__PURE__ */ l("small", { className: i.group, children: e.groupLabel })
|
|
233
251
|
] }) }, `${e.groupLabel ?? "root"}-${e.value}`);
|
|
234
252
|
}),
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
/* @__PURE__ */
|
|
239
|
-
|
|
253
|
+
M && q && /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(j, { "aria-label": K(q.render(C)) || C, className: i.option, onClick: xe, variant: "tertiary", children: /* @__PURE__ */ l("span", { className: i.text, children: q.render(C) }) }) }),
|
|
254
|
+
le.length === 0 && !M && !d && !p && !y && /* @__PURE__ */ l("li", { className: i.empty, children: $e }),
|
|
255
|
+
p && /* @__PURE__ */ b("li", { className: i.empty, children: [
|
|
256
|
+
/* @__PURE__ */ l("span", { role: "alert", children: p }),
|
|
257
|
+
ue && /* @__PURE__ */ l(j, { disabled: d, onClick: ue, variant: "tertiary", children: Be })
|
|
240
258
|
] }),
|
|
241
|
-
|
|
242
|
-
y &&
|
|
259
|
+
d && !r && !E && /* @__PURE__ */ l("li", { "aria-label": fe, className: i.empty, role: "status", children: /* @__PURE__ */ l(Re, { size: "small" }) }),
|
|
260
|
+
y && R && !p && /* @__PURE__ */ l("li", { ref: he, children: /* @__PURE__ */ l(j, { className: i.option, disabled: d, onClick: se, variant: "tertiary", children: De }) })
|
|
243
261
|
] })
|
|
244
262
|
] })
|
|
263
|
+
] }), et = v || a ? /* @__PURE__ */ b("div", { className: k(i.label, S === "inline" && i["inline-field"]), children: [
|
|
264
|
+
/* @__PURE__ */ l(ut, { label: Ue, labelId: v ? I : void 0, description: a, descriptionId: be, inline: S === "inline" }),
|
|
265
|
+
Ce
|
|
266
|
+
] }) : Ce;
|
|
267
|
+
return /* @__PURE__ */ b("div", { className: i.field, "data-component": "dropdown", children: [
|
|
268
|
+
et,
|
|
269
|
+
U && /* @__PURE__ */ l(at, { errorId: U, errorMessage: n })
|
|
245
270
|
] });
|
|
246
|
-
return v ? /* @__PURE__ */ _("div", { className: $(r.label, S === "inline" && r["inline-field"]), "data-component": "dropdown", children: [
|
|
247
|
-
/* @__PURE__ */ o("span", { id: F, children: Be }),
|
|
248
|
-
be
|
|
249
|
-
] }) : be;
|
|
250
271
|
};
|
|
251
272
|
export {
|
|
252
|
-
|
|
273
|
+
Yt as Dropdown
|
|
253
274
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index42.css');const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index42.css');const r=require("react/jsx-runtime"),J=require("classix"),p=require("react"),K=require("../button/index.cjs"),Q=require("../form/index.cjs"),W=require("../label/index.cjs"),X="_field_1tf8u_1",Y="_dropzone_1tf8u_19",Z="_upload_1tf8u_34",L="_hint_1tf8u_46",M="_files_1tf8u_52",V="_minimal_1tf8u_59",C="_dragging_1tf8u_76",l={field:X,dropzone:Y,upload:Z,hint:L,files:M,minimal:V,dragging:C},ee=({"aria-describedby":k,accepts:A,children:z,className:O,description:I,disabled:i=!1,dropLabel:P="or drag and drop",errorMessage:c,id:$,invalid:m=!1,label:a,maxFileSize:R,multiple:h=!1,name:w,onChange:d,onValidation:F,required:T=!1,uploadLabel:_=a??"Select files",variant:o="default"})=>{const x=p.useId(),q=$??x,j=(m||c)&&c?`${x}-error`:void 0,N=I&&o!=="minimal"?`${x}-description`:void 0,b=[k,N,j].filter(Boolean).join(" ")||void 0,u=p.useRef(0),S=p.useRef(null),D=p.useRef(null),[U,g]=p.useState(!1),v=e=>{e.preventDefault(),e.stopPropagation()},B=e=>{const t=D.current;if(!t)return;const s=new DataTransfer;for(const n of e)s.items.add(n);t.files=s.files,d==null||d({target:t,currentTarget:t})},E=e=>{const{validFiles:t,emptyFiles:s,oversizedFiles:n}=e.reduce((y,f)=>(f.size===0?y.emptyFiles.push(f):R&&f.size>R?y.oversizedFiles.push(f):y.validFiles.push(f),y),{validFiles:[],emptyFiles:[],oversizedFiles:[]});return(s.length>0||n.length>0)&&(F==null||F(s,n)),t},G=e=>{if(v(e),u.current=0,g(!1),i)return;const t=Array.from(e.dataTransfer.files??[]),s=E(t);if(s.length===0)return;const n=h?s:s.slice(0,1);B(n)},H=e=>{if(i)return;const t=Array.from(e.target.files??[]),s=E(t);if(s.length===t.length){d==null||d(e);return}const n=h?s:s.slice(0,1);B(n)};return r.jsxs("div",{className:J(l.field,l[o],U&&!i&&l.dragging,O),role:"group","aria-label":a??_,"data-disabled":i||void 0,"data-invalid":m||!!c||void 0,onDragEnter:e=>{var t,s;v(e),!(i||!((s=(t=e.dataTransfer)==null?void 0:t.types)!=null&&s.includes("Files")))&&(u.current+=1,g(!0))},onDragOver:e=>{var t,s;v(e),!(i||!((s=(t=e.dataTransfer)==null?void 0:t.types)!=null&&s.includes("Files")))&&(e.dataTransfer.dropEffect="copy",g(!0))},onDragLeave:e=>{v(e),u.current=Math.max(0,u.current-1),u.current===0&&g(!1)},onDrop:G,"data-component":"dropzone",children:[a&&o!=="minimal"&&r.jsx("label",{htmlFor:q,children:r.jsx(W.Label,{label:a,description:I,descriptionId:N,required:T})}),r.jsxs("div",{children:[r.jsxs("div",{className:l.dropzone,children:[r.jsx("input",{accept:A,"aria-label":a??_,"aria-describedby":b,"aria-invalid":m||!!c||void 0,disabled:i,hidden:!0,id:q,name:w,multiple:h,onInvalid:e=>{var t;e.preventDefault(),(t=S.current)==null||t.focus()},onChange:H,ref:D,required:T,type:"file"}),r.jsx(K.Button,{"aria-label":o==="minimal"?_:void 0,"aria-describedby":b,"aria-invalid":m||!!c||void 0,className:l.upload,disabled:i,icon:"UploadSimple",ref:S,onClick:()=>{var e;return(e=D.current)==null?void 0:e.click()},size:"small",variant:o==="minimal"?"tertiary":"secondary",children:o!=="minimal"&&_}),o!=="minimal"&&r.jsx("span",{className:l.hint,children:P})]}),j&&r.jsx(Q.FieldError,{errorId:j,errorMessage:c})]}),z&&r.jsx("div",{className:l.files,children:z})]})};exports.Dropzone=ee;
|