@cagatayfdn/flora-components 0.0.109 → 0.0.111

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.
@@ -1,359 +0,0 @@
1
- import * as m from "react";
2
- import "react-dom";
3
- import { a as D, u as I, D as Y, N as F, s as E, i as S, m as W, w as j, b as J, c as Q, d as Z, e as A, f as $, R as ee, j as te } from "./index-9ZLCCecr.js";
4
- /**
5
- * React Router DOM v6.22.0
6
- *
7
- * Copyright (c) Remix Software Inc.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE.md file in the root directory of this source tree.
11
- *
12
- * @license MIT
13
- */
14
- function N() {
15
- return N = Object.assign ? Object.assign.bind() : function(e) {
16
- for (var n = 1; n < arguments.length; n++) {
17
- var r = arguments[n];
18
- for (var a in r)
19
- Object.prototype.hasOwnProperty.call(r, a) && (e[a] = r[a]);
20
- }
21
- return e;
22
- }, N.apply(this, arguments);
23
- }
24
- function K(e, n) {
25
- if (e == null)
26
- return {};
27
- var r = {}, a = Object.keys(e), t, i;
28
- for (i = 0; i < a.length; i++)
29
- t = a[i], !(n.indexOf(t) >= 0) && (r[t] = e[t]);
30
- return r;
31
- }
32
- const _ = "get", L = "application/x-www-form-urlencoded";
33
- function P(e) {
34
- return e != null && typeof e.tagName == "string";
35
- }
36
- function ne(e) {
37
- return P(e) && e.tagName.toLowerCase() === "button";
38
- }
39
- function re(e) {
40
- return P(e) && e.tagName.toLowerCase() === "form";
41
- }
42
- function ae(e) {
43
- return P(e) && e.tagName.toLowerCase() === "input";
44
- }
45
- function ie(e) {
46
- return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
47
- }
48
- function oe(e, n) {
49
- return e.button === 0 && // Ignore everything but left clicks
50
- (!n || n === "_self") && // Let browser handle "target=_blank" etc.
51
- !ie(e);
52
- }
53
- let R = null;
54
- function le() {
55
- if (R === null)
56
- try {
57
- new FormData(
58
- document.createElement("form"),
59
- // @ts-expect-error if FormData supports the submitter parameter, this will throw
60
- 0
61
- ), R = !1;
62
- } catch {
63
- R = !0;
64
- }
65
- return R;
66
- }
67
- const se = /* @__PURE__ */ new Set(["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"]);
68
- function k(e) {
69
- return e != null && !se.has(e) ? (process.env.NODE_ENV !== "production" && j(!1, '"' + e + '" is not a valid `encType` for `<Form>`/`<fetcher.Form>` ' + ('and will default to "' + L + '"')), null) : e;
70
- }
71
- function ue(e, n) {
72
- let r, a, t, i, o;
73
- if (re(e)) {
74
- let s = e.getAttribute("action");
75
- a = s ? E(s, n) : null, r = e.getAttribute("method") || _, t = k(e.getAttribute("enctype")) || L, i = new FormData(e);
76
- } else if (ne(e) || ae(e) && (e.type === "submit" || e.type === "image")) {
77
- let s = e.form;
78
- if (s == null)
79
- throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');
80
- let u = e.getAttribute("formaction") || s.getAttribute("action");
81
- if (a = u ? E(u, n) : null, r = e.getAttribute("formmethod") || s.getAttribute("method") || _, t = k(e.getAttribute("formenctype")) || k(s.getAttribute("enctype")) || L, i = new FormData(s, e), !le()) {
82
- let {
83
- name: l,
84
- type: p,
85
- value: v
86
- } = e;
87
- if (p === "image") {
88
- let h = l ? l + "." : "";
89
- i.append(h + "x", "0"), i.append(h + "y", "0");
90
- } else
91
- l && i.append(l, v);
92
- }
93
- } else {
94
- if (P(e))
95
- throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');
96
- r = _, a = null, t = L, o = e;
97
- }
98
- return i && t === "text/plain" && (o = i, i = void 0), {
99
- action: a,
100
- method: r.toLowerCase(),
101
- encType: t,
102
- formData: i,
103
- body: o
104
- };
105
- }
106
- const ce = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset", "unstable_viewTransition"], fe = ["aria-current", "caseSensitive", "className", "end", "style", "to", "unstable_viewTransition", "children"], me = ["fetcherKey", "navigate", "reloadDocument", "replace", "state", "method", "action", "onSubmit", "relative", "preventScrollReset", "unstable_viewTransition"], de = "6";
107
- try {
108
- window.__reactRouterVersion = de;
109
- } catch {
110
- }
111
- const z = /* @__PURE__ */ m.createContext({
112
- isTransitioning: !1
113
- });
114
- process.env.NODE_ENV !== "production" && (z.displayName = "ViewTransition");
115
- const pe = /* @__PURE__ */ m.createContext(/* @__PURE__ */ new Map());
116
- process.env.NODE_ENV !== "production" && (pe.displayName = "Fetchers");
117
- process.env.NODE_ENV;
118
- const he = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", ve = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, q = /* @__PURE__ */ m.forwardRef(function(n, r) {
119
- let {
120
- onClick: a,
121
- relative: t,
122
- reloadDocument: i,
123
- replace: o,
124
- state: s,
125
- target: u,
126
- to: l,
127
- preventScrollReset: p,
128
- unstable_viewTransition: v
129
- } = n, h = K(n, ce), {
130
- basename: x
131
- } = m.useContext(F), b, w = !1;
132
- if (typeof l == "string" && ve.test(l) && (b = l, he))
133
- try {
134
- let d = new URL(window.location.href), f = l.startsWith("//") ? new URL(d.protocol + l) : new URL(l), C = E(f.pathname, x);
135
- f.origin === d.origin && C != null ? l = C + f.search + f.hash : w = !0;
136
- } catch {
137
- process.env.NODE_ENV !== "production" && j(!1, '<Link to="' + l + '"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.');
138
- }
139
- let y = J(l, {
140
- relative: t
141
- }), g = ge(l, {
142
- replace: o,
143
- state: s,
144
- target: u,
145
- preventScrollReset: p,
146
- relative: t,
147
- unstable_viewTransition: v
148
- });
149
- function c(d) {
150
- a && a(d), d.defaultPrevented || g(d);
151
- }
152
- return (
153
- // eslint-disable-next-line jsx-a11y/anchor-has-content
154
- /* @__PURE__ */ m.createElement("a", N({}, h, {
155
- href: b || y,
156
- onClick: w || i ? a : c,
157
- ref: r,
158
- target: u
159
- }))
160
- );
161
- });
162
- process.env.NODE_ENV !== "production" && (q.displayName = "Link");
163
- const be = /* @__PURE__ */ m.forwardRef(function(n, r) {
164
- let {
165
- "aria-current": a = "page",
166
- caseSensitive: t = !1,
167
- className: i = "",
168
- end: o = !1,
169
- style: s,
170
- to: u,
171
- unstable_viewTransition: l,
172
- children: p
173
- } = n, v = K(n, fe), h = D(u, {
174
- relative: v.relative
175
- }), x = I(), b = m.useContext(Y), {
176
- navigator: w,
177
- basename: y
178
- } = m.useContext(F), g = b != null && // Conditional usage is OK here because the usage of a data router is static
179
- // eslint-disable-next-line react-hooks/rules-of-hooks
180
- Re(h) && l === !0, c = w.encodeLocation ? w.encodeLocation(h).pathname : h.pathname, d = x.pathname, f = b && b.navigation && b.navigation.location ? b.navigation.location.pathname : null;
181
- t || (d = d.toLowerCase(), f = f ? f.toLowerCase() : null, c = c.toLowerCase()), f && y && (f = E(f, y) || f);
182
- const C = c !== "/" && c.endsWith("/") ? c.length - 1 : c.length;
183
- let O = d === c || !o && d.startsWith(c) && d.charAt(C) === "/", M = f != null && (f === c || !o && f.startsWith(c) && f.charAt(c.length) === "/"), V = {
184
- isActive: O,
185
- isPending: M,
186
- isTransitioning: g
187
- }, H = O ? a : void 0, U;
188
- typeof i == "function" ? U = i(V) : U = [i, O ? "active" : null, M ? "pending" : null, g ? "transitioning" : null].filter(Boolean).join(" ");
189
- let X = typeof s == "function" ? s(V) : s;
190
- return /* @__PURE__ */ m.createElement(q, N({}, v, {
191
- "aria-current": H,
192
- className: U,
193
- ref: r,
194
- style: X,
195
- to: u,
196
- unstable_viewTransition: l
197
- }), typeof p == "function" ? p(V) : p);
198
- });
199
- process.env.NODE_ENV !== "production" && (be.displayName = "NavLink");
200
- const we = /* @__PURE__ */ m.forwardRef((e, n) => {
201
- let {
202
- fetcherKey: r,
203
- navigate: a,
204
- reloadDocument: t,
205
- replace: i,
206
- state: o,
207
- method: s = _,
208
- action: u,
209
- onSubmit: l,
210
- relative: p,
211
- preventScrollReset: v,
212
- unstable_viewTransition: h
213
- } = e, x = K(e, me), b = xe(), w = Ce(u, {
214
- relative: p
215
- }), y = s.toLowerCase() === "get" ? "get" : "post", g = (c) => {
216
- if (l && l(c), c.defaultPrevented)
217
- return;
218
- c.preventDefault();
219
- let d = c.nativeEvent.submitter, f = (d == null ? void 0 : d.getAttribute("formmethod")) || s;
220
- b(d || c.currentTarget, {
221
- fetcherKey: r,
222
- method: f,
223
- navigate: a,
224
- replace: i,
225
- state: o,
226
- relative: p,
227
- preventScrollReset: v,
228
- unstable_viewTransition: h
229
- });
230
- };
231
- return /* @__PURE__ */ m.createElement("form", N({
232
- ref: n,
233
- method: y,
234
- action: w,
235
- onSubmit: t ? l : g
236
- }, x));
237
- });
238
- process.env.NODE_ENV !== "production" && (we.displayName = "Form");
239
- process.env.NODE_ENV;
240
- var T;
241
- (function(e) {
242
- e.UseScrollRestoration = "useScrollRestoration", e.UseSubmit = "useSubmit", e.UseSubmitFetcher = "useSubmitFetcher", e.UseFetcher = "useFetcher", e.useViewTransitionState = "useViewTransitionState";
243
- })(T || (T = {}));
244
- var B;
245
- (function(e) {
246
- e.UseFetcher = "useFetcher", e.UseFetchers = "useFetchers", e.UseScrollRestoration = "useScrollRestoration";
247
- })(B || (B = {}));
248
- function ye(e) {
249
- return e + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router.";
250
- }
251
- function G(e) {
252
- let n = m.useContext(Q);
253
- return n || (process.env.NODE_ENV !== "production" ? S(!1, ye(e)) : S(!1)), n;
254
- }
255
- function ge(e, n) {
256
- let {
257
- target: r,
258
- replace: a,
259
- state: t,
260
- preventScrollReset: i,
261
- relative: o,
262
- unstable_viewTransition: s
263
- } = n === void 0 ? {} : n, u = Z(), l = I(), p = D(e, {
264
- relative: o
265
- });
266
- return m.useCallback((v) => {
267
- if (oe(v, r)) {
268
- v.preventDefault();
269
- let h = a !== void 0 ? a : A(l) === A(p);
270
- u(e, {
271
- replace: h,
272
- state: t,
273
- preventScrollReset: i,
274
- relative: o,
275
- unstable_viewTransition: s
276
- });
277
- }
278
- }, [l, u, p, a, t, r, e, i, o, s]);
279
- }
280
- function Ee() {
281
- if (typeof document > "u")
282
- throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");
283
- }
284
- let Se = 0, Ne = () => "__" + String(++Se) + "__";
285
- function xe() {
286
- let {
287
- router: e
288
- } = G(T.UseSubmit), {
289
- basename: n
290
- } = m.useContext(F), r = $();
291
- return m.useCallback(function(a, t) {
292
- t === void 0 && (t = {}), Ee();
293
- let {
294
- action: i,
295
- method: o,
296
- encType: s,
297
- formData: u,
298
- body: l
299
- } = ue(a, n);
300
- if (t.navigate === !1) {
301
- let p = t.fetcherKey || Ne();
302
- e.fetch(p, r, t.action || i, {
303
- preventScrollReset: t.preventScrollReset,
304
- formData: u,
305
- body: l,
306
- formMethod: t.method || o,
307
- formEncType: t.encType || s,
308
- unstable_flushSync: t.unstable_flushSync
309
- });
310
- } else
311
- e.navigate(t.action || i, {
312
- preventScrollReset: t.preventScrollReset,
313
- formData: u,
314
- body: l,
315
- formMethod: t.method || o,
316
- formEncType: t.encType || s,
317
- replace: t.replace,
318
- state: t.state,
319
- fromRouteId: r,
320
- unstable_flushSync: t.unstable_flushSync,
321
- unstable_viewTransition: t.unstable_viewTransition
322
- });
323
- }, [e, n, r]);
324
- }
325
- function Ce(e, n) {
326
- let {
327
- relative: r
328
- } = n === void 0 ? {} : n, {
329
- basename: a
330
- } = m.useContext(F), t = m.useContext(ee);
331
- t || (process.env.NODE_ENV !== "production" ? S(!1, "useFormAction must be used inside a RouteContext") : S(!1));
332
- let [i] = t.matches.slice(-1), o = N({}, D(e || ".", {
333
- relative: r
334
- })), s = I();
335
- if (e == null) {
336
- o.search = s.search;
337
- let u = new URLSearchParams(o.search);
338
- u.has("index") && u.get("index") === "" && (u.delete("index"), o.search = u.toString() ? "?" + u.toString() : "");
339
- }
340
- return (!e || e === ".") && i.route.index && (o.search = o.search ? o.search.replace(/^\?/, "?index&") : "?index"), a !== "/" && (o.pathname = o.pathname === "/" ? a : te([a, o.pathname])), A(o);
341
- }
342
- function Re(e, n) {
343
- n === void 0 && (n = {});
344
- let r = m.useContext(z);
345
- r == null && (process.env.NODE_ENV !== "production" ? S(!1, "`unstable_useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?") : S(!1));
346
- let {
347
- basename: a
348
- } = G(T.useViewTransitionState), t = D(e, {
349
- relative: n.relative
350
- });
351
- if (!r.isTransitioning)
352
- return !1;
353
- let i = E(r.currentLocation.pathname, a) || r.currentLocation.pathname, o = E(r.nextLocation.pathname, a) || r.nextLocation.pathname;
354
- return W(t.pathname, o) != null || W(t.pathname, i) != null;
355
- }
356
- export {
357
- q as L,
358
- be as N
359
- };