@emeraldemperaur/vector-sigma 1.4.48 → 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 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 form layout by adding/removing fields, sections or entire steps based on conditional logic.</li>
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 form across multi-step processes, allowing users to save progress and resume later.
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 form data to backend workflows, CRM systems, or databases immediately upon submission.</li>
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
  ![Testing Library](https://img.shields.io/badge/-Testing%20Library-%23E33332?style=for-the-badge&logo=testing-library&logoColor=white)
456
460
  ![Jest](https://img.shields.io/badge/-jest-%23C21325?style=for-the-badge&logo=jest&logoColor=white)
457
461
  ![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white)
462
+ [![Storybook](https://raw.githubusercontent.com/storybookjs/brand/master/badge/badge-storybook.svg)](https://storybook.js.org)
463
+ ![Lerna](https://img.shields.io/badge/-Lerna-9437FF?style=flat-square&logo=lerna&logoColor=white)
464
+ ![Chromatic](https://img.shields.io/badge/-Chromatic-FC521F?style=flat-square&logo=chromatic&logoColor=white)
465
+ ![Netlify](https://img.shields.io/badge/-Netlify-00C7B7?style=flat-square&logo=netlify&logoColor=white)
458
466
 
459
467
 
460
468
  ### Changeset Versioning Synopsis
package/lib/index.cjs CHANGED
@@ -57285,17 +57285,29 @@ const Teletraan1 = ({ xFormModel, readOnlyMode = false, displayMode = 'codice',
57285
57285
  };
57286
57286
 
57287
57287
  const FormikStateObserver = ({ instance }) => {
57288
- const { values, errors, dirty } = formik.useFormikContext();
57288
+ const formikContext = formik.useFormikContext();
57289
57289
  React.useEffect(() => {
57290
- instance.values = values;
57291
- 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
+ }
57292
57304
  // Status code 0 (Empty) to
57293
57305
  // Status code 1 (In Progress) :: user typing detected
57294
- if (dirty && instance.statusCode === 0) {
57306
+ if (formikContext.dirty && instance.statusCode === 0) {
57295
57307
  instance.statusCode = 1;
57296
57308
  instance.timeInProgress = Date.now();
57297
57309
  }
57298
- }, [values, errors, dirty, instance]);
57310
+ }, [formikContext, instance]);
57299
57311
  return null;
57300
57312
  };
57301
57313
  class VectorSigma {
@@ -57308,6 +57320,7 @@ class VectorSigma {
57308
57320
  this.isValid = false;
57309
57321
  this.values = {};
57310
57322
  this.errors = {};
57323
+ this.actions = null;
57311
57324
  this.statusCode = 0; // 0 = Created/Empty | 1 = In Progress | 2 = Submitted
57312
57325
  this.timeInProgress = null;
57313
57326
  this.timeSubmitted = null;
@@ -57432,7 +57445,7 @@ class VectorSigma {
57432
57445
  };
57433
57446
  }
57434
57447
  /**
57435
- * Traverses xForm schema object and injects Formik values into their respective input queryResponse attributes by `inputAlias`.
57448
+ * Traverses xForm schema object and injects Formik values into respective input queryResponse attributes by `inputAlias`.
57436
57449
  */
57437
57450
  hydrateQueryResponses(submittedValues) {
57438
57451
  const traverseAndHydrate = (queries) => {
@@ -57569,17 +57582,17 @@ class VectorSigma {
57569
57582
  * * Transforms the initialized xForm JSON/JS object, normalizing attribute fields and returning a `<Teletraan1/>` component.
57570
57583
  * @param options VectorSigmaRenderProps -- `VectorSigma` and `Teletraan1` props for VΣ render matrix.
57571
57584
  * @example .transform({
57572
- displayMode: 'codex',
57573
- readOnlyMode: false,
57574
- brandColor: '#800020',
57575
- onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
57585
+ displayMode: 'codex',
57586
+ readOnlyMode: false,
57587
+ brandColor: '#800020',
57588
+ onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
57576
57589
  // Use Case: Send extant xForm object to API
57577
57590
  await axios.post('/api/submit', instance.getxForm());
57578
57591
  // Use Case: Submit and clear form after success
57579
57592
  actions.submitForm();
57580
57593
  actions.resetForm();
57581
57594
  },
57582
- onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex only) props
57595
+ onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex only) props
57583
57596
  })})
57584
57597
  */
57585
57598
  transform(options) {
@@ -57618,7 +57631,7 @@ class VectorSigma {
57618
57631
  } },
57619
57632
  React.createElement("img", { src: sanitizedData.logo, alt: `${sanitizedData.name || 'Form'} Logo`, style: { maxHeight: '64px', maxWidth: '100%', objectFit: 'contain' } }))),
57620
57633
  React.createElement(Teletraan1, Object.assign({ brandColor: sanitizedData.brandColor, xFormModel: sanitizedData }, options)),
57621
- !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)' } },
57622
57635
  React.createElement(o$a, { type: "submit", disabled: isSubmitting, style: Object.assign({ cursor: isSubmitting ? 'wait' : 'pointer', padding: '0 24px' }, (sanitizedData.brandColor ?
57623
57636
  { backgroundColor: sanitizedData.brandColor, color: '#fff' }
57624
57637
  :
@@ -57630,17 +57643,17 @@ class VectorSigma {
57630
57643
  * * `render()` is the final method in the Vector Sigma builder pattern chain.
57631
57644
  * @param options VectorSigmaRenderProps -- `VectorSigma` and `Teletraan1` props for VΣ render matrix.
57632
57645
  * @example .render({
57633
- displayMode: 'dual',
57634
- brandColor: '#800020',
57635
- readOnlyMode: false,
57636
- onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
57646
+ displayMode: 'dual',
57647
+ brandColor: '#800020',
57648
+ readOnlyMode: false,
57649
+ onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
57637
57650
  // Use Case: Send hydrated xForm object to API
57638
57651
  await axios.post('/api/submit', instance.getxForm());
57639
57652
  // Use Case: Submit and clear form after success
57640
57653
  actions.submitForm();
57641
57654
  actions.resetForm();
57642
57655
  },
57643
- onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex) props
57656
+ onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex) props
57644
57657
  })})
57645
57658
  */
57646
57659
  render(options) {
package/lib/index.esm.js CHANGED
@@ -57264,17 +57264,29 @@ const Teletraan1 = ({ xFormModel, readOnlyMode = false, displayMode = 'codice',
57264
57264
  };
57265
57265
 
57266
57266
  const FormikStateObserver = ({ instance }) => {
57267
- const { values, errors, dirty } = useFormikContext();
57267
+ const formikContext = useFormikContext();
57268
57268
  useEffect(() => {
57269
- instance.values = values;
57270
- 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
+ }
57271
57283
  // Status code 0 (Empty) to
57272
57284
  // Status code 1 (In Progress) :: user typing detected
57273
- if (dirty && instance.statusCode === 0) {
57285
+ if (formikContext.dirty && instance.statusCode === 0) {
57274
57286
  instance.statusCode = 1;
57275
57287
  instance.timeInProgress = Date.now();
57276
57288
  }
57277
- }, [values, errors, dirty, instance]);
57289
+ }, [formikContext, instance]);
57278
57290
  return null;
57279
57291
  };
57280
57292
  class VectorSigma {
@@ -57287,6 +57299,7 @@ class VectorSigma {
57287
57299
  this.isValid = false;
57288
57300
  this.values = {};
57289
57301
  this.errors = {};
57302
+ this.actions = null;
57290
57303
  this.statusCode = 0; // 0 = Created/Empty | 1 = In Progress | 2 = Submitted
57291
57304
  this.timeInProgress = null;
57292
57305
  this.timeSubmitted = null;
@@ -57411,7 +57424,7 @@ class VectorSigma {
57411
57424
  };
57412
57425
  }
57413
57426
  /**
57414
- * Traverses xForm schema object and injects Formik values into their respective input queryResponse attributes by `inputAlias`.
57427
+ * Traverses xForm schema object and injects Formik values into respective input queryResponse attributes by `inputAlias`.
57415
57428
  */
57416
57429
  hydrateQueryResponses(submittedValues) {
57417
57430
  const traverseAndHydrate = (queries) => {
@@ -57548,17 +57561,17 @@ class VectorSigma {
57548
57561
  * * Transforms the initialized xForm JSON/JS object, normalizing attribute fields and returning a `<Teletraan1/>` component.
57549
57562
  * @param options VectorSigmaRenderProps -- `VectorSigma` and `Teletraan1` props for VΣ render matrix.
57550
57563
  * @example .transform({
57551
- displayMode: 'codex',
57552
- readOnlyMode: false,
57553
- brandColor: '#800020',
57554
- onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
57564
+ displayMode: 'codex',
57565
+ readOnlyMode: false,
57566
+ brandColor: '#800020',
57567
+ onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
57555
57568
  // Use Case: Send extant xForm object to API
57556
57569
  await axios.post('/api/submit', instance.getxForm());
57557
57570
  // Use Case: Submit and clear form after success
57558
57571
  actions.submitForm();
57559
57572
  actions.resetForm();
57560
57573
  },
57561
- onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex only) props
57574
+ onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex only) props
57562
57575
  })})
57563
57576
  */
57564
57577
  transform(options) {
@@ -57597,7 +57610,7 @@ class VectorSigma {
57597
57610
  } },
57598
57611
  React__default.createElement("img", { src: sanitizedData.logo, alt: `${sanitizedData.name || 'Form'} Logo`, style: { maxHeight: '64px', maxWidth: '100%', objectFit: 'contain' } }))),
57599
57612
  React__default.createElement(Teletraan1, Object.assign({ brandColor: sanitizedData.brandColor, xFormModel: sanitizedData }, options)),
57600
- !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)' } },
57601
57614
  React__default.createElement(o$a, { type: "submit", disabled: isSubmitting, style: Object.assign({ cursor: isSubmitting ? 'wait' : 'pointer', padding: '0 24px' }, (sanitizedData.brandColor ?
57602
57615
  { backgroundColor: sanitizedData.brandColor, color: '#fff' }
57603
57616
  :
@@ -57609,17 +57622,17 @@ class VectorSigma {
57609
57622
  * * `render()` is the final method in the Vector Sigma builder pattern chain.
57610
57623
  * @param options VectorSigmaRenderProps -- `VectorSigma` and `Teletraan1` props for VΣ render matrix.
57611
57624
  * @example .render({
57612
- displayMode: 'dual',
57613
- brandColor: '#800020',
57614
- readOnlyMode: false,
57615
- onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
57625
+ displayMode: 'dual',
57626
+ brandColor: '#800020',
57627
+ readOnlyMode: false,
57628
+ onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
57616
57629
  // Use Case: Send hydrated xForm object to API
57617
57630
  await axios.post('/api/submit', instance.getxForm());
57618
57631
  // Use Case: Submit and clear form after success
57619
57632
  actions.submitForm();
57620
57633
  actions.resetForm();
57621
57634
  },
57622
- onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex) props
57635
+ onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex) props
57623
57636
  })})
57624
57637
  */
57625
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 their respective input queryResponse attributes by `inputAlias`.
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
- displayMode: 'codex',
153
- readOnlyMode: false,
154
- brandColor: '#800020',
155
- onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
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
- onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex only) props
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
- displayMode: 'dual',
173
- brandColor: '#800020',
174
- readOnlyMode: false,
175
- onSubmit: async (values, actions, instance) => { // <-- onSubmit callback function passed into VectorSigma props
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
- onFinish: () => handleFormFinish() // <-- onFinish callback function passed into Teletraan1 (Codex) props
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.48",
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"