@workfort/ui-react 0.2.0 → 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/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { Panel, Button, Badge, StatusDot, Skeleton, Divider, TextInput, List, ListItem, ScrollArea, ErrorFallback, } from './components.js';
|
|
2
2
|
export { useAuth } from './use-auth.js';
|
|
3
3
|
export { useTheme } from './use-theme.js';
|
|
4
|
+
export { useIdleDetection } from './use-idle-detection.js';
|
|
5
|
+
export { usePermissions } from './use-permissions.js';
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAClD,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,GACrD,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAClD,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,GACrD,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import b, { forwardRef as
|
|
2
|
-
import "@workfort/ui";
|
|
3
|
-
import { getAuthClient as
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
for (const [
|
|
7
|
-
if (
|
|
8
|
-
const
|
|
9
|
-
|
|
1
|
+
import b, { forwardRef as g, useRef as w, useCallback as f, useSyncExternalStore as d, useEffect as k, useState as p } from "react";
|
|
2
|
+
import { IdleDetector as h, PermissionSet as S } from "@workfort/ui";
|
|
3
|
+
import { getAuthClient as v } from "@workfort/auth";
|
|
4
|
+
function x(t, n) {
|
|
5
|
+
const o = w(null), s = w(/* @__PURE__ */ new Map()), c = {}, a = {};
|
|
6
|
+
for (const [r, i] of Object.entries(n))
|
|
7
|
+
if (r.startsWith("on") && r.length > 2 && typeof i == "function") {
|
|
8
|
+
const m = (r[2].toLowerCase() + r.slice(3)).replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
9
|
+
a[m] = i;
|
|
10
10
|
} else
|
|
11
|
-
|
|
12
|
-
return { ref:
|
|
13
|
-
if (
|
|
14
|
-
for (const [
|
|
15
|
-
|
|
16
|
-
typeof t == "function" ? t(
|
|
17
|
-
}, [t, ...Object.keys(
|
|
11
|
+
c[r] = i;
|
|
12
|
+
return { ref: f((r) => {
|
|
13
|
+
if (o.current && (s.current.forEach((i, u) => o.current.removeEventListener(u, i)), s.current.clear()), o.current = r, r)
|
|
14
|
+
for (const [i, u] of Object.entries(a))
|
|
15
|
+
r.addEventListener(i, u), s.current.set(i, u);
|
|
16
|
+
typeof t == "function" ? t(r) : t && (t.current = r);
|
|
17
|
+
}, [t, ...Object.keys(a)]), cleanProps: c };
|
|
18
18
|
}
|
|
19
|
-
function e(t,
|
|
20
|
-
const
|
|
21
|
-
const { ref:
|
|
22
|
-
return b.createElement(t, { ref:
|
|
19
|
+
function e(t, n) {
|
|
20
|
+
const o = g(({ children: s, ...c }, a) => {
|
|
21
|
+
const { ref: l, cleanProps: r } = x(a, c);
|
|
22
|
+
return b.createElement(t, { ref: l, ...r }, s);
|
|
23
23
|
});
|
|
24
|
-
return
|
|
24
|
+
return o.displayName = n, o;
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const D = e("wf-panel", "Panel"), T = e("wf-button", "Button"), y = e("wf-badge", "Badge"), I = e("wf-status-dot", "StatusDot"), L = e("wf-skeleton", "Skeleton"), B = e("wf-divider", "Divider"), F = e("wf-text-input", "TextInput"), R = e("wf-list", "List"), O = e("wf-list-item", "ListItem"), j = e("wf-scroll-area", "ScrollArea"), W = e("wf-error-fallback", "ErrorFallback");
|
|
27
27
|
e("wf-input", "Input");
|
|
28
28
|
e("wf-textarea", "Textarea");
|
|
29
29
|
e("wf-select", "Select");
|
|
@@ -54,36 +54,51 @@ e("wf-stepper", "Stepper");
|
|
|
54
54
|
e("wf-step", "Step");
|
|
55
55
|
e("wf-progress", "Progress");
|
|
56
56
|
e("wf-alert-dialog", "AlertDialog");
|
|
57
|
-
function
|
|
58
|
-
const t =
|
|
59
|
-
t.off("change",
|
|
60
|
-
}), [t]),
|
|
61
|
-
return { user:
|
|
57
|
+
function G() {
|
|
58
|
+
const t = v(), n = f((c) => (t.on("change", c), t.on("logout", c), () => {
|
|
59
|
+
t.off("change", c), t.off("logout", c);
|
|
60
|
+
}), [t]), o = f(() => t.getUser(), [t]), s = d(n, o);
|
|
61
|
+
return { user: s, isAuthenticated: s !== null };
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function P() {
|
|
64
64
|
return typeof document > "u" ? "dark" : document.documentElement.getAttribute("data-theme") ?? "dark";
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
const t =
|
|
66
|
+
function M() {
|
|
67
|
+
const t = f((n) => {
|
|
68
68
|
if (typeof document > "u") return () => {
|
|
69
69
|
};
|
|
70
|
-
const
|
|
71
|
-
return
|
|
70
|
+
const o = new MutationObserver(() => n());
|
|
71
|
+
return o.observe(document.documentElement, { attributes: !0, attributeFilter: ["data-theme"] }), () => o.disconnect();
|
|
72
72
|
}, []);
|
|
73
|
-
return
|
|
73
|
+
return d(t, P, () => "dark");
|
|
74
|
+
}
|
|
75
|
+
function N(t) {
|
|
76
|
+
const n = w(null);
|
|
77
|
+
k(() => {
|
|
78
|
+
const o = new h(t);
|
|
79
|
+
return o.start(), n.current = o, () => o.dispose();
|
|
80
|
+
}, []);
|
|
81
|
+
}
|
|
82
|
+
function U(t = []) {
|
|
83
|
+
const [n] = p(() => new S(t)), [, o] = p(0), s = f((a) => n.can(a), [n]), c = f((a) => {
|
|
84
|
+
n.update(a), o((l) => l + 1);
|
|
85
|
+
}, [n]);
|
|
86
|
+
return { can: s, update: c };
|
|
74
87
|
}
|
|
75
88
|
export {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
y as Badge,
|
|
90
|
+
T as Button,
|
|
91
|
+
B as Divider,
|
|
92
|
+
W as ErrorFallback,
|
|
93
|
+
R as List,
|
|
94
|
+
O as ListItem,
|
|
95
|
+
D as Panel,
|
|
96
|
+
j as ScrollArea,
|
|
97
|
+
L as Skeleton,
|
|
98
|
+
I as StatusDot,
|
|
99
|
+
F as TextInput,
|
|
100
|
+
G as useAuth,
|
|
101
|
+
N as useIdleDetection,
|
|
102
|
+
U as usePermissions,
|
|
103
|
+
M as useTheme
|
|
89
104
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-idle-detection.d.ts","sourceRoot":"","sources":["../src/use-idle-detection.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEtE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAShE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-permissions.d.ts","sourceRoot":"","sources":["../src/use-permissions.ts"],"names":[],"mappings":"AAGA,wBAAgB,cAAc,CAAC,OAAO,GAAE,MAAM,EAAO;sBAId,MAAM;oBAER,MAAM,EAAE;EAM5C"}
|