@x15ventures/x15-ui-library 3.14.0 → 3.15.1

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 (156) hide show
  1. package/dist/cjs/autoGenerated/libraryThemes.js +12 -12
  2. package/dist/cjs/autoGenerated/libraryThemes.js.map +1 -1
  3. package/dist/cjs/autoGenerated/libraryThemes.json +12 -12
  4. package/dist/cjs/components/design/dialog/Dialog.js +1 -1
  5. package/dist/cjs/components/design/dialog/Dialog.js.map +1 -1
  6. package/dist/cjs/components/design/headerBar/HeaderBar.js +3 -1
  7. package/dist/cjs/components/design/headerBar/HeaderBar.js.map +1 -1
  8. package/dist/cjs/components/design/headerBar/headerBar.css +6 -1
  9. package/dist/cjs/components/design/skeleton/Skeleton.js +48 -0
  10. package/dist/cjs/components/design/skeleton/Skeleton.js.map +1 -0
  11. package/dist/cjs/components/design/skeleton/_skeletonVariables.css +0 -0
  12. package/dist/cjs/components/design/skeleton/skeleton.css +86 -0
  13. package/dist/cjs/components/form/formFields/formFieldWrapper/FormField.js +8 -5
  14. package/dist/cjs/components/form/formFields/formFieldWrapper/FormField.js.map +1 -1
  15. package/dist/cjs/components/form/formFields/formFieldWrapper/formFieldProps.js.map +1 -1
  16. package/dist/cjs/components/form/formFields/subComponents/inputs/autocomplete/Autocomplete.js +15 -11
  17. package/dist/cjs/components/form/formFields/subComponents/inputs/autocomplete/Autocomplete.js.map +1 -1
  18. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js +37 -15
  19. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js.map +1 -1
  20. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/inputCheckbox.css +4 -4
  21. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.js.map +1 -1
  22. package/dist/cjs/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js +9 -9
  23. package/dist/cjs/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js.map +1 -1
  24. package/dist/cjs/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.js +14 -4
  25. package/dist/cjs/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.js.map +1 -1
  26. package/dist/cjs/components/form/formFields/subComponents/inputs/text/InputText.js +23 -17
  27. package/dist/cjs/components/form/formFields/subComponents/inputs/text/InputText.js.map +1 -1
  28. package/dist/cjs/components/form/formFields/subComponents/select/Select.js +6 -5
  29. package/dist/cjs/components/form/formFields/subComponents/select/Select.js.map +1 -1
  30. package/dist/cjs/components/form/formFields/subComponents/textarea/Textarea.js +55 -83
  31. package/dist/cjs/components/form/formFields/subComponents/textarea/Textarea.js.map +1 -1
  32. package/dist/cjs/components/form/formFields/subComponents/textarea/textarea.css +20 -0
  33. package/dist/cjs/components/form/hookFormWrapper/HookFormWrapper.js +22 -5
  34. package/dist/cjs/components/form/hookFormWrapper/HookFormWrapper.js.map +1 -1
  35. package/dist/cjs/components/form/validation/ValidationMessages.js +36 -38
  36. package/dist/cjs/components/form/validation/ValidationMessages.js.map +1 -1
  37. package/dist/cjs/components/index.js +7 -0
  38. package/dist/cjs/components/index.js.map +1 -1
  39. package/dist/cjs/exampleUIs/exampleComponents/DemoContactForm.js +1 -2
  40. package/dist/cjs/exampleUIs/exampleComponents/DemoContactForm.js.map +1 -1
  41. package/dist/cjs/helpers/index.js +12 -0
  42. package/dist/cjs/helpers/index.js.map +1 -1
  43. package/dist/cjs/helpers/stringHelpers.js +48 -2
  44. package/dist/cjs/helpers/stringHelpers.js.map +1 -1
  45. package/dist/cjs/index.js +7 -0
  46. package/dist/cjs/index.js.map +1 -1
  47. package/dist/cjs/interfaces/headerText.interface.js.map +1 -1
  48. package/dist/cjs/package.json +137 -151
  49. package/dist/cjs/styles/index.css +36 -25
  50. package/dist/cjs/styles/shared/_allPartials.css +22 -25
  51. package/dist/cjs/styles/shared/forms/_forms.css +22 -25
  52. package/dist/cjs/styles/variables/cssVars/_darkModeVariables.css +3 -0
  53. package/dist/cjs/styles/variables/cssVars/_designVariables.css +11 -0
  54. package/dist/components/design/dialog/Dialog.d.ts.map +1 -1
  55. package/dist/components/design/dialog/Dialog.test.d.ts +5 -0
  56. package/dist/components/design/dialog/Dialog.test.d.ts.map +1 -0
  57. package/dist/components/design/headerBar/HeaderBar.d.ts.map +1 -1
  58. package/dist/components/design/skeleton/Skeleton.d.ts +27 -0
  59. package/dist/components/design/skeleton/Skeleton.d.ts.map +1 -0
  60. package/dist/components/form/formFields/formFieldWrapper/FormField.d.ts.map +1 -1
  61. package/dist/components/form/formFields/formFieldWrapper/formFieldProps.d.ts +7 -2
  62. package/dist/components/form/formFields/formFieldWrapper/formFieldProps.d.ts.map +1 -1
  63. package/dist/components/form/formFields/subComponents/inputs/autocomplete/Autocomplete.d.ts.map +1 -1
  64. package/dist/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.d.ts.map +1 -1
  65. package/dist/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.test.d.ts +5 -0
  66. package/dist/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.test.d.ts.map +1 -0
  67. package/dist/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.d.ts +8 -6
  68. package/dist/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.d.ts.map +1 -1
  69. package/dist/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.d.ts.map +1 -1
  70. package/dist/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.d.ts.map +1 -1
  71. package/dist/components/form/formFields/subComponents/inputs/text/InputText.d.ts.map +1 -1
  72. package/dist/components/form/formFields/subComponents/nestedFormContext.test.d.ts +5 -0
  73. package/dist/components/form/formFields/subComponents/nestedFormContext.test.d.ts.map +1 -0
  74. package/dist/components/form/formFields/subComponents/select/Select.d.ts.map +1 -1
  75. package/dist/components/form/formFields/subComponents/textarea/Textarea.d.ts +4 -3
  76. package/dist/components/form/formFields/subComponents/textarea/Textarea.d.ts.map +1 -1
  77. package/dist/components/form/hookFormWrapper/HookFormWrapper.d.ts +3 -0
  78. package/dist/components/form/hookFormWrapper/HookFormWrapper.d.ts.map +1 -1
  79. package/dist/components/form/hookFormWrapper/HookFormWrapper.test.d.ts +5 -0
  80. package/dist/components/form/hookFormWrapper/HookFormWrapper.test.d.ts.map +1 -0
  81. package/dist/components/form/validation/ValidationMessages.d.ts +8 -1
  82. package/dist/components/form/validation/ValidationMessages.d.ts.map +1 -1
  83. package/dist/components/form/validation/ValidationMessages.test.d.ts +5 -0
  84. package/dist/components/form/validation/ValidationMessages.test.d.ts.map +1 -0
  85. package/dist/components/index.d.ts +2 -0
  86. package/dist/components/index.d.ts.map +1 -1
  87. package/dist/esm/autoGenerated/libraryThemes.js +12 -12
  88. package/dist/esm/autoGenerated/libraryThemes.js.map +1 -1
  89. package/dist/esm/autoGenerated/libraryThemes.json +12 -12
  90. package/dist/esm/components/design/dialog/Dialog.js +1 -1
  91. package/dist/esm/components/design/dialog/Dialog.js.map +1 -1
  92. package/dist/esm/components/design/headerBar/HeaderBar.js +3 -1
  93. package/dist/esm/components/design/headerBar/HeaderBar.js.map +1 -1
  94. package/dist/esm/components/design/headerBar/headerBar.css +6 -1
  95. package/dist/esm/components/design/skeleton/Skeleton.js +40 -0
  96. package/dist/esm/components/design/skeleton/Skeleton.js.map +1 -0
  97. package/dist/esm/components/design/skeleton/_skeletonVariables.css +0 -0
  98. package/dist/esm/components/design/skeleton/skeleton.css +86 -0
  99. package/dist/esm/components/form/formFields/formFieldWrapper/FormField.js +8 -5
  100. package/dist/esm/components/form/formFields/formFieldWrapper/FormField.js.map +1 -1
  101. package/dist/esm/components/form/formFields/formFieldWrapper/formFieldProps.js.map +1 -1
  102. package/dist/esm/components/form/formFields/subComponents/inputs/autocomplete/Autocomplete.js +16 -12
  103. package/dist/esm/components/form/formFields/subComponents/inputs/autocomplete/Autocomplete.js.map +1 -1
  104. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js +37 -15
  105. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js.map +1 -1
  106. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/inputCheckbox.css +4 -4
  107. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.js.map +1 -1
  108. package/dist/esm/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js +8 -8
  109. package/dist/esm/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js.map +1 -1
  110. package/dist/esm/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.js +16 -6
  111. package/dist/esm/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.js.map +1 -1
  112. package/dist/esm/components/form/formFields/subComponents/inputs/text/InputText.js +23 -17
  113. package/dist/esm/components/form/formFields/subComponents/inputs/text/InputText.js.map +1 -1
  114. package/dist/esm/components/form/formFields/subComponents/select/Select.js +6 -5
  115. package/dist/esm/components/form/formFields/subComponents/select/Select.js.map +1 -1
  116. package/dist/esm/components/form/formFields/subComponents/textarea/Textarea.js +50 -78
  117. package/dist/esm/components/form/formFields/subComponents/textarea/Textarea.js.map +1 -1
  118. package/dist/esm/components/form/formFields/subComponents/textarea/textarea.css +20 -0
  119. package/dist/esm/components/form/hookFormWrapper/HookFormWrapper.js +22 -5
  120. package/dist/esm/components/form/hookFormWrapper/HookFormWrapper.js.map +1 -1
  121. package/dist/esm/components/form/validation/ValidationMessages.js +36 -38
  122. package/dist/esm/components/form/validation/ValidationMessages.js.map +1 -1
  123. package/dist/esm/components/index.js +1 -0
  124. package/dist/esm/components/index.js.map +1 -1
  125. package/dist/esm/exampleUIs/exampleComponents/DemoContactForm.js +1 -2
  126. package/dist/esm/exampleUIs/exampleComponents/DemoContactForm.js.map +1 -1
  127. package/dist/esm/helpers/index.js +1 -1
  128. package/dist/esm/helpers/index.js.map +1 -1
  129. package/dist/esm/helpers/stringHelpers.js +44 -0
  130. package/dist/esm/helpers/stringHelpers.js.map +1 -1
  131. package/dist/esm/index.js +1 -1
  132. package/dist/esm/index.js.map +1 -1
  133. package/dist/esm/interfaces/headerText.interface.js.map +1 -1
  134. package/dist/esm/package.json +137 -151
  135. package/dist/esm/styles/index.css +36 -25
  136. package/dist/esm/styles/shared/_allPartials.css +22 -25
  137. package/dist/esm/styles/shared/forms/_forms.css +22 -25
  138. package/dist/esm/styles/variables/cssVars/_darkModeVariables.css +3 -0
  139. package/dist/esm/styles/variables/cssVars/_designVariables.css +11 -0
  140. package/dist/exampleUIs/exampleComponents/DemoContactForm.d.ts.map +1 -1
  141. package/dist/helpers/index.d.ts +1 -1
  142. package/dist/helpers/index.d.ts.map +1 -1
  143. package/dist/helpers/stringHelpers.d.ts +17 -0
  144. package/dist/helpers/stringHelpers.d.ts.map +1 -1
  145. package/dist/index.d.ts +2 -2
  146. package/dist/index.d.ts.map +1 -1
  147. package/dist/interfaces/headerText.interface.d.ts +1 -0
  148. package/dist/interfaces/headerText.interface.d.ts.map +1 -1
  149. package/dist/package.json +137 -151
  150. package/package.json +137 -151
  151. package/dist/cjs/components/form/formFields/utilities/formUtilities.js +0 -22
  152. package/dist/cjs/components/form/formFields/utilities/formUtilities.js.map +0 -1
  153. package/dist/components/form/formFields/utilities/formUtilities.d.ts +0 -18
  154. package/dist/components/form/formFields/utilities/formUtilities.d.ts.map +0 -1
  155. package/dist/esm/components/form/formFields/utilities/formUtilities.js +0 -16
  156. package/dist/esm/components/form/formFields/utilities/formUtilities.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.js","names":["React","useMemo","useState","useFormContext","HookFormWrapper","NoHookFormContext","extractError","ValidationMessages","getCharacterCount","value","Intl","segmenter","Segmenter","undefined","granularity","Array","from","segment","length","clampToGraphemeMax","maxAllowed","slice","map","join","Textarea","field","id","name","placeholder","defaultValue","maxLength","enforceMaxLength","onBlur","onChange","onKeyDown","onTouched","htmlNativeDomProps","validation","showSpinner","customCssClasses","customContent","register","getFieldState","formState","errors","fieldState","hasFieldError","Boolean","isInvalid","invalid","count","setCount","toString","hasStartedTyping","setHasStartedTyping","hasMaxLength","isAtLimit","isRequiredError","error","type","characterCounter","cssClass","input","normalizedValidation","maxLengthRule","maxLengthValue","Number","isNaN","maxLengthMessage","graphemeMaxLengthValidator","_maxLength","validate","restValidation","formValues","validationResult","graphemeMaxLength","registered","HandleBeforeInput","event","nativeEvent","inserted","data","target","currentTarget","start","selectionStart","end","selectionEnd","nextValue","preventDefault","HandleChange","rawValue","newValue","onTextareaChange","HandleOnBlur","HandleKeyEvent","onTextareaKeyDown","characterCounterId","errorsId","existingDescribedBy","showsRequiredError","mergedDescribedBy","filter","textareaProps","className","disabled","required","onBeforeInput","createElement","preField","role","postField"],"sources":["../../../../../../../src/components/form/formFields/subComponents/textarea/Textarea.tsx"],"sourcesContent":["'use client';\n\nimport React, { useMemo, useState } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { HookFormWrapper } from '../../../hookFormWrapper/HookFormWrapper';\nimport { FormFieldProps } from '../../formFieldWrapper/formFieldProps';\nimport { NoHookFormContext } from '../../utilities/formUtilities';\nimport { extractError, ValidationMessages } from '../../../validation/ValidationMessages';\n\ninterface TextareaProps extends FormFieldProps, React.TextareaHTMLAttributes<HTMLTextAreaElement> {}\n\n/**\n* Counts user-perceived characters (grapheme clusters).\n* Treats emojis and composed characters (e.g. accented letters) as a single character.\n* Falls back to basic code-point counting if Intl.Segmenter is not available.\n*/\nfunction getCharacterCount(value: string): number {\n if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {\n const segmenter = new Intl.Segmenter(undefined, {\n granularity: 'grapheme',\n });\n return Array.from(segmenter.segment(value)).length;\n }\n return Array.from(value).length;\n}\n\nfunction clampToGraphemeMax(value: string, maxAllowed: number): string {\n if (getCharacterCount(value) <= maxAllowed) {\n return value;\n }\n\n if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {\n const segmenter = new Intl.Segmenter(undefined, {\n granularity: 'grapheme',\n });\n\n return Array.from(segmenter.segment(value))\n .slice(0, maxAllowed)\n .map((segment) => segment.segment)\n .join('');\n }\n\n return Array.from(value).slice(0, maxAllowed).join('');\n}\n\nexport const Textarea: React.FC<TextareaProps> = (\n {\n field: {\n id,\n name,\n placeholder,\n defaultValue,\n maxLength,\n enforceMaxLength,\n onBlur = () => {},\n onChange = () => {},\n onKeyDown = () => {},\n onTouched = () => {},\n ...htmlNativeDomProps\n },\n validation,\n showSpinner,\n customCssClasses,\n customContent\n }\n) => {\n const { register, getFieldState, formState: { errors } } = useFormContext() || NoHookFormContext;\n const fieldState = getFieldState(name);\n const hasFieldError = Boolean(extractError(errors, name));\n // Combine fieldState.invalid with a direct errors lookup so this component re-renders\n // whenever formState.errors changes (getFieldState alone does not subscribe to errors).\n const isInvalid = Boolean(fieldState?.invalid ?? hasFieldError);\n const [count, setCount] = useState<number>(() =>\n getCharacterCount(defaultValue?.toString() || '')\n );\n const [hasStartedTyping, setHasStartedTyping] = useState(false);\n const hasMaxLength = typeof maxLength === 'number';\n const isAtLimit = hasMaxLength ? count >= maxLength : false;\n // Only hide counter for 'required' error. All other errors (maxLength, pattern, etc)\n // should show counter instead of error message.\n const isRequiredError = fieldState?.error?.type === 'required';\n const characterCounter =\n !hasStartedTyping || !hasMaxLength || isRequiredError\n ? undefined\n : `${ count }/${ maxLength }`;\n const cssClass = `${ customCssClasses?.input || '' }${ isInvalid ? ' invalidField' : '' }`;\n\n const normalizedValidation = useMemo(() => {\n if (!validation || typeof validation.maxLength === 'undefined') {\n return validation;\n }\n\n const maxLengthRule = validation.maxLength;\n const maxLengthValue =\n typeof maxLengthRule === 'number'\n ? maxLengthRule\n : typeof maxLengthRule === 'object' && maxLengthRule && 'value' in maxLengthRule\n ? Number(maxLengthRule.value)\n : undefined;\n\n if (typeof maxLengthValue !== 'number' || Number.isNaN(maxLengthValue)) {\n return validation;\n }\n\n const maxLengthMessage = `Maximum length is ${ maxLengthValue }`;\n\n const graphemeMaxLengthValidator = (value: string) =>\n getCharacterCount(value || '') <= maxLengthValue || maxLengthMessage;\n\n // eslint-disable-next-line no-unused-vars\n const { maxLength: _maxLength, validate, ...restValidation } = validation;\n\n if (typeof validate === 'function') {\n return {\n ...restValidation,\n validate: async (value: string, formValues?: unknown) => {\n const validationResult = await validate(value, formValues);\n if (validationResult !== true) {\n return validationResult;\n }\n return graphemeMaxLengthValidator(value);\n },\n };\n }\n\n if (validate && typeof validate === 'object') {\n return {\n ...restValidation,\n validate: {\n ...validate,\n graphemeMaxLength: graphemeMaxLengthValidator,\n },\n };\n }\n\n return {\n ...restValidation,\n validate: graphemeMaxLengthValidator,\n };\n }, [validation]);\n\n const registered = register(name, normalizedValidation);\n\n /**\n * Prevents input that would exceed the maxLength when counting grapheme clusters.\n * Native <textarea maxLength> counts UTF-16 units, so emojis and composed characters\n * can be treated as multiple characters. We avoid using native maxLength and enforce\n * the limit here instead.\n */\n const HandleBeforeInput = (event: React.FormEvent<HTMLTextAreaElement>) => {\n if (enforceMaxLength !== true || !hasMaxLength) return;\n\n const nativeEvent = event.nativeEvent as InputEvent;\n const inserted = nativeEvent.data ?? '';\n\n if (!inserted) return;\n\n const target = event.currentTarget;\n const start = target.selectionStart ?? target.value.length;\n const end = target.selectionEnd ?? target.value.length;\n\n const nextValue =\n target.value.slice(0, start) +\n inserted +\n target.value.slice(end);\n\n if (getCharacterCount(nextValue) > maxLength) {\n event.preventDefault();\n }\n };\n\n const HandleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n const rawValue = event.target.value || '';\n const newValue =\n enforceMaxLength === true && hasMaxLength\n ? clampToGraphemeMax(rawValue, maxLength)\n : rawValue;\n\n if (newValue !== rawValue) {\n event.target.value = newValue;\n }\n\n setHasStartedTyping(true);\n setCount(getCharacterCount(newValue));\n const onTextareaChange = onChange as\n | React.ChangeEventHandler<HTMLTextAreaElement>\n | undefined;\n onTextareaChange?.(event);\n };\n\n const HandleOnBlur = (event: React.FocusEvent<HTMLTextAreaElement>) => {\n const { target } = event;\n if (target) {\n onTouched();\n onBlur(event);\n }\n };\n\n const HandleKeyEvent = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n onTouched();\n const onTextareaKeyDown = onKeyDown as\n | React.KeyboardEventHandler<HTMLTextAreaElement>\n | undefined;\n onTextareaKeyDown?.(event);\n };\n\n const characterCounterId = `${ id }_characterCount`;\n const errorsId = `${ name }_errors`;\n const existingDescribedBy =\n typeof htmlNativeDomProps['aria-describedby'] === 'string'\n ? htmlNativeDomProps['aria-describedby']\n : undefined;\n const showsRequiredError = isInvalid && isRequiredError;\n const mergedDescribedBy = showsRequiredError\n ? [existingDescribedBy, errorsId].filter(Boolean).join(' ')\n : characterCounter !== undefined\n ? [existingDescribedBy, characterCounterId].filter(Boolean).join(' ')\n : existingDescribedBy;\n \n const textareaProps = {\n id,\n className: cssClass,\n placeholder,\n defaultValue,\n ...(showSpinner ? { disabled: true } : {}),\n ...(validation && typeof validation.required !== 'undefined' ? { required: true } : {}),\n ...registered,\n onBeforeInput: HandleBeforeInput,\n onChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n HandleChange(event);\n registered?.onChange?.(event);\n },\n onBlur: (event: React.FocusEvent<HTMLTextAreaElement>) => {\n HandleOnBlur(event);\n registered?.onBlur?.(event);\n },\n onKeyDown: HandleKeyEvent,\n ...htmlNativeDomProps,\n 'aria-describedby': mergedDescribedBy,\n };\n\n return (\n <HookFormWrapper>\n { customContent?.preField && <span className=\"preField\">{ customContent?.preField }</span> }\n\n <div className=\"textareaFieldContainer\">\n <textarea { ...textareaProps } /> \n\n <div className=\"textareaFooter\">\n { isInvalid && isRequiredError\n ? <ValidationMessages name={ name } validation={ { required: validation?.required } } />\n : (\n <div\n id={ characterCounterId }\n className={ `textareaCharacterCount ${\n isAtLimit\n ? 'textareaCharacterCountExceeded'\n : ''\n }` }\n role={ isAtLimit ? 'status' : undefined }\n aria-live={ isAtLimit ? 'polite' : undefined }\n aria-atomic={ isAtLimit ? 'true' : undefined }\n >\n { characterCounter }\n </div>\n )\n }\n </div>\n </div>\n\n { customContent?.postField && <span className=\"postField\">{ customContent?.postField }</span> }\n </HookFormWrapper>\n );\n};\n"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,IAAIC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAChD,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,eAAe,QAAQ,0CAA0C;AAE1E,SAASC,iBAAiB,QAAQ,+BAA+B;AACjE,SAASC,YAAY,EAAEC,kBAAkB,QAAQ,wCAAwC;AAIzF;AACA;AACA;AACA;AACA;AACA,SAASC,iBAAiBA,CAACC,KAAa,EAAU;EAChD,IAAI,OAAOC,IAAI,KAAK,WAAW,IAAI,WAAW,IAAIA,IAAI,EAAE;IACtD,MAAMC,SAAS,GAAG,IAAID,IAAI,CAACE,SAAS,CAACC,SAAS,EAAE;MAC9CC,WAAW,EAAE;IACf,CAAC,CAAC;IACF,OAAOC,KAAK,CAACC,IAAI,CAACL,SAAS,CAACM,OAAO,CAACR,KAAK,CAAC,CAAC,CAACS,MAAM;EACpD;EACA,OAAOH,KAAK,CAACC,IAAI,CAACP,KAAK,CAAC,CAACS,MAAM;AACjC;AAEA,SAASC,kBAAkBA,CAACV,KAAa,EAAEW,UAAkB,EAAU;EACrE,IAAIZ,iBAAiB,CAACC,KAAK,CAAC,IAAIW,UAAU,EAAE;IAC1C,OAAOX,KAAK;EACd;EAEA,IAAI,OAAOC,IAAI,KAAK,WAAW,IAAI,WAAW,IAAIA,IAAI,EAAE;IACtD,MAAMC,SAAS,GAAG,IAAID,IAAI,CAACE,SAAS,CAACC,SAAS,EAAE;MAC9CC,WAAW,EAAE;IACf,CAAC,CAAC;IAEF,OAAOC,KAAK,CAACC,IAAI,CAACL,SAAS,CAACM,OAAO,CAACR,KAAK,CAAC,CAAC,CACxCY,KAAK,CAAC,CAAC,EAAED,UAAU,CAAC,CACpBE,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SAAS,EAAC;EAAU,GAAGhE,aAAa,EAAEqE,QAAgB,CAAC,eAE1F7G,KAAA,CAAA4G,aAAA;IAAKJ,SAAS,EAAC;EAAwB,gBACrCxG,KAAA,CAAA4G,aAAA,aAAeL,aAAiB,CAAC,eAEjCvG,KAAA,CAAA4G,aAAA;IAAKJ,SAAS,EAAC;EAAgB,GAC3BxD,SAAS,IAAIS,eAAe,gBAC1BzD,KAAA,CAAA4G,aAAA,CAACrG,kBAAkB;IAACoB,IAAI,EAAGA,IAAM;IAACU,UAAU,EAAG;MAAEqE,QAAQ,EAAErE,UAAU,EAAEqE;IAAS;EAAG,CAAE,CAAC,gBAEtF1G,KAAA,CAAA4G,aAAA;IACElF,EAAE,EAAGuE,kBAAoB;IACzBO,SAAS,EAAG,0BACVhD,SAAS,GACL,gCAAgC,GAChC,EAAE,EACJ;IACJsD,IAAI,EAAGtD,SAAS,GAAG,QAAQ,GAAG3C,SAAW;IACzC,aAAY2C,SAAS,GAAG,QAAQ,GAAG3C,SAAW;IAC9C,eAAc2C,SAAS,GAAG,MAAM,GAAG3C;EAAW,GAE5C+C,gBACC,CAGN,CACF,CAAC,EAEJpB,aAAa,EAAEuE,SAAS,iBAAI/G,KAAA,CAAA4G,aAAA;IAAMJ,SAAS,EAAC;EAAW,GAAGhE,aAAa,EAAEuE,SAAiB,CAC7E,CAAC;AAEtB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Textarea.js","names":["React","useMemo","useState","useFormContext","HookFormWrapper","extractError","clampToGraphemeMax","getCharacterCount","Textarea","props","createElement","formContext","TextareaField","field","id","name","placeholder","defaultValue","maxLength","enforceMaxLength","onBlur","onChange","onKeyDown","onTouched","htmlNativeDomProps","validation","showSpinner","customCssClasses","customContent","register","getFieldState","formState","errors","fieldState","isInvalid","Boolean","invalid","isRequiredError","error","type","count","setCount","toString","hasStartedTyping","setHasStartedTyping","hasMaxLength","isAtLimit","showsCharacterCount","cssClass","input","normalizedValidation","maxLengthRule","maxLengthValue","Number","value","undefined","isNaN","maxLengthMessage","graphemeMaxLengthValidator","_maxLength","validate","restValidation","formValues","validationResult","graphemeMaxLength","fieldRegistration","HandleBeforeInput","event","nativeEvent","inserted","data","target","currentTarget","start","selectionStart","length","end","selectionEnd","nextValue","slice","preventDefault","HandleChange","rawValue","newValue","HandleAutoFill","animationName","HandleOnBlur","HandleKeyEvent","textareaProps","className","disabled","required","onBeforeInput","onAnimationStart","containerCssClass","Fragment","preField","role","postField"],"sources":["../../../../../../../src/components/form/formFields/subComponents/textarea/Textarea.tsx"],"sourcesContent":["'use client';\n\nimport React, { useMemo, useState } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { HookFormWrapper } from '../../../hookFormWrapper/HookFormWrapper';\nimport {\n FormFieldProps,\n TextareaFieldProps,\n} from '../../formFieldWrapper/formFieldProps';\nimport { extractError } from '../../../validation/ValidationMessages';\nimport { clampToGraphemeMax, getCharacterCount } from '../../../../../helpers/stringHelpers';\n\nimport './textarea.scss';\n\nexport interface TextareaProps extends Omit<FormFieldProps, 'field'> {\n field: Omit<TextareaFieldProps, 'type'>;\n}\n\nexport const Textarea: React.FC<TextareaProps> = (props) => (\n <HookFormWrapper formContext={ props.formContext }>\n <TextareaField { ...props } />\n </HookFormWrapper>\n);\n\nconst TextareaField: React.FC<TextareaProps> = (\n {\n field: {\n id,\n name,\n placeholder,\n defaultValue,\n maxLength,\n enforceMaxLength,\n onBlur = () => {},\n onChange = () => {},\n onKeyDown = () => {},\n onTouched = () => {},\n ...htmlNativeDomProps\n },\n validation,\n showSpinner,\n customCssClasses,\n customContent\n }\n) => {\n const { register, getFieldState, formState: { errors } } = useFormContext();\n const fieldState = getFieldState(name);\n // getFieldState alone does not subscribe to errors, so the direct lookup keeps this in sync.\n const isInvalid = Boolean(fieldState?.invalid || extractError(errors, name));\n const isRequiredError = fieldState?.error?.type === 'required';\n\n const [count, setCount] = useState<number>(() => getCharacterCount(defaultValue?.toString() || ''));\n const [hasStartedTyping, setHasStartedTyping] = useState(false);\n\n const hasMaxLength = typeof maxLength === 'number';\n const isAtLimit = hasMaxLength ? count >= maxLength : false;\n const showsCharacterCount = hasStartedTyping && hasMaxLength && !isRequiredError;\n\n const cssClass = `${ customCssClasses?.input || '' }${ isInvalid ? ' invalidField' : '' }`;\n\n const normalizedValidation = useMemo(() => {\n if (!validation || typeof validation.maxLength === 'undefined') {\n return validation;\n }\n\n const maxLengthRule = validation.maxLength;\n const maxLengthValue =\n typeof maxLengthRule === 'number'\n ? maxLengthRule\n : typeof maxLengthRule === 'object' && maxLengthRule && 'value' in maxLengthRule\n ? Number(maxLengthRule.value)\n : undefined;\n\n if (typeof maxLengthValue !== 'number' || Number.isNaN(maxLengthValue)) {\n return validation;\n }\n\n const maxLengthMessage = `Maximum length is ${ maxLengthValue }`;\n\n const graphemeMaxLengthValidator = (value: string) =>\n getCharacterCount(value || '') <= maxLengthValue || maxLengthMessage;\n\n // eslint-disable-next-line no-unused-vars\n const { maxLength: _maxLength, validate, ...restValidation } = validation;\n\n if (typeof validate === 'function') {\n return {\n ...restValidation,\n validate: async (value: string, formValues?: unknown) => {\n const validationResult = await validate(value, formValues);\n\n if (validationResult !== true) {\n return validationResult;\n }\n\n return graphemeMaxLengthValidator(value);\n },\n };\n }\n\n if (validate && typeof validate === 'object') {\n return {\n ...restValidation,\n validate: {\n ...validate,\n graphemeMaxLength: graphemeMaxLengthValidator,\n },\n };\n }\n\n return {\n ...restValidation,\n validate: graphemeMaxLengthValidator,\n };\n }, [validation]);\n\n const fieldRegistration = register(name, normalizedValidation);\n\n /**\n * Native maxLength counts UTF-16 units, so emojis and composed characters are treated as\n * several characters. The limit is enforced here against grapheme clusters instead.\n */\n const HandleBeforeInput = (event: React.FormEvent<HTMLTextAreaElement>) => {\n if (enforceMaxLength !== true || !hasMaxLength) {\n return;\n }\n\n const nativeEvent = event.nativeEvent as InputEvent;\n const inserted = nativeEvent.data ?? '';\n\n if (!inserted) {\n return;\n }\n\n const target = event.currentTarget;\n const start = target.selectionStart ?? target.value.length;\n const end = target.selectionEnd ?? target.value.length;\n const nextValue = target.value.slice(0, start) + inserted + target.value.slice(end);\n\n if (getCharacterCount(nextValue) > maxLength) {\n event.preventDefault();\n }\n };\n\n const HandleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n const rawValue = event.target.value || '';\n const newValue = enforceMaxLength === true && hasMaxLength\n ? clampToGraphemeMax(rawValue, maxLength)\n : rawValue;\n\n if (newValue !== rawValue) {\n event.target.value = newValue;\n }\n\n setHasStartedTyping(true);\n setCount(getCharacterCount(newValue));\n\n (onChange as React.ChangeEventHandler<HTMLTextAreaElement>)(event);\n fieldRegistration?.onChange?.(event);\n };\n\n const HandleAutoFill = (event: React.AnimationEvent<HTMLTextAreaElement>) => {\n // Browsers trigger onAnimationStart when autofill happens.\n // We need to notify react-hook-form of the new value.\n if (event.animationName === 'onAutoFill') {\n const { value } = event.currentTarget;\n setHasStartedTyping(true);\n setCount(getCharacterCount(value || ''));\n HandleChange({ target: event.currentTarget } as unknown as React.ChangeEvent<HTMLTextAreaElement>);\n }\n };\n\n const HandleOnBlur = (event: React.FocusEvent<HTMLTextAreaElement>) => {\n const { target } = event;\n\n if (target) {\n onTouched();\n (onBlur as React.FocusEventHandler<HTMLTextAreaElement>)(event);\n }\n\n fieldRegistration?.onBlur?.(event);\n };\n\n const HandleKeyEvent = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n onTouched();\n (onKeyDown as React.KeyboardEventHandler<HTMLTextAreaElement>)(event);\n };\n\n const textareaProps = {\n id,\n className: cssClass,\n placeholder,\n defaultValue,\n ...(showSpinner ? { disabled: true } : {}),\n ...(validation && typeof validation.required !== 'undefined' ? { required: true } : {}),\n ...htmlNativeDomProps,\n ...fieldRegistration,\n onBeforeInput: HandleBeforeInput,\n onChange: HandleChange,\n onBlur: HandleOnBlur,\n onKeyDown: HandleKeyEvent,\n onAnimationStart: HandleAutoFill,\n };\n\n const containerCssClass = `textareaFieldContainer${ showsCharacterCount ? ' withCharacterCount' : '' }`;\n\n return (\n <>\n { customContent?.preField && <span className=\"preField\">{ customContent?.preField }</span> }\n\n <span className={ containerCssClass }>\n <textarea { ...textareaProps } />\n\n {\n showsCharacterCount && (\n <span\n className={ `textareaCharacterCount ${ isAtLimit ? 'textareaCharacterCountExceeded' : '' }` }\n role={ isAtLimit ? 'status' : undefined }\n aria-live={ isAtLimit ? 'polite' : undefined }\n aria-atomic={ isAtLimit ? 'true' : undefined }\n >\n { `${ count }/${ maxLength }` }\n </span>\n )\n }\n </span>\n\n { customContent?.postField && <span className=\"postField\">{ customContent?.postField }</span> }\n </>\n );\n};\n"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,IAAIC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAChD,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,eAAe,QAAQ,0CAA0C;AAK1E,SAASC,YAAY,QAAQ,wCAAwC;AACrE,SAASC,kBAAkB,EAAEC,iBAAiB,QAAQ,sCAAsC;AAE5F,OAAO,iBAAiB;AAMxB,OAAO,MAAMC,QAAiC,GAAIC,KAAK,iBACrDT,KAAA,CAAAU,aAAA,CAACN,eAAe;EAACO,WAAW,EAAGF,KAAK,CAACE;AAAa,gBAChDX,KAAA,CAAAU,aAAA,CAACE,aAAa,EAAMH,KAAS,CACd,CAClB;AAED,MAAMG,aAAsC,GAAGA,CAC7C;EACEC,KAAK,EAAE;IACLC,EAAE;IACFC,IAAI;IACJC,WAAW;IACXC,YAAY;IACZC,SAAS;IACTC,gBAAgB;IAChBC,MAAM,GAAGA,CAAA,KAAM,CAAC,CAAC;IACjBC,QAAQ,GAAGA,CAAA,KAAM,CAAC,CAAC;IACnBC,SAAS,GAAGA,CAAA,KAAM,CAAC,CAAC;IACpBC,SAAS,GAAGA,CAAA,KAAM,CAAC,CAAC;IACpB,GAAGC;EACL,CAAC;EACDC,UAAU;EACVC,WAAW;EACXC,gBAAgB;EAChBC;AACF,CAAC,KACE;EACH,MAAM;I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G,yBAA0B/C,mBAAmB,GAAG,qBAAqB,GAAG,EAAE,EAAG;EAEvG,oBACE/C,KAAA,CAAAU,aAAA,CAAAV,KAAA,CAAA+F,QAAA,QACInE,aAAa,EAAEoE,QAAQ,iBAAIhG,KAAA,CAAAU,aAAA;IAAM+E,SAAS,EAAC;EAAU,GAAG7D,aAAa,EAAEoE,QAAgB,CAAC,eAE1FhG,KAAA,CAAAU,aAAA;IAAM+E,SAAS,EAAGK;EAAmB,gBACnC9F,KAAA,CAAAU,aAAA,aAAe8E,aAAiB,CAAC,EAG/BzC,mBAAmB,iBACjB/C,KAAA,CAAAU,aAAA;IACE+E,SAAS,EAAG,0BAA2B3C,SAAS,GAAG,gCAAgC,GAAG,EAAE,EAAK;IAC7FmD,IAAI,EAAGnD,SAAS,GAAG,QAAQ,GAAGS,SAAW;IACzC,aAAYT,SAAS,GAAG,QAAQ,GAAGS,SAAW;IAC9C,eAAcT,SAAS,GAAG,MAAM,GAAGS;EAAW,GAE5C,GAAIf,KAAK,IAAMtB,SAAS,EACtB,CAGN,CAAC,EAELU,aAAa,EAAEsE,SAAS,iBAAIlG,KAAA,CAAAU,aAAA;IAAM+E,SAAS,EAAC;EAAW,GAAG7D,aAAa,EAAEsE,SAAiB,CAC5F,CAAC;AAEP,CAAC","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ .textareaFieldContainer {
2
+ position: relative;
3
+ width: 100%;
4
+ }
5
+ .textareaFieldContainer.withCharacterCount textarea {
6
+ padding-bottom: 26px;
7
+ }
8
+
9
+ .textareaCharacterCount {
10
+ line-height: 15px;
11
+ font-size: 13px;
12
+ color: var(--inputLabelColor);
13
+ position: absolute;
14
+ right: 10px;
15
+ bottom: 10px;
16
+ pointer-events: none;
17
+ }
18
+ .textareaCharacterCount.textareaCharacterCountExceeded {
19
+ color: var(--inputErrorColor);
20
+ }
@@ -6,21 +6,38 @@ import { FormProvider, useForm, useFormContext } from 'react-hook-form';
6
6
  export const HookFormWrapper = ({
7
7
  formCssClass = 'x15StandardForm',
8
8
  children,
9
- formProps
9
+ formProps,
10
+ formContext,
11
+ onSubmit
10
12
  }) => {
11
- const existingHookFormContext = useFormContext();
13
+ const inheritedHookFormContext = useFormContext();
12
14
  const hookFormMethods = useForm({
13
15
  mode: 'all',
14
16
  criteriaMode: 'all',
15
17
  shouldFocusError: true
16
18
  });
17
- if (existingHookFormContext) {
18
- return children;
19
+
20
+ // A manually supplied context re-publishes the form state across a boundary the
21
+ // React context could not cross (e.g. a Next.js server/client component split).
22
+ if (formContext) {
23
+ return /*#__PURE__*/React.createElement(FormProvider, formContext, children);
24
+ }
25
+ if (inheritedHookFormContext) {
26
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
19
27
  }
28
+ const {
29
+ onSubmit: nativeOnSubmit,
30
+ ...remainingFormProps
31
+ } = formProps || {};
32
+
33
+ // `onSubmit` receives the validated values, so consumers never need to call useForm themselves.
34
+ const handleFormSubmit = onSubmit ? hookFormMethods.handleSubmit(onSubmit) : nativeOnSubmit;
20
35
  return /*#__PURE__*/React.createElement(FormProvider, hookFormMethods, /*#__PURE__*/React.createElement("form", _extends({
21
36
  className: formCssClass,
22
37
  autoComplete: "off"
23
- }, formProps), children));
38
+ }, remainingFormProps, {
39
+ onSubmit: handleFormSubmit
40
+ }), children));
24
41
  };
25
42
  export default HookFormWrapper;
26
43
  //# sourceMappingURL=HookFormWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HookFormWrapper.js","names":["_extends","React","FormProvider","useForm","useFormContext","HookFormWrapper","formCssClass","children","formProps","existingHookFormContext","hookFormMethods","mode","criteriaMode","shouldFocusError","createElement","className","autoComplete"],"sources":["../../../../../src/components/form/hookFormWrapper/HookFormWrapper.tsx"],"sourcesContent":["'use client';\n\nimport React, { ReactNode, ReactElement, FormHTMLAttributes } from 'react';\nimport { FormProvider, useForm, useFormContext } from 'react-hook-form';\n\ninterface FormWrapperProps {\n formCssClass?: string;\n formProps?: FormHTMLAttributes<HTMLFormElement>;\n children: ReactNode | ReactElement;\n}\n\nexport const HookFormWrapper: React.FC<FormWrapperProps> = (\n {\n formCssClass = 'x15StandardForm',\n children,\n formProps\n }\n) => {\n const existingHookFormContext = useFormContext();\n\n const hookFormMethods = useForm({\n mode: 'all',\n criteriaMode: 'all',\n shouldFocusError: true\n });\n\n if (existingHookFormContext) {\n return children;\n }\n\n return (\n <FormProvider { ...hookFormMethods }>\n <form className={ formCssClass } autoComplete=\"off\" { ...formProps }>\n {\n children\n }\n </form>\n </FormProvider>\n );\n};\n\nexport default HookFormWrapper;\n"],"mappings":"AAAA,YAAY;;AAAC,OAAAA,QAAA;AAEb,OAAOC,KAAK,MAAuD,OAAO;AAC1E,SAASC,YAAY,EAAEC,OAAO,EAAEC,cAAc,QAAQ,iBAAiB;AAQvE,OAAO,MAAMC,eAA2C,GAAGA,CACzD;EACEC,YAAY,GAAG,iBAAiB;EAChCC,QAAQ;EACRC;AACF,CAAC,KACE;EACH,MAAMC,uBAAuB,GAAGL,cAAc,CAAC,CAAC;EAEhD,MAAMM,eAAe,GAAGP,OAAO,CAAC;IAC9BQ,IAAI,EAAE,KAAK;IACXC,YAAY,EAAE,KAAK;IACnBC,gBAAgB,EAAE;EACpB,CAAC,CAAC;EAEF,IAAIJ,uBAAuB,EAAE;IAC3B,OAAOF,QAAQ;EACjB;EAEA,oBACEN,KAAA,CAAAa,aAAA,CAACZ,YAAY,EAAMQ,eAAe,eAChCT,KAAA,CAAAa,aAAA,SAAAd,QAAA;IAAMe,SAAS,EAAGT,YAAc;IAACU,YAAY,EAAC;EAAK,GAAMR,SAAS,GAE9DD,QAEE,CACM,CAAC;AAEnB,CAAC;AAED,eAAeF,eAAe","ignoreList":[]}
1
+ {"version":3,"file":"HookFormWrapper.js","names":["_extends","React","FormProvider","useForm","useFormContext","HookFormWrapper","formCssClass","children","formProps","formContext","onSubmit","inheritedHookFormContext","hookFormMethods","mode","criteriaMode","shouldFocusError","createElement","Fragment","nativeOnSubmit","remainingFormProps","handleFormSubmit","handleSubmit","className","autoComplete"],"sources":["../../../../../src/components/form/hookFormWrapper/HookFormWrapper.tsx"],"sourcesContent":["'use client';\n\nimport React, { ReactNode, ReactElement, FormHTMLAttributes } from 'react';\nimport { FieldValues, FormProvider, useForm, useFormContext, UseFormReturn } from 'react-hook-form';\n\ninterface FormWrapperProps {\n formCssClass?: string;\n formProps?: FormHTMLAttributes<HTMLFormElement>;\n children: ReactNode | ReactElement;\n formContext?: UseFormReturn<FieldValues, any, FieldValues>\n /* eslint-disable-next-line no-unused-vars */\n onSubmit?: (values: FieldValues) => void | Promise<void>;\n}\n\nexport const HookFormWrapper: React.FC<FormWrapperProps> = (\n {\n formCssClass = 'x15StandardForm',\n children,\n formProps,\n formContext,\n onSubmit,\n }\n) => {\n const inheritedHookFormContext = useFormContext();\n\n const hookFormMethods = useForm({\n mode: 'all',\n criteriaMode: 'all',\n shouldFocusError: true\n });\n\n // A manually supplied context re-publishes the form state across a boundary the\n // React context could not cross (e.g. a Next.js server/client component split).\n if (formContext) {\n return (\n <FormProvider { ...formContext }>\n { children }\n </FormProvider>\n );\n }\n\n if (inheritedHookFormContext) {\n return <>{ children }</>;\n }\n\n const { onSubmit: nativeOnSubmit, ...remainingFormProps } = formProps || {};\n\n // `onSubmit` receives the validated values, so consumers never need to call useForm themselves.\n const handleFormSubmit = onSubmit\n ? hookFormMethods.handleSubmit(onSubmit)\n : nativeOnSubmit;\n\n return (\n <FormProvider { ...hookFormMethods }>\n <form\n className={ formCssClass }\n autoComplete=\"off\"\n { ...remainingFormProps }\n onSubmit={ handleFormSubmit }\n >\n {\n children\n }\n </form>\n </FormProvider>\n );\n};\n\nexport default HookFormWrapper;\n"],"mappings":"AAAA,YAAY;;AAAC,OAAAA,QAAA;AAEb,OAAOC,KAAK,MAAuD,OAAO;AAC1E,SAAsBC,YAAY,EAAEC,OAAO,EAAEC,cAAc,QAAuB,iBAAiB;AAWnG,OAAO,MAAMC,eAA2C,GAAGA,CACzD;EACEC,YAAY,GAAG,iBAAiB;EAChCC,QAAQ;EACRC,SAAS;EACTC,WAAW;EACXC;AACF,CAAC,KACE;EACH,MAAMC,wBAAwB,GAAGP,cAAc,CAAC,CAAC;EAEjD,MAAMQ,eAAe,GAAGT,OAAO,CAAC;IAC9BU,IAAI,EAAE,KAAK;IACXC,YAAY,EAAE,KAAK;IACnBC,gBAAgB,EAAE;EACpB,CAAC,CAAC;;EAEF;EACA;EACA,IAAIN,WAAW,EAAE;IACf,oBACER,KAAA,CAAAe,aAAA,CAACd,YAAY,EAAMO,WAAW,EAC1BF,QACU,CAAC;EAEnB;EAEA,IAAII,wBAAwB,EAAE;IAC5B,oBAAOV,KAAA,CAAAe,aAAA,CAAAf,KAAA,CAAAgB,QAAA,QAAIV,QAAY,CAAC;EAC1B;EAEA,MAAM;IAAEG,QAAQ,EAAEQ,cAAc;IAAE,GAAGC;EAAmB,CAAC,GAAGX,SAAS,IAAI,CAAC,CAAC;;EAE3E;EACA,MAAMY,gBAAgB,GAAGV,QAAQ,GAC7BE,eAAe,CAACS,YAAY,CAACX,QAAQ,CAAC,GACtCQ,cAAc;EAElB,oBACEjB,KAAA,CAAAe,aAAA,CAACd,YAAY,EAAMU,eAAe,eAChCX,KAAA,CAAAe,aAAA,SAAAhB,QAAA;IACEsB,SAAS,EAAGhB,YAAc;IAC1BiB,YAAY,EAAC;EAAK,GACbJ,kBAAkB;IACvBT,QAAQ,EAAGU;EAAkB,IAG3Bb,QAEE,CACM,CAAC;AAEnB,CAAC;AAED,eAAeF,eAAe","ignoreList":[]}
@@ -1,19 +1,27 @@
1
- /* eslint-disable no-unused-vars */
2
-
3
1
  'use client';
4
2
 
5
3
  import React from 'react';
6
- import { ErrorMessage } from '@hookform/error-message';
7
4
  import { useFormContext } from 'react-hook-form';
8
- import { NoHookFormContext } from '../formFields/utilities/formUtilities';
9
5
  // Type for generic error messages
10
6
  export const GenericErrorMessages = {
11
- required: () => 'This field is required. Please enter a value.',
12
- minLength: value => `Please provide a minimum of ${value} characters.`,
13
- maxLength: value => `Please provide a maximum of ${value} characters.`,
14
- min: value => `The value must be a minimum of ${value}.`,
15
- max: value => `The value must be a maximum of ${value}.`,
16
- unknown: () => 'An unknown error has occurred.'
7
+ required: 'This field is required. Please enter a value.',
8
+ minLength: 'Please provide a minimum of {value} characters.',
9
+ maxLength: 'Please provide a maximum of {value} characters.',
10
+ min: 'The value must be a minimum of {value}.',
11
+ max: 'The value must be a maximum of {value}.',
12
+ unknown: 'An unknown error has occurred.'
13
+ };
14
+ const isGenericErrorType = errorType => typeof errorType === 'string' && errorType !== 'unknown' && Object.prototype.hasOwnProperty.call(GenericErrorMessages, errorType);
15
+ const getValidationValue = validator => typeof validator === 'object' ? validator.value : validator;
16
+ const getGenericErrorMessage = (errorType, validation) => {
17
+ if (!isGenericErrorType(errorType)) {
18
+ return undefined;
19
+ }
20
+ if (errorType === 'required') {
21
+ return GenericErrorMessages.required;
22
+ }
23
+ const value = getValidationValue(validation?.[errorType]);
24
+ return value === undefined ? undefined : GenericErrorMessages[errorType].replace('{value}', String(value));
17
25
  };
18
26
 
19
27
  // Helper function to extract nested errors
@@ -33,49 +41,39 @@ export const ValidationMessages = ({
33
41
  name,
34
42
  validation
35
43
  }) => {
44
+ const formContext = useFormContext();
45
+ if (!formContext) {
46
+ return null;
47
+ }
36
48
  const {
37
49
  formState: {
38
50
  errors
39
51
  }
40
- } = useFormContext() || NoHookFormContext;
52
+ } = formContext;
41
53
  const fieldError = extractError(errors, name);
42
54
  if (!fieldError) {
43
55
  return null;
44
56
  }
45
57
 
46
- // Check all the validators have a message
47
- if (validation) {
48
- Object.entries(validation).forEach(([validatorKey, validator]) => {
49
- if (GenericErrorMessages[validatorKey]) {
50
- if (typeof validator === 'boolean') {
51
- if (fieldError.type && fieldError.types && typeof fieldError.types[fieldError.type] === 'string') {
52
- fieldError.message = fieldError.types[fieldError.type];
53
- } else {
54
- fieldError.message = GenericErrorMessages[validatorKey]();
55
- }
56
- } else if (typeof validator === 'object' && 'value' in validator) {
57
- // @ts-ignore The hook form types don't seem to cater for versions with value properties properly
58
- fieldError.message = GenericErrorMessages[validatorKey](validator.value || undefined);
59
- }
60
- }
61
- });
62
- }
58
+ // Derive a fallback message rather than mutating the error object held in formState.
59
+ const resolveMessage = () => {
60
+ if (fieldError.message) {
61
+ return fieldError.message;
62
+ }
63
+ if (fieldError.type && fieldError.types && typeof fieldError.types[fieldError.type] === 'string') {
64
+ return fieldError.types[fieldError.type];
65
+ }
66
+ return getGenericErrorMessage(fieldError.type, validation);
67
+ };
68
+ const message = resolveMessage() || GenericErrorMessages.unknown;
63
69
  return /*#__PURE__*/React.createElement("span", {
64
70
  className: "validation",
65
71
  id: `${name}_errors`
66
72
  }, /*#__PURE__*/React.createElement("span", {
67
73
  className: "message"
68
- }, !fieldError?.message && /*#__PURE__*/React.createElement("span", {
74
+ }, /*#__PURE__*/React.createElement("span", {
69
75
  className: "error"
70
- }, GenericErrorMessages.unknown()), /*#__PURE__*/React.createElement(ErrorMessage, {
71
- errors: errors,
72
- name: name,
73
- render: ({
74
- message
75
- }) => /*#__PURE__*/React.createElement("span", {
76
- className: "error"
77
- }, message)
78
- })));
76
+ }, message)));
79
77
  };
80
78
  export default ValidationMessages;
81
79
  //# sourceMappingURL=ValidationMessages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ValidationMessages.js","names":["React","ErrorMessage","useFormContext","NoHookFormContext","GenericErrorMessages","required","minLength","value","maxLength","min","max","unknown","extractError","errors","fieldName","undefined","pathComponents","split","reduce","accumulator","pathComponent","ValidationMessages","name","validation","formState","fieldError","Object","entries","forEach","validatorKey","validator","type","types","message","createElement","className","id","render"],"sources":["../../../../../src/components/form/validation/ValidationMessages.tsx"],"sourcesContent":["/* eslint-disable no-unused-vars */\n\n'use client';\n\nimport React from 'react';\nimport { ErrorMessage } from '@hookform/error-message';\nimport {\n FieldError,\n FieldErrors,\n FieldErrorsImpl,\n Merge, useFormContext\n} from 'react-hook-form';\nimport {\n ValidationProps\n} from '../formFields/formFieldWrapper/formFieldProps';\nimport { NoHookFormContext } from '../formFields/utilities/formUtilities';\nimport { InputCheckboxValidationProps } from '../formFields/subComponents/inputs/checkbox/inputCheckboxProps';\n\n// Type for generic error messages\nexport const GenericErrorMessages: Record<string, (value?: never) => string> = {\n required: () => 'This field is required. Please enter a value.',\n minLength: (value) => `Please provide a minimum of ${ value } characters.`,\n maxLength: (value) => `Please provide a maximum of ${ value } characters.`,\n min: (value) => `The value must be a minimum of ${ value }.`,\n max: (value) => `The value must be a maximum of ${ value }.`,\n unknown: () => 'An unknown error has occurred.'\n};\n\n// Helper function to extract nested errors\nexport const extractError = (\n errors: FieldErrors,\n fieldName: string\n): FieldError | Merge<FieldError, FieldErrorsImpl<never>> | undefined => {\n if (!errors) {\n return undefined;\n }\n\n const pathComponents = fieldName.split('.');\n\n return pathComponents.reduce<FieldError | Merge<FieldError, FieldErrorsImpl<never>> | undefined>(\n (accumulator, pathComponent) => {\n if (!accumulator) {\n return undefined;\n }\n\n return (accumulator as never)[pathComponent];\n },\n errors as never\n );\n};\n\ninterface ValidationMessagesProps {\n name: string;\n validation?: ValidationProps | InputCheckboxValidationProps\n}\n\nexport const ValidationMessages: React.FC<ValidationMessagesProps> = (\n {\n name,\n validation\n }\n) => {\n const { formState: { errors } } = useFormContext() || NoHookFormContext;\n\n const fieldError = extractError(errors, name);\n\n if (!fieldError) {\n return null;\n }\n\n // Check all the validators have a message\n if (validation) {\n Object.entries(validation).forEach(([validatorKey, validator]) => {\n if (GenericErrorMessages[validatorKey]) {\n if (typeof validator === 'boolean') {\n if (\n fieldError.type &&\n fieldError.types &&\n typeof fieldError.types[fieldError.type] === 'string'\n ) {\n fieldError.message = fieldError.types[fieldError.type] as string;\n } else {\n fieldError.message = GenericErrorMessages[validatorKey]();\n }\n } else if (typeof validator === 'object' && 'value' in validator) {\n // @ts-ignore The hook form types don't seem to cater for versions with value properties properly\n fieldError.message = GenericErrorMessages[validatorKey](validator.value || undefined);\n }\n }\n });\n }\n\n return (\n <span className=\"validation\" id={ `${ name }_errors` }>\n <span className=\"message\">\n { !fieldError?.message && (\n <span className=\"error\">{ GenericErrorMessages.unknown() }</span>\n ) }\n\n <ErrorMessage\n errors={ errors }\n name={ name }\n render={ ({ message }) => <span className=\"error\">{ message }</span> }\n />\n </span>\n </span>\n );\n};\n\nexport default ValidationMessages;\n"],"mappings":"AAAA;;AAEA,YAAY;;AAEZ,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAISC,cAAc,QAChB,iBAAiB;AAIxB,SAASC,iBAAiB,QAAQ,uCAAuC;AAGzE;AACA,OAAO,MAAMC,oBAA+D,GAAG;EAC7EC,QAAQ,EAAEA,CAAA,KAAM,+CAA+C;EAC/DC,SAAS,EAAGC,KAAK,IAAK,+BAAgCA,KAAK,cAAe;EAC1EC,SAAS,EAAGD,KAAK,IAAK,+BAAgCA,KAAK,cAAe;EAC1EE,GAAG,EAAGF,KAAK,IAAK,kCAAmCA,KAAK,GAAI;EAC5DG,GAAG,EAAGH,KAAK,IAAK,kCAAmCA,KAAK,GAAI;EAC5DI,OAAO,EAAEA,CAAA,KAAM;AACjB,CAAC;;AAED;AACA,OAAO,MAAMC,YAAY,GAAGA,CAC1BC,MAAmB,EACnBC,SAAiB,KACsD;EACvE,IAAI,CAACD,MAAM,EAAE;IACX,OAAOE,SAAS;EAClB;EAEA,MAAMC,cAAc,GAAGF,SAAS,CAACG,KAAK,CAAC,GAAG,CAAC;EAE3C,OAAOD,cAAc,CAACE,MAAM,CAC1B,CAACC,WAAW,EAAEC,aAAa,KAAK;IAC9B,IAAI,CAACD,WAAW,EAAE;MAChB,OAAOJ,SAAS;IAClB;IAEA,OAAQI,WAAW,CAAWC,aAAa,CAAC;EAC9C,CAAC,EACDP,MACF,CAAC;AACH,CAAC;AAOD,OAAO,MAAMQ,kBAAqD,GAAGA,CACnE;EACEC,IAAI;EACJC;AACF,CAAC,KACE;EACH,MAAM;IAAEC,SAA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C,CAAS,CACjE,eAEDX,KAAA,CAAAkC,aAAA,CAACjC,YAAY;IACXY,MAAM,EAAGA,MAAQ;IACjBS,IAAI,EAAGA,IAAM;IACbe,MAAM,EAAGA,CAAC;MAAEJ;IAAQ,CAAC,kBAAKjC,KAAA,CAAAkC,aAAA;MAAMC,SAAS,EAAC;IAAO,GAAGF,OAAe;EAAG,CACvE,CACG,CACF,CAAC;AAEX,CAAC;AAED,eAAeZ,kBAAkB","ignoreList":[]}
1
+ {"version":3,"file":"ValidationMessages.js","names":["React","useFormContext","GenericErrorMessages","required","minLength","maxLength","min","max","unknown","isGenericErrorType","errorType","Object","prototype","hasOwnProperty","call","getValidationValue","validator","value","getGenericErrorMessage","validation","undefined","replace","String","extractError","errors","fieldName","pathComponents","split","reduce","accumulator","pathComponent","ValidationMessages","name","formContext","formState","fieldError","resolveMessage","message","type","types","createElement","className","id"],"sources":["../../../../../src/components/form/validation/ValidationMessages.tsx"],"sourcesContent":[" \n\n'use client';\n\nimport React from 'react';\nimport {\n FieldError,\n FieldErrors,\n FieldErrorsImpl,\n Merge,\n ValidationRule,\n useFormContext\n} from 'react-hook-form';\nimport {\n ValidationProps\n} from '../formFields/formFieldWrapper/formFieldProps';\nimport { InputCheckboxValidationProps } from '../formFields/subComponents/inputs/checkbox/inputCheckboxProps';\n\n// Type for generic error messages\nexport const GenericErrorMessages = {\n required: 'This field is required. Please enter a value.',\n minLength: 'Please provide a minimum of {value} characters.',\n maxLength: 'Please provide a maximum of {value} characters.',\n min: 'The value must be a minimum of {value}.',\n max: 'The value must be a maximum of {value}.',\n unknown: 'An unknown error has occurred.'\n};\n\ntype ValidationRules = ValidationProps | InputCheckboxValidationProps;\ntype GenericErrorType = Exclude<keyof typeof GenericErrorMessages, 'unknown'>;\ntype ValidationErrorType = NonNullable<ReturnType<typeof extractError>>['type'];\n\nconst isGenericErrorType = (errorType: ValidationErrorType): errorType is GenericErrorType =>\n typeof errorType === 'string'\n && errorType !== 'unknown'\n && Object.prototype.hasOwnProperty.call(GenericErrorMessages, errorType);\n\nconst getValidationValue = <TValue extends string | number>(\n validator: ValidationRule<TValue> | undefined\n): TValue | undefined => typeof validator === 'object' ? validator.value : validator;\n\nconst getGenericErrorMessage = (\n errorType: ValidationErrorType,\n validation?: ValidationRules\n): string | undefined => {\n if (!isGenericErrorType(errorType)) {\n return undefined;\n }\n\n if (errorType === 'required') {\n return GenericErrorMessages.required;\n }\n\n const value = getValidationValue(validation?.[errorType]);\n\n return value === undefined\n ? undefined\n : GenericErrorMessages[errorType].replace('{value}', String(value));\n};\n\n// Helper function to extract nested errors\nexport const extractError = (\n errors: FieldErrors,\n fieldName: string\n): FieldError | Merge<FieldError, FieldErrorsImpl<never>> | undefined => {\n if (!errors) {\n return undefined;\n }\n\n const pathComponents = fieldName.split('.');\n\n return pathComponents.reduce<FieldError | Merge<FieldError, FieldErrorsImpl<never>> | undefined>(\n (accumulator, pathComponent) => {\n if (!accumulator) {\n return undefined;\n }\n\n return (accumulator as never)[pathComponent];\n },\n errors as never\n );\n};\n\ninterface ValidationMessagesProps {\n name: string;\n validation?: ValidationProps | InputCheckboxValidationProps\n}\n\nexport const ValidationMessages: React.FC<ValidationMessagesProps> = (\n {\n name,\n validation\n }\n) => {\n const formContext = useFormContext();\n\n if (!formContext) {\n return null;\n }\n\n const { formState: { errors } } = formContext;\n\n const fieldError = extractError(errors, name);\n\n if (!fieldError) {\n return null;\n }\n\n // Derive a fallback message rather than mutating the error object held in formState.\n const resolveMessage = (): string | undefined => {\n if (fieldError.message) {\n return fieldError.message as string;\n }\n\n if (\n fieldError.type\n && fieldError.types\n && typeof fieldError.types[fieldError.type] === 'string'\n ) {\n return fieldError.types[fieldError.type] as string;\n }\n\n return getGenericErrorMessage(fieldError.type, validation);\n };\n\n const message = resolveMessage() || GenericErrorMessages.unknown;\n\n return (\n <span className=\"validation\" id={ `${ name }_errors` }>\n <span className=\"message\">\n <span className=\"error\">{ message }</span>\n </span>\n </span>\n );\n};\n\nexport default Validation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,aAAA;IAAMC,SAAS,EAAC;EAAO,GAAGJ,OAAe,CACrC,CACF,CAAC;AAEX,CAAC;AAED,eAAeN,kBAAkB","ignoreList":[]}
@@ -14,6 +14,7 @@ export { KitLogo } from './design/logos/ventures/kit-logo';
14
14
  export { DoshiiLogo } from './design/logos/ventures/doshii-logo';
15
15
  export { TruyuLogo } from './design/logos/ventures/truyu-logo';
16
16
  export { SidePanel } from './design/sidePanel/SidePanel';
17
+ export { Skeleton } from './design/skeleton/Skeleton';
17
18
  export { Spinner } from './design/spinner/Spinner';
18
19
  export { StatusIconButton } from './design/statusIndicators/statusIconButton/StatusIconButton';
19
20
  export { StatusLight } from './design/statusIndicators/statusLight/StatusLight';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Accordion","Chip","Pill","Badge","Dialog","HeaderBar","Icon","NotificationIcon","VentureLogo","CreditSavvyLogo","HomeInLogo","KitLogo","DoshiiLogo","TruyuLogo","SidePanel","Spinner","StatusIconButton","StatusLight","StatusLightsBar","Tabs","Tooltip","EllipsisTooltip","RevealMore","CopyText","Paginator","PageBanner","Banner","Alert","SimpleButton","Button","FormField","InputCheckbox","CheckboxInput","StyledRadioGroup","StyledRadioInput","StyledRadioLabel","HookFormWrapper","TextInput","EmailInput","FileInput","SearchInput","NumberInput","PhoneInput","UrlInput","PasswordInput","PasswordInputSignup","SelectDropdown","Combobox","Textarea","InputDate","DateInput","Card","ReportFooter","MainHeader","ThemeLoader","DevToolbar","ThemeSwitch","LoremIpsum","GlobalDashboard","Menu","PopupMenu","SearchPanelMenu","Link","TemplateForm","TemplateLoading","TemplateDashboard","TemplatePage","Select","Checkbox"],"sources":["../../../src/components/index.ts"],"sourcesContent":["'use client';\n\n// UI components\nexport { Accordion } from './design/accordion/Accordion';\nexport { Chip, Pill, Badge } from './design/chip/Chip';\nexport { Dialog } from './design/dialog/Dialog';\nexport { HeaderBar } from './design/headerBar/HeaderBar';\nexport { Icon } from './design/icons/basicIcon/Icon';\nexport { NotificationIcon } from './design/icons/notificationIcon/NotificationIcon';\nexport { VentureLogo } from './design/logos/VentureLogo';\n\nexport { CreditSavvyLogo } from './design/logos/ventures/credit-savvy-logo';\nexport { HomeInLogo } from './design/logos/ventures/home-in-logo';\nexport { KitLogo } from './design/logos/ventures/kit-logo';\nexport { DoshiiLogo } from './design/logos/ventures/doshii-logo';\nexport { TruyuLogo } from './design/logos/ventures/truyu-logo';\n\nexport { SidePanel } from './design/sidePanel/SidePanel';\nexport { Spinner } from './design/spinner/Spinner';\nexport { StatusIconButton } from './design/statusIndicators/statusIconButton/StatusIconButton';\nexport { StatusLight } from './design/statusIndicators/statusLight/StatusLight';\nexport { StatusLightsBar } from './design/statusIndicators/statusLightsBar/StatusLightsBar';\nexport { Tabs } from './design/tabs/Tabs';\nexport { Tooltip } from './design/tooltip/Tooltip';\nexport { EllipsisTooltip } from './design/tooltip/ellipsisTooltip/EllipsisTooltip';\nexport { RevealMore } from './design/revealMore/RevealMore';\nexport { CopyText } from './design/copyText/CopyText';\nexport { Paginator } from './design/paginators/Paginator';\nexport { PageBanner, Banner, Alert } from './design/banners/pageBanner/PageBanner';\nexport type { PageBannerProps } from './design/banners/pageBanner/PageBanner';\n\n// Form components\nexport { SimpleButton, Button } from './form/buttons/SimpleButton';\nexport { FormField } from './form/formFields/formFieldWrapper/FormField';\nexport { InputCheckbox, CheckboxInput } from './form/formFields/subComponents/inputs/checkbox/InputCheckbox';\nexport { StyledRadioGroup } from './form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup';\nexport { StyledRadioInput } from './form/formFields/subComponents/inputs/radio/styled/StyledRadioInput';\nexport { StyledRadioLabel } from './form/formFields/subComponents/inputs/radio/styled/StyledRadioLabel';\nexport { HookFormWrapper } from './form/hookFormWrapper/HookFormWrapper';\n\nexport {\n TextInput,\n EmailInput,\n FileInput,\n SearchInput,\n NumberInput,\n PhoneInput,\n UrlInput,\n PasswordInput,\n PasswordInputSignup,\n SelectDropdown,\n Combobox,\n Textarea\n} from './form/formFields/subComponents/InputVariants';\nexport type {\n FormComponentProps,\n DropdownSelectProps,\n PasswordInputProps\n} from './form/formFields/subComponents/InputVariants';\n\nexport {\n InputDate\n} from './form/formFields/subComponents/inputs/date/InputDate';\nexport { DateInput } from './form/formFields/subComponents/inputs/date/DateInput';\nexport type { StyledRadioGroupProps } from './form/formFields/subComponents/inputs/radio/radioInputsProps';\n\n// Layout\nexport { Card } from './design/card/Card';\nexport { ReportFooter } from './layout/footers/reports/ReportFooter';\nexport { MainHeader } from './layout/mainHeader/MainHeader';\n\nexport { ThemeLoader } from './design/themeLoader/ThemeLoader';\nexport type { ThemeStructure } from './design/themeLoader/ThemeLoader';\n\n// Testing\nexport { DevToolbar } from './testing/devToolbar/DevToolbar';\nexport { ThemeSwitch } from './testing/themeSwitch/ThemeSwitch';\nexport { LoremIpsum } from './testing/loremIpsum/LoremIpsum';\n\nexport { GlobalDashboard } from './layout/dashboard/layouts/globalDashboard/GlobalDashboard';\nexport { Menu } from './navigation/menu/Menu';\nexport { PopupMenu } from './navigation/popupMenu/PopupMenu';\nexport { SearchPanelMenu } from './navigation/searchPanelMenu/SearchPanelMenu';\nexport { Link } from './navigation/link/Link';\n\nexport type { MenuItemPropTypes, MenuButtonPropTypes, MenuItemIconStates } from './navigation/menu/Menu.interfaces';\n\n// Templates\nexport { TemplateForm } from './templates/templateForm/TemplateForm';\nexport type { TemplateFormProps } from './templates/templateForm/TemplateForm';\nexport { TemplateLoading } from './templates/templateLoading/TemplateLoading';\nexport type { TemplateLoadingProps } from './templates/templateLoading/TemplateLoading';\nexport { TemplateDashboard } from './templates/templateDashboard/TemplateDashboard';\nexport type { TemplateDashboardProps } from './templates/templateDashboard/TemplateDashboard';\nexport { TemplatePage } from './templates/templatePage/TemplatePage';\nexport type { TemplatePageProps } from './templates/templatePage/TemplatePage';\n\n// Aliases to match common libraries\nexport { SelectDropdown as Select } from './form/formFields/subComponents/InputVariants';\nexport { InputCheckbox as Checkbox } from './form/formFields/subComponents/inputs/check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SAAS,EACTC,WAAW,EACXC,WAAW,EACXC,UAAU,EACVC,QAAQ,EACRC,aAAa,EACbC,mBAAmB,EACnBC,cAAc,EACdC,QAAQ,EACRC,QAAQ,QACH,+CAA+C;AAOtD,SACEC,SAAS,QACJ,uDAAuD;AAC9D,SAASC,SAAS,QAAQ,uDAAuD;AAGjF;AACA,SAASC,IAAI,QAAQ,oBAAoB;AACzC,SAASC,YAAY,QAAQ,uCAAuC;AACpE,SAASC,UAAU,QAAQ,gCAAgC;AAE3D,SAASC,WAAW,QAAQ,kCAAkC;AAG9D;AACA,SAASC,UAAU,QAAQ,iCAAiC;AAC5D,SAASC,WAAW,QAAQ,mCAAmC;AAC/D,SAASC,UAAU,QAAQ,iCAAiC;AAE5D,SAASC,eAAe,QAAQ,4DAA4D;AAC5F,SAASC,IAAI,QAAQ,wBAAwB;AAC7C,SAASC,SAAS,QAAQ,kCAAkC;AAC5D,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SAASC,IAAI,QAAQ,wBAAwB;AAI7C;AACA,SAASC,YAAY,QAAQ,uCAAuC;AAEpE,SAASC,eAAe,QAAQ,6CAA6C;AAE7E,SAASC,iBAAiB,QAAQ,iDAAiD;AAEnF,SAASC,YAAY,QAAQ,uCAAuC;AAGpE;AACA,SAASpB,cAAc,IAAIqB,MAAM,QAAQ,+CAA+C;AACxF,SAASpC,aAAa,IAAIqC,QAAQ,QAAQ,+DAA+D","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["Accordion","Chip","Pill","Badge","Dialog","HeaderBar","Icon","NotificationIcon","VentureLogo","CreditSavvyLogo","HomeInLogo","KitLogo","DoshiiLogo","TruyuLogo","SidePanel","Skeleton","Spinner","StatusIconButton","StatusLight","StatusLightsBar","Tabs","Tooltip","EllipsisTooltip","RevealMore","CopyText","Paginator","PageBanner","Banner","Alert","SimpleButton","Button","FormField","InputCheckbox","CheckboxInput","StyledRadioGroup","StyledRadioInput","StyledRadioLabel","HookFormWrapper","TextInput","EmailInput","FileInput","SearchInput","NumberInput","PhoneInput","UrlInput","PasswordInput","PasswordInputSignup","SelectDropdown","Combobox","Textarea","InputDate","DateInput","Card","ReportFooter","MainHeader","ThemeLoader","DevToolbar","ThemeSwitch","LoremIpsum","GlobalDashboard","Menu","PopupMenu","SearchPanelMenu","Link","TemplateForm","TemplateLoading","TemplateDashboard","TemplatePage","Select","Checkbox"],"sources":["../../../src/components/index.ts"],"sourcesContent":["'use client';\n\n// UI components\nexport { Accordion } from './design/accordion/Accordion';\nexport { Chip, Pill, Badge } from './design/chip/Chip';\nexport { Dialog } from './design/dialog/Dialog';\nexport { HeaderBar } from './design/headerBar/HeaderBar';\nexport { Icon } from './design/icons/basicIcon/Icon';\nexport { NotificationIcon } from './design/icons/notificationIcon/NotificationIcon';\nexport { VentureLogo } from './design/logos/VentureLogo';\n\nexport { CreditSavvyLogo } from './design/logos/ventures/credit-savvy-logo';\nexport { HomeInLogo } from './design/logos/ventures/home-in-logo';\nexport { KitLogo } from './design/logos/ventures/kit-logo';\nexport { DoshiiLogo } from './design/logos/ventures/doshii-logo';\nexport { TruyuLogo } from './design/logos/ventures/truyu-logo';\n\nexport { SidePanel } from './design/sidePanel/SidePanel';\nexport { Skeleton } from './design/skeleton/Skeleton';\nexport type { SkeletonProps } from './design/skeleton/Skeleton';\nexport { Spinner } from './design/spinner/Spinner';\nexport { StatusIconButton } from './design/statusIndicators/statusIconButton/StatusIconButton';\nexport { StatusLight } from './design/statusIndicators/statusLight/StatusLight';\nexport { StatusLightsBar } from './design/statusIndicators/statusLightsBar/StatusLightsBar';\nexport { Tabs } from './design/tabs/Tabs';\nexport { Tooltip } from './design/tooltip/Tooltip';\nexport { EllipsisTooltip } from './design/tooltip/ellipsisTooltip/EllipsisTooltip';\nexport { RevealMore } from './design/revealMore/RevealMore';\nexport { CopyText } from './design/copyText/CopyText';\nexport { Paginator } from './design/paginators/Paginator';\nexport { PageBanner, Banner, Alert } from './design/banners/pageBanner/PageBanner';\nexport type { PageBannerProps } from './design/banners/pageBanner/PageBanner';\n\n// Form components\nexport { SimpleButton, Button } from './form/buttons/SimpleButton';\nexport { FormField } from './form/formFields/formFieldWrapper/FormField';\nexport { InputCheckbox, CheckboxInput } from './form/formFields/subComponents/inputs/checkbox/InputCheckbox';\nexport { StyledRadioGroup } from './form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup';\nexport { StyledRadioInput } from './form/formFields/subComponents/inputs/radio/styled/StyledRadioInput';\nexport { StyledRadioLabel } from './form/formFields/subComponents/inputs/radio/styled/StyledRadioLabel';\nexport { HookFormWrapper } from './form/hookFormWrapper/HookFormWrapper';\n\nexport {\n TextInput,\n EmailInput,\n FileInput,\n SearchInput,\n NumberInput,\n PhoneInput,\n UrlInput,\n PasswordInput,\n PasswordInputSignup,\n SelectDropdown,\n Combobox,\n Textarea\n} from './form/formFields/subComponents/InputVariants';\nexport type {\n FormComponentProps,\n DropdownSelectProps,\n PasswordInputProps\n} from './form/formFields/subComponents/InputVariants';\n\nexport {\n InputDate\n} from './form/formFields/subComponents/inputs/date/InputDate';\nexport { DateInput } from './form/formFields/subComponents/inputs/date/DateInput';\nexport type { StyledRadioGroupProps } from './form/formFields/subComponents/inputs/radio/radioInputsProps';\n\n// Layout\nexport { Card } from './design/card/Card';\nexport { ReportFooter } from './layout/footers/reports/ReportFooter';\nexport { MainHeader } from './layout/mainHeader/MainHeader';\n\nexport { ThemeLoader } from './design/themeLoader/ThemeLoader';\nexport type { ThemeStructure } from './design/themeLoader/ThemeLoader';\n\n// Testing\nexport { DevToolbar } from './testing/devToolbar/DevToolbar';\nexport { ThemeSwitch } from './testing/themeSwitch/ThemeSwitch';\nexport { LoremIpsum } from './testing/loremIpsum/LoremIpsum';\n\nexport { GlobalDashboard } from './layout/dashboard/layouts/globalDashboard/GlobalDashboard';\nexport { Menu } from './navigation/menu/Menu';\nexport { PopupMenu } from './navigation/popupMenu/PopupMenu';\nexport { SearchPanelMenu } from './navigation/searchPanelMenu/SearchPanelMenu';\nexport { Link } from './navigation/link/Link';\n\nexport type { MenuItemPropTypes, MenuButtonPropTypes, MenuItemIconStates } from './navigation/menu/Menu.interfaces';\n\n// Templates\nexport { TemplateForm } from './templates/templateForm/TemplateForm';\nexport type { TemplateFormProps } from './templates/templateForm/TemplateForm';\nexport { TemplateLoading } from './templates/templateLoading/TemplateLoading';\nexport type { TemplateLoadingProps } from './templates/templateLoading/TemplateLoading';\nexport { TemplateDashboard } from './templates/templateDashboard/TemplateDashboard';\nexport type { TemplateDashboardProps } from './templates/templateDashboard/TemplateDashboard';\nexport { TemplatePage } from './templates/templatePage/TemplatePage';\nexport type { TemplatePageProps } from './templates/templatePage/TemplatePage';\n\n// Aliases to match common libraries\nexport { SelectDropdown as Select } from './form/formFields/subComponents/InputVariants';\nexport { InputCheckbox as Checkbox } from './form/formFields/subComponents/inputs/checkbox/InputCheckbox';"],"mappings":"AAAA,YAAY;;AAEZ;AACA,SAASA,SAAS,QAAQ,8BAA8B;AACxD,SAASC,IAAI,EAAEC,IAAI,EAAEC,KAAK,QAAQ,oBAAoB;AACtD,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,SAAS,QAAQ,8BAA8B;AACxD,SAASC,IAAI,QAAQ,+BAA+B;AACpD,SAASC,gBAAgB,QAAQ,kDAAkD;AACnF,SAASC,WAAW,QAAQ,4BAA4B;AAExD,SAASC,eAAe,QAAQ,2CAA2C;AAC3E,SAASC,UAAU,QAAQ,sCAAsC;AACjE,SAASC,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,UAAU,QAAQ,qCAAqC;AAChE,SAASC,SAAS,QAAQ,oCAAoC;AAE9D,SAASC,SAAS,QAAQ,8BAA8B;AACxD,SAASC,QAAQ,QAAQ,4BAA4B;AAErD,SAASC,OAAO,QAAQ,0BAA0B;AAClD,SAASC,gBAAgB,QAAQ,6DAA6D;AAC9F,SAASC,WAAW,QAAQ,mDAAmD;AAC/E,SAASC,eAAe,QAAQ,2DAA2D;AAC3F,SAASC,IAAI,QAAQ,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C,eAAe,QAAQ,6CAA6C;AAE7E,SAASC,iBAAiB,QAAQ,iDAAiD;AAEnF,SAASC,YAAY,QAAQ,uCAAuC;AAGpE;AACA,SAASpB,cAAc,IAAIqB,MAAM,QAAQ,+CAA+C;AACxF,SAASpC,aAAa,IAAIqC,QAAQ,QAAQ,+DAA+D","ignoreList":[]}
@@ -68,8 +68,7 @@ export const DemoContactForm = ({
68
68
  }), /*#__PURE__*/React.createElement(Textarea, {
69
69
  field: {
70
70
  id: 'yourMessage',
71
- name: 'yourMessage',
72
- type: 'textarea'
71
+ name: 'yourMessage'
73
72
  },
74
73
  label: {
75
74
  text: 'Your message'
@@ -1 +1 @@
1
- {"version":3,"file":"DemoContactForm.js","names":["React","useEffect","useFormContext","TextInput","EmailInput","PhoneInput","SimpleButton","Textarea","InputCheckbox","Tooltip","DemoContactForm","onConsentClick","consentIsGiven","hasConsent","setHasConsent","useState","formContext","handleConsentClick","event","isChecked","target","checked","setValue","createElement","className","field","id","name","label","text","validation","required","type","defaultChecked","value","onChange","icon","buttonType","buttonStyle","color","rightIcon"],"sources":["../../../../src/exampleUIs/exampleComponents/DemoContactForm.tsx"],"sourcesContent":["import React, { FC, useEffect } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport {\n TextInput,\n EmailInput,\n PhoneInput\n} from '../../components/form/formFields/subComponents/InputVariants';\nimport { SimpleButton } from '../../components/form/buttons/SimpleButton';\nimport { Textarea } from '../../components/form/formFields/subComponents/textarea/Textarea';\nimport { InputCheckbox } from '../../components/form/formFields/subComponents/inputs/checkbox/InputCheckbox';\nimport { Tooltip } from '../../components/design/tooltip/Tooltip';\nimport { GenericFunction } from '../../interfaces/generic.interface';\n\nexport const DemoContactForm: FC<{\n onConsentClick: GenericFunction;\n consentIsGiven: boolean;\n}> = (\n {\n onConsentClick = () => {},\n consentIsGiven = false\n }\n) => {\n const [hasConsent, setHasConsent] = React.useState<boolean>(consentIsGiven);\n\n const formContext = useFormContext();\n\n const handleConsentClick = (event: React.ChangeEvent<HTMLInputElement>) => {\n const isChecked = event.target.checked;\n formContext.setValue('consentCheckbox1', isChecked);\n setHasConsent(isChecked);\n onConsentClick(isChecked);\n };\n\n useEffect(() => {\n formContext.setValue('consentCheckbox1', consentIsGiven);\n setHasConsent(consentIsGiven);\n });\n\n return (\n <div>\n <h2 className=\"spaceAfter\">Can't find what you're looking for?</h2>\n <h3 className=\"spaceAfter\">Send us a message</h3>\n\n <p className=\"spaceAfter\">To provide you with the best service possible we'll need some details about you.</p>\n\n <TextInput\n field={ {\n id: 'firstName',\n name: 'firstName'\n } }\n label={ {\n text: 'First Name'\n } }\n validation={ {\n required: 'This is required'\n } }\n />\n\n <TextInput\n field={ {\n id: 'lastName',\n name: 'lastName'\n } }\n label={ {\n text: 'Last Name'\n } }\n validation={ {\n required: 'This is required'\n } }\n />\n\n <EmailInput\n field={ {\n id: 'yourEmail',\n name: 'yourEmail'\n } }\n label={ {\n text: 'Your email address'\n } }\n />\n\n <PhoneInput\n field={ {\n id: 'yourPhone',\n name: 'yourPhone'\n } }\n label={ {\n text: 'A number we can reach you on'\n } }\n />\n\n <Textarea\n field={ {\n id: 'yourMessage',\n name: 'yourMessage',\n type: 'textarea'\n } }\n label={ {\n text: 'Your message'\n } }\n />\n\n <InputCheckbox\n field={ {\n defaultChecked: hasConsent,\n id: 'consentCheckbox1',\n name: 'consentCheckbox1',\n value: 'consentIsGiven',\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => handleConsentClick(event)\n } }\n label={ {\n text: <span>By leaving this checked you are <strong>consenting</strong> to one of our support staff contacting you in the event that they need more information. <Tooltip icon=\"info\">More about why we might contact you.</Tooltip></span>\n } }\n />\n\n <div className=\"spaceBefore flexRow\">\n <SimpleButton\n label=\"Send Message\"\n id=\"demoSubmitButton1\"\n buttonType=\"submit\"\n buttonStyle={\n {\n color: 'primary'\n }\n }\n rightIcon={ {\n icon: 'telegram'\n } }\n />\n </div>\n </div>\n );\n};\n\nexport default DemoContactForm;"],"mappings":"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C,eAAAvB,KAAA,CAAAuB,aAAA,iBAAQ,YAAkB,CAAC,8FAA0F,eAAAvB,KAAA,CAAAuB,aAAA,CAACd,OAAO;QAAC2B,IAAI,EAAC;MAAM,GAAC,sCAA6C,CAAO;IAC5O;EAAG,CACJ,CAAC,eAEFpC,KAAA,CAAAuB,aAAA;IAAKC,SAAS,EAAC;EAAqB,gBAClCxB,KAAA,CAAAuB,aAAA,CAACjB,YAAY;IACXsB,KAAK,EAAC,cAAc;IACpBF,EAAE,EAAC,mBAAmB;IACtBW,UAAU,EAAC,QAAQ;IACnBC,WAAW,EACT;MACEC,KAAK,EAAE;IACT,CACD;IACDC,SAAS,EAAG;MACVJ,IAAI,EAAE;IACR;EAAG,CACJ,CACE,CACF,CAAC;AAEV,CAAC;AAED,eAAe1B,eAAe","ignoreList":[]}
1
+ {"version":3,"file":"DemoContactForm.js","names":["React","useEffect","useFormContext","TextInput","EmailInput","PhoneInput","SimpleButton","Textarea","InputCheckbox","Tooltip","DemoContactForm","onConsentClick","consentIsGiven","hasConsent","setHasConsent","useState","formContext","handleConsentClick","event","isChecked","target","checked","setValue","createElement","className","field","id","name","label","text","validation","required","defaultChecked","value","onChange","icon","buttonType","buttonStyle","color","rightIcon"],"sources":["../../../../src/exampleUIs/exampleComponents/DemoContactForm.tsx"],"sourcesContent":["import React, { FC, useEffect } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport {\n TextInput,\n EmailInput,\n PhoneInput\n} from '../../components/form/formFields/subComponents/InputVariants';\nimport { SimpleButton } from '../../components/form/buttons/SimpleButton';\nimport { Textarea } from '../../components/form/formFields/subComponents/textarea/Textarea';\nimport { InputCheckbox } from '../../components/form/formFields/subComponents/inputs/checkbox/InputCheckbox';\nimport { Tooltip } from '../../components/design/tooltip/Tooltip';\nimport { GenericFunction } from '../../interfaces/generic.interface';\n\nexport const DemoContactForm: FC<{\n onConsentClick: GenericFunction;\n consentIsGiven: boolean;\n}> = (\n {\n onConsentClick = () => {},\n consentIsGiven = false\n }\n) => {\n const [hasConsent, setHasConsent] = React.useState<boolean>(consentIsGiven);\n\n const formContext = useFormContext();\n\n const handleConsentClick = (event: React.ChangeEvent<HTMLInputElement>) => {\n const isChecked = event.target.checked;\n formContext.setValue('consentCheckbox1', isChecked);\n setHasConsent(isChecked);\n onConsentClick(isChecked);\n };\n\n useEffect(() => {\n formContext.setValue('consentCheckbox1', consentIsGiven);\n setHasConsent(consentIsGiven);\n });\n\n return (\n <div>\n <h2 className=\"spaceAfter\">Can't find what you're looking for?</h2>\n <h3 className=\"spaceAfter\">Send us a message</h3>\n\n <p className=\"spaceAfter\">To provide you with the best service possible we'll need some details about you.</p>\n\n <TextInput\n field={ {\n id: 'firstName',\n name: 'firstName'\n } }\n label={ {\n text: 'First Name'\n } }\n validation={ {\n required: 'This is required'\n } }\n />\n\n <TextInput\n field={ {\n id: 'lastName',\n name: 'lastName'\n } }\n label={ {\n text: 'Last Name'\n } }\n validation={ {\n required: 'This is required'\n } }\n />\n\n <EmailInput\n field={ {\n id: 'yourEmail',\n name: 'yourEmail'\n } }\n label={ {\n text: 'Your email address'\n } }\n />\n\n <PhoneInput\n field={ {\n id: 'yourPhone',\n name: 'yourPhone'\n } }\n label={ {\n text: 'A number we can reach you on'\n } }\n />\n\n <Textarea\n field={ {\n id: 'yourMessage',\n name: 'yourMessage',\n } }\n label={ {\n text: 'Your message'\n } }\n />\n\n <InputCheckbox\n field={ {\n defaultChecked: hasConsent,\n id: 'consentCheckbox1',\n name: 'consentCheckbox1',\n value: 'consentIsGiven',\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => handleConsentClick(event)\n } }\n label={ {\n text: <span>By leaving this checked you are <strong>consenting</strong> to one of our support staff contacting you in the event that they need more information. <Tooltip icon=\"info\">More about why we might contact you.</Tooltip></span>\n } }\n />\n\n <div className=\"spaceBefore flexRow\">\n <SimpleButton\n label=\"Send Message\"\n id=\"demoSubmitButton1\"\n buttonType=\"submit\"\n buttonStyle={\n {\n color: 'primary'\n }\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G;MACNC,IAAI,eAAE7B,KAAA,CAAAuB,aAAA,eAAM,kCAAgC,eAAAvB,KAAA,CAAAuB,aAAA,iBAAQ,YAAkB,CAAC,8FAA0F,eAAAvB,KAAA,CAAAuB,aAAA,CAACd,OAAO;QAAC0B,IAAI,EAAC;MAAM,GAAC,sCAA6C,CAAO;IAC5O;EAAG,CACJ,CAAC,eAEFnC,KAAA,CAAAuB,aAAA;IAAKC,SAAS,EAAC;EAAqB,gBAClCxB,KAAA,CAAAuB,aAAA,CAACjB,YAAY;IACXsB,KAAK,EAAC,cAAc;IACpBF,EAAE,EAAC,mBAAmB;IACtBU,UAAU,EAAC,QAAQ;IACnBC,WAAW,EACT;MACEC,KAAK,EAAE;IACT,CACD;IACDC,SAAS,EAAG;MACVJ,IAAI,EAAE;IACR;EAAG,CACJ,CACE,CACF,CAAC;AAEV,CAAC;AAED,eAAezB,eAAe","ignoreList":[]}
@@ -4,6 +4,6 @@ export { transformPlacesData, extractNamePieces } from './dataHelpers';
4
4
  export { dateToShortIsoString, isValidDate, dateToShortReadableDate, dateToShortReadableMonth, timeStampToShortReadableDate, dateToReadableTime, dateToShortReadableDateTime, getLastDateOfMonth, daysSince } from './dateHelpers';
5
5
  export { USER_CURRENCY, intlCurrencyFormatter, intlNumberFormatter, formatNumberForLocale, formatAsCurrencyForLocale, getNumberAbbreviation, formatRoundedNumberWithAbbreviation, formatNumberWithAbbreviation, formatNumberForChartAxis, formatAsSimpleCurrencyForChartAxis, formatAsInternationalCurrencyForChartAxis, formatAsCurrencyWithAbbreviation, formatFileSize } from './formatters';
6
6
  export { getRandomNumberBelow, getRandomBetweenInclusive, getRandomBetweenExclusive, hashCode, roundToDecimal, formatNumberToMinDigits, formatDigitalTime } from './numberHelpers';
7
- export { richTextParser, capitalize, capitalizeFirstLetter, lowerCaseFirstLetter, useAnInsteadOfA, splitCamelCase, pluralize, pluralizeIfNeeded, getInitialsOrAcronym } from './stringHelpers';
7
+ export { richTextParser, capitalize, capitalizeFirstLetter, lowerCaseFirstLetter, getCharacterCount, clampToGraphemeMax, useAnInsteadOfA, splitCamelCase, pluralize, pluralizeIfNeeded, getInitialsOrAcronym } from './stringHelpers';
8
8
  export { objectsAreTheSame, isAnObject, createCompareValueOverride, deepMergeObjects, overrideMergeObjects, makeInheritanceObject, updateNestedProperty, filterObject, getArrayOfObjectKeys, getArrayOfReadableObjectKeys, getBranchFromPath, deepRemoveProps } from './objectHelpers';
9
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["getMinAge","getMaxAge","getMinAndMaxAges","validateBirthdate","isDateEntryComplete","getAgeInWeeks","getAgeInYears","binaryFindInArray","addAndSortArray","moveItemInArrayMutate","moveItemInArrayCopy","getRandomItemFromArray","getItemIndexWithinArray","getRoundedMedian","getMostOccurringBoolean","cssClassesArrayToString","transformPlacesData","extractNamePieces","dateToShortIsoString","isValidDate","dateToShortReadableDate","dateToShortReadableMonth","timeStampToShortReadableDate","dateToReadableTime","dateToShortReadableDateTime","getLastDateOfMonth","daysSince","USER_CURRENCY","intlCurrencyFormatter","intlNumberFormatter","formatNumberForLocale","formatAsCurrencyForLocale","getNumberAbbreviation","formatRoundedNumberWithAbbreviation","formatNumberWithAbbreviation","formatNumberForChartAxis","formatAsSimpleCurrencyForChartAxis","formatAsInternationalCurrencyForChartAxis","formatAsCurrencyWithAbbreviation","formatFileSize","getRandomNumberBelow","getRandomBetweenInclusive","getRandomBetweenExclusive","hashCode","roundToDecimal","formatNumberToMinDigits","formatDigitalTime","richTextParser","capitalize","capitalizeFirstLetter","lowerCaseFirstLetter","useAnInsteadOfA","splitCamelCase","pluralize","pluralizeIfNeeded","getInitialsOrAcronym","objectsAreTheSame","isAnObject","createCompareValueOverride","deepMergeObjects","overrideMergeObjects","makeInheritanceObject","updateNestedProperty","filterObject","getArrayOfObjectKeys","getArrayOfReadableObjectKeys","getBranchFromPath","deepRemoveProps"],"sources":["../../../src/helpers/index.ts"],"sourcesContent":["export {\n getMinAge,\n getMaxAge,\n getMinAndMaxAges,\n validateBirthdate,\n isDateEntryComplete,\n getAgeInWeeks,\n getAgeInYears\n} from './ageHelpers';\n\nexport {\n binaryFindInArray,\n addAndSortArray,\n moveItemInArrayMutate,\n moveItemInArrayCopy,\n getRandomItemFromArray,\n getItemIndexWithinArray,\n getRoundedMedian,\n getMostOccurringBoolean,\n cssClassesArrayToString\n} from './arrayHelpers';\n\nexport {\n transformPlacesData,\n extractNamePieces\n} from './dataHelpers';\nexport type { NamePieces } from './dataHelpers';\n\nexport {\n dateToShortIsoString,\n isValidDate,\n dateToShortReadableDate,\n dateToShortReadableMonth,\n timeStampToShortReadableDate,\n dateToReadableTime,\n dateToShortReadableDateTime,\n getLastDateOfMonth,\n daysSince\n} from './dateHelpers';\n\nexport {\n USER_CURRENCY,\n intlCurrencyFormatter,\n intlNumberFormatter,\n formatNumberForLocale,\n formatAsCurrencyForLocale,\n getNumberAbbreviation,\n formatRoundedNumberWithAbbreviation,\n formatNumberWithAbbreviation,\n formatNumberForChartAxis,\n formatAsSimpleCurrencyForChartAxis,\n formatAsInternationalCurrencyForChartAxis,\n formatAsCurrencyWithAbbreviation,\n formatFileSize\n} from './formatters';\n\nexport {\n getRandomNumberBelow,\n getRandomBetweenInclusive,\n getRandomBetweenExclusive,\n hashCode,\n roundToDecimal,\n formatNumberToMinDigits,\n formatDigitalTime\n} from './numberHelpers';\n\nexport {\n richTextParser,\n capitalize,\n capitalizeFirstLetter,\n lowerCaseFirstLetter,\n useAnInsteadOfA,\n splitCamelCase,\n pluralize,\n pluralizeIfNeeded,\n getInitialsOrAcronym\n} from './stringHelpers';\n\nexport {\n objectsAreTheSame,\n isAnObject,\n createCompareValueOverride,\n deepMergeObjects,\n overrideMergeObjects,\n makeInheritanceObject,\n updateNestedProperty,\n filterObject,\n getArrayOfObjectKeys,\n getArrayOfReadableObjectKeys,\n getBranchFromPath,\n deepRemoveProps\n} from './objectHelpers';\n"],"mappings":"AAAA,SACEA,SAAS,EACTC,SAAS,EACTC,gBAAgB,EAChBC,iBAAiB,EACjBC,mBAAmB,EACnBC,aAAa,EACbC,aAAa,QACR,cAAc;AAErB,SACEC,iBAAiB,EACjBC,eAAe,EACfC,qBAAqB,EACrBC,mBAAmB,EACnBC,sBAAsB,EACtBC,uBAAuB,EACvBC,gBAAgB,EAChBC,uBAAuB,EACvBC,uBAAuB,QAClB,gBAAgB;AAEvB,SACEC,mBAAmB,EACnBC,iBAAiB,QACZ,eAAe;AAGtB,SACEC,oBAAoB,EACpBC,WAAW,EACXC,uBAAuB,EACvBC,wBAAwB,EACxBC,4BAA4B,EAC5BC,kBAAkB,EAClBC,2BAA2B,EAC3BC,kBAAkB,EAClBC,SAAS,QACJ,eAAe;AAEtB,SACEC,aAAa,EACbC,qBAAqB,EACrBC,mBAAmB,EACnBC,qBAAqB,EACrBC,yBAAyB,EACzBC,qBAAqB,EACrBC,mCAAmC,EACnCC,4BAA4B,EAC5BC,wBAAwB,EACxBC,kCAAkC,EAClCC,yCAAyC,EACzCC,gCAAgC,EAChCC,cAAc,QACT,cAAc;AAErB,SACEC,oBAAoB,EACpBC,yBAAyB,EACzBC,yBAAyB,EACzBC,QAAQ,EACRC,cAAc,EACdC,uBAAuB,EACvBC,iBAAiB,QACZ,iBAAiB;AAExB,SACEC,cAAc,EACdC,UAAU,EACVC,qBAAqB,EACrBC,oBAAoB,EACpBC,eAAe,EACfC,cAAc,EACdC,SAAS,EACTC,iBAAiB,EACjBC,oBAAoB,QACf,iBAAiB;AAExB,SACEC,iBAAiB,EACjBC,UAAU,EACVC,0BAA0B,EAC1BC,gBAAgB,EAChBC,oBAAoB,EACpBC,qBAAqB,EACrBC,oBAAoB,EACpBC,YAAY,EACZC,oBAAoB,EACpBC,4BAA4B,EAC5BC,iBAAiB,EACjBC,eAAe,QACV,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["getMinAge","getMaxAge","getMinAndMaxAges","validateBirthdate","isDateEntryComplete","getAgeInWeeks","getAgeInYears","binaryFindInArray","addAndSortArray","moveItemInArrayMutate","moveItemInArrayCopy","getRandomItemFromArray","getItemIndexWithinArray","getRoundedMedian","getMostOccurringBoolean","cssClassesArrayToString","transformPlacesData","extractNamePieces","dateToShortIsoString","isValidDate","dateToShortReadableDate","dateToShortReadableMonth","timeStampToShortReadableDate","dateToReadableTime","dateToShortReadableDateTime","getLastDateOfMonth","daysSince","USER_CURRENCY","intlCurrencyFormatter","intlNumberFormatter","formatNumberForLocale","formatAsCurrencyForLocale","getNumberAbbreviation","formatRoundedNumberWithAbbreviation","formatNumberWithAbbreviation","formatNumberForChartAxis","formatAsSimpleCurrencyForChartAxis","formatAsInternationalCurrencyForChartAxis","formatAsCurrencyWithAbbreviation","formatFileSize","getRandomNumberBelow","getRandomBetweenInclusive","getRandomBetweenExclusive","hashCode","roundToDecimal","formatNumberToMinDigits","formatDigitalTime","richTextParser","capitalize","capitalizeFirstLetter","lowerCaseFirstLetter","getCharacterCount","clampToGraphemeMax","useAnInsteadOfA","splitCamelCase","pluralize","pluralizeIfNeeded","getInitialsOrAcronym","objectsAreTheSame","isAnObject","createCompareValueOverride","deepMergeObjects","overrideMergeObjects","makeInheritanceObject","updateNestedProperty","filterObject","getArrayOfObjectKeys","getArrayOfReadableObjectKeys","getBranchFromPath","deepRemoveProps"],"sources":["../../../src/helpers/index.ts"],"sourcesContent":["export {\n getMinAge,\n getMaxAge,\n getMinAndMaxAges,\n validateBirthdate,\n isDateEntryComplete,\n getAgeInWeeks,\n getAgeInYears\n} from './ageHelpers';\n\nexport {\n binaryFindInArray,\n addAndSortArray,\n moveItemInArrayMutate,\n moveItemInArrayCopy,\n getRandomItemFromArray,\n getItemIndexWithinArray,\n getRoundedMedian,\n getMostOccurringBoolean,\n cssClassesArrayToString\n} from './arrayHelpers';\n\nexport {\n transformPlacesData,\n extractNamePieces\n} from './dataHelpers';\nexport type { NamePieces } from './dataHelpers';\n\nexport {\n dateToShortIsoString,\n isValidDate,\n dateToShortReadableDate,\n dateToShortReadableMonth,\n timeStampToShortReadableDate,\n dateToReadableTime,\n dateToShortReadableDateTime,\n getLastDateOfMonth,\n daysSince\n} from './dateHelpers';\n\nexport {\n USER_CURRENCY,\n intlCurrencyFormatter,\n intlNumberFormatter,\n formatNumberForLocale,\n formatAsCurrencyForLocale,\n getNumberAbbreviation,\n formatRoundedNumberWithAbbreviation,\n formatNumberWithAbbreviation,\n formatNumberForChartAxis,\n formatAsSimpleCurrencyForChartAxis,\n formatAsInternationalCurrencyForChartAxis,\n formatAsCurrencyWithAbbreviation,\n formatFileSize\n} from './formatters';\n\nexport {\n getRandomNumberBelow,\n getRandomBetweenInclusive,\n getRandomBetweenExclusive,\n hashCode,\n roundToDecimal,\n formatNumberToMinDigits,\n formatDigitalTime\n} from './numberHelpers';\n\nexport {\n richTextParser,\n capitalize,\n capitalizeFirstLetter,\n lowerCaseFirstLetter,\n getCharacterCount,\n clampToGraphemeMax,\n useAnInsteadOfA,\n splitCamelCase,\n pluralize,\n pluralizeIfNeeded,\n getInitialsOrAcronym\n} from './stringHelpers';\n\nexport {\n objectsAreTheSame,\n isAnObject,\n createCompareValueOverride,\n deepMergeObjects,\n overrideMergeObjects,\n makeInheritanceObject,\n updateNestedProperty,\n filterObject,\n getArrayOfObjectKeys,\n getArrayOfReadableObjectKeys,\n getBranchFromPath,\n deepRemoveProps\n} from './objectHelpers';\n"],"mappings":"AAAA,SACEA,SAAS,EACTC,SAAS,EACTC,gBAAgB,EAChBC,iBAAiB,EACjBC,mBAAmB,EACnBC,aAAa,EACbC,aAAa,QACR,cAAc;AAErB,SACEC,iBAAiB,EACjBC,eAAe,EACfC,qBAAqB,EACrBC,mBAAmB,EACnBC,sBAAsB,EACtBC,uBAAuB,EACvBC,gBAAgB,EAChBC,uBAAuB,EACvBC,uBAAuB,QAClB,gBAAgB;AAEvB,SACEC,mBAAmB,EACnBC,iBAAiB,QACZ,eAAe;AAGtB,SACEC,oBAAoB,EACpBC,WAAW,EACXC,uBAAuB,EACvBC,wBAAwB,EACxBC,4BAA4B,EAC5BC,kBAAkB,EAClBC,2BAA2B,EAC3BC,kBAAkB,EAClBC,SAAS,QACJ,eAAe;AAEtB,SACEC,aAAa,EACbC,qBAAqB,EACrBC,mBAAmB,EACnBC,qBAAqB,EACrBC,yBAAyB,EACzBC,qBAAqB,EACrBC,mCAAmC,EACnCC,4BAA4B,EAC5BC,wBAAwB,EACxBC,kCAAkC,EAClCC,yCAAyC,EACzCC,gCAAgC,EAChCC,cAAc,QACT,cAAc;AAErB,SACEC,oBAAoB,EACpBC,yBAAyB,EACzBC,yBAAyB,EACzBC,QAAQ,EACRC,cAAc,EACdC,uBAAuB,EACvBC,iBAAiB,QACZ,iBAAiB;AAExB,SACEC,cAAc,EACdC,UAAU,EACVC,qBAAqB,EACrBC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,EAClBC,eAAe,EACfC,cAAc,EACdC,SAAS,EACTC,iBAAiB,EACjBC,oBAAoB,QACf,iBAAiB;AAExB,SACEC,iBAAiB,EACjBC,UAAU,EACVC,0BAA0B,EAC1BC,gBAAgB,EAChBC,oBAAoB,EACpBC,qBAAqB,EACrBC,oBAAoB,EACpBC,YAAY,EACZC,oBAAoB,EACpBC,4BAA4B,EAC5BC,iBAAiB,EACjBC,eAAe,QACV,iBAAiB","ignoreList":[]}
@@ -32,6 +32,50 @@ export const capitalizeFirstLetter = pString => `${pString.substring(0, 1).toUpp
32
32
  */
33
33
  export const lowerCaseFirstLetter = pString => `${pString.substring(0, 1).toLowerCase()}${pString.substring(1)}`;
34
34
 
35
+ /**
36
+ * Splits a string into grapheme clusters so text metrics and clamping can share
37
+ * the same segmentation logic without forcing callers to pass pre-segmented data.
38
+ *
39
+ * @param {string} pString - The string to segment.
40
+ * @returns {string[]} The grapheme units in order, falling back to code points when Intl.Segmenter is unavailable.
41
+ */
42
+ const getGraphemeSegments = pString => {
43
+ if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {
44
+ const segmenter = new Intl.Segmenter(undefined, {
45
+ granularity: 'grapheme'
46
+ });
47
+ return Array.from(segmenter.segment(pString), ({
48
+ segment
49
+ }) => segment);
50
+ }
51
+ return Array.from(pString);
52
+ };
53
+
54
+ /**
55
+ * Counts user-perceived characters (grapheme clusters) so emojis and composed
56
+ * characters such as accented letters count as one.
57
+ *
58
+ * @param {string} pString - A string of text.
59
+ * @returns {number} The number of grapheme clusters, falling back to code points where Intl.Segmenter is unavailable.
60
+ */
61
+ export const getCharacterCount = pString => getGraphemeSegments(pString).length;
62
+
63
+ /**
64
+ * Truncates a string to a maximum number of grapheme clusters without splitting
65
+ * an emoji or composed character in half.
66
+ *
67
+ * @param {string} pString - A string of text.
68
+ * @param {number} maxAllowed - The maximum number of user-perceived characters to keep.
69
+ * @returns {string} The truncated string, or the unchanged pString if it is already within the limit.
70
+ */
71
+ export const clampToGraphemeMax = (pString, maxAllowed) => {
72
+ const graphemeSegments = getGraphemeSegments(pString);
73
+ if (graphemeSegments.length <= maxAllowed) {
74
+ return pString;
75
+ }
76
+ return graphemeSegments.slice(0, maxAllowed).join('');
77
+ };
78
+
35
79
  /**
36
80
  * Determines if "an" should be used instead of "a" before the given word.
37
81
  *
@@ -1 +1 @@
1
- {"version":3,"file":"stringHelpers.js","names":["parse","richTextParser","richText","supportEscapedCharacters","adjustedText","split","join","capitalize","pString","substring","toUpperCase","toLowerCase","capitalizeFirstLetter","lowerCaseFirstLetter","useAnInsteadOfA","word","lettersRequiringAn","firstLetter","includes","splitCamelCase","replace","pluralize","endsWith","slice","pluralizeIfNeeded","count","getInitialsOrAcronym","map","piece"],"sources":["../../../src/helpers/stringHelpers.ts"],"sourcesContent":["import React from 'react';\nimport parse from 'html-react-parser';\n\nexport const richTextParser = (richText: string, supportEscapedCharacters: boolean): string | React.JSX.Element | React.JSX.Element[] => {\n // Adjusts text to replace line breaks with <br/> tags\n const adjustedText = richText.split('\\r\\n').join('<br/>');\n if (supportEscapedCharacters) {\n return parse(adjustedText);\n }\n return parse(richText);\n};\n\n/**\n * Takes a string and returns it with the first character capitalized and the remaining characters as lowercase.\n *\n * @param {string} pString - A string of text.\n * @returns {string} The capitalized string or the unchanged pString if anything other than a string is sent to it.\n */\nexport const capitalize = (pString: string): string => `${ pString.substring(0, 1).toUpperCase() }${ pString.substring(1).toLowerCase() }`;\n\n/**\n * Capitalizes the first letter of the given string.\n *\n * @param {string} pString - A string of text.\n * @returns {string} The string with the first letter capitalized, or the unchanged pString if it's not a string.\n */\nexport const capitalizeFirstLetter = (pString: string): string => `${ pString.substring(0, 1).toUpperCase() }${ pString.substring(1) }`;\n\n/**\n * Converts the first letter of the given string to lowercase.\n *\n * @param {string} pString - A string of text.\n * @returns {string} The string with the first letter converted to lowercase, or the unchanged pString if it's not a string.\n */\nexport const lowerCaseFirstLetter = (pString: string): string => `${ pString.substring(0, 1).toLowerCase() }${ pString.substring(1) }`;\n\n/**\n * Determines if \"an\" should be used instead of \"a\" before the given word.\n *\n * @param {string} word - The word to check.\n * @returns {boolean} True if \"an\" should be used, false otherwise.\n */\nexport const useAnInsteadOfA = (word: string): boolean => {\n const lettersRequiringAn = ['a', 'e', 'i', 'o', 'u', 'h'];\n const firstLetter = word.substring(0, 1).toLowerCase();\n return lettersRequiringAn.includes(firstLetter);\n};\n\nexport const splitCamelCase = (pString: string): string => pString\n// Single regex to handle all cases: lowercase followed by uppercase/number, or number followed by letter\n .replace(/([a-z])([A-Z0-9])|([0-9])([a-zA-Z])/g, '$1$3 $2$4')\n// Insert a space between capital letters and lowercase letters where missing\n .replace(/([A-Z])([A-Z][a-z])/g, '$1 $2')\n// Convert the entire string to lowercase for consistency\n .toLowerCase();\n\nexport const pluralize = (pString: string): string => {\n if (pString.endsWith('y')) {\n // If the word ends with 'y', replace 'y' with 'ies'\n return `${ pString.slice(0, -1) }ies`;\n } if (pString.endsWith('s') || pString.endsWith('x') || pString.endsWith('z') || pString.endsWith('ch') || pString.endsWith('sh')) {\n // If the word ends with s, x, z, ch, or sh, add 'es'\n return `${ pString }es`;\n }\n // For other cases, just add 's'\n return `${ pString }s`;\n};\n\nexport const pluralizeIfNeeded = (pString: string, count: number): string => {\n if (count && count > 1) {\n return pluralize(pString);\n }\n return pString;\n};\n\nexport const getInitialsOrAcronym = (pString: string): string => {\n return pString.split(' ').map((piece) => capitalize(piece.substring(0, 1))).join('');\n};\n"],"mappings":"AACA,OAAOA,KAAK,MAAM,mBAAmB;AAErC,OAAO,MAAMC,cAAc,GAAGA,CAACC,QAAgB,EAAEC,wBAAiC,KAAuD;EACvI;EACA,MAAMC,YAAY,GAAGF,QAAQ,CAACG,KAAK,CAAC,MAAM,CAAC,CAACC,IAAI,CAAC,OAAO,CAAC;EACzD,IAAIH,wBAAwB,EAAE;IAC5B,OAAOH,KAAK,CAACI,YAAY,CAAC;EAC5B;EACA,OAAOJ,KAAK,CAACE,QAAQ,CAAC;AACxB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMK,UAAU,GAAIC,OAAe,IAAa,GAAIA,OAAO,CAACC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAKF,OAAO,CAACC,SAAS,CAAC,CAAC,CAAC,CAACE,WAAW,CAAC,CAAC,EAAG;;AAE1I;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,GAAIJ,OAAe,IAAa,GAAIA,OAAO,CAACC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAKF,OAAO,CAACC,SAAS,CAAC,CAAC,CAAC,EAAG;;AAEvI;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,oBAAoB,GAAIL,OAAe,IAAa,GAAIA,OAAO,CAACC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAACE,WAAW,CAAC,CAAC,GAAKH,OAAO,CAACC,SAAS,CAAC,CAAC,CAAC,EAAG;;AAEtI;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMK,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EAC/D,OAAOA,OAAO,CAACH,KAAK,CAAC,GAAG,CAAC,CAACsB,GAAG,CAAEC,KAAK,IAAKrB,UAAU,CAACqB,KAAK,CAACnB,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAACH,IAAI,CAAC,EAAE,CAAC;AACtF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"stringHelpers.js","names":["parse","richTextParser","richText","supportEscapedCharacters","adjustedText","split","join","capitalize","pString","substring","toUpperCase","toLowerCase","capitalizeFirstLetter","lowerCaseFirstLetter","getGraphemeSegments","Intl","segmenter","Segmenter","undefined","granularity","Array","from","segment","getCharacterCount","length","clampToGraphemeMax","maxAllowed","graphemeSegments","slice","useAnInsteadOfA","word","lettersRequiringAn","firstLetter","includes","splitCamelCase","replace","pluralize","endsWith","pluralizeIfNeeded","count","getInitialsOrAcronym","map","piece"],"sources":["../../../src/helpers/stringHelpers.ts"],"sourcesContent":["import React from 'react';\nimport parse from 'html-react-parser';\n\nexport const richTextParser = (richText: string, supportEscapedCharacters: boolean): string | React.JSX.Element | React.JSX.Element[] => {\n // Adjusts text to replace line breaks with <br/> tags\n const adjustedText = richText.split('\\r\\n').join('<br/>');\n if (supportEscapedCharacters) {\n return parse(adjustedText);\n }\n return parse(richText);\n};\n\n/**\n * Takes a string and returns it with the first character capitalized and the remaining characters as lowercase.\n *\n * @param {string} pString - A string of text.\n * @returns {string} The capitalized string or the unchanged pString if anything other than a string is sent to it.\n */\nexport const capitalize = (pString: string): string => `${ pString.substring(0, 1).toUpperCase() }${ pString.substring(1).toLowerCase() }`;\n\n/**\n * Capitalizes the first letter of the given string.\n *\n * @param {string} pString - A string of text.\n * @returns {string} The string with the first letter capitalized, or the unchanged pString if it's not a string.\n */\nexport const capitalizeFirstLetter = (pString: string): string => `${ pString.substring(0, 1).toUpperCase() }${ pString.substring(1) }`;\n\n/**\n * Converts the first letter of the given string to lowercase.\n *\n * @param {string} pString - A string of text.\n * @returns {string} The string with the first letter converted to lowercase, or the unchanged pString if it's not a string.\n */\nexport const lowerCaseFirstLetter = (pString: string): string => `${ pString.substring(0, 1).toLowerCase() }${ pString.substring(1) }`;\n\n/**\n * Splits a string into grapheme clusters so text metrics and clamping can share\n * the same segmentation logic without forcing callers to pass pre-segmented data.\n *\n * @param {string} pString - The string to segment.\n * @returns {string[]} The grapheme units in order, falling back to code points when Intl.Segmenter is unavailable.\n */\nconst getGraphemeSegments = (pString: string): string[] => {\n if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {\n const segmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });\n\n return Array.from(segmenter.segment(pString), ({ segment }) => segment);\n }\n\n return Array.from(pString);\n};\n\n/**\n * Counts user-perceived characters (grapheme clusters) so emojis and composed\n * characters such as accented letters count as one.\n *\n * @param {string} pString - A string of text.\n * @returns {number} The number of grapheme clusters, falling back to code points where Intl.Segmenter is unavailable.\n */\nexport const getCharacterCount = (pString: string): number => getGraphemeSegments(pString).length;\n\n/**\n * Truncates a string to a maximum number of grapheme clusters without splitting\n * an emoji or composed character in half.\n *\n * @param {string} pString - A string of text.\n * @param {number} maxAllowed - The maximum number of user-perceived characters to keep.\n * @returns {string} The truncated string, or the unchanged pString if it is already within the limit.\n */\nexport const clampToGraphemeMax = (pString: string, maxAllowed: number): string => {\n const graphemeSegments = getGraphemeSegments(pString);\n\n if (graphemeSegments.length <= maxAllowed) {\n return pString;\n }\n\n return graphemeSegments.slice(0, maxAllowed).join('');\n};\n\n/**\n * Determines if \"an\" should be used instead of \"a\" before the given word.\n *\n * @param {string} word - The word to check.\n * @returns {boolean} True if \"an\" should be used, false otherwise.\n */\nexport const useAnInsteadOfA = (word: string): boolean => {\n const lettersRequiringAn = ['a', 'e', 'i', 'o', 'u', 'h'];\n const firstLetter = word.substring(0, 1).toLowerCase();\n return lettersRequiringAn.includes(firstLetter);\n};\n\nexport const splitCamelCase = (pString: string): string => pString\n// Single regex to handle all cases: lowercase followed by uppercase/number, or number followed by letter\n .replace(/([a-z])([A-Z0-9])|([0-9])([a-zA-Z])/g, '$1$3 $2$4')\n// Insert a space between capital letters and lowercase letters where missing\n .replace(/([A-Z])([A-Z][a-z])/g, '$1 $2')\n// Convert the entire string to lowercase for consistency\n .toLowerCase();\n\nexport const pluralize = (pString: string): string => {\n if (pString.endsWith('y')) {\n // If the word ends with 'y', replace 'y' with 'ies'\n return `${ pString.slice(0, -1) }ies`;\n } if (pString.endsWith('s') || pString.endsWith('x') || pString.endsWith('z') || pString.endsWith('ch') || pString.endsWith('sh')) {\n // If the word ends with s, x, z, ch, or sh, add 'es'\n return `${ pString }es`;\n }\n // For other cases, just add 's'\n return `${ pString }s`;\n};\n\nexport const pluralizeIfNeeded = (pString: string, count: number): string => {\n if (count && count > 1) {\n return pluralize(pString);\n }\n return pString;\n};\n\nexport const getInitialsOrAcronym = (pString: string): string => {\n return pString.split(' ').map((piece) => capitalize(piece.substring(0, 1))).join('');\n};\n"],"mappings":"AACA,OAAOA,KAAK,MAAM,mBAAmB;AAErC,OAAO,MAAMC,cAAc,GAAGA,CAACC,QAAgB,EAAEC,wBAAiC,KAAuD;EACvI;EACA,MAAMC,YAAY,GAAGF,QAAQ,CAACG,KAAK,CAAC,MAAM,CAAC,CAACC,IAAI,CAAC,OAAO,CAAC;EACzD,IAAIH,wBAAwB,EAAE;IAC5B,OAAOH,KAAK,CAACI,YAAY,CAAC;EAC5B;EACA,OAAOJ,KAAK,CAACE,QAAQ,CAAC;AACxB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMK,UAAU,GAAIC,OAAe,IAAa,GAAIA,OAAO,CAACC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAKF,OAAO,CAACC,SAAS,CAAC,CAAC,CAAC,CAACE,WAAW,CAAC,CAAC,EAAG;;AAE1I;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,GAAIJ,OAAe,IAAa,GAAIA,OAAO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AAC5B,OAAO,CAAC;EAC3B;EACA,OAAOA,OAAO;AAChB,CAAC;AAED,OAAO,MAAMgC,oBAAoB,GAAIhC,OAAe,IAAa;EAC/D,OAAOA,OAAO,CAACH,KAAK,CAAC,GAAG,CAAC,CAACoC,GAAG,CAAEC,KAAK,IAAKnC,UAAU,CAACmC,KAAK,CAACjC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAACH,IAAI,CAAC,EAAE,CAAC;AACtF,CAAC","ignoreList":[]}
package/dist/esm/index.js CHANGED
@@ -2,7 +2,7 @@ import './styles/index.css';
2
2
  import './icons/style.css';
3
3
 
4
4
  // Components
5
- export { Accordion, Chip, Pill, Badge, Dialog, HeaderBar, Icon, NotificationIcon, VentureLogo, CreditSavvyLogo, HomeInLogo, KitLogo, DoshiiLogo, TruyuLogo, SidePanel, Spinner, StatusIconButton, StatusLight, StatusLightsBar, Tabs, Tooltip, EllipsisTooltip, RevealMore, CopyText, Paginator, PageBanner, Banner, Alert, SimpleButton, Button, FormField, InputCheckbox, CheckboxInput, StyledRadioGroup, StyledRadioInput, StyledRadioLabel, HookFormWrapper, TextInput, EmailInput, FileInput, SearchInput, NumberInput, PhoneInput, UrlInput, PasswordInput, PasswordInputSignup, SelectDropdown, Select, Combobox, Textarea, InputDate, DateInput, Card, ReportFooter, MainHeader, ThemeLoader, DevToolbar, ThemeSwitch, LoremIpsum, GlobalDashboard, Menu, PopupMenu, SearchPanelMenu, Link, TemplateForm, TemplateLoading, TemplateDashboard, TemplatePage } from './components';
5
+ export { Accordion, Chip, Pill, Badge, Dialog, HeaderBar, Icon, NotificationIcon, VentureLogo, CreditSavvyLogo, HomeInLogo, KitLogo, DoshiiLogo, TruyuLogo, SidePanel, Skeleton, Spinner, StatusIconButton, StatusLight, StatusLightsBar, Tabs, Tooltip, EllipsisTooltip, RevealMore, CopyText, Paginator, PageBanner, Banner, Alert, SimpleButton, Button, FormField, InputCheckbox, CheckboxInput, StyledRadioGroup, StyledRadioInput, StyledRadioLabel, HookFormWrapper, TextInput, EmailInput, FileInput, SearchInput, NumberInput, PhoneInput, UrlInput, PasswordInput, PasswordInputSignup, SelectDropdown, Select, Combobox, Textarea, InputDate, DateInput, Card, ReportFooter, MainHeader, ThemeLoader, DevToolbar, ThemeSwitch, LoremIpsum, GlobalDashboard, Menu, PopupMenu, SearchPanelMenu, Link, TemplateForm, TemplateLoading, TemplateDashboard, TemplatePage } from './components';
6
6
  // Hooks
7
7
  export { useOnClickOutside, usePopupKeys, useOnEdgeProximityDetect, useFirstCapital, useTabbableInputGroup, useDialogOverlay, useEllipsisBookends, useFocusTrap, useInertAttribute } from './hooks';
8
8