meticulous-ui 3.2.6 → 3.2.7
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 +17 -13
- package/package.json +1 -1
- package/utils/announceToScreenReader.js +9 -0
- package/utils/captureException.js +12 -0
- package/utils/decodeJWT.js +11 -0
- package/utils/fallback.js +4 -0
- package/utils/generateAriaId.js +5 -0
- package/utils/getToken.js +4 -0
- package/utils/getVariant.js +10 -0
- package/utils/handleKeyboardNavigation.js +17 -0
- package/utils/hasPermission.js +13 -0
- package/utils/index.js +140 -102
- package/utils/isAuthenticated.js +14 -0
- package/utils/isFeatureEnabled.js +10 -0
- package/utils/logError.js +7 -0
- package/utils/removeToken.js +4 -0
- package/utils/safeJSONParse.js +10 -0
- package/utils/safeJSONStringify.js +10 -0
- package/utils/setToken.js +4 -0
- package/utils/trapFocus.js +16 -0
package/README.md
CHANGED
|
@@ -142,19 +142,23 @@ import blue from 'meticulous-ui/colors/blue';
|
|
|
142
142
|
|
|
143
143
|
## 📦 Utils
|
|
144
144
|
|
|
145
|
-
| Category
|
|
146
|
-
|
|
|
147
|
-
| **String**
|
|
148
|
-
| **Number**
|
|
149
|
-
| **Date-Time**
|
|
150
|
-
| **Data**
|
|
151
|
-
| **Validation**
|
|
152
|
-
| **Device**
|
|
153
|
-
| **Storage**
|
|
154
|
-
| **Routing**
|
|
155
|
-
| **UI**
|
|
156
|
-
| **Performance**
|
|
157
|
-
| **Async**
|
|
145
|
+
| Category | Functions |
|
|
146
|
+
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
147
|
+
| **String** | `capFirstLetter`, `capitalize`, `titleCase`, `camelCase`, `snakeCase`, `kebabCase`, `slugify`, `truncate`, `removeExtraSpaces`, `maskEmail`, `maskPhone`, `generateInitials`, |
|
|
148
|
+
| **Number** | `clamp`, `formatCurrency`, `formatNumber`, `formatCompactNumber`, `percentage`, `randomInt`, `randomBetween`, `randomValue`, `roundTo`, |
|
|
149
|
+
| **Date-Time** | `formatDate`, `formatTime`, `addDays`, `differenceInDays`, `isToday`, `isPast`, `timeAgo`, `getGreetingByTime`, `countdown`, |
|
|
150
|
+
| **Data** | `deepClone`, `mergeDeep`, `pick`, `omit`, `isEmpty`, `isEqual`, `hasEqualProps`, `isNonEmptyArray`, `flattenObject`, `groupBy`, `keyBy`, `uniqueBy`, `sortBy`, `chunk`, `compose`, |
|
|
151
|
+
| **Validation** | `isEmail`, `isPhone`, `isURL`, `isPasswordStrong`, `isPAN`, `isAadhaar`, `isGST`, `isRequired`, `minLength`, `maxLength`, |
|
|
152
|
+
| **Device** | `isMobile`, `isIOS`, `isAndroid`, `isSafari`, `isDarkMode`, `isOnline`, `copyToClipboard`, `downloadFile`, `openInNewTab`, `getScreenSize`, |
|
|
153
|
+
| **Storage** | `setLocalStorage`, `getLocalStorage`, `removeLocalStorage`, `setSessionStorage`, `getSessionStorage`, `clearStorage`, |
|
|
154
|
+
| **Routing** | `getQueryParams`, `setQueryParam`, `removeQueryParam`, `buildURL`, `redirectTo`, `getCurrentPath`, `isActiveRoute`, |
|
|
155
|
+
| **UI** | `scrollToTop`, `scrollToElement`, `lockBodyScroll`, `unlockBodyScroll`, `toggleFullscreen`, `focusElement`, `detectOutsideClick`, `measureElement`, |
|
|
156
|
+
| **Performance** | `debounce`, `throttle`, `memoize`, `lazyLoadComponent`, `requestIdleTask`, `rafThrottle`, |
|
|
157
|
+
| **Async** | `retry`, `sleep`, `withTimeout`, `parallel`, `sequential`, `safeAsync`, `cancelablePromise` |
|
|
158
|
+
| **Accessibility** | `announceToScreenReader`, `trapFocus`, `generateAriaId`, `handleKeyboardNavigation` |
|
|
159
|
+
| **Error Handling** | `logError`, `captureException`, `safeJSONParse`, `safeJSONStringify`, `fallback` |
|
|
160
|
+
| **Auth** | `isAuthenticated`, `getToken`, `setToken`, `removeToken`, `decodeJWT`, `hasPermission` |
|
|
161
|
+
| **Feature Flags** | `isFeatureEnabled`, `getVariant` |
|
|
158
162
|
|
|
159
163
|
## 🌱 Features
|
|
160
164
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meticulous-ui",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.7",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"description": "A comprehensive React UI component library with a wide range of customizable components, icons, colors, and utilities for building modern web applications.",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const i = (t, o = "polite") => {
|
|
2
|
+
const e = document.createElement("div");
|
|
3
|
+
e.setAttribute("aria-live", o), e.setAttribute("aria-atomic", "true"), e.style.cssText = "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0", document.body.appendChild(e), requestAnimationFrame(() => {
|
|
4
|
+
e.textContent = t, setTimeout(() => document.body.removeChild(e), 1e3);
|
|
5
|
+
});
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
i as default
|
|
9
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const o = (e, n = {}) => {
|
|
2
|
+
const t = {
|
|
3
|
+
message: e instanceof Error ? e.message : String(e),
|
|
4
|
+
stack: e instanceof Error ? e.stack : void 0,
|
|
5
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6
|
+
...n
|
|
7
|
+
};
|
|
8
|
+
return typeof window < "u" && typeof window.__captureException == "function" ? window.__captureException(t) : console.error("[captureException]", t), t;
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
o as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const y = (a, t, h = {}) => {
|
|
2
|
+
const { onSelect: o, loop: l = !0, orientation: p = "vertical" } = h, n = p === "horizontal" ? "ArrowLeft" : "ArrowUp", v = p === "horizontal" ? "ArrowRight" : "ArrowDown";
|
|
3
|
+
return (r) => {
|
|
4
|
+
if (r.key === v) {
|
|
5
|
+
r.preventDefault();
|
|
6
|
+
const f = t + 1 >= a.length ? l ? 0 : t : t + 1;
|
|
7
|
+
o == null || o(f, a[f]);
|
|
8
|
+
} else if (r.key === n) {
|
|
9
|
+
r.preventDefault();
|
|
10
|
+
const f = t - 1 < 0 ? l ? a.length - 1 : t : t - 1;
|
|
11
|
+
o == null || o(f, a[f]);
|
|
12
|
+
} else r.key === "Home" ? (r.preventDefault(), o == null || o(0, a[0])) : r.key === "End" && (r.preventDefault(), o == null || o(a.length - 1, a[a.length - 1]));
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
y as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import n from "./decodeJWT.js";
|
|
2
|
+
import a from "./getToken.js";
|
|
3
|
+
const l = (o, s = "auth_token") => {
|
|
4
|
+
const t = a(s);
|
|
5
|
+
if (!t) return !1;
|
|
6
|
+
const r = n(t);
|
|
7
|
+
if (!r) return !1;
|
|
8
|
+
const e = r.roles ?? r.role ?? [];
|
|
9
|
+
return Array.isArray(e) ? e.includes(o) : e === o;
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
l as default
|
|
13
|
+
};
|
package/utils/index.js
CHANGED
|
@@ -8,11 +8,11 @@ import p from "./deepClone.js";
|
|
|
8
8
|
import f from "./flattenObject.js";
|
|
9
9
|
import a from "./formatCompactNumber.js";
|
|
10
10
|
import s from "./formatCurrency.js";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
11
|
+
import n from "./formatDate.js";
|
|
12
|
+
import l from "./formatNumber.js";
|
|
13
13
|
import c from "./formatTime.js";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
14
|
+
import d from "./generateInitials.js";
|
|
15
|
+
import u from "./getGreetingByTime.js";
|
|
16
16
|
import g from "./groupBy.js";
|
|
17
17
|
import y from "./hasEqualProps.js";
|
|
18
18
|
import S from "./addDays.js";
|
|
@@ -20,33 +20,33 @@ import T from "./countdown.js";
|
|
|
20
20
|
import k from "./differenceInDays.js";
|
|
21
21
|
import b from "./isEmpty.js";
|
|
22
22
|
import h from "./isEqual.js";
|
|
23
|
-
import
|
|
23
|
+
import E from "./isNonEmptyArray.js";
|
|
24
24
|
import P from "./isPast.js";
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
25
|
+
import C from "./isToday.js";
|
|
26
|
+
import A from "./kebabCase.js";
|
|
27
|
+
import L from "./keyBy.js";
|
|
28
|
+
import B from "./maskEmail.js";
|
|
29
|
+
import N from "./maskPhone.js";
|
|
30
|
+
import I from "./mergeDeep.js";
|
|
31
|
+
import q from "./omit.js";
|
|
32
|
+
import v from "./percentage.js";
|
|
33
|
+
import w from "./pick.js";
|
|
34
|
+
import O from "./randomBetween.js";
|
|
35
35
|
import x from "./randomInt.js";
|
|
36
|
-
import
|
|
37
|
-
import
|
|
36
|
+
import D from "./randomValue.js";
|
|
37
|
+
import F from "./removeExtraSpaces.js";
|
|
38
38
|
import R from "./roundTo.js";
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
39
|
+
import z from "./slugify.js";
|
|
40
|
+
import J from "./snakeCase.js";
|
|
41
|
+
import Q from "./sortBy.js";
|
|
42
|
+
import G from "./timeAgo.js";
|
|
43
|
+
import M from "./titleCase.js";
|
|
44
|
+
import U from "./truncate.js";
|
|
45
45
|
import V from "./uniqueBy.js";
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
import
|
|
49
|
-
import
|
|
46
|
+
import j from "./isEmail.js";
|
|
47
|
+
import K from "./isPhone.js";
|
|
48
|
+
import W from "./isURL.js";
|
|
49
|
+
import H from "./isPasswordStrong.js";
|
|
50
50
|
import X from "./isPAN.js";
|
|
51
51
|
import Y from "./isAadhaar.js";
|
|
52
52
|
import Z from "./isGST.js";
|
|
@@ -62,8 +62,8 @@ import po from "./isOnline.js";
|
|
|
62
62
|
import fo from "./copyToClipboard.js";
|
|
63
63
|
import ao from "./downloadFile.js";
|
|
64
64
|
import so from "./openInNewTab.js";
|
|
65
|
-
import
|
|
66
|
-
import
|
|
65
|
+
import no from "./getScreenSize.js";
|
|
66
|
+
import lo from "./getQueryParams.js";
|
|
67
67
|
import co from "./setQueryParam.js";
|
|
68
68
|
import uo from "./removeQueryParam.js";
|
|
69
69
|
import go from "./buildURL.js";
|
|
@@ -73,64 +73,81 @@ import To from "./isActiveRoute.js";
|
|
|
73
73
|
import ko from "./setLocalStorage.js";
|
|
74
74
|
import bo from "./getLocalStorage.js";
|
|
75
75
|
import ho from "./removeLocalStorage.js";
|
|
76
|
-
import
|
|
76
|
+
import Eo from "./setSessionStorage.js";
|
|
77
77
|
import Po from "./getSessionStorage.js";
|
|
78
|
-
import
|
|
79
|
-
import
|
|
80
|
-
import
|
|
81
|
-
import
|
|
82
|
-
import
|
|
83
|
-
import
|
|
84
|
-
import
|
|
85
|
-
import
|
|
86
|
-
import
|
|
87
|
-
import
|
|
78
|
+
import Co from "./clearStorage.js";
|
|
79
|
+
import Ao from "./debounce.js";
|
|
80
|
+
import Lo from "./throttle.js";
|
|
81
|
+
import Bo from "./memoize.js";
|
|
82
|
+
import No from "./lazyLoadComponent.js";
|
|
83
|
+
import Io from "./requestIdleTask.js";
|
|
84
|
+
import qo from "./rafThrottle.js";
|
|
85
|
+
import vo from "./scrollToTop.js";
|
|
86
|
+
import wo from "./scrollToElement.js";
|
|
87
|
+
import Oo from "./lockBodyScroll.js";
|
|
88
88
|
import xo from "./unlockBodyScroll.js";
|
|
89
|
-
import
|
|
90
|
-
import
|
|
89
|
+
import Do from "./toggleFullscreen.js";
|
|
90
|
+
import Fo from "./focusElement.js";
|
|
91
91
|
import Ro from "./detectOutsideClick.js";
|
|
92
|
-
import
|
|
93
|
-
import
|
|
94
|
-
import
|
|
95
|
-
import
|
|
96
|
-
import
|
|
97
|
-
import
|
|
98
|
-
import Vo from "./
|
|
99
|
-
import
|
|
100
|
-
|
|
92
|
+
import zo from "./measureElement.js";
|
|
93
|
+
import Jo from "./announceToScreenReader.js";
|
|
94
|
+
import Qo from "./trapFocus.js";
|
|
95
|
+
import Go from "./generateAriaId.js";
|
|
96
|
+
import Mo from "./handleKeyboardNavigation.js";
|
|
97
|
+
import Uo from "./logError.js";
|
|
98
|
+
import Vo from "./captureException.js";
|
|
99
|
+
import jo from "./safeJSONParse.js";
|
|
100
|
+
import Ko from "./safeJSONStringify.js";
|
|
101
|
+
import Wo from "./fallback.js";
|
|
102
|
+
import Ho from "./isAuthenticated.js";
|
|
103
|
+
import Xo from "./getToken.js";
|
|
104
|
+
import Yo from "./setToken.js";
|
|
105
|
+
import Zo from "./removeToken.js";
|
|
106
|
+
import _o from "./decodeJWT.js";
|
|
107
|
+
import $o from "./hasPermission.js";
|
|
108
|
+
import or from "./isFeatureEnabled.js";
|
|
109
|
+
import rr from "./getVariant.js";
|
|
110
|
+
import mr from "./retry.js";
|
|
111
|
+
import tr from "./sleep.js";
|
|
112
|
+
import ir from "./withTimeout.js";
|
|
113
|
+
import er from "./parallel.js";
|
|
114
|
+
import pr from "./sequential.js";
|
|
115
|
+
import fr from "./safeAsync.js";
|
|
116
|
+
import ar from "./cancelablePromise.js";
|
|
117
|
+
const St = {
|
|
101
118
|
// string
|
|
102
119
|
capFirstLetter: o,
|
|
103
120
|
capitalize: r,
|
|
104
121
|
camelCase: m,
|
|
105
|
-
generateInitials:
|
|
106
|
-
kebabCase:
|
|
107
|
-
maskEmail:
|
|
108
|
-
maskPhone:
|
|
109
|
-
removeExtraSpaces:
|
|
110
|
-
slugify:
|
|
111
|
-
snakeCase:
|
|
112
|
-
titleCase:
|
|
113
|
-
truncate:
|
|
122
|
+
generateInitials: d,
|
|
123
|
+
kebabCase: A,
|
|
124
|
+
maskEmail: B,
|
|
125
|
+
maskPhone: N,
|
|
126
|
+
removeExtraSpaces: F,
|
|
127
|
+
slugify: z,
|
|
128
|
+
snakeCase: J,
|
|
129
|
+
titleCase: M,
|
|
130
|
+
truncate: U,
|
|
114
131
|
// number
|
|
115
132
|
clamp: i,
|
|
116
133
|
formatCompactNumber: a,
|
|
117
134
|
formatCurrency: s,
|
|
118
|
-
formatNumber:
|
|
119
|
-
percentage:
|
|
120
|
-
randomBetween:
|
|
135
|
+
formatNumber: l,
|
|
136
|
+
percentage: v,
|
|
137
|
+
randomBetween: O,
|
|
121
138
|
randomInt: x,
|
|
122
|
-
randomValue:
|
|
139
|
+
randomValue: D,
|
|
123
140
|
roundTo: R,
|
|
124
141
|
// date-time
|
|
125
142
|
addDays: S,
|
|
126
143
|
countdown: T,
|
|
127
144
|
differenceInDays: k,
|
|
128
|
-
formatDate:
|
|
145
|
+
formatDate: n,
|
|
129
146
|
formatTime: c,
|
|
130
|
-
getGreetingByTime:
|
|
147
|
+
getGreetingByTime: u,
|
|
131
148
|
isPast: P,
|
|
132
|
-
isToday:
|
|
133
|
-
timeAgo:
|
|
149
|
+
isToday: C,
|
|
150
|
+
timeAgo: G,
|
|
134
151
|
// object / array
|
|
135
152
|
chunk: t,
|
|
136
153
|
compose: e,
|
|
@@ -140,18 +157,18 @@ const Rm = {
|
|
|
140
157
|
hasEqualProps: y,
|
|
141
158
|
isEmpty: b,
|
|
142
159
|
isEqual: h,
|
|
143
|
-
isNonEmptyArray:
|
|
144
|
-
keyBy:
|
|
145
|
-
mergeDeep:
|
|
146
|
-
omit:
|
|
147
|
-
pick:
|
|
148
|
-
sortBy:
|
|
160
|
+
isNonEmptyArray: E,
|
|
161
|
+
keyBy: L,
|
|
162
|
+
mergeDeep: I,
|
|
163
|
+
omit: q,
|
|
164
|
+
pick: w,
|
|
165
|
+
sortBy: Q,
|
|
149
166
|
uniqueBy: V,
|
|
150
167
|
// validation
|
|
151
|
-
isEmail:
|
|
152
|
-
isPhone:
|
|
153
|
-
isURL:
|
|
154
|
-
isPasswordStrong:
|
|
168
|
+
isEmail: j,
|
|
169
|
+
isPhone: K,
|
|
170
|
+
isURL: W,
|
|
171
|
+
isPasswordStrong: H,
|
|
155
172
|
isPAN: X,
|
|
156
173
|
isAadhaar: Y,
|
|
157
174
|
isGST: Z,
|
|
@@ -168,9 +185,9 @@ const Rm = {
|
|
|
168
185
|
copyToClipboard: fo,
|
|
169
186
|
downloadFile: ao,
|
|
170
187
|
openInNewTab: so,
|
|
171
|
-
getScreenSize:
|
|
188
|
+
getScreenSize: no,
|
|
172
189
|
// routing
|
|
173
|
-
getQueryParams:
|
|
190
|
+
getQueryParams: lo,
|
|
174
191
|
setQueryParam: co,
|
|
175
192
|
removeQueryParam: uo,
|
|
176
193
|
buildURL: go,
|
|
@@ -181,34 +198,55 @@ const Rm = {
|
|
|
181
198
|
setLocalStorage: ko,
|
|
182
199
|
getLocalStorage: bo,
|
|
183
200
|
removeLocalStorage: ho,
|
|
184
|
-
setSessionStorage:
|
|
201
|
+
setSessionStorage: Eo,
|
|
185
202
|
getSessionStorage: Po,
|
|
186
|
-
clearStorage:
|
|
203
|
+
clearStorage: Co,
|
|
187
204
|
// performance
|
|
188
|
-
debounce:
|
|
189
|
-
throttle:
|
|
190
|
-
memoize:
|
|
191
|
-
lazyLoadComponent:
|
|
192
|
-
requestIdleTask:
|
|
193
|
-
rafThrottle:
|
|
205
|
+
debounce: Ao,
|
|
206
|
+
throttle: Lo,
|
|
207
|
+
memoize: Bo,
|
|
208
|
+
lazyLoadComponent: No,
|
|
209
|
+
requestIdleTask: Io,
|
|
210
|
+
rafThrottle: qo,
|
|
194
211
|
// ui / dom
|
|
195
|
-
scrollToTop:
|
|
196
|
-
scrollToElement:
|
|
197
|
-
lockBodyScroll:
|
|
212
|
+
scrollToTop: vo,
|
|
213
|
+
scrollToElement: wo,
|
|
214
|
+
lockBodyScroll: Oo,
|
|
198
215
|
unlockBodyScroll: xo,
|
|
199
|
-
toggleFullscreen:
|
|
200
|
-
focusElement:
|
|
216
|
+
toggleFullscreen: Do,
|
|
217
|
+
focusElement: Fo,
|
|
201
218
|
detectOutsideClick: Ro,
|
|
202
|
-
measureElement:
|
|
219
|
+
measureElement: zo,
|
|
220
|
+
// accessibility
|
|
221
|
+
announceToScreenReader: Jo,
|
|
222
|
+
trapFocus: Qo,
|
|
223
|
+
generateAriaId: Go,
|
|
224
|
+
handleKeyboardNavigation: Mo,
|
|
225
|
+
// error handling
|
|
226
|
+
logError: Uo,
|
|
227
|
+
captureException: Vo,
|
|
228
|
+
safeJSONParse: jo,
|
|
229
|
+
safeJSONStringify: Ko,
|
|
230
|
+
fallback: Wo,
|
|
231
|
+
// auth
|
|
232
|
+
isAuthenticated: Ho,
|
|
233
|
+
getToken: Xo,
|
|
234
|
+
setToken: Yo,
|
|
235
|
+
removeToken: Zo,
|
|
236
|
+
decodeJWT: _o,
|
|
237
|
+
hasPermission: $o,
|
|
238
|
+
// feature flags
|
|
239
|
+
isFeatureEnabled: or,
|
|
240
|
+
getVariant: rr,
|
|
203
241
|
// async / api
|
|
204
|
-
retry:
|
|
205
|
-
sleep:
|
|
206
|
-
withTimeout:
|
|
207
|
-
parallel:
|
|
208
|
-
sequential:
|
|
209
|
-
safeAsync:
|
|
210
|
-
cancelablePromise:
|
|
242
|
+
retry: mr,
|
|
243
|
+
sleep: tr,
|
|
244
|
+
withTimeout: ir,
|
|
245
|
+
parallel: er,
|
|
246
|
+
sequential: pr,
|
|
247
|
+
safeAsync: fr,
|
|
248
|
+
cancelablePromise: ar
|
|
211
249
|
};
|
|
212
250
|
export {
|
|
213
|
-
|
|
251
|
+
St as default
|
|
214
252
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import o from "./getToken.js";
|
|
2
|
+
const s = (r = "auth_token") => {
|
|
3
|
+
const t = o(r);
|
|
4
|
+
if (!t) return !1;
|
|
5
|
+
try {
|
|
6
|
+
const [, n] = t.split("."), { exp: e } = JSON.parse(atob(n));
|
|
7
|
+
return !(e && Date.now() / 1e3 > e);
|
|
8
|
+
} catch {
|
|
9
|
+
return !!t;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
s as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const c = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])', d = (t) => {
|
|
2
|
+
const e = (t == null ? void 0 : t.current) ?? t;
|
|
3
|
+
if (!e) return () => {
|
|
4
|
+
};
|
|
5
|
+
const i = () => [...e.querySelectorAll(c)], s = (n) => {
|
|
6
|
+
if (n.key !== "Tab") return;
|
|
7
|
+
const o = i();
|
|
8
|
+
if (!o.length) return;
|
|
9
|
+
const r = o[0], a = o[o.length - 1];
|
|
10
|
+
n.shiftKey ? document.activeElement === r && (n.preventDefault(), a.focus()) : document.activeElement === a && (n.preventDefault(), r.focus());
|
|
11
|
+
};
|
|
12
|
+
return e.addEventListener("keydown", s), () => e.removeEventListener("keydown", s);
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
d as default
|
|
16
|
+
};
|