@bizapps/ui 1.5.1 → 1.6.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/phone.cjs ADDED
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ var libphonenumberJs = require('libphonenumber-js');
4
+
5
+ // src/lib/phone.ts
6
+ function validatePhone(value) {
7
+ if (!value) {
8
+ return { isValid: false };
9
+ }
10
+ if (libphonenumberJs.isValidPhoneNumber(value)) {
11
+ return { isValid: true };
12
+ }
13
+ return { isValid: false, problem: libphonenumberJs.validatePhoneNumberLength(value) ?? "INVALID" };
14
+ }
15
+
16
+ exports.validatePhone = validatePhone;
17
+ //# sourceMappingURL=phone.cjs.map
18
+ //# sourceMappingURL=phone.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/phone.ts"],"names":["isValidPhoneNumber","validatePhoneNumberLength"],"mappings":";;;;;AAmCO,SAAS,cAAc,KAAA,EAAmC;AAC7D,EAAA,IAAI,CAAC,KAAA,EAAO;AACR,IAAA,OAAO,EAAE,SAAS,KAAA,EAAM;AAAA,EAC5B;AACA,EAAA,IAAIA,mCAAA,CAAmB,KAAK,CAAA,EAAG;AAC3B,IAAA,OAAO,EAAE,SAAS,IAAA,EAAK;AAAA,EAC3B;AACA,EAAA,OAAO,EAAE,OAAA,EAAS,KAAA,EAAO,SAASC,0CAAA,CAA0B,KAAK,KAAK,SAAA,EAAU;AACpF","file":"phone.cjs","sourcesContent":["import { isValidPhoneNumber, validatePhoneNumberLength } from 'libphonenumber-js';\n\n/**\n * Why a value is not a valid phone number. Mirrors `libphonenumber-js`'\n * `validatePhoneNumberLength` result, plus `'INVALID'` for a value whose length\n * IS possible for its calling code but which is not a real number (e.g. an\n * 8-digit Colombian value: 8 is a possible fixed-line length, yet `3008...` is\n * not an assignable fixed-line prefix).\n *\n * The design system emits this code, never a message: the copy belongs to the\n * consumer's i18n catalog.\n */\nexport type PhoneFieldProblem =\n | 'TOO_SHORT'\n | 'TOO_LONG'\n | 'INVALID_LENGTH'\n | 'INVALID_COUNTRY'\n | 'NOT_A_NUMBER'\n | 'INVALID';\n\nexport interface PhoneFieldValidity {\n /** True only when the value is a valid, assignable number. */\n isValid: boolean;\n /** Why it is invalid. Absent for a valid value AND for an empty one. */\n problem?: PhoneFieldProblem;\n}\n\n/**\n * Validates an E.164 phone value. Pure and stateless — safe to share between\n * the field, a Zod schema and a server route handler so the rule is written\n * once.\n *\n * An empty value reports `{ isValid: false }` with no `problem`: emptiness is\n * the consumer's `required` rule, not a phone problem.\n */\nexport function validatePhone(value: string): PhoneFieldValidity {\n if (!value) {\n return { isValid: false };\n }\n if (isValidPhoneNumber(value)) {\n return { isValid: true };\n }\n return { isValid: false, problem: validatePhoneNumberLength(value) ?? 'INVALID' };\n}\n"]}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Why a value is not a valid phone number. Mirrors `libphonenumber-js`'
3
+ * `validatePhoneNumberLength` result, plus `'INVALID'` for a value whose length
4
+ * IS possible for its calling code but which is not a real number (e.g. an
5
+ * 8-digit Colombian value: 8 is a possible fixed-line length, yet `3008...` is
6
+ * not an assignable fixed-line prefix).
7
+ *
8
+ * The design system emits this code, never a message: the copy belongs to the
9
+ * consumer's i18n catalog.
10
+ */
11
+ type PhoneFieldProblem = 'TOO_SHORT' | 'TOO_LONG' | 'INVALID_LENGTH' | 'INVALID_COUNTRY' | 'NOT_A_NUMBER' | 'INVALID';
12
+ interface PhoneFieldValidity {
13
+ /** True only when the value is a valid, assignable number. */
14
+ isValid: boolean;
15
+ /** Why it is invalid. Absent for a valid value AND for an empty one. */
16
+ problem?: PhoneFieldProblem;
17
+ }
18
+ /**
19
+ * Validates an E.164 phone value. Pure and stateless — safe to share between
20
+ * the field, a Zod schema and a server route handler so the rule is written
21
+ * once.
22
+ *
23
+ * An empty value reports `{ isValid: false }` with no `problem`: emptiness is
24
+ * the consumer's `required` rule, not a phone problem.
25
+ */
26
+ declare function validatePhone(value: string): PhoneFieldValidity;
27
+
28
+ export { type PhoneFieldProblem, type PhoneFieldValidity, validatePhone };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Why a value is not a valid phone number. Mirrors `libphonenumber-js`'
3
+ * `validatePhoneNumberLength` result, plus `'INVALID'` for a value whose length
4
+ * IS possible for its calling code but which is not a real number (e.g. an
5
+ * 8-digit Colombian value: 8 is a possible fixed-line length, yet `3008...` is
6
+ * not an assignable fixed-line prefix).
7
+ *
8
+ * The design system emits this code, never a message: the copy belongs to the
9
+ * consumer's i18n catalog.
10
+ */
11
+ type PhoneFieldProblem = 'TOO_SHORT' | 'TOO_LONG' | 'INVALID_LENGTH' | 'INVALID_COUNTRY' | 'NOT_A_NUMBER' | 'INVALID';
12
+ interface PhoneFieldValidity {
13
+ /** True only when the value is a valid, assignable number. */
14
+ isValid: boolean;
15
+ /** Why it is invalid. Absent for a valid value AND for an empty one. */
16
+ problem?: PhoneFieldProblem;
17
+ }
18
+ /**
19
+ * Validates an E.164 phone value. Pure and stateless — safe to share between
20
+ * the field, a Zod schema and a server route handler so the rule is written
21
+ * once.
22
+ *
23
+ * An empty value reports `{ isValid: false }` with no `problem`: emptiness is
24
+ * the consumer's `required` rule, not a phone problem.
25
+ */
26
+ declare function validatePhone(value: string): PhoneFieldValidity;
27
+
28
+ export { type PhoneFieldProblem, type PhoneFieldValidity, validatePhone };
package/dist/phone.js ADDED
@@ -0,0 +1,16 @@
1
+ import { isValidPhoneNumber, validatePhoneNumberLength } from 'libphonenumber-js';
2
+
3
+ // src/lib/phone.ts
4
+ function validatePhone(value) {
5
+ if (!value) {
6
+ return { isValid: false };
7
+ }
8
+ if (isValidPhoneNumber(value)) {
9
+ return { isValid: true };
10
+ }
11
+ return { isValid: false, problem: validatePhoneNumberLength(value) ?? "INVALID" };
12
+ }
13
+
14
+ export { validatePhone };
15
+ //# sourceMappingURL=phone.js.map
16
+ //# sourceMappingURL=phone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/phone.ts"],"names":[],"mappings":";;;AAmCO,SAAS,cAAc,KAAA,EAAmC;AAC7D,EAAA,IAAI,CAAC,KAAA,EAAO;AACR,IAAA,OAAO,EAAE,SAAS,KAAA,EAAM;AAAA,EAC5B;AACA,EAAA,IAAI,kBAAA,CAAmB,KAAK,CAAA,EAAG;AAC3B,IAAA,OAAO,EAAE,SAAS,IAAA,EAAK;AAAA,EAC3B;AACA,EAAA,OAAO,EAAE,OAAA,EAAS,KAAA,EAAO,SAAS,yBAAA,CAA0B,KAAK,KAAK,SAAA,EAAU;AACpF","file":"phone.js","sourcesContent":["import { isValidPhoneNumber, validatePhoneNumberLength } from 'libphonenumber-js';\n\n/**\n * Why a value is not a valid phone number. Mirrors `libphonenumber-js`'\n * `validatePhoneNumberLength` result, plus `'INVALID'` for a value whose length\n * IS possible for its calling code but which is not a real number (e.g. an\n * 8-digit Colombian value: 8 is a possible fixed-line length, yet `3008...` is\n * not an assignable fixed-line prefix).\n *\n * The design system emits this code, never a message: the copy belongs to the\n * consumer's i18n catalog.\n */\nexport type PhoneFieldProblem =\n | 'TOO_SHORT'\n | 'TOO_LONG'\n | 'INVALID_LENGTH'\n | 'INVALID_COUNTRY'\n | 'NOT_A_NUMBER'\n | 'INVALID';\n\nexport interface PhoneFieldValidity {\n /** True only when the value is a valid, assignable number. */\n isValid: boolean;\n /** Why it is invalid. Absent for a valid value AND for an empty one. */\n problem?: PhoneFieldProblem;\n}\n\n/**\n * Validates an E.164 phone value. Pure and stateless — safe to share between\n * the field, a Zod schema and a server route handler so the rule is written\n * once.\n *\n * An empty value reports `{ isValid: false }` with no `problem`: emptiness is\n * the consumer's `required` rule, not a phone problem.\n */\nexport function validatePhone(value: string): PhoneFieldValidity {\n if (!value) {\n return { isValid: false };\n }\n if (isValidPhoneNumber(value)) {\n return { isValid: true };\n }\n return { isValid: false, problem: validatePhoneNumberLength(value) ?? 'INVALID' };\n}\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.5.1",
6
+ "version": "1.6.0",
7
7
  "description": "This package provides reusable UI components to ensure consistency across all CRM frontend applications",
8
8
  "author": "BizAppsTotal <bizapps@tcce.biz>",
9
9
  "type": "module",
@@ -24,6 +24,16 @@
24
24
  "import": "./dist/policy.js",
25
25
  "require": "./dist/policy.cjs"
26
26
  },
27
+ "./phone": {
28
+ "types": "./dist/phone.d.ts",
29
+ "import": "./dist/phone.js",
30
+ "require": "./dist/phone.cjs"
31
+ },
32
+ "./editor": {
33
+ "types": "./dist/editor.d.ts",
34
+ "import": "./dist/editor.js",
35
+ "require": "./dist/editor.cjs"
36
+ },
27
37
  "./styles": "./dist/main.css"
28
38
  },
29
39
  "peerDependencies": {
@@ -35,6 +45,14 @@
35
45
  "@schedule-x/react": "4.1.0",
36
46
  "@schedule-x/theme-default": "4.6.0",
37
47
  "@tanstack/react-table": "^8.21.3",
48
+ "@tiptap/core": "^3.30.5",
49
+ "@tiptap/extension-highlight": "^3.30.5",
50
+ "@tiptap/extension-image": "^3.30.5",
51
+ "@tiptap/extension-link": "^3.30.5",
52
+ "@tiptap/extension-table": "^3.30.5",
53
+ "@tiptap/pm": "^3.30.5",
54
+ "@tiptap/react": "^3.30.5",
55
+ "@tiptap/starter-kit": "^3.30.5",
38
56
  "embla-carousel-react": "^8.6.0",
39
57
  "lucide-react": "^1.16.0",
40
58
  "motion": "^12.23.13",
@@ -72,6 +90,30 @@
72
90
  "@tanstack/react-table": {
73
91
  "optional": true
74
92
  },
93
+ "@tiptap/core": {
94
+ "optional": true
95
+ },
96
+ "@tiptap/extension-highlight": {
97
+ "optional": true
98
+ },
99
+ "@tiptap/extension-image": {
100
+ "optional": true
101
+ },
102
+ "@tiptap/extension-link": {
103
+ "optional": true
104
+ },
105
+ "@tiptap/extension-table": {
106
+ "optional": true
107
+ },
108
+ "@tiptap/pm": {
109
+ "optional": true
110
+ },
111
+ "@tiptap/react": {
112
+ "optional": true
113
+ },
114
+ "@tiptap/starter-kit": {
115
+ "optional": true
116
+ },
75
117
  "embla-carousel-react": {
76
118
  "optional": true
77
119
  },
@@ -110,6 +152,14 @@
110
152
  "@testing-library/jest-dom": "^7.0.0",
111
153
  "@testing-library/react": "^16.3.2",
112
154
  "@testing-library/user-event": "^14.6.1",
155
+ "@tiptap/core": "3.30.5",
156
+ "@tiptap/extension-highlight": "3.30.5",
157
+ "@tiptap/extension-image": "3.30.5",
158
+ "@tiptap/extension-link": "3.30.5",
159
+ "@tiptap/extension-table": "3.30.5",
160
+ "@tiptap/pm": "3.30.5",
161
+ "@tiptap/react": "3.30.5",
162
+ "@tiptap/starter-kit": "3.30.5",
113
163
  "@types/node": "^24.12.0",
114
164
  "@types/react": "^19.2.14",
115
165
  "@types/react-dom": "^19.2.3",