@emeraldemperaur/vector-sigma 1.4.12 → 1.4.13

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 CHANGED
@@ -21582,7 +21582,6 @@ const FileMultiple = (_a) => {
21582
21582
  React.createElement(Icon, { name: 'close' })))));
21583
21583
  }))),
21584
21584
  React.createElement("div", null,
21585
- React.createElement("br", null),
21586
21585
  React.createElement(p$d, { id: `${alias}InputLabel`, as: "label", size: "2", weight: "bold", htmlFor: alias }, inputLabel),
21587
21586
  "\u00A0",
21588
21587
  isHinted ?
@@ -28946,7 +28945,6 @@ const PasswordInput = (_a) => {
28946
28945
  React.createElement(e, { content: showPassword ? "Hide password" : "Show password" },
28947
28946
  React.createElement(o$5, { size: "1", variant: "ghost", color: "gray", onClick: toggleVisibility, type: "button", "aria-label": showPassword ? "Hide password" : "Show password" }, showPassword ? (React.createElement(Icon, { name: "eyeopen", height: "16", width: "16" })) : (React.createElement(Icon, { name: "eyeclosed", height: "16", width: "16" })))))),
28948
28947
  React.createElement("div", null,
28949
- React.createElement("br", null),
28950
28948
  React.createElement(p$d, { id: `${alias}InputLabel`, as: "label", size: "2", weight: "bold", htmlFor: alias }, inputLabel),
28951
28949
  "\u00A0",
28952
28950
  isHinted && (React.createElement(e, { content: hintText || "No hint available", align: "start", sideOffset: 5, className: "core-input-tooltip" },
@@ -36549,69 +36547,68 @@ const PhoneInput = (_a) => {
36549
36547
  hasError && (React.createElement(p$d, { id: errorId, size: "1", color: "red", className: 'core-input-label-error' }, errorText || meta.error || `Required field`))))));
36550
36548
  };
36551
36549
 
36552
- const parseUuidFormat = (input) => {
36553
- if (!input.toLowerCase().startsWith('uuid')) {
36554
- return [4, 4, 4, 4];
36550
+ const safeParseUuidFormat = (typeString) => {
36551
+ try {
36552
+ if (!typeString.startsWith('uuid'))
36553
+ return null;
36554
+ // "uuid-8-4-4-4-12" -> [8,4,4,4,12]
36555
+ const parts = typeString.split('-').slice(1).map(Number);
36556
+ return parts.length > 0 && !parts.some(isNaN) ? parts : null;
36555
36557
  }
36556
- const parts = input.slice(5).split('-');
36557
- const numbers = parts.map((part) => parseInt(part, 10));
36558
- if (numbers.some((n) => isNaN(n))) {
36559
- return [4, 4, 4, 4];
36558
+ catch (_a) {
36559
+ return null;
36560
36560
  }
36561
- return numbers;
36562
36561
  };
36563
-
36564
36562
  const UUIDInput = (_a) => {
36565
- var { alias, type, inputLabel, width, delimiter = "-", format = [8, 4, 4, 4, 12], placeholder = '', newRow, isHinted, hintText, hintUrl, errorText, readOnly = false, inputVariant = 'input-outline', size = "2", className } = _a, props = __rest$1(_a, ["alias", "type", "inputLabel", "width", "delimiter", "format", "placeholder", "newRow", "isHinted", "hintText", "hintUrl", "errorText", "readOnly", "inputVariant", "size", "className"]);
36563
+ var { alias, type = "uuid", inputLabel, width, delimiter = "-", format = [8, 4, 4, 4, 12], placeholder = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', newRow, isHinted, hintText, hintUrl, errorText, readOnly = false, inputVariant = 'input-outline', size = "2", className } = _a, props = __rest$1(_a, ["alias", "type", "inputLabel", "width", "delimiter", "format", "placeholder", "newRow", "isHinted", "hintText", "hintUrl", "errorText", "readOnly", "inputVariant", "size", "className"]);
36566
36564
  const { setFieldValue, setFieldTouched } = formik.useFormikContext();
36567
36565
  const [field, meta] = formik.useField(alias);
36568
36566
  const hasError = Boolean(meta.touched && meta.error);
36569
36567
  const [copied, setCopied] = React.useState(false);
36570
36568
  const errorId = `${alias}-error`;
36571
36569
  const activeFormat = React.useMemo(() => {
36572
- if (type && type.toLowerCase().startsWith("uuid") && type.length > 4) {
36573
- const parsed = parseUuidFormat(type);
36574
- if (parsed)
36575
- return parsed;
36576
- }
36577
- return format;
36578
- }, [format, type]);
36579
- const maxRawLength = activeFormat.reduce((a, b) => a + b, 0);
36580
- const formatUUID = (rawValue) => {
36581
- const clean = rawValue.replace(/[^0-9a-fA-F]/g, '').toUpperCase().slice(0, maxRawLength);
36582
- let formatted = '';
36583
- let currentIdx = 0;
36570
+ const parsed = safeParseUuidFormat(type);
36571
+ return parsed || format;
36572
+ }, [type, format]);
36573
+ const maxHexChars = activeFormat.reduce((a, b) => a + b, 0);
36574
+ const maxTotalLength = maxHexChars + (activeFormat.length - 1);
36575
+ const formatValue = (rawValue) => {
36576
+ if (!rawValue)
36577
+ return "";
36578
+ const clean = rawValue.replace(/[^0-9a-fA-F]/g, "").toUpperCase().slice(0, maxHexChars);
36579
+ const parts = [];
36580
+ let currentIndex = 0;
36584
36581
  for (let i = 0; i < activeFormat.length; i++) {
36585
- const chunkLen = activeFormat[i];
36586
- if (currentIdx + chunkLen <= clean.length) {
36587
- formatted += clean.substring(currentIdx, chunkLen);
36588
- if (i < activeFormat.length - 1) {
36589
- formatted += delimiter;
36590
- }
36582
+ const chunkLength = activeFormat[i];
36583
+ const remaining = clean.length - currentIndex;
36584
+ if (remaining > 0) {
36585
+ const chunk = clean.substr(currentIndex, chunkLength);
36586
+ parts.push(chunk);
36587
+ currentIndex += chunkLength;
36591
36588
  }
36592
36589
  else {
36593
- formatted += clean.substring(currentIdx);
36594
36590
  break;
36595
36591
  }
36596
- currentIdx += chunkLen;
36597
36592
  }
36598
- return formatted;
36593
+ return parts.join(delimiter);
36599
36594
  };
36600
36595
  const handleChange = (e) => {
36601
- const newVal = e.target.value;
36602
- const formatted = formatUUID(newVal);
36596
+ const val = e.target.value;
36597
+ const formatted = formatValue(val);
36603
36598
  setFieldValue(alias, formatted);
36604
36599
  };
36605
36600
  const handleCopy = () => {
36606
- navigator.clipboard.writeText(field.value || '');
36607
- setCopied(true);
36608
- setTimeout(() => setCopied(false), 2000);
36601
+ if (field.value) {
36602
+ navigator.clipboard.writeText(field.value);
36603
+ setCopied(true);
36604
+ setTimeout(() => setCopied(false), 2000);
36605
+ }
36609
36606
  };
36610
36607
  const variantClass = inputVariant !== 'input-outline' ? `input-${inputVariant}` : '';
36611
36608
  return (React.createElement(Column, { span: width, newLine: newRow },
36612
36609
  React.createElement(p$5, { direction: "column", gap: "2", style: { width: '100%' } },
36613
36610
  React.createElement(u, Object.assign({ size: size, variant: "surface", color: hasError ? 'red' : undefined, className: `${variantClass} ${className || ''}` }, props),
36614
- React.createElement("input", { id: `${alias}FormInput`, name: alias, "aria-describedby": `${alias}InputLabel`, readOnly: readOnly, value: field.value || '', onChange: handleChange, onBlur: () => setFieldTouched(alias, true), placeholder: placeholder || 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', maxLength: maxRawLength + (activeFormat.length - 1), type: "text", style: {
36611
+ React.createElement("input", { id: `${alias}FormInput`, name: alias, "aria-describedby": `${alias}InputLabel`, readOnly: readOnly, value: field.value || '', onChange: handleChange, onBlur: () => setFieldTouched(alias, true), maxLength: maxTotalLength, placeholder: placeholder, type: "text", style: {
36615
36612
  flex: 1,
36616
36613
  border: 'none',
36617
36614
  outline: 'none',
@@ -36628,12 +36625,12 @@ const UUIDInput = (_a) => {
36628
36625
  React.createElement(e, { content: copied ? "Copied!" : "Copy to clipboard" },
36629
36626
  React.createElement(o$5, { size: "1", variant: "ghost", color: copied ? "green" : "gray", onClick: handleCopy, type: "button", disabled: !field.value }, copied ? React.createElement(CheckIcon, null) : React.createElement(CopyIcon, null))))),
36630
36627
  React.createElement("div", null,
36631
- React.createElement(p$d, { id: `${alias}InputLabel`, as: "label", size: "2", weight: "bold", htmlFor: alias }, inputLabel),
36628
+ inputLabel && (React.createElement(p$d, { id: `${alias}InputLabel`, as: "label", size: "2", weight: "bold", htmlFor: alias }, inputLabel)),
36632
36629
  "\u00A0",
36633
- isHinted && (React.createElement(e, { content: hintText || "No hint available", align: "start", sideOffset: 5, className: "core-input-tooltip" },
36630
+ isHinted && (React.createElement(e, { content: hintText || "No hint available" },
36634
36631
  React.createElement("a", { href: hintUrl || "", target: "_blank", rel: "noopener noreferrer" },
36635
- React.createElement(Icon, { name: "questionmarkcircled", height: "16", width: "16", style: { cursor: 'pointer', color: 'gray' } })))),
36636
- hasError && (React.createElement("p", { id: errorId, className: 'core-input-label-error' }, errorText || meta.error || `Required field`))))));
36632
+ React.createElement(Icon, { name: "questionmarkcircled", height: "16", width: "16", style: { cursor: 'pointer', color: 'gray', marginLeft: 4 } })))),
36633
+ hasError && (React.createElement(p$d, { id: errorId, size: "1", color: "red", style: { display: 'block', marginTop: 2 } }, errorText || meta.error || `Required field`))))));
36637
36634
  };
36638
36635
 
36639
36636
  var FaCcVisa = {};
@@ -47256,6 +47253,18 @@ const xFormSchema = object({
47256
47253
  model: array(SectionSchema),
47257
47254
  });
47258
47255
 
47256
+ const parseUuidFormat = (input) => {
47257
+ if (!input.toLowerCase().startsWith('uuid')) {
47258
+ return [4, 4, 4, 4];
47259
+ }
47260
+ const parts = input.slice(5).split('-');
47261
+ const numbers = parts.map((part) => parseInt(part, 10));
47262
+ if (numbers.some((n) => isNaN(n))) {
47263
+ return [4, 4, 4, 4];
47264
+ }
47265
+ return numbers;
47266
+ };
47267
+
47259
47268
  exports.AvatarInput = AvatarInput;
47260
47269
  exports.ButtonInput = ButtonInput;
47261
47270
  exports.CURRENCIES = CURRENCIES;
package/lib/index.esm.js CHANGED
@@ -21562,7 +21562,6 @@ const FileMultiple = (_a) => {
21562
21562
  React__default.createElement(Icon, { name: 'close' })))));
21563
21563
  }))),
21564
21564
  React__default.createElement("div", null,
21565
- React__default.createElement("br", null),
21566
21565
  React__default.createElement(p$d, { id: `${alias}InputLabel`, as: "label", size: "2", weight: "bold", htmlFor: alias }, inputLabel),
21567
21566
  "\u00A0",
21568
21567
  isHinted ?
@@ -28926,7 +28925,6 @@ const PasswordInput = (_a) => {
28926
28925
  React__default.createElement(e, { content: showPassword ? "Hide password" : "Show password" },
28927
28926
  React__default.createElement(o$5, { size: "1", variant: "ghost", color: "gray", onClick: toggleVisibility, type: "button", "aria-label": showPassword ? "Hide password" : "Show password" }, showPassword ? (React__default.createElement(Icon, { name: "eyeopen", height: "16", width: "16" })) : (React__default.createElement(Icon, { name: "eyeclosed", height: "16", width: "16" })))))),
28928
28927
  React__default.createElement("div", null,
28929
- React__default.createElement("br", null),
28930
28928
  React__default.createElement(p$d, { id: `${alias}InputLabel`, as: "label", size: "2", weight: "bold", htmlFor: alias }, inputLabel),
28931
28929
  "\u00A0",
28932
28930
  isHinted && (React__default.createElement(e, { content: hintText || "No hint available", align: "start", sideOffset: 5, className: "core-input-tooltip" },
@@ -36529,69 +36527,68 @@ const PhoneInput = (_a) => {
36529
36527
  hasError && (React__default.createElement(p$d, { id: errorId, size: "1", color: "red", className: 'core-input-label-error' }, errorText || meta.error || `Required field`))))));
36530
36528
  };
36531
36529
 
36532
- const parseUuidFormat = (input) => {
36533
- if (!input.toLowerCase().startsWith('uuid')) {
36534
- return [4, 4, 4, 4];
36530
+ const safeParseUuidFormat = (typeString) => {
36531
+ try {
36532
+ if (!typeString.startsWith('uuid'))
36533
+ return null;
36534
+ // "uuid-8-4-4-4-12" -> [8,4,4,4,12]
36535
+ const parts = typeString.split('-').slice(1).map(Number);
36536
+ return parts.length > 0 && !parts.some(isNaN) ? parts : null;
36535
36537
  }
36536
- const parts = input.slice(5).split('-');
36537
- const numbers = parts.map((part) => parseInt(part, 10));
36538
- if (numbers.some((n) => isNaN(n))) {
36539
- return [4, 4, 4, 4];
36538
+ catch (_a) {
36539
+ return null;
36540
36540
  }
36541
- return numbers;
36542
36541
  };
36543
-
36544
36542
  const UUIDInput = (_a) => {
36545
- var { alias, type, inputLabel, width, delimiter = "-", format = [8, 4, 4, 4, 12], placeholder = '', newRow, isHinted, hintText, hintUrl, errorText, readOnly = false, inputVariant = 'input-outline', size = "2", className } = _a, props = __rest$1(_a, ["alias", "type", "inputLabel", "width", "delimiter", "format", "placeholder", "newRow", "isHinted", "hintText", "hintUrl", "errorText", "readOnly", "inputVariant", "size", "className"]);
36543
+ var { alias, type = "uuid", inputLabel, width, delimiter = "-", format = [8, 4, 4, 4, 12], placeholder = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', newRow, isHinted, hintText, hintUrl, errorText, readOnly = false, inputVariant = 'input-outline', size = "2", className } = _a, props = __rest$1(_a, ["alias", "type", "inputLabel", "width", "delimiter", "format", "placeholder", "newRow", "isHinted", "hintText", "hintUrl", "errorText", "readOnly", "inputVariant", "size", "className"]);
36546
36544
  const { setFieldValue, setFieldTouched } = useFormikContext();
36547
36545
  const [field, meta] = useField(alias);
36548
36546
  const hasError = Boolean(meta.touched && meta.error);
36549
36547
  const [copied, setCopied] = useState(false);
36550
36548
  const errorId = `${alias}-error`;
36551
36549
  const activeFormat = useMemo(() => {
36552
- if (type && type.toLowerCase().startsWith("uuid") && type.length > 4) {
36553
- const parsed = parseUuidFormat(type);
36554
- if (parsed)
36555
- return parsed;
36556
- }
36557
- return format;
36558
- }, [format, type]);
36559
- const maxRawLength = activeFormat.reduce((a, b) => a + b, 0);
36560
- const formatUUID = (rawValue) => {
36561
- const clean = rawValue.replace(/[^0-9a-fA-F]/g, '').toUpperCase().slice(0, maxRawLength);
36562
- let formatted = '';
36563
- let currentIdx = 0;
36550
+ const parsed = safeParseUuidFormat(type);
36551
+ return parsed || format;
36552
+ }, [type, format]);
36553
+ const maxHexChars = activeFormat.reduce((a, b) => a + b, 0);
36554
+ const maxTotalLength = maxHexChars + (activeFormat.length - 1);
36555
+ const formatValue = (rawValue) => {
36556
+ if (!rawValue)
36557
+ return "";
36558
+ const clean = rawValue.replace(/[^0-9a-fA-F]/g, "").toUpperCase().slice(0, maxHexChars);
36559
+ const parts = [];
36560
+ let currentIndex = 0;
36564
36561
  for (let i = 0; i < activeFormat.length; i++) {
36565
- const chunkLen = activeFormat[i];
36566
- if (currentIdx + chunkLen <= clean.length) {
36567
- formatted += clean.substring(currentIdx, chunkLen);
36568
- if (i < activeFormat.length - 1) {
36569
- formatted += delimiter;
36570
- }
36562
+ const chunkLength = activeFormat[i];
36563
+ const remaining = clean.length - currentIndex;
36564
+ if (remaining > 0) {
36565
+ const chunk = clean.substr(currentIndex, chunkLength);
36566
+ parts.push(chunk);
36567
+ currentIndex += chunkLength;
36571
36568
  }
36572
36569
  else {
36573
- formatted += clean.substring(currentIdx);
36574
36570
  break;
36575
36571
  }
36576
- currentIdx += chunkLen;
36577
36572
  }
36578
- return formatted;
36573
+ return parts.join(delimiter);
36579
36574
  };
36580
36575
  const handleChange = (e) => {
36581
- const newVal = e.target.value;
36582
- const formatted = formatUUID(newVal);
36576
+ const val = e.target.value;
36577
+ const formatted = formatValue(val);
36583
36578
  setFieldValue(alias, formatted);
36584
36579
  };
36585
36580
  const handleCopy = () => {
36586
- navigator.clipboard.writeText(field.value || '');
36587
- setCopied(true);
36588
- setTimeout(() => setCopied(false), 2000);
36581
+ if (field.value) {
36582
+ navigator.clipboard.writeText(field.value);
36583
+ setCopied(true);
36584
+ setTimeout(() => setCopied(false), 2000);
36585
+ }
36589
36586
  };
36590
36587
  const variantClass = inputVariant !== 'input-outline' ? `input-${inputVariant}` : '';
36591
36588
  return (React__default.createElement(Column, { span: width, newLine: newRow },
36592
36589
  React__default.createElement(p$5, { direction: "column", gap: "2", style: { width: '100%' } },
36593
36590
  React__default.createElement(u, Object.assign({ size: size, variant: "surface", color: hasError ? 'red' : undefined, className: `${variantClass} ${className || ''}` }, props),
36594
- React__default.createElement("input", { id: `${alias}FormInput`, name: alias, "aria-describedby": `${alias}InputLabel`, readOnly: readOnly, value: field.value || '', onChange: handleChange, onBlur: () => setFieldTouched(alias, true), placeholder: placeholder || 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', maxLength: maxRawLength + (activeFormat.length - 1), type: "text", style: {
36591
+ React__default.createElement("input", { id: `${alias}FormInput`, name: alias, "aria-describedby": `${alias}InputLabel`, readOnly: readOnly, value: field.value || '', onChange: handleChange, onBlur: () => setFieldTouched(alias, true), maxLength: maxTotalLength, placeholder: placeholder, type: "text", style: {
36595
36592
  flex: 1,
36596
36593
  border: 'none',
36597
36594
  outline: 'none',
@@ -36608,12 +36605,12 @@ const UUIDInput = (_a) => {
36608
36605
  React__default.createElement(e, { content: copied ? "Copied!" : "Copy to clipboard" },
36609
36606
  React__default.createElement(o$5, { size: "1", variant: "ghost", color: copied ? "green" : "gray", onClick: handleCopy, type: "button", disabled: !field.value }, copied ? React__default.createElement(CheckIcon, null) : React__default.createElement(CopyIcon, null))))),
36610
36607
  React__default.createElement("div", null,
36611
- React__default.createElement(p$d, { id: `${alias}InputLabel`, as: "label", size: "2", weight: "bold", htmlFor: alias }, inputLabel),
36608
+ inputLabel && (React__default.createElement(p$d, { id: `${alias}InputLabel`, as: "label", size: "2", weight: "bold", htmlFor: alias }, inputLabel)),
36612
36609
  "\u00A0",
36613
- isHinted && (React__default.createElement(e, { content: hintText || "No hint available", align: "start", sideOffset: 5, className: "core-input-tooltip" },
36610
+ isHinted && (React__default.createElement(e, { content: hintText || "No hint available" },
36614
36611
  React__default.createElement("a", { href: hintUrl || "", target: "_blank", rel: "noopener noreferrer" },
36615
- React__default.createElement(Icon, { name: "questionmarkcircled", height: "16", width: "16", style: { cursor: 'pointer', color: 'gray' } })))),
36616
- hasError && (React__default.createElement("p", { id: errorId, className: 'core-input-label-error' }, errorText || meta.error || `Required field`))))));
36612
+ React__default.createElement(Icon, { name: "questionmarkcircled", height: "16", width: "16", style: { cursor: 'pointer', color: 'gray', marginLeft: 4 } })))),
36613
+ hasError && (React__default.createElement(p$d, { id: errorId, size: "1", color: "red", style: { display: 'block', marginTop: 2 } }, errorText || meta.error || `Required field`))))));
36617
36614
  };
36618
36615
 
36619
36616
  var FaCcVisa = {};
@@ -47236,4 +47233,16 @@ const xFormSchema = object({
47236
47233
  model: array(SectionSchema),
47237
47234
  });
47238
47235
 
47236
+ const parseUuidFormat = (input) => {
47237
+ if (!input.toLowerCase().startsWith('uuid')) {
47238
+ return [4, 4, 4, 4];
47239
+ }
47240
+ const parts = input.slice(5).split('-');
47241
+ const numbers = parts.map((part) => parseInt(part, 10));
47242
+ if (numbers.some((n) => isNaN(n))) {
47243
+ return [4, 4, 4, 4];
47244
+ }
47245
+ return numbers;
47246
+ };
47247
+
47239
47248
  export { AvatarInput, ButtonInput, CURRENCIES, CheckboxGroupInput, 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, R as Theme, N as ThemePanel, Toggle, UUIDInput, parseUuidFormat, primeMatrix, vectorSigma, xFormSchema };
@@ -5,7 +5,7 @@ import '../../styles/main.scss';
5
5
  type startsWithUuid = `uuid${string}`;
6
6
  type UUIDInputProps = Omit<React.ComponentProps<typeof TextField.Root>, 'type' | 'onChange' | 'value' | 'defaultValue'> & {
7
7
  alias: string;
8
- type: startsWithUuid;
8
+ type?: startsWithUuid | string;
9
9
  inputLabel?: string;
10
10
  width: number;
11
11
  newRow?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emeraldemperaur/vector-sigma",
3
- "version": "1.4.12",
3
+ "version": "1.4.13",
4
4
  "description": "Dynamic Form Orchestrator: NPM Package",
5
5
  "repository": {
6
6
  "type": "git",