prom-pal-ui 1.5.3 → 1.5.5

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.
@@ -21599,7 +21599,7 @@ var index = /*#__PURE__*/Object.freeze({
21599
21599
  function t(r,e){try{var o=r();}catch(r){return e(r)}return o&&o.then?o.then(void 0,e):o}function s(r,e){for(var n={};r.length;){var t=r[0],s=t.code,i=t.message,a=t.path.join(".");if(!n[a])if("unionErrors"in t){var u=t.unionErrors[0].errors[0];n[a]={message:u.message,type:u.code};}else n[a]={message:i,type:s};if("unionErrors"in t&&t.unionErrors.forEach(function(e){return e.errors.forEach(function(e){return r.push(e)})}),e){var c=n[a].types,f=c&&c[t.code];n[a]=reactHookForm.appendErrors(a,e,n,s,f?[].concat(f,t.message):t.message);}r.shift();}return n}function i(r,e){for(var n={};r.length;){var t=r[0],s=t.code,i=t.message,a=t.path.join(".");if(!n[a])if("invalid_union"===t.code&&t.errors.length>0){var u=t.errors[0][0];n[a]={message:u.message,type:u.code};}else n[a]={message:i,type:s};if("invalid_union"===t.code&&t.errors.forEach(function(e){return e.forEach(function(e){return r.push(e)})}),e){var c=n[a].types,f=c&&c[t.code];n[a]=reactHookForm.appendErrors(a,e,n,s,f?[].concat(f,t.message):t.message);}r.shift();}return n}function a(o$1,a,u){if(void 0===u&&(u={}),function(r){return "_def"in r&&"object"==typeof r._def&&"typeName"in r._def}(o$1))return function(n,i,c){try{return Promise.resolve(t(function(){return Promise.resolve(o$1["sync"===u.mode?"parse":"parseAsync"](n,a)).then(function(e){return c.shouldUseNativeValidation&&o({},c),{errors:{},values:u.raw?Object.assign({},n):e}})},function(r){if(function(r){return Array.isArray(null==r?void 0:r.issues)}(r))return {values:{},errors:s$1(s(r.errors,!c.shouldUseNativeValidation&&"all"===c.criteriaMode),c)};throw r}))}catch(r){return Promise.reject(r)}};if(function(r){return "_zod"in r&&"object"==typeof r._zod}(o$1))return function(s,c,f){try{return Promise.resolve(t(function(){return Promise.resolve(("sync"===u.mode?parse$1:parseAsync$1)(o$1,s,a)).then(function(e){return f.shouldUseNativeValidation&&o({},f),{errors:{},values:u.raw?Object.assign({},s):e}})},function(r){if(function(r){return r instanceof $ZodError}(r))return {values:{},errors:s$1(i(r.issues,!f.shouldUseNativeValidation&&"all"===f.criteriaMode),f)};throw r}))}catch(r){return Promise.reject(r)}};throw new Error("Invalid input: not a Zod schema")}
21600
21600
 
21601
21601
  var PromFrom = function (_a) {
21602
- var schema = _a.schema, render = _a.render, children = _a.children, onSubmit = _a.onSubmit, _b = _a.defaultValues, defaultValues = _b === void 0 ? {} : _b, externalForm = _a.form;
21602
+ var schema = _a.schema, render = _a.render, children = _a.children, onSubmit = _a.onSubmit, _b = _a.defaultValues, defaultValues = _b === void 0 ? {} : _b, externalForm = _a.form, styleWrapper = _a.styleWrapper;
21603
21603
  var internalForm = reactHookForm.useForm({
21604
21604
  resolver: schema ? a(schema) : undefined,
21605
21605
  defaultValues: defaultValues,
@@ -21637,7 +21637,7 @@ var PromFrom = function (_a) {
21637
21637
  var handleSubmit = handleOnSubmit
21638
21638
  ? form.handleSubmit(handleOnSubmit)
21639
21639
  : undefined;
21640
- return (jsxRuntimeExports.jsx(reactHookForm.FormProvider, __assign({}, form, { children: jsxRuntimeExports.jsx("form", { onSubmit: handleSubmit, className: "space-y-4", onKeyDown: function (e) {
21640
+ return (jsxRuntimeExports.jsx(reactHookForm.FormProvider, __assign({}, form, { children: jsxRuntimeExports.jsx("form", { onSubmit: handleSubmit, className: cn("space-y-4", styleWrapper), onKeyDown: function (e) {
21641
21641
  if (e.key === "Enter" && !onSubmit) {
21642
21642
  e.preventDefault();
21643
21643
  }
@@ -21579,7 +21579,7 @@ var index = /*#__PURE__*/Object.freeze({
21579
21579
  function t(r,e){try{var o=r();}catch(r){return e(r)}return o&&o.then?o.then(void 0,e):o}function s(r,e){for(var n={};r.length;){var t=r[0],s=t.code,i=t.message,a=t.path.join(".");if(!n[a])if("unionErrors"in t){var u=t.unionErrors[0].errors[0];n[a]={message:u.message,type:u.code};}else n[a]={message:i,type:s};if("unionErrors"in t&&t.unionErrors.forEach(function(e){return e.errors.forEach(function(e){return r.push(e)})}),e){var c=n[a].types,f=c&&c[t.code];n[a]=appendErrors(a,e,n,s,f?[].concat(f,t.message):t.message);}r.shift();}return n}function i(r,e){for(var n={};r.length;){var t=r[0],s=t.code,i=t.message,a=t.path.join(".");if(!n[a])if("invalid_union"===t.code&&t.errors.length>0){var u=t.errors[0][0];n[a]={message:u.message,type:u.code};}else n[a]={message:i,type:s};if("invalid_union"===t.code&&t.errors.forEach(function(e){return e.forEach(function(e){return r.push(e)})}),e){var c=n[a].types,f=c&&c[t.code];n[a]=appendErrors(a,e,n,s,f?[].concat(f,t.message):t.message);}r.shift();}return n}function a(o$1,a,u){if(void 0===u&&(u={}),function(r){return "_def"in r&&"object"==typeof r._def&&"typeName"in r._def}(o$1))return function(n,i,c){try{return Promise.resolve(t(function(){return Promise.resolve(o$1["sync"===u.mode?"parse":"parseAsync"](n,a)).then(function(e){return c.shouldUseNativeValidation&&o({},c),{errors:{},values:u.raw?Object.assign({},n):e}})},function(r){if(function(r){return Array.isArray(null==r?void 0:r.issues)}(r))return {values:{},errors:s$1(s(r.errors,!c.shouldUseNativeValidation&&"all"===c.criteriaMode),c)};throw r}))}catch(r){return Promise.reject(r)}};if(function(r){return "_zod"in r&&"object"==typeof r._zod}(o$1))return function(s,c,f){try{return Promise.resolve(t(function(){return Promise.resolve(("sync"===u.mode?parse$1:parseAsync$1)(o$1,s,a)).then(function(e){return f.shouldUseNativeValidation&&o({},f),{errors:{},values:u.raw?Object.assign({},s):e}})},function(r){if(function(r){return r instanceof $ZodError}(r))return {values:{},errors:s$1(i(r.issues,!f.shouldUseNativeValidation&&"all"===f.criteriaMode),f)};throw r}))}catch(r){return Promise.reject(r)}};throw new Error("Invalid input: not a Zod schema")}
21580
21580
 
21581
21581
  var PromFrom = function (_a) {
21582
- var schema = _a.schema, render = _a.render, children = _a.children, onSubmit = _a.onSubmit, _b = _a.defaultValues, defaultValues = _b === void 0 ? {} : _b, externalForm = _a.form;
21582
+ var schema = _a.schema, render = _a.render, children = _a.children, onSubmit = _a.onSubmit, _b = _a.defaultValues, defaultValues = _b === void 0 ? {} : _b, externalForm = _a.form, styleWrapper = _a.styleWrapper;
21583
21583
  var internalForm = useForm({
21584
21584
  resolver: schema ? a(schema) : undefined,
21585
21585
  defaultValues: defaultValues,
@@ -21617,7 +21617,7 @@ var PromFrom = function (_a) {
21617
21617
  var handleSubmit = handleOnSubmit
21618
21618
  ? form.handleSubmit(handleOnSubmit)
21619
21619
  : undefined;
21620
- return (jsxRuntimeExports.jsx(FormProvider, __assign({}, form, { children: jsxRuntimeExports.jsx("form", { onSubmit: handleSubmit, className: "space-y-4", onKeyDown: function (e) {
21620
+ return (jsxRuntimeExports.jsx(FormProvider, __assign({}, form, { children: jsxRuntimeExports.jsx("form", { onSubmit: handleSubmit, className: cn("space-y-4", styleWrapper), onKeyDown: function (e) {
21621
21621
  if (e.key === "Enter" && !onSubmit) {
21622
21622
  e.preventDefault();
21623
21623
  }
@@ -1,40 +1,88 @@
1
1
  'use strict';
2
2
 
3
+ var _tslib = require('../_virtual/_tslib.js');
3
4
  var types = require('./types.js');
4
5
 
5
- // src/logger-client.ts
6
- class PromLoggerClient {
7
- async log(level, message, data) {
8
- try {
9
- const response = await fetch("/api/log", {
10
- method: "POST",
11
- headers: { "Content-Type": "application/json" },
12
- body: JSON.stringify({
13
- level,
14
- message,
15
- data,
16
- timestamp: new Date().toISOString(),
17
- }),
18
- });
19
- if (!response.ok) {
20
- console.error("Failed to send log:", await response.text());
21
- }
22
- }
23
- catch (e) {
24
- console.error("Failed to send log:", e);
25
- }
26
- }
27
- async info(message, data) {
28
- await this.log(types.PromLogLevel.INFO, message, data);
29
- }
30
- async warn(message, data) {
31
- await this.log(types.PromLogLevel.WARN, message, data);
32
- }
33
- async error(message, error, context) {
34
- const errorData = Object.assign(Object.assign({}, (error && Object.assign({ errorMessage: error.message, stack: error.stack }, (error.response && { status: error.response.status })))), (context && { context }));
35
- await this.log(types.PromLogLevel.ERROR, message, errorData);
6
+ var PromLoggerClient = /** @class */ (function () {
7
+ function PromLoggerClient() {
36
8
  }
37
- }
38
- const clientLogger = new PromLoggerClient();
9
+ PromLoggerClient.prototype.log = function (level, message, data) {
10
+ return _tslib.__awaiter(this, void 0, void 0, function () {
11
+ var response, _a, _b, _c, e_1;
12
+ return _tslib.__generator(this, function (_d) {
13
+ switch (_d.label) {
14
+ case 0:
15
+ _d.trys.push([0, 4, , 5]);
16
+ return [4 /*yield*/, fetch("/api/log", {
17
+ method: "POST",
18
+ headers: { "Content-Type": "application/json" },
19
+ body: JSON.stringify({
20
+ level: level,
21
+ message: message,
22
+ data: data,
23
+ timestamp: new Date().toISOString(),
24
+ }),
25
+ })];
26
+ case 1:
27
+ response = _d.sent();
28
+ if (!!response.ok) return [3 /*break*/, 3];
29
+ _b = (_a = console).error;
30
+ _c = ["Failed to send log:"];
31
+ return [4 /*yield*/, response.text()];
32
+ case 2:
33
+ _b.apply(_a, _c.concat([_d.sent()]));
34
+ _d.label = 3;
35
+ case 3: return [3 /*break*/, 5];
36
+ case 4:
37
+ e_1 = _d.sent();
38
+ console.error("Failed to send log:", e_1);
39
+ return [3 /*break*/, 5];
40
+ case 5: return [2 /*return*/];
41
+ }
42
+ });
43
+ });
44
+ };
45
+ PromLoggerClient.prototype.info = function (message, data) {
46
+ return _tslib.__awaiter(this, void 0, void 0, function () {
47
+ return _tslib.__generator(this, function (_a) {
48
+ switch (_a.label) {
49
+ case 0: return [4 /*yield*/, this.log(types.PromLogLevel.INFO, message, data)];
50
+ case 1:
51
+ _a.sent();
52
+ return [2 /*return*/];
53
+ }
54
+ });
55
+ });
56
+ };
57
+ PromLoggerClient.prototype.warn = function (message, data) {
58
+ return _tslib.__awaiter(this, void 0, void 0, function () {
59
+ return _tslib.__generator(this, function (_a) {
60
+ switch (_a.label) {
61
+ case 0: return [4 /*yield*/, this.log(types.PromLogLevel.WARN, message, data)];
62
+ case 1:
63
+ _a.sent();
64
+ return [2 /*return*/];
65
+ }
66
+ });
67
+ });
68
+ };
69
+ PromLoggerClient.prototype.error = function (message, error, context) {
70
+ return _tslib.__awaiter(this, void 0, void 0, function () {
71
+ var errorData;
72
+ return _tslib.__generator(this, function (_a) {
73
+ switch (_a.label) {
74
+ case 0:
75
+ errorData = _tslib.__assign(_tslib.__assign({}, (error && _tslib.__assign({ errorMessage: error.message, stack: error.stack }, (error.response && { status: error.response.status })))), (context && { context: context }));
76
+ return [4 /*yield*/, this.log(types.PromLogLevel.ERROR, message, errorData)];
77
+ case 1:
78
+ _a.sent();
79
+ return [2 /*return*/];
80
+ }
81
+ });
82
+ });
83
+ };
84
+ return PromLoggerClient;
85
+ }());
86
+ var clientLogger = new PromLoggerClient();
39
87
 
40
88
  exports.clientLogger = clientLogger;
@@ -1,38 +1,86 @@
1
+ import { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
1
2
  import { PromLogLevel } from './types.js';
2
3
 
3
- // src/logger-client.ts
4
- class PromLoggerClient {
5
- async log(level, message, data) {
6
- try {
7
- const response = await fetch("/api/log", {
8
- method: "POST",
9
- headers: { "Content-Type": "application/json" },
10
- body: JSON.stringify({
11
- level,
12
- message,
13
- data,
14
- timestamp: new Date().toISOString(),
15
- }),
16
- });
17
- if (!response.ok) {
18
- console.error("Failed to send log:", await response.text());
19
- }
20
- }
21
- catch (e) {
22
- console.error("Failed to send log:", e);
23
- }
24
- }
25
- async info(message, data) {
26
- await this.log(PromLogLevel.INFO, message, data);
27
- }
28
- async warn(message, data) {
29
- await this.log(PromLogLevel.WARN, message, data);
30
- }
31
- async error(message, error, context) {
32
- const errorData = Object.assign(Object.assign({}, (error && Object.assign({ errorMessage: error.message, stack: error.stack }, (error.response && { status: error.response.status })))), (context && { context }));
33
- await this.log(PromLogLevel.ERROR, message, errorData);
4
+ var PromLoggerClient = /** @class */ (function () {
5
+ function PromLoggerClient() {
34
6
  }
35
- }
36
- const clientLogger = new PromLoggerClient();
7
+ PromLoggerClient.prototype.log = function (level, message, data) {
8
+ return __awaiter(this, void 0, void 0, function () {
9
+ var response, _a, _b, _c, e_1;
10
+ return __generator(this, function (_d) {
11
+ switch (_d.label) {
12
+ case 0:
13
+ _d.trys.push([0, 4, , 5]);
14
+ return [4 /*yield*/, fetch("/api/log", {
15
+ method: "POST",
16
+ headers: { "Content-Type": "application/json" },
17
+ body: JSON.stringify({
18
+ level: level,
19
+ message: message,
20
+ data: data,
21
+ timestamp: new Date().toISOString(),
22
+ }),
23
+ })];
24
+ case 1:
25
+ response = _d.sent();
26
+ if (!!response.ok) return [3 /*break*/, 3];
27
+ _b = (_a = console).error;
28
+ _c = ["Failed to send log:"];
29
+ return [4 /*yield*/, response.text()];
30
+ case 2:
31
+ _b.apply(_a, _c.concat([_d.sent()]));
32
+ _d.label = 3;
33
+ case 3: return [3 /*break*/, 5];
34
+ case 4:
35
+ e_1 = _d.sent();
36
+ console.error("Failed to send log:", e_1);
37
+ return [3 /*break*/, 5];
38
+ case 5: return [2 /*return*/];
39
+ }
40
+ });
41
+ });
42
+ };
43
+ PromLoggerClient.prototype.info = function (message, data) {
44
+ return __awaiter(this, void 0, void 0, function () {
45
+ return __generator(this, function (_a) {
46
+ switch (_a.label) {
47
+ case 0: return [4 /*yield*/, this.log(PromLogLevel.INFO, message, data)];
48
+ case 1:
49
+ _a.sent();
50
+ return [2 /*return*/];
51
+ }
52
+ });
53
+ });
54
+ };
55
+ PromLoggerClient.prototype.warn = function (message, data) {
56
+ return __awaiter(this, void 0, void 0, function () {
57
+ return __generator(this, function (_a) {
58
+ switch (_a.label) {
59
+ case 0: return [4 /*yield*/, this.log(PromLogLevel.WARN, message, data)];
60
+ case 1:
61
+ _a.sent();
62
+ return [2 /*return*/];
63
+ }
64
+ });
65
+ });
66
+ };
67
+ PromLoggerClient.prototype.error = function (message, error, context) {
68
+ return __awaiter(this, void 0, void 0, function () {
69
+ var errorData;
70
+ return __generator(this, function (_a) {
71
+ switch (_a.label) {
72
+ case 0:
73
+ errorData = __assign(__assign({}, (error && __assign({ errorMessage: error.message, stack: error.stack }, (error.response && { status: error.response.status })))), (context && { context: context }));
74
+ return [4 /*yield*/, this.log(PromLogLevel.ERROR, message, errorData)];
75
+ case 1:
76
+ _a.sent();
77
+ return [2 /*return*/];
78
+ }
79
+ });
80
+ });
81
+ };
82
+ return PromLoggerClient;
83
+ }());
84
+ var clientLogger = new PromLoggerClient();
37
85
 
38
86
  export { clientLogger };
@@ -15,13 +15,14 @@ type PromFormRenderProps = {
15
15
  };
16
16
  interface PromFromProps extends CommonPromComponentProps {
17
17
  children?: ReactNode;
18
+ styleWrapper?: string;
18
19
  schema?: z.ZodObject<any>;
19
20
  defaultValues?: z.infer<any>;
20
21
  form?: ExtendedFormMethods<z.infer<any>>;
21
22
  onSubmit?: (data: z.infer<any>) => Promise<void>;
22
23
  render?: (props: PromFormRenderProps) => ReactNode;
23
24
  }
24
- declare const PromFrom: ({ schema, render, children, onSubmit, defaultValues, form: externalForm, }: PromFromProps) => import("react/jsx-runtime").JSX.Element;
25
+ declare const PromFrom: ({ schema, render, children, onSubmit, defaultValues, form: externalForm, styleWrapper, }: PromFromProps) => import("react/jsx-runtime").JSX.Element;
25
26
  declare const usePromForm: <T extends FieldValues>() => {
26
27
  form: ExtendedFormMethods<T>;
27
28
  errors: import("react-hook-form").FieldErrors<T>;
@@ -0,0 +1 @@
1
+ export default function logger(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prom-pal-ui",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "type": "module",
5
5
  "main": "build/cjs/index.js",
6
6
  "module": "build/esm/index.js",
@@ -18,11 +18,6 @@
18
18
  "import": "./build/function/esm/index.js",
19
19
  "require": "./build/function/cjs/index.js",
20
20
  "types": "./build/types/function/index.d.ts"
21
- },
22
- "./server": {
23
- "import": "./build/server/esm/index.js",
24
- "require": "./build/server/cjs/index.js",
25
- "types": "./build/types/server/index.d.ts"
26
21
  }
27
22
  },
28
23
  "publishConfig": {
@@ -79,5 +74,8 @@
79
74
  "react-hook-form": "^7.69.0",
80
75
  "zod": "^4.3.4"
81
76
  },
82
- "dependencies": {}
77
+ "dependencies": {
78
+ "@radix-ui/react-dialog": "^1.1.15",
79
+ "@radix-ui/react-tooltip": "^1.2.8"
80
+ }
83
81
  }