simple-search-dropdown
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -1,6 +0,6 @@ | ||
import { jsxs as ne, jsx as M } from "react/jsx-runtime"; | ||
import { jsxs as ne, jsx as B } from "react/jsx-runtime"; | ||
import * as l from "react"; | ||
import ae, { useState as L, useRef as H, useEffect as z } from "react"; | ||
var w = function() { | ||
return w = Object.assign || function(t) { | ||
var C = function() { | ||
return C = Object.assign || function(t) { | ||
for (var n, r = 1, a = arguments.length; r < a; r++) { | ||
@@ -11,5 +11,5 @@ n = arguments[r]; | ||
return t; | ||
}, w.apply(this, arguments); | ||
}, C.apply(this, arguments); | ||
}; | ||
function U(e, t) { | ||
function G(e, t) { | ||
var n = {}; | ||
@@ -112,11 +112,11 @@ for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]); | ||
} | ||
var h = function() { | ||
var m = function() { | ||
var d = u; | ||
u = [], d.forEach(c); | ||
}, g = function() { | ||
return Promise.resolve().then(h); | ||
}, p = function() { | ||
return Promise.resolve().then(m); | ||
}; | ||
g(), n = { | ||
p(), n = { | ||
push: function(d) { | ||
u.push(d), g(); | ||
u.push(d), p(); | ||
}, | ||
@@ -134,6 +134,6 @@ filter: function(d) { | ||
var t = de(null); | ||
return t.options = w({ async: !0, ssr: !1 }, e), t; | ||
return t.options = C({ async: !0, ssr: !1 }, e), t; | ||
} | ||
var $ = function(e) { | ||
var t = e.sideCar, n = U(e, ["sideCar"]); | ||
var U = function(e) { | ||
var t = e.sideCar, n = G(e, ["sideCar"]); | ||
if (!t) | ||
@@ -144,7 +144,7 @@ throw new Error("Sidecar: please provide `sideCar` property to import the right car"); | ||
throw new Error("Sidecar medium not found"); | ||
return l.createElement(r, w({}, n)); | ||
return l.createElement(r, C({}, n)); | ||
}; | ||
$.isSideCarExport = !0; | ||
U.isSideCarExport = !0; | ||
function he(e, t) { | ||
return e.useMedium(t), $; | ||
return e.useMedium(t), U; | ||
} | ||
@@ -157,8 +157,8 @@ var q = ve(), V = function() { | ||
onTouchMoveCapture: V | ||
}), a = r[0], c = r[1], u = e.forwardProps, o = e.children, h = e.className, g = e.removeScrollBar, d = e.enabled, y = e.shards, b = e.sideCar, C = e.noIsolation, p = e.inert, i = e.allowPinchZoom, s = e.as, f = s === void 0 ? "div" : s, v = e.gapMode, S = U(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), E = b, m = se([n, t]), R = w(w({}, S), a); | ||
}), a = r[0], c = r[1], u = e.forwardProps, o = e.children, m = e.className, p = e.removeScrollBar, d = e.enabled, b = e.shards, y = e.sideCar, h = e.noIsolation, S = e.inert, i = e.allowPinchZoom, s = e.as, f = s === void 0 ? "div" : s, v = e.gapMode, w = G(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), E = y, g = se([n, t]), R = C(C({}, w), a); | ||
return l.createElement( | ||
l.Fragment, | ||
null, | ||
d && l.createElement(E, { sideCar: q, removeScrollBar: g, shards: y, noIsolation: C, inert: p, setCallbacks: c, allowPinchZoom: !!i, lockRef: n, gapMode: v }), | ||
u ? l.cloneElement(l.Children.only(o), w(w({}, R), { ref: m })) : l.createElement(f, w({}, R, { className: h, ref: m }), o) | ||
d && l.createElement(E, { sideCar: q, removeScrollBar: p, shards: b, noIsolation: h, inert: S, setCallbacks: c, allowPinchZoom: !!i, lockRef: n, gapMode: v }), | ||
u ? l.cloneElement(l.Children.only(o), C(C({}, R), { ref: g })) : l.createElement(f, C({}, R, { className: m, ref: g }), o) | ||
); | ||
@@ -187,3 +187,3 @@ }); | ||
} | ||
function ye(e, t) { | ||
function pe(e, t) { | ||
e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t)); | ||
@@ -195,7 +195,7 @@ } | ||
} | ||
var pe = function() { | ||
var ye = function() { | ||
var e = 0, t = null; | ||
return { | ||
add: function(n) { | ||
e == 0 && (t = ge()) && (ye(t, n), be(t)), e++; | ||
e == 0 && (t = ge()) && (pe(t, n), be(t)), e++; | ||
}, | ||
@@ -207,3 +207,3 @@ remove: function() { | ||
}, Se = function() { | ||
var e = pe(); | ||
var e = ye(); | ||
return function(t, n) { | ||
@@ -306,3 +306,3 @@ l.useEffect(function() { | ||
try { | ||
var B = Object.defineProperty({}, "passive", { | ||
var T = Object.defineProperty({}, "passive", { | ||
get: function() { | ||
@@ -312,3 +312,3 @@ return Y = !0, !0; | ||
}); | ||
window.addEventListener("test", B, B), window.removeEventListener("test", B, B); | ||
window.addEventListener("test", T, T), window.removeEventListener("test", T, T); | ||
} catch { | ||
@@ -330,3 +330,3 @@ Y = !1; | ||
return K(e, "overflowY"); | ||
}, Me = function(e) { | ||
}, Be = function(e) { | ||
return K(e, "overflowX"); | ||
@@ -346,3 +346,3 @@ }, Z = function(e, t) { | ||
return !1; | ||
}, Te = function(e) { | ||
}, Me = function(e) { | ||
var t = e.scrollTop, n = e.scrollHeight, r = e.clientHeight; | ||
@@ -354,3 +354,3 @@ return [ | ||
]; | ||
}, Be = function(e) { | ||
}, Te = function(e) { | ||
var t = e.scrollLeft, n = e.scrollWidth, r = e.clientWidth; | ||
@@ -363,18 +363,18 @@ return [ | ||
}, ee = function(e, t) { | ||
return e === "v" ? Ne(t) : Me(t); | ||
return e === "v" ? Ne(t) : Be(t); | ||
}, te = function(e, t) { | ||
return e === "v" ? Te(t) : Be(t); | ||
return e === "v" ? Me(t) : Te(t); | ||
}, Oe = function(e, t) { | ||
return e === "h" && t === "rtl" ? -1 : 1; | ||
}, Ie = function(e, t, n, r, a) { | ||
var c = Oe(e, window.getComputedStyle(t).direction), u = c * r, o = n.target, h = t.contains(o), g = !1, d = u > 0, y = 0, b = 0; | ||
var c = Oe(e, window.getComputedStyle(t).direction), u = c * r, o = n.target, m = t.contains(o), p = !1, d = u > 0, b = 0, y = 0; | ||
do { | ||
var C = te(e, o), p = C[0], i = C[1], s = C[2], f = i - s - c * p; | ||
(p || f) && ee(e, o) && (y += f, b += p), o instanceof ShadowRoot ? o = o.host : o = o.parentNode; | ||
var h = te(e, o), S = h[0], i = h[1], s = h[2], f = i - s - c * S; | ||
(S || f) && ee(e, o) && (b += f, y += S), o instanceof ShadowRoot ? o = o.host : o = o.parentNode; | ||
} while ( | ||
// portaled content | ||
!h && o !== document.body || // self content | ||
h && (t.contains(o) || t === o) | ||
!m && o !== document.body || // self content | ||
m && (t.contains(o) || t === o) | ||
); | ||
return (d && (Math.abs(y) < 1 || !a) || !d && (Math.abs(b) < 1 || !a)) && (g = !0), g; | ||
return (d && (Math.abs(b) < 1 || !a) || !d && (Math.abs(y) < 1 || !a)) && (p = !0), p; | ||
}, O = function(e) { | ||
@@ -384,3 +384,3 @@ return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0]; | ||
return [e.deltaX, e.deltaY]; | ||
}, G = function(e) { | ||
}, $ = function(e) { | ||
return e && "current" in e ? e.current : e; | ||
@@ -402,3 +402,3 @@ }, Ae = function(e, t) { | ||
document.body.classList.add("block-interactivity-".concat(a)); | ||
var i = oe([e.lockRef.current], (e.shards || []).map(G), !0).filter(Boolean); | ||
var i = oe([e.lockRef.current], (e.shards || []).map($), !0).filter(Boolean); | ||
return i.forEach(function(s) { | ||
@@ -416,19 +416,19 @@ return s.classList.add("allow-interactivity-".concat(a)); | ||
return !u.current.allowPinchZoom; | ||
var f = O(i), v = n.current, S = "deltaX" in i ? i.deltaX : v[0] - f[0], E = "deltaY" in i ? i.deltaY : v[1] - f[1], m, R = i.target, N = Math.abs(S) > Math.abs(E) ? "h" : "v"; | ||
var f = O(i), v = n.current, w = "deltaX" in i ? i.deltaX : v[0] - f[0], E = "deltaY" in i ? i.deltaY : v[1] - f[1], g, R = i.target, N = Math.abs(w) > Math.abs(E) ? "h" : "v"; | ||
if ("touches" in i && N === "h" && R.type === "range") | ||
return !1; | ||
var T = Z(N, R); | ||
if (!T) | ||
var M = Z(N, R); | ||
if (!M) | ||
return !0; | ||
if (T ? m = N : (m = N === "v" ? "h" : "v", T = Z(N, R)), !T) | ||
if (M ? g = N : (g = N === "v" ? "h" : "v", M = Z(N, R)), !M) | ||
return !1; | ||
if (!r.current && "changedTouches" in i && (S || E) && (r.current = m), !m) | ||
if (!r.current && "changedTouches" in i && (w || E) && (r.current = g), !g) | ||
return !0; | ||
var D = r.current || m; | ||
return Ie(D, s, i, D === "h" ? S : E, !0); | ||
}, []), h = l.useCallback(function(i) { | ||
var D = r.current || g; | ||
return Ie(D, s, i, D === "h" ? w : E, !0); | ||
}, []), m = l.useCallback(function(i) { | ||
var s = i; | ||
if (!(!P.length || P[P.length - 1] !== c)) { | ||
var f = "deltaY" in s ? Q(s) : O(s), v = t.current.filter(function(m) { | ||
return m.name === s.type && (m.target === s.target || s.target === m.shadowParent) && Ae(m.delta, f); | ||
var f = "deltaY" in s ? Q(s) : O(s), v = t.current.filter(function(g) { | ||
return g.name === s.type && (g.target === s.target || s.target === g.shadowParent) && Ae(g.delta, f); | ||
})[0]; | ||
@@ -440,13 +440,13 @@ if (v && v.should) { | ||
if (!v) { | ||
var S = (u.current.shards || []).map(G).filter(Boolean).filter(function(m) { | ||
return m.contains(s.target); | ||
}), E = S.length > 0 ? o(s, S[0]) : !u.current.noIsolation; | ||
var w = (u.current.shards || []).map($).filter(Boolean).filter(function(g) { | ||
return g.contains(s.target); | ||
}), E = w.length > 0 ? o(s, w[0]) : !u.current.noIsolation; | ||
E && s.cancelable && s.preventDefault(); | ||
} | ||
} | ||
}, []), g = l.useCallback(function(i, s, f, v) { | ||
var S = { name: i, delta: s, target: f, should: v, shadowParent: Xe(f) }; | ||
t.current.push(S), setTimeout(function() { | ||
}, []), p = l.useCallback(function(i, s, f, v) { | ||
var w = { name: i, delta: s, target: f, should: v, shadowParent: Xe(f) }; | ||
t.current.push(w), setTimeout(function() { | ||
t.current = t.current.filter(function(E) { | ||
return E !== S; | ||
return E !== w; | ||
}); | ||
@@ -456,24 +456,24 @@ }, 1); | ||
n.current = O(i), r.current = void 0; | ||
}, []), b = l.useCallback(function(i) { | ||
p(i.type, Q(i), i.target, o(i, e.lockRef.current)); | ||
}, []), y = l.useCallback(function(i) { | ||
g(i.type, Q(i), i.target, o(i, e.lockRef.current)); | ||
}, []), b = l.useCallback(function(i) { | ||
g(i.type, O(i), i.target, o(i, e.lockRef.current)); | ||
p(i.type, O(i), i.target, o(i, e.lockRef.current)); | ||
}, []); | ||
l.useEffect(function() { | ||
return P.push(c), e.setCallbacks({ | ||
onScrollCapture: y, | ||
onWheelCapture: y, | ||
onTouchMoveCapture: b | ||
}), document.addEventListener("wheel", h, k), document.addEventListener("touchmove", h, k), document.addEventListener("touchstart", d, k), function() { | ||
onScrollCapture: b, | ||
onWheelCapture: b, | ||
onTouchMoveCapture: y | ||
}), document.addEventListener("wheel", m, k), document.addEventListener("touchmove", m, k), document.addEventListener("touchstart", d, k), function() { | ||
P = P.filter(function(i) { | ||
return i !== c; | ||
}), document.removeEventListener("wheel", h, k), document.removeEventListener("touchmove", h, k), document.removeEventListener("touchstart", d, k); | ||
}), document.removeEventListener("wheel", m, k), document.removeEventListener("touchmove", m, k), document.removeEventListener("touchstart", d, k); | ||
}; | ||
}, []); | ||
var C = e.removeScrollBar, p = e.inert; | ||
var h = e.removeScrollBar, S = e.inert; | ||
return l.createElement( | ||
l.Fragment, | ||
null, | ||
p ? l.createElement(c, { styles: We(a) }) : null, | ||
C ? l.createElement(Le, { gapMode: e.gapMode }) : null | ||
S ? l.createElement(c, { styles: We(a) }) : null, | ||
h ? l.createElement(Le, { gapMode: e.gapMode }) : null | ||
); | ||
@@ -488,7 +488,7 @@ } | ||
var re = l.forwardRef(function(e, t) { | ||
return l.createElement(W, w({}, e, { ref: t, sideCar: Ye })); | ||
return l.createElement(W, C({}, e, { ref: t, sideCar: Ye })); | ||
}); | ||
re.classNames = W.classNames; | ||
const ze = ae.forwardRef((e, t) => { | ||
const [n, r] = L(!1), [a, c] = L(!1), [u, o] = L(), [h, g] = L(""), [d, y] = L(), { data: b, ...C } = e, p = H(null), i = H(null); | ||
const [n, r] = L(!1), [a, c] = L(!1), [u, o] = L({ label: "", value: "" }), [m, p] = L(""), [d, b] = L(), { data: y, ...h } = e, S = H(null), i = H(null); | ||
z(() => { | ||
@@ -499,16 +499,16 @@ if (a) { | ||
} | ||
if (d != null && d.length && h && y(void 0), b && typeof b == "function") { | ||
const f = b(h.toLowerCase()); | ||
if (d != null && d.length && m && b(void 0), y && typeof y == "function") { | ||
const f = y(m.toLowerCase()); | ||
if (f instanceof Promise) { | ||
f.then((v) => { | ||
y(v); | ||
b(v); | ||
}); | ||
return; | ||
} | ||
y(f); | ||
} else b && y(b); | ||
b(f); | ||
} else y && b(y); | ||
}, [a]); | ||
const s = (f) => { | ||
const v = f.target; | ||
p.current && !p.current.contains(v) && i.current && !i.current.contains(v) && r(!1); | ||
S.current && !S.current.contains(v) && i.current && !i.current.contains(v) && r(!1); | ||
}; | ||
@@ -518,20 +518,32 @@ return z(() => (document.addEventListener("mousedown", s), () => { | ||
}), []), /* @__PURE__ */ ne("div", { children: [ | ||
/* @__PURE__ */ M( | ||
/* @__PURE__ */ B( | ||
"input", | ||
{ | ||
ref: p, | ||
ref: S, | ||
onFocus: () => r(!0), | ||
className: "p-2 bg-gray-200 cursor-pointer focus:cursor-text", | ||
type: "text", | ||
value: (u == null ? void 0 : u.label) || h, | ||
value: u.label, | ||
onChange: (f) => { | ||
g(f.target.value), c(!0); | ||
p(f.target.value), c(!0), h.onChange && h.onChange(f); | ||
}, | ||
placeholder: e.placeholder, | ||
disabled: e.disabled, | ||
...C | ||
placeholder: h.placeholder, | ||
disabled: h.disabled | ||
} | ||
), | ||
/* @__PURE__ */ M("input", { ref: t, disabled: !0, className: "hidden", type: "text", value: (u == null ? void 0 : u.value) ?? "" }), | ||
n && d && d.length > 0 && /* @__PURE__ */ M(re, { children: /* @__PURE__ */ M("div", { ref: i, className: "absolute z-10 w-full bg-white border border-gray-300 rounded mt-1", children: d.filter((f) => String(f.label).toLowerCase().indexOf(h.toLowerCase() ?? "") > -1).map((f, v) => /* @__PURE__ */ M("div", { className: "p-2 cursor-pointer hover:bg-gray-100", onClick: () => { | ||
/* @__PURE__ */ B( | ||
"input", | ||
{ | ||
id: `${h.name}-id`, | ||
name: `${h.name}-id`, | ||
onChange: h.onChange, | ||
onBlur: h.onBlur, | ||
ref: t, | ||
disabled: !0, | ||
className: "hidden", | ||
type: "text", | ||
value: u.value | ||
} | ||
), | ||
n && d && d.length > 0 && /* @__PURE__ */ B(re, { children: /* @__PURE__ */ B("div", { ref: i, className: "absolute z-10 w-full bg-white border border-gray-300 rounded mt-1", children: d.filter((f) => String(f.label).toLowerCase().indexOf(m.toLowerCase() ?? "") > -1).map((f, v) => /* @__PURE__ */ B("div", { className: "p-2 cursor-pointer hover:bg-gray-100", onClick: () => { | ||
o(f), r(!1); | ||
@@ -538,0 +550,0 @@ }, children: f.label }, v)) }) }) |
@@ -1,2 +0,2 @@ | ||
(function(x,C){typeof exports=="object"&&typeof module<"u"?C(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],C):(x=typeof globalThis<"u"?globalThis:x||self,C(x["simple-search-dropdown"]={},x["react/jsx-runtime"],x.React))})(this,function(x,C,p){"use strict";function re(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const u=re(p);var E=function(){return E=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var c in n)Object.prototype.hasOwnProperty.call(n,c)&&(t[c]=n[c])}return t},E.apply(this,arguments)};function z(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function ne(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,c;r<a;r++)(c||!(r in t))&&(c||(c=Array.prototype.slice.call(t,0,r)),c[r]=t[r]);return e.concat(c||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var M="right-scroll-bar-position",j="width-before-scroll-bar",ae="with-scroll-bars-hidden",oe="--removed-body-scroll-bar-size";function D(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function ce(e,t){var n=p.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var ie=typeof window<"u"?u.useLayoutEffect:u.useEffect,H=new WeakMap;function ue(e,t){var n=ce(null,function(r){return e.forEach(function(a){return D(a,r)})});return ie(function(){var r=H.get(n);if(r){var a=new Set(r),c=new Set(e),l=n.current;a.forEach(function(o){c.has(o)||D(o,null)}),c.forEach(function(o){a.has(o)||D(o,l)})}H.set(n,e)},[e]),n}function le(e){return e}function se(e,t){t===void 0&&(t=le);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(c){var l=t(c,r);return n.push(l),function(){n=n.filter(function(o){return o!==l})}},assignSyncMedium:function(c){for(r=!0;n.length;){var l=n;n=[],l.forEach(c)}n={push:function(o){return c(o)},filter:function(){return n}}},assignMedium:function(c){r=!0;var l=[];if(n.length){var o=n;n=[],o.forEach(c),l=n}var h=function(){var d=l;l=[],d.forEach(c)},m=function(){return Promise.resolve().then(h)};m(),n={push:function(d){l.push(d),m()},filter:function(d){return l=l.filter(d),n}}}};return a}function fe(e){e===void 0&&(e={});var t=se(null);return t.options=E({async:!0,ssr:!1},e),t}var _=function(e){var t=e.sideCar,n=z(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return u.createElement(r,E({},n))};_.isSideCarExport=!0;function de(e,t){return e.useMedium(t),_}var F=fe(),V=function(){},B=u.forwardRef(function(e,t){var n=u.useRef(null),r=u.useState({onScrollCapture:V,onWheelCapture:V,onTouchMoveCapture:V}),a=r[0],c=r[1],l=e.forwardProps,o=e.children,h=e.className,m=e.removeScrollBar,d=e.enabled,y=e.shards,S=e.sideCar,k=e.noIsolation,b=e.inert,i=e.allowPinchZoom,s=e.as,f=s===void 0?"div":s,v=e.gapMode,w=z(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=S,g=ue([n,t]),N=E(E({},w),a);return u.createElement(u.Fragment,null,d&&u.createElement(P,{sideCar:F,removeScrollBar:m,shards:y,noIsolation:k,inert:b,setCallbacks:c,allowPinchZoom:!!i,lockRef:n,gapMode:v}),l?u.cloneElement(u.Children.only(o),E(E({},N),{ref:g})):u.createElement(f,E({},N,{className:h,ref:g}),o))});B.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},B.classNames={fullWidth:j,zeroRight:M};var ve=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function he(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ve();return t&&e.setAttribute("nonce",t),e}function ge(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function me(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var pe=function(){var e=0,t=null;return{add:function(n){e==0&&(t=he())&&(ge(t,n),me(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ye=function(){var e=pe();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Z=function(){var e=ye(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},Se={left:0,top:0,right:0,gap:0},X=function(e){return parseInt(e||"",10)||0},be=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[X(n),X(r),X(a)]},we=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Se;var t=be(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Ce=Z(),L="data-scroll-locked",Ee=function(e,t,n,r){var a=e.left,c=e.top,l=e.right,o=e.gap;return n===void 0&&(n="margin"),` | ||
(function(x,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],E):(x=typeof globalThis<"u"?globalThis:x||self,E(x["simple-search-dropdown"]={},x["react/jsx-runtime"],x.React))})(this,function(x,E,b){"use strict";function re(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const l=re(b);var k=function(){return k=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var c in n)Object.prototype.hasOwnProperty.call(n,c)&&(t[c]=n[c])}return t},k.apply(this,arguments)};function z(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function ne(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,c;r<a;r++)(c||!(r in t))&&(c||(c=Array.prototype.slice.call(t,0,r)),c[r]=t[r]);return e.concat(c||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var M="right-scroll-bar-position",B="width-before-scroll-bar",ae="with-scroll-bars-hidden",oe="--removed-body-scroll-bar-size";function D(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function ce(e,t){var n=b.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var ie=typeof window<"u"?l.useLayoutEffect:l.useEffect,H=new WeakMap;function le(e,t){var n=ce(null,function(r){return e.forEach(function(a){return D(a,r)})});return ie(function(){var r=H.get(n);if(r){var a=new Set(r),c=new Set(e),u=n.current;a.forEach(function(o){c.has(o)||D(o,null)}),c.forEach(function(o){a.has(o)||D(o,u)})}H.set(n,e)},[e]),n}function ue(e){return e}function se(e,t){t===void 0&&(t=ue);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(c){var u=t(c,r);return n.push(u),function(){n=n.filter(function(o){return o!==u})}},assignSyncMedium:function(c){for(r=!0;n.length;){var u=n;n=[],u.forEach(c)}n={push:function(o){return c(o)},filter:function(){return n}}},assignMedium:function(c){r=!0;var u=[];if(n.length){var o=n;n=[],o.forEach(c),u=n}var g=function(){var d=u;u=[],d.forEach(c)},p=function(){return Promise.resolve().then(g)};p(),n={push:function(d){u.push(d),p()},filter:function(d){return u=u.filter(d),n}}}};return a}function fe(e){e===void 0&&(e={});var t=se(null);return t.options=k({async:!0,ssr:!1},e),t}var _=function(e){var t=e.sideCar,n=z(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return l.createElement(r,k({},n))};_.isSideCarExport=!0;function de(e,t){return e.useMedium(t),_}var F=fe(),V=function(){},j=l.forwardRef(function(e,t){var n=l.useRef(null),r=l.useState({onScrollCapture:V,onWheelCapture:V,onTouchMoveCapture:V}),a=r[0],c=r[1],u=e.forwardProps,o=e.children,g=e.className,p=e.removeScrollBar,d=e.enabled,y=e.shards,S=e.sideCar,h=e.noIsolation,w=e.inert,i=e.allowPinchZoom,s=e.as,f=s===void 0?"div":s,v=e.gapMode,C=z(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=S,m=le([n,t]),N=k(k({},C),a);return l.createElement(l.Fragment,null,d&&l.createElement(P,{sideCar:F,removeScrollBar:p,shards:y,noIsolation:h,inert:w,setCallbacks:c,allowPinchZoom:!!i,lockRef:n,gapMode:v}),u?l.cloneElement(l.Children.only(o),k(k({},N),{ref:m})):l.createElement(f,k({},N,{className:g,ref:m}),o))});j.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},j.classNames={fullWidth:B,zeroRight:M};var ve=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function he(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ve();return t&&e.setAttribute("nonce",t),e}function ge(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function me(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var pe=function(){var e=0,t=null;return{add:function(n){e==0&&(t=he())&&(ge(t,n),me(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},be=function(){var e=pe();return function(t,n){l.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Z=function(){var e=be(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},ye={left:0,top:0,right:0,gap:0},X=function(e){return parseInt(e||"",10)||0},Se=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[X(n),X(r),X(a)]},we=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return ye;var t=Se(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Ce=Z(),L="data-scroll-locked",Ee=function(e,t,n,r){var a=e.left,c=e.top,u=e.right,o=e.gap;return n===void 0&&(n="margin"),` | ||
.`.concat(ae,` { | ||
@@ -12,3 +12,3 @@ overflow: hidden `).concat(r,`; | ||
padding-top: `).concat(c,`px; | ||
padding-right: `).concat(l,`px; | ||
padding-right: `).concat(u,`px; | ||
margin-left:0; | ||
@@ -24,3 +24,3 @@ margin-top:0; | ||
.`).concat(j,` { | ||
.`).concat(B,` { | ||
margin-right: `).concat(o,"px ").concat(r,`; | ||
@@ -33,3 +33,3 @@ } | ||
.`).concat(j," .").concat(j,` { | ||
.`).concat(B," .").concat(B,` { | ||
margin-right: 0 `).concat(r,`; | ||
@@ -41,5 +41,5 @@ } | ||
} | ||
`)},Q=function(){var e=parseInt(document.body.getAttribute(L)||"0",10);return isFinite(e)?e:0},ke=function(){u.useEffect(function(){return document.body.setAttribute(L,(Q()+1).toString()),function(){var e=Q()-1;e<=0?document.body.removeAttribute(L):document.body.setAttribute(L,e.toString())}},[])},Pe=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;ke();var c=u.useMemo(function(){return we(a)},[a]);return u.createElement(Ce,{styles:Ee(c,!t,a,n?"":"!important")})},Y=!1;if(typeof window<"u")try{var I=Object.defineProperty({},"passive",{get:function(){return Y=!0,!0}});window.addEventListener("test",I,I),window.removeEventListener("test",I,I)}catch{Y=!1}var R=Y?{passive:!1}:!1,xe=function(e){return e.tagName==="TEXTAREA"},q=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!xe(e)&&n[t]==="visible")},Le=function(e){return q(e,"overflowY")},Re=function(e){return q(e,"overflowX")},G=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=U(e,r);if(a){var c=$(e,r),l=c[1],o=c[2];if(l>o)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Te=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Ne=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},U=function(e,t){return e==="v"?Le(t):Re(t)},$=function(e,t){return e==="v"?Te(t):Ne(t)},Oe=function(e,t){return e==="h"&&t==="rtl"?-1:1},Me=function(e,t,n,r,a){var c=Oe(e,window.getComputedStyle(t).direction),l=c*r,o=n.target,h=t.contains(o),m=!1,d=l>0,y=0,S=0;do{var k=$(e,o),b=k[0],i=k[1],s=k[2],f=i-s-c*b;(b||f)&&U(e,o)&&(y+=f,S+=b),o instanceof ShadowRoot?o=o.host:o=o.parentNode}while(!h&&o!==document.body||h&&(t.contains(o)||t===o));return(d&&(Math.abs(y)<1||!a)||!d&&(Math.abs(S)<1||!a))&&(m=!0),m},A=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},J=function(e){return[e.deltaX,e.deltaY]},K=function(e){return e&&"current"in e?e.current:e},je=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Be=function(e){return` | ||
`)},Q=function(){var e=parseInt(document.body.getAttribute(L)||"0",10);return isFinite(e)?e:0},ke=function(){l.useEffect(function(){return document.body.setAttribute(L,(Q()+1).toString()),function(){var e=Q()-1;e<=0?document.body.removeAttribute(L):document.body.setAttribute(L,e.toString())}},[])},Pe=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;ke();var c=l.useMemo(function(){return we(a)},[a]);return l.createElement(Ce,{styles:Ee(c,!t,a,n?"":"!important")})},Y=!1;if(typeof window<"u")try{var I=Object.defineProperty({},"passive",{get:function(){return Y=!0,!0}});window.addEventListener("test",I,I),window.removeEventListener("test",I,I)}catch{Y=!1}var R=Y?{passive:!1}:!1,xe=function(e){return e.tagName==="TEXTAREA"},$=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!xe(e)&&n[t]==="visible")},Le=function(e){return $(e,"overflowY")},Re=function(e){return $(e,"overflowX")},q=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=G(e,r);if(a){var c=U(e,r),u=c[1],o=c[2];if(u>o)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Te=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Ne=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},G=function(e,t){return e==="v"?Le(t):Re(t)},U=function(e,t){return e==="v"?Te(t):Ne(t)},Oe=function(e,t){return e==="h"&&t==="rtl"?-1:1},Me=function(e,t,n,r,a){var c=Oe(e,window.getComputedStyle(t).direction),u=c*r,o=n.target,g=t.contains(o),p=!1,d=u>0,y=0,S=0;do{var h=U(e,o),w=h[0],i=h[1],s=h[2],f=i-s-c*w;(w||f)&&G(e,o)&&(y+=f,S+=w),o instanceof ShadowRoot?o=o.host:o=o.parentNode}while(!g&&o!==document.body||g&&(t.contains(o)||t===o));return(d&&(Math.abs(y)<1||!a)||!d&&(Math.abs(S)<1||!a))&&(p=!0),p},A=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},J=function(e){return[e.deltaX,e.deltaY]},K=function(e){return e&&"current"in e?e.current:e},Be=function(e,t){return e[0]===t[0]&&e[1]===t[1]},je=function(e){return` | ||
.block-interactivity-`.concat(e,` {pointer-events: none;} | ||
.allow-interactivity-`).concat(e,` {pointer-events: all;} | ||
`)},Ie=0,T=[];function Ae(e){var t=u.useRef([]),n=u.useRef([0,0]),r=u.useRef(),a=u.useState(Ie++)[0],c=u.useState(Z)[0],l=u.useRef(e);u.useEffect(function(){l.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var i=ne([e.lockRef.current],(e.shards||[]).map(K),!0).filter(Boolean);return i.forEach(function(s){return s.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),i.forEach(function(s){return s.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var o=u.useCallback(function(i,s){if("touches"in i&&i.touches.length===2)return!l.current.allowPinchZoom;var f=A(i),v=n.current,w="deltaX"in i?i.deltaX:v[0]-f[0],P="deltaY"in i?i.deltaY:v[1]-f[1],g,N=i.target,O=Math.abs(w)>Math.abs(P)?"h":"v";if("touches"in i&&O==="h"&&N.type==="range")return!1;var W=G(O,N);if(!W)return!0;if(W?g=O:(g=O==="v"?"h":"v",W=G(O,N)),!W)return!1;if(!r.current&&"changedTouches"in i&&(w||P)&&(r.current=g),!g)return!0;var te=r.current||g;return Me(te,s,i,te==="h"?w:P,!0)},[]),h=u.useCallback(function(i){var s=i;if(!(!T.length||T[T.length-1]!==c)){var f="deltaY"in s?J(s):A(s),v=t.current.filter(function(g){return g.name===s.type&&(g.target===s.target||s.target===g.shadowParent)&&je(g.delta,f)})[0];if(v&&v.should){s.cancelable&&s.preventDefault();return}if(!v){var w=(l.current.shards||[]).map(K).filter(Boolean).filter(function(g){return g.contains(s.target)}),P=w.length>0?o(s,w[0]):!l.current.noIsolation;P&&s.cancelable&&s.preventDefault()}}},[]),m=u.useCallback(function(i,s,f,v){var w={name:i,delta:s,target:f,should:v,shadowParent:We(f)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(P){return P!==w})},1)},[]),d=u.useCallback(function(i){n.current=A(i),r.current=void 0},[]),y=u.useCallback(function(i){m(i.type,J(i),i.target,o(i,e.lockRef.current))},[]),S=u.useCallback(function(i){m(i.type,A(i),i.target,o(i,e.lockRef.current))},[]);u.useEffect(function(){return T.push(c),e.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:S}),document.addEventListener("wheel",h,R),document.addEventListener("touchmove",h,R),document.addEventListener("touchstart",d,R),function(){T=T.filter(function(i){return i!==c}),document.removeEventListener("wheel",h,R),document.removeEventListener("touchmove",h,R),document.removeEventListener("touchstart",d,R)}},[]);var k=e.removeScrollBar,b=e.inert;return u.createElement(u.Fragment,null,b?u.createElement(c,{styles:Be(a)}):null,k?u.createElement(Pe,{gapMode:e.gapMode}):null)}function We(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const De=de(F,Ae);var ee=u.forwardRef(function(e,t){return u.createElement(B,E({},e,{ref:t,sideCar:De}))});ee.classNames=B.classNames;const Ve=p.forwardRef((e,t)=>{const[n,r]=p.useState(!1),[a,c]=p.useState(!1),[l,o]=p.useState(),[h,m]=p.useState(""),[d,y]=p.useState(),{data:S,...k}=e,b=p.useRef(null),i=p.useRef(null);p.useEffect(()=>{if(a){c(!1);return}if(d!=null&&d.length&&h&&y(void 0),S&&typeof S=="function"){const f=S(h.toLowerCase());if(f instanceof Promise){f.then(v=>{y(v)});return}y(f)}else S&&y(S)},[a]);const s=f=>{const v=f.target;b.current&&!b.current.contains(v)&&i.current&&!i.current.contains(v)&&r(!1)};return p.useEffect(()=>(document.addEventListener("mousedown",s),()=>{document.removeEventListener("mousedown",s)}),[]),C.jsxs("div",{children:[C.jsx("input",{ref:b,onFocus:()=>r(!0),className:"p-2 bg-gray-200 cursor-pointer focus:cursor-text",type:"text",value:(l==null?void 0:l.label)||h,onChange:f=>{m(f.target.value),c(!0)},placeholder:e.placeholder,disabled:e.disabled,...k}),C.jsx("input",{ref:t,disabled:!0,className:"hidden",type:"text",value:(l==null?void 0:l.value)??""}),n&&d&&d.length>0&&C.jsx(ee,{children:C.jsx("div",{ref:i,className:"absolute z-10 w-full bg-white border border-gray-300 rounded mt-1",children:d.filter(f=>String(f.label).toLowerCase().indexOf(h.toLowerCase()??"")>-1).map((f,v)=>C.jsx("div",{className:"p-2 cursor-pointer hover:bg-gray-100",onClick:()=>{o(f),r(!1)},children:f.label},v))})})]})});x.SearchSelect=Ve,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})}); | ||
`)},Ie=0,T=[];function Ae(e){var t=l.useRef([]),n=l.useRef([0,0]),r=l.useRef(),a=l.useState(Ie++)[0],c=l.useState(Z)[0],u=l.useRef(e);l.useEffect(function(){u.current=e},[e]),l.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var i=ne([e.lockRef.current],(e.shards||[]).map(K),!0).filter(Boolean);return i.forEach(function(s){return s.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),i.forEach(function(s){return s.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var o=l.useCallback(function(i,s){if("touches"in i&&i.touches.length===2)return!u.current.allowPinchZoom;var f=A(i),v=n.current,C="deltaX"in i?i.deltaX:v[0]-f[0],P="deltaY"in i?i.deltaY:v[1]-f[1],m,N=i.target,O=Math.abs(C)>Math.abs(P)?"h":"v";if("touches"in i&&O==="h"&&N.type==="range")return!1;var W=q(O,N);if(!W)return!0;if(W?m=O:(m=O==="v"?"h":"v",W=q(O,N)),!W)return!1;if(!r.current&&"changedTouches"in i&&(C||P)&&(r.current=m),!m)return!0;var te=r.current||m;return Me(te,s,i,te==="h"?C:P,!0)},[]),g=l.useCallback(function(i){var s=i;if(!(!T.length||T[T.length-1]!==c)){var f="deltaY"in s?J(s):A(s),v=t.current.filter(function(m){return m.name===s.type&&(m.target===s.target||s.target===m.shadowParent)&&Be(m.delta,f)})[0];if(v&&v.should){s.cancelable&&s.preventDefault();return}if(!v){var C=(u.current.shards||[]).map(K).filter(Boolean).filter(function(m){return m.contains(s.target)}),P=C.length>0?o(s,C[0]):!u.current.noIsolation;P&&s.cancelable&&s.preventDefault()}}},[]),p=l.useCallback(function(i,s,f,v){var C={name:i,delta:s,target:f,should:v,shadowParent:We(f)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(P){return P!==C})},1)},[]),d=l.useCallback(function(i){n.current=A(i),r.current=void 0},[]),y=l.useCallback(function(i){p(i.type,J(i),i.target,o(i,e.lockRef.current))},[]),S=l.useCallback(function(i){p(i.type,A(i),i.target,o(i,e.lockRef.current))},[]);l.useEffect(function(){return T.push(c),e.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:S}),document.addEventListener("wheel",g,R),document.addEventListener("touchmove",g,R),document.addEventListener("touchstart",d,R),function(){T=T.filter(function(i){return i!==c}),document.removeEventListener("wheel",g,R),document.removeEventListener("touchmove",g,R),document.removeEventListener("touchstart",d,R)}},[]);var h=e.removeScrollBar,w=e.inert;return l.createElement(l.Fragment,null,w?l.createElement(c,{styles:je(a)}):null,h?l.createElement(Pe,{gapMode:e.gapMode}):null)}function We(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const De=de(F,Ae);var ee=l.forwardRef(function(e,t){return l.createElement(j,k({},e,{ref:t,sideCar:De}))});ee.classNames=j.classNames;const Ve=b.forwardRef((e,t)=>{const[n,r]=b.useState(!1),[a,c]=b.useState(!1),[u,o]=b.useState({label:"",value:""}),[g,p]=b.useState(""),[d,y]=b.useState(),{data:S,...h}=e,w=b.useRef(null),i=b.useRef(null);b.useEffect(()=>{if(a){c(!1);return}if(d!=null&&d.length&&g&&y(void 0),S&&typeof S=="function"){const f=S(g.toLowerCase());if(f instanceof Promise){f.then(v=>{y(v)});return}y(f)}else S&&y(S)},[a]);const s=f=>{const v=f.target;w.current&&!w.current.contains(v)&&i.current&&!i.current.contains(v)&&r(!1)};return b.useEffect(()=>(document.addEventListener("mousedown",s),()=>{document.removeEventListener("mousedown",s)}),[]),E.jsxs("div",{children:[E.jsx("input",{ref:w,onFocus:()=>r(!0),className:"p-2 bg-gray-200 cursor-pointer focus:cursor-text",type:"text",value:u.label,onChange:f=>{p(f.target.value),c(!0),h.onChange&&h.onChange(f)},placeholder:h.placeholder,disabled:h.disabled}),E.jsx("input",{id:`${h.name}-id`,name:`${h.name}-id`,onChange:h.onChange,onBlur:h.onBlur,ref:t,disabled:!0,className:"hidden",type:"text",value:u.value}),n&&d&&d.length>0&&E.jsx(ee,{children:E.jsx("div",{ref:i,className:"absolute z-10 w-full bg-white border border-gray-300 rounded mt-1",children:d.filter(f=>String(f.label).toLowerCase().indexOf(g.toLowerCase()??"")>-1).map((f,v)=>E.jsx("div",{className:"p-2 cursor-pointer hover:bg-gray-100",onClick:()=>{o(f),r(!1)},children:f.label},v))})})]})});x.SearchSelect=Ve,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})}); |
{ | ||
"name": "simple-search-dropdown", | ||
"private": false, | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"main": "./dist/index.umd.js", | ||
@@ -6,0 +6,0 @@ "module": "./dist/index.es.js", |
37912
644