@x15ventures/x15-ui-library 3.15.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 (130) 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/form/formFields/formFieldWrapper/FormField.js +8 -5
  10. package/dist/cjs/components/form/formFields/formFieldWrapper/FormField.js.map +1 -1
  11. package/dist/cjs/components/form/formFields/formFieldWrapper/formFieldProps.js.map +1 -1
  12. package/dist/cjs/components/form/formFields/subComponents/inputs/autocomplete/Autocomplete.js +15 -11
  13. package/dist/cjs/components/form/formFields/subComponents/inputs/autocomplete/Autocomplete.js.map +1 -1
  14. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js +37 -15
  15. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js.map +1 -1
  16. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/inputCheckbox.css +4 -4
  17. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.js.map +1 -1
  18. package/dist/cjs/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js +9 -9
  19. package/dist/cjs/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js.map +1 -1
  20. package/dist/cjs/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.js +14 -4
  21. package/dist/cjs/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.js.map +1 -1
  22. package/dist/cjs/components/form/formFields/subComponents/inputs/text/InputText.js +23 -17
  23. package/dist/cjs/components/form/formFields/subComponents/inputs/text/InputText.js.map +1 -1
  24. package/dist/cjs/components/form/formFields/subComponents/select/Select.js +6 -5
  25. package/dist/cjs/components/form/formFields/subComponents/select/Select.js.map +1 -1
  26. package/dist/cjs/components/form/formFields/subComponents/textarea/Textarea.js +55 -83
  27. package/dist/cjs/components/form/formFields/subComponents/textarea/Textarea.js.map +1 -1
  28. package/dist/cjs/components/form/formFields/subComponents/textarea/textarea.css +20 -0
  29. package/dist/cjs/components/form/hookFormWrapper/HookFormWrapper.js +22 -5
  30. package/dist/cjs/components/form/hookFormWrapper/HookFormWrapper.js.map +1 -1
  31. package/dist/cjs/components/form/validation/ValidationMessages.js +36 -38
  32. package/dist/cjs/components/form/validation/ValidationMessages.js.map +1 -1
  33. package/dist/cjs/exampleUIs/exampleComponents/DemoContactForm.js +1 -2
  34. package/dist/cjs/exampleUIs/exampleComponents/DemoContactForm.js.map +1 -1
  35. package/dist/cjs/helpers/index.js +12 -0
  36. package/dist/cjs/helpers/index.js.map +1 -1
  37. package/dist/cjs/helpers/stringHelpers.js +48 -2
  38. package/dist/cjs/helpers/stringHelpers.js.map +1 -1
  39. package/dist/cjs/interfaces/headerText.interface.js.map +1 -1
  40. package/dist/cjs/package.json +137 -151
  41. package/dist/cjs/styles/index.css +22 -25
  42. package/dist/cjs/styles/shared/_allPartials.css +22 -25
  43. package/dist/cjs/styles/shared/forms/_forms.css +22 -25
  44. package/dist/components/design/dialog/Dialog.d.ts.map +1 -1
  45. package/dist/components/design/dialog/Dialog.test.d.ts +5 -0
  46. package/dist/components/design/dialog/Dialog.test.d.ts.map +1 -0
  47. package/dist/components/design/headerBar/HeaderBar.d.ts.map +1 -1
  48. package/dist/components/form/formFields/formFieldWrapper/FormField.d.ts.map +1 -1
  49. package/dist/components/form/formFields/formFieldWrapper/formFieldProps.d.ts +7 -2
  50. package/dist/components/form/formFields/formFieldWrapper/formFieldProps.d.ts.map +1 -1
  51. package/dist/components/form/formFields/subComponents/inputs/autocomplete/Autocomplete.d.ts.map +1 -1
  52. package/dist/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.d.ts.map +1 -1
  53. package/dist/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.test.d.ts +5 -0
  54. package/dist/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.test.d.ts.map +1 -0
  55. package/dist/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.d.ts +8 -6
  56. package/dist/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.d.ts.map +1 -1
  57. package/dist/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.d.ts.map +1 -1
  58. package/dist/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.d.ts.map +1 -1
  59. package/dist/components/form/formFields/subComponents/inputs/text/InputText.d.ts.map +1 -1
  60. package/dist/components/form/formFields/subComponents/nestedFormContext.test.d.ts +5 -0
  61. package/dist/components/form/formFields/subComponents/nestedFormContext.test.d.ts.map +1 -0
  62. package/dist/components/form/formFields/subComponents/select/Select.d.ts.map +1 -1
  63. package/dist/components/form/formFields/subComponents/textarea/Textarea.d.ts +4 -3
  64. package/dist/components/form/formFields/subComponents/textarea/Textarea.d.ts.map +1 -1
  65. package/dist/components/form/hookFormWrapper/HookFormWrapper.d.ts +3 -0
  66. package/dist/components/form/hookFormWrapper/HookFormWrapper.d.ts.map +1 -1
  67. package/dist/components/form/hookFormWrapper/HookFormWrapper.test.d.ts +5 -0
  68. package/dist/components/form/hookFormWrapper/HookFormWrapper.test.d.ts.map +1 -0
  69. package/dist/components/form/validation/ValidationMessages.d.ts +8 -1
  70. package/dist/components/form/validation/ValidationMessages.d.ts.map +1 -1
  71. package/dist/components/form/validation/ValidationMessages.test.d.ts +5 -0
  72. package/dist/components/form/validation/ValidationMessages.test.d.ts.map +1 -0
  73. package/dist/esm/autoGenerated/libraryThemes.js +12 -12
  74. package/dist/esm/autoGenerated/libraryThemes.js.map +1 -1
  75. package/dist/esm/autoGenerated/libraryThemes.json +12 -12
  76. package/dist/esm/components/design/dialog/Dialog.js +1 -1
  77. package/dist/esm/components/design/dialog/Dialog.js.map +1 -1
  78. package/dist/esm/components/design/headerBar/HeaderBar.js +3 -1
  79. package/dist/esm/components/design/headerBar/HeaderBar.js.map +1 -1
  80. package/dist/esm/components/design/headerBar/headerBar.css +6 -1
  81. package/dist/esm/components/form/formFields/formFieldWrapper/FormField.js +8 -5
  82. package/dist/esm/components/form/formFields/formFieldWrapper/FormField.js.map +1 -1
  83. package/dist/esm/components/form/formFields/formFieldWrapper/formFieldProps.js.map +1 -1
  84. package/dist/esm/components/form/formFields/subComponents/inputs/autocomplete/Autocomplete.js +16 -12
  85. package/dist/esm/components/form/formFields/subComponents/inputs/autocomplete/Autocomplete.js.map +1 -1
  86. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js +37 -15
  87. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js.map +1 -1
  88. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/inputCheckbox.css +4 -4
  89. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.js.map +1 -1
  90. package/dist/esm/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js +8 -8
  91. package/dist/esm/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js.map +1 -1
  92. package/dist/esm/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.js +16 -6
  93. package/dist/esm/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.js.map +1 -1
  94. package/dist/esm/components/form/formFields/subComponents/inputs/text/InputText.js +23 -17
  95. package/dist/esm/components/form/formFields/subComponents/inputs/text/InputText.js.map +1 -1
  96. package/dist/esm/components/form/formFields/subComponents/select/Select.js +6 -5
  97. package/dist/esm/components/form/formFields/subComponents/select/Select.js.map +1 -1
  98. package/dist/esm/components/form/formFields/subComponents/textarea/Textarea.js +50 -78
  99. package/dist/esm/components/form/formFields/subComponents/textarea/Textarea.js.map +1 -1
  100. package/dist/esm/components/form/formFields/subComponents/textarea/textarea.css +20 -0
  101. package/dist/esm/components/form/hookFormWrapper/HookFormWrapper.js +22 -5
  102. package/dist/esm/components/form/hookFormWrapper/HookFormWrapper.js.map +1 -1
  103. package/dist/esm/components/form/validation/ValidationMessages.js +36 -38
  104. package/dist/esm/components/form/validation/ValidationMessages.js.map +1 -1
  105. package/dist/esm/exampleUIs/exampleComponents/DemoContactForm.js +1 -2
  106. package/dist/esm/exampleUIs/exampleComponents/DemoContactForm.js.map +1 -1
  107. package/dist/esm/helpers/index.js +1 -1
  108. package/dist/esm/helpers/index.js.map +1 -1
  109. package/dist/esm/helpers/stringHelpers.js +44 -0
  110. package/dist/esm/helpers/stringHelpers.js.map +1 -1
  111. package/dist/esm/interfaces/headerText.interface.js.map +1 -1
  112. package/dist/esm/package.json +137 -151
  113. package/dist/esm/styles/index.css +22 -25
  114. package/dist/esm/styles/shared/_allPartials.css +22 -25
  115. package/dist/esm/styles/shared/forms/_forms.css +22 -25
  116. package/dist/exampleUIs/exampleComponents/DemoContactForm.d.ts.map +1 -1
  117. package/dist/helpers/index.d.ts +1 -1
  118. package/dist/helpers/index.d.ts.map +1 -1
  119. package/dist/helpers/stringHelpers.d.ts +17 -0
  120. package/dist/helpers/stringHelpers.d.ts.map +1 -1
  121. package/dist/interfaces/headerText.interface.d.ts +1 -0
  122. package/dist/interfaces/headerText.interface.d.ts.map +1 -1
  123. package/dist/package.json +137 -151
  124. package/package.json +137 -151
  125. package/dist/cjs/components/form/formFields/utilities/formUtilities.js +0 -22
  126. package/dist/cjs/components/form/formFields/utilities/formUtilities.js.map +0 -1
  127. package/dist/components/form/formFields/utilities/formUtilities.d.ts +0 -18
  128. package/dist/components/form/formFields/utilities/formUtilities.d.ts.map +0 -1
  129. package/dist/esm/components/form/formFields/utilities/formUtilities.js +0 -16
  130. package/dist/esm/components/form/formFields/utilities/formUtilities.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ValidationMessages.js","names":["_interopRequireDefault","require","Object","defineProperty","exports","value","extractError","default","ValidationMessages","GenericErrorMessages","_react","_errorMessage","_reactHookForm","_formUtilities","required","minLength","maxLength","min","max","unknown","errors","fieldName","undefined","pathComponents","split","reduce","accumulator","pathComponent","name","validation","formState","useFormContext","NoHookFormContext","fieldError","entries","forEach","validatorKey","validator","type","types","message","createElement","className","id","ErrorMessage","render","_default"],"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;;AAAC,IAAAA,sBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,YAAA,GAAAF,OAAA,CAAAG,OAAA,GAAAH,OAAA,CAAAI,kBAAA,GAAAJ,OAAA,CAAAK,oBAAA;AAEb,IAAAC,MAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AACA,IAAAW,cAAA,GAAAX,OAAA;AASA,IAAAY,cAAA,GAAAZ,OAAA;AAGA;AACO,MAAMQ,oBAA+D,GAAAL,OAAA,CAAAK,oBAAA,GAAG;EAC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AAA;AAAA,IAAAsC,QAAA,GAAA1C,OAAA,CAAAG,OAAA,GAEaC,kBAAkB","ignoreList":[]}
1
+ {"version":3,"file":"ValidationMessages.js","names":["_interopRequireDefault","require","Object","defineProperty","exports","value","extractError","default","ValidationMessages","GenericErrorMessages","_react","_reactHookForm","required","minLength","maxLength","min","max","unknown","isGenericErrorType","errorType","prototype","hasOwnProperty","call","getValidationValue","validator","getGenericErrorMessage","validation","undefined","replace","String","errors","fieldName","pathComponents","split","reduce","accumulator","pathComponent","name","formContext","useFormContext","formState","fieldError","resolveMessage","message","type","types","createElement","className","id","_default"],"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 ValidationMessages;\n"],"mappings":";AAEA,YAAY;;AAAC,IAAAA,sBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,YAAA,GAAAF,OAAA,CAAAG,OAAA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YAAY;IAACC,EAAE,EAAG,GAAIX,IAAI;EAAY,gBACpD3B,MAAA,CAAAH,OAAA,CAAAuC,aAAA;IAAMC,SAAS,EAAC;EAAS,gBACvBrC,MAAA,CAAAH,OAAA,CAAAuC,aAAA;IAAMC,SAAS,EAAC;EAAO,GAAGJ,OAAe,CACrC,CACF,CAAC;AAEX,CAAC;AAACvC,OAAA,CAAAI,kBAAA,GAAAA,kBAAA;AAAA,IAAAyC,QAAA,GAAA7C,OAAA,CAAAG,OAAA,GAEaC,kBAAkB","ignoreList":[]}
@@ -75,8 +75,7 @@ const DemoContactForm = ({
75
75
  }), /*#__PURE__*/_react.default.createElement(_Textarea.Textarea, {
76
76
  field: {
77
77
  id: 'yourMessage',
78
- name: 'yourMessage',
79
- type: 'textarea'
78
+ name: 'yourMessage'
80
79
  },
81
80
  label: {
82
81
  text: 'Your message'
@@ -1 +1 @@
1
- {"version":3,"file":"DemoContactForm.js","names":["_react","_interopRequireWildcard","require","_reactHookForm","_InputVariants","_SimpleButton","_Textarea","_InputCheckbox","_Tooltip","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DemoContactForm","onConsentClick","consentIsGiven","hasConsent","setHasConsent","React","useState","formContext","useFormContext","handleConsentClick","event","isChecked","target","checked","setValue","useEffect","createElement","className","TextInput","field","id","name","label","text","validation","required","EmailInput","PhoneInput","Textarea","type","InputCheckbox","defaultChecked","value","onChange","Tooltip","icon","SimpleButton","buttonType","buttonStyle","color","rightIcon","exports","_default"],"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":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAKA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAAkE,SAAAD,wBAAAQ,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAQ,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA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AU;MAC1BiB,EAAE,EAAE,kBAAkB;MACtBC,IAAI,EAAE,kBAAkB;MACxBW,KAAK,EAAE,gBAAgB;MACvBC,QAAQ,EAAGvB,KAA0C,IAAKD,kBAAkB,CAACC,KAAK;IACpF,CAAG;IACHY,KAAK,EAAG;MACNC,IAAI,eAAEnD,MAAA,CAAAmB,OAAA,CAAAyB,aAAA,eAAM,kCAAgC,eAAA5C,MAAA,CAAAmB,OAAA,CAAAyB,aAAA,iBAAQ,YAAkB,CAAC,8FAA0F,eAAA5C,MAAA,CAAAmB,OAAA,CAAAyB,aAAA,CAACpC,QAAA,CAAAsD,OAAO;QAACC,IAAI,EAAC;MAAM,GAAC,sCAA6C,CAAO;IAC5O;EAAG,CACJ,CAAC,eAEF/D,MAAA,CAAAmB,OAAA,CAAAyB,aAAA;IAAKC,SAAS,EAAC;EAAqB,gBAClC7C,MAAA,CAAAmB,OAAA,CAAAyB,aAAA,CAACvC,aAAA,CAAA2D,YAAY;IACXd,KAAK,EAAC,cAAc;IACpBF,EAAE,EAAC,mBAAmB;IACtBiB,UAAU,EAAC,QAAQ;IACnBC,WAAW,EACT;MACEC,KAAK,EAAE;IACT,CACD;IACDC,SAAS,EAAG;MACVL,IAAI,EAAE;IACR;EAAG,CACJ,CACE,CACF,CAAC;AAEV,CAAC;AAACM,OAAA,CAAAzC,eAAA,GAAAA,eAAA;AAAA,IAAA0C,QAAA,GAAAD,OAAA,CAAAlD,OAAA,GAEaS,eAAe","ignoreList":[]}
1
+ {"version":3,"file":"DemoContactForm.js","names":["_react","_interopRequireWildcard","require","_reactHookForm","_InputVariants","_SimpleButton","_Textarea","_InputCheckbox","_Tooltip","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DemoContactForm","onConsentClick","consentIsGiven","hasConsent","setHasConsent","React","useState","formContext","useFormContext","handleConsentClick","event","isChecked","target","checked","setValue","useEffect","createElement","className","TextInput","field","id","name","label","text","validation","required","EmailInput","PhoneInput","Textarea","InputCheckbox","defaultChecked","value","onChange","Tooltip","icon","SimpleButton","buttonType","buttonStyle","color","rightIcon","exports","_default"],"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 }\n }\n rightIcon={ {\n icon: 'telegram'\n } }\n />\n </div>\n </div>\n );\n};\n\nexport default DemoContactForm;"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAKA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAAkE,SAAAD,wBAAAQ,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAQ,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,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,eAAe","ignoreList":[]}
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "capitalizeFirstLetter", {
33
33
  return _stringHelpers.capitalizeFirstLetter;
34
34
  }
35
35
  });
36
+ Object.defineProperty(exports, "clampToGraphemeMax", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _stringHelpers.clampToGraphemeMax;
40
+ }
41
+ });
36
42
  Object.defineProperty(exports, "createCompareValueOverride", {
37
43
  enumerable: true,
38
44
  get: function () {
@@ -201,6 +207,12 @@ Object.defineProperty(exports, "getBranchFromPath", {
201
207
  return _objectHelpers.getBranchFromPath;
202
208
  }
203
209
  });
210
+ Object.defineProperty(exports, "getCharacterCount", {
211
+ enumerable: true,
212
+ get: function () {
213
+ return _stringHelpers.getCharacterCount;
214
+ }
215
+ });
204
216
  Object.defineProperty(exports, "getInitialsOrAcronym", {
205
217
  enumerable: true,
206
218
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_ageHelpers","require","_arrayHelpers","_dataHelpers","_dateHelpers","_formatters","_numberHelpers","_stringHelpers","_objectHelpers"],"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,IAAAA,WAAA,GAAAC,OAAA;AAUA,IAAAC,aAAA,GAAAD,OAAA;AAYA,IAAAE,YAAA,GAAAF,OAAA;AAMA,IAAAG,YAAA,GAAAH,OAAA;AAYA,IAAAI,WAAA,GAAAJ,OAAA;AAgBA,IAAAK,cAAA,GAAAL,OAAA;AAUA,IAAAM,cAAA,GAAAN,OAAA;AAYA,IAAAO,cAAA,GAAAP,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_ageHelpers","require","_arrayHelpers","_dataHelpers","_dateHelpers","_formatters","_numberHelpers","_stringHelpers","_objectHelpers"],"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,IAAAA,WAAA,GAAAC,OAAA;AAUA,IAAAC,aAAA,GAAAD,OAAA;AAYA,IAAAE,YAAA,GAAAF,OAAA;AAMA,IAAAG,YAAA,GAAAH,OAAA;AAYA,IAAAI,WAAA,GAAAJ,OAAA;AAgBA,IAAAK,cAAA,GAAAL,OAAA;AAUA,IAAAM,cAAA,GAAAN,OAAA;AAcA,IAAAO,cAAA,GAAAP,OAAA","ignoreList":[]}
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.useAnInsteadOfA = exports.splitCamelCase = exports.richTextParser = exports.pluralizeIfNeeded = exports.pluralize = exports.lowerCaseFirstLetter = exports.getInitialsOrAcronym = exports.capitalizeFirstLetter = exports.capitalize = void 0;
7
+ exports.useAnInsteadOfA = exports.splitCamelCase = exports.richTextParser = exports.pluralizeIfNeeded = exports.pluralize = exports.lowerCaseFirstLetter = exports.getInitialsOrAcronym = exports.getCharacterCount = exports.clampToGraphemeMax = exports.capitalizeFirstLetter = exports.capitalize = void 0;
8
8
  var _htmlReactParser = _interopRequireDefault(require("html-react-parser"));
9
9
  const richTextParser = (richText, supportEscapedCharacters) => {
10
10
  // Adjusts text to replace line breaks with <br/> tags
@@ -42,13 +42,59 @@ const capitalizeFirstLetter = pString => `${pString.substring(0, 1).toUpperCase(
42
42
  exports.capitalizeFirstLetter = capitalizeFirstLetter;
43
43
  const lowerCaseFirstLetter = pString => `${pString.substring(0, 1).toLowerCase()}${pString.substring(1)}`;
44
44
 
45
+ /**
46
+ * Splits a string into grapheme clusters so text metrics and clamping can share
47
+ * the same segmentation logic without forcing callers to pass pre-segmented data.
48
+ *
49
+ * @param {string} pString - The string to segment.
50
+ * @returns {string[]} The grapheme units in order, falling back to code points when Intl.Segmenter is unavailable.
51
+ */
52
+ exports.lowerCaseFirstLetter = lowerCaseFirstLetter;
53
+ const getGraphemeSegments = pString => {
54
+ if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {
55
+ const segmenter = new Intl.Segmenter(undefined, {
56
+ granularity: 'grapheme'
57
+ });
58
+ return Array.from(segmenter.segment(pString), ({
59
+ segment
60
+ }) => segment);
61
+ }
62
+ return Array.from(pString);
63
+ };
64
+
65
+ /**
66
+ * Counts user-perceived characters (grapheme clusters) so emojis and composed
67
+ * characters such as accented letters count as one.
68
+ *
69
+ * @param {string} pString - A string of text.
70
+ * @returns {number} The number of grapheme clusters, falling back to code points where Intl.Segmenter is unavailable.
71
+ */
72
+ const getCharacterCount = pString => getGraphemeSegments(pString).length;
73
+
74
+ /**
75
+ * Truncates a string to a maximum number of grapheme clusters without splitting
76
+ * an emoji or composed character in half.
77
+ *
78
+ * @param {string} pString - A string of text.
79
+ * @param {number} maxAllowed - The maximum number of user-perceived characters to keep.
80
+ * @returns {string} The truncated string, or the unchanged pString if it is already within the limit.
81
+ */
82
+ exports.getCharacterCount = getCharacterCount;
83
+ const clampToGraphemeMax = (pString, maxAllowed) => {
84
+ const graphemeSegments = getGraphemeSegments(pString);
85
+ if (graphemeSegments.length <= maxAllowed) {
86
+ return pString;
87
+ }
88
+ return graphemeSegments.slice(0, maxAllowed).join('');
89
+ };
90
+
45
91
  /**
46
92
  * Determines if "an" should be used instead of "a" before the given word.
47
93
  *
48
94
  * @param {string} word - The word to check.
49
95
  * @returns {boolean} True if "an" should be used, false otherwise.
50
96
  */
51
- exports.lowerCaseFirstLetter = lowerCaseFirstLetter;
97
+ exports.clampToGraphemeMax = clampToGraphemeMax;
52
98
  const useAnInsteadOfA = word => {
53
99
  const lettersRequiringAn = ['a', 'e', 'i', 'o', 'u', 'h'];
54
100
  const firstLetter = word.substring(0, 1).toLowerCase();
@@ -1 +1 @@
1
- {"version":3,"file":"stringHelpers.js","names":["_htmlReactParser","_interopRequireDefault","require","richTextParser","richText","supportEscapedCharacters","adjustedText","split","join","parse","exports","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,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEO,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,OAAO,IAAAI,wBAAK,EAACH,YAAY,CAAC;EAC5B;EACA,OAAO,IAAAG,wBAAK,EAACL,QAAQ,CAAC;AACxB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALAM,OAAA,CAAAP,cAAA,GAAAA,cAAA;AAMO,MAAMQ,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;AALAL,OAAA,CAAAC,UAAA,GAAAA,UAAA;AAMO,MAAMK,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;AALAH,OAAA,CAAAM,qBAAA,GAAAA,qBAAA;AAMO,MAAMC,oBAAoB,GAAIL,OAAe,IAAa,GAAIA,OAAO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,OAAO,GAAI;AACxB,CAAC;AAACF,OAAA,CAAAe,SAAA,GAAAA,SAAA;AAEK,MAAMG,iBAAiB,GAAGA,CAAChB,OAAe,EAAEiB,KAAa,KAAa;EAC3E,IAAIA,KAAK,IAAIA,KAAK,GAAG,CAAC,EAAE;IACtB,OAAOJ,SAAS,CAACb,OAAO,CAAC;EAC3B;EACA,OAAOA,OAAO;AAChB,CAAC;AAACF,OAAA,CAAAkB,iBAAA,GAAAA,iBAAA;AAEK,MAAME,oBAAoB,GAAIlB,OAAe,IAAa;EAC/D,OAAOA,OAAO,CAACL,KAAK,CAAC,GAAG,CAAC,CAACwB,GAAG,CAAEC,KAAK,IAAKrB,UAAU,CAACqB,KAAK,CAACnB,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAACL,IAAI,CAAC,EAAE,CAAC;AACtF,CAAC;AAACE,OAAA,CAAAoB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"file":"stringHelpers.js","names":["_htmlReactParser","_interopRequireDefault","require","richTextParser","richText","supportEscapedCharacters","adjustedText","split","join","parse","exports","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,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEO,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,wBAA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CAAC;AAACL,OAAA,CAAA4B,cAAA,GAAAA,cAAA;AAEV,MAAME,SAAS,GAAI5B,OAAe,IAAa;EACpD,IAAIA,OAAO,CAAC6B,QAAQ,CAAC,GAAG,CAAC,EAAE;IACzB;IACA,OAAO,GAAI7B,OAAO,CAACoB,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAM;EACvC;EAAE,IAAIpB,OAAO,CAAC6B,QAAQ,CAAC,GAAG,CAAC,IAAI7B,OAAO,CAAC6B,QAAQ,CAAC,GAAG,CAAC,IAAI7B,OAAO,CAAC6B,QAAQ,CAAC,GAAG,CAAC,IAAI7B,OAAO,CAAC6B,QAAQ,CAAC,IAAI,CAAC,IAAI7B,OAAO,CAAC6B,QAAQ,CAAC,IAAI,CAAC,EAAE;IACjI;IACA,OAAO,GAAI7B,OAAO,IAAK;EACzB;EACA;EACA,OAAO,GAAIA,OAAO,GAAI;AACxB,CAAC;AAACF,OAAA,CAAA8B,SAAA,GAAAA,SAAA;AAEK,MAAME,iBAAiB,GAAGA,CAAC9B,OAAe,EAAE+B,KAAa,KAAa;EAC3E,IAAIA,KAAK,IAAIA,KAAK,GAAG,CAAC,EAAE;IACtB,OAAOH,SAAS,CAAC5B,OAAO,CAAC;EAC3B;EACA,OAAOA,OAAO;AAChB,CAAC;AAACF,OAAA,CAAAgC,iBAAA,GAAAA,iBAAA;AAEK,MAAME,oBAAoB,GAAIhC,OAAe,IAAa;EAC/D,OAAOA,OAAO,CAACL,KAAK,CAAC,GAAG,CAAC,CAACsC,GAAG,CAAEC,KAAK,IAAKnC,UAAU,CAACmC,KAAK,CAACjC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAACL,IAAI,CAAC,EAAE,CAAC;AACtF,CAAC;AAACE,OAAA,CAAAkC,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"headerText.interface.js","names":[],"sources":["../../../src/interfaces/headerText.interface.ts"],"sourcesContent":["import React from 'react';\nimport { NotificationIconProps } from '../components/design/icons/notificationIcon/NotificationIcon';\nimport { ButtonProps } from '../components/form/buttons/button.interface';\nimport { IconProps } from '../components/design/icons/basicIcon/Icon';\nimport { NotificationsButtonProps } from '../components/form/buttons/notificationsButton/NotificationsButton';\n\nexport type SimpleHeaderButton = ButtonProps & {\n kind?: 'simple'\n};\n\nexport type NotificationsHeaderButton = Omit<NotificationsButtonProps, 'label'> & {\n kind?: 'notifications'\n};\n\nexport type HeaderButtonTypes = SimpleHeaderButton | NotificationsHeaderButton;\n\nexport interface HeaderTextInterface {\n leftIcon?: IconProps;\n rightIcon?: IconProps;\n text?: string;\n notificationIcon?: NotificationIconProps;\n buttons?: HeaderButtonTypes[];\n children?: React.ReactNode;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"headerText.interface.js","names":[],"sources":["../../../src/interfaces/headerText.interface.ts"],"sourcesContent":["import React from 'react';\nimport { NotificationIconProps } from '../components/design/icons/notificationIcon/NotificationIcon';\nimport { ButtonProps } from '../components/form/buttons/button.interface';\nimport { IconProps } from '../components/design/icons/basicIcon/Icon';\nimport { NotificationsButtonProps } from '../components/form/buttons/notificationsButton/NotificationsButton';\n\nexport type SimpleHeaderButton = ButtonProps & {\n kind?: 'simple'\n};\n\nexport type NotificationsHeaderButton = Omit<NotificationsButtonProps, 'label'> & {\n kind?: 'notifications'\n};\n\nexport type HeaderButtonTypes = SimpleHeaderButton | NotificationsHeaderButton;\n\nexport interface HeaderTextInterface {\n leftIcon?: IconProps;\n rightIcon?: IconProps;\n text?: string;\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n notificationIcon?: NotificationIconProps;\n buttons?: HeaderButtonTypes[];\n children?: React.ReactNode;\n}\n"],"mappings":"","ignoreList":[]}
@@ -137,8 +137,23 @@
137
137
  "files": [
138
138
  "dist"
139
139
  ],
140
- "version": "3.14.0",
141
- "packageManager": "pnpm@10.11.0",
140
+ "version": "3.15.0",
141
+ "devEngines": {
142
+ "runtime": {
143
+ "name": "node",
144
+ "version": "24.15.0",
145
+ "onFail": "warn"
146
+ },
147
+ "packageManager": {
148
+ "name": "pnpm",
149
+ "version": "12.4.1",
150
+ "onFail": "warn"
151
+ }
152
+ },
153
+ "engines": {
154
+ "node": "24.15.0"
155
+ },
156
+ "packageManager": "pnpm@12.4.1",
142
157
  "repository": {
143
158
  "type": "git",
144
159
  "url": "https://github.com/x15ventures/x15-ui-library.git"
@@ -173,162 +188,133 @@
173
188
  "storybook:build": "pnpm install --frozen-lockfile && pnpm build:cicd && storybook build --config-dir config/storybook/web --output-dir ./storybook-static"
174
189
  },
175
190
  "dependencies": {
176
- "@hookform/error-message": "^2.0.1",
177
- "@x15stack/aws": "^1.7.2",
178
- "@x15ventures/x15-ui-library-icons": "^1.1.3",
179
- "babel-plugin-transform-imports": "^2.0.0",
180
- "html-react-parser": "^5.2.17",
181
- "jsdom": "^26.1.0",
182
- "react": "^18.3.1",
183
- "react-dom": "^18.3.1",
184
- "react-helmet": "^6.1.0",
185
- "react-hook-form": "^7.74.0",
186
- "run-func": "^3.0.0",
187
- "storybook": "^10.3.5",
188
- "use-debounce": "^10.1.1"
191
+ "@x15ventures/x15-ui-library-icons": "1.1.3",
192
+ "babel-plugin-transform-imports": "2.0.0",
193
+ "html-react-parser": "5.2.17",
194
+ "jsdom": "26.1.0",
195
+ "react": "18.3.1",
196
+ "react-dom": "18.3.1",
197
+ "react-helmet": "6.1.0",
198
+ "run-func": "3.0.0",
199
+ "storybook": "10.3.5",
200
+ "use-debounce": "10.1.1"
189
201
  },
190
202
  "peerDependencies": {
191
- "core-js": "^3.44.0",
192
- "react": "^18.0.0",
193
- "react-dom": "^18.0.0",
194
- "storybook": "^10.1.10"
203
+ "core-js": "3.49.0",
204
+ "react": "18.3.1",
205
+ "react-dom": "18.3.1",
206
+ "react-hook-form": "7.74.0",
207
+ "storybook": "10.3.5"
195
208
  },
196
209
  "devDependencies": {
197
- "@babel/cli": "^7.28.6",
210
+ "@babel/cli": "7.28.6",
198
211
  "@babel/core": "7.29.6",
199
- "@babel/eslint-parser": "^7.28.6",
200
- "@babel/eslint-plugin": "^7.27.1",
201
- "@babel/plugin-syntax-jsx": "^7.28.6",
202
- "@babel/plugin-transform-class-properties": "^7.28.6",
203
- "@babel/plugin-transform-modules-commonjs": "^7.28.6",
204
- "@babel/plugin-transform-runtime": "^7.29.0",
205
- "@babel/preset-env": "^7.29.2",
206
- "@babel/preset-react": "^7.28.5",
207
- "@babel/preset-typescript": "^7.28.5",
208
- "@babel/runtime": "^7.29.2",
209
- "@commitlint/cli": "^20.5.2",
210
- "@commitlint/config-conventional": "^20.5.0",
211
- "@eslint/js": "^9.39.4",
212
- "@jest/globals": "^29.7.0",
213
- "@jest/types": "^29.6.3",
214
- "@mdx-js/mdx": "^3.1.1",
215
- "@mdx-js/react": "^3.1.1",
216
- "@rollup/plugin-commonjs": "^28.0.9",
217
- "@rollup/plugin-node-resolve": "^16.0.3",
218
- "@rollup/plugin-typescript": "^12.3.0",
219
- "@semantic-release/changelog": "^6.0.3",
220
- "@semantic-release/commit-analyzer": "^13.0.1",
221
- "@semantic-release/exec": "^7.1.0",
222
- "@semantic-release/git": "^10.0.1",
223
- "@semantic-release/npm": "^12.0.2",
224
- "@semantic-release/release-notes-generator": "^14.1.0",
225
- "@storybook/addon-a11y": "^10.3.5",
226
- "@storybook/addon-docs": "^10.3.5",
227
- "@storybook/addon-knobs": "^8.0.1",
228
- "@storybook/addon-links": "^10.3.5",
229
- "@storybook/addon-styling-webpack": "^1.0.1",
230
- "@storybook/cli": "^10.3.5",
231
- "@storybook/core-events": "^8.6.14",
232
- "@storybook/manager-api": "^8.6.14",
233
- "@storybook/mdx2-csf": "^1.1.0",
234
- "@storybook/preset-scss": "^1.0.3",
235
- "@storybook/preview-api": "^8.6.14",
236
- "@storybook/react": "^10.3.5",
237
- "@storybook/react-webpack5": "^10.3.5",
238
- "@storybook/types": "^8.6.14",
239
- "@testing-library/jest-dom": "^6.9.1",
240
- "@testing-library/react": "^16.3.2",
241
- "@testing-library/user-event": "^14.6.1",
242
- "@types/enzyme": "^3.10.19",
243
- "@types/enzyme-adapter-react-16": "^1.0.9",
244
- "@types/jest": "^29.5.14",
245
- "@types/node": "^20.19.39",
246
- "@types/react": "^18.3.28",
247
- "@types/react-dom": "^18.3.7",
248
- "@types/react-helmet": "^6.1.11",
249
- "@types/webpack": "^5.28.5",
250
- "@types/webpack-env": "^1.18.8",
251
- "@typescript-eslint/eslint-plugin": "^8.59.1",
252
- "@typescript-eslint/parser": "^8.59.1",
253
- "@x15stack/aws": "^1.6.5",
254
- "autoprefixer": "^10.5.0",
255
- "babel-jest": "^30.3.0",
256
- "babel-loader": "^9.2.1",
257
- "babel-plugin-macros": "^3.1.0",
258
- "chromatic": "^11.29.0",
259
- "commitlint": "^20.5.3",
260
- "copy-webpack-plugin": "^12.0.2",
261
- "cors": "^2.8.6",
262
- "cross-env": "^7.0.3",
263
- "css-loader": "^7.1.4",
264
- "enzyme": "^3.11.0",
265
- "enzyme-adapter-react-16": "^1.15.8",
266
- "esbuild": "^0.25.12",
267
- "esbuild-sass-plugin": "^3.7.0",
268
- "eslint": "^9.39.4",
269
- "eslint-import-resolver-typescript": "^3.10.1",
270
- "eslint-plugin-import": "^2.32.0",
271
- "eslint-plugin-jest": "^28.14.0",
272
- "eslint-plugin-jsx-a11y": "^6.10.2",
273
- "eslint-plugin-react": "^7.37.5",
212
+ "@babel/eslint-parser": "7.28.6",
213
+ "@babel/eslint-plugin": "7.27.1",
214
+ "@babel/plugin-syntax-jsx": "7.28.6",
215
+ "@babel/plugin-transform-class-properties": "7.28.6",
216
+ "@babel/plugin-transform-modules-commonjs": "7.28.6",
217
+ "@babel/plugin-transform-runtime": "7.29.0",
218
+ "@babel/preset-env": "7.29.2",
219
+ "@babel/preset-react": "7.28.5",
220
+ "@babel/preset-typescript": "7.28.5",
221
+ "@babel/runtime": "7.29.2",
222
+ "@commitlint/cli": "20.5.2",
223
+ "@commitlint/config-conventional": "20.5.0",
224
+ "@eslint/js": "9.39.4",
225
+ "@jest/globals": "29.7.0",
226
+ "@jest/types": "29.6.3",
227
+ "@mdx-js/mdx": "3.1.1",
228
+ "@mdx-js/react": "3.1.1",
229
+ "@rollup/plugin-commonjs": "28.0.9",
230
+ "@rollup/plugin-node-resolve": "16.0.3",
231
+ "@rollup/plugin-typescript": "12.3.0",
232
+ "@semantic-release/changelog": "6.0.3",
233
+ "@semantic-release/commit-analyzer": "13.0.1",
234
+ "@semantic-release/exec": "7.1.0",
235
+ "@semantic-release/git": "10.0.1",
236
+ "@semantic-release/npm": "12.0.2",
237
+ "@semantic-release/release-notes-generator": "14.1.0",
238
+ "@storybook/addon-a11y": "10.3.5",
239
+ "@storybook/addon-docs": "10.3.5",
240
+ "@storybook/addon-knobs": "8.0.1",
241
+ "@storybook/addon-links": "10.3.5",
242
+ "@storybook/addon-styling-webpack": "1.0.1",
243
+ "@storybook/cli": "10.3.5",
244
+ "@storybook/core-events": "8.6.14",
245
+ "@storybook/manager-api": "8.6.14",
246
+ "@storybook/mdx2-csf": "1.1.0",
247
+ "@storybook/preset-scss": "1.0.3",
248
+ "@storybook/preview-api": "8.6.14",
249
+ "@storybook/react": "10.3.5",
250
+ "@storybook/react-webpack5": "10.3.5",
251
+ "@storybook/types": "8.6.14",
252
+ "@testing-library/jest-dom": "6.9.1",
253
+ "@testing-library/react": "16.3.2",
254
+ "@testing-library/user-event": "14.6.1",
255
+ "@types/enzyme": "3.10.19",
256
+ "@types/enzyme-adapter-react-16": "1.0.9",
257
+ "@types/jest": "29.5.14",
258
+ "@types/node": "20.19.39",
259
+ "@types/react": "18.3.28",
260
+ "@types/react-dom": "18.3.7",
261
+ "@types/react-helmet": "6.1.11",
262
+ "@types/webpack": "5.28.5",
263
+ "@types/webpack-env": "1.18.8",
264
+ "@typescript-eslint/eslint-plugin": "8.59.1",
265
+ "@typescript-eslint/parser": "8.59.1",
266
+ "@x15stack/aws": "1.7.2",
267
+ "autoprefixer": "10.5.0",
268
+ "babel-jest": "30.3.0",
269
+ "babel-loader": "9.2.1",
270
+ "babel-plugin-macros": "3.1.0",
271
+ "chromatic": "11.29.0",
272
+ "commitlint": "20.5.3",
273
+ "copy-webpack-plugin": "12.0.2",
274
+ "cors": "2.8.6",
275
+ "cross-env": "7.0.3",
276
+ "css-loader": "7.1.4",
277
+ "enzyme": "3.11.0",
278
+ "enzyme-adapter-react-16": "1.15.8",
279
+ "esbuild": "0.25.12",
280
+ "esbuild-sass-plugin": "3.7.0",
281
+ "eslint": "9.39.4",
282
+ "eslint-import-resolver-typescript": "4.4.5",
283
+ "eslint-plugin-import": "2.32.0",
284
+ "eslint-plugin-jest": "28.14.0",
285
+ "eslint-plugin-jsx-a11y": "6.10.2",
286
+ "eslint-plugin-react": "7.37.5",
274
287
  "eslint-plugin-storybook": "10.1.10",
275
- "express": "^5.2.1",
276
- "file-loader": "^6.2.0",
288
+ "express": "5.2.1",
289
+ "file-loader": "6.2.0",
277
290
  "fs": "0.0.1-security",
278
- "fs-extra": "^11.3.4",
279
- "glob": "^13.0.6",
280
- "globals": "^15.15.0",
281
- "jest": "^30.3.0",
282
- "jest-environment-jsdom": "^29.7.0",
283
- "lefthook": "^1.13.6",
284
- "minimatch": "^10.2.5",
285
- "nodemon": "^3.1.14",
286
- "npm-run-all": "^4.1.5",
287
- "null-loader": "^4.0.1",
288
- "postcss": "^8.5.12",
289
- "postcss-loader": "^8.2.1",
290
- "raw-loader": "^4.0.2",
291
- "react-docgen-typescript": "^2.4.0",
292
- "react-docgen-typescript-loader": "^3.7.2",
293
- "react-dropzone": "^14.4.1",
294
- "sass": "^1.99.0",
295
- "sass-loader": "^16.0.7",
296
- "semantic-release": "^24.2.9",
297
- "style-loader": "^4.0.0",
298
- "ts-jest": "^29.4.9",
299
- "ts-morph": "^25.0.1",
300
- "tsconfig-paths-webpack-plugin": "^4.2.0",
301
- "ttab": "^0.9.0",
291
+ "fs-extra": "11.3.4",
292
+ "glob": "13.0.6",
293
+ "globals": "15.15.0",
294
+ "jest": "30.3.0",
295
+ "jest-environment-jsdom": "29.7.0",
296
+ "lefthook": "1.13.6",
297
+ "minimatch": "9.0.7",
298
+ "nodemon": "3.1.14",
299
+ "npm-run-all": "4.1.5",
300
+ "null-loader": "4.0.1",
301
+ "postcss": "8.5.23",
302
+ "postcss-loader": "8.2.1",
303
+ "raw-loader": "4.0.2",
304
+ "react-docgen-typescript": "2.4.0",
305
+ "react-docgen-typescript-loader": "3.7.2",
306
+ "react-dropzone": "14.4.1",
307
+ "react-hook-form": "7.74.0",
308
+ "sass": "1.99.0",
309
+ "sass-loader": "16.0.7",
310
+ "semantic-release": "24.2.9",
311
+ "style-loader": "4.0.0",
312
+ "ts-jest": "29.4.9",
313
+ "ts-morph": "25.0.1",
314
+ "tsconfig-paths-webpack-plugin": "4.2.0",
315
+ "ttab": "0.9.0",
302
316
  "typescript": "5.5.4",
303
- "url-loader": "^4.1.1",
304
- "vitest": "3.2.6"
305
- },
306
- "pnpm": {
307
- "overrides": {
308
- "@babel/plugin-transform-modules-systemjs": "7.29.4",
309
- "@tootallnate/once@<3.0.1": ">=3.0.1",
310
- "brace-expansion": "5.0.6",
311
- "fast-uri": "3.1.2",
312
- "form-data": "4.0.6",
313
- "flatted": ">=3.4.2",
314
- "flatted@<3.4.0": ">=3.4.0",
315
- "handlebars": ">=4.7.9",
316
- "immutable@>=5.0.0 <5.1.5": ">=5.1.5",
317
- "js-yaml": "4.2.0",
318
- "minimatch": "9.0.7",
319
- "path-to-regexp": ">=8.4.0",
320
- "picomatch": ">=4.0.4",
321
- "qs": "6.15.2",
322
- "rollup": ">=4.59.0",
323
- "serialize-javascript": ">=7.0.3",
324
- "shell-quote": "1.8.4",
325
- "storybook": ">=10.2.10",
326
- "undici": "8.5.0",
327
- "uuid": "11.1.1",
328
- "vite": "6.4.3",
329
- "webpack": ">=5.104.1",
330
- "ws": "8.21.0",
331
- "yaml": ">=1.10.3"
332
- }
317
+ "url-loader": "4.1.1",
318
+ "vitest": "4.1.11"
333
319
  }
334
320
  }