@cryptlex/web-components 6.6.6-alpha41 → 6.6.6-alpha45

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.
Files changed (41) hide show
  1. package/dist/components/checkbox.d.ts +4 -2
  2. package/dist/components/checkbox.js +1 -1
  3. package/dist/components/checkbox.js.map +1 -1
  4. package/dist/components/data-table-filter.d.ts +1 -1
  5. package/dist/components/data-table-filter.js +1 -1
  6. package/dist/components/data-table.d.ts +3 -11
  7. package/dist/components/data-table.js +1 -1
  8. package/dist/components/data-table.js.map +1 -1
  9. package/dist/components/date-picker.js +1 -1
  10. package/dist/components/dialog-action-utils.d.ts +38 -0
  11. package/dist/components/dialog-action-utils.js +2 -0
  12. package/dist/components/dialog-action-utils.js.map +1 -0
  13. package/dist/components/dialog-menu.d.ts +3 -3
  14. package/dist/components/dialog-menu.js +1 -1
  15. package/dist/components/dialog-menu.js.map +1 -1
  16. package/dist/components/dialog.d.ts +1 -1
  17. package/dist/components/id-search.d.ts +12 -11
  18. package/dist/components/id-search.js +1 -1
  19. package/dist/components/id-search.js.map +1 -1
  20. package/dist/components/select-options.d.ts +8 -0
  21. package/dist/components/select-options.js +1 -1
  22. package/dist/components/select-options.js.map +1 -1
  23. package/dist/components/table-actions.d.ts +46 -0
  24. package/dist/components/table-actions.js +2 -0
  25. package/dist/components/table-actions.js.map +1 -0
  26. package/dist/utilities/countries.d.ts +3 -0
  27. package/dist/utilities/countries.js +2 -0
  28. package/dist/utilities/countries.js.map +1 -0
  29. package/dist/utilities/numbers.d.ts +1 -0
  30. package/dist/utilities/numbers.js +1 -1
  31. package/dist/utilities/numbers.js.map +1 -1
  32. package/dist/utilities/resources.d.ts +8 -1
  33. package/dist/utilities/resources.js +1 -1
  34. package/dist/utilities/resources.js.map +1 -1
  35. package/dist/utilities/string.d.ts +5 -0
  36. package/dist/utilities/string.js +1 -1
  37. package/dist/utilities/string.js.map +1 -1
  38. package/dist/utilities/validators.d.ts +16 -0
  39. package/dist/utilities/validators.js +2 -0
  40. package/dist/utilities/validators.js.map +1 -0
  41. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.js","sources":["../../lib/utilities/validators.ts"],"sourcesContent":["import type { FieldApi as FieldApiType } from '@tanstack/react-form';\nimport { z } from 'zod';\ntype FieldApi = FieldApiType<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n>;\n\n/**\n * Validates that the value of an array item is unique.\n * @param arrayFieldName - The field name of the array.\n * @param currentIndex - The current index of the array item.\n * @param key - The property name of the item.\n * @returns A validator function.\n */\nexport function getUniqueArrayItemValidator(arrayFieldName: string, currentIndex: number, key: string) {\n return ({ value, fieldApi }: { value: any; fieldApi: FieldApi }): { message: string } | undefined => {\n const arrayValue = fieldApi.form.state.values[arrayFieldName];\n const checkUniqueness = (stringValue: string): boolean => {\n if (!Array.isArray(arrayValue)) return true;\n\n const target = stringValue.toLowerCase();\n let firstIndex: number | null = null;\n\n for (let i = 0; i < arrayValue.length; i++) {\n const v = arrayValue[i]?.[key];\n if (typeof v !== 'string') continue;\n\n if (v.toLowerCase() === target) {\n if (firstIndex === null) {\n firstIndex = i; // first match\n } else if (i === currentIndex) {\n // this is the second+ occurrence → invalid\n return false;\n }\n }\n }\n\n // Valid if it's the first match or no match\n return true;\n };\n\n const result = z\n .string()\n .min(1)\n .refine(value => checkUniqueness(value), {\n message: `'${value}' already exists. Enter a unique value.`,\n })\n .safeParse(value);\n\n if (result.success) {\n return undefined;\n }\n\n const firstIssue = result.error.issues[0];\n return {\n message: firstIssue?.message,\n };\n };\n}\n"],"names":["getUniqueArrayItemValidator","arrayFieldName","currentIndex","key","value","fieldApi","arrayValue","checkUniqueness","stringValue","target","firstIndex","i","v","result","z"],"mappings":"wBA+BO,SAASA,EAA4BC,EAAwBC,EAAsBC,EAAa,CACnG,MAAO,CAAC,CAAE,MAAAC,EAAO,SAAAC,KAAoF,CACjG,MAAMC,EAAaD,EAAS,KAAK,MAAM,OAAOJ,CAAc,EACtDM,EAAmBC,GAAiC,CACtD,GAAI,CAAC,MAAM,QAAQF,CAAU,EAAG,MAAO,GAEvC,MAAMG,EAASD,EAAY,YAAA,EAC3B,IAAIE,EAA4B,KAEhC,QAASC,EAAI,EAAGA,EAAIL,EAAW,OAAQK,IAAK,CACxC,MAAMC,EAAIN,EAAWK,CAAC,IAAIR,CAAG,EAC7B,GAAI,OAAOS,GAAM,UAEbA,EAAE,YAAA,IAAkBH,GACpB,GAAIC,IAAe,KACfA,EAAaC,UACNA,IAAMT,EAEb,MAAO,GAGnB,CAGA,MAAO,EACX,EAEMW,EAASC,EACV,OAAA,EACA,IAAI,CAAC,EACL,OAAOV,GAASG,EAAgBH,CAAK,EAAG,CACrC,QAAS,IAAIA,CAAK,yCAAA,CACrB,EACA,UAAUA,CAAK,EAEpB,OAAIS,EAAO,QACP,OAIG,CACH,QAFeA,EAAO,MAAM,OAAO,CAAC,GAEf,OAAA,CAE7B,CACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptlex/web-components",
3
- "version": "6.6.6-alpha41",
3
+ "version": "6.6.6-alpha45",
4
4
  "description": "React component library for Cryptlex web applications",
5
5
  "author": "Cryptlex",
6
6
  "type": "module",