@workfort/ui-react 0.0.1
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/components.d.ts +68 -0
- package/dist/components.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/use-auth.d.ts +6 -0
- package/dist/use-auth.d.ts.map +1 -0
- package/dist/use-theme.d.ts +4 -0
- package/dist/use-theme.d.ts.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { WfPanel, WfButton, WfBadge, WfStatusDot, WfSkeleton, WfTextInput, WfList, WfListItem, WfScrollArea, WfErrorFallback } from '@workfort/ui';
|
|
3
|
+
export declare const Panel: React.ForwardRefExoticComponent<{
|
|
4
|
+
label?: string;
|
|
5
|
+
} & React.HTMLAttributes<WfPanel> & {
|
|
6
|
+
[key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
} & React.RefAttributes<WfPanel>>;
|
|
9
|
+
export declare const Button: React.ForwardRefExoticComponent<{
|
|
10
|
+
variant?: "text" | "filled";
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
} & React.HTMLAttributes<WfButton> & {
|
|
13
|
+
[key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
} & React.RefAttributes<WfButton>>;
|
|
16
|
+
export declare const Badge: React.ForwardRefExoticComponent<{
|
|
17
|
+
count?: number;
|
|
18
|
+
} & React.HTMLAttributes<WfBadge> & {
|
|
19
|
+
[key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
} & React.RefAttributes<WfBadge>>;
|
|
22
|
+
export declare const StatusDot: React.ForwardRefExoticComponent<{
|
|
23
|
+
status?: string;
|
|
24
|
+
} & React.HTMLAttributes<WfStatusDot> & {
|
|
25
|
+
[key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
} & React.RefAttributes<WfStatusDot>>;
|
|
28
|
+
export declare const Skeleton: React.ForwardRefExoticComponent<{
|
|
29
|
+
width?: string;
|
|
30
|
+
height?: string;
|
|
31
|
+
} & React.HTMLAttributes<WfSkeleton> & {
|
|
32
|
+
[key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
} & React.RefAttributes<WfSkeleton>>;
|
|
35
|
+
export declare const Divider: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
36
|
+
[key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
|
|
37
|
+
children?: React.ReactNode;
|
|
38
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
39
|
+
export declare const TextInput: React.ForwardRefExoticComponent<{
|
|
40
|
+
placeholder?: string;
|
|
41
|
+
value?: string;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
} & React.HTMLAttributes<WfTextInput> & {
|
|
44
|
+
[key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
|
|
45
|
+
children?: React.ReactNode;
|
|
46
|
+
} & React.RefAttributes<WfTextInput>>;
|
|
47
|
+
export declare const List: React.ForwardRefExoticComponent<React.HTMLAttributes<WfList> & {
|
|
48
|
+
[key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
|
|
49
|
+
children?: React.ReactNode;
|
|
50
|
+
} & React.RefAttributes<WfList>>;
|
|
51
|
+
export declare const ListItem: React.ForwardRefExoticComponent<{
|
|
52
|
+
active?: boolean;
|
|
53
|
+
} & React.HTMLAttributes<WfListItem> & {
|
|
54
|
+
[key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
|
|
55
|
+
children?: React.ReactNode;
|
|
56
|
+
} & React.RefAttributes<WfListItem>>;
|
|
57
|
+
export declare const ScrollArea: React.ForwardRefExoticComponent<React.HTMLAttributes<WfScrollArea> & {
|
|
58
|
+
[key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
|
|
59
|
+
children?: React.ReactNode;
|
|
60
|
+
} & React.RefAttributes<WfScrollArea>>;
|
|
61
|
+
export declare const ErrorFallback: React.ForwardRefExoticComponent<{
|
|
62
|
+
title?: string;
|
|
63
|
+
message?: string;
|
|
64
|
+
} & React.HTMLAttributes<WfErrorFallback> & {
|
|
65
|
+
[key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
|
|
66
|
+
children?: React.ReactNode;
|
|
67
|
+
} & React.RefAttributes<WfErrorFallback>>;
|
|
68
|
+
//# sourceMappingURL=components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAC/D,OAAO,cAAc,CAAC;AAEtB,OAAO,KAAK,EACV,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EACnD,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAC/D,MAAM,cAAc,CAAC;AAqEtB,eAAO,MAAM,KAAK;YAA6B,MAAM;;yDAhEE,OAAO,EAAE,KAAK,IAAI;eAF5D,KAAK,CAAC,SAAS;iCAkEiD,CAAC;AAC9E,eAAO,MAAM,MAAM;cAAgC,MAAM,GAAG,QAAQ;eAAa,OAAO;;yDAjEjC,OAAO,EAAE,KAAK,IAAI;eAF5D,KAAK,CAAC,SAAS;kCAmEsF,CAAC;AACnH,eAAO,MAAM,KAAK;YAA6B,MAAM;;yDAlEE,OAAO,EAAE,KAAK,IAAI;eAF5D,KAAK,C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ACzB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import d, { forwardRef as w, useRef as m, useCallback as l, useSyncExternalStore as p } from "react";
|
|
2
|
+
import "@workfort/ui";
|
|
3
|
+
import { getAuthClient as g } from "@workfort/auth";
|
|
4
|
+
function k(t, u) {
|
|
5
|
+
const n = m(null), s = m(/* @__PURE__ */ new Map()), o = {}, a = {};
|
|
6
|
+
for (const [e, c] of Object.entries(u))
|
|
7
|
+
if (e.startsWith("on") && e.length > 2 && typeof c == "function") {
|
|
8
|
+
const b = (e[2].toLowerCase() + e.slice(3)).replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
9
|
+
a[b] = c;
|
|
10
|
+
} else
|
|
11
|
+
o[e] = c;
|
|
12
|
+
return { ref: l((e) => {
|
|
13
|
+
if (n.current && (s.current.forEach((c, i) => n.current.removeEventListener(i, c)), s.current.clear()), n.current = e, e)
|
|
14
|
+
for (const [c, i] of Object.entries(a))
|
|
15
|
+
e.addEventListener(c, i), s.current.set(c, i);
|
|
16
|
+
typeof t == "function" ? t(e) : t && (t.current = e);
|
|
17
|
+
}, [t, ...Object.keys(a)]), cleanProps: o };
|
|
18
|
+
}
|
|
19
|
+
function r(t, u) {
|
|
20
|
+
const n = w(({ children: s, ...o }, a) => {
|
|
21
|
+
const { ref: f, cleanProps: e } = k(a, o);
|
|
22
|
+
return d.createElement(t, { ref: f, ...e }, s);
|
|
23
|
+
});
|
|
24
|
+
return n.displayName = u, n;
|
|
25
|
+
}
|
|
26
|
+
const y = r("wf-panel", "Panel"), L = r("wf-button", "Button"), A = r("wf-badge", "Badge"), C = r("wf-status-dot", "StatusDot"), x = r("wf-skeleton", "Skeleton"), P = r("wf-divider", "Divider"), B = r("wf-text-input", "TextInput"), D = r("wf-list", "List"), I = r("wf-list-item", "ListItem"), O = r("wf-scroll-area", "ScrollArea"), T = r("wf-error-fallback", "ErrorFallback");
|
|
27
|
+
function j() {
|
|
28
|
+
const t = g(), u = l((o) => (t.on("change", o), t.on("logout", o), () => {
|
|
29
|
+
t.off("change", o), t.off("logout", o);
|
|
30
|
+
}), [t]), n = l(() => t.getUser(), [t]), s = p(u, n);
|
|
31
|
+
return { user: s, isAuthenticated: s !== null };
|
|
32
|
+
}
|
|
33
|
+
function h() {
|
|
34
|
+
return typeof document > "u" ? "dark" : document.documentElement.getAttribute("data-theme") ?? "dark";
|
|
35
|
+
}
|
|
36
|
+
function F() {
|
|
37
|
+
const t = l((u) => {
|
|
38
|
+
if (typeof document > "u") return () => {
|
|
39
|
+
};
|
|
40
|
+
const n = new MutationObserver(() => u());
|
|
41
|
+
return n.observe(document.documentElement, { attributes: !0, attributeFilter: ["data-theme"] }), () => n.disconnect();
|
|
42
|
+
}, []);
|
|
43
|
+
return p(t, h, () => "dark");
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
A as Badge,
|
|
47
|
+
L as Button,
|
|
48
|
+
P as Divider,
|
|
49
|
+
T as ErrorFallback,
|
|
50
|
+
D as List,
|
|
51
|
+
I as ListItem,
|
|
52
|
+
y as Panel,
|
|
53
|
+
O as ScrollArea,
|
|
54
|
+
x as Skeleton,
|
|
55
|
+
C as StatusDot,
|
|
56
|
+
B as TextInput,
|
|
57
|
+
j as useAuth,
|
|
58
|
+
F as useTheme
|
|
59
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-auth.d.ts","sourceRoot":"","sources":["../src/use-auth.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,wBAAgB,OAAO,IAAI;IAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAAC,eAAe,EAAE,OAAO,CAAA;CAAE,CAUzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-theme.d.ts","sourceRoot":"","sources":["../src/use-theme.ts"],"names":[],"mappings":"AAEA,KAAK,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAO9B,wBAAgB,QAAQ,IAAI,KAAK,CAQhC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@workfort/ui-react",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"default": "./dist/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "vite build",
|
|
17
|
+
"test": "vitest run"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@workfort/auth": "^0.0.1"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@workfort/ui": "^0.0.1",
|
|
24
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@workfort/ui": "workspace:*",
|
|
28
|
+
"@testing-library/react": "^16.0.0",
|
|
29
|
+
"@types/react": "^18.3.0",
|
|
30
|
+
"@vitejs/plugin-react": "^4.3.0",
|
|
31
|
+
"react": "^18.3.0",
|
|
32
|
+
"react-dom": "^18.3.0",
|
|
33
|
+
"typescript": "^5.6.0",
|
|
34
|
+
"vite": "^6.0.0",
|
|
35
|
+
"vite-plugin-dts": "^4.0.0",
|
|
36
|
+
"vitest": "^2.1.0",
|
|
37
|
+
"happy-dom": "^15.0.0"
|
|
38
|
+
}
|
|
39
|
+
}
|