@emeraldemperaur/vector-sigma 1.4.47 → 1.4.49
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/README.md +11 -3
- package/lib/index.cjs +42 -25
- package/lib/index.esm.js +42 -25
- package/lib/types/components/image/image.d.ts +0 -2
- package/lib/types/vectorSigma.d.ts +30 -13
- package/package.json +7 -12
package/README.md
CHANGED
|
@@ -15,18 +15,22 @@ Vector Sigma (VΣ) is a dynamic form orchestrator package for rapidly creating a
|
|
|
15
15
|
#### Key Features
|
|
16
16
|
<ol>
|
|
17
17
|
<li>
|
|
18
|
-
<strong>Real-Time Form Adaptation:</strong> Adapt the
|
|
18
|
+
<strong>Real-Time Form Adaptation:</strong> Adapt the xForm layout by adding/removing fields, sections or entire steps based on conditional logic.</li>
|
|
19
19
|
<li>
|
|
20
20
|
<strong>Validation Logic Management:</strong> Centralize business rules such as complex field validation, visibility constraints, and facilitate input value pre-population from external APIs.
|
|
21
21
|
</li>
|
|
22
22
|
<li>
|
|
23
|
-
<strong>Form State Coordination:</strong> Monitor the "state" of the
|
|
23
|
+
<strong>Form State Coordination:</strong> Monitor the "state" of the xForm across multi-step processes, allowing users to save progress and resume later.
|
|
24
24
|
</li>
|
|
25
25
|
<li>
|
|
26
|
-
<strong>Application UI Integration:</strong> Connects the
|
|
26
|
+
<strong>Application UI Integration:</strong> Connects the xForm data to backend workflows, CRM systems, or databases immediately upon submission.</li>
|
|
27
27
|
</ol>
|
|
28
28
|
|
|
29
29
|
### Documentation
|
|
30
|
+
<ul>
|
|
31
|
+
<li><a href="#">VΣ Documentation</a></li>
|
|
32
|
+
<li><a href="#">χForm Components Storybook</a></li>
|
|
33
|
+
<ul>
|
|
30
34
|
|
|
31
35
|
### Installation
|
|
32
36
|
```bash
|
|
@@ -455,6 +459,10 @@ const App = () => {
|
|
|
455
459
|

|
|
456
460
|

|
|
457
461
|

|
|
462
|
+
[](https://storybook.js.org)
|
|
463
|
+

|
|
464
|
+

|
|
465
|
+

|
|
458
466
|
|
|
459
467
|
|
|
460
468
|
### Changeset Versioning Synopsis
|
package/lib/index.cjs
CHANGED
|
@@ -32044,26 +32044,30 @@ const getStyles = (design, layout) => {
|
|
|
32044
32044
|
border: '1px solid var(--gray-6)',
|
|
32045
32045
|
};
|
|
32046
32046
|
}
|
|
32047
|
-
return Object.assign(Object.assign({ borderRadius }, visualStyles), {
|
|
32047
|
+
return Object.assign(Object.assign({ borderRadius }, visualStyles), { overflow: 'hidden', display: 'block' });
|
|
32048
32048
|
};
|
|
32049
|
-
const ImageOutput = ({ id, src, alt = "Image", design = 'outline', layout = 'normal', aspectratio
|
|
32049
|
+
const ImageOutput = ({ id, src, alt = "Image", design = 'outline', layout = 'normal', aspectratio, height, width = '100%', className, style, onClick, }) => {
|
|
32050
32050
|
const containerStyles = getStyles(design, layout);
|
|
32051
32051
|
const iconColor = design === 'neumorphic' ? '#555' : 'var(--gray-9)';
|
|
32052
|
-
const content = (React.createElement(p$8, { className: className, style: Object.assign(Object.assign(Object.assign({}, containerStyles), { width: '100%', height: height || '
|
|
32052
|
+
const content = (React.createElement(p$8, { className: className, style: Object.assign(Object.assign(Object.assign({}, containerStyles), { width: '100%', maxWidth: 500, maxHeight: 500, height: height || 'auto' }), style), onClick: onClick }, src ? (React.createElement("img", { id: String(id), src: src, alt: alt, style: {
|
|
32053
32053
|
width: '100%',
|
|
32054
|
-
|
|
32055
|
-
|
|
32054
|
+
maxHeight: 500,
|
|
32055
|
+
height: height ? '100%' : 'auto',
|
|
32056
|
+
objectFit: 'contain',
|
|
32056
32057
|
display: 'block',
|
|
32057
32058
|
} })) : (React.createElement(p$5, { align: "center", justify: "center", style: {
|
|
32058
32059
|
width: '100%',
|
|
32059
|
-
height: '
|
|
32060
|
+
height: height || '150px',
|
|
32060
32061
|
backgroundColor: design === 'neumorphic' ? 'transparent' : 'var(--gray-3)',
|
|
32061
|
-
minHeight: height || '100%',
|
|
32062
32062
|
} },
|
|
32063
32063
|
React.createElement(p$5, { direction: "column", align: "center", gap: "2" },
|
|
32064
32064
|
React.createElement(Icon, { name: 'image', width: "32", height: "32", color: iconColor, style: { opacity: 0.5 } }),
|
|
32065
32065
|
React.createElement(p$d, { size: "1", color: "gray" }, "No Image"))))));
|
|
32066
|
-
|
|
32066
|
+
if (aspectratio && !height) {
|
|
32067
|
+
return (React.createElement(p$8, { style: { width, maxWidth: 500 } },
|
|
32068
|
+
React.createElement(i$9, { ratio: aspectratio }, content)));
|
|
32069
|
+
}
|
|
32070
|
+
return (React.createElement(p$8, { style: { width, maxWidth: 500 } }, content));
|
|
32067
32071
|
};
|
|
32068
32072
|
|
|
32069
32073
|
const Input$1 = (_a) => {
|
|
@@ -57281,17 +57285,29 @@ const Teletraan1 = ({ xFormModel, readOnlyMode = false, displayMode = 'codice',
|
|
|
57281
57285
|
};
|
|
57282
57286
|
|
|
57283
57287
|
const FormikStateObserver = ({ instance }) => {
|
|
57284
|
-
const
|
|
57288
|
+
const formikContext = formik.useFormikContext();
|
|
57285
57289
|
React.useEffect(() => {
|
|
57286
|
-
instance.values = values;
|
|
57287
|
-
instance.errors = errors;
|
|
57290
|
+
instance.values = formikContext.values;
|
|
57291
|
+
instance.errors = formikContext.errors;
|
|
57292
|
+
if (!instance.actions) {
|
|
57293
|
+
instance.actions = {
|
|
57294
|
+
submitForm: formikContext.submitForm,
|
|
57295
|
+
resetForm: formikContext.resetForm,
|
|
57296
|
+
setValues: formikContext.setValues,
|
|
57297
|
+
setFieldValue: formikContext.setFieldValue,
|
|
57298
|
+
setFieldError: formikContext.setFieldError,
|
|
57299
|
+
setFieldTouched: formikContext.setFieldTouched,
|
|
57300
|
+
validateForm: formikContext.validateForm,
|
|
57301
|
+
setSubmitting: formikContext.setSubmitting,
|
|
57302
|
+
};
|
|
57303
|
+
}
|
|
57288
57304
|
// Status code 0 (Empty) to
|
|
57289
57305
|
// Status code 1 (In Progress) :: user typing detected
|
|
57290
|
-
if (dirty && instance.statusCode === 0) {
|
|
57306
|
+
if (formikContext.dirty && instance.statusCode === 0) {
|
|
57291
57307
|
instance.statusCode = 1;
|
|
57292
57308
|
instance.timeInProgress = Date.now();
|
|
57293
57309
|
}
|
|
57294
|
-
}, [
|
|
57310
|
+
}, [formikContext, instance]);
|
|
57295
57311
|
return null;
|
|
57296
57312
|
};
|
|
57297
57313
|
class VectorSigma {
|
|
@@ -57304,6 +57320,7 @@ class VectorSigma {
|
|
|
57304
57320
|
this.isValid = false;
|
|
57305
57321
|
this.values = {};
|
|
57306
57322
|
this.errors = {};
|
|
57323
|
+
this.actions = null;
|
|
57307
57324
|
this.statusCode = 0; // 0 = Created/Empty | 1 = In Progress | 2 = Submitted
|
|
57308
57325
|
this.timeInProgress = null;
|
|
57309
57326
|
this.timeSubmitted = null;
|
|
@@ -57428,7 +57445,7 @@ class VectorSigma {
|
|
|
57428
57445
|
};
|
|
57429
57446
|
}
|
|
57430
57447
|
/**
|
|
57431
|
-
* Traverses xForm schema object and injects Formik values into
|
|
57448
|
+
* Traverses xForm schema object and injects Formik values into respective input queryResponse attributes by `inputAlias`.
|
|
57432
57449
|
*/
|
|
57433
57450
|
hydrateQueryResponses(submittedValues) {
|
|
57434
57451
|
const traverseAndHydrate = (queries) => {
|
|
@@ -57565,17 +57582,17 @@ class VectorSigma {
|
|
|
57565
57582
|
* * Transforms the initialized xForm JSON/JS object, normalizing attribute fields and returning a `<Teletraan1/>` component.
|
|
57566
57583
|
* @param options VectorSigmaRenderProps -- `VectorSigma` and `Teletraan1` props for VΣ render matrix.
|
|
57567
57584
|
* @example .transform({
|
|
57568
|
-
|
|
57569
|
-
|
|
57570
|
-
|
|
57571
|
-
|
|
57585
|
+
displayMode: 'codex',
|
|
57586
|
+
readOnlyMode: false,
|
|
57587
|
+
brandColor: '#800020',
|
|
57588
|
+
onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
|
|
57572
57589
|
// Use Case: Send extant xForm object to API
|
|
57573
57590
|
await axios.post('/api/submit', instance.getxForm());
|
|
57574
57591
|
// Use Case: Submit and clear form after success
|
|
57575
57592
|
actions.submitForm();
|
|
57576
57593
|
actions.resetForm();
|
|
57577
57594
|
},
|
|
57578
|
-
|
|
57595
|
+
onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex only) props
|
|
57579
57596
|
})})
|
|
57580
57597
|
*/
|
|
57581
57598
|
transform(options) {
|
|
@@ -57614,7 +57631,7 @@ class VectorSigma {
|
|
|
57614
57631
|
} },
|
|
57615
57632
|
React.createElement("img", { src: sanitizedData.logo, alt: `${sanitizedData.name || 'Form'} Logo`, style: { maxHeight: '64px', maxWidth: '100%', objectFit: 'contain' } }))),
|
|
57616
57633
|
React.createElement(Teletraan1, Object.assign({ brandColor: sanitizedData.brandColor, xFormModel: sanitizedData }, options)),
|
|
57617
|
-
!isCodexMode && !(options === null || options === void 0 ? void 0 : options.readOnlyMode) && (React.createElement(p$5, { mt: "6", justify: "end", style: { width: '100%', paddingTop: '20px', borderTop: '1px solid var(--gray-5)' } },
|
|
57634
|
+
!isCodexMode && !(options === null || options === void 0 ? void 0 : options.readOnlyMode) && !(options === null || options === void 0 ? void 0 : options.buttonOverride) && (React.createElement(p$5, { mt: "6", justify: "end", style: { width: '100%', paddingTop: '20px', borderTop: '1px solid var(--gray-5)' } },
|
|
57618
57635
|
React.createElement(o$a, { type: "submit", disabled: isSubmitting, style: Object.assign({ cursor: isSubmitting ? 'wait' : 'pointer', padding: '0 24px' }, (sanitizedData.brandColor ?
|
|
57619
57636
|
{ backgroundColor: sanitizedData.brandColor, color: '#fff' }
|
|
57620
57637
|
:
|
|
@@ -57626,17 +57643,17 @@ class VectorSigma {
|
|
|
57626
57643
|
* * `render()` is the final method in the Vector Sigma builder pattern chain.
|
|
57627
57644
|
* @param options VectorSigmaRenderProps -- `VectorSigma` and `Teletraan1` props for VΣ render matrix.
|
|
57628
57645
|
* @example .render({
|
|
57629
|
-
|
|
57630
|
-
|
|
57631
|
-
|
|
57632
|
-
|
|
57646
|
+
displayMode: 'dual',
|
|
57647
|
+
brandColor: '#800020',
|
|
57648
|
+
readOnlyMode: false,
|
|
57649
|
+
onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
|
|
57633
57650
|
// Use Case: Send hydrated xForm object to API
|
|
57634
57651
|
await axios.post('/api/submit', instance.getxForm());
|
|
57635
57652
|
// Use Case: Submit and clear form after success
|
|
57636
57653
|
actions.submitForm();
|
|
57637
57654
|
actions.resetForm();
|
|
57638
57655
|
},
|
|
57639
|
-
|
|
57656
|
+
onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex) props
|
|
57640
57657
|
})})
|
|
57641
57658
|
*/
|
|
57642
57659
|
render(options) {
|
package/lib/index.esm.js
CHANGED
|
@@ -32023,26 +32023,30 @@ const getStyles = (design, layout) => {
|
|
|
32023
32023
|
border: '1px solid var(--gray-6)',
|
|
32024
32024
|
};
|
|
32025
32025
|
}
|
|
32026
|
-
return Object.assign(Object.assign({ borderRadius }, visualStyles), {
|
|
32026
|
+
return Object.assign(Object.assign({ borderRadius }, visualStyles), { overflow: 'hidden', display: 'block' });
|
|
32027
32027
|
};
|
|
32028
|
-
const ImageOutput = ({ id, src, alt = "Image", design = 'outline', layout = 'normal', aspectratio
|
|
32028
|
+
const ImageOutput = ({ id, src, alt = "Image", design = 'outline', layout = 'normal', aspectratio, height, width = '100%', className, style, onClick, }) => {
|
|
32029
32029
|
const containerStyles = getStyles(design, layout);
|
|
32030
32030
|
const iconColor = design === 'neumorphic' ? '#555' : 'var(--gray-9)';
|
|
32031
|
-
const content = (React__default.createElement(p$8, { className: className, style: Object.assign(Object.assign(Object.assign({}, containerStyles), { width: '100%', height: height || '
|
|
32031
|
+
const content = (React__default.createElement(p$8, { className: className, style: Object.assign(Object.assign(Object.assign({}, containerStyles), { width: '100%', maxWidth: 500, maxHeight: 500, height: height || 'auto' }), style), onClick: onClick }, src ? (React__default.createElement("img", { id: String(id), src: src, alt: alt, style: {
|
|
32032
32032
|
width: '100%',
|
|
32033
|
-
|
|
32034
|
-
|
|
32033
|
+
maxHeight: 500,
|
|
32034
|
+
height: height ? '100%' : 'auto',
|
|
32035
|
+
objectFit: 'contain',
|
|
32035
32036
|
display: 'block',
|
|
32036
32037
|
} })) : (React__default.createElement(p$5, { align: "center", justify: "center", style: {
|
|
32037
32038
|
width: '100%',
|
|
32038
|
-
height: '
|
|
32039
|
+
height: height || '150px',
|
|
32039
32040
|
backgroundColor: design === 'neumorphic' ? 'transparent' : 'var(--gray-3)',
|
|
32040
|
-
minHeight: height || '100%',
|
|
32041
32041
|
} },
|
|
32042
32042
|
React__default.createElement(p$5, { direction: "column", align: "center", gap: "2" },
|
|
32043
32043
|
React__default.createElement(Icon, { name: 'image', width: "32", height: "32", color: iconColor, style: { opacity: 0.5 } }),
|
|
32044
32044
|
React__default.createElement(p$d, { size: "1", color: "gray" }, "No Image"))))));
|
|
32045
|
-
|
|
32045
|
+
if (aspectratio && !height) {
|
|
32046
|
+
return (React__default.createElement(p$8, { style: { width, maxWidth: 500 } },
|
|
32047
|
+
React__default.createElement(i$9, { ratio: aspectratio }, content)));
|
|
32048
|
+
}
|
|
32049
|
+
return (React__default.createElement(p$8, { style: { width, maxWidth: 500 } }, content));
|
|
32046
32050
|
};
|
|
32047
32051
|
|
|
32048
32052
|
const Input$1 = (_a) => {
|
|
@@ -57260,17 +57264,29 @@ const Teletraan1 = ({ xFormModel, readOnlyMode = false, displayMode = 'codice',
|
|
|
57260
57264
|
};
|
|
57261
57265
|
|
|
57262
57266
|
const FormikStateObserver = ({ instance }) => {
|
|
57263
|
-
const
|
|
57267
|
+
const formikContext = useFormikContext();
|
|
57264
57268
|
useEffect(() => {
|
|
57265
|
-
instance.values = values;
|
|
57266
|
-
instance.errors = errors;
|
|
57269
|
+
instance.values = formikContext.values;
|
|
57270
|
+
instance.errors = formikContext.errors;
|
|
57271
|
+
if (!instance.actions) {
|
|
57272
|
+
instance.actions = {
|
|
57273
|
+
submitForm: formikContext.submitForm,
|
|
57274
|
+
resetForm: formikContext.resetForm,
|
|
57275
|
+
setValues: formikContext.setValues,
|
|
57276
|
+
setFieldValue: formikContext.setFieldValue,
|
|
57277
|
+
setFieldError: formikContext.setFieldError,
|
|
57278
|
+
setFieldTouched: formikContext.setFieldTouched,
|
|
57279
|
+
validateForm: formikContext.validateForm,
|
|
57280
|
+
setSubmitting: formikContext.setSubmitting,
|
|
57281
|
+
};
|
|
57282
|
+
}
|
|
57267
57283
|
// Status code 0 (Empty) to
|
|
57268
57284
|
// Status code 1 (In Progress) :: user typing detected
|
|
57269
|
-
if (dirty && instance.statusCode === 0) {
|
|
57285
|
+
if (formikContext.dirty && instance.statusCode === 0) {
|
|
57270
57286
|
instance.statusCode = 1;
|
|
57271
57287
|
instance.timeInProgress = Date.now();
|
|
57272
57288
|
}
|
|
57273
|
-
}, [
|
|
57289
|
+
}, [formikContext, instance]);
|
|
57274
57290
|
return null;
|
|
57275
57291
|
};
|
|
57276
57292
|
class VectorSigma {
|
|
@@ -57283,6 +57299,7 @@ class VectorSigma {
|
|
|
57283
57299
|
this.isValid = false;
|
|
57284
57300
|
this.values = {};
|
|
57285
57301
|
this.errors = {};
|
|
57302
|
+
this.actions = null;
|
|
57286
57303
|
this.statusCode = 0; // 0 = Created/Empty | 1 = In Progress | 2 = Submitted
|
|
57287
57304
|
this.timeInProgress = null;
|
|
57288
57305
|
this.timeSubmitted = null;
|
|
@@ -57407,7 +57424,7 @@ class VectorSigma {
|
|
|
57407
57424
|
};
|
|
57408
57425
|
}
|
|
57409
57426
|
/**
|
|
57410
|
-
* Traverses xForm schema object and injects Formik values into
|
|
57427
|
+
* Traverses xForm schema object and injects Formik values into respective input queryResponse attributes by `inputAlias`.
|
|
57411
57428
|
*/
|
|
57412
57429
|
hydrateQueryResponses(submittedValues) {
|
|
57413
57430
|
const traverseAndHydrate = (queries) => {
|
|
@@ -57544,17 +57561,17 @@ class VectorSigma {
|
|
|
57544
57561
|
* * Transforms the initialized xForm JSON/JS object, normalizing attribute fields and returning a `<Teletraan1/>` component.
|
|
57545
57562
|
* @param options VectorSigmaRenderProps -- `VectorSigma` and `Teletraan1` props for VΣ render matrix.
|
|
57546
57563
|
* @example .transform({
|
|
57547
|
-
|
|
57548
|
-
|
|
57549
|
-
|
|
57550
|
-
|
|
57564
|
+
displayMode: 'codex',
|
|
57565
|
+
readOnlyMode: false,
|
|
57566
|
+
brandColor: '#800020',
|
|
57567
|
+
onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
|
|
57551
57568
|
// Use Case: Send extant xForm object to API
|
|
57552
57569
|
await axios.post('/api/submit', instance.getxForm());
|
|
57553
57570
|
// Use Case: Submit and clear form after success
|
|
57554
57571
|
actions.submitForm();
|
|
57555
57572
|
actions.resetForm();
|
|
57556
57573
|
},
|
|
57557
|
-
|
|
57574
|
+
onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex only) props
|
|
57558
57575
|
})})
|
|
57559
57576
|
*/
|
|
57560
57577
|
transform(options) {
|
|
@@ -57593,7 +57610,7 @@ class VectorSigma {
|
|
|
57593
57610
|
} },
|
|
57594
57611
|
React__default.createElement("img", { src: sanitizedData.logo, alt: `${sanitizedData.name || 'Form'} Logo`, style: { maxHeight: '64px', maxWidth: '100%', objectFit: 'contain' } }))),
|
|
57595
57612
|
React__default.createElement(Teletraan1, Object.assign({ brandColor: sanitizedData.brandColor, xFormModel: sanitizedData }, options)),
|
|
57596
|
-
!isCodexMode && !(options === null || options === void 0 ? void 0 : options.readOnlyMode) && (React__default.createElement(p$5, { mt: "6", justify: "end", style: { width: '100%', paddingTop: '20px', borderTop: '1px solid var(--gray-5)' } },
|
|
57613
|
+
!isCodexMode && !(options === null || options === void 0 ? void 0 : options.readOnlyMode) && !(options === null || options === void 0 ? void 0 : options.buttonOverride) && (React__default.createElement(p$5, { mt: "6", justify: "end", style: { width: '100%', paddingTop: '20px', borderTop: '1px solid var(--gray-5)' } },
|
|
57597
57614
|
React__default.createElement(o$a, { type: "submit", disabled: isSubmitting, style: Object.assign({ cursor: isSubmitting ? 'wait' : 'pointer', padding: '0 24px' }, (sanitizedData.brandColor ?
|
|
57598
57615
|
{ backgroundColor: sanitizedData.brandColor, color: '#fff' }
|
|
57599
57616
|
:
|
|
@@ -57605,17 +57622,17 @@ class VectorSigma {
|
|
|
57605
57622
|
* * `render()` is the final method in the Vector Sigma builder pattern chain.
|
|
57606
57623
|
* @param options VectorSigmaRenderProps -- `VectorSigma` and `Teletraan1` props for VΣ render matrix.
|
|
57607
57624
|
* @example .render({
|
|
57608
|
-
|
|
57609
|
-
|
|
57610
|
-
|
|
57611
|
-
|
|
57625
|
+
displayMode: 'dual',
|
|
57626
|
+
brandColor: '#800020',
|
|
57627
|
+
readOnlyMode: false,
|
|
57628
|
+
onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
|
|
57612
57629
|
// Use Case: Send hydrated xForm object to API
|
|
57613
57630
|
await axios.post('/api/submit', instance.getxForm());
|
|
57614
57631
|
// Use Case: Submit and clear form after success
|
|
57615
57632
|
actions.submitForm();
|
|
57616
57633
|
actions.resetForm();
|
|
57617
57634
|
},
|
|
57618
|
-
|
|
57635
|
+
onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex) props
|
|
57619
57636
|
})})
|
|
57620
57637
|
*/
|
|
57621
57638
|
render(options) {
|
|
@@ -24,18 +24,35 @@ export interface VectorSigmaRenderProps<T extends Record<string, any> = Record<s
|
|
|
24
24
|
/**
|
|
25
25
|
* * Optional Radix UI Theme configuration.
|
|
26
26
|
* Enables developer theming extensibility to align xForm appearance with an extant application design system.
|
|
27
|
-
*
|
|
28
|
-
* https://www.radix-ui.com/themes/docs/components/theme
|
|
27
|
+
* * https://www.radix-ui.com/themes/docs/components/theme
|
|
29
28
|
* @example
|
|
30
29
|
* theme={{ appearance: 'dark', accentColor: 'ruby', radius: 'large' }}
|
|
31
30
|
*/
|
|
32
31
|
theme?: Omit<ThemeProps, 'children'>;
|
|
32
|
+
/**
|
|
33
|
+
* * Optional toggle to disable the default xForm bottom submit button.
|
|
34
|
+
* Allows developers to implement custom Submit, Save or Validate buttons outside xForm component.
|
|
35
|
+
* @example
|
|
36
|
+
* buttonOverride={true}
|
|
37
|
+
*/
|
|
38
|
+
buttonOverride?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface VectorSigmaActions<T> {
|
|
41
|
+
submitForm: () => Promise<void | undefined>;
|
|
42
|
+
resetForm: (nextState?: Partial<import('formik').FormikState<T>>) => void;
|
|
43
|
+
setValues: (values: React.SetStateAction<T>, shouldValidate?: boolean) => Promise<void | import('formik').FormikErrors<T>>;
|
|
44
|
+
setFieldValue: (field: string, value: any, shouldValidate?: boolean) => Promise<void | import('formik').FormikErrors<T>>;
|
|
45
|
+
setFieldError: (field: string, message: string | undefined) => void;
|
|
46
|
+
setFieldTouched: (field: string, isTouched?: boolean, shouldValidate?: boolean) => Promise<void | import('formik').FormikErrors<T>>;
|
|
47
|
+
validateForm: (values?: any) => Promise<import('formik').FormikErrors<T>>;
|
|
48
|
+
setSubmitting: (isSubmitting: boolean) => void;
|
|
33
49
|
}
|
|
34
50
|
export declare class VectorSigma<T extends Record<string, any> = Record<string, any>> {
|
|
35
51
|
isValid: boolean;
|
|
36
52
|
formObject: XFormType;
|
|
37
53
|
values: Partial<T>;
|
|
38
54
|
errors: Record<string, any>;
|
|
55
|
+
actions: VectorSigmaActions<T> | null;
|
|
39
56
|
statusCode: 0 | 1 | 2;
|
|
40
57
|
timeCreated: number;
|
|
41
58
|
timeInProgress: number | null;
|
|
@@ -57,7 +74,7 @@ export declare class VectorSigma<T extends Record<string, any> = Record<string,
|
|
|
57
74
|
*/
|
|
58
75
|
private buildFormikConfig;
|
|
59
76
|
/**
|
|
60
|
-
* Traverses xForm schema object and injects Formik values into
|
|
77
|
+
* Traverses xForm schema object and injects Formik values into respective input queryResponse attributes by `inputAlias`.
|
|
61
78
|
*/
|
|
62
79
|
private hydrateQueryResponses;
|
|
63
80
|
/**
|
|
@@ -149,17 +166,17 @@ export declare class VectorSigma<T extends Record<string, any> = Record<string,
|
|
|
149
166
|
* * Transforms the initialized xForm JSON/JS object, normalizing attribute fields and returning a `<Teletraan1/>` component.
|
|
150
167
|
* @param options VectorSigmaRenderProps -- `VectorSigma` and `Teletraan1` props for VΣ render matrix.
|
|
151
168
|
* @example .transform({
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
169
|
+
displayMode: 'codex',
|
|
170
|
+
readOnlyMode: false,
|
|
171
|
+
brandColor: '#800020',
|
|
172
|
+
onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
|
|
156
173
|
// Use Case: Send extant xForm object to API
|
|
157
174
|
await axios.post('/api/submit', instance.getxForm());
|
|
158
175
|
// Use Case: Submit and clear form after success
|
|
159
176
|
actions.submitForm();
|
|
160
177
|
actions.resetForm();
|
|
161
178
|
},
|
|
162
|
-
|
|
179
|
+
onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex only) props
|
|
163
180
|
})})
|
|
164
181
|
*/
|
|
165
182
|
transform(options?: VectorSigmaRenderProps<T>): React.ReactElement;
|
|
@@ -169,17 +186,17 @@ export declare class VectorSigma<T extends Record<string, any> = Record<string,
|
|
|
169
186
|
* * `render()` is the final method in the Vector Sigma builder pattern chain.
|
|
170
187
|
* @param options VectorSigmaRenderProps -- `VectorSigma` and `Teletraan1` props for VΣ render matrix.
|
|
171
188
|
* @example .render({
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
189
|
+
displayMode: 'dual',
|
|
190
|
+
brandColor: '#800020',
|
|
191
|
+
readOnlyMode: false,
|
|
192
|
+
onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
|
|
176
193
|
// Use Case: Send hydrated xForm object to API
|
|
177
194
|
await axios.post('/api/submit', instance.getxForm());
|
|
178
195
|
// Use Case: Submit and clear form after success
|
|
179
196
|
actions.submitForm();
|
|
180
197
|
actions.resetForm();
|
|
181
198
|
},
|
|
182
|
-
|
|
199
|
+
onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex) props
|
|
183
200
|
})})
|
|
184
201
|
*/
|
|
185
202
|
render(options?: VectorSigmaRenderProps<T>): React.ReactElement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emeraldemperaur/vector-sigma",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.49",
|
|
4
4
|
"description": "Dynamic Form Orchestrator: NPM Package",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -47,32 +47,24 @@
|
|
|
47
47
|
"@types/react": "^19.2.10",
|
|
48
48
|
"@types/react-dom": "^19.2.3",
|
|
49
49
|
"@types/react-datepicker": "^6.2.0",
|
|
50
|
-
"formik": "^2.4.9",
|
|
51
50
|
"identity-obj-proxy": "^3.0.0",
|
|
52
51
|
"jest": "^30.2.0",
|
|
53
52
|
"jest-environment-jsdom": "^30.2.0",
|
|
54
53
|
"jest-junit": "^16.0.0",
|
|
55
|
-
"react": "^19.2.4",
|
|
56
|
-
"react-dom": "^19.2.4",
|
|
57
54
|
"rollup": "^4.58.1",
|
|
58
55
|
"rollup-plugin-delete": "^3.0.2",
|
|
59
56
|
"rollup-plugin-postcss": "^4.0.2",
|
|
60
57
|
"rollup-plugin-preserve-directives": "^0.4.0",
|
|
61
58
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
62
59
|
"rollup-plugin-visualizer": "^6.0.5",
|
|
63
|
-
"sass-embedded": "^1.97.3",
|
|
64
60
|
"ts-jest": "^29.4.6",
|
|
65
61
|
"tslib": "^2.8.1",
|
|
66
|
-
"typescript": "^5.9.3"
|
|
67
|
-
"yup": "^1.7.1",
|
|
68
|
-
"zod": "^4.3.6"
|
|
62
|
+
"typescript": "^5.9.3"
|
|
69
63
|
},
|
|
70
64
|
"peerDependencies": {
|
|
71
|
-
"formik": "^2.4.9",
|
|
72
65
|
"react": ">=18.0.0",
|
|
73
66
|
"react-dom": ">=18.0.0",
|
|
74
|
-
"sass-embedded": "^1.97.3"
|
|
75
|
-
"yup": "^1.7.1"
|
|
67
|
+
"sass-embedded": "^1.97.3"
|
|
76
68
|
},
|
|
77
69
|
"dependencies": {
|
|
78
70
|
"@radix-ui/react-accordion": "^1.2.12",
|
|
@@ -81,10 +73,13 @@
|
|
|
81
73
|
"card-validator": "^10.0.4",
|
|
82
74
|
"country-flag-icons": "^1.6.12",
|
|
83
75
|
"date-fns": "^4.1.0",
|
|
76
|
+
"formik": "^2.4.9",
|
|
84
77
|
"react-datepicker": "^9.1.0",
|
|
85
78
|
"react-day-picker": "^9.13.1",
|
|
86
79
|
"react-imask": "^7.6.1",
|
|
87
|
-
"react-phone-number-input": "^3.4.14"
|
|
80
|
+
"react-phone-number-input": "^3.4.14",
|
|
81
|
+
"yup": "^1.7.1",
|
|
82
|
+
"zod": "^4.3.6"
|
|
88
83
|
},
|
|
89
84
|
"overrides": {
|
|
90
85
|
"minimatch": "^10.2.3"
|