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