naria-ui 0.1.64 → 0.2.1
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/README.md +87 -76
- package/dist/components/Loading/Loading.d.ts +8 -0
- package/dist/components/Loading/index.d.ts +1 -0
- package/dist/{lib/components → components}/index.d.ts +3 -1
- package/dist/hooks/click-outside.d.ts +3 -0
- package/dist/hooks/is-first-render.d.ts +1 -0
- package/dist/hooks/use-width.d.ts +1 -0
- package/dist/naria-ui.cjs.js +26 -0
- package/dist/naria-ui.es.js +675 -0
- package/dist/utils/navigator.d.ts +3 -0
- package/package.json +26 -27
- package/dist/index.cjs.js +0 -26
- package/dist/index.es.js +0 -669
- /package/dist/{lib/components → components}/Button/Button.d.ts +0 -0
- /package/dist/{lib/components → components}/Button/index.d.ts +0 -0
- /package/dist/{lib/components → components}/Input/Input.d.ts +0 -0
- /package/dist/{lib/components → components}/Input/index.d.ts +0 -0
- /package/dist/{lib/components → components}/Select/Select.d.ts +0 -0
- /package/dist/{lib/components → components}/Select/index.d.ts +0 -0
- /package/dist/{lib/index.d.ts → index.d.ts} +0 -0
|
@@ -0,0 +1,675 @@
|
|
|
1
|
+
import * as M from "react";
|
|
2
|
+
import ue, { useEffect as R, useState as y, useRef as ee } from "react";
|
|
3
|
+
var K = { exports: {} }, V = {};
|
|
4
|
+
/**
|
|
5
|
+
* @license React
|
|
6
|
+
* react-jsx-runtime.production.js
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the MIT license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
var te;
|
|
14
|
+
function de() {
|
|
15
|
+
if (te) return V;
|
|
16
|
+
te = 1;
|
|
17
|
+
var t = Symbol.for("react.transitional.element"), u = Symbol.for("react.fragment");
|
|
18
|
+
function c(h, o, d) {
|
|
19
|
+
var x = null;
|
|
20
|
+
if (d !== void 0 && (x = "" + d), o.key !== void 0 && (x = "" + o.key), "key" in o) {
|
|
21
|
+
d = {};
|
|
22
|
+
for (var s in o)
|
|
23
|
+
s !== "key" && (d[s] = o[s]);
|
|
24
|
+
} else d = o;
|
|
25
|
+
return o = d.ref, {
|
|
26
|
+
$$typeof: t,
|
|
27
|
+
type: h,
|
|
28
|
+
key: x,
|
|
29
|
+
ref: o !== void 0 ? o : null,
|
|
30
|
+
props: d
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return V.Fragment = u, V.jsx = c, V.jsxs = c, V;
|
|
34
|
+
}
|
|
35
|
+
var G = {};
|
|
36
|
+
/**
|
|
37
|
+
* @license React
|
|
38
|
+
* react-jsx-runtime.development.js
|
|
39
|
+
*
|
|
40
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
41
|
+
*
|
|
42
|
+
* This source code is licensed under the MIT license found in the
|
|
43
|
+
* LICENSE file in the root directory of this source tree.
|
|
44
|
+
*/
|
|
45
|
+
var ne;
|
|
46
|
+
function le() {
|
|
47
|
+
return ne || (ne = 1, process.env.NODE_ENV !== "production" && function() {
|
|
48
|
+
function t(e) {
|
|
49
|
+
if (e == null) return null;
|
|
50
|
+
if (typeof e == "function")
|
|
51
|
+
return e.$$typeof === _ ? null : e.displayName || e.name || null;
|
|
52
|
+
if (typeof e == "string") return e;
|
|
53
|
+
switch (e) {
|
|
54
|
+
case L:
|
|
55
|
+
return "Fragment";
|
|
56
|
+
case S:
|
|
57
|
+
return "Profiler";
|
|
58
|
+
case X:
|
|
59
|
+
return "StrictMode";
|
|
60
|
+
case w:
|
|
61
|
+
return "Suspense";
|
|
62
|
+
case F:
|
|
63
|
+
return "SuspenseList";
|
|
64
|
+
case Z:
|
|
65
|
+
return "Activity";
|
|
66
|
+
}
|
|
67
|
+
if (typeof e == "object")
|
|
68
|
+
switch (typeof e.tag == "number" && console.error(
|
|
69
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
70
|
+
), e.$$typeof) {
|
|
71
|
+
case H:
|
|
72
|
+
return "Portal";
|
|
73
|
+
case N:
|
|
74
|
+
return (e.displayName || "Context") + ".Provider";
|
|
75
|
+
case P:
|
|
76
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
77
|
+
case U:
|
|
78
|
+
var i = e.render;
|
|
79
|
+
return e = e.displayName, e || (e = i.displayName || i.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
80
|
+
case g:
|
|
81
|
+
return i = e.displayName || null, i !== null ? i : t(e.type) || "Memo";
|
|
82
|
+
case k:
|
|
83
|
+
i = e._payload, e = e._init;
|
|
84
|
+
try {
|
|
85
|
+
return t(e(i));
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
function u(e) {
|
|
92
|
+
return "" + e;
|
|
93
|
+
}
|
|
94
|
+
function c(e) {
|
|
95
|
+
try {
|
|
96
|
+
u(e);
|
|
97
|
+
var i = !1;
|
|
98
|
+
} catch {
|
|
99
|
+
i = !0;
|
|
100
|
+
}
|
|
101
|
+
if (i) {
|
|
102
|
+
i = console;
|
|
103
|
+
var f = i.error, r = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
104
|
+
return f.call(
|
|
105
|
+
i,
|
|
106
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
107
|
+
r
|
|
108
|
+
), u(e);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function h(e) {
|
|
112
|
+
if (e === L) return "<>";
|
|
113
|
+
if (typeof e == "object" && e !== null && e.$$typeof === k)
|
|
114
|
+
return "<...>";
|
|
115
|
+
try {
|
|
116
|
+
var i = t(e);
|
|
117
|
+
return i ? "<" + i + ">" : "<...>";
|
|
118
|
+
} catch {
|
|
119
|
+
return "<...>";
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function o() {
|
|
123
|
+
var e = v.A;
|
|
124
|
+
return e === null ? null : e.getOwner();
|
|
125
|
+
}
|
|
126
|
+
function d() {
|
|
127
|
+
return Error("react-stack-top-frame");
|
|
128
|
+
}
|
|
129
|
+
function x(e) {
|
|
130
|
+
if (B.call(e, "key")) {
|
|
131
|
+
var i = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
132
|
+
if (i && i.isReactWarning) return !1;
|
|
133
|
+
}
|
|
134
|
+
return e.key !== void 0;
|
|
135
|
+
}
|
|
136
|
+
function s(e, i) {
|
|
137
|
+
function f() {
|
|
138
|
+
$ || ($ = !0, console.error(
|
|
139
|
+
"%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)",
|
|
140
|
+
i
|
|
141
|
+
));
|
|
142
|
+
}
|
|
143
|
+
f.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
144
|
+
get: f,
|
|
145
|
+
configurable: !0
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function T() {
|
|
149
|
+
var e = t(this.type);
|
|
150
|
+
return J[e] || (J[e] = !0, console.error(
|
|
151
|
+
"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."
|
|
152
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
153
|
+
}
|
|
154
|
+
function l(e, i, f, r, E, j, W, z) {
|
|
155
|
+
return f = j.ref, e = {
|
|
156
|
+
$$typeof: D,
|
|
157
|
+
type: e,
|
|
158
|
+
key: i,
|
|
159
|
+
props: j,
|
|
160
|
+
_owner: E
|
|
161
|
+
}, (f !== void 0 ? f : null) !== null ? Object.defineProperty(e, "ref", {
|
|
162
|
+
enumerable: !1,
|
|
163
|
+
get: T
|
|
164
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
165
|
+
configurable: !1,
|
|
166
|
+
enumerable: !1,
|
|
167
|
+
writable: !0,
|
|
168
|
+
value: 0
|
|
169
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
170
|
+
configurable: !1,
|
|
171
|
+
enumerable: !1,
|
|
172
|
+
writable: !0,
|
|
173
|
+
value: null
|
|
174
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
175
|
+
configurable: !1,
|
|
176
|
+
enumerable: !1,
|
|
177
|
+
writable: !0,
|
|
178
|
+
value: W
|
|
179
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
180
|
+
configurable: !1,
|
|
181
|
+
enumerable: !1,
|
|
182
|
+
writable: !0,
|
|
183
|
+
value: z
|
|
184
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
185
|
+
}
|
|
186
|
+
function A(e, i, f, r, E, j, W, z) {
|
|
187
|
+
var p = i.children;
|
|
188
|
+
if (p !== void 0)
|
|
189
|
+
if (r)
|
|
190
|
+
if (b(p)) {
|
|
191
|
+
for (r = 0; r < p.length; r++)
|
|
192
|
+
C(p[r]);
|
|
193
|
+
Object.freeze && Object.freeze(p);
|
|
194
|
+
} else
|
|
195
|
+
console.error(
|
|
196
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
197
|
+
);
|
|
198
|
+
else C(p);
|
|
199
|
+
if (B.call(i, "key")) {
|
|
200
|
+
p = t(e);
|
|
201
|
+
var m = Object.keys(i).filter(function(ce) {
|
|
202
|
+
return ce !== "key";
|
|
203
|
+
});
|
|
204
|
+
r = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", Q[p + r] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
205
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
206
|
+
let props = %s;
|
|
207
|
+
<%s {...props} />
|
|
208
|
+
React keys must be passed directly to JSX without using spread:
|
|
209
|
+
let props = %s;
|
|
210
|
+
<%s key={someKey} {...props} />`,
|
|
211
|
+
r,
|
|
212
|
+
p,
|
|
213
|
+
m,
|
|
214
|
+
p
|
|
215
|
+
), Q[p + r] = !0);
|
|
216
|
+
}
|
|
217
|
+
if (p = null, f !== void 0 && (c(f), p = "" + f), x(i) && (c(i.key), p = "" + i.key), "key" in i) {
|
|
218
|
+
f = {};
|
|
219
|
+
for (var Y in i)
|
|
220
|
+
Y !== "key" && (f[Y] = i[Y]);
|
|
221
|
+
} else f = i;
|
|
222
|
+
return p && s(
|
|
223
|
+
f,
|
|
224
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
225
|
+
), l(
|
|
226
|
+
e,
|
|
227
|
+
p,
|
|
228
|
+
j,
|
|
229
|
+
E,
|
|
230
|
+
o(),
|
|
231
|
+
f,
|
|
232
|
+
W,
|
|
233
|
+
z
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
function C(e) {
|
|
237
|
+
typeof e == "object" && e !== null && e.$$typeof === D && e._store && (e._store.validated = 1);
|
|
238
|
+
}
|
|
239
|
+
var n = ue, D = Symbol.for("react.transitional.element"), H = Symbol.for("react.portal"), L = Symbol.for("react.fragment"), X = Symbol.for("react.strict_mode"), S = Symbol.for("react.profiler"), P = Symbol.for("react.consumer"), N = Symbol.for("react.context"), U = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), F = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), k = Symbol.for("react.lazy"), Z = Symbol.for("react.activity"), _ = Symbol.for("react.client.reference"), v = n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, B = Object.prototype.hasOwnProperty, b = Array.isArray, O = console.createTask ? console.createTask : function() {
|
|
240
|
+
return null;
|
|
241
|
+
};
|
|
242
|
+
n = {
|
|
243
|
+
"react-stack-bottom-frame": function(e) {
|
|
244
|
+
return e();
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
var $, J = {}, I = n["react-stack-bottom-frame"].bind(
|
|
248
|
+
n,
|
|
249
|
+
d
|
|
250
|
+
)(), q = O(h(d)), Q = {};
|
|
251
|
+
G.Fragment = L, G.jsx = function(e, i, f, r, E) {
|
|
252
|
+
var j = 1e4 > v.recentlyCreatedOwnerStacks++;
|
|
253
|
+
return A(
|
|
254
|
+
e,
|
|
255
|
+
i,
|
|
256
|
+
f,
|
|
257
|
+
!1,
|
|
258
|
+
r,
|
|
259
|
+
E,
|
|
260
|
+
j ? Error("react-stack-top-frame") : I,
|
|
261
|
+
j ? O(h(e)) : q
|
|
262
|
+
);
|
|
263
|
+
}, G.jsxs = function(e, i, f, r, E) {
|
|
264
|
+
var j = 1e4 > v.recentlyCreatedOwnerStacks++;
|
|
265
|
+
return A(
|
|
266
|
+
e,
|
|
267
|
+
i,
|
|
268
|
+
f,
|
|
269
|
+
!0,
|
|
270
|
+
r,
|
|
271
|
+
E,
|
|
272
|
+
j ? Error("react-stack-top-frame") : I,
|
|
273
|
+
j ? O(h(e)) : q
|
|
274
|
+
);
|
|
275
|
+
};
|
|
276
|
+
}()), G;
|
|
277
|
+
}
|
|
278
|
+
var oe;
|
|
279
|
+
function fe() {
|
|
280
|
+
return oe || (oe = 1, process.env.NODE_ENV === "production" ? K.exports = de() : K.exports = le()), K.exports;
|
|
281
|
+
}
|
|
282
|
+
var a = fe();
|
|
283
|
+
const re = ({
|
|
284
|
+
classNames: t = {
|
|
285
|
+
wrapper: "",
|
|
286
|
+
color: ""
|
|
287
|
+
}
|
|
288
|
+
}) => /* @__PURE__ */ a.jsxs(
|
|
289
|
+
"svg",
|
|
290
|
+
{
|
|
291
|
+
className: `nariaLoading ${t.wrapper}`,
|
|
292
|
+
"data-prop": "wrapper",
|
|
293
|
+
viewBox: "0 0 64 64",
|
|
294
|
+
fill: "none",
|
|
295
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
296
|
+
children: [
|
|
297
|
+
/* @__PURE__ */ a.jsx(
|
|
298
|
+
"path",
|
|
299
|
+
{
|
|
300
|
+
d: "M32 3C35.8083 3 39.5794 3.75011 43.0978 5.20749C46.6163 6.66488 49.8132 8.80101 52.5061 11.4939C55.199 14.1868 57.3351 17.3837 58.7925 20.9022C60.2499 24.4206 61 28.1917 61 32C61 35.8083 60.2499 39.5794 58.7925 43.0978C57.3351 46.6163 55.199 49.8132 52.5061 52.5061C49.8132 55.199 46.6163 57.3351 43.0978 58.7925C39.5794 60.2499 35.8083 61 32 61C28.1917 61 24.4206 60.2499 20.9022 58.7925C17.3837 57.3351 14.1868 55.199 11.4939 52.5061C8.801 49.8132 6.66487 46.6163 5.20749 43.0978C3.7501 39.5794 3 35.8083 3 32C3 28.1917 3.75011 24.4206 5.2075 20.9022C6.66489 17.3837 8.80101 14.1868 11.4939 11.4939C14.1868 8.80099 17.3838 6.66487 20.9022 5.20749C24.4206 3.7501 28.1917 3 32 3L32 3Z",
|
|
301
|
+
stroke: "currentColor",
|
|
302
|
+
strokeWidth: "6",
|
|
303
|
+
strokeLinecap: "round",
|
|
304
|
+
strokeLinejoin: "round"
|
|
305
|
+
}
|
|
306
|
+
),
|
|
307
|
+
/* @__PURE__ */ a.jsx(
|
|
308
|
+
"path",
|
|
309
|
+
{
|
|
310
|
+
d: "M32 3C36.5778 3 41.0906 4.08374 45.1692 6.16256C49.2477 8.24138 52.7762 11.2562 55.466 14.9605C58.1558 18.6647 59.9304 22.9531 60.6448 27.4748C61.3591 31.9965 60.9928 36.6232 59.5759 40.9762",
|
|
311
|
+
stroke: "currentColor",
|
|
312
|
+
strokeWidth: "6",
|
|
313
|
+
strokeLinecap: "round",
|
|
314
|
+
strokeLinejoin: "round",
|
|
315
|
+
className: t.color,
|
|
316
|
+
"data-prop": "color"
|
|
317
|
+
}
|
|
318
|
+
)
|
|
319
|
+
]
|
|
320
|
+
}
|
|
321
|
+
), ve = ({
|
|
322
|
+
type: t = "button",
|
|
323
|
+
classNames: u = {
|
|
324
|
+
button: "",
|
|
325
|
+
loading: {
|
|
326
|
+
wrapper: "",
|
|
327
|
+
color: ""
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
value: c,
|
|
331
|
+
icon: h = null,
|
|
332
|
+
isLoading: o = !1,
|
|
333
|
+
isDisabled: d = !1,
|
|
334
|
+
...x
|
|
335
|
+
}) => /* @__PURE__ */ a.jsxs(
|
|
336
|
+
"button",
|
|
337
|
+
{
|
|
338
|
+
type: t,
|
|
339
|
+
disabled: d,
|
|
340
|
+
...x,
|
|
341
|
+
className: `nariaButton ${d ? "nariaButton-disabled" : ""} ${u == null ? void 0 : u.button}`,
|
|
342
|
+
"data-prop": "button",
|
|
343
|
+
children: [
|
|
344
|
+
o ? /* @__PURE__ */ a.jsx(re, { classNames: {
|
|
345
|
+
wrapper: u.loading.wrapper,
|
|
346
|
+
color: u.loading.color
|
|
347
|
+
}, "data-prop-wrapper": "wrapper", "data-prop-color": "color" }) : h,
|
|
348
|
+
c
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
), ie = (t) => /* @__PURE__ */ M.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 384 512", fill: "currentColor", ...t }, /* @__PURE__ */ M.createElement("path", { fill: "currentColor", d: "M209.5 369c-9.4 9.4-24.6 9.4-33.9 0L15.5 209c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l143 143 143-143c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-160 160z" })), se = (t) => /* @__PURE__ */ M.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 384 512", fill: "currentColor", ...t }, /* @__PURE__ */ M.createElement("path", { fill: "currentColor", d: "M7.5 105c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l151 151 151-151c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-151 151 151 151c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-151-151-151 151c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l151-151-151-151z" })), ae = (t) => /* @__PURE__ */ M.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", fill: "currentColor", ...t }, /* @__PURE__ */ M.createElement("path", { fill: "currentColor", d: "M368 208a160 160 0 1 0 -320 0 160 160 0 1 0 320 0zM337.1 371.1C301.7 399.2 256.8 416 208 416 93.1 416 0 322.9 0 208S93.1 0 208 0 416 93.1 416 208c0 48.8-16.8 93.7-44.9 129.1L505 471c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L337.1 371.1z" })), we = (t, u, c) => {
|
|
352
|
+
R(() => {
|
|
353
|
+
function h(o) {
|
|
354
|
+
u.current && !u.current.contains(o.target) && (t != null && t.current) && !(t != null && t.current.contains(o.target)) && c();
|
|
355
|
+
}
|
|
356
|
+
return document.addEventListener("mousedown", h), () => {
|
|
357
|
+
document.removeEventListener("mousedown", h);
|
|
358
|
+
};
|
|
359
|
+
}, [t, c]);
|
|
360
|
+
}, pe = () => {
|
|
361
|
+
const [t, u] = y(typeof window < "u" ? window.innerWidth : 0), c = () => u(typeof window < "u" ? window.innerWidth : 0);
|
|
362
|
+
return R(() => (window.addEventListener("resize", c), () => window.removeEventListener("resize", c)), [t]), t;
|
|
363
|
+
}, ge = () => {
|
|
364
|
+
const t = `${window.location.pathname}${window.location.search}`;
|
|
365
|
+
window.history.replaceState(null, "", t);
|
|
366
|
+
}, he = (t) => {
|
|
367
|
+
window.location.hash = t;
|
|
368
|
+
}, xe = (t) => {
|
|
369
|
+
const [u, c] = y(!1);
|
|
370
|
+
return R(() => {
|
|
371
|
+
const h = (o) => {
|
|
372
|
+
window.location.hash !== t ? c(!0) : c(!1);
|
|
373
|
+
};
|
|
374
|
+
return window.addEventListener("hashchange", h), () => {
|
|
375
|
+
window.removeEventListener("hashchange", h);
|
|
376
|
+
};
|
|
377
|
+
}, []), u;
|
|
378
|
+
}, Ee = ({
|
|
379
|
+
options: t,
|
|
380
|
+
label: u,
|
|
381
|
+
hasError: c,
|
|
382
|
+
title: h,
|
|
383
|
+
value: o,
|
|
384
|
+
api: d,
|
|
385
|
+
selected: x,
|
|
386
|
+
placeholder: s,
|
|
387
|
+
disabled: T = !1,
|
|
388
|
+
pagination: l,
|
|
389
|
+
optionFilterLabel: A,
|
|
390
|
+
hasSearch: C = !1,
|
|
391
|
+
classNames: n = {
|
|
392
|
+
wrapper: "",
|
|
393
|
+
label: "",
|
|
394
|
+
title: "",
|
|
395
|
+
button: "",
|
|
396
|
+
input: "",
|
|
397
|
+
listWrapper: "",
|
|
398
|
+
list: "",
|
|
399
|
+
option: "",
|
|
400
|
+
optionActive: "",
|
|
401
|
+
mobileHeader: "",
|
|
402
|
+
errorText: ""
|
|
403
|
+
},
|
|
404
|
+
onSelectChange: D
|
|
405
|
+
}) => {
|
|
406
|
+
let H = !0;
|
|
407
|
+
const L = pe(), X = xe("#select"), [S, P] = y(!1), [N, U] = y(!0), [w, F] = y(null), [g, k] = y(null), [Z, _] = y(""), [v, B] = y({
|
|
408
|
+
page: 1,
|
|
409
|
+
pageLabel: "page",
|
|
410
|
+
size: 20,
|
|
411
|
+
sizeLabel: "size",
|
|
412
|
+
isLoading: !1
|
|
413
|
+
}), b = ee(void 0), O = ee(void 0), $ = ee(void 0), J = async () => {
|
|
414
|
+
if (b != null && b.current)
|
|
415
|
+
try {
|
|
416
|
+
const r = await fetch(b == null ? void 0 : b.current);
|
|
417
|
+
if (!r.ok)
|
|
418
|
+
throw new Error(`Response status: ${r.status}`);
|
|
419
|
+
return await r.json();
|
|
420
|
+
} catch (r) {
|
|
421
|
+
console.error(r.message);
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
R(() => () => {
|
|
425
|
+
H = !1;
|
|
426
|
+
}, []), R(() => {
|
|
427
|
+
if (d != null && d.length) {
|
|
428
|
+
if (b.current = d, b.current.includes((l == null ? void 0 : l.pageLabel) || "page")) {
|
|
429
|
+
const r = new URL(d);
|
|
430
|
+
r.searchParams.set((l == null ? void 0 : l.pageLabel) || "page", ((l == null ? void 0 : l.page) || v.page).toString()), r.searchParams.set((l == null ? void 0 : l.sizeLabel) || "size", ((l == null ? void 0 : l.size) || v.size).toString()), b.current = r.href;
|
|
431
|
+
}
|
|
432
|
+
U(!0), J().then((r) => {
|
|
433
|
+
H && (U(!1), k(r));
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
}, [d, l]), R(() => {
|
|
437
|
+
if (v.isLoading) {
|
|
438
|
+
if (b.current.includes((l == null ? void 0 : l.pageLabel) || "page")) {
|
|
439
|
+
const r = new URL(b.current);
|
|
440
|
+
r.searchParams.set((l == null ? void 0 : l.pageLabel) || "page", v.page.toString()), b.current = r.href;
|
|
441
|
+
}
|
|
442
|
+
J().then((r) => {
|
|
443
|
+
H && (U(!1), B({
|
|
444
|
+
...v,
|
|
445
|
+
isLoading: !1
|
|
446
|
+
}), k([
|
|
447
|
+
...g,
|
|
448
|
+
...r
|
|
449
|
+
]));
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
}, [v]), R(() => {
|
|
453
|
+
var r;
|
|
454
|
+
L < 768 && (S ? (he("select"), document.body.style.overflow = "hidden", (r = $.current) == null || r.focus()) : (window.location.hash && !document.referrer.includes("#") && ge(), document.body.style.overflow = "auto"));
|
|
455
|
+
}, [S]), R(() => {
|
|
456
|
+
x && (t != null && t.length) && (t != null && t.find((r) => r[u] === x) ? F(t == null ? void 0 : t.find((r) => r[u] === x)) : F(x));
|
|
457
|
+
}, [x]), R(() => {
|
|
458
|
+
w && C && (o != null && o.length && (g != null && g.find((r) => r[u] === w[u])) ? _((g == null ? void 0 : g.find((r) => r[u] === w[u])[o]) || "") : _(w));
|
|
459
|
+
}, [w]), R(() => {
|
|
460
|
+
X && P(!1);
|
|
461
|
+
}, [X]), R(() => {
|
|
462
|
+
t != null && t.length && k(t);
|
|
463
|
+
}, [t]);
|
|
464
|
+
const I = () => {
|
|
465
|
+
C && k(t), P((r) => !r);
|
|
466
|
+
}, q = () => {
|
|
467
|
+
C && (k(t), _(typeof w == "string" ? w : w ? w[o] : "")), P(!1);
|
|
468
|
+
}, Q = (r) => {
|
|
469
|
+
C && (o != null && o.length ? _(r[o]) : _(r)), F(r), I(), D && D(r);
|
|
470
|
+
}, e = (r) => {
|
|
471
|
+
if (!w)
|
|
472
|
+
return "";
|
|
473
|
+
if (u != null && u.length && r[u] === w[u])
|
|
474
|
+
return `nariaSelectOption-active ${n == null ? void 0 : n.optionActive}`;
|
|
475
|
+
if (r === w)
|
|
476
|
+
return `nariaSelectOption-active ${n == null ? void 0 : n.optionActive}`;
|
|
477
|
+
}, i = (r) => {
|
|
478
|
+
d != null && d.length && (g != null && g.length) && !v.isLoading && r.target.offsetHeight + r.target.scrollTop >= r.target.scrollHeight - 100 && B({
|
|
479
|
+
page: v.page + 1,
|
|
480
|
+
isLoading: !0
|
|
481
|
+
});
|
|
482
|
+
}, f = (r) => {
|
|
483
|
+
var j, W, z;
|
|
484
|
+
const E = (W = (j = r == null ? void 0 : r.target) == null ? void 0 : j.value) != null && W.length ? t.filter((p) => {
|
|
485
|
+
var m, Y;
|
|
486
|
+
return typeof p == "object" ? p[A != null && A.length ? A : o].includes((m = r == null ? void 0 : r.target) == null ? void 0 : m.value) : p.includes((Y = r == null ? void 0 : r.target) == null ? void 0 : Y.value);
|
|
487
|
+
}) : t;
|
|
488
|
+
k(E), _((z = r == null ? void 0 : r.target) == null ? void 0 : z.value), S || P(!0);
|
|
489
|
+
};
|
|
490
|
+
return we(O, $, q), /* @__PURE__ */ a.jsxs(
|
|
491
|
+
"div",
|
|
492
|
+
{
|
|
493
|
+
className: `nariaSelect ${T ? "nariaSelect-disabled" : ""} ${n == null ? void 0 : n.wrapper}`,
|
|
494
|
+
"data-prop": "wrapper",
|
|
495
|
+
children: [
|
|
496
|
+
/* @__PURE__ */ a.jsxs(
|
|
497
|
+
"label",
|
|
498
|
+
{
|
|
499
|
+
className: `${c && "!text-danger-100"}
|
|
500
|
+
${n == null ? void 0 : n.label}`,
|
|
501
|
+
"data-prop": "label",
|
|
502
|
+
children: [
|
|
503
|
+
/* @__PURE__ */ a.jsx("span", { className: n == null ? void 0 : n.title, "data-prop": "title", children: h }),
|
|
504
|
+
C ? /* @__PURE__ */ a.jsxs("div", { className: "nariaSearchInput", children: [
|
|
505
|
+
/* @__PURE__ */ a.jsx(
|
|
506
|
+
"input",
|
|
507
|
+
{
|
|
508
|
+
ref: $,
|
|
509
|
+
placeholder: s != null && s.length ? s : "Select",
|
|
510
|
+
className: `${w ? "text-dark-100" : "text-grey-300"}
|
|
511
|
+
${c && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${n == null ? void 0 : n.input}`,
|
|
512
|
+
value: Z,
|
|
513
|
+
disabled: T,
|
|
514
|
+
type: "text",
|
|
515
|
+
onClick: I,
|
|
516
|
+
onChange: f,
|
|
517
|
+
"data-prop": "input"
|
|
518
|
+
}
|
|
519
|
+
),
|
|
520
|
+
S ? /* @__PURE__ */ a.jsx(
|
|
521
|
+
ae,
|
|
522
|
+
{
|
|
523
|
+
className: "nariaSearchIcon"
|
|
524
|
+
}
|
|
525
|
+
) : /* @__PURE__ */ a.jsx(
|
|
526
|
+
ie,
|
|
527
|
+
{
|
|
528
|
+
className: `nariaArrowIcon ${S ? "nariaArrowIcon-rotate-180" : ""}`
|
|
529
|
+
}
|
|
530
|
+
)
|
|
531
|
+
] }) : /* @__PURE__ */ a.jsxs(
|
|
532
|
+
"button",
|
|
533
|
+
{
|
|
534
|
+
type: "button",
|
|
535
|
+
ref: $,
|
|
536
|
+
disabled: T,
|
|
537
|
+
className: `nariaHandler ${w ? "text-dark-100" : "text-grey-300"}
|
|
538
|
+
${c && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${n == null ? void 0 : n.button}`,
|
|
539
|
+
"data-prop": "button",
|
|
540
|
+
onClick: I,
|
|
541
|
+
children: [
|
|
542
|
+
w ? o != null && o.length ? w[o] : w : s != null && s.length ? s : "Select",
|
|
543
|
+
" ",
|
|
544
|
+
/* @__PURE__ */ a.jsx(
|
|
545
|
+
ie,
|
|
546
|
+
{
|
|
547
|
+
className: `nariaArrowIcon ${S ? "nariaArrowIcon-rotate-180" : ""}`
|
|
548
|
+
}
|
|
549
|
+
)
|
|
550
|
+
]
|
|
551
|
+
}
|
|
552
|
+
)
|
|
553
|
+
]
|
|
554
|
+
}
|
|
555
|
+
),
|
|
556
|
+
S ? /* @__PURE__ */ a.jsx(
|
|
557
|
+
"div",
|
|
558
|
+
{
|
|
559
|
+
className: `nariaListWrapper ${L < 768 ? "nariaListWrapper-mobile" : ""} ${n == null ? void 0 : n.listWrapper}`,
|
|
560
|
+
"data-prop": "listWrapper",
|
|
561
|
+
ref: O,
|
|
562
|
+
children: /* @__PURE__ */ a.jsx(
|
|
563
|
+
"div",
|
|
564
|
+
{
|
|
565
|
+
className: `nariaList ${L < 768 ? "nariaList-mobile" : "nariaList-desktop"} ${n == null ? void 0 : n.list}`,
|
|
566
|
+
"data-prop": "input",
|
|
567
|
+
onScroll: i,
|
|
568
|
+
children: d && N ? /* @__PURE__ */ a.jsx("div", { className: "nariaLoadingWrapper", children: /* @__PURE__ */ a.jsx(re, {}) }) : /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
569
|
+
L < 768 ? /* @__PURE__ */ a.jsxs(
|
|
570
|
+
"div",
|
|
571
|
+
{
|
|
572
|
+
className: `nariaSelectMobileHeader ${n == null ? void 0 : n.mobileHeader}`,
|
|
573
|
+
"data-prop": "mobileHeader",
|
|
574
|
+
children: [
|
|
575
|
+
C ? /* @__PURE__ */ a.jsxs("div", { className: "nariaSearchInput", children: [
|
|
576
|
+
/* @__PURE__ */ a.jsx(
|
|
577
|
+
"input",
|
|
578
|
+
{
|
|
579
|
+
ref: $,
|
|
580
|
+
placeholder: s != null && s.length ? s : "Select",
|
|
581
|
+
className: `${w ? "text-dark-100" : "text-grey-300"}
|
|
582
|
+
${c && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${n == null ? void 0 : n.input}`,
|
|
583
|
+
"data-prop": "input",
|
|
584
|
+
value: Z,
|
|
585
|
+
disabled: T,
|
|
586
|
+
type: "text",
|
|
587
|
+
onChange: f
|
|
588
|
+
}
|
|
589
|
+
),
|
|
590
|
+
/* @__PURE__ */ a.jsx(
|
|
591
|
+
ae,
|
|
592
|
+
{
|
|
593
|
+
className: "nariaSearchIcon"
|
|
594
|
+
}
|
|
595
|
+
)
|
|
596
|
+
] }) : void 0,
|
|
597
|
+
/* @__PURE__ */ a.jsx("button", { className: "p-3", onClick: q, disabled: T, children: /* @__PURE__ */ a.jsx(se, { className: "w-6" }) })
|
|
598
|
+
]
|
|
599
|
+
}
|
|
600
|
+
) : void 0,
|
|
601
|
+
g != null && g.length ? /* @__PURE__ */ a.jsx(a.Fragment, { children: g == null ? void 0 : g.map((r, E) => /* @__PURE__ */ a.jsx(
|
|
602
|
+
"button",
|
|
603
|
+
{
|
|
604
|
+
type: "button",
|
|
605
|
+
onClick: () => Q(r),
|
|
606
|
+
disabled: T,
|
|
607
|
+
className: `nariaSelectOption ${n == null ? void 0 : n.option} ${e(r)}`,
|
|
608
|
+
"data-prop": "option",
|
|
609
|
+
"data-prop-active": "optionActive",
|
|
610
|
+
children: o != null && o.length ? r[o] : r
|
|
611
|
+
},
|
|
612
|
+
E.toString()
|
|
613
|
+
)) }) : /* @__PURE__ */ a.jsx("div", { children: "No Data" }),
|
|
614
|
+
v.isLoading ? /* @__PURE__ */ a.jsx("div", { className: "nariaLoadingMoreWrapper", children: /* @__PURE__ */ a.jsx(re, {}) }) : void 0
|
|
615
|
+
] })
|
|
616
|
+
}
|
|
617
|
+
)
|
|
618
|
+
}
|
|
619
|
+
) : void 0,
|
|
620
|
+
c && /* @__PURE__ */ a.jsx("p", { className: `nariaSelectErrorText ${n == null ? void 0 : n.errorText}`, "data-prop": "errorText", children: c })
|
|
621
|
+
]
|
|
622
|
+
}
|
|
623
|
+
);
|
|
624
|
+
}, je = ({
|
|
625
|
+
type: t = "text",
|
|
626
|
+
placeholder: u,
|
|
627
|
+
classNames: c = {
|
|
628
|
+
wrapper: "",
|
|
629
|
+
label: "",
|
|
630
|
+
title: "",
|
|
631
|
+
input: "",
|
|
632
|
+
errorText: ""
|
|
633
|
+
},
|
|
634
|
+
title: h,
|
|
635
|
+
hasError: o,
|
|
636
|
+
register: d,
|
|
637
|
+
name: x,
|
|
638
|
+
isDisabled: s = !1,
|
|
639
|
+
autocomplete: T = !1,
|
|
640
|
+
...l
|
|
641
|
+
}) => /* @__PURE__ */ a.jsxs("div", { className: `nariaInputWrapper ${c.wrapper}`, "data-prop": "wrapper", children: [
|
|
642
|
+
/* @__PURE__ */ a.jsxs(
|
|
643
|
+
"label",
|
|
644
|
+
{
|
|
645
|
+
htmlFor: x,
|
|
646
|
+
className: `${c.label} ${o && "nariaInputLabel-error"}`,
|
|
647
|
+
"data-prop": "label",
|
|
648
|
+
children: [
|
|
649
|
+
/* @__PURE__ */ a.jsx("span", { className: c == null ? void 0 : c.title, "data-prop": "title", children: h }),
|
|
650
|
+
/* @__PURE__ */ a.jsx(
|
|
651
|
+
"input",
|
|
652
|
+
{
|
|
653
|
+
disabled: s,
|
|
654
|
+
autoComplete: T ? "on" : "off",
|
|
655
|
+
id: x,
|
|
656
|
+
...d,
|
|
657
|
+
...l,
|
|
658
|
+
type: t,
|
|
659
|
+
name: x,
|
|
660
|
+
className: `${c.input} ${o && "nariaInput-error"}`,
|
|
661
|
+
placeholder: u,
|
|
662
|
+
"data-prop": "input"
|
|
663
|
+
}
|
|
664
|
+
)
|
|
665
|
+
]
|
|
666
|
+
}
|
|
667
|
+
),
|
|
668
|
+
o && /* @__PURE__ */ a.jsx("p", { className: `nariaInputErrorText ${c == null ? void 0 : c.errorText}`, "data-prop": "errorText", children: o })
|
|
669
|
+
] });
|
|
670
|
+
export {
|
|
671
|
+
ve as Button,
|
|
672
|
+
je as Input,
|
|
673
|
+
re as Loading,
|
|
674
|
+
Ee as Select
|
|
675
|
+
};
|