naria-ui 0.1.55 → 0.1.57
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/lib/components/Button/Button.d.ts +16 -0
- package/dist/lib/components/Button/index.d.ts +1 -0
- package/dist/lib/components/Input/Input.d.ts +19 -0
- package/dist/lib/components/Input/index.d.ts +1 -0
- package/dist/lib/components/Select/Select.d.ts +37 -0
- package/dist/lib/components/Select/index.d.ts +1 -0
- package/dist/lib/components/index.d.ts +3 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/naria-ui.cjs.js +26 -0
- package/dist/naria-ui.css +1 -0
- package/dist/naria-ui.es.js +669 -0
- package/package.json +4 -1
- package/assets/icons/angle-down.svg +0 -1
- package/assets/icons/angle-left.svg +0 -1
- package/assets/icons/angle-right.svg +0 -1
- package/assets/icons/angle-up.svg +0 -1
- package/assets/icons/close.svg +0 -1
- package/assets/icons/search.svg +0 -1
- package/eslint.config.js +0 -28
- package/hooks/click-outside.ts +0 -17
- package/hooks/is-first-render.ts +0 -7
- package/hooks/use-width.ts +0 -11
- package/index.html +0 -13
- package/lib/components/Button/Button.tsx +0 -47
- package/lib/components/Button/button.scss +0 -9
- package/lib/components/Button/index.ts +0 -1
- package/lib/components/Input/Input.tsx +0 -66
- package/lib/components/Input/index.ts +0 -1
- package/lib/components/Select/Select.tsx +0 -414
- package/lib/components/Select/index.ts +0 -1
- package/lib/components/Select/select.scss +0 -138
- package/lib/components/index.ts +0 -3
- package/lib/index.ts +0 -1
- package/shared/loading/Loading.tsx +0 -35
- package/shared/loading/loading.scss +0 -9
- package/src/App.css +0 -0
- package/src/App.tsx +0 -81
- package/src/index.css +0 -0
- package/src/main.tsx +0 -7
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.app.json +0 -34
- package/tsconfig.build.json +0 -11
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -24
- package/utils/navigator.ts +0 -29
- package/vite.config.ts +0 -50
- /package/{public → dist}/light.css +0 -0
- /package/{public → dist}/light.scss +0 -0
|
@@ -0,0 +1,669 @@
|
|
|
1
|
+
import * as P from "react";
|
|
2
|
+
import le, { useState as A, useEffect as x, useRef as ee } from "react";
|
|
3
|
+
var G = { exports: {} }, U = {};
|
|
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 ce() {
|
|
15
|
+
if (te) return U;
|
|
16
|
+
te = 1;
|
|
17
|
+
var t = Symbol.for("react.transitional.element"), i = Symbol.for("react.fragment");
|
|
18
|
+
function s(f, o, c) {
|
|
19
|
+
var p = null;
|
|
20
|
+
if (c !== void 0 && (p = "" + c), o.key !== void 0 && (p = "" + o.key), "key" in o) {
|
|
21
|
+
c = {};
|
|
22
|
+
for (var m in o)
|
|
23
|
+
m !== "key" && (c[m] = o[m]);
|
|
24
|
+
} else c = o;
|
|
25
|
+
return o = c.ref, {
|
|
26
|
+
$$typeof: t,
|
|
27
|
+
type: f,
|
|
28
|
+
key: p,
|
|
29
|
+
ref: o !== void 0 ? o : null,
|
|
30
|
+
props: c
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return U.Fragment = i, U.jsx = s, U.jsxs = s, U;
|
|
34
|
+
}
|
|
35
|
+
var B = {};
|
|
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 ue() {
|
|
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 === S ? null : e.displayName || e.name || null;
|
|
52
|
+
if (typeof e == "string") return e;
|
|
53
|
+
switch (e) {
|
|
54
|
+
case k:
|
|
55
|
+
return "Fragment";
|
|
56
|
+
case T:
|
|
57
|
+
return "Profiler";
|
|
58
|
+
case J:
|
|
59
|
+
return "StrictMode";
|
|
60
|
+
case u:
|
|
61
|
+
return "Suspense";
|
|
62
|
+
case M:
|
|
63
|
+
return "SuspenseList";
|
|
64
|
+
case q:
|
|
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 z:
|
|
72
|
+
return "Portal";
|
|
73
|
+
case X:
|
|
74
|
+
return (e.displayName || "Context") + ".Provider";
|
|
75
|
+
case $:
|
|
76
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
77
|
+
case Y:
|
|
78
|
+
var n = e.render;
|
|
79
|
+
return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
80
|
+
case _:
|
|
81
|
+
return n = e.displayName || null, n !== null ? n : t(e.type) || "Memo";
|
|
82
|
+
case C:
|
|
83
|
+
n = e._payload, e = e._init;
|
|
84
|
+
try {
|
|
85
|
+
return t(e(n));
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
function i(e) {
|
|
92
|
+
return "" + e;
|
|
93
|
+
}
|
|
94
|
+
function s(e) {
|
|
95
|
+
try {
|
|
96
|
+
i(e);
|
|
97
|
+
var n = !1;
|
|
98
|
+
} catch {
|
|
99
|
+
n = !0;
|
|
100
|
+
}
|
|
101
|
+
if (n) {
|
|
102
|
+
n = console;
|
|
103
|
+
var l = n.error, r = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
104
|
+
return l.call(
|
|
105
|
+
n,
|
|
106
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
107
|
+
r
|
|
108
|
+
), i(e);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function f(e) {
|
|
112
|
+
if (e === k) return "<>";
|
|
113
|
+
if (typeof e == "object" && e !== null && e.$$typeof === C)
|
|
114
|
+
return "<...>";
|
|
115
|
+
try {
|
|
116
|
+
var n = t(e);
|
|
117
|
+
return n ? "<" + n + ">" : "<...>";
|
|
118
|
+
} catch {
|
|
119
|
+
return "<...>";
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function o() {
|
|
123
|
+
var e = w.A;
|
|
124
|
+
return e === null ? null : e.getOwner();
|
|
125
|
+
}
|
|
126
|
+
function c() {
|
|
127
|
+
return Error("react-stack-top-frame");
|
|
128
|
+
}
|
|
129
|
+
function p(e) {
|
|
130
|
+
if (D.call(e, "key")) {
|
|
131
|
+
var n = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
132
|
+
if (n && n.isReactWarning) return !1;
|
|
133
|
+
}
|
|
134
|
+
return e.key !== void 0;
|
|
135
|
+
}
|
|
136
|
+
function m(e, n) {
|
|
137
|
+
function l() {
|
|
138
|
+
L || (L = !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
|
+
n
|
|
141
|
+
));
|
|
142
|
+
}
|
|
143
|
+
l.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
144
|
+
get: l,
|
|
145
|
+
configurable: !0
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function E() {
|
|
149
|
+
var e = t(this.type);
|
|
150
|
+
return F[e] || (F[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 b(e, n, l, r, v, h, Z, Q) {
|
|
155
|
+
return l = h.ref, e = {
|
|
156
|
+
$$typeof: W,
|
|
157
|
+
type: e,
|
|
158
|
+
key: n,
|
|
159
|
+
props: h,
|
|
160
|
+
_owner: v
|
|
161
|
+
}, (l !== void 0 ? l : null) !== null ? Object.defineProperty(e, "ref", {
|
|
162
|
+
enumerable: !1,
|
|
163
|
+
get: E
|
|
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: Z
|
|
179
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
180
|
+
configurable: !1,
|
|
181
|
+
enumerable: !1,
|
|
182
|
+
writable: !0,
|
|
183
|
+
value: Q
|
|
184
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
185
|
+
}
|
|
186
|
+
function I(e, n, l, r, v, h, Z, Q) {
|
|
187
|
+
var g = n.children;
|
|
188
|
+
if (g !== void 0)
|
|
189
|
+
if (r)
|
|
190
|
+
if (j(g)) {
|
|
191
|
+
for (r = 0; r < g.length; r++)
|
|
192
|
+
R(g[r]);
|
|
193
|
+
Object.freeze && Object.freeze(g);
|
|
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 R(g);
|
|
199
|
+
if (D.call(n, "key")) {
|
|
200
|
+
g = t(e);
|
|
201
|
+
var N = Object.keys(n).filter(function(ie) {
|
|
202
|
+
return ie !== "key";
|
|
203
|
+
});
|
|
204
|
+
r = 0 < N.length ? "{key: someKey, " + N.join(": ..., ") + ": ...}" : "{key: someKey}", V[g + r] || (N = 0 < N.length ? "{" + N.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
|
+
g,
|
|
213
|
+
N,
|
|
214
|
+
g
|
|
215
|
+
), V[g + r] = !0);
|
|
216
|
+
}
|
|
217
|
+
if (g = null, l !== void 0 && (s(l), g = "" + l), p(n) && (s(n.key), g = "" + n.key), "key" in n) {
|
|
218
|
+
l = {};
|
|
219
|
+
for (var K in n)
|
|
220
|
+
K !== "key" && (l[K] = n[K]);
|
|
221
|
+
} else l = n;
|
|
222
|
+
return g && m(
|
|
223
|
+
l,
|
|
224
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
225
|
+
), b(
|
|
226
|
+
e,
|
|
227
|
+
g,
|
|
228
|
+
h,
|
|
229
|
+
v,
|
|
230
|
+
o(),
|
|
231
|
+
l,
|
|
232
|
+
Z,
|
|
233
|
+
Q
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
function R(e) {
|
|
237
|
+
typeof e == "object" && e !== null && e.$$typeof === W && e._store && (e._store.validated = 1);
|
|
238
|
+
}
|
|
239
|
+
var d = le, W = Symbol.for("react.transitional.element"), z = Symbol.for("react.portal"), k = Symbol.for("react.fragment"), J = Symbol.for("react.strict_mode"), T = Symbol.for("react.profiler"), $ = Symbol.for("react.consumer"), X = Symbol.for("react.context"), Y = Symbol.for("react.forward_ref"), u = Symbol.for("react.suspense"), M = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), q = Symbol.for("react.activity"), S = Symbol.for("react.client.reference"), w = d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, D = Object.prototype.hasOwnProperty, j = Array.isArray, O = console.createTask ? console.createTask : function() {
|
|
240
|
+
return null;
|
|
241
|
+
};
|
|
242
|
+
d = {
|
|
243
|
+
"react-stack-bottom-frame": function(e) {
|
|
244
|
+
return e();
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
var L, F = {}, y = d["react-stack-bottom-frame"].bind(
|
|
248
|
+
d,
|
|
249
|
+
c
|
|
250
|
+
)(), H = O(f(c)), V = {};
|
|
251
|
+
B.Fragment = k, B.jsx = function(e, n, l, r, v) {
|
|
252
|
+
var h = 1e4 > w.recentlyCreatedOwnerStacks++;
|
|
253
|
+
return I(
|
|
254
|
+
e,
|
|
255
|
+
n,
|
|
256
|
+
l,
|
|
257
|
+
!1,
|
|
258
|
+
r,
|
|
259
|
+
v,
|
|
260
|
+
h ? Error("react-stack-top-frame") : y,
|
|
261
|
+
h ? O(f(e)) : H
|
|
262
|
+
);
|
|
263
|
+
}, B.jsxs = function(e, n, l, r, v) {
|
|
264
|
+
var h = 1e4 > w.recentlyCreatedOwnerStacks++;
|
|
265
|
+
return I(
|
|
266
|
+
e,
|
|
267
|
+
n,
|
|
268
|
+
l,
|
|
269
|
+
!0,
|
|
270
|
+
r,
|
|
271
|
+
v,
|
|
272
|
+
h ? Error("react-stack-top-frame") : y,
|
|
273
|
+
h ? O(f(e)) : H
|
|
274
|
+
);
|
|
275
|
+
};
|
|
276
|
+
}()), B;
|
|
277
|
+
}
|
|
278
|
+
var ae;
|
|
279
|
+
function de() {
|
|
280
|
+
return ae || (ae = 1, process.env.NODE_ENV === "production" ? G.exports = ce() : G.exports = ue()), G.exports;
|
|
281
|
+
}
|
|
282
|
+
var a = de();
|
|
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
|
+
), be = ({
|
|
322
|
+
type: t = "button",
|
|
323
|
+
classNames: i = {
|
|
324
|
+
button: "",
|
|
325
|
+
loading: {
|
|
326
|
+
wrapper: "",
|
|
327
|
+
color: ""
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
value: s,
|
|
331
|
+
icon: f = null,
|
|
332
|
+
isLoading: o = !1,
|
|
333
|
+
isDisabled: c = !1,
|
|
334
|
+
...p
|
|
335
|
+
}) => /* @__PURE__ */ a.jsxs(
|
|
336
|
+
"button",
|
|
337
|
+
{
|
|
338
|
+
type: t,
|
|
339
|
+
disabled: c,
|
|
340
|
+
...p,
|
|
341
|
+
className: `nariaButton ${c ? "nariaButton-disabled" : ""} ${i?.button}`,
|
|
342
|
+
"data-prop": "button",
|
|
343
|
+
children: [
|
|
344
|
+
o ? /* @__PURE__ */ a.jsx(re, { classNames: {
|
|
345
|
+
wrapper: i.loading.wrapper,
|
|
346
|
+
color: i.loading.color
|
|
347
|
+
}, "data-prop-wrapper": "wrapper", "data-prop-color": "color" }) : f,
|
|
348
|
+
s
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
), xe = ({
|
|
352
|
+
type: t = "text",
|
|
353
|
+
placeholder: i,
|
|
354
|
+
classNames: s = {
|
|
355
|
+
wrapper: "",
|
|
356
|
+
label: "",
|
|
357
|
+
title: "",
|
|
358
|
+
input: "",
|
|
359
|
+
errorText: ""
|
|
360
|
+
},
|
|
361
|
+
title: f,
|
|
362
|
+
hasError: o,
|
|
363
|
+
register: c,
|
|
364
|
+
name: p,
|
|
365
|
+
isDisabled: m = !1,
|
|
366
|
+
autocomplete: E = !1,
|
|
367
|
+
...b
|
|
368
|
+
}) => /* @__PURE__ */ a.jsxs("div", { className: `nariaInputWrapper ${s.wrapper}`, "data-prop": "wrapper", children: [
|
|
369
|
+
/* @__PURE__ */ a.jsxs(
|
|
370
|
+
"label",
|
|
371
|
+
{
|
|
372
|
+
htmlFor: p,
|
|
373
|
+
className: `${s.label} ${o && "nariaInputLabel-error"}`,
|
|
374
|
+
"data-prop": "label",
|
|
375
|
+
children: [
|
|
376
|
+
/* @__PURE__ */ a.jsx("span", { className: s?.title, "data-prop": "title", children: f }),
|
|
377
|
+
/* @__PURE__ */ a.jsx(
|
|
378
|
+
"input",
|
|
379
|
+
{
|
|
380
|
+
disabled: m,
|
|
381
|
+
autoComplete: E ? "on" : "off",
|
|
382
|
+
id: p,
|
|
383
|
+
...c,
|
|
384
|
+
...b,
|
|
385
|
+
type: t,
|
|
386
|
+
name: p,
|
|
387
|
+
className: `${s.input} ${o && "nariaInput-error"}`,
|
|
388
|
+
placeholder: i,
|
|
389
|
+
"data-prop": "input"
|
|
390
|
+
}
|
|
391
|
+
)
|
|
392
|
+
]
|
|
393
|
+
}
|
|
394
|
+
),
|
|
395
|
+
o && /* @__PURE__ */ a.jsx("p", { className: `nariaInputErrorText ${s?.errorText}`, "data-prop": "errorText", children: o })
|
|
396
|
+
] }), oe = (t) => /* @__PURE__ */ P.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 384 512", fill: "currentColor", ...t }, /* @__PURE__ */ P.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" })), fe = (t) => /* @__PURE__ */ P.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 384 512", fill: "currentColor", ...t }, /* @__PURE__ */ P.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" })), se = (t) => /* @__PURE__ */ P.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", fill: "currentColor", ...t }, /* @__PURE__ */ P.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" })), pe = () => {
|
|
397
|
+
const [t, i] = A(typeof window < "u" ? window.innerWidth : 0), s = () => i(typeof window < "u" ? window.innerWidth : 0);
|
|
398
|
+
return x(() => (window.addEventListener("resize", s), () => window.removeEventListener("resize", s)), [t]), t;
|
|
399
|
+
}, ge = () => {
|
|
400
|
+
const t = `${window.location.pathname}${window.location.search}`;
|
|
401
|
+
window.history.replaceState(null, "", t);
|
|
402
|
+
}, me = (t) => {
|
|
403
|
+
window.location.hash = t;
|
|
404
|
+
}, he = (t) => {
|
|
405
|
+
const [i, s] = A(!1);
|
|
406
|
+
return x(() => {
|
|
407
|
+
const f = (o) => {
|
|
408
|
+
window.location.hash !== t ? s(!0) : s(!1);
|
|
409
|
+
};
|
|
410
|
+
return window.addEventListener("hashchange", f), () => {
|
|
411
|
+
window.removeEventListener("hashchange", f);
|
|
412
|
+
};
|
|
413
|
+
}, []), i;
|
|
414
|
+
}, we = (t, i, s) => {
|
|
415
|
+
x(() => {
|
|
416
|
+
function f(o) {
|
|
417
|
+
i.current && !i.current.contains(o.target) && t?.current && !t?.current.contains(o.target) && s();
|
|
418
|
+
}
|
|
419
|
+
return document.addEventListener("mousedown", f), () => {
|
|
420
|
+
document.removeEventListener("mousedown", f);
|
|
421
|
+
};
|
|
422
|
+
}, [t, s]);
|
|
423
|
+
}, Ee = ({
|
|
424
|
+
options: t,
|
|
425
|
+
label: i,
|
|
426
|
+
hasError: s,
|
|
427
|
+
title: f,
|
|
428
|
+
value: o,
|
|
429
|
+
api: c,
|
|
430
|
+
selected: p,
|
|
431
|
+
placeholder: m,
|
|
432
|
+
disabled: E = !1,
|
|
433
|
+
pagination: b,
|
|
434
|
+
optionFilterLabel: I,
|
|
435
|
+
hasSearch: R = !1,
|
|
436
|
+
classNames: d = {
|
|
437
|
+
wrapper: "",
|
|
438
|
+
label: "",
|
|
439
|
+
title: "",
|
|
440
|
+
button: "",
|
|
441
|
+
input: "",
|
|
442
|
+
listWrapper: "",
|
|
443
|
+
list: "",
|
|
444
|
+
option: "",
|
|
445
|
+
optionActive: "",
|
|
446
|
+
mobileHeader: "",
|
|
447
|
+
errorText: ""
|
|
448
|
+
},
|
|
449
|
+
onSelectChange: W
|
|
450
|
+
}) => {
|
|
451
|
+
let z = !0;
|
|
452
|
+
const k = pe(), J = he("#select"), [T, $] = A(!1), [X, Y] = A(!0), [u, M] = A(null), [_, C] = A(null), [q, S] = A(""), [w, D] = A({
|
|
453
|
+
page: 1,
|
|
454
|
+
pageLabel: "page",
|
|
455
|
+
size: 20,
|
|
456
|
+
sizeLabel: "size",
|
|
457
|
+
isLoading: !1
|
|
458
|
+
}), j = ee(void 0), O = ee(void 0), L = ee(void 0), F = async () => {
|
|
459
|
+
if (j?.current)
|
|
460
|
+
try {
|
|
461
|
+
const r = await fetch(j?.current);
|
|
462
|
+
if (!r.ok)
|
|
463
|
+
throw new Error(`Response status: ${r.status}`);
|
|
464
|
+
return await r.json();
|
|
465
|
+
} catch (r) {
|
|
466
|
+
console.error(r.message);
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
x(() => () => {
|
|
470
|
+
z = !1;
|
|
471
|
+
}, []), x(() => {
|
|
472
|
+
if (c?.length) {
|
|
473
|
+
if (j.current = c, j.current.includes(b?.pageLabel || "page")) {
|
|
474
|
+
const r = new URL(c);
|
|
475
|
+
r.searchParams.set(b?.pageLabel || "page", (b?.page || w.page).toString()), r.searchParams.set(b?.sizeLabel || "size", (b?.size || w.size).toString()), j.current = r.href;
|
|
476
|
+
}
|
|
477
|
+
Y(!0), F().then((r) => {
|
|
478
|
+
z && (Y(!1), C(r));
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
}, [c, b]), x(() => {
|
|
482
|
+
if (w.isLoading) {
|
|
483
|
+
if (j.current.includes(b?.pageLabel || "page")) {
|
|
484
|
+
const r = new URL(j.current);
|
|
485
|
+
r.searchParams.set(b?.pageLabel || "page", w.page.toString()), j.current = r.href;
|
|
486
|
+
}
|
|
487
|
+
F().then((r) => {
|
|
488
|
+
z && (Y(!1), D({
|
|
489
|
+
...w,
|
|
490
|
+
isLoading: !1
|
|
491
|
+
}), C([
|
|
492
|
+
..._,
|
|
493
|
+
...r
|
|
494
|
+
]));
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
}, [w]), x(() => {
|
|
498
|
+
k < 768 && (T ? (me("select"), document.body.style.overflow = "hidden", L.current?.focus()) : (window.location.hash && !document.referrer.includes("#") && ge(), document.body.style.overflow = "auto"));
|
|
499
|
+
}, [T]), x(() => {
|
|
500
|
+
p && t?.length && (t?.find((r) => r[i] === p) ? M(t?.find((r) => r[i] === p)) : M(p));
|
|
501
|
+
}, [p]), x(() => {
|
|
502
|
+
u && R && (o?.length && _?.find((r) => r[i] === u[i]) ? S(_?.find((r) => r[i] === u[i])[o] || "") : S(u));
|
|
503
|
+
}, [u]), x(() => {
|
|
504
|
+
J && $(!1);
|
|
505
|
+
}, [J]), x(() => {
|
|
506
|
+
t?.length && C(t);
|
|
507
|
+
}, [t]);
|
|
508
|
+
const y = () => {
|
|
509
|
+
R && C(t), $((r) => !r);
|
|
510
|
+
}, H = () => {
|
|
511
|
+
R && (C(t), S(typeof u == "string" ? u : u ? u[o] : "")), $(!1);
|
|
512
|
+
}, V = (r) => {
|
|
513
|
+
R && (o?.length ? S(r[o]) : S(r)), M(r), y(), W && W(r);
|
|
514
|
+
}, e = (r) => {
|
|
515
|
+
if (!u)
|
|
516
|
+
return "";
|
|
517
|
+
if (i?.length && r[i] === u[i])
|
|
518
|
+
return `nariaSelectOption-active ${d?.optionActive}`;
|
|
519
|
+
if (r === u)
|
|
520
|
+
return `nariaSelectOption-active ${d?.optionActive}`;
|
|
521
|
+
}, n = (r) => {
|
|
522
|
+
c?.length && _?.length && !w.isLoading && r.target.offsetHeight + r.target.scrollTop >= r.target.scrollHeight - 100 && D({
|
|
523
|
+
page: w.page + 1,
|
|
524
|
+
isLoading: !0
|
|
525
|
+
});
|
|
526
|
+
}, l = (r) => {
|
|
527
|
+
const v = r?.target?.value?.length ? t.filter((h) => typeof h == "object" ? h[I?.length ? I : o].includes(r?.target?.value) : h.includes(r?.target?.value)) : t;
|
|
528
|
+
C(v), S(r?.target?.value), T || $(!0);
|
|
529
|
+
};
|
|
530
|
+
return we(O, L, H), /* @__PURE__ */ a.jsxs(
|
|
531
|
+
"div",
|
|
532
|
+
{
|
|
533
|
+
className: `nariaSelect ${E ? "nariaSelect-disabled" : ""} ${d?.wrapper}`,
|
|
534
|
+
"data-prop": "wrapper",
|
|
535
|
+
children: [
|
|
536
|
+
/* @__PURE__ */ a.jsxs(
|
|
537
|
+
"label",
|
|
538
|
+
{
|
|
539
|
+
className: `${s && "!text-danger-100"}
|
|
540
|
+
${d?.label}`,
|
|
541
|
+
"data-prop": "label",
|
|
542
|
+
children: [
|
|
543
|
+
/* @__PURE__ */ a.jsx("span", { className: d?.title, "data-prop": "title", children: f }),
|
|
544
|
+
R ? /* @__PURE__ */ a.jsxs("div", { className: "nariaSearchInput", children: [
|
|
545
|
+
/* @__PURE__ */ a.jsx(
|
|
546
|
+
"input",
|
|
547
|
+
{
|
|
548
|
+
ref: L,
|
|
549
|
+
placeholder: m?.length ? m : "Select",
|
|
550
|
+
className: `${u ? "text-dark-100" : "text-grey-300"}
|
|
551
|
+
${s && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${d?.input}`,
|
|
552
|
+
value: q,
|
|
553
|
+
disabled: E,
|
|
554
|
+
type: "text",
|
|
555
|
+
onClick: y,
|
|
556
|
+
onChange: l,
|
|
557
|
+
"data-prop": "input"
|
|
558
|
+
}
|
|
559
|
+
),
|
|
560
|
+
T ? /* @__PURE__ */ a.jsx(
|
|
561
|
+
se,
|
|
562
|
+
{
|
|
563
|
+
className: "nariaSearchIcon"
|
|
564
|
+
}
|
|
565
|
+
) : /* @__PURE__ */ a.jsx(
|
|
566
|
+
oe,
|
|
567
|
+
{
|
|
568
|
+
className: `nariaArrowIcon ${T ? "nariaArrowIcon-rotate-180" : ""}`
|
|
569
|
+
}
|
|
570
|
+
)
|
|
571
|
+
] }) : /* @__PURE__ */ a.jsxs(
|
|
572
|
+
"button",
|
|
573
|
+
{
|
|
574
|
+
type: "button",
|
|
575
|
+
ref: L,
|
|
576
|
+
disabled: E,
|
|
577
|
+
className: `nariaHandler ${u ? "text-dark-100" : "text-grey-300"}
|
|
578
|
+
${s && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${d?.button}`,
|
|
579
|
+
"data-prop": "button",
|
|
580
|
+
onClick: y,
|
|
581
|
+
children: [
|
|
582
|
+
u ? o?.length ? u[o] : u : m?.length ? m : "Select",
|
|
583
|
+
" ",
|
|
584
|
+
/* @__PURE__ */ a.jsx(
|
|
585
|
+
oe,
|
|
586
|
+
{
|
|
587
|
+
className: `nariaArrowIcon ${T ? "nariaArrowIcon-rotate-180" : ""}`
|
|
588
|
+
}
|
|
589
|
+
)
|
|
590
|
+
]
|
|
591
|
+
}
|
|
592
|
+
)
|
|
593
|
+
]
|
|
594
|
+
}
|
|
595
|
+
),
|
|
596
|
+
T ? /* @__PURE__ */ a.jsx(
|
|
597
|
+
"div",
|
|
598
|
+
{
|
|
599
|
+
className: `nariaListWrapper ${k < 768 ? "nariaListWrapper-mobile" : ""} ${d?.listWrapper}`,
|
|
600
|
+
"data-prop": "listWrapper",
|
|
601
|
+
ref: O,
|
|
602
|
+
children: /* @__PURE__ */ a.jsx(
|
|
603
|
+
"div",
|
|
604
|
+
{
|
|
605
|
+
className: `nariaList ${k < 768 ? "nariaList-mobile" : "nariaList-desktop"} ${d?.list}`,
|
|
606
|
+
"data-prop": "input",
|
|
607
|
+
onScroll: n,
|
|
608
|
+
children: c && X ? /* @__PURE__ */ a.jsx("div", { className: "nariaLoadingWrapper", children: /* @__PURE__ */ a.jsx(re, {}) }) : /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
609
|
+
k < 768 ? /* @__PURE__ */ a.jsxs(
|
|
610
|
+
"div",
|
|
611
|
+
{
|
|
612
|
+
className: `nariaSelectMobileHeader ${d?.mobileHeader}`,
|
|
613
|
+
"data-prop": "mobileHeader",
|
|
614
|
+
children: [
|
|
615
|
+
R ? /* @__PURE__ */ a.jsxs("div", { className: "nariaSearchInput", children: [
|
|
616
|
+
/* @__PURE__ */ a.jsx(
|
|
617
|
+
"input",
|
|
618
|
+
{
|
|
619
|
+
ref: L,
|
|
620
|
+
placeholder: m?.length ? m : "Select",
|
|
621
|
+
className: `${u ? "text-dark-100" : "text-grey-300"}
|
|
622
|
+
${s && "!border-danger-100 focus:border-danger-100 outline-danger-100"} ${d?.input}`,
|
|
623
|
+
"data-prop": "input",
|
|
624
|
+
value: q,
|
|
625
|
+
disabled: E,
|
|
626
|
+
type: "text",
|
|
627
|
+
onChange: l
|
|
628
|
+
}
|
|
629
|
+
),
|
|
630
|
+
/* @__PURE__ */ a.jsx(
|
|
631
|
+
se,
|
|
632
|
+
{
|
|
633
|
+
className: "nariaSearchIcon"
|
|
634
|
+
}
|
|
635
|
+
)
|
|
636
|
+
] }) : void 0,
|
|
637
|
+
/* @__PURE__ */ a.jsx("button", { className: "p-3", onClick: H, disabled: E, children: /* @__PURE__ */ a.jsx(fe, { className: "w-6" }) })
|
|
638
|
+
]
|
|
639
|
+
}
|
|
640
|
+
) : void 0,
|
|
641
|
+
_?.length ? /* @__PURE__ */ a.jsx(a.Fragment, { children: _?.map((r, v) => /* @__PURE__ */ a.jsx(
|
|
642
|
+
"button",
|
|
643
|
+
{
|
|
644
|
+
type: "button",
|
|
645
|
+
onClick: () => V(r),
|
|
646
|
+
disabled: E,
|
|
647
|
+
className: `nariaSelectOption ${d?.option} ${e(r)}`,
|
|
648
|
+
"data-prop": "option",
|
|
649
|
+
"data-prop-active": "optionActive",
|
|
650
|
+
children: o?.length ? r[o] : r
|
|
651
|
+
},
|
|
652
|
+
v.toString()
|
|
653
|
+
)) }) : /* @__PURE__ */ a.jsx("div", { children: "No Data" }),
|
|
654
|
+
w.isLoading ? /* @__PURE__ */ a.jsx("div", { className: "nariaLoadingMoreWrapper", children: /* @__PURE__ */ a.jsx(re, {}) }) : void 0
|
|
655
|
+
] })
|
|
656
|
+
}
|
|
657
|
+
)
|
|
658
|
+
}
|
|
659
|
+
) : void 0,
|
|
660
|
+
s && /* @__PURE__ */ a.jsx("p", { className: `nariaSelectErrorText ${d?.errorText}`, "data-prop": "errorText", children: s })
|
|
661
|
+
]
|
|
662
|
+
}
|
|
663
|
+
);
|
|
664
|
+
};
|
|
665
|
+
export {
|
|
666
|
+
be as Button,
|
|
667
|
+
xe as Input,
|
|
668
|
+
Ee as Select
|
|
669
|
+
};
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "Mohammad Mehdi Mohammadi",
|
|
6
6
|
"url": ""
|
|
7
7
|
},
|
|
8
|
-
"version": "0.1.
|
|
8
|
+
"version": "0.1.57",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"main": "./dist/naria-ui.cjs.js",
|
|
11
11
|
"module": "./dist/naria-ui.es.js",
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
"require": "./dist/naria-ui.cjs.js"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
20
23
|
"publishConfig": {
|
|
21
24
|
"access": "public"
|
|
22
25
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="currentColor"><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"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512" fill="currentColor"><path fill="currentColor" d="M15.5 239c-9.4 9.4-9.4 24.6 0 33.9l160 160c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-143-143 143-143c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0L15.5 239z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512" fill="currentColor"><path fill="currentColor" d="M241.5 239c9.4 9.4 9.4 24.6 0 33.9L81.5 433c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l143-143-143-143c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l160 160z"/></svg>
|