@televet/kibble-ui 4.0.0-beta.46 → 4.0.0-beta.48
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/chunks/menu.component-CTze16Re.js.map +1 -1
- package/dist/chunks/menu.component-DfMZGgCy.js.map +1 -1
- package/dist/chunks/select.component-CASOsFQJ.js +2 -0
- package/dist/chunks/{select.component-D3FwGf7W.js.map → select.component-CASOsFQJ.js.map} +1 -1
- package/dist/chunks/select.component-CEDzVkE_.js +391 -0
- package/dist/chunks/{select.component-DC_tM1JD.js.map → select.component-CEDzVkE_.js.map} +1 -1
- package/dist/chunks/{theme.provider-CnlvRUbx.js → theme.provider-B9PPowSI.js} +5 -3
- package/dist/chunks/{theme.provider-CnlvRUbx.js.map → theme.provider-B9PPowSI.js.map} +1 -1
- package/dist/chunks/{theme.provider-B8KfvKCf.js → theme.provider-DOj3vPkk.js} +2 -2
- package/dist/chunks/{theme.provider-B8KfvKCf.js.map → theme.provider-DOj3vPkk.js.map} +1 -1
- package/dist/chunks/tooltip.component-C7RpuMiK.js.map +1 -1
- package/dist/chunks/tooltip.component-DYBYGsfe.js.map +1 -1
- package/dist/cjs/components/Select/index.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/theme/index.cjs +1 -1
- package/dist/esm/components/Select/index.js +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/theme/index.js +1 -1
- package/dist/types/components/Select/select.component.d.ts +3 -0
- package/package.json +1 -1
- package/dist/chunks/select.component-D3FwGf7W.js +0 -2
- package/dist/chunks/select.component-DC_tM1JD.js +0 -345
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-BjDatQAs.js"),l=require("react"),B=require("./withFormControl-YVXep-WE.js"),J=require("./icon.component-4aaCABoX.js"),K=require("./button.component-ytAmAAJg.js"),C=require("./text.component-Dcx3RoTp.js"),Q=require("./spinner.component-BuNeiOw3.js"),n=require("./use-locale-context-BdqHZ8L8.js"),U=require("./create-slot-recipe-context-D-pJ8fgs.js"),R=require("./icons-BVYVhH49.js"),v=require("./use-field-context--wBJQY1R.js"),p=require("./index-CZ42b9rT.js"),S=require("./index-BDnnTdaJ.js"),X=require("./tooltip.component-C7RpuMiK.js"),h=require("./flex-DKWxn8hO.js"),Y=t=>t&&t.__esModule?t:{default:t},Z=Y(l),z=t=>new S.ListCollection(t),[E,d]=n.createContext({name:"SelectContext",hookName:"useSelectContext",providerName:"<SelectProvider />"}),I=l.forwardRef((t,o)=>{const s=d(),r=p.mergeProps(s.getClearTriggerProps(),t);return e.jsxRuntimeExports.jsx(n.ark.button,{...r,ref:o})});I.displayName="SelectClearTrigger";const w=l.forwardRef((t,o)=>{const s=d(),r=n.usePresenceContext(),c=p.mergeProps(s.getContentProps(),r.getPresenceProps(),t);return r.unmounted?null:e.jsxRuntimeExports.jsx(n.ark.div,{...c,ref:n.composeRefs(r.ref,o)})});w.displayName="SelectContent";const b=l.forwardRef((t,o)=>{const s=d(),r=p.mergeProps(s.getControlProps(),t);return e.jsxRuntimeExports.jsx(n.ark.div,{...r,ref:o})});b.displayName="SelectControl";const y=l.forwardRef((t,o)=>{const s=d(),r=p.mergeProps(s.getHiddenSelectProps(),t),c=s.value.length===0,a=v.useFieldContext();return e.jsxRuntimeExports.jsxs(n.ark.select,{"aria-describedby":a?.ariaDescribedby,...r,ref:o,children:[c&&e.jsxRuntimeExports.jsx("option",{value:""}),s.collection.items.map((i,x)=>e.jsxRuntimeExports.jsx("option",{value:s.collection.getItemValue(i)??"",disabled:s.collection.getItemDisabled(i),children:s.collection.stringifyItem(i)},x))]})});y.displayName="SelectHiddenSelect";const N=l.forwardRef((t,o)=>{const s=d(),r=p.mergeProps(s.getIndicatorProps(),t);return e.jsxRuntimeExports.jsx(n.ark.div,{...r,ref:o})});N.displayName="SelectIndicator";const[ee,he]=n.createContext({name:"SelectItemContext",hookName:"useSelectItemContext",providerName:"<SelectItemProvider />"}),[te,T]=n.createContext({name:"SelectItemPropsContext",hookName:"useSelectItemPropsContext",providerName:"<SelectItemPropsProvider />"}),k=l.forwardRef((t,o)=>{const[s,r]=n.createSplitProps()(t,["item","persistFocus"]),c=d(),a=p.mergeProps(c.getItemProps(s),r),i=c.getItemState(s);return e.jsxRuntimeExports.jsx(te,{value:s,children:e.jsxRuntimeExports.jsx(ee,{value:i,children:e.jsxRuntimeExports.jsx(n.ark.div,{...a,ref:o})})})});k.displayName="SelectItem";const[re,se]=n.createContext({name:"SelectItemGroupPropsContext",hookName:"useSelectItemGroupPropsContext",providerName:"<SelectItemGroupPropsProvider />"}),q=l.forwardRef((t,o)=>{const s=l.useId(),[r,c]=n.createSplitProps()(t,["id"]),a={id:s,...r},i=d(),x=p.mergeProps(i.getItemGroupProps(a),c);return e.jsxRuntimeExports.jsx(re,{value:a,children:e.jsxRuntimeExports.jsx(n.ark.div,{...x,ref:o})})});q.displayName="SelectItemGroup";const G=l.forwardRef((t,o)=>{const s=d(),r=se(),c=p.mergeProps(s.getItemGroupLabelProps({htmlFor:r.id}),t);return e.jsxRuntimeExports.jsx(n.ark.div,{...c,ref:o})});G.displayName="SelectItemGroupLabel";const A=l.forwardRef((t,o)=>{const s=d(),r=T(),c=p.mergeProps(s.getItemIndicatorProps(r),t);return e.jsxRuntimeExports.jsx(n.ark.div,{...c,ref:o})});A.displayName="SelectItemIndicator";const F=l.forwardRef((t,o)=>{const s=d(),r=T(),c=p.mergeProps(s.getItemTextProps(r),t);return e.jsxRuntimeExports.jsx(n.ark.span,{...c,ref:o})});F.displayName="SelectItemText";const V=l.forwardRef((t,o)=>{const s=d(),r=p.mergeProps(s.getLabelProps(),t);return e.jsxRuntimeExports.jsx(n.ark.label,{...r,ref:o})});V.displayName="SelectLabel";const _=l.forwardRef((t,o)=>{const s=d(),r=p.mergeProps(s.getPositionerProps(),t);return n.usePresenceContext().unmounted?null:e.jsxRuntimeExports.jsx(n.ark.div,{...r,ref:o})});_.displayName="SelectPositioner";const oe=t=>{const o=l.useId(),{dir:s}=n.useLocaleContext(),{getRootNode:r}=n.useEnvironmentContext(),c=v.useFieldContext(),a={id:o,ids:{label:c?.ids.label,hiddenSelect:c?.ids.control},disabled:c?.disabled,readOnly:c?.readOnly,invalid:c?.invalid,required:c?.required,dir:s,getRootNode:r,...t},i=n.useMachine(S.machine,a);return S.connect(i,n.normalizeProps)},ne=(t,o)=>{const[s,r]=n.splitPresenceProps(t),[c,a]=n.createSplitProps()(r,["closeOnSelect","collection","composite","defaultHighlightedValue","defaultOpen","defaultValue","deselectable","disabled","form","highlightedValue","id","ids","invalid","loopFocus","multiple","name","onFocusOutside","onHighlightChange","onInteractOutside","onOpenChange","onPointerDownOutside","onValueChange","open","positioning","readOnly","required","scrollToIndexFn","value"]),i=oe(c),x=n.usePresence(p.mergeProps({present:i.open},s)),j=p.mergeProps(i.getRootProps(),a);return e.jsxRuntimeExports.jsx(E,{value:i,children:e.jsxRuntimeExports.jsx(n.PresenceProvider,{value:x,children:e.jsxRuntimeExports.jsx(n.ark.div,{...j,ref:o})})})},ce=l.forwardRef(ne),le=(t,o)=>{const[s,r]=n.splitPresenceProps(t),[{value:c},a]=n.createSplitProps()(r,["value"]),i=n.usePresence(p.mergeProps({present:c.open},s)),x=p.mergeProps(c.getRootProps(),a);return e.jsxRuntimeExports.jsx(E,{value:c,children:e.jsxRuntimeExports.jsx(n.PresenceProvider,{value:i,children:e.jsxRuntimeExports.jsx(n.ark.div,{...x,ref:o})})})},ie=l.forwardRef(le),$=l.forwardRef((t,o)=>{const s=d(),r=p.mergeProps(s.getTriggerProps(),t);return e.jsxRuntimeExports.jsx(n.ark.button,{...r,ref:o})});$.displayName="SelectTrigger";const L=l.forwardRef((t,o)=>{const{children:s,placeholder:r,...c}=t,a=d(),i=p.mergeProps(a.getValueTextProps(),c);return e.jsxRuntimeExports.jsx(n.ark.span,{...i,ref:o,children:s||a.valueAsString||r})});L.displayName="SelectValueText";const{withProvider:O,withContext:u}=U.createSlotRecipeContext({key:"select"});O(ie,"root",{forwardAsChild:!0});const ae=O(ce,"root",{forwardAsChild:!0,defaultProps:{positioning:{sameWidth:!0}}}),pe=u($,"trigger",{forwardAsChild:!0}),de=u(_,"positioner",{forwardAsChild:!0}),ue=u(w,"content",{forwardAsChild:!0}),xe=u(L,"valueText",{forwardAsChild:!0}),me=u(I,"clearTrigger",{forwardAsChild:!0,defaultProps:{children:e.jsxRuntimeExports.jsx(R.CloseIcon,{boxSize:"1em"})}});u(q,"itemGroup",{forwardAsChild:!0});u(G,"itemGroupLabel",{forwardAsChild:!0});const Pe=u(k,"item",{forwardAsChild:!0});u(F,"itemText",{forwardAsChild:!0});u(A,"itemIndicator",{forwardAsChild:!0,defaultProps:{children:e.jsxRuntimeExports.jsx(R.CheckIcon,{})}});const je=u("div","indicatorGroup");u(N,"indicator",{forwardAsChild:!0,defaultProps:{children:e.jsxRuntimeExports.jsx(R.ChevronDownIcon,{})}});const ge=u(b,"control",{forwardAsChild:!0});u(V,"label",{forwardAsChild:!0});const Se=y,D=({item:t,onContrast:o,shouldTruncateText:s,size:r})=>e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[t.leftElement,typeof t.label=="string"?e.jsxRuntimeExports.jsx(C.WrappedText,{size:r,truncated:s,variant:t.variant||(o?"onContrast":"default"),children:t.label}):t.label]}),Re=({placeholder:t="",placeholderElement:o,...s})=>{const r=d(),c=l.useMemo(()=>r.selectedItems[0],[r]);return e.jsxRuntimeExports.jsxs(pe,{children:[!c&&o,e.jsxRuntimeExports.jsx(xe,{placeholder:t,children:c&&e.jsxRuntimeExports.jsx(D,{item:c,...s})})]})},fe=B.withFormControl(({clearable:t,emptyPlaceholder:o="No options available",loading:s,onContrast:r,options:c,placeholder:a="",placeholderElement:i,selectRef:x,shouldTruncateText:j,size:P="md",...M})=>{const{contentRef:f}=X.useModalContentRef(),W=r?"onContrast":"default",g=l.useMemo(()=>z({items:c??[],itemToString:m=>typeof m.label=="string"?m.label:m.valueText||"",itemToValue:m=>m.value}),[c]);return console.log(f),e.jsxRuntimeExports.jsxs(ae,{className:"Select","data-testid":"kibble-select",collection:g,size:P,variant:W,...M,children:[e.jsxRuntimeExports.jsx(Se,{ref:x}),e.jsxRuntimeExports.jsxs(ge,{children:[e.jsxRuntimeExports.jsx(Re,{placeholder:a,placeholderElement:i,onContrast:!!r,shouldTruncateText:!!j,size:P}),e.jsxRuntimeExports.jsxs(je,{children:[t&&e.jsxRuntimeExports.jsx(me,{asChild:!0,children:e.jsxRuntimeExports.jsx(K.Button,{iconName:"close",onContrast:r,size:P==="lg"?"sm":"xs",variant:"ghostNeutral"})}),e.jsxRuntimeExports.jsx(J.Icon,{name:"chevronDown",size:P,variant:r?"onContrast":"default"})]})]}),e.jsxRuntimeExports.jsx(n.Portal,{container:f||void 0,children:e.jsxRuntimeExports.jsx(de,{children:e.jsxRuntimeExports.jsx(ue,{children:s?e.jsxRuntimeExports.jsx(h.Flex,{w:"100%",justifyContent:"center",py:3,children:e.jsxRuntimeExports.jsx(Q.Spinner,{variant:r?"brandOnContrast":"brand",size:P})}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:g.items.length?g.items.map(m=>e.jsxRuntimeExports.jsx(Pe,{item:m,children:e.jsxRuntimeExports.jsx(D,{item:m,onContrast:!!r,shouldTruncateText:!!j,size:P})},m.value)):e.jsxRuntimeExports.jsx(h.Flex,{w:"100%",justifyContent:"center",py:3,children:e.jsxRuntimeExports.jsx(C.WrappedText,{size:"sm",variant:r?"subtleOnContrast":"subtle",children:o})})})})})})]})}),H=Z.default.forwardRef((t,o)=>e.jsxRuntimeExports.jsx(fe,{selectRef:o,...t}));H.displayName="Select";exports.WrappedSelect=H;
|
|
2
|
-
//# sourceMappingURL=select.component-D3FwGf7W.js.map
|
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
-
import X, { forwardRef as a, useId as j, useMemo as I } from "react";
|
|
3
|
-
import { w as Y } from "./withFormControl-Vf_flDYv.js";
|
|
4
|
-
import { I as Z } from "./icon.component-BmcWaysM.js";
|
|
5
|
-
import { B as z } from "./button.component-BWlRjD5a.js";
|
|
6
|
-
import { W as b } from "./text.component-D3E0SdX1.js";
|
|
7
|
-
import { S as ee } from "./spinner.component-DCSsW51J.js";
|
|
8
|
-
import { a as g, f as d, u as y, h as te, b as h, j as oe, i as re, k as se, n as ne, s as N, l as w, m as T, P as le } from "./use-locale-context-zakBNK5b.js";
|
|
9
|
-
import { c as ce } from "./create-slot-recipe-context-DJkLYvCT.js";
|
|
10
|
-
import { C as ie, b as ae, c as de } from "./icons-grAfs3Oz.js";
|
|
11
|
-
import { u as G } from "./use-field-context-B8ygn96q.js";
|
|
12
|
-
import { U as i } from "./index-DLvqBeH6.js";
|
|
13
|
-
import { L as pe, m as me, c as ue } from "./index-Dn2nvQ5m.js";
|
|
14
|
-
import { u as xe } from "./tooltip.component-DYBYGsfe.js";
|
|
15
|
-
import { F as v } from "./flex-C2d2LH-K.js";
|
|
16
|
-
const Pe = (o) => new pe(o), [A, p] = g({
|
|
17
|
-
name: "SelectContext",
|
|
18
|
-
hookName: "useSelectContext",
|
|
19
|
-
providerName: "<SelectProvider />"
|
|
20
|
-
}), R = a((o, s) => {
|
|
21
|
-
const r = p(), t = i(r.getClearTriggerProps(), o);
|
|
22
|
-
return /* @__PURE__ */ e.jsx(d.button, { ...t, ref: s });
|
|
23
|
-
});
|
|
24
|
-
R.displayName = "SelectClearTrigger";
|
|
25
|
-
const V = a((o, s) => {
|
|
26
|
-
const r = p(), t = y(), n = i(r.getContentProps(), t.getPresenceProps(), o);
|
|
27
|
-
return t.unmounted ? null : /* @__PURE__ */ e.jsx(d.div, { ...n, ref: te(t.ref, s) });
|
|
28
|
-
});
|
|
29
|
-
V.displayName = "SelectContent";
|
|
30
|
-
const F = a((o, s) => {
|
|
31
|
-
const r = p(), t = i(r.getControlProps(), o);
|
|
32
|
-
return /* @__PURE__ */ e.jsx(d.div, { ...t, ref: s });
|
|
33
|
-
});
|
|
34
|
-
F.displayName = "SelectControl";
|
|
35
|
-
const L = a((o, s) => {
|
|
36
|
-
const r = p(), t = i(r.getHiddenSelectProps(), o), n = r.value.length === 0, c = G();
|
|
37
|
-
return /* @__PURE__ */ e.jsxs(d.select, { "aria-describedby": c?.ariaDescribedby, ...t, ref: s, children: [
|
|
38
|
-
n && /* @__PURE__ */ e.jsx("option", { value: "" }),
|
|
39
|
-
r.collection.items.map((l, u) => /* @__PURE__ */ e.jsx(
|
|
40
|
-
"option",
|
|
41
|
-
{
|
|
42
|
-
value: r.collection.getItemValue(l) ?? "",
|
|
43
|
-
disabled: r.collection.getItemDisabled(l),
|
|
44
|
-
children: r.collection.stringifyItem(l)
|
|
45
|
-
},
|
|
46
|
-
u
|
|
47
|
-
))
|
|
48
|
-
] });
|
|
49
|
-
});
|
|
50
|
-
L.displayName = "SelectHiddenSelect";
|
|
51
|
-
const O = a((o, s) => {
|
|
52
|
-
const r = p(), t = i(r.getIndicatorProps(), o);
|
|
53
|
-
return /* @__PURE__ */ e.jsx(d.div, { ...t, ref: s });
|
|
54
|
-
});
|
|
55
|
-
O.displayName = "SelectIndicator";
|
|
56
|
-
const [Se, ze] = g({
|
|
57
|
-
name: "SelectItemContext",
|
|
58
|
-
hookName: "useSelectItemContext",
|
|
59
|
-
providerName: "<SelectItemProvider />"
|
|
60
|
-
}), [ge, $] = g({
|
|
61
|
-
name: "SelectItemPropsContext",
|
|
62
|
-
hookName: "useSelectItemPropsContext",
|
|
63
|
-
providerName: "<SelectItemPropsProvider />"
|
|
64
|
-
}), k = a((o, s) => {
|
|
65
|
-
const [r, t] = h()(o, ["item", "persistFocus"]), n = p(), c = i(n.getItemProps(r), t), l = n.getItemState(r);
|
|
66
|
-
return /* @__PURE__ */ e.jsx(ge, { value: r, children: /* @__PURE__ */ e.jsx(Se, { value: l, children: /* @__PURE__ */ e.jsx(d.div, { ...c, ref: s }) }) });
|
|
67
|
-
});
|
|
68
|
-
k.displayName = "SelectItem";
|
|
69
|
-
const [he, fe] = g({
|
|
70
|
-
name: "SelectItemGroupPropsContext",
|
|
71
|
-
hookName: "useSelectItemGroupPropsContext",
|
|
72
|
-
providerName: "<SelectItemGroupPropsProvider />"
|
|
73
|
-
}), H = a((o, s) => {
|
|
74
|
-
const r = j(), [t, n] = h()(o, ["id"]), c = { id: r, ...t }, l = p(), u = i(l.getItemGroupProps(c), n);
|
|
75
|
-
return /* @__PURE__ */ e.jsx(he, { value: c, children: /* @__PURE__ */ e.jsx(d.div, { ...u, ref: s }) });
|
|
76
|
-
});
|
|
77
|
-
H.displayName = "SelectItemGroup";
|
|
78
|
-
const D = a((o, s) => {
|
|
79
|
-
const r = p(), t = fe(), n = i(r.getItemGroupLabelProps({ htmlFor: t.id }), o);
|
|
80
|
-
return /* @__PURE__ */ e.jsx(d.div, { ...n, ref: s });
|
|
81
|
-
});
|
|
82
|
-
D.displayName = "SelectItemGroupLabel";
|
|
83
|
-
const W = a((o, s) => {
|
|
84
|
-
const r = p(), t = $(), n = i(r.getItemIndicatorProps(t), o);
|
|
85
|
-
return /* @__PURE__ */ e.jsx(d.div, { ...n, ref: s });
|
|
86
|
-
});
|
|
87
|
-
W.displayName = "SelectItemIndicator";
|
|
88
|
-
const E = a((o, s) => {
|
|
89
|
-
const r = p(), t = $(), n = i(r.getItemTextProps(t), o);
|
|
90
|
-
return /* @__PURE__ */ e.jsx(d.span, { ...n, ref: s });
|
|
91
|
-
});
|
|
92
|
-
E.displayName = "SelectItemText";
|
|
93
|
-
const _ = a((o, s) => {
|
|
94
|
-
const r = p(), t = i(r.getLabelProps(), o);
|
|
95
|
-
return /* @__PURE__ */ e.jsx(d.label, { ...t, ref: s });
|
|
96
|
-
});
|
|
97
|
-
_.displayName = "SelectLabel";
|
|
98
|
-
const q = a((o, s) => {
|
|
99
|
-
const r = p(), t = i(r.getPositionerProps(), o);
|
|
100
|
-
return y().unmounted ? null : /* @__PURE__ */ e.jsx(d.div, { ...t, ref: s });
|
|
101
|
-
});
|
|
102
|
-
q.displayName = "SelectPositioner";
|
|
103
|
-
const Ce = (o) => {
|
|
104
|
-
const s = j(), { dir: r } = oe(), { getRootNode: t } = re(), n = G(), c = {
|
|
105
|
-
id: s,
|
|
106
|
-
ids: {
|
|
107
|
-
label: n?.ids.label,
|
|
108
|
-
hiddenSelect: n?.ids.control
|
|
109
|
-
},
|
|
110
|
-
disabled: n?.disabled,
|
|
111
|
-
readOnly: n?.readOnly,
|
|
112
|
-
invalid: n?.invalid,
|
|
113
|
-
required: n?.required,
|
|
114
|
-
dir: r,
|
|
115
|
-
getRootNode: t,
|
|
116
|
-
...o
|
|
117
|
-
}, l = se(me, c);
|
|
118
|
-
return ue(l, ne);
|
|
119
|
-
}, ve = (o, s) => {
|
|
120
|
-
const [r, t] = N(o), [n, c] = h()(t, [
|
|
121
|
-
"closeOnSelect",
|
|
122
|
-
"collection",
|
|
123
|
-
"composite",
|
|
124
|
-
"defaultHighlightedValue",
|
|
125
|
-
"defaultOpen",
|
|
126
|
-
"defaultValue",
|
|
127
|
-
"deselectable",
|
|
128
|
-
"disabled",
|
|
129
|
-
"form",
|
|
130
|
-
"highlightedValue",
|
|
131
|
-
"id",
|
|
132
|
-
"ids",
|
|
133
|
-
"invalid",
|
|
134
|
-
"loopFocus",
|
|
135
|
-
"multiple",
|
|
136
|
-
"name",
|
|
137
|
-
"onFocusOutside",
|
|
138
|
-
"onHighlightChange",
|
|
139
|
-
"onInteractOutside",
|
|
140
|
-
"onOpenChange",
|
|
141
|
-
"onPointerDownOutside",
|
|
142
|
-
"onValueChange",
|
|
143
|
-
"open",
|
|
144
|
-
"positioning",
|
|
145
|
-
"readOnly",
|
|
146
|
-
"required",
|
|
147
|
-
"scrollToIndexFn",
|
|
148
|
-
"value"
|
|
149
|
-
]), l = Ce(n), u = w(i({ present: l.open }, r)), S = i(l.getRootProps(), c);
|
|
150
|
-
return /* @__PURE__ */ e.jsx(A, { value: l, children: /* @__PURE__ */ e.jsx(T, { value: u, children: /* @__PURE__ */ e.jsx(d.div, { ...S, ref: s }) }) });
|
|
151
|
-
}, je = a(ve), Ie = (o, s) => {
|
|
152
|
-
const [r, t] = N(o), [{ value: n }, c] = h()(t, ["value"]), l = w(i({ present: n.open }, r)), u = i(n.getRootProps(), c);
|
|
153
|
-
return /* @__PURE__ */ e.jsx(A, { value: n, children: /* @__PURE__ */ e.jsx(T, { value: l, children: /* @__PURE__ */ e.jsx(d.div, { ...u, ref: s }) }) });
|
|
154
|
-
}, be = a(Ie), M = a((o, s) => {
|
|
155
|
-
const r = p(), t = i(r.getTriggerProps(), o);
|
|
156
|
-
return /* @__PURE__ */ e.jsx(d.button, { ...t, ref: s });
|
|
157
|
-
});
|
|
158
|
-
M.displayName = "SelectTrigger";
|
|
159
|
-
const B = a((o, s) => {
|
|
160
|
-
const { children: r, placeholder: t, ...n } = o, c = p(), l = i(c.getValueTextProps(), n);
|
|
161
|
-
return /* @__PURE__ */ e.jsx(d.span, { ...l, ref: s, children: r || c.valueAsString || t });
|
|
162
|
-
});
|
|
163
|
-
B.displayName = "SelectValueText";
|
|
164
|
-
const {
|
|
165
|
-
withProvider: U,
|
|
166
|
-
withContext: m
|
|
167
|
-
} = ce({ key: "select" });
|
|
168
|
-
U(be, "root", {
|
|
169
|
-
forwardAsChild: !0
|
|
170
|
-
});
|
|
171
|
-
const ye = U(
|
|
172
|
-
je,
|
|
173
|
-
"root",
|
|
174
|
-
{
|
|
175
|
-
forwardAsChild: !0,
|
|
176
|
-
defaultProps: { positioning: { sameWidth: !0 } }
|
|
177
|
-
}
|
|
178
|
-
), Ne = m(
|
|
179
|
-
M,
|
|
180
|
-
"trigger",
|
|
181
|
-
{ forwardAsChild: !0 }
|
|
182
|
-
), we = m(q, "positioner", { forwardAsChild: !0 }), Te = m(
|
|
183
|
-
V,
|
|
184
|
-
"content",
|
|
185
|
-
{ forwardAsChild: !0 }
|
|
186
|
-
), Ge = m(B, "valueText", { forwardAsChild: !0 }), Ae = m(R, "clearTrigger", {
|
|
187
|
-
forwardAsChild: !0,
|
|
188
|
-
defaultProps: { children: /* @__PURE__ */ e.jsx(ie, { boxSize: "1em" }) }
|
|
189
|
-
});
|
|
190
|
-
m(H, "itemGroup", { forwardAsChild: !0 });
|
|
191
|
-
m(D, "itemGroupLabel", { forwardAsChild: !0 });
|
|
192
|
-
const Re = m(
|
|
193
|
-
k,
|
|
194
|
-
"item",
|
|
195
|
-
{ forwardAsChild: !0 }
|
|
196
|
-
);
|
|
197
|
-
m(
|
|
198
|
-
E,
|
|
199
|
-
"itemText",
|
|
200
|
-
{ forwardAsChild: !0 }
|
|
201
|
-
);
|
|
202
|
-
m(W, "itemIndicator", {
|
|
203
|
-
forwardAsChild: !0,
|
|
204
|
-
defaultProps: {
|
|
205
|
-
children: /* @__PURE__ */ e.jsx(ae, {})
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
const Ve = m("div", "indicatorGroup");
|
|
209
|
-
m(O, "indicator", {
|
|
210
|
-
forwardAsChild: !0,
|
|
211
|
-
defaultProps: {
|
|
212
|
-
children: /* @__PURE__ */ e.jsx(de, {})
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
const Fe = m(
|
|
216
|
-
F,
|
|
217
|
-
"control",
|
|
218
|
-
{ forwardAsChild: !0 }
|
|
219
|
-
);
|
|
220
|
-
m(
|
|
221
|
-
_,
|
|
222
|
-
"label",
|
|
223
|
-
{ forwardAsChild: !0 }
|
|
224
|
-
);
|
|
225
|
-
const Le = L, J = ({
|
|
226
|
-
item: o,
|
|
227
|
-
onContrast: s,
|
|
228
|
-
shouldTruncateText: r,
|
|
229
|
-
size: t
|
|
230
|
-
}) => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
231
|
-
o.leftElement,
|
|
232
|
-
typeof o.label == "string" ? /* @__PURE__ */ e.jsx(
|
|
233
|
-
b,
|
|
234
|
-
{
|
|
235
|
-
size: t,
|
|
236
|
-
truncated: r,
|
|
237
|
-
variant: o.variant || (s ? "onContrast" : "default"),
|
|
238
|
-
children: o.label
|
|
239
|
-
}
|
|
240
|
-
) : o.label
|
|
241
|
-
] }), Oe = ({
|
|
242
|
-
placeholder: o = "",
|
|
243
|
-
placeholderElement: s,
|
|
244
|
-
...r
|
|
245
|
-
}) => {
|
|
246
|
-
const t = p(), n = I(() => t.selectedItems[0], [t]);
|
|
247
|
-
return /* @__PURE__ */ e.jsxs(Ne, { children: [
|
|
248
|
-
!n && s,
|
|
249
|
-
/* @__PURE__ */ e.jsx(Ge, { placeholder: o, children: n && /* @__PURE__ */ e.jsx(J, { item: n, ...r }) })
|
|
250
|
-
] });
|
|
251
|
-
}, $e = Y(
|
|
252
|
-
({
|
|
253
|
-
clearable: o,
|
|
254
|
-
emptyPlaceholder: s = "No options available",
|
|
255
|
-
loading: r,
|
|
256
|
-
onContrast: t,
|
|
257
|
-
options: n,
|
|
258
|
-
placeholder: c = "",
|
|
259
|
-
placeholderElement: l,
|
|
260
|
-
selectRef: u,
|
|
261
|
-
shouldTruncateText: S,
|
|
262
|
-
size: P = "md",
|
|
263
|
-
...K
|
|
264
|
-
}) => {
|
|
265
|
-
const { contentRef: C } = xe(), Q = t ? "onContrast" : "default", f = I(() => Pe({
|
|
266
|
-
items: n ?? [],
|
|
267
|
-
itemToString: (x) => typeof x.label == "string" ? x.label : x.valueText || "",
|
|
268
|
-
itemToValue: (x) => x.value
|
|
269
|
-
}), [n]);
|
|
270
|
-
return console.log(C), /* @__PURE__ */ e.jsxs(
|
|
271
|
-
ye,
|
|
272
|
-
{
|
|
273
|
-
className: "Select",
|
|
274
|
-
"data-testid": "kibble-select",
|
|
275
|
-
collection: f,
|
|
276
|
-
size: P,
|
|
277
|
-
variant: Q,
|
|
278
|
-
...K,
|
|
279
|
-
children: [
|
|
280
|
-
/* @__PURE__ */ e.jsx(Le, { ref: u }),
|
|
281
|
-
/* @__PURE__ */ e.jsxs(Fe, { children: [
|
|
282
|
-
/* @__PURE__ */ e.jsx(
|
|
283
|
-
Oe,
|
|
284
|
-
{
|
|
285
|
-
placeholder: c,
|
|
286
|
-
placeholderElement: l,
|
|
287
|
-
onContrast: !!t,
|
|
288
|
-
shouldTruncateText: !!S,
|
|
289
|
-
size: P
|
|
290
|
-
}
|
|
291
|
-
),
|
|
292
|
-
/* @__PURE__ */ e.jsxs(Ve, { children: [
|
|
293
|
-
o && /* @__PURE__ */ e.jsx(Ae, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
294
|
-
z,
|
|
295
|
-
{
|
|
296
|
-
iconName: "close",
|
|
297
|
-
onContrast: t,
|
|
298
|
-
size: P === "lg" ? "sm" : "xs",
|
|
299
|
-
variant: "ghostNeutral"
|
|
300
|
-
}
|
|
301
|
-
) }),
|
|
302
|
-
/* @__PURE__ */ e.jsx(
|
|
303
|
-
Z,
|
|
304
|
-
{
|
|
305
|
-
name: "chevronDown",
|
|
306
|
-
size: P,
|
|
307
|
-
variant: t ? "onContrast" : "default"
|
|
308
|
-
}
|
|
309
|
-
)
|
|
310
|
-
] })
|
|
311
|
-
] }),
|
|
312
|
-
/* @__PURE__ */ e.jsx(le, { container: C || void 0, children: /* @__PURE__ */ e.jsx(we, { children: /* @__PURE__ */ e.jsx(Te, { children: r ? /* @__PURE__ */ e.jsx(v, { w: "100%", justifyContent: "center", py: 3, children: /* @__PURE__ */ e.jsx(
|
|
313
|
-
ee,
|
|
314
|
-
{
|
|
315
|
-
variant: t ? "brandOnContrast" : "brand",
|
|
316
|
-
size: P
|
|
317
|
-
}
|
|
318
|
-
) }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: f.items.length ? f.items.map((x) => /* @__PURE__ */ e.jsx(Re, { item: x, children: /* @__PURE__ */ e.jsx(
|
|
319
|
-
J,
|
|
320
|
-
{
|
|
321
|
-
item: x,
|
|
322
|
-
onContrast: !!t,
|
|
323
|
-
shouldTruncateText: !!S,
|
|
324
|
-
size: P
|
|
325
|
-
}
|
|
326
|
-
) }, x.value)) : /* @__PURE__ */ e.jsx(v, { w: "100%", justifyContent: "center", py: 3, children: /* @__PURE__ */ e.jsx(
|
|
327
|
-
b,
|
|
328
|
-
{
|
|
329
|
-
size: "sm",
|
|
330
|
-
variant: t ? "subtleOnContrast" : "subtle",
|
|
331
|
-
children: s
|
|
332
|
-
}
|
|
333
|
-
) }) }) }) }) })
|
|
334
|
-
]
|
|
335
|
-
}
|
|
336
|
-
);
|
|
337
|
-
}
|
|
338
|
-
), ke = X.forwardRef(
|
|
339
|
-
(o, s) => /* @__PURE__ */ e.jsx($e, { selectRef: s, ...o })
|
|
340
|
-
);
|
|
341
|
-
ke.displayName = "Select";
|
|
342
|
-
export {
|
|
343
|
-
ke as W
|
|
344
|
-
};
|
|
345
|
-
//# sourceMappingURL=select.component-DC_tM1JD.js.map
|