react-ecosistema-unp 0.2.4 → 0.3.0

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "react-ecosistema-unp",
3
3
  "author": "Ecosistema de Información - Unidad Nacional de Protección",
4
4
  "private": false,
5
- "version": "0.2.4",
5
+ "version": "0.3.0",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {
@@ -39,9 +39,8 @@
39
39
  "lint": "eslint .",
40
40
  "preview": "vite preview",
41
41
  "storybook": "storybook dev -p 6006",
42
- "build-storybook": "storybook build",
43
- "build:storybook": "storybook build --output-dir .storybook-build",
44
- "predeploy": "npm run build:storybook",
42
+ "build-storybook": "storybook build --output-dir .storybook/.storybook-build",
43
+ "predeploy": "npm run build-storybook",
45
44
  "deploy:storybook": "gh-pages -d .storybook-build -b gh-pages -t"
46
45
  },
47
46
  "peerDependencies": {
@@ -1,488 +0,0 @@
1
- import { jsx as f, jsxs as W } from "react/jsx-runtime";
2
- import * as p from "react";
3
- import C, { useRef as $, useState as re, useCallback as oe, useReducer as ae, useContext as h, useEffect as ie } from "react";
4
- import { B as se } from "../../useFinalizarSesion-COlHmXt5.js";
5
- import { MenuLateral as le } from "./MenuLateral.js";
6
- import ue from "./NotificacionUsuario.js";
7
- import { _ as ce, u as k, S as E, c as q, m as S, d as de, e as j, f as R, T as fe, g as ve, a as pe, b as me } from "../../Bootstrap-ByT3_uwe.js";
8
- function I() {
9
- return I = Object.assign ? Object.assign.bind() : function(e) {
10
- for (var t = 1; t < arguments.length; t++) {
11
- var r = arguments[t];
12
- for (var n in r) ({}).hasOwnProperty.call(r, n) && (e[n] = r[n]);
13
- }
14
- return e;
15
- }, I.apply(null, arguments);
16
- }
17
- function L(e) {
18
- return "default" + e.charAt(0).toUpperCase() + e.substr(1);
19
- }
20
- function be(e) {
21
- var t = ye(e, "string");
22
- return typeof t == "symbol" ? t : String(t);
23
- }
24
- function ye(e, t) {
25
- if (typeof e != "object" || e === null) return e;
26
- var r = e[Symbol.toPrimitive];
27
- if (r !== void 0) {
28
- var n = r.call(e, t);
29
- if (typeof n != "object") return n;
30
- throw new TypeError("@@toPrimitive must return a primitive value.");
31
- }
32
- return String(e);
33
- }
34
- function xe(e, t, r) {
35
- var n = $(e !== void 0), o = re(t), i = o[0], a = o[1], l = e !== void 0, v = n.current;
36
- return n.current = l, !l && v && i !== t && a(t), [l ? e : i, oe(function(c) {
37
- for (var s = arguments.length, u = new Array(s > 1 ? s - 1 : 0), d = 1; d < s; d++)
38
- u[d - 1] = arguments[d];
39
- r && r.apply(void 0, [c].concat(u)), a(c);
40
- }, [r])];
41
- }
42
- function V(e, t) {
43
- return Object.keys(t).reduce(function(r, n) {
44
- var o, i = r, a = i[L(n)], l = i[n], v = ce(i, [L(n), n].map(be)), c = t[n], s = xe(l, a, e[c]), u = s[0], d = s[1];
45
- return I({}, v, (o = {}, o[n] = u, o[c] = d, o));
46
- }, e);
47
- }
48
- const Ce = ["as", "disabled"];
49
- function he(e, t) {
50
- if (e == null) return {};
51
- var r = {};
52
- for (var n in e) if ({}.hasOwnProperty.call(e, n)) {
53
- if (t.indexOf(n) >= 0) continue;
54
- r[n] = e[n];
55
- }
56
- return r;
57
- }
58
- function Pe(e) {
59
- return !e || e.trim() === "#";
60
- }
61
- function M({
62
- tagName: e,
63
- disabled: t,
64
- href: r,
65
- target: n,
66
- rel: o,
67
- role: i,
68
- onClick: a,
69
- tabIndex: l = 0,
70
- type: v
71
- }) {
72
- e || (r != null || n != null || o != null ? e = "a" : e = "button");
73
- const c = {
74
- tagName: e
75
- };
76
- if (e === "button")
77
- return [{
78
- type: v || "button",
79
- disabled: t
80
- }, c];
81
- const s = (d) => {
82
- if ((t || e === "a" && Pe(r)) && d.preventDefault(), t) {
83
- d.stopPropagation();
84
- return;
85
- }
86
- a == null || a(d);
87
- }, u = (d) => {
88
- d.key === " " && (d.preventDefault(), s(d));
89
- };
90
- return e === "a" && (r || (r = "#"), t && (r = void 0)), [{
91
- role: i ?? "button",
92
- // explicitly undefined so that it overrides the props disabled in a spread
93
- // e.g. <Tag {...props} {...hookProps} />
94
- disabled: void 0,
95
- tabIndex: t ? void 0 : l,
96
- href: r,
97
- target: e === "a" ? n : void 0,
98
- "aria-disabled": t || void 0,
99
- rel: e === "a" ? o : void 0,
100
- onClick: s,
101
- onKeyDown: u
102
- }, c];
103
- }
104
- const X = /* @__PURE__ */ p.forwardRef((e, t) => {
105
- let {
106
- as: r,
107
- disabled: n
108
- } = e, o = he(e, Ce);
109
- const [i, {
110
- tagName: a
111
- }] = M(Object.assign({
112
- tagName: r,
113
- disabled: n
114
- }, o));
115
- return /* @__PURE__ */ f(a, Object.assign({}, o, i, {
116
- ref: t
117
- }));
118
- });
119
- X.displayName = "Button";
120
- const ge = ["onKeyDown"];
121
- function Ke(e, t) {
122
- if (e == null) return {};
123
- var r = {};
124
- for (var n in e) if ({}.hasOwnProperty.call(e, n)) {
125
- if (t.indexOf(n) >= 0) continue;
126
- r[n] = e[n];
127
- }
128
- return r;
129
- }
130
- function we(e) {
131
- return !e || e.trim() === "#";
132
- }
133
- const Y = /* @__PURE__ */ p.forwardRef((e, t) => {
134
- let {
135
- onKeyDown: r
136
- } = e, n = Ke(e, ge);
137
- const [o] = M(Object.assign({
138
- tagName: "a"
139
- }, n)), i = k((a) => {
140
- o.onKeyDown(a), r == null || r(a);
141
- });
142
- return we(n.href) || n.role === "button" ? /* @__PURE__ */ f("a", Object.assign({
143
- ref: t
144
- }, n, o, {
145
- onKeyDown: i
146
- })) : /* @__PURE__ */ f("a", Object.assign({
147
- ref: t
148
- }, n, {
149
- onKeyDown: r
150
- }));
151
- });
152
- Y.displayName = "Anchor";
153
- const z = /* @__PURE__ */ p.createContext(null);
154
- z.displayName = "CardHeaderContext";
155
- function U(e, t) {
156
- let r = 0;
157
- return p.Children.map(e, (n) => /* @__PURE__ */ p.isValidElement(n) ? t(n, r++) : n);
158
- }
159
- function Ne(e, t) {
160
- let r = 0;
161
- p.Children.forEach(e, (n) => {
162
- /* @__PURE__ */ p.isValidElement(n) && t(n, r++);
163
- });
164
- }
165
- var Oe = Function.prototype.bind.call(Function.prototype.call, [].slice);
166
- function $e(e, t) {
167
- return Oe(e.querySelectorAll(t));
168
- }
169
- function Ee() {
170
- const [, e] = ae((t) => t + 1, 0);
171
- return e;
172
- }
173
- const T = /* @__PURE__ */ p.createContext(null);
174
- T.displayName = "NavContext";
175
- const Ie = "data-rr-ui-", Se = "rrUi";
176
- function A(e) {
177
- return `${Ie}${e}`;
178
- }
179
- function je(e) {
180
- return `${Se}${e}`;
181
- }
182
- const G = /* @__PURE__ */ p.createContext(null);
183
- G.displayName = "NavbarContext";
184
- const Re = ["as", "active", "eventKey"];
185
- function Te(e, t) {
186
- if (e == null) return {};
187
- var r = {};
188
- for (var n in e) if ({}.hasOwnProperty.call(e, n)) {
189
- if (t.indexOf(n) >= 0) continue;
190
- r[n] = e[n];
191
- }
192
- return r;
193
- }
194
- function J({
195
- key: e,
196
- onClick: t,
197
- active: r,
198
- id: n,
199
- role: o,
200
- disabled: i
201
- }) {
202
- const a = h(E), l = h(T), v = h(q);
203
- let c = r;
204
- const s = {
205
- role: o
206
- };
207
- if (l) {
208
- !o && l.role === "tablist" && (s.role = "tab");
209
- const u = l.getControllerId(e ?? null), d = l.getControlledId(e ?? null);
210
- s[A("event-key")] = e, s.id = u || n, c = r == null && e != null ? l.activeKey === e : r, (c || !(v != null && v.unmountOnExit) && !(v != null && v.mountOnEnter)) && (s["aria-controls"] = d);
211
- }
212
- return s.role === "tab" && (s["aria-selected"] = c, c || (s.tabIndex = -1), i && (s.tabIndex = -1, s["aria-disabled"] = !0)), s.onClick = k((u) => {
213
- i || (t == null || t(u), e != null && a && !u.isPropagationStopped() && a(e, u));
214
- }), [s, {
215
- isActive: c
216
- }];
217
- }
218
- const Q = /* @__PURE__ */ p.forwardRef((e, t) => {
219
- let {
220
- as: r = X,
221
- active: n,
222
- eventKey: o
223
- } = e, i = Te(e, Re);
224
- const [a, l] = J(Object.assign({
225
- key: S(o, i.href),
226
- active: n
227
- }, i));
228
- return a[A("active")] = l.isActive, /* @__PURE__ */ f(r, Object.assign({}, i, a, {
229
- ref: t
230
- }));
231
- });
232
- Q.displayName = "NavItem";
233
- const Ae = ["as", "onSelect", "activeKey", "role", "onKeyDown"];
234
- function De(e, t) {
235
- if (e == null) return {};
236
- var r = {};
237
- for (var n in e) if ({}.hasOwnProperty.call(e, n)) {
238
- if (t.indexOf(n) >= 0) continue;
239
- r[n] = e[n];
240
- }
241
- return r;
242
- }
243
- const F = () => {
244
- }, H = A("event-key"), Z = /* @__PURE__ */ p.forwardRef((e, t) => {
245
- let {
246
- // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
247
- as: r = "div",
248
- onSelect: n,
249
- activeKey: o,
250
- role: i,
251
- onKeyDown: a
252
- } = e, l = De(e, Ae);
253
- const v = Ee(), c = $(!1), s = h(E), u = h(q);
254
- let d, P;
255
- u && (i = i || "tablist", o = u.activeKey, d = u.getControlledId, P = u.getControllerId);
256
- const y = $(null), x = (m) => {
257
- const b = y.current;
258
- if (!b) return null;
259
- const N = $e(b, `[${H}]:not([aria-disabled=true])`), O = b.querySelector("[aria-selected=true]");
260
- if (!O || O !== document.activeElement) return null;
261
- const B = N.indexOf(O);
262
- if (B === -1) return null;
263
- let K = B + m;
264
- return K >= N.length && (K = 0), K < 0 && (K = N.length - 1), N[K];
265
- }, g = (m, b) => {
266
- m != null && (n == null || n(m, b), s == null || s(m, b));
267
- }, w = (m) => {
268
- if (a == null || a(m), !u)
269
- return;
270
- let b;
271
- switch (m.key) {
272
- case "ArrowLeft":
273
- case "ArrowUp":
274
- b = x(-1);
275
- break;
276
- case "ArrowRight":
277
- case "ArrowDown":
278
- b = x(1);
279
- break;
280
- default:
281
- return;
282
- }
283
- b && (m.preventDefault(), g(b.dataset[je("EventKey")] || null, m), c.current = !0, v());
284
- };
285
- ie(() => {
286
- if (y.current && c.current) {
287
- const m = y.current.querySelector(`[${H}][aria-selected=true]`);
288
- m == null || m.focus();
289
- }
290
- c.current = !1;
291
- });
292
- const ne = de(t, y);
293
- return /* @__PURE__ */ f(E.Provider, {
294
- value: g,
295
- children: /* @__PURE__ */ f(T.Provider, {
296
- value: {
297
- role: i,
298
- // used by NavLink to determine it's role
299
- activeKey: S(o),
300
- getControlledId: d || F,
301
- getControllerId: P || F
302
- },
303
- children: /* @__PURE__ */ f(r, Object.assign({}, l, {
304
- onKeyDown: w,
305
- ref: ne,
306
- role: i
307
- }))
308
- })
309
- });
310
- });
311
- Z.displayName = "Nav";
312
- const _e = Object.assign(Z, {
313
- Item: Q
314
- }), D = /* @__PURE__ */ p.forwardRef(({
315
- className: e,
316
- bsPrefix: t,
317
- as: r = "div",
318
- ...n
319
- }, o) => (t = j(t, "nav-item"), /* @__PURE__ */ f(r, {
320
- ref: o,
321
- className: R(e, t),
322
- ...n
323
- })));
324
- D.displayName = "NavItem";
325
- const _ = /* @__PURE__ */ p.forwardRef(({
326
- bsPrefix: e,
327
- className: t,
328
- as: r = Y,
329
- active: n,
330
- eventKey: o,
331
- disabled: i = !1,
332
- ...a
333
- }, l) => {
334
- e = j(e, "nav-link");
335
- const [v, c] = J({
336
- key: S(o, a.href),
337
- active: n,
338
- disabled: i,
339
- ...a
340
- });
341
- return /* @__PURE__ */ f(r, {
342
- ...a,
343
- ...v,
344
- ref: l,
345
- disabled: i,
346
- className: R(t, e, i && "disabled", c.isActive && "active")
347
- });
348
- });
349
- _.displayName = "NavLink";
350
- const ee = /* @__PURE__ */ p.forwardRef((e, t) => {
351
- const {
352
- as: r = "div",
353
- bsPrefix: n,
354
- variant: o,
355
- fill: i = !1,
356
- justify: a = !1,
357
- navbar: l,
358
- navbarScroll: v,
359
- className: c,
360
- activeKey: s,
361
- ...u
362
- } = V(e, {
363
- activeKey: "onSelect"
364
- }), d = j(n, "nav");
365
- let P, y, x = !1;
366
- const g = h(G), w = h(z);
367
- return g ? (P = g.bsPrefix, x = l ?? !0) : w && ({
368
- cardHeaderBsPrefix: y
369
- } = w), /* @__PURE__ */ f(_e, {
370
- as: r,
371
- ref: t,
372
- activeKey: s,
373
- className: R(c, {
374
- [d]: !x,
375
- [`${P}-nav`]: x,
376
- [`${P}-nav-scroll`]: x && v,
377
- [`${y}-${o}`]: !!y,
378
- [`${d}-${o}`]: !!o,
379
- [`${d}-fill`]: i,
380
- [`${d}-justified`]: a
381
- }),
382
- ...u
383
- });
384
- });
385
- ee.displayName = "Nav";
386
- const Be = Object.assign(ee, {
387
- Item: D,
388
- Link: _
389
- });
390
- function Le(e) {
391
- let t;
392
- return Ne(e, (r) => {
393
- t == null && (t = r.props.eventKey);
394
- }), t;
395
- }
396
- function Ue(e) {
397
- const {
398
- title: t,
399
- eventKey: r,
400
- disabled: n,
401
- tabClassName: o,
402
- tabAttrs: i,
403
- id: a
404
- } = e.props;
405
- return t == null ? null : /* @__PURE__ */ f(D, {
406
- as: "li",
407
- role: "presentation",
408
- children: /* @__PURE__ */ f(_, {
409
- as: "button",
410
- type: "button",
411
- eventKey: r,
412
- disabled: n,
413
- id: a,
414
- className: o,
415
- ...i,
416
- children: t
417
- })
418
- });
419
- }
420
- const te = (e) => {
421
- const {
422
- id: t,
423
- onSelect: r,
424
- transition: n,
425
- mountOnEnter: o = !1,
426
- unmountOnExit: i = !1,
427
- variant: a = "tabs",
428
- children: l,
429
- activeKey: v = Le(l),
430
- ...c
431
- } = V(e, {
432
- activeKey: "onSelect"
433
- });
434
- return /* @__PURE__ */ W(fe, {
435
- id: t,
436
- activeKey: v,
437
- onSelect: r,
438
- transition: ve(n),
439
- mountOnEnter: o,
440
- unmountOnExit: i,
441
- children: [/* @__PURE__ */ f(Be, {
442
- id: t,
443
- ...c,
444
- role: "tablist",
445
- as: "ul",
446
- variant: a,
447
- children: U(l, Ue)
448
- }), /* @__PURE__ */ f(pe, {
449
- children: U(l, (s) => {
450
- const u = {
451
- ...s.props
452
- };
453
- return delete u.title, delete u.disabled, delete u.tabClassName, delete u.tabAttrs, /* @__PURE__ */ f(me, {
454
- ...u
455
- });
456
- })
457
- })]
458
- });
459
- };
460
- te.displayName = "Tabs";
461
- const Me = ({ children: e }) => {
462
- const [t, r] = C.useState(!1), [n, o] = C.useState(void 0), i = () => {
463
- r(!t);
464
- };
465
- return C.useEffect(() => {
466
- if (C.Children.count(e) > 0) {
467
- const a = C.Children.toArray(
468
- e
469
- )[0];
470
- o(a.props.eventKey);
471
- }
472
- }, [e]), /* @__PURE__ */ W(se, { children: [
473
- /* @__PURE__ */ f("div", { className: "position-absolute top-0 end-0 m-3", children: /* @__PURE__ */ f(ue, {}) }),
474
- /* @__PURE__ */ f(le, { onToggle: i, isOpen: t }),
475
- /* @__PURE__ */ f("div", { className: `${t ? "menu-open" : ""}`, children: /* @__PURE__ */ f("div", { className: "main-section", children: /* @__PURE__ */ f(
476
- te,
477
- {
478
- id: "controlled-tab-example",
479
- activeKey: n,
480
- onSelect: (a) => o(a !== null ? a : void 0),
481
- children: C.Children.map(e, (a) => C.isValidElement(a) ? a : null)
482
- }
483
- ) }) })
484
- ] });
485
- };
486
- export {
487
- Me as default
488
- };