react-drpdwn-ui
Version:
A simple and reusable dropdown UI component for selecting states or departments in React applications.
292 lines (291 loc) • 9.38 kB
JavaScript
import re from "react";
var T = { exports: {} }, R = {};
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var $;
function te() {
if ($) return R;
$ = 1;
var u = Symbol.for("react.transitional.element"), m = Symbol.for("react.fragment");
function i(f, s, a) {
var d = null;
if (a !== void 0 && (d = "" + a), s.key !== void 0 && (d = "" + s.key), "key" in s) {
a = {};
for (var _ in s)
_ !== "key" && (a[_] = s[_]);
} else a = s;
return s = a.ref, {
$$typeof: u,
type: f,
key: d,
ref: s !== void 0 ? s : null,
props: a
};
}
return R.Fragment = m, R.jsx = i, R.jsxs = i, R;
}
var b = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var D;
function ne() {
return D || (D = 1, process.env.NODE_ENV !== "production" && function() {
function u(e) {
if (e == null) return null;
if (typeof e == "function")
return e.$$typeof === Q ? null : e.displayName || e.name || null;
if (typeof e == "string") return e;
switch (e) {
case k:
return "Fragment";
case J:
return "Profiler";
case q:
return "StrictMode";
case X:
return "Suspense";
case B:
return "SuspenseList";
case Z:
return "Activity";
}
if (typeof e == "object")
switch (typeof e.tag == "number" && console.error(
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
), e.$$typeof) {
case U:
return "Portal";
case V:
return (e.displayName || "Context") + ".Provider";
case z:
return (e._context.displayName || "Context") + ".Consumer";
case G:
var r = e.render;
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
case H:
return r = e.displayName || null, r !== null ? r : u(e.type) || "Memo";
case g:
r = e._payload, e = e._init;
try {
return u(e(r));
} catch {
}
}
return null;
}
function m(e) {
return "" + e;
}
function i(e) {
try {
m(e);
var r = !1;
} catch {
r = !0;
}
if (r) {
r = console;
var t = r.error, n = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
return t.call(
r,
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
n
), m(e);
}
}
function f(e) {
if (e === k) return "<>";
if (typeof e == "object" && e !== null && e.$$typeof === g)
return "<...>";
try {
var r = u(e);
return r ? "<" + r + ">" : "<...>";
} catch {
return "<...>";
}
}
function s() {
var e = O.A;
return e === null ? null : e.getOwner();
}
function a() {
return Error("react-stack-top-frame");
}
function d(e) {
if (y.call(e, "key")) {
var r = Object.getOwnPropertyDescriptor(e, "key").get;
if (r && r.isReactWarning) return !1;
}
return e.key !== void 0;
}
function _(e, r) {
function t() {
N || (N = !0, console.error(
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
r
));
}
t.isReactWarning = !0, Object.defineProperty(e, "key", {
get: t,
configurable: !0
});
}
function M() {
var e = u(this.type);
return C[e] || (C[e] = !0, console.error(
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
)), e = this.props.ref, e !== void 0 ? e : null;
}
function W(e, r, t, n, c, l, j, x) {
return t = l.ref, e = {
$$typeof: h,
type: e,
key: r,
props: l,
_owner: c
}, (t !== void 0 ? t : null) !== null ? Object.defineProperty(e, "ref", {
enumerable: !1,
get: M
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: 0
}), Object.defineProperty(e, "_debugInfo", {
configurable: !1,
enumerable: !1,
writable: !0,
value: null
}), Object.defineProperty(e, "_debugStack", {
configurable: !1,
enumerable: !1,
writable: !0,
value: j
}), Object.defineProperty(e, "_debugTask", {
configurable: !1,
enumerable: !1,
writable: !0,
value: x
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
}
function w(e, r, t, n, c, l, j, x) {
var o = r.children;
if (o !== void 0)
if (n)
if (K(o)) {
for (n = 0; n < o.length; n++)
P(o[n]);
Object.freeze && Object.freeze(o);
} else
console.error(
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
);
else P(o);
if (y.call(r, "key")) {
o = u(e);
var E = Object.keys(r).filter(function(ee) {
return ee !== "key";
});
n = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", I[o + n] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,
n,
o,
E,
o
), I[o + n] = !0);
}
if (o = null, t !== void 0 && (i(t), o = "" + t), d(r) && (i(r.key), o = "" + r.key), "key" in r) {
t = {};
for (var S in r)
S !== "key" && (t[S] = r[S]);
} else t = r;
return o && _(
t,
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
), W(
e,
o,
l,
c,
s(),
t,
j,
x
);
}
function P(e) {
typeof e == "object" && e !== null && e.$$typeof === h && e._store && (e._store.validated = 1);
}
var v = re, h = Symbol.for("react.transitional.element"), U = Symbol.for("react.portal"), k = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), J = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), V = Symbol.for("react.context"), G = Symbol.for("react.forward_ref"), X = Symbol.for("react.suspense"), B = Symbol.for("react.suspense_list"), H = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), Z = Symbol.for("react.activity"), Q = Symbol.for("react.client.reference"), O = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, y = Object.prototype.hasOwnProperty, K = Array.isArray, A = console.createTask ? console.createTask : function() {
return null;
};
v = {
react_stack_bottom_frame: function(e) {
return e();
}
};
var N, C = {}, Y = v.react_stack_bottom_frame.bind(
v,
a
)(), F = A(f(a)), I = {};
b.Fragment = k, b.jsx = function(e, r, t, n, c) {
var l = 1e4 > O.recentlyCreatedOwnerStacks++;
return w(
e,
r,
t,
!1,
n,
c,
l ? Error("react-stack-top-frame") : Y,
l ? A(f(e)) : F
);
}, b.jsxs = function(e, r, t, n, c) {
var l = 1e4 > O.recentlyCreatedOwnerStacks++;
return w(
e,
r,
t,
!0,
n,
c,
l ? Error("react-stack-top-frame") : Y,
l ? A(f(e)) : F
);
};
}()), b;
}
var L;
function oe() {
return L || (L = 1, process.env.NODE_ENV === "production" ? T.exports = te() : T.exports = ne()), T.exports;
}
var p = oe();
function se({ id: u, label: m, value: i, options: f, onChange: s }) {
return /* @__PURE__ */ p.jsxs("div", { className: "dropdown", children: [
/* @__PURE__ */ p.jsx("label", { htmlFor: u, children: m }),
/* @__PURE__ */ p.jsx("select", { id: u, value: i, onChange: s, children: f.map((a, d) => /* @__PURE__ */ p.jsx("option", { value: a.value || a, children: a.label || a }, d)) })
] });
}
export {
se as Dropdown
};
//# sourceMappingURL=index.es.js.map