@emeraldemperaur/vector-sigma 1.4.30 → 1.4.31
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/lib/index.cjs +126 -0
- package/lib/index.esm.js +126 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/tests/components/components.avatar.test.d.ts +1 -0
- package/lib/types/tests/components/components.button.test.d.ts +1 -0
- package/lib/types/tests/components/components.checkboxgroup.test.d.ts +1 -0
- package/lib/types/tests/components/components.conditional.test.d.ts +1 -0
- package/lib/types/tests/components/components.datepickers.test.d.ts +1 -0
- package/lib/types/tests/components/components.files.test.d.ts +1 -0
- package/lib/types/tests/components/components.iconimage.test.d.ts +1 -0
- package/lib/types/tests/components/components.inputs.finance.test.d.ts +1 -0
- package/lib/types/tests/components/components.inputs.test.d.ts +1 -0
- package/lib/types/tests/components/components.radiogroup.test.d.ts +1 -0
- package/lib/types/tests/components/components.rangeslider.test.d.ts +1 -0
- package/lib/types/tests/components/components.sectiontitle.test.d.ts +1 -0
- package/lib/types/tests/components/components.selectors.test.d.ts +1 -0
- package/lib/types/tests/layouts/layouts.accordion.test.d.ts +1 -0
- package/lib/types/tests/layouts/layouts.codex.test.d.ts +1 -0
- package/lib/types/tests/layouts/layouts.column.test.d.ts +1 -0
- package/lib/types/tests/layouts/layouts.container.test.d.ts +1 -0
- package/lib/types/tests/layouts/layouts.row.test.d.ts +1 -0
- package/lib/types/tests/orion.test.d.ts +0 -0
- package/lib/types/tests/utils/utils.chronos.test.d.ts +1 -0
- package/lib/types/tests/utils/utils.minerva.test.d.ts +1 -0
- package/lib/types/tests/utils/utils.uuid.test.d.ts +1 -0
- package/lib/types/tests/utils/utils.vinci.test.d.ts +1 -0
- package/lib/types/utils/minerva.d.ts +10 -0
- package/lib/types/utils/voltaire.d.ts +2 -0
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -53907,6 +53907,131 @@ const parseUuidFormat = (input) => {
|
|
|
53907
53907
|
return numbers;
|
|
53908
53908
|
};
|
|
53909
53909
|
|
|
53910
|
+
/**
|
|
53911
|
+
* Utility to convert any string to camelCase (e.g., "USER NAME" -> "userName", "user_profile" -> "userProfile")
|
|
53912
|
+
* Safely handles ALL CAPS, snake_case, spaces, and existing camelCase.
|
|
53913
|
+
* @param str - String to convert to camelCase format
|
|
53914
|
+
*/
|
|
53915
|
+
const toCamelCase = (str) => {
|
|
53916
|
+
if (!str)
|
|
53917
|
+
return "";
|
|
53918
|
+
const words = str
|
|
53919
|
+
.replace(/([a-z])([A-Z])/g, '$1 $2') // 1. Split existing camelCase with a space
|
|
53920
|
+
.replace(/[^a-zA-Z0-9]+/g, ' ') // 2. Replace non-alphanumeric characters with spaces
|
|
53921
|
+
.trim()
|
|
53922
|
+
.toLowerCase() // 3. Lowercase everything
|
|
53923
|
+
.split(/\s+/); // 4. Split into an array of words
|
|
53924
|
+
if (words.length === 0 || words[0] === '')
|
|
53925
|
+
return "";
|
|
53926
|
+
return words.map((word, index) => {
|
|
53927
|
+
if (index === 0)
|
|
53928
|
+
return word; // First word stays lowercase
|
|
53929
|
+
return word.charAt(0).toUpperCase() + word.slice(1); // Capitalize subsequent words
|
|
53930
|
+
}).join('');
|
|
53931
|
+
};
|
|
53932
|
+
/**
|
|
53933
|
+
* Utility to convert a string to kebab-case (e.g., "Profile Section" -> "profile-section")
|
|
53934
|
+
* Ensures code-friendly standard strings.
|
|
53935
|
+
* @param str - String to convert to kebab-case format
|
|
53936
|
+
*/
|
|
53937
|
+
const toKebabCase = (str) => {
|
|
53938
|
+
if (!str)
|
|
53939
|
+
return "";
|
|
53940
|
+
return str
|
|
53941
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2') // 1. Handle camelCase inputs
|
|
53942
|
+
.replace(/[^a-zA-Z0-9]+/g, '-') // 2. Replace non-alphanumeric chars with hyphens
|
|
53943
|
+
.toLowerCase() // 3. Lowercase everything
|
|
53944
|
+
.replace(/^-+|-+$/g, ''); // 4. Trim any leading or trailing hyphens
|
|
53945
|
+
};
|
|
53946
|
+
/**
|
|
53947
|
+
* Normalizes and sanitizes an XFormType object.
|
|
53948
|
+
* - Standardizes Section IDs (Consecutive numbers or code-friendly strings).
|
|
53949
|
+
* - Enforces globally consecutive Query IDs.
|
|
53950
|
+
* - Ensures unique, Formik-friendly camelCase Input Aliases.
|
|
53951
|
+
* - Auto-fills empty inputAliases with unique 'undefinedElement[N]' placeholder.
|
|
53952
|
+
* @param xform - xForm object {} to normalize `sectionId`, `queryId` and `inputAlias` attributes for `<Teletraan1/>` component
|
|
53953
|
+
*/
|
|
53954
|
+
const normalizeXForm = (xform) => {
|
|
53955
|
+
var _a, _b;
|
|
53956
|
+
// Deep clone the object to prevent mutating the original data reference
|
|
53957
|
+
const normalizedForm = JSON.parse(JSON.stringify(xform));
|
|
53958
|
+
if (!normalizedForm.model || normalizedForm.model.length === 0) {
|
|
53959
|
+
return normalizedForm;
|
|
53960
|
+
}
|
|
53961
|
+
// ==========================================
|
|
53962
|
+
// 1. SECTION ID NORMALIZATION
|
|
53963
|
+
// ==========================================
|
|
53964
|
+
const firstSectionId = normalizedForm.model[0].sectionId;
|
|
53965
|
+
const isFirstSectionNumbered = !isNaN(Number(firstSectionId)) && String(firstSectionId).trim() !== '';
|
|
53966
|
+
let sectionCounter = isFirstSectionNumbered ? Number(firstSectionId) : 1;
|
|
53967
|
+
normalizedForm.model.forEach((section) => {
|
|
53968
|
+
if (isFirstSectionNumbered) {
|
|
53969
|
+
// If the first section was a number, make all subsequent sections consecutive numbers
|
|
53970
|
+
section.sectionId = String(sectionCounter++);
|
|
53971
|
+
}
|
|
53972
|
+
else {
|
|
53973
|
+
// Otherwise, sanitize to a code-friendly string
|
|
53974
|
+
section.sectionId = toKebabCase(section.sectionId) || `section-${sectionCounter++}`;
|
|
53975
|
+
}
|
|
53976
|
+
});
|
|
53977
|
+
// ==========================================
|
|
53978
|
+
// 2. QUERY ID & ALIAS NORMALIZATION
|
|
53979
|
+
// ==========================================
|
|
53980
|
+
const aliasTracker = {};
|
|
53981
|
+
let undefinedCounter = 1;
|
|
53982
|
+
// Set the global query counter based on the very first query's ID (defaults to 1)
|
|
53983
|
+
let globalQueryId = 1;
|
|
53984
|
+
const firstQuery = (_b = (_a = normalizedForm.model[0]) === null || _a === void 0 ? void 0 : _a.queries) === null || _b === void 0 ? void 0 : _b[0];
|
|
53985
|
+
if (firstQuery && typeof firstQuery.queryId === 'number' && !isNaN(firstQuery.queryId)) {
|
|
53986
|
+
globalQueryId = firstQuery.queryId;
|
|
53987
|
+
}
|
|
53988
|
+
// Recursive function to process flat queries AND nested conditional queries
|
|
53989
|
+
const processQuery = (query) => {
|
|
53990
|
+
// A. Assign consecutive ordered queryId
|
|
53991
|
+
query.queryId = globalQueryId++;
|
|
53992
|
+
// B. Sanitize inputAlias to camelCase
|
|
53993
|
+
let baseAlias = toCamelCase(query.inputAlias);
|
|
53994
|
+
// C. Handle completely empty/invalid strings
|
|
53995
|
+
if (!baseAlias) {
|
|
53996
|
+
// Ensure we don't collide with a user who manually typed "undefinedElement1"
|
|
53997
|
+
let potentialAlias = `undefinedElement${undefinedCounter}`;
|
|
53998
|
+
while (aliasTracker[potentialAlias]) {
|
|
53999
|
+
undefinedCounter++;
|
|
54000
|
+
potentialAlias = `undefinedElement${undefinedCounter}`;
|
|
54001
|
+
}
|
|
54002
|
+
query.inputAlias = potentialAlias;
|
|
54003
|
+
aliasTracker[potentialAlias] = 1; // Mark this generated alias as used
|
|
54004
|
+
undefinedCounter++;
|
|
54005
|
+
}
|
|
54006
|
+
// D. Enforce global uniqueness across all sections for standard aliases
|
|
54007
|
+
else {
|
|
54008
|
+
if (aliasTracker[baseAlias]) {
|
|
54009
|
+
// Duplicate found: Increment the count and attach it (e.g., "userProfile2")
|
|
54010
|
+
aliasTracker[baseAlias]++;
|
|
54011
|
+
query.inputAlias = `${baseAlias}${aliasTracker[baseAlias]}`;
|
|
54012
|
+
}
|
|
54013
|
+
else {
|
|
54014
|
+
// First instance: Record it as 1
|
|
54015
|
+
aliasTracker[baseAlias] = 1;
|
|
54016
|
+
query.inputAlias = baseAlias;
|
|
54017
|
+
}
|
|
54018
|
+
}
|
|
54019
|
+
// E. Recursively process toggledInput if the query contains conditional logic
|
|
54020
|
+
if (query.toggledInput) {
|
|
54021
|
+
processQuery(query.toggledInput);
|
|
54022
|
+
}
|
|
54023
|
+
};
|
|
54024
|
+
// Run the processor over all queries in all sections
|
|
54025
|
+
normalizedForm.model.forEach((section) => {
|
|
54026
|
+
if (section.queries && Array.isArray(section.queries)) {
|
|
54027
|
+
section.queries.forEach((query) => {
|
|
54028
|
+
processQuery(query);
|
|
54029
|
+
});
|
|
54030
|
+
}
|
|
54031
|
+
});
|
|
54032
|
+
return normalizedForm;
|
|
54033
|
+
};
|
|
54034
|
+
|
|
53910
54035
|
exports.Accordion = Accordion;
|
|
53911
54036
|
exports.AccordionItem = AccordionItem;
|
|
53912
54037
|
exports.AvatarInput = AvatarInput;
|
|
@@ -53946,6 +54071,7 @@ exports.Theme = R;
|
|
|
53946
54071
|
exports.ThemePanel = N;
|
|
53947
54072
|
exports.Toggle = Toggle;
|
|
53948
54073
|
exports.UUIDInput = UUIDInput;
|
|
54074
|
+
exports.normalizeXForm = normalizeXForm;
|
|
53949
54075
|
exports.parseUuidFormat = parseUuidFormat;
|
|
53950
54076
|
exports.primeMatrix = primeMatrix;
|
|
53951
54077
|
exports.useStepper = useStepper;
|
package/lib/index.esm.js
CHANGED
|
@@ -53887,4 +53887,129 @@ const parseUuidFormat = (input) => {
|
|
|
53887
53887
|
return numbers;
|
|
53888
53888
|
};
|
|
53889
53889
|
|
|
53890
|
-
|
|
53890
|
+
/**
|
|
53891
|
+
* Utility to convert any string to camelCase (e.g., "USER NAME" -> "userName", "user_profile" -> "userProfile")
|
|
53892
|
+
* Safely handles ALL CAPS, snake_case, spaces, and existing camelCase.
|
|
53893
|
+
* @param str - String to convert to camelCase format
|
|
53894
|
+
*/
|
|
53895
|
+
const toCamelCase = (str) => {
|
|
53896
|
+
if (!str)
|
|
53897
|
+
return "";
|
|
53898
|
+
const words = str
|
|
53899
|
+
.replace(/([a-z])([A-Z])/g, '$1 $2') // 1. Split existing camelCase with a space
|
|
53900
|
+
.replace(/[^a-zA-Z0-9]+/g, ' ') // 2. Replace non-alphanumeric characters with spaces
|
|
53901
|
+
.trim()
|
|
53902
|
+
.toLowerCase() // 3. Lowercase everything
|
|
53903
|
+
.split(/\s+/); // 4. Split into an array of words
|
|
53904
|
+
if (words.length === 0 || words[0] === '')
|
|
53905
|
+
return "";
|
|
53906
|
+
return words.map((word, index) => {
|
|
53907
|
+
if (index === 0)
|
|
53908
|
+
return word; // First word stays lowercase
|
|
53909
|
+
return word.charAt(0).toUpperCase() + word.slice(1); // Capitalize subsequent words
|
|
53910
|
+
}).join('');
|
|
53911
|
+
};
|
|
53912
|
+
/**
|
|
53913
|
+
* Utility to convert a string to kebab-case (e.g., "Profile Section" -> "profile-section")
|
|
53914
|
+
* Ensures code-friendly standard strings.
|
|
53915
|
+
* @param str - String to convert to kebab-case format
|
|
53916
|
+
*/
|
|
53917
|
+
const toKebabCase = (str) => {
|
|
53918
|
+
if (!str)
|
|
53919
|
+
return "";
|
|
53920
|
+
return str
|
|
53921
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2') // 1. Handle camelCase inputs
|
|
53922
|
+
.replace(/[^a-zA-Z0-9]+/g, '-') // 2. Replace non-alphanumeric chars with hyphens
|
|
53923
|
+
.toLowerCase() // 3. Lowercase everything
|
|
53924
|
+
.replace(/^-+|-+$/g, ''); // 4. Trim any leading or trailing hyphens
|
|
53925
|
+
};
|
|
53926
|
+
/**
|
|
53927
|
+
* Normalizes and sanitizes an XFormType object.
|
|
53928
|
+
* - Standardizes Section IDs (Consecutive numbers or code-friendly strings).
|
|
53929
|
+
* - Enforces globally consecutive Query IDs.
|
|
53930
|
+
* - Ensures unique, Formik-friendly camelCase Input Aliases.
|
|
53931
|
+
* - Auto-fills empty inputAliases with unique 'undefinedElement[N]' placeholder.
|
|
53932
|
+
* @param xform - xForm object {} to normalize `sectionId`, `queryId` and `inputAlias` attributes for `<Teletraan1/>` component
|
|
53933
|
+
*/
|
|
53934
|
+
const normalizeXForm = (xform) => {
|
|
53935
|
+
var _a, _b;
|
|
53936
|
+
// Deep clone the object to prevent mutating the original data reference
|
|
53937
|
+
const normalizedForm = JSON.parse(JSON.stringify(xform));
|
|
53938
|
+
if (!normalizedForm.model || normalizedForm.model.length === 0) {
|
|
53939
|
+
return normalizedForm;
|
|
53940
|
+
}
|
|
53941
|
+
// ==========================================
|
|
53942
|
+
// 1. SECTION ID NORMALIZATION
|
|
53943
|
+
// ==========================================
|
|
53944
|
+
const firstSectionId = normalizedForm.model[0].sectionId;
|
|
53945
|
+
const isFirstSectionNumbered = !isNaN(Number(firstSectionId)) && String(firstSectionId).trim() !== '';
|
|
53946
|
+
let sectionCounter = isFirstSectionNumbered ? Number(firstSectionId) : 1;
|
|
53947
|
+
normalizedForm.model.forEach((section) => {
|
|
53948
|
+
if (isFirstSectionNumbered) {
|
|
53949
|
+
// If the first section was a number, make all subsequent sections consecutive numbers
|
|
53950
|
+
section.sectionId = String(sectionCounter++);
|
|
53951
|
+
}
|
|
53952
|
+
else {
|
|
53953
|
+
// Otherwise, sanitize to a code-friendly string
|
|
53954
|
+
section.sectionId = toKebabCase(section.sectionId) || `section-${sectionCounter++}`;
|
|
53955
|
+
}
|
|
53956
|
+
});
|
|
53957
|
+
// ==========================================
|
|
53958
|
+
// 2. QUERY ID & ALIAS NORMALIZATION
|
|
53959
|
+
// ==========================================
|
|
53960
|
+
const aliasTracker = {};
|
|
53961
|
+
let undefinedCounter = 1;
|
|
53962
|
+
// Set the global query counter based on the very first query's ID (defaults to 1)
|
|
53963
|
+
let globalQueryId = 1;
|
|
53964
|
+
const firstQuery = (_b = (_a = normalizedForm.model[0]) === null || _a === void 0 ? void 0 : _a.queries) === null || _b === void 0 ? void 0 : _b[0];
|
|
53965
|
+
if (firstQuery && typeof firstQuery.queryId === 'number' && !isNaN(firstQuery.queryId)) {
|
|
53966
|
+
globalQueryId = firstQuery.queryId;
|
|
53967
|
+
}
|
|
53968
|
+
// Recursive function to process flat queries AND nested conditional queries
|
|
53969
|
+
const processQuery = (query) => {
|
|
53970
|
+
// A. Assign consecutive ordered queryId
|
|
53971
|
+
query.queryId = globalQueryId++;
|
|
53972
|
+
// B. Sanitize inputAlias to camelCase
|
|
53973
|
+
let baseAlias = toCamelCase(query.inputAlias);
|
|
53974
|
+
// C. Handle completely empty/invalid strings
|
|
53975
|
+
if (!baseAlias) {
|
|
53976
|
+
// Ensure we don't collide with a user who manually typed "undefinedElement1"
|
|
53977
|
+
let potentialAlias = `undefinedElement${undefinedCounter}`;
|
|
53978
|
+
while (aliasTracker[potentialAlias]) {
|
|
53979
|
+
undefinedCounter++;
|
|
53980
|
+
potentialAlias = `undefinedElement${undefinedCounter}`;
|
|
53981
|
+
}
|
|
53982
|
+
query.inputAlias = potentialAlias;
|
|
53983
|
+
aliasTracker[potentialAlias] = 1; // Mark this generated alias as used
|
|
53984
|
+
undefinedCounter++;
|
|
53985
|
+
}
|
|
53986
|
+
// D. Enforce global uniqueness across all sections for standard aliases
|
|
53987
|
+
else {
|
|
53988
|
+
if (aliasTracker[baseAlias]) {
|
|
53989
|
+
// Duplicate found: Increment the count and attach it (e.g., "userProfile2")
|
|
53990
|
+
aliasTracker[baseAlias]++;
|
|
53991
|
+
query.inputAlias = `${baseAlias}${aliasTracker[baseAlias]}`;
|
|
53992
|
+
}
|
|
53993
|
+
else {
|
|
53994
|
+
// First instance: Record it as 1
|
|
53995
|
+
aliasTracker[baseAlias] = 1;
|
|
53996
|
+
query.inputAlias = baseAlias;
|
|
53997
|
+
}
|
|
53998
|
+
}
|
|
53999
|
+
// E. Recursively process toggledInput if the query contains conditional logic
|
|
54000
|
+
if (query.toggledInput) {
|
|
54001
|
+
processQuery(query.toggledInput);
|
|
54002
|
+
}
|
|
54003
|
+
};
|
|
54004
|
+
// Run the processor over all queries in all sections
|
|
54005
|
+
normalizedForm.model.forEach((section) => {
|
|
54006
|
+
if (section.queries && Array.isArray(section.queries)) {
|
|
54007
|
+
section.queries.forEach((query) => {
|
|
54008
|
+
processQuery(query);
|
|
54009
|
+
});
|
|
54010
|
+
}
|
|
54011
|
+
});
|
|
54012
|
+
return normalizedForm;
|
|
54013
|
+
};
|
|
54014
|
+
|
|
54015
|
+
export { Accordion, AccordionItem, AvatarInput, ButtonInput, CURRENCIES, CheckboxGroupInput, Codex, CodexControls, CodexItem, Column, ConditionalTrigger, Container, CreditCardInput, CurrencyInput, DatePicker, DateRangePicker, DateTimePicker, Dropdown, File$1 as File, FileMultiple, FlagIcon, Icon, ImageOutput, Input$2 as Input, MultipleSelect, OptionSelect, PasswordInput, PhoneInput, RadioGroupInput, RangeSlider, Row, SectionTitle, SliderInput, StockInput, Teletraan1, R as Theme, N as ThemePanel, Toggle, UUIDInput, normalizeXForm, parseUuidFormat, primeMatrix, useStepper, vectorSigma, xFormSchema };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { XFormType } from "./voltron";
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes and sanitizes an XFormType object.
|
|
4
|
+
* - Standardizes Section IDs (Consecutive numbers or code-friendly strings).
|
|
5
|
+
* - Enforces globally consecutive Query IDs.
|
|
6
|
+
* - Ensures unique, Formik-friendly camelCase Input Aliases.
|
|
7
|
+
* - Auto-fills empty inputAliases with unique 'undefinedElement[N]' placeholder.
|
|
8
|
+
* @param xform - xForm object {} to normalize `sectionId`, `queryId` and `inputAlias` attributes for `<Teletraan1/>` component
|
|
9
|
+
*/
|
|
10
|
+
export declare const normalizeXForm: (xform: XFormType) => XFormType;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { XFormType } from "./voltron";
|
|
1
2
|
export declare const avatarInputType: string[];
|
|
2
3
|
export declare const buttonInputType: string[];
|
|
3
4
|
export declare const checkboxInputType: string[];
|
|
@@ -22,3 +23,4 @@ export declare const rangeSliderInputType: string[];
|
|
|
22
23
|
export declare const toggleInputType: string[];
|
|
23
24
|
export declare const sectionTitleOutputType: string[];
|
|
24
25
|
export declare const conditionalInputType: string[];
|
|
26
|
+
export declare const generateInitialValues: (schema: XFormType) => Record<string, any>;
|