@emeraldemperaur/vector-sigma 1.4.46 → 1.4.48

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
@@ -343,19 +343,28 @@ import { useVectorSigma } from './hooks/useVectorSigma';
343
343
 
344
344
  <li><strong>🎨Theming Extensibilty</strong></br>
345
345
  <p align="justify">Customizable to fit seamlessly into an existing design system and allow developer control of the visual layer through standard CSS patterns.</p>
346
+ <p>Radix UI <code>theme</code> {} passed into the <code>transfrom()</code> or <code>render()</code> method(s) as an <code>options</code> attribute can be leveraged to cleverly align the returned xForm style and appearance with an extant application design system.</p>
346
347
 
347
348
  ```javascript
348
- import { Theme, File, Dropdown } from '@emeraldemperaur/vector-sigma';
349
+ import React from 'react';
350
+ import { VectorSigma } from './VectorSigma';
349
351
 
350
- const App = () => {
351
- return (
352
-
353
- <Theme>
354
- <File/>
355
- <Dropdown/>
356
- </Theme>
357
- );
358
- }
352
+ const xForm97 = new VectorSigma(apiJSONData);
353
+
354
+ return xForm97.render({
355
+ displayMode: 'codex',
356
+ // www.radix-ui.com/themes/docs/components/theme
357
+ theme: {
358
+ appearance: 'dark',
359
+ accentColor: 'yellow',
360
+ grayColor: 'slate',
361
+ radius: 'none',
362
+ scaling: '100%'
363
+ },
364
+ onSubmit: async (values, actions, instance) => {
365
+ console.log(values);
366
+ }
367
+ });
359
368
  ```
360
369
  </li>
361
370
 
package/lib/index.cjs CHANGED
@@ -32044,30 +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), { position: 'relative', overflow: 'hidden', display: 'block' });
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 = 16 / 9, height, width = '100%', className, style, onClick, }) => {
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, height: height || 'auto' }), style), onClick: onClick }, src ? (React.createElement("img", { id: String(id), src: src, alt: alt, style: {
32053
- width: '333px',
32054
- height: '333px',
32055
- objectFit: 'cover',
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
+ width: '100%',
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: '100%',
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
- if (height) {
32067
- return content;
32066
+ if (aspectratio && !height) {
32067
+ return (React.createElement(p$8, { style: { width, maxWidth: 500 } },
32068
+ React.createElement(i$9, { ratio: aspectratio }, content)));
32068
32069
  }
32069
- return (React.createElement(p$8, { style: { width } },
32070
- React.createElement(i$9, { ratio: aspectratio }, content)));
32070
+ return (React.createElement(p$8, { style: { width, maxWidth: 500 } }, content));
32071
32071
  };
32072
32072
 
32073
32073
  const Input$1 = (_a) => {
@@ -57273,7 +57273,7 @@ const Teletraan1 = ({ xFormModel, readOnlyMode = false, displayMode = 'codice',
57273
57273
  case 'codex':
57274
57274
  return (React.createElement(Codex, { brandColor: brandColor }, xFormModel.model.map((formsection, index, array) => (React.createElement(CodexItem, { key: formsection.sectionId, stepId: String(formsection.sectionId), title: formsection.title, subtitleDescription: formsection.subtitle ? formsection.subtitle : undefined, icon: React.createElement(Icon, { name: formsection.icon || "fontfamily" }) },
57275
57275
  React.createElement(Row, { key: formsection.sectionId }, renderQueries(formsection.queries)),
57276
- React.createElement(CodexControls, { prevStepId: index > 0 ? String(array[index - 1].sectionId) : undefined, nextStepId: index < array.length - 1 ? String(array[index + 1].sectionId) : undefined, onPrev: onPrev, onNext: onNext, onFinish: onFinish }))))));
57276
+ React.createElement(CodexControls, { prevStepId: index > 0 ? String(array[index - 1].sectionId) : undefined, nextStepId: index < array.length - 1 ? String(array[index + 1].sectionId) : undefined, onPrev: onPrev, onNext: onNext, onFinish: () => onFinish }))))));
57277
57277
  case 'codice':
57278
57278
  default:
57279
57279
  return (React.createElement(React.Fragment, { key: xFormModel.uuid }, xFormModel.model.map((formsection) => (React.createElement(React.Fragment, { key: formsection.sectionId || crypto.randomUUID() },
@@ -57587,7 +57587,8 @@ class VectorSigma {
57587
57587
  const sanitizedData = normalizeXForm(this.formObject);
57588
57588
  const { initialValues, validationSchema } = this.buildFormikConfig(sanitizedData);
57589
57589
  const isCodexMode = (options === null || options === void 0 ? void 0 : options.displayMode) === 'codex';
57590
- return (React.createElement(R, null,
57590
+ const themeConfig = Object.assign({ appearance: 'inherit', accentColor: 'blue', radius: 'medium' }, options === null || options === void 0 ? void 0 : options.theme);
57591
+ return (React.createElement(R, Object.assign({}, themeConfig),
57591
57592
  React.createElement(formik.Formik, { initialValues: initialValues, validationSchema: validationSchema, onSubmit: (values, actions) => __awaiter(this, void 0, void 0, function* () {
57592
57593
  try {
57593
57594
  this.statusCode = 2;
@@ -57598,7 +57599,7 @@ class VectorSigma {
57598
57599
  yield options.onSubmit(values, actions, this);
57599
57600
  }
57600
57601
  if (options === null || options === void 0 ? void 0 : options.onFinish) {
57601
- options.onFinish();
57602
+ options.onFinish(values, actions, this);
57602
57603
  }
57603
57604
  }
57604
57605
  catch (error) {
package/lib/index.esm.js CHANGED
@@ -32023,30 +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), { position: 'relative', overflow: 'hidden', display: 'block' });
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 = 16 / 9, height, width = '100%', className, style, onClick, }) => {
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, height: height || 'auto' }), style), onClick: onClick }, src ? (React__default.createElement("img", { id: String(id), src: src, alt: alt, style: {
32032
- width: '333px',
32033
- height: '333px',
32034
- objectFit: 'cover',
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
+ width: '100%',
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: '100%',
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
- if (height) {
32046
- return content;
32045
+ if (aspectratio && !height) {
32046
+ return (React__default.createElement(p$8, { style: { width, maxWidth: 500 } },
32047
+ React__default.createElement(i$9, { ratio: aspectratio }, content)));
32047
32048
  }
32048
- return (React__default.createElement(p$8, { style: { width } },
32049
- React__default.createElement(i$9, { ratio: aspectratio }, content)));
32049
+ return (React__default.createElement(p$8, { style: { width, maxWidth: 500 } }, content));
32050
32050
  };
32051
32051
 
32052
32052
  const Input$1 = (_a) => {
@@ -57252,7 +57252,7 @@ const Teletraan1 = ({ xFormModel, readOnlyMode = false, displayMode = 'codice',
57252
57252
  case 'codex':
57253
57253
  return (React__default.createElement(Codex, { brandColor: brandColor }, xFormModel.model.map((formsection, index, array) => (React__default.createElement(CodexItem, { key: formsection.sectionId, stepId: String(formsection.sectionId), title: formsection.title, subtitleDescription: formsection.subtitle ? formsection.subtitle : undefined, icon: React__default.createElement(Icon, { name: formsection.icon || "fontfamily" }) },
57254
57254
  React__default.createElement(Row, { key: formsection.sectionId }, renderQueries(formsection.queries)),
57255
- React__default.createElement(CodexControls, { prevStepId: index > 0 ? String(array[index - 1].sectionId) : undefined, nextStepId: index < array.length - 1 ? String(array[index + 1].sectionId) : undefined, onPrev: onPrev, onNext: onNext, onFinish: onFinish }))))));
57255
+ React__default.createElement(CodexControls, { prevStepId: index > 0 ? String(array[index - 1].sectionId) : undefined, nextStepId: index < array.length - 1 ? String(array[index + 1].sectionId) : undefined, onPrev: onPrev, onNext: onNext, onFinish: () => onFinish }))))));
57256
57256
  case 'codice':
57257
57257
  default:
57258
57258
  return (React__default.createElement(React__default.Fragment, { key: xFormModel.uuid }, xFormModel.model.map((formsection) => (React__default.createElement(React__default.Fragment, { key: formsection.sectionId || crypto.randomUUID() },
@@ -57566,7 +57566,8 @@ class VectorSigma {
57566
57566
  const sanitizedData = normalizeXForm(this.formObject);
57567
57567
  const { initialValues, validationSchema } = this.buildFormikConfig(sanitizedData);
57568
57568
  const isCodexMode = (options === null || options === void 0 ? void 0 : options.displayMode) === 'codex';
57569
- return (React__default.createElement(R, null,
57569
+ const themeConfig = Object.assign({ appearance: 'inherit', accentColor: 'blue', radius: 'medium' }, options === null || options === void 0 ? void 0 : options.theme);
57570
+ return (React__default.createElement(R, Object.assign({}, themeConfig),
57570
57571
  React__default.createElement(Formik, { initialValues: initialValues, validationSchema: validationSchema, onSubmit: (values, actions) => __awaiter(this, void 0, void 0, function* () {
57571
57572
  try {
57572
57573
  this.statusCode = 2;
@@ -57577,7 +57578,7 @@ class VectorSigma {
57577
57578
  yield options.onSubmit(values, actions, this);
57578
57579
  }
57579
57580
  if (options === null || options === void 0 ? void 0 : options.onFinish) {
57580
- options.onFinish();
57581
+ options.onFinish(values, actions, this);
57581
57582
  }
57582
57583
  }
57583
57584
  catch (error) {
@@ -38,8 +38,6 @@ export interface ImageDisplayProps {
38
38
  layout?: ImageLayout & {};
39
39
  /**
40
40
  * * The aspect ratio of the ImageOutput component.
41
- * Default: 16 / 9
42
- * Variants: 16 / 9, 4 / 3, 1.
43
41
  * * @example
44
42
  * aspectratio={ 16 / 9 || 4 / 3 }
45
43
  */
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import { XFormType } from 'utils/voltron';
3
+ import { FormikHelpers } from 'formik';
4
+ import { VectorSigma } from 'vectorSigma';
3
5
  export type teletraan1Display = 'accordion' | 'codice' | 'codex' | 'dual';
4
6
  export interface Teletraan1Props {
5
7
  /**
@@ -49,6 +51,6 @@ export interface Teletraan1Props {
49
51
  * * @example
50
52
  * onFinish={console.log("Teletraan-1 Codex :: onFinish()")}
51
53
  */
52
- onFinish?: () => void;
54
+ onFinish?: (values: any, actions: FormikHelpers<any>, instance: VectorSigma<any>) => void | Promise<any>;
53
55
  }
54
56
  export declare const Teletraan1: ({ xFormModel, readOnlyMode, displayMode, brandColor, onPrev, onNext, onFinish }: Teletraan1Props) => React.JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { XFormType, XFormQuery, SectionSchema } from './utils/voltron';
3
3
  import { Teletraan1Props } from './teletraan1';
4
4
  import { z } from "zod";
5
+ import { ThemeProps } from '@radix-ui/themes';
5
6
  import { FormikHelpers } from 'formik';
6
7
  import './styles/main.scss';
7
8
  export interface VectorSigmaRenderProps<T extends Record<string, any> = Record<string, any>> extends Omit<Teletraan1Props, 'xFormModel'> {
@@ -20,6 +21,15 @@ export interface VectorSigmaRenderProps<T extends Record<string, any> = Record<s
20
21
  }}
21
22
  */
22
23
  onSubmit?: (values: T, actions: FormikHelpers<T>, instance: VectorSigma<T>) => void | Promise<any>;
24
+ /**
25
+ * * Optional Radix UI Theme configuration.
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
29
+ * @example
30
+ * theme={{ appearance: 'dark', accentColor: 'ruby', radius: 'large' }}
31
+ */
32
+ theme?: Omit<ThemeProps, 'children'>;
23
33
  }
24
34
  export declare class VectorSigma<T extends Record<string, any> = Record<string, any>> {
25
35
  isValid: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emeraldemperaur/vector-sigma",
3
- "version": "1.4.46",
3
+ "version": "1.4.48",
4
4
  "description": "Dynamic Form Orchestrator: NPM Package",
5
5
  "repository": {
6
6
  "type": "git",
File without changes
File without changes