@simplybusiness/mobius 10.4.0 → 10.4.2

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 (144) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/components/AddressLookup/AddressLookup.js +5 -4
  3. package/dist/cjs/components/AddressLookup/AddressLookup.js.map +2 -2
  4. package/dist/cjs/components/AddressLookup/index.js +5 -4
  5. package/dist/cjs/components/AddressLookup/index.js.map +2 -2
  6. package/dist/cjs/components/Alert/Alert.js +5 -4
  7. package/dist/cjs/components/Alert/Alert.js.map +2 -2
  8. package/dist/cjs/components/Alert/index.js +5 -4
  9. package/dist/cjs/components/Alert/index.js.map +2 -2
  10. package/dist/cjs/components/Checkbox/Checkbox.js +5 -4
  11. package/dist/cjs/components/Checkbox/Checkbox.js.map +2 -2
  12. package/dist/cjs/components/Checkbox/CheckboxGroup.js +5 -4
  13. package/dist/cjs/components/Checkbox/CheckboxGroup.js.map +2 -2
  14. package/dist/cjs/components/Checkbox/index.js +5 -4
  15. package/dist/cjs/components/Checkbox/index.js.map +2 -2
  16. package/dist/cjs/components/Combobox/Combobox.js +5 -4
  17. package/dist/cjs/components/Combobox/Combobox.js.map +2 -2
  18. package/dist/cjs/components/Combobox/index.js +5 -4
  19. package/dist/cjs/components/Combobox/index.js.map +2 -2
  20. package/dist/cjs/components/DateField/DateField.js +5 -4
  21. package/dist/cjs/components/DateField/DateField.js.map +2 -2
  22. package/dist/cjs/components/DateField/index.js +5 -4
  23. package/dist/cjs/components/DateField/index.js.map +2 -2
  24. package/dist/cjs/components/ErrorMessage/ErrorMessage.js +5 -4
  25. package/dist/cjs/components/ErrorMessage/ErrorMessage.js.map +2 -2
  26. package/dist/cjs/components/ErrorMessage/index.js +5 -4
  27. package/dist/cjs/components/ErrorMessage/index.js.map +2 -2
  28. package/dist/cjs/components/ExpandableText/ExpandableText.js +5 -4
  29. package/dist/cjs/components/ExpandableText/ExpandableText.js.map +2 -2
  30. package/dist/cjs/components/ExpandableText/index.js +5 -4
  31. package/dist/cjs/components/ExpandableText/index.js.map +2 -2
  32. package/dist/cjs/components/MaskedField/MaskedField.js +5 -4
  33. package/dist/cjs/components/MaskedField/MaskedField.js.map +2 -2
  34. package/dist/cjs/components/MaskedField/index.js +6 -5
  35. package/dist/cjs/components/MaskedField/index.js.map +2 -2
  36. package/dist/cjs/components/NumberField/NumberField.js +5 -4
  37. package/dist/cjs/components/NumberField/NumberField.js.map +2 -2
  38. package/dist/cjs/components/NumberField/index.js +5 -4
  39. package/dist/cjs/components/NumberField/index.js.map +2 -2
  40. package/dist/cjs/components/PasswordField/PasswordField.js +5 -4
  41. package/dist/cjs/components/PasswordField/PasswordField.js.map +2 -2
  42. package/dist/cjs/components/PasswordField/index.js +5 -4
  43. package/dist/cjs/components/PasswordField/index.js.map +2 -2
  44. package/dist/cjs/components/Radio/Radio.js +5 -4
  45. package/dist/cjs/components/Radio/Radio.js.map +2 -2
  46. package/dist/cjs/components/Radio/RadioGroup.js +5 -4
  47. package/dist/cjs/components/Radio/RadioGroup.js.map +2 -2
  48. package/dist/cjs/components/Radio/index.js +5 -4
  49. package/dist/cjs/components/Radio/index.js.map +2 -2
  50. package/dist/cjs/components/Select/Select.js +5 -4
  51. package/dist/cjs/components/Select/Select.js.map +2 -2
  52. package/dist/cjs/components/Select/index.js +5 -4
  53. package/dist/cjs/components/Select/index.js.map +2 -2
  54. package/dist/cjs/components/TextArea/TextArea.js +5 -4
  55. package/dist/cjs/components/TextArea/TextArea.js.map +2 -2
  56. package/dist/cjs/components/TextArea/index.js +5 -4
  57. package/dist/cjs/components/TextArea/index.js.map +2 -2
  58. package/dist/cjs/components/TextField/TextField.js +5 -4
  59. package/dist/cjs/components/TextField/TextField.js.map +2 -2
  60. package/dist/cjs/components/TextField/index.js +5 -4
  61. package/dist/cjs/components/TextField/index.js.map +2 -2
  62. package/dist/cjs/components/TextOrHTML/TextOrHTML.js +5 -4
  63. package/dist/cjs/components/TextOrHTML/TextOrHTML.js.map +2 -2
  64. package/dist/cjs/components/TextOrHTML/index.js +5 -4
  65. package/dist/cjs/components/TextOrHTML/index.js.map +2 -2
  66. package/dist/cjs/components/index.js +6 -5
  67. package/dist/cjs/components/index.js.map +2 -2
  68. package/dist/cjs/index.js +6 -5
  69. package/dist/cjs/index.js.map +2 -2
  70. package/dist/cjs/meta.json +103 -103
  71. package/dist/esm/{chunk-4WVJNNBK.js → chunk-2HUMNED2.js} +2 -2
  72. package/dist/esm/{chunk-N4WQ6522.js → chunk-2VEO5SSY.js} +2 -2
  73. package/dist/esm/{chunk-AFU7BFCD.js → chunk-576SEJGC.js} +3 -3
  74. package/dist/esm/{chunk-QPIA6BGW.js → chunk-6JCU4CGA.js} +2 -2
  75. package/dist/esm/{chunk-X6EPYQKX.js → chunk-F5ELD54X.js} +2 -2
  76. package/dist/esm/{chunk-ZN5TRIVZ.js → chunk-GV36OVX7.js} +2 -2
  77. package/dist/esm/{chunk-JNAQ76CR.js → chunk-HGNWNZ5E.js} +2 -2
  78. package/dist/esm/{chunk-ONDOONBM.js → chunk-HUSMC5GZ.js} +2 -2
  79. package/dist/esm/{chunk-UIIXVY6K.js → chunk-IQKS662C.js} +2 -2
  80. package/dist/esm/{chunk-DYTHXKMX.js → chunk-KTJCAQT4.js} +6 -5
  81. package/dist/esm/chunk-KTJCAQT4.js.map +7 -0
  82. package/dist/esm/{chunk-5OFXPT4J.js → chunk-M62U4QGQ.js} +2 -2
  83. package/dist/esm/{chunk-UQVAEWY2.js → chunk-MZJT3USG.js} +2 -2
  84. package/dist/esm/{chunk-FKTDL7KO.js → chunk-OAG5T7NC.js} +2 -2
  85. package/dist/esm/{chunk-M2NDSQR5.js → chunk-P6YHEIFT.js} +2 -2
  86. package/dist/esm/{chunk-P5VEI574.js → chunk-S4CU4XRB.js} +2 -2
  87. package/dist/esm/{chunk-4NBLO5WK.js → chunk-X4CMSAET.js} +2 -2
  88. package/dist/esm/{chunk-KQZ3MNK5.js → chunk-XNEQHHNV.js} +2 -2
  89. package/dist/esm/components/AddressLookup/AddressLookup.js +5 -5
  90. package/dist/esm/components/AddressLookup/index.js +5 -5
  91. package/dist/esm/components/Alert/Alert.js +2 -2
  92. package/dist/esm/components/Alert/index.js +2 -2
  93. package/dist/esm/components/Checkbox/Checkbox.js +3 -3
  94. package/dist/esm/components/Checkbox/CheckboxGroup.js +4 -4
  95. package/dist/esm/components/Checkbox/index.js +4 -4
  96. package/dist/esm/components/Combobox/Combobox.js +4 -4
  97. package/dist/esm/components/Combobox/index.js +4 -4
  98. package/dist/esm/components/DateField/DateField.js +4 -4
  99. package/dist/esm/components/DateField/index.js +4 -4
  100. package/dist/esm/components/ErrorMessage/ErrorMessage.js +2 -2
  101. package/dist/esm/components/ErrorMessage/index.js +2 -2
  102. package/dist/esm/components/ExpandableText/ExpandableText.js +2 -2
  103. package/dist/esm/components/ExpandableText/index.js +2 -2
  104. package/dist/esm/components/MaskedField/MaskedField.js +3 -3
  105. package/dist/esm/components/MaskedField/index.js +4 -4
  106. package/dist/esm/components/NumberField/NumberField.js +4 -4
  107. package/dist/esm/components/NumberField/index.js +4 -4
  108. package/dist/esm/components/PasswordField/PasswordField.js +4 -4
  109. package/dist/esm/components/PasswordField/index.js +4 -4
  110. package/dist/esm/components/Radio/Radio.js +3 -3
  111. package/dist/esm/components/Radio/RadioGroup.js +3 -3
  112. package/dist/esm/components/Radio/index.js +4 -4
  113. package/dist/esm/components/Select/Select.js +3 -3
  114. package/dist/esm/components/Select/index.js +3 -3
  115. package/dist/esm/components/TextArea/TextArea.js +3 -3
  116. package/dist/esm/components/TextArea/index.js +3 -3
  117. package/dist/esm/components/TextField/TextField.js +3 -3
  118. package/dist/esm/components/TextField/index.js +3 -3
  119. package/dist/esm/components/TextOrHTML/TextOrHTML.js +1 -1
  120. package/dist/esm/components/TextOrHTML/index.js +1 -1
  121. package/dist/esm/components/index.js +17 -17
  122. package/dist/esm/index.js +17 -17
  123. package/dist/esm/meta.json +191 -191
  124. package/dist/tsconfig.build.tsbuildinfo +1 -1
  125. package/package.json +2 -2
  126. package/src/components/TextOrHTML/TextOrHTML.test.tsx +45 -8
  127. package/src/components/TextOrHTML/TextOrHTML.tsx +7 -4
  128. package/dist/esm/chunk-DYTHXKMX.js.map +0 -7
  129. /package/dist/esm/{chunk-4WVJNNBK.js.map → chunk-2HUMNED2.js.map} +0 -0
  130. /package/dist/esm/{chunk-N4WQ6522.js.map → chunk-2VEO5SSY.js.map} +0 -0
  131. /package/dist/esm/{chunk-AFU7BFCD.js.map → chunk-576SEJGC.js.map} +0 -0
  132. /package/dist/esm/{chunk-QPIA6BGW.js.map → chunk-6JCU4CGA.js.map} +0 -0
  133. /package/dist/esm/{chunk-X6EPYQKX.js.map → chunk-F5ELD54X.js.map} +0 -0
  134. /package/dist/esm/{chunk-ZN5TRIVZ.js.map → chunk-GV36OVX7.js.map} +0 -0
  135. /package/dist/esm/{chunk-JNAQ76CR.js.map → chunk-HGNWNZ5E.js.map} +0 -0
  136. /package/dist/esm/{chunk-ONDOONBM.js.map → chunk-HUSMC5GZ.js.map} +0 -0
  137. /package/dist/esm/{chunk-UIIXVY6K.js.map → chunk-IQKS662C.js.map} +0 -0
  138. /package/dist/esm/{chunk-5OFXPT4J.js.map → chunk-M62U4QGQ.js.map} +0 -0
  139. /package/dist/esm/{chunk-UQVAEWY2.js.map → chunk-MZJT3USG.js.map} +0 -0
  140. /package/dist/esm/{chunk-FKTDL7KO.js.map → chunk-OAG5T7NC.js.map} +0 -0
  141. /package/dist/esm/{chunk-M2NDSQR5.js.map → chunk-P6YHEIFT.js.map} +0 -0
  142. /package/dist/esm/{chunk-P5VEI574.js.map → chunk-S4CU4XRB.js.map} +0 -0
  143. /package/dist/esm/{chunk-4NBLO5WK.js.map → chunk-X4CMSAET.js.map} +0 -0
  144. /package/dist/esm/{chunk-KQZ3MNK5.js.map → chunk-XNEQHHNV.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/components/MaskedField/MaskedField.tsx", "../../../../src/components/TextField/TextField.tsx", "../../../../src/utils/spaceDelimitedList.ts", "../../../../src/hooks/useLabel/useLabel.tsx", "../../../../src/hooks/useTextField/useTextField.tsx", "../../../../src/hooks/useValidationClasses/useValidationClasses.ts", "../../../../src/components/ErrorMessage/ErrorMessage.tsx", "../../../../src/components/Icon/Icon.tsx", "../../../../src/components/TextOrHTML/TextOrHTML.tsx", "../../../../src/components/Text/Text.tsx", "../../../../src/components/Label/Label.tsx", "../../../../src/components/Stack/Stack.tsx", "../../../../src/components/TextField/adornmentWithClassName.ts"],
4
- "sourcesContent": ["\"use client\";\n\nimport type { ChangeEvent, FocusEvent, Ref, RefAttributes } from \"react\";\nimport { useCallback, useEffect } from \"react\";\nimport { useIMask } from \"react-imask\";\nimport type { FactoryOpts, InputMask, InputMaskElement } from \"imask\";\nimport type { TextFieldProps } from \"../TextField\";\nimport { TextField } from \"../TextField\";\n\nexport type MaskedFieldElementType = HTMLInputElement;\n\nexport interface MaskedFieldProps\n extends\n Omit<TextFieldProps, \"type\" | \"ref\">,\n RefAttributes<MaskedFieldElementType> {\n mask: FactoryOpts;\n \"data-testid\"?: string;\n /**\n * If true, onChange and onBlur events will emit the masked (formatted) value.\n * If false (default), events will emit the unmasked (raw) value.\n *\n * @example\n * // TelephoneQuestion uses useMaskedValue={true}\n * // User types: 5551234567\n * // onChange receives: \"(555) 123-4567\" (formatted for display/storage)\n *\n * @example\n * // CurrencyQuestion uses useMaskedValue={false}\n * // User types: 1234\n * // User sees: \"1,234\" (with thousands separator)\n * // onChange receives: \"1234\" (raw number for calculations)\n */\n useMaskedValue?: boolean;\n}\n\nexport type MaskedFieldRef = Ref<MaskedFieldElementType>;\n\n/**\n * Creates an onChange handler for IMask's onAccept callback.\n *\n * IMask calls onAccept every time the user types and the mask accepts the input.\n * This handler converts IMask's callback into a standard React onChange event.\n *\n * @param onChange - The onChange handler from parent component\n * @param useMaskedValue - Whether to emit the formatted value or raw value\n * @param name - The input's name attribute (for the synthetic event)\n *\n * @example\n * // TelephoneQuestion (US) - useMaskedValue=true\n * // User types: \"5551234567\"\n * // Emits: \"(555) 123-4567\" (formatted for display)\n * // Use case: Want to store/display the formatted phone number\n *\n * @example\n * // CurrencyQuestion - useMaskedValue=false\n * // User types: \"1234.56\"\n * // User sees: \"1,234.56\" (with formatting)\n * // Emits: \"1234.56\" (raw value for calculations)\n * // Use case: Need numeric value for backend/calculations\n */\nconst useAcceptHandler = (\n onChange: MaskedFieldProps[\"onChange\"],\n useMaskedValue: boolean,\n name?: string,\n) => {\n return useCallback(\n (maskedValue: string, maskInstance: InputMask<FactoryOpts>) => {\n // Exit early if no onChange handler provided\n if (!onChange) {\n return;\n }\n\n // IMask provides two values:\n // 1. maskedValue: The formatted value user sees (e.g., \"(555) 123-4567\")\n // 2. maskInstance.unmaskedValue: The raw value without formatting (e.g., \"5551234567\")\n const formattedValue = maskedValue;\n const rawValue = maskInstance.unmaskedValue;\n\n // Choose which value to emit based on useMaskedValue prop\n const valueToEmit = useMaskedValue ? formattedValue : rawValue;\n\n // Create a synthetic React event that matches the standard onChange signature\n // This allows parent components to handle it like any other input change\n onChange({\n target: { name, value: valueToEmit },\n } as ChangeEvent<HTMLInputElement>);\n },\n [onChange, useMaskedValue, name],\n );\n};\n\n/**\n * Creates a ref callback that forwards the input element to both IMask and the parent component.\n *\n * React allows two ways to pass refs:\n * 1. Ref callback function: (element) => { ... }\n * 2. Ref object: { current: element }\n *\n * This hook handles both cases and also ensures IMask gets the element reference it needs.\n *\n * @param imaskRef - IMask's ref (needs the element to apply masking)\n * @param forwardedRef - Parent component's ref (could be function or object)\n *\n * @example\n * // Parent uses callback ref\n * <MaskedField ref={(el) => console.log(el)} />\n *\n * @example\n * // Parent uses useRef\n * const inputRef = useRef(null);\n * <MaskedField ref={inputRef} />\n */\nconst useCombinedRef = (\n imaskRef: React.MutableRefObject<InputMaskElement | null>,\n forwardedRef?: MaskedFieldRef,\n) => {\n return useCallback(\n (element: HTMLInputElement | null) => {\n // First, give the element to IMask so it can apply masking\n imaskRef.current = element;\n\n // Then forward the element to the parent component's ref\n // Handle both callback refs and ref objects\n\n // Case 1: Parent passed a callback ref function\n if (typeof forwardedRef === \"function\") {\n forwardedRef(element);\n }\n // Case 2: Parent passed a ref object (from useRef)\n else if (forwardedRef) {\n forwardedRef.current = element;\n }\n // Case 3: No ref was forwarded (forwardedRef is null/undefined)\n // Do nothing - this is fine\n },\n [imaskRef, forwardedRef],\n );\n};\n\n/**\n * Creates an onBlur handler that extracts the correct value from IMask.\n *\n * When the user tabs away or clicks outside the input, we need to emit\n * the current value (either formatted or raw) via the onBlur event.\n *\n * @param onBlur - The onBlur handler from parent component\n * @param maskRef - Reference to the IMask instance (provides current values)\n * @param useMaskedValue - Whether to emit the formatted value or raw value\n * @param name - The input's name attribute (for the synthetic event)\n *\n * @example\n * // TelephoneQuestion - useMaskedValue=true\n * // Input displays: \"(555) 123-4567\"\n * // onBlur emits: \"(555) 123-4567\" (formatted)\n *\n * @example\n * // CurrencyQuestion - useMaskedValue=false\n * // Input displays: \"$1,234.56\"\n * // onBlur emits: \"1234.56\" (raw for validation/submission)\n */\nconst useBlurHandler = (\n onBlur: MaskedFieldProps[\"onBlur\"],\n maskRef: React.MutableRefObject<InputMask<FactoryOpts> | null>,\n useMaskedValue: boolean,\n name?: string,\n) => {\n return useCallback(\n (event: FocusEvent<Element>) => {\n // Exit early if no onBlur handler provided or mask isn't initialized\n if (!onBlur || !maskRef.current) {\n return;\n }\n\n // Extract current values from the IMask instance\n // maskRef.current.value: The formatted value (e.g., \"(555) 123-4567\")\n // maskRef.current.unmaskedValue: The raw value (e.g., \"5551234567\")\n const formattedValue = maskRef.current.value;\n const rawValue = maskRef.current.unmaskedValue;\n\n // Choose which value to emit based on useMaskedValue prop\n const valueToEmit = useMaskedValue ? formattedValue : rawValue;\n\n // Create an enhanced event that preserves the original event properties\n // but overrides the target to include our extracted value\n onBlur({\n ...event,\n target: { ...event.target, name, value: valueToEmit },\n } as FocusEvent<Element>);\n },\n [onBlur, maskRef, useMaskedValue, name],\n );\n};\n\n/**\n * Controlled MaskedField - for use with value prop.\n * Syncs external value changes to IMask via useEffect.\n *\n * Use this when:\n * - The parent component manages the input state\n * - You need to programmatically update the value\n * - You need validation or transformation on every change\n */\nconst ControlledMaskedField = ({\n mask,\n useMaskedValue = false,\n value,\n onChange,\n onBlur,\n name,\n forwardedRef,\n ...textFieldProps\n}: Omit<MaskedFieldProps, \"defaultValue\"> & {\n value: string | number;\n forwardedRef?: MaskedFieldRef;\n}) => {\n const onAccept = useAcceptHandler(onChange, useMaskedValue, name);\n const { ref: imaskRef, maskRef, setValue } = useIMask(mask, { onAccept });\n\n const combinedRef = useCombinedRef(imaskRef, forwardedRef);\n const handleBlur = useBlurHandler(onBlur, maskRef, useMaskedValue, name);\n\n // Sync external value changes to IMask\n useEffect(() => {\n if (!maskRef.current) {\n return;\n }\n\n const stringValue = value.toString();\n const currentMasked = maskRef.current.value;\n const currentUnmasked = maskRef.current.unmaskedValue;\n\n // Only update if value actually changed (prevents infinite loops)\n if (currentMasked !== stringValue && currentUnmasked !== stringValue) {\n setValue(stringValue);\n }\n }, [value, maskRef, setValue, imaskRef]);\n\n return (\n <TextField\n {...textFieldProps}\n ref={combinedRef}\n name={name}\n onBlur={handleBlur}\n />\n );\n};\n\n/**\n * Uncontrolled MaskedField - for use with defaultValue prop.\n * No value synchronization needed - IMask manages the value internally.\n *\n * Use this when:\n * - You only need the final value on submit\n * - You don't need to react to intermediate changes\n * - You want simpler code without state management\n */\nconst UncontrolledMaskedField = ({\n mask,\n useMaskedValue = false,\n defaultValue,\n onChange,\n onBlur,\n name,\n forwardedRef,\n ...textFieldProps\n}: Omit<MaskedFieldProps, \"value\"> & {\n defaultValue?: string | number;\n forwardedRef?: MaskedFieldRef;\n}) => {\n const onAccept = useAcceptHandler(onChange, useMaskedValue, name);\n const { ref: imaskRef, maskRef } = useIMask(mask, { onAccept });\n\n const combinedRef = useCombinedRef(imaskRef, forwardedRef);\n const handleBlur = useBlurHandler(onBlur, maskRef, useMaskedValue, name);\n\n return (\n <TextField\n {...textFieldProps}\n ref={combinedRef}\n name={name}\n onBlur={handleBlur}\n defaultValue={defaultValue?.toString()}\n />\n );\n};\n\nconst MaskedField = ({ ref: forwardedRef, ...props }: MaskedFieldProps) => {\n const { value, defaultValue, ...rest } = props;\n\n // Check for \"value\" in props (not `value !== undefined`) to maintain consistent\n // controlled/uncontrolled state throughout component lifetime and prevent focus loss.\n // Example: CurrencyQuestion passes value={undefined} initially, then value={5} after typing.\n if (\"value\" in props) {\n return (\n <ControlledMaskedField\n {...rest}\n value={value ?? \"\"}\n forwardedRef={forwardedRef}\n />\n );\n } else {\n return (\n <UncontrolledMaskedField\n {...rest}\n defaultValue={defaultValue}\n forwardedRef={forwardedRef}\n />\n );\n }\n};\n\nMaskedField.displayName = \"MaskedField\";\n\nexport { MaskedField };\n", "\"use client\";\n\nimport classNames from \"classnames/dedupe\";\nimport type {\n HTMLInputTypeAttribute,\n ReactElement,\n ReactNode,\n Ref,\n RefAttributes,\n} from \"react\";\nimport type { UseTextFieldProps } from \"../../hooks\";\nimport { useTextField, useValidationClasses } from \"../../hooks\";\nimport type { DOMProps, FocusEvents } from \"../../types\";\nimport { ErrorMessage } from \"../ErrorMessage\";\nimport { Label } from \"../Label\";\nimport { Stack } from \"../Stack\";\nimport { adornmentWithClassName } from \"./adornmentWithClassName\";\nimport \"./TextField.css\";\n\nexport type TextFieldElementType = HTMLInputElement;\nexport interface TextFieldProps\n extends\n DOMProps,\n FocusEvents,\n UseTextFieldProps,\n RefAttributes<TextFieldElementType> {\n className?: string;\n errorMessage?: string;\n children?: ReactNode;\n label?: string;\n type?: Exclude<\n HTMLInputTypeAttribute,\n | \"button\"\n | \"checkbox\"\n | \"color\"\n | \"date\"\n | \"datetime-local\"\n | \"file\"\n | \"image\"\n | \"month\"\n | \"radio\"\n | \"range\"\n | \"reset\"\n | \"submit\"\n | \"week\"\n >;\n prefixInside?: ReactElement;\n prefixOutside?: ReactElement;\n suffixInside?: ReactElement;\n suffixOutside?: ReactElement;\n}\n\nexport type TextFieldRef = Ref<TextFieldElementType>;\n\nconst TextField = ({ ref, ...props }: TextFieldProps) => {\n const {\n isDisabled,\n type = \"text\",\n isInvalid,\n className,\n label,\n errorMessage,\n children,\n isRequired,\n prefixInside,\n prefixOutside,\n suffixInside,\n suffixOutside,\n autoComplete,\n isReadOnly,\n ...otherProps\n } = props;\n\n const resolvedAutoComplete =\n autoComplete ??\n (type === \"email\" ? \"email\" : type === \"tel\" ? \"tel\" : undefined);\n\n const { inputProps, labelProps, errorMessageProps } = useTextField({\n ...props,\n autoComplete: resolvedAutoComplete,\n \"aria-errormessage\": errorMessage,\n });\n\n const hidden = type === \"hidden\";\n\n const validationClasses = useValidationClasses({ isInvalid });\n\n const textfieldClasses = {\n \"--is-disabled\": isDisabled,\n \"--is-required\": typeof isRequired === \"boolean\" && isRequired,\n \"--is-optional\": typeof isRequired === \"boolean\" && !isRequired,\n \"--is-hidden\": hidden,\n [className || \"\"]: true,\n };\n\n const sharedClasses = classNames(validationClasses, textfieldClasses);\n\n const labelClasses = classNames(\n {\n \"--is-disabled\": isDisabled,\n },\n validationClasses,\n );\n\n const containerClasses = classNames(\n \"mobius\",\n \"mobius-text-field\",\n sharedClasses,\n );\n\n const inputClasses = classNames(\n \"mobius\",\n \"mobius-text-field__input\",\n sharedClasses,\n );\n\n const inputWrapperClasses = classNames(\n \"mobius-text-field__input-wrapper\",\n sharedClasses,\n );\n\n return (\n <Stack gap=\"xs\" className={containerClasses}>\n {label && !hidden && (\n <Label {...labelProps} className={labelClasses}>\n {label}\n </Label>\n )}\n <div className=\"mobius-text-field__inner-container\">\n {adornmentWithClassName(\n prefixOutside,\n labelClasses,\n \"mobius-text-field__prefix-outside\",\n )}\n <div className={inputWrapperClasses}>\n {adornmentWithClassName(\n prefixInside,\n labelClasses,\n \"mobius-text-field__prefix-inside\",\n )}\n <input\n {...otherProps}\n {...inputProps}\n ref={ref}\n type={type}\n className={inputClasses}\n />\n {adornmentWithClassName(\n suffixInside,\n labelClasses,\n \"mobius-text-field__suffix-inside\",\n )}\n </div>\n {adornmentWithClassName(\n suffixOutside,\n labelClasses,\n \"mobius-text-field__suffix-outside\",\n )}\n </div>\n {children && (\n <div className=\"mobius-text-field__children\">{children}</div>\n )}\n\n <ErrorMessage {...errorMessageProps} errorMessage={errorMessage} />\n </Stack>\n );\n};\n\nTextField.displayName = \"TextField\";\nexport { TextField };\n", "export function spaceDelimitedList(\n list: (string | null | undefined)[],\n): string | undefined {\n return list.filter(Boolean).join(\" \") || undefined;\n}\n", "import type { LabelHTMLAttributes } from \"react\";\nimport { useId, useRef } from \"react\";\n\nexport type UseLabelProps = {\n id?: string | undefined;\n label?: string | undefined;\n \"aria-label\"?: string | undefined;\n \"aria-labelledby\"?: string | undefined;\n labelElementType?: \"label\" | \"span\" | undefined;\n};\n\nexport type UseLabelReturn = {\n labelProps: {\n id?: string | undefined;\n } & LabelHTMLAttributes<HTMLLabelElement>;\n fieldProps: LabellingProps;\n};\n\nexport type LabellingProps = {\n id?: string | undefined;\n \"aria-label\"?: string | undefined;\n \"aria-labelledby\"?: string | undefined;\n \"aria-describedby\"?: string | undefined;\n \"aria-details\"?: string | undefined;\n};\n\nexport function useLabel({\n id: providedId,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n labelElementType = \"label\",\n}: UseLabelProps) {\n let labelProps: UseLabelReturn[\"labelProps\"] = {};\n let fieldProps: UseLabelReturn[\"fieldProps\"] = {};\n\n const hasWarnedAboutMissingLabels = useRef(false);\n\n const fallbackId = useId();\n const id = providedId || fallbackId;\n const labelId = useId();\n\n if (label) {\n ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;\n labelProps = {\n id: labelId,\n htmlFor: labelElementType === \"label\" ? id : undefined,\n };\n } else if (\n !ariaLabelledby &&\n !ariaLabel &&\n !hasWarnedAboutMissingLabels.current\n ) {\n hasWarnedAboutMissingLabels.current = true;\n console.warn(\n \"If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility\",\n );\n }\n\n fieldProps = {\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n };\n\n return {\n labelProps,\n fieldProps,\n };\n}\n", "import { useId } from \"react\";\nimport { spaceDelimitedList } from \"../../utils/spaceDelimitedList\";\nimport { useLabel } from \"../useLabel/useLabel\";\nimport type { UseTextFieldProps, UseTextFieldReturn } from \"./types\";\n\nexport function useTextField(props: UseTextFieldProps): UseTextFieldReturn {\n const {\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n inputElementType = \"input\",\n } = props;\n const { labelProps, fieldProps } = useLabel(props);\n\n const descriptionId = useId();\n const descriptionProps = { id: descriptionId };\n\n const errorMessageId = useId();\n const errorMessageProps = { id: errorMessageId };\n\n const ariaDescribedBy = spaceDelimitedList([\n props.description && descriptionId,\n props.errorMessage && errorMessageId,\n props[\"aria-describedby\"],\n ]);\n\n return {\n descriptionProps,\n errorMessageProps,\n labelProps,\n inputProps: {\n defaultValue: props.defaultValue,\n value: props.value,\n onChange: props.onChange,\n disabled: isDisabled,\n readOnly: isReadOnly,\n required: isRequired,\n \"aria-required\": isRequired === true ? true : undefined,\n \"aria-invalid\": props.isInvalid,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": props[\"aria-errormessage\"],\n role: props.role,\n\n type: inputElementType === \"input\" ? props.type : undefined,\n pattern: inputElementType === \"input\" ? props.pattern : undefined,\n\n autoComplete: props.autoComplete,\n maxLength: props.maxLength,\n minLength: props.minLength,\n name: props.name,\n placeholder: props.placeholder,\n inputMode: props.inputMode,\n\n // Clipboard events\n onCopy: props.onCopy,\n onCut: props.onCut,\n onPaste: props.onPaste,\n\n // Composition events\n onCompositionEnd: props.onCompositionEnd,\n onCompositionStart: props.onCompositionStart,\n onCompositionUpdate: props.onCompositionUpdate,\n\n // Selection events\n onSelect: props.onSelect,\n\n // Input events\n onBeforeInput: props.onBeforeInput,\n onInput: props.onInput,\n\n // Focus events\n onFocus: props.onFocus,\n onBlur: props.onBlur,\n\n ...fieldProps,\n },\n };\n}\n", "import type { Validation } from \"../../types\";\n\nexport type GetValidationClassesProps = Pick<Validation, \"isInvalid\">;\n\nexport const useValidationClasses = (props: GetValidationClassesProps) => {\n const { isInvalid } = props;\n\n if (isInvalid) {\n return \"--is-invalid\";\n }\n\n if (isInvalid === false) {\n return \"--is-valid\";\n }\n\n return \"\";\n};\n", "import { error } from \"@simplybusiness/icons\";\nimport classNames from \"classnames/dedupe\";\nimport { Icon } from \"../Icon\";\nimport { TextOrHTML } from \"../TextOrHTML\";\nimport \"./ErrorMessage.css\";\n\nexport interface ErrorMessageProps {\n errorMessage?: string;\n id?: string;\n className?: string;\n}\n\nexport const ErrorMessage = ({\n id,\n errorMessage,\n className,\n}: ErrorMessageProps) => {\n const classes = classNames(\"mobius\", \"mobius-error-message\", className);\n\n if (!errorMessage) return null;\n\n return (\n <div id={id} className={classes} data-testid=\"ErrorMessage\" role=\"alert\">\n <Icon\n icon={error}\n className=\"mobius-error-message__icon\"\n aria-hidden=\"true\"\n />\n <TextOrHTML\n elementType=\"span\"\n className=\"mobius-error-message__text\"\n text={errorMessage}\n />\n </div>\n );\n};\n\nErrorMessage.displayName = \"ErrorMessage\";\n", "import classNames from \"classnames/dedupe\";\nimport type { IconProps } from \"./types\";\nimport \"./Icon.css\";\n\nconst ICON_PREFIX = \"mobius-icon\";\n\nconst capitaliseFirstLetter = (str: string) =>\n str.charAt(0).toUpperCase() + str.slice(1);\n\nexport function Icon({\n ref,\n icon,\n className,\n size = \"xs\",\n color,\n fixedWidth,\n spin,\n spinReverse,\n title,\n ...otherProps\n}: IconProps) {\n if (!icon) {\n throw new Error(\"Must specify icon object\");\n }\n\n const classes = classNames(\n \"mobius\",\n \"mobius-icon\",\n `svg-inline--${ICON_PREFIX}`,\n `--size-${size}`,\n className,\n {\n [`${ICON_PREFIX}-fw`]: fixedWidth,\n [`${ICON_PREFIX}-spin`]: spin || spinReverse,\n [`${ICON_PREFIX}-spin-reverse`]: spinReverse,\n },\n );\n\n const { iconName, width, height, svgPathData } = icon;\n const formattedIconName = iconName.split(\"-\").join(\" \");\n\n const defaultTitle = `${capitaliseFirstLetter(formattedIconName)} icon`;\n const titleText = title || defaultTitle;\n\n return (\n <svg\n ref={ref}\n focusable=\"false\"\n data-icon={iconName}\n className={classes}\n role=\"img\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox={`0 0 ${width} ${height}`}\n style={{ color }}\n {...otherProps}\n >\n <title>{titleText}</title>\n <path fill=\"currentColor\" d={svgPathData} />\n </svg>\n );\n}\n", "import classNames from \"classnames/dedupe\";\nimport type { RefAttributes } from \"react\";\nimport { useMemo } from \"react\";\nimport type { TextElementType, TextProps } from \"../Text/Text\";\nimport { Text, getElementType } from \"../Text/Text\";\n\nexport type HTMLElementType = \"span\" | \"div\";\n\nconst isBlockHTML = (text: string) => /^\\s*<[a-z]/i.test(text);\nconst containsHTML = (text: string) =>\n /<[a-z/]/i.test(text) || /&(?:#\\d+|#x[\\da-f]+|[a-z]\\w*);/i.test(text); // tag or entity\n\nconst buildTextClasses = (\n textProps: Omit<TextProps, \"children\">,\n htmlClassName?: string,\n) => {\n const { variant, elementType, spacing, className } = textProps;\n const variantType = variant || getElementType(variant, elementType);\n return classNames(\n \"mobius\",\n \"mobius-text\",\n { [`--is-${variantType}`]: variantType },\n { [`--has-line-height-${spacing}`]: spacing },\n className,\n htmlClassName,\n );\n};\n\nexport interface TextOrHTMLProps\n extends Omit<TextProps, \"children\">, RefAttributes<TextElementType> {\n /** HTML string to be rendered with dangerouslySetInnerHTML */\n text: string;\n /** Custom class name for the dangerous HTML element */\n htmlClassName?: string;\n /** HTML element type for the dangerous HTML element */\n htmlElementType?: HTMLElementType;\n /** If true, wraps the dangerous HTML element inside a Text component */\n textWrapper?: boolean;\n /** If true, auto-detects whether text is HTML or plain text to determine wrapping and element type */\n autoDetect?: boolean;\n}\n\nconst TextOrHTML = ({\n ref,\n text,\n htmlClassName,\n htmlElementType,\n textWrapper = false,\n autoDetect = false,\n ...textProps\n}: TextOrHTMLProps) => {\n const textIsBlockHTML = autoDetect && isBlockHTML(text);\n\n // Memoize the dangerouslySetInnerHTML object to prevent unnecessary re-renders\n // See: https://github.com/facebook/react/issues/31660\n const dangerousHTML = useMemo(() => ({ __html: text }), [text]);\n\n // Non-block text with autoDetect: render directly on a Text-equivalent element,\n // avoiding unnecessary <span> nesting inside <p>.\n if (autoDetect && !textIsBlockHTML) {\n const { variant, spacing, elementType, className, ...domProps } = textProps;\n const Element = getElementType(variant, elementType);\n const classes = buildTextClasses(textProps, htmlClassName);\n\n return containsHTML(text) ? (\n <Element\n ref={ref}\n {...domProps}\n className={classes}\n dangerouslySetInnerHTML={dangerousHTML}\n />\n ) : (\n <Element ref={ref} {...domProps} className={classes}>\n {text}\n </Element>\n );\n }\n\n const DangerousComponent =\n htmlElementType ?? (textIsBlockHTML ? \"div\" : \"span\");\n const dangerousElement = (\n <DangerousComponent\n className={htmlClassName}\n dangerouslySetInnerHTML={dangerousHTML}\n />\n );\n\n if (textWrapper) {\n return (\n <Text ref={ref} {...textProps}>\n {dangerousElement}\n </Text>\n );\n }\n\n return dangerousElement;\n};\n\nTextOrHTML.displayName = \"TextOrHTML\";\nexport { TextOrHTML };\n", "import type { ReactNode, RefAttributes } from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport type { DOMProps } from \"../../types/dom\";\nimport \"./Text.css\";\n\nexport type TextElementType = HTMLHeadingElement | HTMLParagraphElement;\nexport type TextVariantType =\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"body\"\n | \"small\"\n | \"legal\"\n | \"title\";\nexport type ElementType = \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"p\" | \"span\";\nexport interface TextProps extends DOMProps, RefAttributes<TextElementType> {\n /** HTML element for the text */\n elementType?: ElementType;\n /** Specify font size override */\n variant?: TextVariantType;\n /** Specify compact line height override */\n spacing?: \"loose\" | \"tight\";\n /** Custom class name for setting specific CSS */\n className?: string;\n children: ReactNode;\n style?: React.CSSProperties;\n}\n\nexport const getElementType = (\n variant: TextVariantType | undefined,\n elementType: ElementType | undefined,\n): ElementType => {\n // Explicit elementType always wins\n if (elementType) {\n return elementType;\n }\n // Infer element from variant\n if (variant && [\"h1\", \"h2\", \"h3\", \"h4\"].includes(variant)) {\n return variant as ElementType;\n }\n return \"p\";\n};\n\nconst Text = ({ ref, elementType, ...props }: TextProps) => {\n // Remove non-DOM props from element\n const { variant, className, spacing, ...otherProps } = props;\n\n // If a variant is supplied, set the class name and element type\n const Element: ElementType = getElementType(variant, elementType);\n const variantType = variant || Element;\n const classes = classNames(\n \"mobius\",\n \"mobius-text\",\n { [`--is-${variantType}`]: variantType },\n { [`--has-line-height-${spacing}`]: spacing },\n className,\n );\n\n return <Element ref={ref} {...otherProps} className={classes} />;\n};\n\nText.displayName = \"Text\";\nexport { Text };\n", "import type React from \"react\";\nimport type { ReactNode, RefAttributes } from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport type { DOMProps } from \"../../types/dom\";\nimport \"./Label.css\";\n\nexport type LabelElementType = HTMLLabelElement;\nexport type IntrinsicLabel = Omit<\n React.JSX.IntrinsicElements[\"label\"],\n \"css\" | \"color\" | \"ref\"\n>;\n\nexport interface LabelProps\n extends IntrinsicLabel, DOMProps, RefAttributes<LabelElementType> {\n children?: ReactNode;\n className?: string;\n elementType?: \"label\" | \"span\";\n}\n\nconst Label = ({ ref, ...props }: LabelProps) => {\n const { elementType: Element = \"label\", children, ...otherProps } = props;\n\n const classes = classNames(\"mobius\", \"mobius-label\", props.className);\n otherProps.className = classes;\n\n return (\n <Element ref={ref} {...otherProps} className={classes}>\n {children}\n </Element>\n );\n};\n\nLabel.displayName = \"Label\";\nexport { Label };\n", "import type { Ref, RefAttributes, ReactNode } from \"react\";\nimport type React from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport type { DOMProps } from \"../../types/dom\";\nimport type { SpacingType } from \"../../types\";\nimport \"./Stack.css\";\n\nexport type StackElementType = HTMLDivElement;\n\nexport interface StackProps extends DOMProps, RefAttributes<StackElementType> {\n children?: ReactNode;\n /** How big a gap between items */\n gap?: SpacingType;\n /** Custom class name for setting specific CSS */\n className?: string;\n elementType?: React.ElementType;\n}\n\nexport type StackRef = Ref<StackElementType>;\n\nexport const Stack = ({ ref, ...props }: StackProps) => {\n const { elementType: Element = \"div\", gap, ...otherProps } = props;\n\n const classes = classNames(\n \"mobius\",\n \"mobius-stack\",\n {\n [`--gap-${gap}`]: gap,\n },\n otherProps.className,\n );\n\n return <Element ref={ref} {...otherProps} className={classes} />;\n};\n\nStack.displayName = \"Stack\";\n", "import classNames from \"classnames/dedupe\";\nimport type { ReactElement } from \"react\";\nimport { cloneElement } from \"react\";\n\nexport const adornmentWithClassName = (\n component?: ReactElement,\n validationClasses?: string,\n className?: string,\n) => {\n if (!component) return null;\n\n return cloneElement(component, {\n className: classNames(\n (component.props as { className?: string }).className,\n validationClasses,\n className,\n ),\n } as { className: string });\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,IAAAA,gBAAuC;AACvC,yBAAyB;;;ACFzB,IAAAC,iBAAuB;;;ACFhB,SAAS,mBACd,MACoB;AACpB,SAAO,KAAK,OAAO,OAAO,EAAE,KAAK,GAAG,KAAK;AAC3C;;;ACHA,mBAA8B;AAyBvB,SAAS,SAAS;AAAA,EACvB,IAAI;AAAA,EACJ;AAAA,EACA,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,mBAAmB;AACrB,GAAkB;AAChB,MAAI,aAA2C,CAAC;AAChD,MAAI,aAA2C,CAAC;AAEhD,QAAM,kCAA8B,qBAAO,KAAK;AAEhD,QAAM,iBAAa,oBAAM;AACzB,QAAM,KAAK,cAAc;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EJ,OAAO;AACL,WACE;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;",
4
+ "sourcesContent": ["\"use client\";\n\nimport type { ChangeEvent, FocusEvent, Ref, RefAttributes } from \"react\";\nimport { useCallback, useEffect } from \"react\";\nimport { useIMask } from \"react-imask\";\nimport type { FactoryOpts, InputMask, InputMaskElement } from \"imask\";\nimport type { TextFieldProps } from \"../TextField\";\nimport { TextField } from \"../TextField\";\n\nexport type MaskedFieldElementType = HTMLInputElement;\n\nexport interface MaskedFieldProps\n extends\n Omit<TextFieldProps, \"type\" | \"ref\">,\n RefAttributes<MaskedFieldElementType> {\n mask: FactoryOpts;\n \"data-testid\"?: string;\n /**\n * If true, onChange and onBlur events will emit the masked (formatted) value.\n * If false (default), events will emit the unmasked (raw) value.\n *\n * @example\n * // TelephoneQuestion uses useMaskedValue={true}\n * // User types: 5551234567\n * // onChange receives: \"(555) 123-4567\" (formatted for display/storage)\n *\n * @example\n * // CurrencyQuestion uses useMaskedValue={false}\n * // User types: 1234\n * // User sees: \"1,234\" (with thousands separator)\n * // onChange receives: \"1234\" (raw number for calculations)\n */\n useMaskedValue?: boolean;\n}\n\nexport type MaskedFieldRef = Ref<MaskedFieldElementType>;\n\n/**\n * Creates an onChange handler for IMask's onAccept callback.\n *\n * IMask calls onAccept every time the user types and the mask accepts the input.\n * This handler converts IMask's callback into a standard React onChange event.\n *\n * @param onChange - The onChange handler from parent component\n * @param useMaskedValue - Whether to emit the formatted value or raw value\n * @param name - The input's name attribute (for the synthetic event)\n *\n * @example\n * // TelephoneQuestion (US) - useMaskedValue=true\n * // User types: \"5551234567\"\n * // Emits: \"(555) 123-4567\" (formatted for display)\n * // Use case: Want to store/display the formatted phone number\n *\n * @example\n * // CurrencyQuestion - useMaskedValue=false\n * // User types: \"1234.56\"\n * // User sees: \"1,234.56\" (with formatting)\n * // Emits: \"1234.56\" (raw value for calculations)\n * // Use case: Need numeric value for backend/calculations\n */\nconst useAcceptHandler = (\n onChange: MaskedFieldProps[\"onChange\"],\n useMaskedValue: boolean,\n name?: string,\n) => {\n return useCallback(\n (maskedValue: string, maskInstance: InputMask<FactoryOpts>) => {\n // Exit early if no onChange handler provided\n if (!onChange) {\n return;\n }\n\n // IMask provides two values:\n // 1. maskedValue: The formatted value user sees (e.g., \"(555) 123-4567\")\n // 2. maskInstance.unmaskedValue: The raw value without formatting (e.g., \"5551234567\")\n const formattedValue = maskedValue;\n const rawValue = maskInstance.unmaskedValue;\n\n // Choose which value to emit based on useMaskedValue prop\n const valueToEmit = useMaskedValue ? formattedValue : rawValue;\n\n // Create a synthetic React event that matches the standard onChange signature\n // This allows parent components to handle it like any other input change\n onChange({\n target: { name, value: valueToEmit },\n } as ChangeEvent<HTMLInputElement>);\n },\n [onChange, useMaskedValue, name],\n );\n};\n\n/**\n * Creates a ref callback that forwards the input element to both IMask and the parent component.\n *\n * React allows two ways to pass refs:\n * 1. Ref callback function: (element) => { ... }\n * 2. Ref object: { current: element }\n *\n * This hook handles both cases and also ensures IMask gets the element reference it needs.\n *\n * @param imaskRef - IMask's ref (needs the element to apply masking)\n * @param forwardedRef - Parent component's ref (could be function or object)\n *\n * @example\n * // Parent uses callback ref\n * <MaskedField ref={(el) => console.log(el)} />\n *\n * @example\n * // Parent uses useRef\n * const inputRef = useRef(null);\n * <MaskedField ref={inputRef} />\n */\nconst useCombinedRef = (\n imaskRef: React.MutableRefObject<InputMaskElement | null>,\n forwardedRef?: MaskedFieldRef,\n) => {\n return useCallback(\n (element: HTMLInputElement | null) => {\n // First, give the element to IMask so it can apply masking\n imaskRef.current = element;\n\n // Then forward the element to the parent component's ref\n // Handle both callback refs and ref objects\n\n // Case 1: Parent passed a callback ref function\n if (typeof forwardedRef === \"function\") {\n forwardedRef(element);\n }\n // Case 2: Parent passed a ref object (from useRef)\n else if (forwardedRef) {\n forwardedRef.current = element;\n }\n // Case 3: No ref was forwarded (forwardedRef is null/undefined)\n // Do nothing - this is fine\n },\n [imaskRef, forwardedRef],\n );\n};\n\n/**\n * Creates an onBlur handler that extracts the correct value from IMask.\n *\n * When the user tabs away or clicks outside the input, we need to emit\n * the current value (either formatted or raw) via the onBlur event.\n *\n * @param onBlur - The onBlur handler from parent component\n * @param maskRef - Reference to the IMask instance (provides current values)\n * @param useMaskedValue - Whether to emit the formatted value or raw value\n * @param name - The input's name attribute (for the synthetic event)\n *\n * @example\n * // TelephoneQuestion - useMaskedValue=true\n * // Input displays: \"(555) 123-4567\"\n * // onBlur emits: \"(555) 123-4567\" (formatted)\n *\n * @example\n * // CurrencyQuestion - useMaskedValue=false\n * // Input displays: \"$1,234.56\"\n * // onBlur emits: \"1234.56\" (raw for validation/submission)\n */\nconst useBlurHandler = (\n onBlur: MaskedFieldProps[\"onBlur\"],\n maskRef: React.MutableRefObject<InputMask<FactoryOpts> | null>,\n useMaskedValue: boolean,\n name?: string,\n) => {\n return useCallback(\n (event: FocusEvent<Element>) => {\n // Exit early if no onBlur handler provided or mask isn't initialized\n if (!onBlur || !maskRef.current) {\n return;\n }\n\n // Extract current values from the IMask instance\n // maskRef.current.value: The formatted value (e.g., \"(555) 123-4567\")\n // maskRef.current.unmaskedValue: The raw value (e.g., \"5551234567\")\n const formattedValue = maskRef.current.value;\n const rawValue = maskRef.current.unmaskedValue;\n\n // Choose which value to emit based on useMaskedValue prop\n const valueToEmit = useMaskedValue ? formattedValue : rawValue;\n\n // Create an enhanced event that preserves the original event properties\n // but overrides the target to include our extracted value\n onBlur({\n ...event,\n target: { ...event.target, name, value: valueToEmit },\n } as FocusEvent<Element>);\n },\n [onBlur, maskRef, useMaskedValue, name],\n );\n};\n\n/**\n * Controlled MaskedField - for use with value prop.\n * Syncs external value changes to IMask via useEffect.\n *\n * Use this when:\n * - The parent component manages the input state\n * - You need to programmatically update the value\n * - You need validation or transformation on every change\n */\nconst ControlledMaskedField = ({\n mask,\n useMaskedValue = false,\n value,\n onChange,\n onBlur,\n name,\n forwardedRef,\n ...textFieldProps\n}: Omit<MaskedFieldProps, \"defaultValue\"> & {\n value: string | number;\n forwardedRef?: MaskedFieldRef;\n}) => {\n const onAccept = useAcceptHandler(onChange, useMaskedValue, name);\n const { ref: imaskRef, maskRef, setValue } = useIMask(mask, { onAccept });\n\n const combinedRef = useCombinedRef(imaskRef, forwardedRef);\n const handleBlur = useBlurHandler(onBlur, maskRef, useMaskedValue, name);\n\n // Sync external value changes to IMask\n useEffect(() => {\n if (!maskRef.current) {\n return;\n }\n\n const stringValue = value.toString();\n const currentMasked = maskRef.current.value;\n const currentUnmasked = maskRef.current.unmaskedValue;\n\n // Only update if value actually changed (prevents infinite loops)\n if (currentMasked !== stringValue && currentUnmasked !== stringValue) {\n setValue(stringValue);\n }\n }, [value, maskRef, setValue, imaskRef]);\n\n return (\n <TextField\n {...textFieldProps}\n ref={combinedRef}\n name={name}\n onBlur={handleBlur}\n />\n );\n};\n\n/**\n * Uncontrolled MaskedField - for use with defaultValue prop.\n * No value synchronization needed - IMask manages the value internally.\n *\n * Use this when:\n * - You only need the final value on submit\n * - You don't need to react to intermediate changes\n * - You want simpler code without state management\n */\nconst UncontrolledMaskedField = ({\n mask,\n useMaskedValue = false,\n defaultValue,\n onChange,\n onBlur,\n name,\n forwardedRef,\n ...textFieldProps\n}: Omit<MaskedFieldProps, \"value\"> & {\n defaultValue?: string | number;\n forwardedRef?: MaskedFieldRef;\n}) => {\n const onAccept = useAcceptHandler(onChange, useMaskedValue, name);\n const { ref: imaskRef, maskRef } = useIMask(mask, { onAccept });\n\n const combinedRef = useCombinedRef(imaskRef, forwardedRef);\n const handleBlur = useBlurHandler(onBlur, maskRef, useMaskedValue, name);\n\n return (\n <TextField\n {...textFieldProps}\n ref={combinedRef}\n name={name}\n onBlur={handleBlur}\n defaultValue={defaultValue?.toString()}\n />\n );\n};\n\nconst MaskedField = ({ ref: forwardedRef, ...props }: MaskedFieldProps) => {\n const { value, defaultValue, ...rest } = props;\n\n // Check for \"value\" in props (not `value !== undefined`) to maintain consistent\n // controlled/uncontrolled state throughout component lifetime and prevent focus loss.\n // Example: CurrencyQuestion passes value={undefined} initially, then value={5} after typing.\n if (\"value\" in props) {\n return (\n <ControlledMaskedField\n {...rest}\n value={value ?? \"\"}\n forwardedRef={forwardedRef}\n />\n );\n } else {\n return (\n <UncontrolledMaskedField\n {...rest}\n defaultValue={defaultValue}\n forwardedRef={forwardedRef}\n />\n );\n }\n};\n\nMaskedField.displayName = \"MaskedField\";\n\nexport { MaskedField };\n", "\"use client\";\n\nimport classNames from \"classnames/dedupe\";\nimport type {\n HTMLInputTypeAttribute,\n ReactElement,\n ReactNode,\n Ref,\n RefAttributes,\n} from \"react\";\nimport type { UseTextFieldProps } from \"../../hooks\";\nimport { useTextField, useValidationClasses } from \"../../hooks\";\nimport type { DOMProps, FocusEvents } from \"../../types\";\nimport { ErrorMessage } from \"../ErrorMessage\";\nimport { Label } from \"../Label\";\nimport { Stack } from \"../Stack\";\nimport { adornmentWithClassName } from \"./adornmentWithClassName\";\nimport \"./TextField.css\";\n\nexport type TextFieldElementType = HTMLInputElement;\nexport interface TextFieldProps\n extends\n DOMProps,\n FocusEvents,\n UseTextFieldProps,\n RefAttributes<TextFieldElementType> {\n className?: string;\n errorMessage?: string;\n children?: ReactNode;\n label?: string;\n type?: Exclude<\n HTMLInputTypeAttribute,\n | \"button\"\n | \"checkbox\"\n | \"color\"\n | \"date\"\n | \"datetime-local\"\n | \"file\"\n | \"image\"\n | \"month\"\n | \"radio\"\n | \"range\"\n | \"reset\"\n | \"submit\"\n | \"week\"\n >;\n prefixInside?: ReactElement;\n prefixOutside?: ReactElement;\n suffixInside?: ReactElement;\n suffixOutside?: ReactElement;\n}\n\nexport type TextFieldRef = Ref<TextFieldElementType>;\n\nconst TextField = ({ ref, ...props }: TextFieldProps) => {\n const {\n isDisabled,\n type = \"text\",\n isInvalid,\n className,\n label,\n errorMessage,\n children,\n isRequired,\n prefixInside,\n prefixOutside,\n suffixInside,\n suffixOutside,\n autoComplete,\n isReadOnly,\n ...otherProps\n } = props;\n\n const resolvedAutoComplete =\n autoComplete ??\n (type === \"email\" ? \"email\" : type === \"tel\" ? \"tel\" : undefined);\n\n const { inputProps, labelProps, errorMessageProps } = useTextField({\n ...props,\n autoComplete: resolvedAutoComplete,\n \"aria-errormessage\": errorMessage,\n });\n\n const hidden = type === \"hidden\";\n\n const validationClasses = useValidationClasses({ isInvalid });\n\n const textfieldClasses = {\n \"--is-disabled\": isDisabled,\n \"--is-required\": typeof isRequired === \"boolean\" && isRequired,\n \"--is-optional\": typeof isRequired === \"boolean\" && !isRequired,\n \"--is-hidden\": hidden,\n [className || \"\"]: true,\n };\n\n const sharedClasses = classNames(validationClasses, textfieldClasses);\n\n const labelClasses = classNames(\n {\n \"--is-disabled\": isDisabled,\n },\n validationClasses,\n );\n\n const containerClasses = classNames(\n \"mobius\",\n \"mobius-text-field\",\n sharedClasses,\n );\n\n const inputClasses = classNames(\n \"mobius\",\n \"mobius-text-field__input\",\n sharedClasses,\n );\n\n const inputWrapperClasses = classNames(\n \"mobius-text-field__input-wrapper\",\n sharedClasses,\n );\n\n return (\n <Stack gap=\"xs\" className={containerClasses}>\n {label && !hidden && (\n <Label {...labelProps} className={labelClasses}>\n {label}\n </Label>\n )}\n <div className=\"mobius-text-field__inner-container\">\n {adornmentWithClassName(\n prefixOutside,\n labelClasses,\n \"mobius-text-field__prefix-outside\",\n )}\n <div className={inputWrapperClasses}>\n {adornmentWithClassName(\n prefixInside,\n labelClasses,\n \"mobius-text-field__prefix-inside\",\n )}\n <input\n {...otherProps}\n {...inputProps}\n ref={ref}\n type={type}\n className={inputClasses}\n />\n {adornmentWithClassName(\n suffixInside,\n labelClasses,\n \"mobius-text-field__suffix-inside\",\n )}\n </div>\n {adornmentWithClassName(\n suffixOutside,\n labelClasses,\n \"mobius-text-field__suffix-outside\",\n )}\n </div>\n {children && (\n <div className=\"mobius-text-field__children\">{children}</div>\n )}\n\n <ErrorMessage {...errorMessageProps} errorMessage={errorMessage} />\n </Stack>\n );\n};\n\nTextField.displayName = \"TextField\";\nexport { TextField };\n", "export function spaceDelimitedList(\n list: (string | null | undefined)[],\n): string | undefined {\n return list.filter(Boolean).join(\" \") || undefined;\n}\n", "import type { LabelHTMLAttributes } from \"react\";\nimport { useId, useRef } from \"react\";\n\nexport type UseLabelProps = {\n id?: string | undefined;\n label?: string | undefined;\n \"aria-label\"?: string | undefined;\n \"aria-labelledby\"?: string | undefined;\n labelElementType?: \"label\" | \"span\" | undefined;\n};\n\nexport type UseLabelReturn = {\n labelProps: {\n id?: string | undefined;\n } & LabelHTMLAttributes<HTMLLabelElement>;\n fieldProps: LabellingProps;\n};\n\nexport type LabellingProps = {\n id?: string | undefined;\n \"aria-label\"?: string | undefined;\n \"aria-labelledby\"?: string | undefined;\n \"aria-describedby\"?: string | undefined;\n \"aria-details\"?: string | undefined;\n};\n\nexport function useLabel({\n id: providedId,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n labelElementType = \"label\",\n}: UseLabelProps) {\n let labelProps: UseLabelReturn[\"labelProps\"] = {};\n let fieldProps: UseLabelReturn[\"fieldProps\"] = {};\n\n const hasWarnedAboutMissingLabels = useRef(false);\n\n const fallbackId = useId();\n const id = providedId || fallbackId;\n const labelId = useId();\n\n if (label) {\n ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;\n labelProps = {\n id: labelId,\n htmlFor: labelElementType === \"label\" ? id : undefined,\n };\n } else if (\n !ariaLabelledby &&\n !ariaLabel &&\n !hasWarnedAboutMissingLabels.current\n ) {\n hasWarnedAboutMissingLabels.current = true;\n console.warn(\n \"If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility\",\n );\n }\n\n fieldProps = {\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n };\n\n return {\n labelProps,\n fieldProps,\n };\n}\n", "import { useId } from \"react\";\nimport { spaceDelimitedList } from \"../../utils/spaceDelimitedList\";\nimport { useLabel } from \"../useLabel/useLabel\";\nimport type { UseTextFieldProps, UseTextFieldReturn } from \"./types\";\n\nexport function useTextField(props: UseTextFieldProps): UseTextFieldReturn {\n const {\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n inputElementType = \"input\",\n } = props;\n const { labelProps, fieldProps } = useLabel(props);\n\n const descriptionId = useId();\n const descriptionProps = { id: descriptionId };\n\n const errorMessageId = useId();\n const errorMessageProps = { id: errorMessageId };\n\n const ariaDescribedBy = spaceDelimitedList([\n props.description && descriptionId,\n props.errorMessage && errorMessageId,\n props[\"aria-describedby\"],\n ]);\n\n return {\n descriptionProps,\n errorMessageProps,\n labelProps,\n inputProps: {\n defaultValue: props.defaultValue,\n value: props.value,\n onChange: props.onChange,\n disabled: isDisabled,\n readOnly: isReadOnly,\n required: isRequired,\n \"aria-required\": isRequired === true ? true : undefined,\n \"aria-invalid\": props.isInvalid,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": props[\"aria-errormessage\"],\n role: props.role,\n\n type: inputElementType === \"input\" ? props.type : undefined,\n pattern: inputElementType === \"input\" ? props.pattern : undefined,\n\n autoComplete: props.autoComplete,\n maxLength: props.maxLength,\n minLength: props.minLength,\n name: props.name,\n placeholder: props.placeholder,\n inputMode: props.inputMode,\n\n // Clipboard events\n onCopy: props.onCopy,\n onCut: props.onCut,\n onPaste: props.onPaste,\n\n // Composition events\n onCompositionEnd: props.onCompositionEnd,\n onCompositionStart: props.onCompositionStart,\n onCompositionUpdate: props.onCompositionUpdate,\n\n // Selection events\n onSelect: props.onSelect,\n\n // Input events\n onBeforeInput: props.onBeforeInput,\n onInput: props.onInput,\n\n // Focus events\n onFocus: props.onFocus,\n onBlur: props.onBlur,\n\n ...fieldProps,\n },\n };\n}\n", "import type { Validation } from \"../../types\";\n\nexport type GetValidationClassesProps = Pick<Validation, \"isInvalid\">;\n\nexport const useValidationClasses = (props: GetValidationClassesProps) => {\n const { isInvalid } = props;\n\n if (isInvalid) {\n return \"--is-invalid\";\n }\n\n if (isInvalid === false) {\n return \"--is-valid\";\n }\n\n return \"\";\n};\n", "import { error } from \"@simplybusiness/icons\";\nimport classNames from \"classnames/dedupe\";\nimport { Icon } from \"../Icon\";\nimport { TextOrHTML } from \"../TextOrHTML\";\nimport \"./ErrorMessage.css\";\n\nexport interface ErrorMessageProps {\n errorMessage?: string;\n id?: string;\n className?: string;\n}\n\nexport const ErrorMessage = ({\n id,\n errorMessage,\n className,\n}: ErrorMessageProps) => {\n const classes = classNames(\"mobius\", \"mobius-error-message\", className);\n\n if (!errorMessage) return null;\n\n return (\n <div id={id} className={classes} data-testid=\"ErrorMessage\" role=\"alert\">\n <Icon\n icon={error}\n className=\"mobius-error-message__icon\"\n aria-hidden=\"true\"\n />\n <TextOrHTML\n elementType=\"span\"\n className=\"mobius-error-message__text\"\n text={errorMessage}\n />\n </div>\n );\n};\n\nErrorMessage.displayName = \"ErrorMessage\";\n", "import classNames from \"classnames/dedupe\";\nimport type { IconProps } from \"./types\";\nimport \"./Icon.css\";\n\nconst ICON_PREFIX = \"mobius-icon\";\n\nconst capitaliseFirstLetter = (str: string) =>\n str.charAt(0).toUpperCase() + str.slice(1);\n\nexport function Icon({\n ref,\n icon,\n className,\n size = \"xs\",\n color,\n fixedWidth,\n spin,\n spinReverse,\n title,\n ...otherProps\n}: IconProps) {\n if (!icon) {\n throw new Error(\"Must specify icon object\");\n }\n\n const classes = classNames(\n \"mobius\",\n \"mobius-icon\",\n `svg-inline--${ICON_PREFIX}`,\n `--size-${size}`,\n className,\n {\n [`${ICON_PREFIX}-fw`]: fixedWidth,\n [`${ICON_PREFIX}-spin`]: spin || spinReverse,\n [`${ICON_PREFIX}-spin-reverse`]: spinReverse,\n },\n );\n\n const { iconName, width, height, svgPathData } = icon;\n const formattedIconName = iconName.split(\"-\").join(\" \");\n\n const defaultTitle = `${capitaliseFirstLetter(formattedIconName)} icon`;\n const titleText = title || defaultTitle;\n\n return (\n <svg\n ref={ref}\n focusable=\"false\"\n data-icon={iconName}\n className={classes}\n role=\"img\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox={`0 0 ${width} ${height}`}\n style={{ color }}\n {...otherProps}\n >\n <title>{titleText}</title>\n <path fill=\"currentColor\" d={svgPathData} />\n </svg>\n );\n}\n", "import classNames from \"classnames/dedupe\";\nimport type { RefAttributes } from \"react\";\nimport { useMemo } from \"react\";\nimport type { TextElementType, TextProps } from \"../Text/Text\";\nimport { Text, getElementType } from \"../Text/Text\";\n\nexport type HTMLElementType = \"span\" | \"div\";\n\n// Block-level tags that cannot be nested inside <p>.\nconst BLOCK_TAG =\n /<(div|p|ul|ol|li|h[1-6]|table|tr|td|th|blockquote|pre|hr|dl|dt|dd)[\\s>/]/i;\nconst containsBlockHTML = (text: string) => BLOCK_TAG.test(text);\nconst containsHTML = (text: string) =>\n /<[a-z/]/i.test(text) || /&(?:#\\d+|#x[\\da-f]+|[a-z]\\w*);/i.test(text); // tag or entity\n\nconst buildTextClasses = (\n textProps: Omit<TextProps, \"children\">,\n htmlClassName?: string,\n) => {\n const { variant, elementType, spacing, className } = textProps;\n const variantType = variant || getElementType(variant, elementType);\n return classNames(\n \"mobius\",\n \"mobius-text\",\n { [`--is-${variantType}`]: variantType },\n { [`--has-line-height-${spacing}`]: spacing },\n className,\n htmlClassName,\n );\n};\n\nexport interface TextOrHTMLProps\n extends Omit<TextProps, \"children\">, RefAttributes<TextElementType> {\n /** HTML string to be rendered with dangerouslySetInnerHTML */\n text: string;\n /** Custom class name for the dangerous HTML element */\n htmlClassName?: string;\n /** HTML element type for the dangerous HTML element */\n htmlElementType?: HTMLElementType;\n /** If true, wraps the dangerous HTML element inside a Text component */\n textWrapper?: boolean;\n /** If true, auto-detects whether text is HTML or plain text to determine wrapping and element type */\n autoDetect?: boolean;\n}\n\nconst TextOrHTML = ({\n ref,\n text,\n htmlClassName,\n htmlElementType,\n textWrapper = false,\n autoDetect = false,\n ...textProps\n}: TextOrHTMLProps) => {\n const hasBlockContent = autoDetect && containsBlockHTML(text);\n\n // Memoize the dangerouslySetInnerHTML object to prevent unnecessary re-renders\n // See: https://github.com/facebook/react/issues/31660\n const dangerousHTML = useMemo(() => ({ __html: text }), [text]);\n\n // Non-block text with autoDetect: render directly on a Text-equivalent element,\n // avoiding unnecessary <span> nesting inside <p>.\n if (autoDetect && !hasBlockContent) {\n const { variant, spacing, elementType, className, ...domProps } = textProps;\n const Element = getElementType(variant, elementType);\n const classes = buildTextClasses(textProps, htmlClassName);\n\n return containsHTML(text) ? (\n <Element\n ref={ref}\n {...domProps}\n className={classes}\n dangerouslySetInnerHTML={dangerousHTML}\n />\n ) : (\n <Element ref={ref} {...domProps} className={classes}>\n {text}\n </Element>\n );\n }\n\n const DangerousComponent =\n htmlElementType ?? (hasBlockContent ? \"div\" : \"span\");\n const dangerousElement = (\n <DangerousComponent\n className={htmlClassName}\n dangerouslySetInnerHTML={dangerousHTML}\n />\n );\n\n if (textWrapper) {\n return (\n <Text ref={ref} {...textProps}>\n {dangerousElement}\n </Text>\n );\n }\n\n return dangerousElement;\n};\n\nTextOrHTML.displayName = \"TextOrHTML\";\nexport { TextOrHTML };\n", "import type { ReactNode, RefAttributes } from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport type { DOMProps } from \"../../types/dom\";\nimport \"./Text.css\";\n\nexport type TextElementType = HTMLHeadingElement | HTMLParagraphElement;\nexport type TextVariantType =\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"body\"\n | \"small\"\n | \"legal\"\n | \"title\";\nexport type ElementType = \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"p\" | \"span\";\nexport interface TextProps extends DOMProps, RefAttributes<TextElementType> {\n /** HTML element for the text */\n elementType?: ElementType;\n /** Specify font size override */\n variant?: TextVariantType;\n /** Specify compact line height override */\n spacing?: \"loose\" | \"tight\";\n /** Custom class name for setting specific CSS */\n className?: string;\n children: ReactNode;\n style?: React.CSSProperties;\n}\n\nexport const getElementType = (\n variant: TextVariantType | undefined,\n elementType: ElementType | undefined,\n): ElementType => {\n // Explicit elementType always wins\n if (elementType) {\n return elementType;\n }\n // Infer element from variant\n if (variant && [\"h1\", \"h2\", \"h3\", \"h4\"].includes(variant)) {\n return variant as ElementType;\n }\n return \"p\";\n};\n\nconst Text = ({ ref, elementType, ...props }: TextProps) => {\n // Remove non-DOM props from element\n const { variant, className, spacing, ...otherProps } = props;\n\n // If a variant is supplied, set the class name and element type\n const Element: ElementType = getElementType(variant, elementType);\n const variantType = variant || Element;\n const classes = classNames(\n \"mobius\",\n \"mobius-text\",\n { [`--is-${variantType}`]: variantType },\n { [`--has-line-height-${spacing}`]: spacing },\n className,\n );\n\n return <Element ref={ref} {...otherProps} className={classes} />;\n};\n\nText.displayName = \"Text\";\nexport { Text };\n", "import type React from \"react\";\nimport type { ReactNode, RefAttributes } from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport type { DOMProps } from \"../../types/dom\";\nimport \"./Label.css\";\n\nexport type LabelElementType = HTMLLabelElement;\nexport type IntrinsicLabel = Omit<\n React.JSX.IntrinsicElements[\"label\"],\n \"css\" | \"color\" | \"ref\"\n>;\n\nexport interface LabelProps\n extends IntrinsicLabel, DOMProps, RefAttributes<LabelElementType> {\n children?: ReactNode;\n className?: string;\n elementType?: \"label\" | \"span\";\n}\n\nconst Label = ({ ref, ...props }: LabelProps) => {\n const { elementType: Element = \"label\", children, ...otherProps } = props;\n\n const classes = classNames(\"mobius\", \"mobius-label\", props.className);\n otherProps.className = classes;\n\n return (\n <Element ref={ref} {...otherProps} className={classes}>\n {children}\n </Element>\n );\n};\n\nLabel.displayName = \"Label\";\nexport { Label };\n", "import type { Ref, RefAttributes, ReactNode } from \"react\";\nimport type React from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport type { DOMProps } from \"../../types/dom\";\nimport type { SpacingType } from \"../../types\";\nimport \"./Stack.css\";\n\nexport type StackElementType = HTMLDivElement;\n\nexport interface StackProps extends DOMProps, RefAttributes<StackElementType> {\n children?: ReactNode;\n /** How big a gap between items */\n gap?: SpacingType;\n /** Custom class name for setting specific CSS */\n className?: string;\n elementType?: React.ElementType;\n}\n\nexport type StackRef = Ref<StackElementType>;\n\nexport const Stack = ({ ref, ...props }: StackProps) => {\n const { elementType: Element = \"div\", gap, ...otherProps } = props;\n\n const classes = classNames(\n \"mobius\",\n \"mobius-stack\",\n {\n [`--gap-${gap}`]: gap,\n },\n otherProps.className,\n );\n\n return <Element ref={ref} {...otherProps} className={classes} />;\n};\n\nStack.displayName = \"Stack\";\n", "import classNames from \"classnames/dedupe\";\nimport type { ReactElement } from \"react\";\nimport { cloneElement } from \"react\";\n\nexport const adornmentWithClassName = (\n component?: ReactElement,\n validationClasses?: string,\n className?: string,\n) => {\n if (!component) return null;\n\n return cloneElement(component, {\n className: classNames(\n (component.props as { className?: string }).className,\n validationClasses,\n className,\n ),\n } as { className: string });\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,IAAAA,gBAAuC;AACvC,yBAAyB;;;ACFzB,IAAAC,iBAAuB;;;ACFhB,SAAS,mBACd,MACoB;AACpB,SAAO,KAAK,OAAO,OAAO,EAAE,KAAK,GAAG,KAAK;AAC3C;;;ACHA,mBAA8B;AAyBvB,SAAS,SAAS;AAAA,EACvB,IAAI;AAAA,EACJ;AAAA,EACA,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,mBAAmB;AACrB,GAAkB;AAChB,MAAI,aAA2C,CAAC;AAChD,MAAI,aAA2C,CAAC;AAEhD,QAAM,kCAA8B,qBAAO,KAAK;AAEhD,QAAM,iBAAa,oBAAM;AACzB,QAAM,KAAK,cAAc;AACzB,QAAM,cAAU,oBAAM;AAEtB,MAAI,OAAO;AACT,qBAAiB,iBAAiB,GAAG,OAAO,IAAI,cAAc,KAAK;AACnE,iBAAa;AAAA,MACX,IAAI;AAAA,MACJ,SAAS,qB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,cAAc;",
6
6
  "names": ["import_react", "import_dedupe", "import_react", "import_dedupe", "classNames", "import_dedupe", "import_react", "import_dedupe", "import_jsx_runtime", "classNames", "import_jsx_runtime", "classNames", "import_jsx_runtime", "classNames", "import_dedupe", "import_jsx_runtime", "classNames", "import_dedupe", "import_jsx_runtime", "classNames", "import_dedupe", "import_react", "classNames", "import_jsx_runtime", "classNames", "import_jsx_runtime"]
7
7
  }
@@ -406,7 +406,7 @@ var init_Text = __esm({
406
406
  });
407
407
 
408
408
  // src/components/TextOrHTML/TextOrHTML.tsx
409
- var import_dedupe3, import_react7, import_jsx_runtime3, isBlockHTML, containsHTML, buildTextClasses, TextOrHTML;
409
+ var import_dedupe3, import_react7, import_jsx_runtime3, BLOCK_TAG, containsBlockHTML, containsHTML, buildTextClasses, TextOrHTML;
410
410
  var init_TextOrHTML = __esm({
411
411
  "src/components/TextOrHTML/TextOrHTML.tsx"() {
412
412
  "use strict";
@@ -414,7 +414,8 @@ var init_TextOrHTML = __esm({
414
414
  import_react7 = require("react");
415
415
  init_Text();
416
416
  import_jsx_runtime3 = require("react/jsx-runtime");
417
- isBlockHTML = (text) => /^\s*<[a-z]/i.test(text);
417
+ BLOCK_TAG = /<(div|p|ul|ol|li|h[1-6]|table|tr|td|th|blockquote|pre|hr|dl|dt|dd)[\s>/]/i;
418
+ containsBlockHTML = (text) => BLOCK_TAG.test(text);
418
419
  containsHTML = (text) => /<[a-z/]/i.test(text) || /&(?:#\d+|#x[\da-f]+|[a-z]\w*);/i.test(text);
419
420
  buildTextClasses = (textProps, htmlClassName) => {
420
421
  const { variant, elementType, spacing, className } = textProps;
@@ -437,9 +438,9 @@ var init_TextOrHTML = __esm({
437
438
  autoDetect = false,
438
439
  ...textProps
439
440
  }) => {
440
- const textIsBlockHTML = autoDetect && isBlockHTML(text);
441
+ const hasBlockContent = autoDetect && containsBlockHTML(text);
441
442
  const dangerousHTML = (0, import_react7.useMemo)(() => ({ __html: text }), [text]);
442
- if (autoDetect && !textIsBlockHTML) {
443
+ if (autoDetect && !hasBlockContent) {
443
444
  const { variant, spacing, elementType, className, ...domProps } = textProps;
444
445
  const Element = getElementType(variant, elementType);
445
446
  const classes = buildTextClasses(textProps, htmlClassName);
@@ -453,7 +454,7 @@ var init_TextOrHTML = __esm({
453
454
  }
454
455
  ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Element, { ref, ...domProps, className: classes, children: text });
455
456
  }
456
- const DangerousComponent = htmlElementType ?? (textIsBlockHTML ? "div" : "span");
457
+ const DangerousComponent = htmlElementType ?? (hasBlockContent ? "div" : "span");
457
458
  const dangerousElement = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
458
459
  DangerousComponent,
459
460
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/hooks/useBreakpoint/useBreakpoint.tsx", "../../../../src/hooks/useBreakpoint/index.tsx", "../../../../src/hooks/useButton/useButton.tsx", "../../../../src/hooks/useButton/index.tsx", "../../../../src/utils/spaceDelimitedList.ts", "../../../../src/hooks/useDialogPolyfill/useDialogPolyfill.ts", "../../../../src/hooks/useDialogPolyfill/index.ts", "../../../../src/hooks/useDialog/useDialog.ts", "../../../../src/hooks/useDialog/index.ts", "../../../../src/hooks/useLabel/useLabel.tsx", "../../../../src/hooks/useLabel/index.tsx", "../../../../src/hooks/useTextField/useTextField.tsx", "../../../../src/hooks/useTextField/types.tsx", "../../../../src/hooks/useTextField/index.tsx", "../../../../src/hooks/useValidationClasses/useValidationClasses.ts", "../../../../src/hooks/useValidationClasses/index.ts", "../../../../src/hooks/index.tsx", "../../../../src/components/Icon/Icon.tsx", "../../../../src/components/Icon/types.ts", "../../../../src/components/Icon/index.tsx", "../../../../src/components/Text/Text.tsx", "../../../../src/components/TextOrHTML/TextOrHTML.tsx", "../../../../src/components/TextOrHTML/index.tsx", "../../../../src/components/ErrorMessage/ErrorMessage.tsx", "../../../../src/components/ErrorMessage/index.tsx", "../../../../src/components/Label/Label.tsx", "../../../../src/components/Label/index.tsx", "../../../../src/components/Stack/Stack.tsx", "../../../../src/components/Stack/index.tsx", "../../../../src/components/TextField/adornmentWithClassName.ts", "../../../../src/components/TextField/TextField.tsx", "../../../../src/components/TextField/index.tsx", "../../../../src/components/MaskedField/MaskedField.tsx", "../../../../src/components/MaskedField/index.tsx"],
4
- "sourcesContent": ["\"use client\";\n\nimport {\n useDebouncedValue,\n useIsClient,\n useWindowEvent,\n} from \"@simplybusiness/mobius-hooks\";\nimport { useCallback, useMemo, useState } from \"react\";\nimport type { SizeType } from \"../../types\";\n\nexport type Breakpoint = {\n size: SizeType;\n value: number;\n};\nexport type BreakpointsType = Breakpoint[];\nexport type UseBreakpointType = {\n breakpoint: Breakpoint;\n up: (size: SizeType) => boolean | undefined;\n down: (size: SizeType) => boolean | undefined;\n};\n\n// Hard code breakpoints for SB designs\nexport const DEFAULT_BREAKPOINTS = [\n { size: \"xs\", value: 320 },\n { size: \"sm\", value: 480 },\n { size: \"md\", value: 670 },\n { size: \"lg\", value: 960 },\n { size: \"xl\", value: 1200 },\n { size: \"xxl\", value: 1320 },\n] as BreakpointsType;\n\nconst PASSIVE: AddEventListenerOptions = { passive: true };\n\nconst getBreakpoint = (breakpoints: BreakpointsType, windowWidth: number) => {\n // When breakpoint size and windowWidth are a match\n // The addition of 1px ensures the right breakpoint\n const closest = breakpoints.findIndex(\n breakpoint => breakpoint.value >= windowWidth + 1,\n );\n const smallest = breakpoints[0];\n const largest = breakpoints[breakpoints.length - 1];\n const match = breakpoints[closest - 1];\n\n if (closest === 0) return smallest;\n if (closest === -1) return largest;\n\n return match;\n};\n\nconst useBreakpoint = (\n customBreakpoints?: BreakpointsType,\n): UseBreakpointType => {\n const isClientSide = useIsClient();\n const breakpoints = customBreakpoints || DEFAULT_BREAKPOINTS;\n const defaultBreakpoint = breakpoints[0];\n\n const [windowWidth, setWindowWidth] = useState<number>(\n typeof globalThis?.window !== \"undefined\"\n ? window.innerWidth\n : defaultBreakpoint.value,\n );\n\n useWindowEvent(\"resize\", () => setWindowWidth(window.innerWidth), PASSIVE);\n\n const debouncedWidth = useDebouncedValue(windowWidth, 200);\n\n // Gate on isClientSide so up()/down() also return default-based values\n // during SSR and hydration, matching the server render.\n const currentBreakpoint = useMemo(\n () =>\n !isClientSide || breakpoints.length === 0\n ? defaultBreakpoint\n : getBreakpoint(breakpoints, debouncedWidth),\n [isClientSide, breakpoints, defaultBreakpoint, debouncedWidth],\n );\n\n const up = useCallback(\n (size: SizeType) => {\n const sizeIndex = breakpoints.findIndex(item => item.size === size);\n if (sizeIndex === -1) {\n return false;\n }\n const currentIndex = breakpoints.findIndex(\n item => item.size === currentBreakpoint.size,\n );\n\n return currentIndex >= sizeIndex;\n },\n [currentBreakpoint, breakpoints],\n );\n\n const down = useCallback(\n (size: SizeType) => {\n const sizeIndex = breakpoints.findIndex(item => item.size === size);\n if (sizeIndex === -1) {\n return true;\n }\n const currentIndex = breakpoints.findIndex(\n item => item.size === currentBreakpoint.size,\n );\n\n return currentIndex <= sizeIndex;\n },\n [currentBreakpoint, breakpoints],\n );\n\n return {\n breakpoint: currentBreakpoint,\n up,\n down,\n };\n};\n\nexport { useBreakpoint };\n", "export * from \"./useBreakpoint\";\n", "import type { JSXElementConstructor } from \"react\";\nimport { useCallback } from \"react\";\n\nexport interface UseButtonProps {\n elementType?:\n | \"button\"\n | \"a\"\n | \"span\"\n | \"input\"\n | JSXElementConstructor<unknown>\n | undefined;\n type?: \"button\" | \"submit\" | \"reset\";\n isDisabled?: boolean;\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n onPress?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n href?: string;\n target?: string;\n rel?: string;\n role?: string;\n name?: string | undefined;\n value?: string | undefined;\n}\n\nexport function useButton({\n elementType = \"button\",\n type = \"button\",\n isDisabled = false,\n href,\n target,\n rel,\n role,\n name,\n value,\n onClick,\n onPress,\n}: UseButtonProps) {\n const realOnClick = useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n if (isDisabled) {\n return;\n }\n\n onClick?.(event);\n onPress?.(event);\n },\n [isDisabled, onClick, onPress],\n );\n\n function getRole() {\n if (role) {\n return role;\n }\n\n if (elementType === \"a\") {\n return undefined;\n }\n\n return \"button\";\n }\n\n const extraProps =\n elementType === \"button\"\n ? { type }\n : {\n role: getRole(),\n };\n\n return {\n buttonProps: {\n href: elementType === \"a\" ? href : undefined,\n target: elementType === \"a\" ? target : undefined,\n rel: elementType === \"a\" ? rel : undefined,\n tabIndex: isDisabled ? -1 : 0,\n disabled: isDisabled || undefined,\n \"aria-disabled\": isDisabled || undefined,\n name:\n elementType === \"input\" || elementType === \"button\" ? name : undefined,\n value:\n elementType === \"input\" || elementType === \"button\" ? value : undefined,\n ...extraProps,\n onClick: realOnClick,\n },\n };\n}\n", "export * from \"./useButton\";\n", "export function spaceDelimitedList(\n list: (string | null | undefined)[],\n): string | undefined {\n return list.filter(Boolean).join(\" \") || undefined;\n}\n", "import type { MutableRefObject } from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { supportsDialog } from \"../../utils\";\n\n// Add polyfill for HTML Dialog in old browsers\nexport const useDialogPolyfill = () => {\n const [hasDialogSupport, setHasDialogSupport] = useState(false);\n const hasAlreadyLoaded = useRef(false);\n\n useEffect(() => {\n setHasDialogSupport(supportsDialog());\n }, []);\n\n const polyfillDialog = async (\n ref: MutableRefObject<HTMLDialogElement | null>,\n ) => {\n if (\n !hasAlreadyLoaded.current &&\n !hasDialogSupport &&\n typeof window !== \"undefined\" &&\n ref.current !== null\n ) {\n const { default: dialogPolyfill } = await import(\"dialog-polyfill\");\n\n hasAlreadyLoaded.current = true;\n try {\n if (ref.current) {\n dialogPolyfill.registerDialog(ref.current);\n }\n } catch (error) {\n console.error(\"Failed to load dialog-polyfill\", error);\n }\n }\n };\n\n return {\n polyfillDialog,\n };\n};\n", "export * from \"./useDialogPolyfill\";\n", "import type { MutableRefObject, SyntheticEvent } from \"react\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { supportsDialog } from \"../../utils\";\nimport { useBodyScrollLock } from \"@simplybusiness/mobius-hooks\";\nimport { useDialogPolyfill } from \"../useDialogPolyfill\";\n\nexport type TransitionProps = {\n isEnabled: boolean;\n CSSVariable: string;\n};\n\nexport type useDialogProps = {\n ref: MutableRefObject<HTMLDialogElement | null>;\n transition: TransitionProps;\n isOpen: boolean;\n onOpen?: () => void;\n onClose?: () => void;\n};\n\nconst TRANSITION_CLASS_NAME = \"--transition\";\nconst FALLBACK_TRANSITION_DURATION = 0;\n\nexport const useDialog = (props: useDialogProps) => {\n const { ref, isOpen, transition, onOpen, onClose } = props;\n const [hasDialogSupport, setHasDialogSupport] = useState(false);\n const shouldTransition = hasDialogSupport && transition.isEnabled;\n const { polyfillDialog } = useDialogPolyfill();\n\n useEffect(() => {\n setHasDialogSupport(supportsDialog());\n }, []);\n\n // Read CSS variable value as number\n const TRANSITION_DURATION_IN_MS =\n (ref.current &&\n Number(\n getComputedStyle(ref.current)\n .getPropertyValue(transition.CSSVariable)\n .replace(\"ms\", \"\"),\n )) ||\n FALLBACK_TRANSITION_DURATION;\n\n useBodyScrollLock({ enabled: isOpen });\n\n const open = useCallback(() => {\n ref.current?.showModal();\n onOpen?.();\n }, [onOpen, ref]);\n\n const close = useCallback(() => {\n ref.current?.close();\n onClose?.();\n }, [onClose, ref]);\n\n // Add close handler, to enable closing transitions\n const handleClose = useCallback(\n (event?: SyntheticEvent<HTMLElement, Event>) => {\n if (event) {\n // Prevent default event coming from onCancel,\n // which is triggered by pressing ESC key\n event.preventDefault();\n // Ensure that nested `<dialog>` elements\n // don't close the parent\n event.stopPropagation();\n }\n\n if (shouldTransition) {\n ref.current?.classList.remove(TRANSITION_CLASS_NAME);\n // Delay close to allow exit transition\n setTimeout(() => close(), TRANSITION_DURATION_IN_MS);\n } else {\n close();\n }\n },\n [TRANSITION_DURATION_IN_MS, close, ref, shouldTransition],\n );\n\n useEffect(() => {\n async function toggleDialog() {\n if (isOpen && !ref.current?.open) {\n await polyfillDialog(ref);\n\n open();\n // Fix opening transition in Safari being skipped\n // by wrapping with setTimeout\n setTimeout(() => {\n ref.current?.classList.add(TRANSITION_CLASS_NAME);\n }, 0);\n } else if (!isOpen && ref.current?.open) {\n handleClose();\n }\n }\n\n void toggleDialog();\n }, [handleClose, isOpen, open, ref, polyfillDialog]);\n\n return {\n open,\n close: handleClose,\n };\n};\n", "export * from \"./useDialog\";\n", "import type { LabelHTMLAttributes } from \"react\";\nimport { useId, useRef } from \"react\";\n\nexport type UseLabelProps = {\n id?: string | undefined;\n label?: string | undefined;\n \"aria-label\"?: string | undefined;\n \"aria-labelledby\"?: string | undefined;\n labelElementType?: \"label\" | \"span\" | undefined;\n};\n\nexport type UseLabelReturn = {\n labelProps: {\n id?: string | undefined;\n } & LabelHTMLAttributes<HTMLLabelElement>;\n fieldProps: LabellingProps;\n};\n\nexport type LabellingProps = {\n id?: string | undefined;\n \"aria-label\"?: string | undefined;\n \"aria-labelledby\"?: string | undefined;\n \"aria-describedby\"?: string | undefined;\n \"aria-details\"?: string | undefined;\n};\n\nexport function useLabel({\n id: providedId,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n labelElementType = \"label\",\n}: UseLabelProps) {\n let labelProps: UseLabelReturn[\"labelProps\"] = {};\n let fieldProps: UseLabelReturn[\"fieldProps\"] = {};\n\n const hasWarnedAboutMissingLabels = useRef(false);\n\n const fallbackId = useId();\n const id = providedId || fallbackId;\n const labelId = useId();\n\n if (label) {\n ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;\n labelProps = {\n id: labelId,\n htmlFor: labelElementType === \"label\" ? id : undefined,\n };\n } else if (\n !ariaLabelledby &&\n !ariaLabel &&\n !hasWarnedAboutMissingLabels.current\n ) {\n hasWarnedAboutMissingLabels.current = true;\n console.warn(\n \"If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility\",\n );\n }\n\n fieldProps = {\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n };\n\n return {\n labelProps,\n fieldProps,\n };\n}\n", "export * from \"./useLabel\";\n", "import { useId } from \"react\";\nimport { spaceDelimitedList } from \"../../utils/spaceDelimitedList\";\nimport { useLabel } from \"../useLabel/useLabel\";\nimport type { UseTextFieldProps, UseTextFieldReturn } from \"./types\";\n\nexport function useTextField(props: UseTextFieldProps): UseTextFieldReturn {\n const {\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n inputElementType = \"input\",\n } = props;\n const { labelProps, fieldProps } = useLabel(props);\n\n const descriptionId = useId();\n const descriptionProps = { id: descriptionId };\n\n const errorMessageId = useId();\n const errorMessageProps = { id: errorMessageId };\n\n const ariaDescribedBy = spaceDelimitedList([\n props.description && descriptionId,\n props.errorMessage && errorMessageId,\n props[\"aria-describedby\"],\n ]);\n\n return {\n descriptionProps,\n errorMessageProps,\n labelProps,\n inputProps: {\n defaultValue: props.defaultValue,\n value: props.value,\n onChange: props.onChange,\n disabled: isDisabled,\n readOnly: isReadOnly,\n required: isRequired,\n \"aria-required\": isRequired === true ? true : undefined,\n \"aria-invalid\": props.isInvalid,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": props[\"aria-errormessage\"],\n role: props.role,\n\n type: inputElementType === \"input\" ? props.type : undefined,\n pattern: inputElementType === \"input\" ? props.pattern : undefined,\n\n autoComplete: props.autoComplete,\n maxLength: props.maxLength,\n minLength: props.minLength,\n name: props.name,\n placeholder: props.placeholder,\n inputMode: props.inputMode,\n\n // Clipboard events\n onCopy: props.onCopy,\n onCut: props.onCut,\n onPaste: props.onPaste,\n\n // Composition events\n onCompositionEnd: props.onCompositionEnd,\n onCompositionStart: props.onCompositionStart,\n onCompositionUpdate: props.onCompositionUpdate,\n\n // Selection events\n onSelect: props.onSelect,\n\n // Input events\n onBeforeInput: props.onBeforeInput,\n onInput: props.onInput,\n\n // Focus events\n onFocus: props.onFocus,\n onBlur: props.onBlur,\n\n ...fieldProps,\n },\n };\n}\n", "import type { AriaRole, InputHTMLAttributes } from \"react\";\nimport type { UseLabelProps, UseLabelReturn } from \"../useLabel/useLabel\";\nimport type { FocusEvents, Validation } from \"../../types\";\n\nexport type UseTextFieldProps = UseLabelProps &\n FocusEvents &\n Validation &\n Pick<\n InputHTMLAttributes<HTMLInputElement>,\n | \"defaultValue\"\n | \"value\"\n | \"onChange\"\n | \"autoComplete\"\n | \"maxLength\"\n | \"minLength\"\n | \"name\"\n | \"placeholder\"\n | \"inputMode\"\n | \"type\"\n | \"pattern\"\n\n // Clipboard events\n | \"onCopy\"\n | \"onCut\"\n | \"onPaste\"\n\n // Keyboard events\n | \"onKeyDown\"\n | \"onKeyUp\"\n | \"onKeyPress\"\n\n // Composition events\n | \"onCompositionEnd\"\n | \"onCompositionStart\"\n | \"onCompositionUpdate\"\n\n // Selection events\n | \"onSelect\"\n\n // Input events\n | \"onBeforeInput\"\n | \"onInput\"\n\n // Number types\n | \"min\"\n | \"max\"\n | \"step\"\n > & {\n inputElementType?: \"input\" | \"textarea\" | undefined;\n defaultValue?: string | undefined;\n value?: string | undefined;\n isDisabled?: boolean | undefined;\n isReadOnly?: boolean | undefined;\n isRequired?: boolean | undefined;\n description?: string | undefined;\n errorMessage?: string | undefined;\n \"aria-describedby\"?: string | undefined;\n \"aria-errormessage\"?: string | undefined;\n role?: AriaRole | undefined;\n };\n\nexport type UseTextFieldReturn = {\n labelProps: UseLabelReturn[\"labelProps\"];\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n descriptionProps: { id?: string | undefined };\n errorMessageProps: { id?: string | undefined };\n};\n", "export * from \"./useTextField\";\nexport * from \"./types\";\n", "import type { Validation } from \"../../types\";\n\nexport type GetValidationClassesProps = Pick<Validation, \"isInvalid\">;\n\nexport const useValidationClasses = (props: GetValidationClassesProps) => {\n const { isInvalid } = props;\n\n if (isInvalid) {\n return \"--is-invalid\";\n }\n\n if (isInvalid === false) {\n return \"--is-valid\";\n }\n\n return \"\";\n};\n", "export * from \"./useValidationClasses\";\n", "export * from \"./useBreakpoint\";\nexport * from \"./useButton\";\nexport * from \"./useDialog\";\nexport * from \"./useDialogPolyfill\";\nexport * from \"./useLabel\";\nexport * from \"./useTextField\";\nexport * from \"./useValidationClasses\";\n", "import classNames from \"classnames/dedupe\";\nimport type { IconProps } from \"./types\";\nimport \"./Icon.css\";\n\nconst ICON_PREFIX = \"mobius-icon\";\n\nconst capitaliseFirstLetter = (str: string) =>\n str.charAt(0).toUpperCase() + str.slice(1);\n\nexport function Icon({\n ref,\n icon,\n className,\n size = \"xs\",\n color,\n fixedWidth,\n spin,\n spinReverse,\n title,\n ...otherProps\n}: IconProps) {\n if (!icon) {\n throw new Error(\"Must specify icon object\");\n }\n\n const classes = classNames(\n \"mobius\",\n \"mobius-icon\",\n `svg-inline--${ICON_PREFIX}`,\n `--size-${size}`,\n className,\n {\n [`${ICON_PREFIX}-fw`]: fixedWidth,\n [`${ICON_PREFIX}-spin`]: spin || spinReverse,\n [`${ICON_PREFIX}-spin-reverse`]: spinReverse,\n },\n );\n\n const { iconName, width, height, svgPathData } = icon;\n const formattedIconName = iconName.split(\"-\").join(\" \");\n\n const defaultTitle = `${capitaliseFirstLetter(formattedIconName)} icon`;\n const titleText = title || defaultTitle;\n\n return (\n <svg\n ref={ref}\n focusable=\"false\"\n data-icon={iconName}\n className={classes}\n role=\"img\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox={`0 0 ${width} ${height}`}\n style={{ color }}\n {...otherProps}\n >\n <title>{titleText}</title>\n <path fill=\"currentColor\" d={svgPathData} />\n </svg>\n );\n}\n", "import type { RefAttributes } from \"react\";\nimport type { IconDefinition } from \"../../types/icon\";\n\nexport type IconSizeProp = \"xs\" | \"sm\" | \"md\" | \"lg\";\n\nexport interface IconProps extends RefAttributes<SVGSVGElement> {\n icon?: IconDefinition;\n className?: string;\n size?: IconSizeProp;\n color?: string;\n fixedWidth?: boolean;\n title?: string;\n\n // Animations\n spin?: boolean;\n spinReverse?: boolean;\n}\n", "export * from \"./Icon\";\nexport * from \"./types\";\n", "import type { ReactNode, RefAttributes } from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport type { DOMProps } from \"../../types/dom\";\nimport \"./Text.css\";\n\nexport type TextElementType = HTMLHeadingElement | HTMLParagraphElement;\nexport type TextVariantType =\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"body\"\n | \"small\"\n | \"legal\"\n | \"title\";\nexport type ElementType = \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"p\" | \"span\";\nexport interface TextProps extends DOMProps, RefAttributes<TextElementType> {\n /** HTML element for the text */\n elementType?: ElementType;\n /** Specify font size override */\n variant?: TextVariantType;\n /** Specify compact line height override */\n spacing?: \"loose\" | \"tight\";\n /** Custom class name for setting specific CSS */\n className?: string;\n children: ReactNode;\n style?: React.CSSProperties;\n}\n\nexport const getElementType = (\n variant: TextVariantType | undefined,\n elementType: ElementType | undefined,\n): ElementType => {\n // Explicit elementType always wins\n if (elementType) {\n return elementType;\n }\n // Infer element from variant\n if (variant && [\"h1\", \"h2\", \"h3\", \"h4\"].includes(variant)) {\n return variant as ElementType;\n }\n return \"p\";\n};\n\nconst Text = ({ ref, elementType, ...props }: TextProps) => {\n // Remove non-DOM props from element\n const { variant, className, spacing, ...otherProps } = props;\n\n // If a variant is supplied, set the class name and element type\n const Element: ElementType = getElementType(variant, elementType);\n const variantType = variant || Element;\n const classes = classNames(\n \"mobius\",\n \"mobius-text\",\n { [`--is-${variantType}`]: variantType },\n { [`--has-line-height-${spacing}`]: spacing },\n className,\n );\n\n return <Element ref={ref} {...otherProps} className={classes} />;\n};\n\nText.displayName = \"Text\";\nexport { Text };\n", "import classNames from \"classnames/dedupe\";\nimport type { RefAttributes } from \"react\";\nimport { useMemo } from \"react\";\nimport type { TextElementType, TextProps } from \"../Text/Text\";\nimport { Text, getElementType } from \"../Text/Text\";\n\nexport type HTMLElementType = \"span\" | \"div\";\n\nconst isBlockHTML = (text: string) => /^\\s*<[a-z]/i.test(text);\nconst containsHTML = (text: string) =>\n /<[a-z/]/i.test(text) || /&(?:#\\d+|#x[\\da-f]+|[a-z]\\w*);/i.test(text); // tag or entity\n\nconst buildTextClasses = (\n textProps: Omit<TextProps, \"children\">,\n htmlClassName?: string,\n) => {\n const { variant, elementType, spacing, className } = textProps;\n const variantType = variant || getElementType(variant, elementType);\n return classNames(\n \"mobius\",\n \"mobius-text\",\n { [`--is-${variantType}`]: variantType },\n { [`--has-line-height-${spacing}`]: spacing },\n className,\n htmlClassName,\n );\n};\n\nexport interface TextOrHTMLProps\n extends Omit<TextProps, \"children\">, RefAttributes<TextElementType> {\n /** HTML string to be rendered with dangerouslySetInnerHTML */\n text: string;\n /** Custom class name for the dangerous HTML element */\n htmlClassName?: string;\n /** HTML element type for the dangerous HTML element */\n htmlElementType?: HTMLElementType;\n /** If true, wraps the dangerous HTML element inside a Text component */\n textWrapper?: boolean;\n /** If true, auto-detects whether text is HTML or plain text to determine wrapping and element type */\n autoDetect?: boolean;\n}\n\nconst TextOrHTML = ({\n ref,\n text,\n htmlClassName,\n htmlElementType,\n textWrapper = false,\n autoDetect = false,\n ...textProps\n}: TextOrHTMLProps) => {\n const textIsBlockHTML = autoDetect && isBlockHTML(text);\n\n // Memoize the dangerouslySetInnerHTML object to prevent unnecessary re-renders\n // See: https://github.com/facebook/react/issues/31660\n const dangerousHTML = useMemo(() => ({ __html: text }), [text]);\n\n // Non-block text with autoDetect: render directly on a Text-equivalent element,\n // avoiding unnecessary <span> nesting inside <p>.\n if (autoDetect && !textIsBlockHTML) {\n const { variant, spacing, elementType, className, ...domProps } = textProps;\n const Element = getElementType(variant, elementType);\n const classes = buildTextClasses(textProps, htmlClassName);\n\n return containsHTML(text) ? (\n <Element\n ref={ref}\n {...domProps}\n className={classes}\n dangerouslySetInnerHTML={dangerousHTML}\n />\n ) : (\n <Element ref={ref} {...domProps} className={classes}>\n {text}\n </Element>\n );\n }\n\n const DangerousComponent =\n htmlElementType ?? (textIsBlockHTML ? \"div\" : \"span\");\n const dangerousElement = (\n <DangerousComponent\n className={htmlClassName}\n dangerouslySetInnerHTML={dangerousHTML}\n />\n );\n\n if (textWrapper) {\n return (\n <Text ref={ref} {...textProps}>\n {dangerousElement}\n </Text>\n );\n }\n\n return dangerousElement;\n};\n\nTextOrHTML.displayName = \"TextOrHTML\";\nexport { TextOrHTML };\n", "export * from \"./TextOrHTML\";\n", "import { error } from \"@simplybusiness/icons\";\nimport classNames from \"classnames/dedupe\";\nimport { Icon } from \"../Icon\";\nimport { TextOrHTML } from \"../TextOrHTML\";\nimport \"./ErrorMessage.css\";\n\nexport interface ErrorMessageProps {\n errorMessage?: string;\n id?: string;\n className?: string;\n}\n\nexport const ErrorMessage = ({\n id,\n errorMessage,\n className,\n}: ErrorMessageProps) => {\n const classes = classNames(\"mobius\", \"mobius-error-message\", className);\n\n if (!errorMessage) return null;\n\n return (\n <div id={id} className={classes} data-testid=\"ErrorMessage\" role=\"alert\">\n <Icon\n icon={error}\n className=\"mobius-error-message__icon\"\n aria-hidden=\"true\"\n />\n <TextOrHTML\n elementType=\"span\"\n className=\"mobius-error-message__text\"\n text={errorMessage}\n />\n </div>\n );\n};\n\nErrorMessage.displayName = \"ErrorMessage\";\n", "export * from \"./ErrorMessage\";\n", "import type React from \"react\";\nimport type { ReactNode, RefAttributes } from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport type { DOMProps } from \"../../types/dom\";\nimport \"./Label.css\";\n\nexport type LabelElementType = HTMLLabelElement;\nexport type IntrinsicLabel = Omit<\n React.JSX.IntrinsicElements[\"label\"],\n \"css\" | \"color\" | \"ref\"\n>;\n\nexport interface LabelProps\n extends IntrinsicLabel, DOMProps, RefAttributes<LabelElementType> {\n children?: ReactNode;\n className?: string;\n elementType?: \"label\" | \"span\";\n}\n\nconst Label = ({ ref, ...props }: LabelProps) => {\n const { elementType: Element = \"label\", children, ...otherProps } = props;\n\n const classes = classNames(\"mobius\", \"mobius-label\", props.className);\n otherProps.className = classes;\n\n return (\n <Element ref={ref} {...otherProps} className={classes}>\n {children}\n </Element>\n );\n};\n\nLabel.displayName = \"Label\";\nexport { Label };\n", "export * from \"./Label\";\n", "import type { Ref, RefAttributes, ReactNode } from \"react\";\nimport type React from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport type { DOMProps } from \"../../types/dom\";\nimport type { SpacingType } from \"../../types\";\nimport \"./Stack.css\";\n\nexport type StackElementType = HTMLDivElement;\n\nexport interface StackProps extends DOMProps, RefAttributes<StackElementType> {\n children?: ReactNode;\n /** How big a gap between items */\n gap?: SpacingType;\n /** Custom class name for setting specific CSS */\n className?: string;\n elementType?: React.ElementType;\n}\n\nexport type StackRef = Ref<StackElementType>;\n\nexport const Stack = ({ ref, ...props }: StackProps) => {\n const { elementType: Element = \"div\", gap, ...otherProps } = props;\n\n const classes = classNames(\n \"mobius\",\n \"mobius-stack\",\n {\n [`--gap-${gap}`]: gap,\n },\n otherProps.className,\n );\n\n return <Element ref={ref} {...otherProps} className={classes} />;\n};\n\nStack.displayName = \"Stack\";\n", "export * from \"./Stack\";\n", "import classNames from \"classnames/dedupe\";\nimport type { ReactElement } from \"react\";\nimport { cloneElement } from \"react\";\n\nexport const adornmentWithClassName = (\n component?: ReactElement,\n validationClasses?: string,\n className?: string,\n) => {\n if (!component) return null;\n\n return cloneElement(component, {\n className: classNames(\n (component.props as { className?: string }).className,\n validationClasses,\n className,\n ),\n } as { className: string });\n};\n", "\"use client\";\n\nimport classNames from \"classnames/dedupe\";\nimport type {\n HTMLInputTypeAttribute,\n ReactElement,\n ReactNode,\n Ref,\n RefAttributes,\n} from \"react\";\nimport type { UseTextFieldProps } from \"../../hooks\";\nimport { useTextField, useValidationClasses } from \"../../hooks\";\nimport type { DOMProps, FocusEvents } from \"../../types\";\nimport { ErrorMessage } from \"../ErrorMessage\";\nimport { Label } from \"../Label\";\nimport { Stack } from \"../Stack\";\nimport { adornmentWithClassName } from \"./adornmentWithClassName\";\nimport \"./TextField.css\";\n\nexport type TextFieldElementType = HTMLInputElement;\nexport interface TextFieldProps\n extends\n DOMProps,\n FocusEvents,\n UseTextFieldProps,\n RefAttributes<TextFieldElementType> {\n className?: string;\n errorMessage?: string;\n children?: ReactNode;\n label?: string;\n type?: Exclude<\n HTMLInputTypeAttribute,\n | \"button\"\n | \"checkbox\"\n | \"color\"\n | \"date\"\n | \"datetime-local\"\n | \"file\"\n | \"image\"\n | \"month\"\n | \"radio\"\n | \"range\"\n | \"reset\"\n | \"submit\"\n | \"week\"\n >;\n prefixInside?: ReactElement;\n prefixOutside?: ReactElement;\n suffixInside?: ReactElement;\n suffixOutside?: ReactElement;\n}\n\nexport type TextFieldRef = Ref<TextFieldElementType>;\n\nconst TextField = ({ ref, ...props }: TextFieldProps) => {\n const {\n isDisabled,\n type = \"text\",\n isInvalid,\n className,\n label,\n errorMessage,\n children,\n isRequired,\n prefixInside,\n prefixOutside,\n suffixInside,\n suffixOutside,\n autoComplete,\n isReadOnly,\n ...otherProps\n } = props;\n\n const resolvedAutoComplete =\n autoComplete ??\n (type === \"email\" ? \"email\" : type === \"tel\" ? \"tel\" : undefined);\n\n const { inputProps, labelProps, errorMessageProps } = useTextField({\n ...props,\n autoComplete: resolvedAutoComplete,\n \"aria-errormessage\": errorMessage,\n });\n\n const hidden = type === \"hidden\";\n\n const validationClasses = useValidationClasses({ isInvalid });\n\n const textfieldClasses = {\n \"--is-disabled\": isDisabled,\n \"--is-required\": typeof isRequired === \"boolean\" && isRequired,\n \"--is-optional\": typeof isRequired === \"boolean\" && !isRequired,\n \"--is-hidden\": hidden,\n [className || \"\"]: true,\n };\n\n const sharedClasses = classNames(validationClasses, textfieldClasses);\n\n const labelClasses = classNames(\n {\n \"--is-disabled\": isDisabled,\n },\n validationClasses,\n );\n\n const containerClasses = classNames(\n \"mobius\",\n \"mobius-text-field\",\n sharedClasses,\n );\n\n const inputClasses = classNames(\n \"mobius\",\n \"mobius-text-field__input\",\n sharedClasses,\n );\n\n const inputWrapperClasses = classNames(\n \"mobius-text-field__input-wrapper\",\n sharedClasses,\n );\n\n return (\n <Stack gap=\"xs\" className={containerClasses}>\n {label && !hidden && (\n <Label {...labelProps} className={labelClasses}>\n {label}\n </Label>\n )}\n <div className=\"mobius-text-field__inner-container\">\n {adornmentWithClassName(\n prefixOutside,\n labelClasses,\n \"mobius-text-field__prefix-outside\",\n )}\n <div className={inputWrapperClasses}>\n {adornmentWithClassName(\n prefixInside,\n labelClasses,\n \"mobius-text-field__prefix-inside\",\n )}\n <input\n {...otherProps}\n {...inputProps}\n ref={ref}\n type={type}\n className={inputClasses}\n />\n {adornmentWithClassName(\n suffixInside,\n labelClasses,\n \"mobius-text-field__suffix-inside\",\n )}\n </div>\n {adornmentWithClassName(\n suffixOutside,\n labelClasses,\n \"mobius-text-field__suffix-outside\",\n )}\n </div>\n {children && (\n <div className=\"mobius-text-field__children\">{children}</div>\n )}\n\n <ErrorMessage {...errorMessageProps} errorMessage={errorMessage} />\n </Stack>\n );\n};\n\nTextField.displayName = \"TextField\";\nexport { TextField };\n", "export * from \"./TextField\";\n", "\"use client\";\n\nimport type { ChangeEvent, FocusEvent, Ref, RefAttributes } from \"react\";\nimport { useCallback, useEffect } from \"react\";\nimport { useIMask } from \"react-imask\";\nimport type { FactoryOpts, InputMask, InputMaskElement } from \"imask\";\nimport type { TextFieldProps } from \"../TextField\";\nimport { TextField } from \"../TextField\";\n\nexport type MaskedFieldElementType = HTMLInputElement;\n\nexport interface MaskedFieldProps\n extends\n Omit<TextFieldProps, \"type\" | \"ref\">,\n RefAttributes<MaskedFieldElementType> {\n mask: FactoryOpts;\n \"data-testid\"?: string;\n /**\n * If true, onChange and onBlur events will emit the masked (formatted) value.\n * If false (default), events will emit the unmasked (raw) value.\n *\n * @example\n * // TelephoneQuestion uses useMaskedValue={true}\n * // User types: 5551234567\n * // onChange receives: \"(555) 123-4567\" (formatted for display/storage)\n *\n * @example\n * // CurrencyQuestion uses useMaskedValue={false}\n * // User types: 1234\n * // User sees: \"1,234\" (with thousands separator)\n * // onChange receives: \"1234\" (raw number for calculations)\n */\n useMaskedValue?: boolean;\n}\n\nexport type MaskedFieldRef = Ref<MaskedFieldElementType>;\n\n/**\n * Creates an onChange handler for IMask's onAccept callback.\n *\n * IMask calls onAccept every time the user types and the mask accepts the input.\n * This handler converts IMask's callback into a standard React onChange event.\n *\n * @param onChange - The onChange handler from parent component\n * @param useMaskedValue - Whether to emit the formatted value or raw value\n * @param name - The input's name attribute (for the synthetic event)\n *\n * @example\n * // TelephoneQuestion (US) - useMaskedValue=true\n * // User types: \"5551234567\"\n * // Emits: \"(555) 123-4567\" (formatted for display)\n * // Use case: Want to store/display the formatted phone number\n *\n * @example\n * // CurrencyQuestion - useMaskedValue=false\n * // User types: \"1234.56\"\n * // User sees: \"1,234.56\" (with formatting)\n * // Emits: \"1234.56\" (raw value for calculations)\n * // Use case: Need numeric value for backend/calculations\n */\nconst useAcceptHandler = (\n onChange: MaskedFieldProps[\"onChange\"],\n useMaskedValue: boolean,\n name?: string,\n) => {\n return useCallback(\n (maskedValue: string, maskInstance: InputMask<FactoryOpts>) => {\n // Exit early if no onChange handler provided\n if (!onChange) {\n return;\n }\n\n // IMask provides two values:\n // 1. maskedValue: The formatted value user sees (e.g., \"(555) 123-4567\")\n // 2. maskInstance.unmaskedValue: The raw value without formatting (e.g., \"5551234567\")\n const formattedValue = maskedValue;\n const rawValue = maskInstance.unmaskedValue;\n\n // Choose which value to emit based on useMaskedValue prop\n const valueToEmit = useMaskedValue ? formattedValue : rawValue;\n\n // Create a synthetic React event that matches the standard onChange signature\n // This allows parent components to handle it like any other input change\n onChange({\n target: { name, value: valueToEmit },\n } as ChangeEvent<HTMLInputElement>);\n },\n [onChange, useMaskedValue, name],\n );\n};\n\n/**\n * Creates a ref callback that forwards the input element to both IMask and the parent component.\n *\n * React allows two ways to pass refs:\n * 1. Ref callback function: (element) => { ... }\n * 2. Ref object: { current: element }\n *\n * This hook handles both cases and also ensures IMask gets the element reference it needs.\n *\n * @param imaskRef - IMask's ref (needs the element to apply masking)\n * @param forwardedRef - Parent component's ref (could be function or object)\n *\n * @example\n * // Parent uses callback ref\n * <MaskedField ref={(el) => console.log(el)} />\n *\n * @example\n * // Parent uses useRef\n * const inputRef = useRef(null);\n * <MaskedField ref={inputRef} />\n */\nconst useCombinedRef = (\n imaskRef: React.MutableRefObject<InputMaskElement | null>,\n forwardedRef?: MaskedFieldRef,\n) => {\n return useCallback(\n (element: HTMLInputElement | null) => {\n // First, give the element to IMask so it can apply masking\n imaskRef.current = element;\n\n // Then forward the element to the parent component's ref\n // Handle both callback refs and ref objects\n\n // Case 1: Parent passed a callback ref function\n if (typeof forwardedRef === \"function\") {\n forwardedRef(element);\n }\n // Case 2: Parent passed a ref object (from useRef)\n else if (forwardedRef) {\n forwardedRef.current = element;\n }\n // Case 3: No ref was forwarded (forwardedRef is null/undefined)\n // Do nothing - this is fine\n },\n [imaskRef, forwardedRef],\n );\n};\n\n/**\n * Creates an onBlur handler that extracts the correct value from IMask.\n *\n * When the user tabs away or clicks outside the input, we need to emit\n * the current value (either formatted or raw) via the onBlur event.\n *\n * @param onBlur - The onBlur handler from parent component\n * @param maskRef - Reference to the IMask instance (provides current values)\n * @param useMaskedValue - Whether to emit the formatted value or raw value\n * @param name - The input's name attribute (for the synthetic event)\n *\n * @example\n * // TelephoneQuestion - useMaskedValue=true\n * // Input displays: \"(555) 123-4567\"\n * // onBlur emits: \"(555) 123-4567\" (formatted)\n *\n * @example\n * // CurrencyQuestion - useMaskedValue=false\n * // Input displays: \"$1,234.56\"\n * // onBlur emits: \"1234.56\" (raw for validation/submission)\n */\nconst useBlurHandler = (\n onBlur: MaskedFieldProps[\"onBlur\"],\n maskRef: React.MutableRefObject<InputMask<FactoryOpts> | null>,\n useMaskedValue: boolean,\n name?: string,\n) => {\n return useCallback(\n (event: FocusEvent<Element>) => {\n // Exit early if no onBlur handler provided or mask isn't initialized\n if (!onBlur || !maskRef.current) {\n return;\n }\n\n // Extract current values from the IMask instance\n // maskRef.current.value: The formatted value (e.g., \"(555) 123-4567\")\n // maskRef.current.unmaskedValue: The raw value (e.g., \"5551234567\")\n const formattedValue = maskRef.current.value;\n const rawValue = maskRef.current.unmaskedValue;\n\n // Choose which value to emit based on useMaskedValue prop\n const valueToEmit = useMaskedValue ? formattedValue : rawValue;\n\n // Create an enhanced event that preserves the original event properties\n // but overrides the target to include our extracted value\n onBlur({\n ...event,\n target: { ...event.target, name, value: valueToEmit },\n } as FocusEvent<Element>);\n },\n [onBlur, maskRef, useMaskedValue, name],\n );\n};\n\n/**\n * Controlled MaskedField - for use with value prop.\n * Syncs external value changes to IMask via useEffect.\n *\n * Use this when:\n * - The parent component manages the input state\n * - You need to programmatically update the value\n * - You need validation or transformation on every change\n */\nconst ControlledMaskedField = ({\n mask,\n useMaskedValue = false,\n value,\n onChange,\n onBlur,\n name,\n forwardedRef,\n ...textFieldProps\n}: Omit<MaskedFieldProps, \"defaultValue\"> & {\n value: string | number;\n forwardedRef?: MaskedFieldRef;\n}) => {\n const onAccept = useAcceptHandler(onChange, useMaskedValue, name);\n const { ref: imaskRef, maskRef, setValue } = useIMask(mask, { onAccept });\n\n const combinedRef = useCombinedRef(imaskRef, forwardedRef);\n const handleBlur = useBlurHandler(onBlur, maskRef, useMaskedValue, name);\n\n // Sync external value changes to IMask\n useEffect(() => {\n if (!maskRef.current) {\n return;\n }\n\n const stringValue = value.toString();\n const currentMasked = maskRef.current.value;\n const currentUnmasked = maskRef.current.unmaskedValue;\n\n // Only update if value actually changed (prevents infinite loops)\n if (currentMasked !== stringValue && currentUnmasked !== stringValue) {\n setValue(stringValue);\n }\n }, [value, maskRef, setValue, imaskRef]);\n\n return (\n <TextField\n {...textFieldProps}\n ref={combinedRef}\n name={name}\n onBlur={handleBlur}\n />\n );\n};\n\n/**\n * Uncontrolled MaskedField - for use with defaultValue prop.\n * No value synchronization needed - IMask manages the value internally.\n *\n * Use this when:\n * - You only need the final value on submit\n * - You don't need to react to intermediate changes\n * - You want simpler code without state management\n */\nconst UncontrolledMaskedField = ({\n mask,\n useMaskedValue = false,\n defaultValue,\n onChange,\n onBlur,\n name,\n forwardedRef,\n ...textFieldProps\n}: Omit<MaskedFieldProps, \"value\"> & {\n defaultValue?: string | number;\n forwardedRef?: MaskedFieldRef;\n}) => {\n const onAccept = useAcceptHandler(onChange, useMaskedValue, name);\n const { ref: imaskRef, maskRef } = useIMask(mask, { onAccept });\n\n const combinedRef = useCombinedRef(imaskRef, forwardedRef);\n const handleBlur = useBlurHandler(onBlur, maskRef, useMaskedValue, name);\n\n return (\n <TextField\n {...textFieldProps}\n ref={combinedRef}\n name={name}\n onBlur={handleBlur}\n defaultValue={defaultValue?.toString()}\n />\n );\n};\n\nconst MaskedField = ({ ref: forwardedRef, ...props }: MaskedFieldProps) => {\n const { value, defaultValue, ...rest } = props;\n\n // Check for \"value\" in props (not `value !== undefined`) to maintain consistent\n // controlled/uncontrolled state throughout component lifetime and prevent focus loss.\n // Example: CurrencyQuestion passes value={undefined} initially, then value={5} after typing.\n if (\"value\" in props) {\n return (\n <ControlledMaskedField\n {...rest}\n value={value ?? \"\"}\n forwardedRef={forwardedRef}\n />\n );\n } else {\n return (\n <UncontrolledMaskedField\n {...rest}\n defaultValue={defaultValue}\n forwardedRef={forwardedRef}\n />\n );\n }\n};\n\nMaskedField.displayName = \"MaskedField\";\n\nexport { MaskedField };\n", "\"use client\";\n\nimport loadable from \"@loadable/component\";\nimport { TextField } from \"../TextField\";\nimport type { MaskedFieldProps } from \"./MaskedField\";\n\n/** Lazy-loads MaskedField (and react-imask) so consumers importing only TextField don't bundle react-imask. */\nconst LoadableMaskedField = loadable(() => import(\"./MaskedField\"), {\n resolveComponent: mod => mod.MaskedField,\n});\n\nexport function MaskedField(props: MaskedFieldProps) {\n const {\n mask: _mask,\n useMaskedValue: _useMaskedValue,\n \"data-testid\": _dataTestId,\n ref: forwardedRef,\n ...textFieldProps\n } = props;\n return (\n <LoadableMaskedField\n {...props}\n fallback={\n <TextField\n {...textFieldProps}\n ref={forwardedRef}\n type=\"text\"\n isDisabled\n isReadOnly\n />\n }\n />\n );\n}\n\nMaskedField.displayName = \"MaskedField\";\n\nexport type {\n MaskedFieldProps,\n MaskedFieldRef,\n MaskedFieldElementType,\n} from \"./MaskedField\";\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAEA,qBAKA;AAPA;AAAA;AAAA;AAAA;AAEA,0BAIO;AACP,mBAA+C;AAAA;AAAA;;;ACP/C,IAAAA,sBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IACAC;AADA;AAAA;AAAA;AACA,IAAAA,gBAA4B;AAAA;AAAA;;;ACD5B,IAAAC,kBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,SAAS,mBACd,MACoB;AACpB,SAAO,KAAK,OAAO,OAAO,EAAE,KAAK,GAAG,KAAK;AAC3C;AAJA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IACAC;AADA;AAAA;AAAA;AACA,IAAAA,gBAA4C;AAAA;AAAA;;;ACD5C,IAAAC,0BAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IACAC,eAEAC;AAHA;AAAA;AAAA;AACA,IAAAD,gBAAiD;AAEjD,IAAAC,uBAAkC;AAAA;AAAA;;;ACHlC,IAAAC,kBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC0BO,SAAS,SAAS;AAAA,EACvB,IAAI;AAAA,EACJ;AAAA,EACA,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,mBAAmB;AACrB,GAAkB;AAChB,MAAI,aAA2C,CAAC;AAChD,MAAI,aAA2C,CAAC;AAEhD,QAAM,kCAA8B,sBAAO,KAAK;AAEhD,QAAM,iBAAa,qBAAM;AACzB,QAAM,KAAK,cAAc;AACzB,QAAM,cAAU,qBAAM;AAEtB,MAAI,OAAO;AACT,qBAAiB,iBAAiB,GAAG,OAAO,IAAI,cAAc,K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Y,cAAc;",
4
+ "sourcesContent": ["\"use client\";\n\nimport {\n useDebouncedValue,\n useIsClient,\n useWindowEvent,\n} from \"@simplybusiness/mobius-hooks\";\nimport { useCallback, useMemo, useState } from \"react\";\nimport type { SizeType } from \"../../types\";\n\nexport type Breakpoint = {\n size: SizeType;\n value: number;\n};\nexport type BreakpointsType = Breakpoint[];\nexport type UseBreakpointType = {\n breakpoint: Breakpoint;\n up: (size: SizeType) => boolean | undefined;\n down: (size: SizeType) => boolean | undefined;\n};\n\n// Hard code breakpoints for SB designs\nexport const DEFAULT_BREAKPOINTS = [\n { size: \"xs\", value: 320 },\n { size: \"sm\", value: 480 },\n { size: \"md\", value: 670 },\n { size: \"lg\", value: 960 },\n { size: \"xl\", value: 1200 },\n { size: \"xxl\", value: 1320 },\n] as BreakpointsType;\n\nconst PASSIVE: AddEventListenerOptions = { passive: true };\n\nconst getBreakpoint = (breakpoints: BreakpointsType, windowWidth: number) => {\n // When breakpoint size and windowWidth are a match\n // The addition of 1px ensures the right breakpoint\n const closest = breakpoints.findIndex(\n breakpoint => breakpoint.value >= windowWidth + 1,\n );\n const smallest = breakpoints[0];\n const largest = breakpoints[breakpoints.length - 1];\n const match = breakpoints[closest - 1];\n\n if (closest === 0) return smallest;\n if (closest === -1) return largest;\n\n return match;\n};\n\nconst useBreakpoint = (\n customBreakpoints?: BreakpointsType,\n): UseBreakpointType => {\n const isClientSide = useIsClient();\n const breakpoints = customBreakpoints || DEFAULT_BREAKPOINTS;\n const defaultBreakpoint = breakpoints[0];\n\n const [windowWidth, setWindowWidth] = useState<number>(\n typeof globalThis?.window !== \"undefined\"\n ? window.innerWidth\n : defaultBreakpoint.value,\n );\n\n useWindowEvent(\"resize\", () => setWindowWidth(window.innerWidth), PASSIVE);\n\n const debouncedWidth = useDebouncedValue(windowWidth, 200);\n\n // Gate on isClientSide so up()/down() also return default-based values\n // during SSR and hydration, matching the server render.\n const currentBreakpoint = useMemo(\n () =>\n !isClientSide || breakpoints.length === 0\n ? defaultBreakpoint\n : getBreakpoint(breakpoints, debouncedWidth),\n [isClientSide, breakpoints, defaultBreakpoint, debouncedWidth],\n );\n\n const up = useCallback(\n (size: SizeType) => {\n const sizeIndex = breakpoints.findIndex(item => item.size === size);\n if (sizeIndex === -1) {\n return false;\n }\n const currentIndex = breakpoints.findIndex(\n item => item.size === currentBreakpoint.size,\n );\n\n return currentIndex >= sizeIndex;\n },\n [currentBreakpoint, breakpoints],\n );\n\n const down = useCallback(\n (size: SizeType) => {\n const sizeIndex = breakpoints.findIndex(item => item.size === size);\n if (sizeIndex === -1) {\n return true;\n }\n const currentIndex = breakpoints.findIndex(\n item => item.size === currentBreakpoint.size,\n );\n\n return currentIndex <= sizeIndex;\n },\n [currentBreakpoint, breakpoints],\n );\n\n return {\n breakpoint: currentBreakpoint,\n up,\n down,\n };\n};\n\nexport { useBreakpoint };\n", "export * from \"./useBreakpoint\";\n", "import type { JSXElementConstructor } from \"react\";\nimport { useCallback } from \"react\";\n\nexport interface UseButtonProps {\n elementType?:\n | \"button\"\n | \"a\"\n | \"span\"\n | \"input\"\n | JSXElementConstructor<unknown>\n | undefined;\n type?: \"button\" | \"submit\" | \"reset\";\n isDisabled?: boolean;\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n onPress?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n href?: string;\n target?: string;\n rel?: string;\n role?: string;\n name?: string | undefined;\n value?: string | undefined;\n}\n\nexport function useButton({\n elementType = \"button\",\n type = \"button\",\n isDisabled = false,\n href,\n target,\n rel,\n role,\n name,\n value,\n onClick,\n onPress,\n}: UseButtonProps) {\n const realOnClick = useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n if (isDisabled) {\n return;\n }\n\n onClick?.(event);\n onPress?.(event);\n },\n [isDisabled, onClick, onPress],\n );\n\n function getRole() {\n if (role) {\n return role;\n }\n\n if (elementType === \"a\") {\n return undefined;\n }\n\n return \"button\";\n }\n\n const extraProps =\n elementType === \"button\"\n ? { type }\n : {\n role: getRole(),\n };\n\n return {\n buttonProps: {\n href: elementType === \"a\" ? href : undefined,\n target: elementType === \"a\" ? target : undefined,\n rel: elementType === \"a\" ? rel : undefined,\n tabIndex: isDisabled ? -1 : 0,\n disabled: isDisabled || undefined,\n \"aria-disabled\": isDisabled || undefined,\n name:\n elementType === \"input\" || elementType === \"button\" ? name : undefined,\n value:\n elementType === \"input\" || elementType === \"button\" ? value : undefined,\n ...extraProps,\n onClick: realOnClick,\n },\n };\n}\n", "export * from \"./useButton\";\n", "export function spaceDelimitedList(\n list: (string | null | undefined)[],\n): string | undefined {\n return list.filter(Boolean).join(\" \") || undefined;\n}\n", "import type { MutableRefObject } from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { supportsDialog } from \"../../utils\";\n\n// Add polyfill for HTML Dialog in old browsers\nexport const useDialogPolyfill = () => {\n const [hasDialogSupport, setHasDialogSupport] = useState(false);\n const hasAlreadyLoaded = useRef(false);\n\n useEffect(() => {\n setHasDialogSupport(supportsDialog());\n }, []);\n\n const polyfillDialog = async (\n ref: MutableRefObject<HTMLDialogElement | null>,\n ) => {\n if (\n !hasAlreadyLoaded.current &&\n !hasDialogSupport &&\n typeof window !== \"undefined\" &&\n ref.current !== null\n ) {\n const { default: dialogPolyfill } = await import(\"dialog-polyfill\");\n\n hasAlreadyLoaded.current = true;\n try {\n if (ref.current) {\n dialogPolyfill.registerDialog(ref.current);\n }\n } catch (error) {\n console.error(\"Failed to load dialog-polyfill\", error);\n }\n }\n };\n\n return {\n polyfillDialog,\n };\n};\n", "export * from \"./useDialogPolyfill\";\n", "import type { MutableRefObject, SyntheticEvent } from \"react\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { supportsDialog } from \"../../utils\";\nimport { useBodyScrollLock } from \"@simplybusiness/mobius-hooks\";\nimport { useDialogPolyfill } from \"../useDialogPolyfill\";\n\nexport type TransitionProps = {\n isEnabled: boolean;\n CSSVariable: string;\n};\n\nexport type useDialogProps = {\n ref: MutableRefObject<HTMLDialogElement | null>;\n transition: TransitionProps;\n isOpen: boolean;\n onOpen?: () => void;\n onClose?: () => void;\n};\n\nconst TRANSITION_CLASS_NAME = \"--transition\";\nconst FALLBACK_TRANSITION_DURATION = 0;\n\nexport const useDialog = (props: useDialogProps) => {\n const { ref, isOpen, transition, onOpen, onClose } = props;\n const [hasDialogSupport, setHasDialogSupport] = useState(false);\n const shouldTransition = hasDialogSupport && transition.isEnabled;\n const { polyfillDialog } = useDialogPolyfill();\n\n useEffect(() => {\n setHasDialogSupport(supportsDialog());\n }, []);\n\n // Read CSS variable value as number\n const TRANSITION_DURATION_IN_MS =\n (ref.current &&\n Number(\n getComputedStyle(ref.current)\n .getPropertyValue(transition.CSSVariable)\n .replace(\"ms\", \"\"),\n )) ||\n FALLBACK_TRANSITION_DURATION;\n\n useBodyScrollLock({ enabled: isOpen });\n\n const open = useCallback(() => {\n ref.current?.showModal();\n onOpen?.();\n }, [onOpen, ref]);\n\n const close = useCallback(() => {\n ref.current?.close();\n onClose?.();\n }, [onClose, ref]);\n\n // Add close handler, to enable closing transitions\n const handleClose = useCallback(\n (event?: SyntheticEvent<HTMLElement, Event>) => {\n if (event) {\n // Prevent default event coming from onCancel,\n // which is triggered by pressing ESC key\n event.preventDefault();\n // Ensure that nested `<dialog>` elements\n // don't close the parent\n event.stopPropagation();\n }\n\n if (shouldTransition) {\n ref.current?.classList.remove(TRANSITION_CLASS_NAME);\n // Delay close to allow exit transition\n setTimeout(() => close(), TRANSITION_DURATION_IN_MS);\n } else {\n close();\n }\n },\n [TRANSITION_DURATION_IN_MS, close, ref, shouldTransition],\n );\n\n useEffect(() => {\n async function toggleDialog() {\n if (isOpen && !ref.current?.open) {\n await polyfillDialog(ref);\n\n open();\n // Fix opening transition in Safari being skipped\n // by wrapping with setTimeout\n setTimeout(() => {\n ref.current?.classList.add(TRANSITION_CLASS_NAME);\n }, 0);\n } else if (!isOpen && ref.current?.open) {\n handleClose();\n }\n }\n\n void toggleDialog();\n }, [handleClose, isOpen, open, ref, polyfillDialog]);\n\n return {\n open,\n close: handleClose,\n };\n};\n", "export * from \"./useDialog\";\n", "import type { LabelHTMLAttributes } from \"react\";\nimport { useId, useRef } from \"react\";\n\nexport type UseLabelProps = {\n id?: string | undefined;\n label?: string | undefined;\n \"aria-label\"?: string | undefined;\n \"aria-labelledby\"?: string | undefined;\n labelElementType?: \"label\" | \"span\" | undefined;\n};\n\nexport type UseLabelReturn = {\n labelProps: {\n id?: string | undefined;\n } & LabelHTMLAttributes<HTMLLabelElement>;\n fieldProps: LabellingProps;\n};\n\nexport type LabellingProps = {\n id?: string | undefined;\n \"aria-label\"?: string | undefined;\n \"aria-labelledby\"?: string | undefined;\n \"aria-describedby\"?: string | undefined;\n \"aria-details\"?: string | undefined;\n};\n\nexport function useLabel({\n id: providedId,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n labelElementType = \"label\",\n}: UseLabelProps) {\n let labelProps: UseLabelReturn[\"labelProps\"] = {};\n let fieldProps: UseLabelReturn[\"fieldProps\"] = {};\n\n const hasWarnedAboutMissingLabels = useRef(false);\n\n const fallbackId = useId();\n const id = providedId || fallbackId;\n const labelId = useId();\n\n if (label) {\n ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;\n labelProps = {\n id: labelId,\n htmlFor: labelElementType === \"label\" ? id : undefined,\n };\n } else if (\n !ariaLabelledby &&\n !ariaLabel &&\n !hasWarnedAboutMissingLabels.current\n ) {\n hasWarnedAboutMissingLabels.current = true;\n console.warn(\n \"If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility\",\n );\n }\n\n fieldProps = {\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n };\n\n return {\n labelProps,\n fieldProps,\n };\n}\n", "export * from \"./useLabel\";\n", "import { useId } from \"react\";\nimport { spaceDelimitedList } from \"../../utils/spaceDelimitedList\";\nimport { useLabel } from \"../useLabel/useLabel\";\nimport type { UseTextFieldProps, UseTextFieldReturn } from \"./types\";\n\nexport function useTextField(props: UseTextFieldProps): UseTextFieldReturn {\n const {\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n inputElementType = \"input\",\n } = props;\n const { labelProps, fieldProps } = useLabel(props);\n\n const descriptionId = useId();\n const descriptionProps = { id: descriptionId };\n\n const errorMessageId = useId();\n const errorMessageProps = { id: errorMessageId };\n\n const ariaDescribedBy = spaceDelimitedList([\n props.description && descriptionId,\n props.errorMessage && errorMessageId,\n props[\"aria-describedby\"],\n ]);\n\n return {\n descriptionProps,\n errorMessageProps,\n labelProps,\n inputProps: {\n defaultValue: props.defaultValue,\n value: props.value,\n onChange: props.onChange,\n disabled: isDisabled,\n readOnly: isReadOnly,\n required: isRequired,\n \"aria-required\": isRequired === true ? true : undefined,\n \"aria-invalid\": props.isInvalid,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": props[\"aria-errormessage\"],\n role: props.role,\n\n type: inputElementType === \"input\" ? props.type : undefined,\n pattern: inputElementType === \"input\" ? props.pattern : undefined,\n\n autoComplete: props.autoComplete,\n maxLength: props.maxLength,\n minLength: props.minLength,\n name: props.name,\n placeholder: props.placeholder,\n inputMode: props.inputMode,\n\n // Clipboard events\n onCopy: props.onCopy,\n onCut: props.onCut,\n onPaste: props.onPaste,\n\n // Composition events\n onCompositionEnd: props.onCompositionEnd,\n onCompositionStart: props.onCompositionStart,\n onCompositionUpdate: props.onCompositionUpdate,\n\n // Selection events\n onSelect: props.onSelect,\n\n // Input events\n onBeforeInput: props.onBeforeInput,\n onInput: props.onInput,\n\n // Focus events\n onFocus: props.onFocus,\n onBlur: props.onBlur,\n\n ...fieldProps,\n },\n };\n}\n", "import type { AriaRole, InputHTMLAttributes } from \"react\";\nimport type { UseLabelProps, UseLabelReturn } from \"../useLabel/useLabel\";\nimport type { FocusEvents, Validation } from \"../../types\";\n\nexport type UseTextFieldProps = UseLabelProps &\n FocusEvents &\n Validation &\n Pick<\n InputHTMLAttributes<HTMLInputElement>,\n | \"defaultValue\"\n | \"value\"\n | \"onChange\"\n | \"autoComplete\"\n | \"maxLength\"\n | \"minLength\"\n | \"name\"\n | \"placeholder\"\n | \"inputMode\"\n | \"type\"\n | \"pattern\"\n\n // Clipboard events\n | \"onCopy\"\n | \"onCut\"\n | \"onPaste\"\n\n // Keyboard events\n | \"onKeyDown\"\n | \"onKeyUp\"\n | \"onKeyPress\"\n\n // Composition events\n | \"onCompositionEnd\"\n | \"onCompositionStart\"\n | \"onCompositionUpdate\"\n\n // Selection events\n | \"onSelect\"\n\n // Input events\n | \"onBeforeInput\"\n | \"onInput\"\n\n // Number types\n | \"min\"\n | \"max\"\n | \"step\"\n > & {\n inputElementType?: \"input\" | \"textarea\" | undefined;\n defaultValue?: string | undefined;\n value?: string | undefined;\n isDisabled?: boolean | undefined;\n isReadOnly?: boolean | undefined;\n isRequired?: boolean | undefined;\n description?: string | undefined;\n errorMessage?: string | undefined;\n \"aria-describedby\"?: string | undefined;\n \"aria-errormessage\"?: string | undefined;\n role?: AriaRole | undefined;\n };\n\nexport type UseTextFieldReturn = {\n labelProps: UseLabelReturn[\"labelProps\"];\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n descriptionProps: { id?: string | undefined };\n errorMessageProps: { id?: string | undefined };\n};\n", "export * from \"./useTextField\";\nexport * from \"./types\";\n", "import type { Validation } from \"../../types\";\n\nexport type GetValidationClassesProps = Pick<Validation, \"isInvalid\">;\n\nexport const useValidationClasses = (props: GetValidationClassesProps) => {\n const { isInvalid } = props;\n\n if (isInvalid) {\n return \"--is-invalid\";\n }\n\n if (isInvalid === false) {\n return \"--is-valid\";\n }\n\n return \"\";\n};\n", "export * from \"./useValidationClasses\";\n", "export * from \"./useBreakpoint\";\nexport * from \"./useButton\";\nexport * from \"./useDialog\";\nexport * from \"./useDialogPolyfill\";\nexport * from \"./useLabel\";\nexport * from \"./useTextField\";\nexport * from \"./useValidationClasses\";\n", "import classNames from \"classnames/dedupe\";\nimport type { IconProps } from \"./types\";\nimport \"./Icon.css\";\n\nconst ICON_PREFIX = \"mobius-icon\";\n\nconst capitaliseFirstLetter = (str: string) =>\n str.charAt(0).toUpperCase() + str.slice(1);\n\nexport function Icon({\n ref,\n icon,\n className,\n size = \"xs\",\n color,\n fixedWidth,\n spin,\n spinReverse,\n title,\n ...otherProps\n}: IconProps) {\n if (!icon) {\n throw new Error(\"Must specify icon object\");\n }\n\n const classes = classNames(\n \"mobius\",\n \"mobius-icon\",\n `svg-inline--${ICON_PREFIX}`,\n `--size-${size}`,\n className,\n {\n [`${ICON_PREFIX}-fw`]: fixedWidth,\n [`${ICON_PREFIX}-spin`]: spin || spinReverse,\n [`${ICON_PREFIX}-spin-reverse`]: spinReverse,\n },\n );\n\n const { iconName, width, height, svgPathData } = icon;\n const formattedIconName = iconName.split(\"-\").join(\" \");\n\n const defaultTitle = `${capitaliseFirstLetter(formattedIconName)} icon`;\n const titleText = title || defaultTitle;\n\n return (\n <svg\n ref={ref}\n focusable=\"false\"\n data-icon={iconName}\n className={classes}\n role=\"img\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox={`0 0 ${width} ${height}`}\n style={{ color }}\n {...otherProps}\n >\n <title>{titleText}</title>\n <path fill=\"currentColor\" d={svgPathData} />\n </svg>\n );\n}\n", "import type { RefAttributes } from \"react\";\nimport type { IconDefinition } from \"../../types/icon\";\n\nexport type IconSizeProp = \"xs\" | \"sm\" | \"md\" | \"lg\";\n\nexport interface IconProps extends RefAttributes<SVGSVGElement> {\n icon?: IconDefinition;\n className?: string;\n size?: IconSizeProp;\n color?: string;\n fixedWidth?: boolean;\n title?: string;\n\n // Animations\n spin?: boolean;\n spinReverse?: boolean;\n}\n", "export * from \"./Icon\";\nexport * from \"./types\";\n", "import type { ReactNode, RefAttributes } from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport type { DOMProps } from \"../../types/dom\";\nimport \"./Text.css\";\n\nexport type TextElementType = HTMLHeadingElement | HTMLParagraphElement;\nexport type TextVariantType =\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"body\"\n | \"small\"\n | \"legal\"\n | \"title\";\nexport type ElementType = \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"p\" | \"span\";\nexport interface TextProps extends DOMProps, RefAttributes<TextElementType> {\n /** HTML element for the text */\n elementType?: ElementType;\n /** Specify font size override */\n variant?: TextVariantType;\n /** Specify compact line height override */\n spacing?: \"loose\" | \"tight\";\n /** Custom class name for setting specific CSS */\n className?: string;\n children: ReactNode;\n style?: React.CSSProperties;\n}\n\nexport const getElementType = (\n variant: TextVariantType | undefined,\n elementType: ElementType | undefined,\n): ElementType => {\n // Explicit elementType always wins\n if (elementType) {\n return elementType;\n }\n // Infer element from variant\n if (variant && [\"h1\", \"h2\", \"h3\", \"h4\"].includes(variant)) {\n return variant as ElementType;\n }\n return \"p\";\n};\n\nconst Text = ({ ref, elementType, ...props }: TextProps) => {\n // Remove non-DOM props from element\n const { variant, className, spacing, ...otherProps } = props;\n\n // If a variant is supplied, set the class name and element type\n const Element: ElementType = getElementType(variant, elementType);\n const variantType = variant || Element;\n const classes = classNames(\n \"mobius\",\n \"mobius-text\",\n { [`--is-${variantType}`]: variantType },\n { [`--has-line-height-${spacing}`]: spacing },\n className,\n );\n\n return <Element ref={ref} {...otherProps} className={classes} />;\n};\n\nText.displayName = \"Text\";\nexport { Text };\n", "import classNames from \"classnames/dedupe\";\nimport type { RefAttributes } from \"react\";\nimport { useMemo } from \"react\";\nimport type { TextElementType, TextProps } from \"../Text/Text\";\nimport { Text, getElementType } from \"../Text/Text\";\n\nexport type HTMLElementType = \"span\" | \"div\";\n\n// Block-level tags that cannot be nested inside <p>.\nconst BLOCK_TAG =\n /<(div|p|ul|ol|li|h[1-6]|table|tr|td|th|blockquote|pre|hr|dl|dt|dd)[\\s>/]/i;\nconst containsBlockHTML = (text: string) => BLOCK_TAG.test(text);\nconst containsHTML = (text: string) =>\n /<[a-z/]/i.test(text) || /&(?:#\\d+|#x[\\da-f]+|[a-z]\\w*);/i.test(text); // tag or entity\n\nconst buildTextClasses = (\n textProps: Omit<TextProps, \"children\">,\n htmlClassName?: string,\n) => {\n const { variant, elementType, spacing, className } = textProps;\n const variantType = variant || getElementType(variant, elementType);\n return classNames(\n \"mobius\",\n \"mobius-text\",\n { [`--is-${variantType}`]: variantType },\n { [`--has-line-height-${spacing}`]: spacing },\n className,\n htmlClassName,\n );\n};\n\nexport interface TextOrHTMLProps\n extends Omit<TextProps, \"children\">, RefAttributes<TextElementType> {\n /** HTML string to be rendered with dangerouslySetInnerHTML */\n text: string;\n /** Custom class name for the dangerous HTML element */\n htmlClassName?: string;\n /** HTML element type for the dangerous HTML element */\n htmlElementType?: HTMLElementType;\n /** If true, wraps the dangerous HTML element inside a Text component */\n textWrapper?: boolean;\n /** If true, auto-detects whether text is HTML or plain text to determine wrapping and element type */\n autoDetect?: boolean;\n}\n\nconst TextOrHTML = ({\n ref,\n text,\n htmlClassName,\n htmlElementType,\n textWrapper = false,\n autoDetect = false,\n ...textProps\n}: TextOrHTMLProps) => {\n const hasBlockContent = autoDetect && containsBlockHTML(text);\n\n // Memoize the dangerouslySetInnerHTML object to prevent unnecessary re-renders\n // See: https://github.com/facebook/react/issues/31660\n const dangerousHTML = useMemo(() => ({ __html: text }), [text]);\n\n // Non-block text with autoDetect: render directly on a Text-equivalent element,\n // avoiding unnecessary <span> nesting inside <p>.\n if (autoDetect && !hasBlockContent) {\n const { variant, spacing, elementType, className, ...domProps } = textProps;\n const Element = getElementType(variant, elementType);\n const classes = buildTextClasses(textProps, htmlClassName);\n\n return containsHTML(text) ? (\n <Element\n ref={ref}\n {...domProps}\n className={classes}\n dangerouslySetInnerHTML={dangerousHTML}\n />\n ) : (\n <Element ref={ref} {...domProps} className={classes}>\n {text}\n </Element>\n );\n }\n\n const DangerousComponent =\n htmlElementType ?? (hasBlockContent ? \"div\" : \"span\");\n const dangerousElement = (\n <DangerousComponent\n className={htmlClassName}\n dangerouslySetInnerHTML={dangerousHTML}\n />\n );\n\n if (textWrapper) {\n return (\n <Text ref={ref} {...textProps}>\n {dangerousElement}\n </Text>\n );\n }\n\n return dangerousElement;\n};\n\nTextOrHTML.displayName = \"TextOrHTML\";\nexport { TextOrHTML };\n", "export * from \"./TextOrHTML\";\n", "import { error } from \"@simplybusiness/icons\";\nimport classNames from \"classnames/dedupe\";\nimport { Icon } from \"../Icon\";\nimport { TextOrHTML } from \"../TextOrHTML\";\nimport \"./ErrorMessage.css\";\n\nexport interface ErrorMessageProps {\n errorMessage?: string;\n id?: string;\n className?: string;\n}\n\nexport const ErrorMessage = ({\n id,\n errorMessage,\n className,\n}: ErrorMessageProps) => {\n const classes = classNames(\"mobius\", \"mobius-error-message\", className);\n\n if (!errorMessage) return null;\n\n return (\n <div id={id} className={classes} data-testid=\"ErrorMessage\" role=\"alert\">\n <Icon\n icon={error}\n className=\"mobius-error-message__icon\"\n aria-hidden=\"true\"\n />\n <TextOrHTML\n elementType=\"span\"\n className=\"mobius-error-message__text\"\n text={errorMessage}\n />\n </div>\n );\n};\n\nErrorMessage.displayName = \"ErrorMessage\";\n", "export * from \"./ErrorMessage\";\n", "import type React from \"react\";\nimport type { ReactNode, RefAttributes } from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport type { DOMProps } from \"../../types/dom\";\nimport \"./Label.css\";\n\nexport type LabelElementType = HTMLLabelElement;\nexport type IntrinsicLabel = Omit<\n React.JSX.IntrinsicElements[\"label\"],\n \"css\" | \"color\" | \"ref\"\n>;\n\nexport interface LabelProps\n extends IntrinsicLabel, DOMProps, RefAttributes<LabelElementType> {\n children?: ReactNode;\n className?: string;\n elementType?: \"label\" | \"span\";\n}\n\nconst Label = ({ ref, ...props }: LabelProps) => {\n const { elementType: Element = \"label\", children, ...otherProps } = props;\n\n const classes = classNames(\"mobius\", \"mobius-label\", props.className);\n otherProps.className = classes;\n\n return (\n <Element ref={ref} {...otherProps} className={classes}>\n {children}\n </Element>\n );\n};\n\nLabel.displayName = \"Label\";\nexport { Label };\n", "export * from \"./Label\";\n", "import type { Ref, RefAttributes, ReactNode } from \"react\";\nimport type React from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport type { DOMProps } from \"../../types/dom\";\nimport type { SpacingType } from \"../../types\";\nimport \"./Stack.css\";\n\nexport type StackElementType = HTMLDivElement;\n\nexport interface StackProps extends DOMProps, RefAttributes<StackElementType> {\n children?: ReactNode;\n /** How big a gap between items */\n gap?: SpacingType;\n /** Custom class name for setting specific CSS */\n className?: string;\n elementType?: React.ElementType;\n}\n\nexport type StackRef = Ref<StackElementType>;\n\nexport const Stack = ({ ref, ...props }: StackProps) => {\n const { elementType: Element = \"div\", gap, ...otherProps } = props;\n\n const classes = classNames(\n \"mobius\",\n \"mobius-stack\",\n {\n [`--gap-${gap}`]: gap,\n },\n otherProps.className,\n );\n\n return <Element ref={ref} {...otherProps} className={classes} />;\n};\n\nStack.displayName = \"Stack\";\n", "export * from \"./Stack\";\n", "import classNames from \"classnames/dedupe\";\nimport type { ReactElement } from \"react\";\nimport { cloneElement } from \"react\";\n\nexport const adornmentWithClassName = (\n component?: ReactElement,\n validationClasses?: string,\n className?: string,\n) => {\n if (!component) return null;\n\n return cloneElement(component, {\n className: classNames(\n (component.props as { className?: string }).className,\n validationClasses,\n className,\n ),\n } as { className: string });\n};\n", "\"use client\";\n\nimport classNames from \"classnames/dedupe\";\nimport type {\n HTMLInputTypeAttribute,\n ReactElement,\n ReactNode,\n Ref,\n RefAttributes,\n} from \"react\";\nimport type { UseTextFieldProps } from \"../../hooks\";\nimport { useTextField, useValidationClasses } from \"../../hooks\";\nimport type { DOMProps, FocusEvents } from \"../../types\";\nimport { ErrorMessage } from \"../ErrorMessage\";\nimport { Label } from \"../Label\";\nimport { Stack } from \"../Stack\";\nimport { adornmentWithClassName } from \"./adornmentWithClassName\";\nimport \"./TextField.css\";\n\nexport type TextFieldElementType = HTMLInputElement;\nexport interface TextFieldProps\n extends\n DOMProps,\n FocusEvents,\n UseTextFieldProps,\n RefAttributes<TextFieldElementType> {\n className?: string;\n errorMessage?: string;\n children?: ReactNode;\n label?: string;\n type?: Exclude<\n HTMLInputTypeAttribute,\n | \"button\"\n | \"checkbox\"\n | \"color\"\n | \"date\"\n | \"datetime-local\"\n | \"file\"\n | \"image\"\n | \"month\"\n | \"radio\"\n | \"range\"\n | \"reset\"\n | \"submit\"\n | \"week\"\n >;\n prefixInside?: ReactElement;\n prefixOutside?: ReactElement;\n suffixInside?: ReactElement;\n suffixOutside?: ReactElement;\n}\n\nexport type TextFieldRef = Ref<TextFieldElementType>;\n\nconst TextField = ({ ref, ...props }: TextFieldProps) => {\n const {\n isDisabled,\n type = \"text\",\n isInvalid,\n className,\n label,\n errorMessage,\n children,\n isRequired,\n prefixInside,\n prefixOutside,\n suffixInside,\n suffixOutside,\n autoComplete,\n isReadOnly,\n ...otherProps\n } = props;\n\n const resolvedAutoComplete =\n autoComplete ??\n (type === \"email\" ? \"email\" : type === \"tel\" ? \"tel\" : undefined);\n\n const { inputProps, labelProps, errorMessageProps } = useTextField({\n ...props,\n autoComplete: resolvedAutoComplete,\n \"aria-errormessage\": errorMessage,\n });\n\n const hidden = type === \"hidden\";\n\n const validationClasses = useValidationClasses({ isInvalid });\n\n const textfieldClasses = {\n \"--is-disabled\": isDisabled,\n \"--is-required\": typeof isRequired === \"boolean\" && isRequired,\n \"--is-optional\": typeof isRequired === \"boolean\" && !isRequired,\n \"--is-hidden\": hidden,\n [className || \"\"]: true,\n };\n\n const sharedClasses = classNames(validationClasses, textfieldClasses);\n\n const labelClasses = classNames(\n {\n \"--is-disabled\": isDisabled,\n },\n validationClasses,\n );\n\n const containerClasses = classNames(\n \"mobius\",\n \"mobius-text-field\",\n sharedClasses,\n );\n\n const inputClasses = classNames(\n \"mobius\",\n \"mobius-text-field__input\",\n sharedClasses,\n );\n\n const inputWrapperClasses = classNames(\n \"mobius-text-field__input-wrapper\",\n sharedClasses,\n );\n\n return (\n <Stack gap=\"xs\" className={containerClasses}>\n {label && !hidden && (\n <Label {...labelProps} className={labelClasses}>\n {label}\n </Label>\n )}\n <div className=\"mobius-text-field__inner-container\">\n {adornmentWithClassName(\n prefixOutside,\n labelClasses,\n \"mobius-text-field__prefix-outside\",\n )}\n <div className={inputWrapperClasses}>\n {adornmentWithClassName(\n prefixInside,\n labelClasses,\n \"mobius-text-field__prefix-inside\",\n )}\n <input\n {...otherProps}\n {...inputProps}\n ref={ref}\n type={type}\n className={inputClasses}\n />\n {adornmentWithClassName(\n suffixInside,\n labelClasses,\n \"mobius-text-field__suffix-inside\",\n )}\n </div>\n {adornmentWithClassName(\n suffixOutside,\n labelClasses,\n \"mobius-text-field__suffix-outside\",\n )}\n </div>\n {children && (\n <div className=\"mobius-text-field__children\">{children}</div>\n )}\n\n <ErrorMessage {...errorMessageProps} errorMessage={errorMessage} />\n </Stack>\n );\n};\n\nTextField.displayName = \"TextField\";\nexport { TextField };\n", "export * from \"./TextField\";\n", "\"use client\";\n\nimport type { ChangeEvent, FocusEvent, Ref, RefAttributes } from \"react\";\nimport { useCallback, useEffect } from \"react\";\nimport { useIMask } from \"react-imask\";\nimport type { FactoryOpts, InputMask, InputMaskElement } from \"imask\";\nimport type { TextFieldProps } from \"../TextField\";\nimport { TextField } from \"../TextField\";\n\nexport type MaskedFieldElementType = HTMLInputElement;\n\nexport interface MaskedFieldProps\n extends\n Omit<TextFieldProps, \"type\" | \"ref\">,\n RefAttributes<MaskedFieldElementType> {\n mask: FactoryOpts;\n \"data-testid\"?: string;\n /**\n * If true, onChange and onBlur events will emit the masked (formatted) value.\n * If false (default), events will emit the unmasked (raw) value.\n *\n * @example\n * // TelephoneQuestion uses useMaskedValue={true}\n * // User types: 5551234567\n * // onChange receives: \"(555) 123-4567\" (formatted for display/storage)\n *\n * @example\n * // CurrencyQuestion uses useMaskedValue={false}\n * // User types: 1234\n * // User sees: \"1,234\" (with thousands separator)\n * // onChange receives: \"1234\" (raw number for calculations)\n */\n useMaskedValue?: boolean;\n}\n\nexport type MaskedFieldRef = Ref<MaskedFieldElementType>;\n\n/**\n * Creates an onChange handler for IMask's onAccept callback.\n *\n * IMask calls onAccept every time the user types and the mask accepts the input.\n * This handler converts IMask's callback into a standard React onChange event.\n *\n * @param onChange - The onChange handler from parent component\n * @param useMaskedValue - Whether to emit the formatted value or raw value\n * @param name - The input's name attribute (for the synthetic event)\n *\n * @example\n * // TelephoneQuestion (US) - useMaskedValue=true\n * // User types: \"5551234567\"\n * // Emits: \"(555) 123-4567\" (formatted for display)\n * // Use case: Want to store/display the formatted phone number\n *\n * @example\n * // CurrencyQuestion - useMaskedValue=false\n * // User types: \"1234.56\"\n * // User sees: \"1,234.56\" (with formatting)\n * // Emits: \"1234.56\" (raw value for calculations)\n * // Use case: Need numeric value for backend/calculations\n */\nconst useAcceptHandler = (\n onChange: MaskedFieldProps[\"onChange\"],\n useMaskedValue: boolean,\n name?: string,\n) => {\n return useCallback(\n (maskedValue: string, maskInstance: InputMask<FactoryOpts>) => {\n // Exit early if no onChange handler provided\n if (!onChange) {\n return;\n }\n\n // IMask provides two values:\n // 1. maskedValue: The formatted value user sees (e.g., \"(555) 123-4567\")\n // 2. maskInstance.unmaskedValue: The raw value without formatting (e.g., \"5551234567\")\n const formattedValue = maskedValue;\n const rawValue = maskInstance.unmaskedValue;\n\n // Choose which value to emit based on useMaskedValue prop\n const valueToEmit = useMaskedValue ? formattedValue : rawValue;\n\n // Create a synthetic React event that matches the standard onChange signature\n // This allows parent components to handle it like any other input change\n onChange({\n target: { name, value: valueToEmit },\n } as ChangeEvent<HTMLInputElement>);\n },\n [onChange, useMaskedValue, name],\n );\n};\n\n/**\n * Creates a ref callback that forwards the input element to both IMask and the parent component.\n *\n * React allows two ways to pass refs:\n * 1. Ref callback function: (element) => { ... }\n * 2. Ref object: { current: element }\n *\n * This hook handles both cases and also ensures IMask gets the element reference it needs.\n *\n * @param imaskRef - IMask's ref (needs the element to apply masking)\n * @param forwardedRef - Parent component's ref (could be function or object)\n *\n * @example\n * // Parent uses callback ref\n * <MaskedField ref={(el) => console.log(el)} />\n *\n * @example\n * // Parent uses useRef\n * const inputRef = useRef(null);\n * <MaskedField ref={inputRef} />\n */\nconst useCombinedRef = (\n imaskRef: React.MutableRefObject<InputMaskElement | null>,\n forwardedRef?: MaskedFieldRef,\n) => {\n return useCallback(\n (element: HTMLInputElement | null) => {\n // First, give the element to IMask so it can apply masking\n imaskRef.current = element;\n\n // Then forward the element to the parent component's ref\n // Handle both callback refs and ref objects\n\n // Case 1: Parent passed a callback ref function\n if (typeof forwardedRef === \"function\") {\n forwardedRef(element);\n }\n // Case 2: Parent passed a ref object (from useRef)\n else if (forwardedRef) {\n forwardedRef.current = element;\n }\n // Case 3: No ref was forwarded (forwardedRef is null/undefined)\n // Do nothing - this is fine\n },\n [imaskRef, forwardedRef],\n );\n};\n\n/**\n * Creates an onBlur handler that extracts the correct value from IMask.\n *\n * When the user tabs away or clicks outside the input, we need to emit\n * the current value (either formatted or raw) via the onBlur event.\n *\n * @param onBlur - The onBlur handler from parent component\n * @param maskRef - Reference to the IMask instance (provides current values)\n * @param useMaskedValue - Whether to emit the formatted value or raw value\n * @param name - The input's name attribute (for the synthetic event)\n *\n * @example\n * // TelephoneQuestion - useMaskedValue=true\n * // Input displays: \"(555) 123-4567\"\n * // onBlur emits: \"(555) 123-4567\" (formatted)\n *\n * @example\n * // CurrencyQuestion - useMaskedValue=false\n * // Input displays: \"$1,234.56\"\n * // onBlur emits: \"1234.56\" (raw for validation/submission)\n */\nconst useBlurHandler = (\n onBlur: MaskedFieldProps[\"onBlur\"],\n maskRef: React.MutableRefObject<InputMask<FactoryOpts> | null>,\n useMaskedValue: boolean,\n name?: string,\n) => {\n return useCallback(\n (event: FocusEvent<Element>) => {\n // Exit early if no onBlur handler provided or mask isn't initialized\n if (!onBlur || !maskRef.current) {\n return;\n }\n\n // Extract current values from the IMask instance\n // maskRef.current.value: The formatted value (e.g., \"(555) 123-4567\")\n // maskRef.current.unmaskedValue: The raw value (e.g., \"5551234567\")\n const formattedValue = maskRef.current.value;\n const rawValue = maskRef.current.unmaskedValue;\n\n // Choose which value to emit based on useMaskedValue prop\n const valueToEmit = useMaskedValue ? formattedValue : rawValue;\n\n // Create an enhanced event that preserves the original event properties\n // but overrides the target to include our extracted value\n onBlur({\n ...event,\n target: { ...event.target, name, value: valueToEmit },\n } as FocusEvent<Element>);\n },\n [onBlur, maskRef, useMaskedValue, name],\n );\n};\n\n/**\n * Controlled MaskedField - for use with value prop.\n * Syncs external value changes to IMask via useEffect.\n *\n * Use this when:\n * - The parent component manages the input state\n * - You need to programmatically update the value\n * - You need validation or transformation on every change\n */\nconst ControlledMaskedField = ({\n mask,\n useMaskedValue = false,\n value,\n onChange,\n onBlur,\n name,\n forwardedRef,\n ...textFieldProps\n}: Omit<MaskedFieldProps, \"defaultValue\"> & {\n value: string | number;\n forwardedRef?: MaskedFieldRef;\n}) => {\n const onAccept = useAcceptHandler(onChange, useMaskedValue, name);\n const { ref: imaskRef, maskRef, setValue } = useIMask(mask, { onAccept });\n\n const combinedRef = useCombinedRef(imaskRef, forwardedRef);\n const handleBlur = useBlurHandler(onBlur, maskRef, useMaskedValue, name);\n\n // Sync external value changes to IMask\n useEffect(() => {\n if (!maskRef.current) {\n return;\n }\n\n const stringValue = value.toString();\n const currentMasked = maskRef.current.value;\n const currentUnmasked = maskRef.current.unmaskedValue;\n\n // Only update if value actually changed (prevents infinite loops)\n if (currentMasked !== stringValue && currentUnmasked !== stringValue) {\n setValue(stringValue);\n }\n }, [value, maskRef, setValue, imaskRef]);\n\n return (\n <TextField\n {...textFieldProps}\n ref={combinedRef}\n name={name}\n onBlur={handleBlur}\n />\n );\n};\n\n/**\n * Uncontrolled MaskedField - for use with defaultValue prop.\n * No value synchronization needed - IMask manages the value internally.\n *\n * Use this when:\n * - You only need the final value on submit\n * - You don't need to react to intermediate changes\n * - You want simpler code without state management\n */\nconst UncontrolledMaskedField = ({\n mask,\n useMaskedValue = false,\n defaultValue,\n onChange,\n onBlur,\n name,\n forwardedRef,\n ...textFieldProps\n}: Omit<MaskedFieldProps, \"value\"> & {\n defaultValue?: string | number;\n forwardedRef?: MaskedFieldRef;\n}) => {\n const onAccept = useAcceptHandler(onChange, useMaskedValue, name);\n const { ref: imaskRef, maskRef } = useIMask(mask, { onAccept });\n\n const combinedRef = useCombinedRef(imaskRef, forwardedRef);\n const handleBlur = useBlurHandler(onBlur, maskRef, useMaskedValue, name);\n\n return (\n <TextField\n {...textFieldProps}\n ref={combinedRef}\n name={name}\n onBlur={handleBlur}\n defaultValue={defaultValue?.toString()}\n />\n );\n};\n\nconst MaskedField = ({ ref: forwardedRef, ...props }: MaskedFieldProps) => {\n const { value, defaultValue, ...rest } = props;\n\n // Check for \"value\" in props (not `value !== undefined`) to maintain consistent\n // controlled/uncontrolled state throughout component lifetime and prevent focus loss.\n // Example: CurrencyQuestion passes value={undefined} initially, then value={5} after typing.\n if (\"value\" in props) {\n return (\n <ControlledMaskedField\n {...rest}\n value={value ?? \"\"}\n forwardedRef={forwardedRef}\n />\n );\n } else {\n return (\n <UncontrolledMaskedField\n {...rest}\n defaultValue={defaultValue}\n forwardedRef={forwardedRef}\n />\n );\n }\n};\n\nMaskedField.displayName = \"MaskedField\";\n\nexport { MaskedField };\n", "\"use client\";\n\nimport loadable from \"@loadable/component\";\nimport { TextField } from \"../TextField\";\nimport type { MaskedFieldProps } from \"./MaskedField\";\n\n/** Lazy-loads MaskedField (and react-imask) so consumers importing only TextField don't bundle react-imask. */\nconst LoadableMaskedField = loadable(() => import(\"./MaskedField\"), {\n resolveComponent: mod => mod.MaskedField,\n});\n\nexport function MaskedField(props: MaskedFieldProps) {\n const {\n mask: _mask,\n useMaskedValue: _useMaskedValue,\n \"data-testid\": _dataTestId,\n ref: forwardedRef,\n ...textFieldProps\n } = props;\n return (\n <LoadableMaskedField\n {...props}\n fallback={\n <TextField\n {...textFieldProps}\n ref={forwardedRef}\n type=\"text\"\n isDisabled\n isReadOnly\n />\n }\n />\n );\n}\n\nMaskedField.displayName = \"MaskedField\";\n\nexport type {\n MaskedFieldProps,\n MaskedFieldRef,\n MaskedFieldElementType,\n} from \"./MaskedField\";\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAEA,qBAKA;AAPA;AAAA;AAAA;AAAA;AAEA,0BAIO;AACP,mBAA+C;AAAA;AAAA;;;ACP/C,IAAAA,sBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IACAC;AADA;AAAA;AAAA;AACA,IAAAA,gBAA4B;AAAA;AAAA;;;ACD5B,IAAAC,kBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,SAAS,mBACd,MACoB;AACpB,SAAO,KAAK,OAAO,OAAO,EAAE,KAAK,GAAG,KAAK;AAC3C;AAJA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IACAC;AADA;AAAA;AAAA;AACA,IAAAA,gBAA4C;AAAA;AAAA;;;ACD5C,IAAAC,0BAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IACAC,eAEAC;AAHA;AAAA;AAAA;AACA,IAAAD,gBAAiD;AAEjD,IAAAC,uBAAkC;AAAA;AAAA;;;ACHlC,IAAAC,kBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC0BO,SAAS,SAAS;AAAA,EACvB,IAAI;AAAA,EACJ;AAAA,EACA,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,mBAAmB;AACrB,GAAkB;AAChB,MAAI,aAA2C,CAAC;AAChD,MAAI,aAA2C,CAAC;AAEhD,QAAM,kCAA8B,sBAAO,KAAK;AAEhD,QAAM,iBAAa,qBAAM;AACzB,QAAM,KAAK,cAAc;AACzB,QAAM,cAAU,qBAAM;AAEtB,MAAI,OAAO;AACT,qBAAiB,iBAAiB,GAAG,OAAO,IAAI,cAAc,KAAK;AACnE,iBAAa;AAAA,MACX,IAAI;AAAA,MACJ,SAAS,qBAAqB,UAAU,KAAK;AAAA,IAC/C;AAA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useDialogPolyfill", "import_react", "import_mobius_hooks", "init_useDialog", "import_react", "init_useLabel", "import_react", "init_useTextField", "init_useValidationClasses", "init_useBreakpoint", "init_useButton", "init_useDialog", "init_useDialogPolyfill", "init_useLabel", "init_useTextField", "init_useValidationClasses", "classNames", "init_types", "init_Icon", "init_types", "import_dedupe", "import_jsx_runtime", "classNames", "import_dedupe", "import_react", "import_jsx_runtime", "classNames", "init_TextOrHTML", "import_dedupe", "import_jsx_runtime", "init_Icon", "init_TextOrHTML", "classNames", "init_ErrorMessage", "import_dedupe", "import_jsx_runtime", "classNames", "init_Label", "import_dedupe", "import_jsx_runtime", "classNames", "init_Stack", "import_dedupe", "import_react", "classNames", "import_dedupe", "import_jsx_runtime", "init_ErrorMessage", "init_Label", "init_Stack", "classNames", "init_TextField", "import_react", "import_jsx_runtime", "init_TextField", "MaskedField_exports", "MaskedField", "init_TextField", "import_jsx_runtime", "loadable"]
7
7
  }
@@ -254,7 +254,8 @@ Text.displayName = "Text";
254
254
 
255
255
  // src/components/TextOrHTML/TextOrHTML.tsx
256
256
  var import_jsx_runtime3 = require("react/jsx-runtime");
257
- var isBlockHTML = (text) => /^\s*<[a-z]/i.test(text);
257
+ var BLOCK_TAG = /<(div|p|ul|ol|li|h[1-6]|table|tr|td|th|blockquote|pre|hr|dl|dt|dd)[\s>/]/i;
258
+ var containsBlockHTML = (text) => BLOCK_TAG.test(text);
258
259
  var containsHTML = (text) => /<[a-z/]/i.test(text) || /&(?:#\d+|#x[\da-f]+|[a-z]\w*);/i.test(text);
259
260
  var buildTextClasses = (textProps, htmlClassName) => {
260
261
  const { variant, elementType, spacing, className } = textProps;
@@ -277,9 +278,9 @@ var TextOrHTML = ({
277
278
  autoDetect = false,
278
279
  ...textProps
279
280
  }) => {
280
- const textIsBlockHTML = autoDetect && isBlockHTML(text);
281
+ const hasBlockContent = autoDetect && containsBlockHTML(text);
281
282
  const dangerousHTML = (0, import_react3.useMemo)(() => ({ __html: text }), [text]);
282
- if (autoDetect && !textIsBlockHTML) {
283
+ if (autoDetect && !hasBlockContent) {
283
284
  const { variant, spacing, elementType, className, ...domProps } = textProps;
284
285
  const Element = getElementType(variant, elementType);
285
286
  const classes = buildTextClasses(textProps, htmlClassName);
@@ -293,7 +294,7 @@ var TextOrHTML = ({
293
294
  }
294
295
  ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Element, { ref, ...domProps, className: classes, children: text });
295
296
  }
296
- const DangerousComponent = htmlElementType ?? (textIsBlockHTML ? "div" : "span");
297
+ const DangerousComponent = htmlElementType ?? (hasBlockContent ? "div" : "span");
297
298
  const dangerousElement = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
298
299
  DangerousComponent,
299
300
  {