@workfort/ui-react 0.0.1 → 0.1.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.
@@ -1,5 +1,4 @@
1
1
  import { default as React } from 'react';
2
- import { WfPanel, WfButton, WfBadge, WfStatusDot, WfSkeleton, WfTextInput, WfList, WfListItem, WfScrollArea, WfErrorFallback } from '@workfort/ui';
3
2
  export declare const Panel: React.ForwardRefExoticComponent<{
4
3
  label?: string;
5
4
  } & React.HTMLAttributes<WfPanel> & {
@@ -65,4 +64,103 @@ export declare const ErrorFallback: React.ForwardRefExoticComponent<{
65
64
  [key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
66
65
  children?: React.ReactNode;
67
66
  } & React.RefAttributes<WfErrorFallback>>;
67
+ export declare const Input: React.ForwardRefExoticComponent<{
68
+ label?: string;
69
+ type?: string;
70
+ placeholder?: string;
71
+ disabled?: boolean;
72
+ readonly?: boolean;
73
+ } & React.HTMLAttributes<WfInput> & {
74
+ [key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
75
+ children?: React.ReactNode;
76
+ } & React.RefAttributes<WfInput>>;
77
+ export declare const Textarea: React.ForwardRefExoticComponent<{
78
+ label?: string;
79
+ disabled?: boolean;
80
+ readonly?: boolean;
81
+ } & React.HTMLAttributes<WfTextarea> & {
82
+ [key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
83
+ children?: React.ReactNode;
84
+ } & React.RefAttributes<WfTextarea>>;
85
+ export declare const Select: React.ForwardRefExoticComponent<{
86
+ label?: string;
87
+ disabled?: boolean;
88
+ } & React.HTMLAttributes<WfSelect> & {
89
+ [key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
90
+ children?: React.ReactNode;
91
+ } & React.RefAttributes<WfSelect>>;
92
+ export declare const Checkbox: React.ForwardRefExoticComponent<{
93
+ label?: string;
94
+ disabled?: boolean;
95
+ } & React.HTMLAttributes<WfCheckbox> & {
96
+ [key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
97
+ children?: React.ReactNode;
98
+ } & React.RefAttributes<WfCheckbox>>;
99
+ export declare const CheckboxGroup: React.ForwardRefExoticComponent<{
100
+ label?: string;
101
+ } & React.HTMLAttributes<WfCheckboxGroup> & {
102
+ [key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
103
+ children?: React.ReactNode;
104
+ } & React.RefAttributes<WfCheckboxGroup>>;
105
+ export declare const Radio: React.ForwardRefExoticComponent<{
106
+ label?: string;
107
+ disabled?: boolean;
108
+ } & React.HTMLAttributes<WfRadio> & {
109
+ [key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
110
+ children?: React.ReactNode;
111
+ } & React.RefAttributes<WfRadio>>;
112
+ export declare const RadioGroup: React.ForwardRefExoticComponent<{
113
+ label?: string;
114
+ } & React.HTMLAttributes<WfRadioGroup> & {
115
+ [key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
116
+ children?: React.ReactNode;
117
+ } & React.RefAttributes<WfRadioGroup>>;
118
+ export declare const Toggle: React.ForwardRefExoticComponent<{
119
+ checked?: boolean;
120
+ disabled?: boolean;
121
+ } & React.HTMLAttributes<WfToggle> & {
122
+ [key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
123
+ children?: React.ReactNode;
124
+ } & React.RefAttributes<WfToggle>>;
125
+ export declare const Slider: React.ForwardRefExoticComponent<{
126
+ min?: number;
127
+ max?: number;
128
+ step?: number;
129
+ value?: number;
130
+ disabled?: boolean;
131
+ } & React.HTMLAttributes<WfSlider> & {
132
+ [key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
133
+ children?: React.ReactNode;
134
+ } & React.RefAttributes<WfSlider>>;
135
+ export declare const Combobox: React.ForwardRefExoticComponent<{
136
+ label?: string;
137
+ placeholder?: string;
138
+ value?: string;
139
+ disabled?: boolean;
140
+ } & React.HTMLAttributes<WfCombobox> & {
141
+ [key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
142
+ children?: React.ReactNode;
143
+ } & React.RefAttributes<WfCombobox>>;
144
+ export declare const DatePicker: React.ForwardRefExoticComponent<{
145
+ label?: string;
146
+ value?: string;
147
+ min?: string;
148
+ max?: string;
149
+ disabled?: boolean;
150
+ } & React.HTMLAttributes<WfDatePicker> & {
151
+ [key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
152
+ children?: React.ReactNode;
153
+ } & React.RefAttributes<WfDatePicker>>;
154
+ export declare const FileUpload: React.ForwardRefExoticComponent<{
155
+ accept?: string;
156
+ multiple?: boolean;
157
+ disabled?: boolean;
158
+ } & React.HTMLAttributes<WfFileUpload> & {
159
+ [key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
160
+ children?: React.ReactNode;
161
+ } & React.RefAttributes<WfFileUpload>>;
162
+ export declare const Form: React.ForwardRefExoticComponent<React.HTMLAttributes<WfForm> & {
163
+ [key: `on${Uppercase<string>}${string}`]: ((...args: unknown[]) => void) | undefined;
164
+ children?: React.ReactNode;
165
+ } & React.RefAttributes<WfForm>>;
68
166
  //# sourceMappingURL=components.d.ts.map
@@ -1 +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,MA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IAAI;eAF5D,KAAK,CAAC,SAAS;kCAuFoH,CAAC;AACjJ,eAAO,MAAM,QAAQ;YAAgC,MAAM;kBAAgB,MAAM;YAAU,MAAM;eAAa,OAAO;;yDAtF9D,OAAO,EAAE,KAAK,IAAI;eAF5D,KAAK,CAAC,SAAS;oCAwFuH,CAAC;AACpJ,eAAO,MAAM,UAAU;YAAkC,MAAM;YAAU,MAAM;UAAQ,MAAM;UAAQ,MAAM;eAAa,OAAO;;yDAvFxE,OAAO,EAAE,KAAK,IAAI;eAF5D,KAAK,CAAC,SAAS;sCAyFsI,CAAC;AACnK,eAAO,MAAM,UAAU;aAAmC,MAAM;eAAa,OAAO;eAAa,OAAO;;yDAxFjD,OAAO,EAAE,KAAK,IAAI;eAF5D,KAAK,CAAC,SAAS;sCA0F+G,CAAC;AAC5I,eAAO,MAAM,IAAI;yDAzFsC,OAAO,EAAE,KAAK,IAAI;eAF5D,KAAK,CAAC,SAAS;gCA2F6B,CAAC"}
package/dist/index.js CHANGED
@@ -1,59 +1,72 @@
1
- import d, { forwardRef as w, useRef as m, useCallback as l, useSyncExternalStore as p } from "react";
1
+ import b, { forwardRef as d, useRef as m, useCallback as f, useSyncExternalStore as p } from "react";
2
2
  import "@workfort/ui";
3
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;
4
+ function k(t, a) {
5
+ const o = m(null), c = m(/* @__PURE__ */ new Map()), r = {}, u = {};
6
+ for (const [n, s] of Object.entries(a))
7
+ if (n.startsWith("on") && n.length > 2 && typeof s == "function") {
8
+ const w = (n[2].toLowerCase() + n.slice(3)).replace(/([A-Z])/g, "-$1").toLowerCase();
9
+ u[w] = s;
10
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 };
11
+ r[n] = s;
12
+ return { ref: f((n) => {
13
+ if (o.current && (c.current.forEach((s, i) => o.current.removeEventListener(i, s)), c.current.clear()), o.current = n, n)
14
+ for (const [s, i] of Object.entries(u))
15
+ n.addEventListener(s, i), c.current.set(s, i);
16
+ typeof t == "function" ? t(n) : t && (t.current = n);
17
+ }, [t, ...Object.keys(u)]), cleanProps: r };
18
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);
19
+ function e(t, a) {
20
+ const o = d(({ children: c, ...r }, u) => {
21
+ const { ref: l, cleanProps: n } = k(u, r);
22
+ return b.createElement(t, { ref: l, ...n }, c);
23
23
  });
24
- return n.displayName = u, n;
24
+ return o.displayName = a, o;
25
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 };
26
+ const C = e("wf-panel", "Panel"), E = e("wf-button", "Button"), y = e("wf-badge", "Badge"), L = e("wf-status-dot", "StatusDot"), A = e("wf-skeleton", "Skeleton"), P = e("wf-divider", "Divider"), T = e("wf-text-input", "TextInput"), D = e("wf-list", "List"), F = e("wf-list-item", "ListItem"), I = e("wf-scroll-area", "ScrollArea"), B = e("wf-error-fallback", "ErrorFallback");
27
+ e("wf-input", "Input");
28
+ e("wf-textarea", "Textarea");
29
+ e("wf-select", "Select");
30
+ e("wf-checkbox", "Checkbox");
31
+ e("wf-checkbox-group", "CheckboxGroup");
32
+ e("wf-radio", "Radio");
33
+ e("wf-radio-group", "RadioGroup");
34
+ e("wf-toggle", "Toggle");
35
+ e("wf-slider", "Slider");
36
+ e("wf-combobox", "Combobox");
37
+ e("wf-date-picker", "DatePicker");
38
+ e("wf-file-upload", "FileUpload");
39
+ e("wf-form", "Form");
40
+ function O() {
41
+ const t = g(), a = f((r) => (t.on("change", r), t.on("logout", r), () => {
42
+ t.off("change", r), t.off("logout", r);
43
+ }), [t]), o = f(() => t.getUser(), [t]), c = p(a, o);
44
+ return { user: c, isAuthenticated: c !== null };
32
45
  }
33
46
  function h() {
34
47
  return typeof document > "u" ? "dark" : document.documentElement.getAttribute("data-theme") ?? "dark";
35
48
  }
36
- function F() {
37
- const t = l((u) => {
49
+ function R() {
50
+ const t = f((a) => {
38
51
  if (typeof document > "u") return () => {
39
52
  };
40
- const n = new MutationObserver(() => u());
41
- return n.observe(document.documentElement, { attributes: !0, attributeFilter: ["data-theme"] }), () => n.disconnect();
53
+ const o = new MutationObserver(() => a());
54
+ return o.observe(document.documentElement, { attributes: !0, attributeFilter: ["data-theme"] }), () => o.disconnect();
42
55
  }, []);
43
56
  return p(t, h, () => "dark");
44
57
  }
45
58
  export {
46
- A as Badge,
47
- L as Button,
59
+ y as Badge,
60
+ E as Button,
48
61
  P as Divider,
49
- T as ErrorFallback,
62
+ B as ErrorFallback,
50
63
  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
64
+ F as ListItem,
65
+ C as Panel,
66
+ I as ScrollArea,
67
+ A as Skeleton,
68
+ L as StatusDot,
69
+ T as TextInput,
70
+ O as useAuth,
71
+ R as useTheme
59
72
  };
package/package.json CHANGED
@@ -1,14 +1,20 @@
1
1
  {
2
2
  "name": "@workfort/ui-react",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
7
7
  ".": {
8
8
  "types": "./dist/index.d.ts",
9
+ "development": "./src/index.tsx",
9
10
  "default": "./dist/index.js"
10
11
  }
11
12
  },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/Work-Fort/Scope",
16
+ "directory": "web/packages/react"
17
+ },
12
18
  "files": [
13
19
  "dist"
14
20
  ],
@@ -24,16 +30,16 @@
24
30
  "react": "^18.0.0 || ^19.0.0"
25
31
  },
26
32
  "devDependencies": {
27
- "@workfort/ui": "workspace:*",
28
33
  "@testing-library/react": "^16.0.0",
29
34
  "@types/react": "^18.3.0",
30
35
  "@vitejs/plugin-react": "^4.3.0",
36
+ "@workfort/ui": "workspace:*",
37
+ "happy-dom": "^15.0.0",
31
38
  "react": "^18.3.0",
32
39
  "react-dom": "^18.3.0",
33
40
  "typescript": "^5.6.0",
34
41
  "vite": "^6.0.0",
35
42
  "vite-plugin-dts": "^4.0.0",
36
- "vitest": "^2.1.0",
37
- "happy-dom": "^15.0.0"
43
+ "vitest": "^2.1.0"
38
44
  }
39
45
  }