@pega/cosmos-react-core 9.17.1 → 9.18.0

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 (91) hide show
  1. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  2. package/lib/components/AppShell/AppHeader.js +44 -7
  3. package/lib/components/AppShell/AppHeader.js.map +1 -1
  4. package/lib/components/AppShell/AppHeader.styles.d.ts +6 -2
  5. package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -1
  6. package/lib/components/AppShell/AppHeader.styles.js +36 -18
  7. package/lib/components/AppShell/AppHeader.styles.js.map +1 -1
  8. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  9. package/lib/components/AppShell/AppShell.js +28 -9
  10. package/lib/components/AppShell/AppShell.js.map +1 -1
  11. package/lib/components/AppShell/AppShellContext.d.ts +1 -0
  12. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  13. package/lib/components/AppShell/AppShellContext.js +1 -0
  14. package/lib/components/AppShell/AppShellContext.js.map +1 -1
  15. package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
  16. package/lib/components/Currency/CurrencyInput.js +19 -12
  17. package/lib/components/Currency/CurrencyInput.js.map +1 -1
  18. package/lib/components/Currency/utils.d.ts +8 -0
  19. package/lib/components/Currency/utils.d.ts.map +1 -1
  20. package/lib/components/Currency/utils.js +34 -4
  21. package/lib/components/Currency/utils.js.map +1 -1
  22. package/lib/components/Dialog/InfoDialogWrapper.d.ts +4 -0
  23. package/lib/components/Dialog/InfoDialogWrapper.d.ts.map +1 -0
  24. package/lib/components/Dialog/InfoDialogWrapper.js +13 -0
  25. package/lib/components/Dialog/InfoDialogWrapper.js.map +1 -0
  26. package/lib/components/Dialog/TouchDialog.d.ts +5 -0
  27. package/lib/components/Dialog/TouchDialog.d.ts.map +1 -0
  28. package/lib/components/Dialog/TouchDialog.js +85 -0
  29. package/lib/components/Dialog/TouchDialog.js.map +1 -0
  30. package/lib/components/Dialog/TouchDialog.styles.d.ts +7 -0
  31. package/lib/components/Dialog/TouchDialog.styles.d.ts.map +1 -0
  32. package/lib/components/Dialog/TouchDialog.styles.js +62 -0
  33. package/lib/components/Dialog/TouchDialog.styles.js.map +1 -0
  34. package/lib/components/Dialog/TouchDialog.test-ids.d.ts +2 -0
  35. package/lib/components/Dialog/TouchDialog.test-ids.d.ts.map +1 -0
  36. package/lib/components/Dialog/TouchDialog.test-ids.js +3 -0
  37. package/lib/components/Dialog/TouchDialog.test-ids.js.map +1 -0
  38. package/lib/components/Dialog/TouchDialog.types.d.ts +42 -0
  39. package/lib/components/Dialog/TouchDialog.types.d.ts.map +1 -0
  40. package/lib/components/Dialog/TouchDialog.types.js +2 -0
  41. package/lib/components/Dialog/TouchDialog.types.js.map +1 -0
  42. package/lib/components/Dialog/TouchInfoDialog.d.ts +4 -0
  43. package/lib/components/Dialog/TouchInfoDialog.d.ts.map +1 -0
  44. package/lib/components/Dialog/TouchInfoDialog.js +14 -0
  45. package/lib/components/Dialog/TouchInfoDialog.js.map +1 -0
  46. package/lib/components/Dialog/index.d.ts +4 -1
  47. package/lib/components/Dialog/index.d.ts.map +1 -1
  48. package/lib/components/Dialog/index.js +3 -1
  49. package/lib/components/Dialog/index.js.map +1 -1
  50. package/lib/components/File/CompactList.js +1 -1
  51. package/lib/components/File/CompactList.js.map +1 -1
  52. package/lib/components/ListToolbar/PresetMenuPopover.d.ts.map +1 -1
  53. package/lib/components/ListToolbar/PresetMenuPopover.js +16 -5
  54. package/lib/components/ListToolbar/PresetMenuPopover.js.map +1 -1
  55. package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
  56. package/lib/components/MenuButton/MenuButton.js +33 -7
  57. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  58. package/lib/components/MultiStepForm/HorizontalFormProgress.js +1 -1
  59. package/lib/components/MultiStepForm/HorizontalFormProgress.js.map +1 -1
  60. package/lib/components/Number/utils.js +1 -1
  61. package/lib/components/Number/utils.js.map +1 -1
  62. package/lib/components/ResponsiveActions/ResponsiveActions.d.ts.map +1 -1
  63. package/lib/components/ResponsiveActions/ResponsiveActions.js +1 -0
  64. package/lib/components/ResponsiveActions/ResponsiveActions.js.map +1 -1
  65. package/lib/components/TextArea/TextArea.d.ts.map +1 -1
  66. package/lib/components/TextArea/TextArea.js +7 -21
  67. package/lib/components/TextArea/TextArea.js.map +1 -1
  68. package/lib/components/TextArea/TextArea.styles.d.ts +0 -1
  69. package/lib/components/TextArea/TextArea.styles.d.ts.map +1 -1
  70. package/lib/components/TextArea/TextArea.styles.js +1 -2
  71. package/lib/components/TextArea/TextArea.styles.js.map +1 -1
  72. package/lib/hooks/useI18n.d.ts +1 -0
  73. package/lib/hooks/useI18n.d.ts.map +1 -1
  74. package/lib/i18n/default.d.ts +1 -0
  75. package/lib/i18n/default.d.ts.map +1 -1
  76. package/lib/i18n/default.js +1 -0
  77. package/lib/i18n/default.js.map +1 -1
  78. package/lib/i18n/i18n.d.ts +1 -0
  79. package/lib/i18n/i18n.d.ts.map +1 -1
  80. package/lib/theme/themes/aurigaDarkTheme.json +45 -58
  81. package/lib/theme/themes/aurigaTheme.json +40 -53
  82. package/lib/theme/themes/virgoTheme.json +3 -3
  83. package/lib/utils/index.d.ts +1 -0
  84. package/lib/utils/index.d.ts.map +1 -1
  85. package/lib/utils/index.js +1 -0
  86. package/lib/utils/index.js.map +1 -1
  87. package/lib/utils/isTouchDevice.d.ts +3 -0
  88. package/lib/utils/isTouchDevice.d.ts.map +1 -0
  89. package/lib/utils/isTouchDevice.js +4 -0
  90. package/lib/utils/isTouchDevice.js.map +1 -0
  91. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MenuButton.js","sourceRoot":"","sources":["../../../src/components/MenuButton/MenuButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAS1D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MA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CAAC,OAAO,EACrB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBACzB,iGAAiG;wBACjG,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;4BACjC,SAAS,CAAC,KAAK,CAAC,CAAC;4BACjB,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;wBAC7B,CAAC;wBACD,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;oBAChC,CAAC,EACD,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,SAAS,CAAC,OAAO,IAAI,SAAS,GACrE,CACH,GACuB,IACzB,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { forwardRef, useState, useCallback } from 'react';\nimport type {\n MouseEventHandler,\n MouseEvent,\n UIEvent,\n PropsWithoutRef,\n KeyboardEventHandler,\n KeyboardEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport type {\n BaseProps,\n ForwardRefForwardPropsComponent,\n NoChildrenProp,\n OmitStrict,\n TestIdProp\n} from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport {\n useConsolidatedRef,\n useUID,\n useFocusWithin,\n useDirection,\n useTestIds,\n useEscape,\n useElement\n} from '../../hooks';\nimport Button, { StyledButton } from '../Button';\nimport type { ButtonProps } from '../Button';\nimport Popover, { StyledPopover } from '../Popover';\nimport type { PopoverProps } from '../Popover';\nimport Menu from '../Menu';\nimport type { MenuProps } from '../Menu/Menu.types';\nimport Icon, { registerIcon, StyledIcon } from '../Icon';\nimport * as arrowMicroDownIcon from '../Icon/icons/arrow-micro-down.icon';\nimport Flex from '../Flex';\nimport { Count } from '../Badges';\nimport type { CountProps } from '../Badges/Count';\nimport { getActiveElement, getFocusables, isInstance, withTestIds } from '../../utils';\n\nimport { getMenuButtonTestIds } from './MenuButton.test-ids';\n\nregisterIcon(arrowMicroDownIcon);\n\nexport interface MenuButtonProps extends BaseProps, NoChildrenProp, TestIdProp {\n /** The text for the MenuButton also used to set the aria-label. */\n text: string;\n /**\n * Determines the Button variant for the MenuButton.\n * @default 'secondary'\n */\n variant?: ButtonProps['variant'];\n /** The name of the icon for the MenuButton. */\n icon?: string;\n /** Only display the icon. The text prop will be forwarded to a tooltip. */\n iconOnly?: ButtonProps['icon'];\n /** The total count representing the list data which was selected. */\n count?: CountProps['children'];\n /** The click handler for the MenuButton. */\n onClick?: MouseEventHandler;\n /** Menu related props. */\n menu?: MenuProps;\n /** Popover related props. */\n popover?: OmitStrict<PopoverProps, 'show' | 'target' | 'children'>;\n /** DOM id for the button element. */\n id?: string;\n /** Ref for the button element. */\n ref?: ButtonProps['ref'];\n /** The keydown handler for the MenuButton. */\n onKeyDown?: KeyboardEventHandler;\n /** Whether to display an arrow when only the icon is displayed. */\n showArrow?: boolean;\n}\n\nexport const StyledMenuButton = styled.button(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n gap: ${spacing};\n flex-shrink: 0;\n white-space: nowrap;\n max-width: 100%;\n\n & + ${StyledPopover} + ${StyledButton} {\n margin-inline-start: ${spacing};\n }\n `;\n }\n);\n\nStyledMenuButton.defaultProps = defaultThemeProp;\n\nconst StyledMenuButtonText = styled.span`\n text-overflow: ellipsis;\n overflow: hidden;\n`;\n\nconst StyledMenuButtonChildren = styled.span<{ padIcon?: boolean }>(({ theme, padIcon }) => {\n const {\n base: {\n 'hit-area': { 'mouse-min': hitAreaMouse, 'finger-min': hitAreaFinger }\n },\n components: {\n icon: {\n size: { s: iconSize }\n }\n }\n } = theme;\n\n return css`\n max-width: 100%;\n\n ${padIcon &&\n css`\n padding-inline-start: calc((${hitAreaMouse} - ${iconSize}) / 2);\n\n @media (pointer: coarse) {\n padding-inline-start: calc(${hitAreaFinger} - ${iconSize} * 2);\n }\n `}\n\n ${StyledIcon}:last-child:not(:first-child) {\n /* Offsets the flex gap to make the down arrow appear to trail the text. */\n margin-inline-start: -${theme.base.spacing};\n }\n `;\n});\n\nStyledMenuButtonChildren.defaultProps = defaultThemeProp;\n\nconst StyledMenuButtonPopover = styled(Popover)`\n min-width: 20ch;\n`;\n\nconst MenuButton: ForwardRefForwardPropsComponent<MenuButtonProps> = forwardRef(function MenuButton(\n props: PropsWithoutRef<MenuButtonProps>,\n ref: MenuButtonProps['ref']\n) {\n const uid = useUID();\n const {\n testId,\n id = uid,\n text,\n menu,\n popover,\n onClick,\n icon,\n count,\n iconOnly = false,\n showArrow,\n onKeyDown: onKeyDownProp,\n ...restProps\n } = props;\n const testIds = useTestIds(testId, getMenuButtonTestIds);\n const [isOpen, setIsOpen] = useState(false);\n\n const buttonRef = useConsolidatedRef(ref);\n // Force re-render when popoverRef is set, so useFocusWithin has a non-null ref to read\n const [, forceRerender] = useElement(null);\n const popoverRef = useConsolidatedRef<HTMLDivElement>(popover?.ref, forceRerender);\n const filterInputRef = useConsolidatedRef<HTMLInputElement>(menu?.filterInputProps?.ref);\n const menuRef = useConsolidatedRef<HTMLDivElement>(menu?.ref);\n\n // FIXME: Type assertion required for issue in useFocusWithin generic\n useFocusWithin<HTMLElement>(\n [popoverRef, buttonRef],\n useCallback((isFocused: boolean) => {\n if (!isFocused) setIsOpen(false);\n }, [])\n );\n\n useEscape(e => {\n if (isOpen) {\n setIsOpen(false);\n e.stopPropagation();\n }\n }, buttonRef);\n\n useEscape(e => {\n if (isOpen) {\n setIsOpen(false);\n e.stopPropagation();\n buttonRef.current?.focus();\n }\n }, menu?.focusControlEl);\n\n useEscape(e => {\n if (isOpen) {\n setIsOpen(false);\n e.stopPropagation();\n buttonRef.current?.focus();\n }\n }, filterInputRef);\n\n const { rtl } = useDirection();\n\n const onKeyDown = useCallback(\n (e: KeyboardEvent) => {\n onKeyDownProp?.(e);\n if (e.key !== 'Tab' || !menu) return;\n\n const footerEl = menuRef.current?.querySelector('footer');\n if (!footerEl) return;\n\n const tabbingForward = !e.shiftKey;\n\n if (tabbingForward) {\n const footerFocusables = getFocusables(footerEl);\n\n if (footerFocusables.length > 0) {\n e.preventDefault();\n footerFocusables[0].focus();\n return;\n }\n }\n\n setIsOpen(false);\n },\n [menu]\n );\n\n return (\n <>\n <Button\n data-testid={testIds.root}\n as={StyledMenuButton}\n aria-label={text}\n {...restProps}\n id={id}\n ref={buttonRef}\n aria-expanded={isOpen}\n aria-haspopup='menu'\n aria-controls={isOpen ? `${id}-popover` : undefined}\n label={iconOnly && !isOpen ? text : undefined}\n onClick={(e: MouseEvent<HTMLButtonElement> & UIEvent<HTMLButtonElement>) => {\n // e.detail is 0 when triggered by keyboard.\n const mouseClick = e.detail > 0;\n\n if (isOpen) {\n if (mouseClick) {\n // Close the menu if it is open and it is a *mouse* click on the button.\n setIsOpen(false);\n }\n } else {\n // Open the menu if it's closed, for mouse or keyboard click.\n setIsOpen(true);\n }\n\n // If the menu is closed or the user mouse clicks.\n // This avoids Enter key firing onClick when selecting a menu item.\n if (!isOpen || mouseClick) {\n onClick?.(e);\n }\n }}\n onKeyDown={onKeyDown}\n icon={iconOnly}\n >\n <Flex\n as={StyledMenuButtonChildren}\n container={{ alignItems: 'center', gap: 1 }}\n padIcon={iconOnly && showArrow}\n >\n {icon && <Icon name={icon} />}\n {!iconOnly && (\n <>\n <StyledMenuButtonText>{text}</StyledMenuButtonText>\n {typeof count === 'number' && <Count>{count}</Count>}\n </>\n )}\n {((!iconOnly && showArrow === undefined) || showArrow) && (\n <Icon name='arrow-micro-down' />\n )}\n </Flex>\n </Button>\n\n <StyledMenuButtonPopover\n placement={rtl ? 'bottom-end' : 'bottom-start'}\n hideOnTargetHidden\n {...popover}\n id={`${id}-popover`}\n show={!!menu && isOpen}\n target={buttonRef.current}\n ref={popoverRef}\n onKeyDown={(e: KeyboardEvent) => {\n if (e.key !== 'Tab' || !buttonRef.current) return;\n\n const footerEl = menuRef.current?.querySelector('footer');\n if (!footerEl || !footerEl?.contains(getActiveElement())) return;\n\n const footerFocusables = getFocusables(footerEl);\n\n if (isInstance(e.target, HTMLElement)) {\n const currentIndex = footerFocusables.indexOf(e.target);\n const tabbingForward = !e.shiftKey;\n const isLastFocusable = currentIndex === footerFocusables.length - 1;\n\n if (tabbingForward && isLastFocusable) {\n e.preventDefault();\n const rootNode = buttonRef.current.getRootNode();\n if (!isInstance(rootNode, Document, ShadowRoot)) return;\n\n const allFocusables = getFocusables(rootNode);\n const nextIndex = allFocusables.indexOf(buttonRef.current) + 1;\n\n allFocusables[nextIndex]?.focus();\n setIsOpen(false);\n } else if (!tabbingForward && currentIndex === 0) {\n e.preventDefault();\n buttonRef.current?.focus();\n }\n }\n }}\n >\n {menu && (\n <Menu\n testId={testIds.root}\n {...menu}\n ref={menuRef}\n loading={menu.loading}\n items={menu.items}\n onItemClick={(itemId, e) => {\n // When clicking an item (by mouse or keyboard) and the menu is not multi-select, close the menu.\n if (menu.mode !== 'multi-select') {\n setIsOpen(false);\n buttonRef.current?.focus();\n }\n menu.onItemClick?.(itemId, e);\n }}\n focusControlEl={menu.focusControlEl || buttonRef.current || undefined}\n />\n )}\n </StyledMenuButtonPopover>\n </>\n );\n});\n\nexport default withTestIds(MenuButton, getMenuButtonTestIds);\n"]}
1
+ {"version":3,"file":"MenuButton.js","sourceRoot":"","sources":["../../../src/components/MenuButton/MenuButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAS1D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAShD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,cAAc,EACd,YAAY,EACZ,UAAU,EACV,SAAS,EACT,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,MAAM,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ACjB,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBACzB,iGAAiG;wBACjG,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;4BACjC,SAAS,CAAC,KAAK,CAAC,CAAC;4BACjB,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;wBAC7B,CAAC;wBACD,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;oBAChC,CAAC,EACD,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,SAAS,CAAC,OAAO,IAAI,SAAS,GACrE,CACH,GACuB,CAC3B,IACA,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { forwardRef, useState, useCallback } from 'react';\nimport type {\n MouseEventHandler,\n MouseEvent,\n UIEvent,\n PropsWithoutRef,\n KeyboardEventHandler,\n KeyboardEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport type {\n BaseProps,\n ForwardRefForwardPropsComponent,\n NoChildrenProp,\n OmitStrict,\n TestIdProp\n} from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport {\n useConsolidatedRef,\n useUID,\n useFocusWithin,\n useDirection,\n useTestIds,\n useEscape,\n useElement\n} from '../../hooks';\nimport { TouchDialog } from '../Dialog/TouchDialog';\nimport Button, { StyledButton } from '../Button';\nimport type { ButtonProps } from '../Button';\nimport Popover, { StyledPopover } from '../Popover';\nimport type { PopoverProps } from '../Popover';\nimport Menu from '../Menu';\nimport type { MenuProps } from '../Menu/Menu.types';\nimport Icon, { registerIcon, StyledIcon } from '../Icon';\nimport * as arrowMicroDownIcon from '../Icon/icons/arrow-micro-down.icon';\nimport Flex from '../Flex';\nimport { Count } from '../Badges';\nimport type { CountProps } from '../Badges/Count';\nimport {\n getActiveElement,\n getFocusables,\n isInstance,\n isTouchDevice,\n withTestIds\n} from '../../utils';\nimport { StyledMenu, StyledMenuListWrapper } from '../Menu/Menu.styles';\n\nimport { getMenuButtonTestIds } from './MenuButton.test-ids';\n\nregisterIcon(arrowMicroDownIcon);\n\nexport interface MenuButtonProps extends BaseProps, NoChildrenProp, TestIdProp {\n /** The text for the MenuButton also used to set the aria-label. */\n text: string;\n /**\n * Determines the Button variant for the MenuButton.\n * @default 'secondary'\n */\n variant?: ButtonProps['variant'];\n /** The name of the icon for the MenuButton. */\n icon?: string;\n /** Only display the icon. The text prop will be forwarded to a tooltip. */\n iconOnly?: ButtonProps['icon'];\n /** The total count representing the list data which was selected. */\n count?: CountProps['children'];\n /** The click handler for the MenuButton. */\n onClick?: MouseEventHandler;\n /** Menu related props. */\n menu?: MenuProps;\n /** Popover related props. */\n popover?: OmitStrict<PopoverProps, 'show' | 'target' | 'children'>;\n /** DOM id for the button element. */\n id?: string;\n /** Ref for the button element. */\n ref?: ButtonProps['ref'];\n /** The keydown handler for the MenuButton. */\n onKeyDown?: KeyboardEventHandler;\n /** Whether to display an arrow when only the icon is displayed. */\n showArrow?: boolean;\n}\n\nexport const StyledMenuButton = styled.button(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n gap: ${spacing};\n flex-shrink: 0;\n white-space: nowrap;\n max-width: 100%;\n\n & + ${StyledPopover} + ${StyledButton} {\n margin-inline-start: ${spacing};\n }\n `;\n }\n);\n\nStyledMenuButton.defaultProps = defaultThemeProp;\n\nconst StyledMenuButtonText = styled.span`\n text-overflow: ellipsis;\n overflow: hidden;\n`;\n\nconst StyledMenuButtonChildren = styled.span<{ padIcon?: boolean }>(({ theme, padIcon }) => {\n const {\n base: {\n 'hit-area': { 'mouse-min': hitAreaMouse, 'finger-min': hitAreaFinger }\n },\n components: {\n icon: {\n size: { s: iconSize }\n }\n }\n } = theme;\n\n return css`\n max-width: 100%;\n\n ${padIcon &&\n css`\n padding-inline-start: calc((${hitAreaMouse} - ${iconSize}) / 2);\n\n @media (pointer: coarse) {\n padding-inline-start: calc(${hitAreaFinger} - ${iconSize} * 2);\n }\n `}\n\n ${StyledIcon}:last-child:not(:first-child) {\n /* Offsets the flex gap to make the down arrow appear to trail the text. */\n margin-inline-start: -${theme.base.spacing};\n }\n `;\n});\n\nStyledMenuButtonChildren.defaultProps = defaultThemeProp;\n\nconst StyledMenuButtonPopover = styled(Popover)`\n min-width: 20ch;\n`;\n\nconst StyledMenuTouchDialog = styled(TouchDialog)`\n ${StyledMenu} {\n height: 100%;\n\n ${StyledMenuListWrapper} {\n flex-grow: 1;\n overflow: auto;\n }\n }\n`;\n\nconst MenuButton: ForwardRefForwardPropsComponent<MenuButtonProps> = forwardRef(function MenuButton(\n props: PropsWithoutRef<MenuButtonProps>,\n ref: MenuButtonProps['ref']\n) {\n const uid = useUID();\n const {\n testId,\n id = uid,\n text,\n menu,\n popover,\n onClick,\n icon,\n count,\n iconOnly = false,\n showArrow,\n onKeyDown: onKeyDownProp,\n ...restProps\n } = props;\n const testIds = useTestIds(testId, getMenuButtonTestIds);\n const [isOpen, setIsOpen] = useState(false);\n\n const buttonRef = useConsolidatedRef(ref);\n // Force re-render when popoverRef is set, so useFocusWithin has a non-null ref to read\n const [, forceRerender] = useElement(null);\n const popoverRef = useConsolidatedRef<HTMLDivElement>(popover?.ref, forceRerender);\n const dialogRef = useConsolidatedRef<HTMLDivElement>(popover?.ref);\n const filterInputRef = useConsolidatedRef<HTMLInputElement>(menu?.filterInputProps?.ref);\n const menuRef = useConsolidatedRef<HTMLDivElement>(menu?.ref);\n\n // FIXME: Type assertion required for issue in useFocusWithin generic\n useFocusWithin<HTMLElement>(\n [popoverRef, dialogRef, buttonRef],\n useCallback((isFocused: boolean) => {\n if (!isFocused) setIsOpen(false);\n }, [])\n );\n\n useEscape(e => {\n if (isOpen) {\n setIsOpen(false);\n e.stopPropagation();\n }\n }, buttonRef);\n\n useEscape(e => {\n if (isOpen) {\n setIsOpen(false);\n e.stopPropagation();\n buttonRef.current?.focus();\n }\n }, menu?.focusControlEl);\n\n useEscape(e => {\n if (isOpen) {\n setIsOpen(false);\n e.stopPropagation();\n buttonRef.current?.focus();\n }\n }, filterInputRef);\n\n const { rtl } = useDirection();\n\n const onKeyDown = useCallback(\n (e: KeyboardEvent) => {\n onKeyDownProp?.(e);\n if (e.key !== 'Tab' || !menu) return;\n\n const footerEl = menuRef.current?.querySelector('footer');\n if (!footerEl) return;\n\n const tabbingForward = !e.shiftKey;\n\n if (tabbingForward) {\n const footerFocusables = getFocusables(footerEl);\n\n if (footerFocusables.length > 0) {\n e.preventDefault();\n footerFocusables[0].focus();\n return;\n }\n }\n\n // Do not close the drawer when the user is tabbing backwards.\n if (!isTouchDevice) setIsOpen(false);\n },\n [menu, isTouchDevice, onKeyDownProp]\n );\n\n return (\n <>\n <Button\n data-testid={testIds.root}\n as={StyledMenuButton}\n aria-label={text}\n {...restProps}\n id={id}\n ref={buttonRef}\n aria-expanded={isOpen}\n aria-haspopup={isTouchDevice ? 'dialog' : 'menu'}\n aria-controls={isOpen ? `${id}-${isTouchDevice ? 'dialog' : 'popover'}` : undefined}\n label={iconOnly && !isOpen ? text : undefined}\n onClick={(e: MouseEvent<HTMLButtonElement> & UIEvent<HTMLButtonElement>) => {\n // e.detail is 0 when triggered by keyboard.\n const mouseClick = e.detail > 0;\n\n if (isOpen) {\n if (mouseClick) {\n // Close the menu if it is open and it is a *mouse* click on the button.\n setIsOpen(false);\n }\n } else {\n // Open the menu if it's closed, for mouse or keyboard click.\n setIsOpen(true);\n }\n\n // If the menu is closed or the user mouse clicks.\n // This avoids Enter key firing onClick when selecting a menu item.\n if (!isOpen || mouseClick) {\n onClick?.(e);\n }\n }}\n onKeyDown={onKeyDown}\n icon={iconOnly}\n >\n <Flex\n as={StyledMenuButtonChildren}\n container={{ alignItems: 'center', gap: 1 }}\n padIcon={iconOnly && showArrow}\n >\n {icon && <Icon name={icon} />}\n {!iconOnly && (\n <>\n <StyledMenuButtonText>{text}</StyledMenuButtonText>\n {typeof count === 'number' && <Count>{count}</Count>}\n </>\n )}\n {((!iconOnly && showArrow === undefined) || showArrow) && (\n <Icon name='arrow-micro-down' />\n )}\n </Flex>\n </Button>\n\n {isTouchDevice ? (\n <StyledMenuTouchDialog\n ref={dialogRef}\n open={!!menu && isOpen}\n onDismiss={() => {\n setIsOpen(false);\n }}\n id={`${id}-dialog`}\n heading={text}\n onAfterClose={() => {\n if (dialogRef.current?.contains(getActiveElement())) {\n buttonRef.current?.focus();\n }\n }}\n >\n {menu && (\n <Menu\n testId={testIds.root}\n {...menu}\n ref={menuRef}\n loading={menu.loading}\n scrollAt={Infinity}\n items={menu.items}\n onItemClick={(itemId, e) => {\n if (menu.mode !== 'multi-select') {\n setIsOpen(false);\n }\n menu.onItemClick?.(itemId, e);\n }}\n focusControlEl={undefined}\n />\n )}\n </StyledMenuTouchDialog>\n ) : (\n <StyledMenuButtonPopover\n placement={rtl ? 'bottom-end' : 'bottom-start'}\n hideOnTargetHidden\n {...popover}\n id={`${id}-popover`}\n show={!!menu && isOpen}\n target={buttonRef.current}\n ref={popoverRef}\n onKeyDown={(e: KeyboardEvent) => {\n if (e.key !== 'Tab' || !buttonRef.current) return;\n\n const footerEl = menuRef.current?.querySelector('footer');\n if (!footerEl || !footerEl?.contains(getActiveElement())) return;\n\n const footerFocusables = getFocusables(footerEl);\n\n if (isInstance(e.target, HTMLElement)) {\n const currentIndex = footerFocusables.indexOf(e.target);\n const tabbingForward = !e.shiftKey;\n const isLastFocusable = currentIndex === footerFocusables.length - 1;\n\n if (tabbingForward && isLastFocusable) {\n e.preventDefault();\n const rootNode = buttonRef.current.getRootNode();\n if (!isInstance(rootNode, Document, ShadowRoot)) return;\n\n const allFocusables = getFocusables(rootNode);\n const nextIndex = allFocusables.indexOf(buttonRef.current) + 1;\n\n allFocusables[nextIndex]?.focus();\n setIsOpen(false);\n } else if (!tabbingForward && currentIndex === 0) {\n e.preventDefault();\n buttonRef.current?.focus();\n }\n }\n }}\n >\n {menu && (\n <Menu\n testId={testIds.root}\n {...menu}\n ref={menuRef}\n loading={menu.loading}\n items={menu.items}\n onItemClick={(itemId, e) => {\n // When clicking an item (by mouse or keyboard) and the menu is not multi-select, close the menu.\n if (menu.mode !== 'multi-select') {\n setIsOpen(false);\n buttonRef.current?.focus();\n }\n menu.onItemClick?.(itemId, e);\n }}\n focusControlEl={menu.focusControlEl || buttonRef.current || undefined}\n />\n )}\n </StyledMenuButtonPopover>\n )}\n </>\n );\n});\n\nexport default withTestIds(MenuButton, getMenuButtonTestIds);\n"]}
@@ -7,7 +7,7 @@ import Flex from '../Flex';
7
7
  import Text from '../Text';
8
8
  import Tooltip from '../Tooltip';
9
9
  import Button from '../Button';
10
- import InfoDialog from '../Dialog/InfoDialog';
10
+ import { InfoDialog } from '../Dialog';
11
11
  import { CurrentStepPopover, StepMarker, StyledBar, StyledFill, StyledFormProgress, StyledHorizontalBarSegment, StyledHorizontalStepText, StyleHorizontalBarList, StyleHorizontalStepMarkers } from './FormProgress.styles';
12
12
  import VerticalFormProgress from './VerticalFormProgress';
13
13
  import { useFormProgressOverflow } from './useFormProgressOverflow';
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalFormProgress.js","sourceRoot":"","sources":["../../../src/components/MultiStepForm/HorizontalFormProgress.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,UAAU,MAAM,sB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IAAI,CACzC,KAAC,UAAU,IACT,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,EACnB,MAAM,EAAE,mBAAmB,EAC3B,SAAS,EAAE,GAAG,EAAE;4BACd,kBAAkB,CAAC,KAAK,CAAC,CAAC;wBAC5B,CAAC,EACD,SAAS,EAAC,cAAc,YAExB,KAAC,oBAAoB,IAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GAAI,GAC3E,CACd,IACG,CACP,CAAC,CAAC,CAAC,CACF,8BACE,KAAC,IAAI,IACH,GAAG,EAAE,QAAQ,EACb,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,0BAA0B,EACpE,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,EAC9D,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EACjB,aAAa,EAAE,aAAa,YAE3B,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,GACrB,EAEN,CAAC,UAAU,IAAI,CACd,KAAC,SAAS,IAAC,OAAO,EAAE,aAAa,YAC/B,KAAC,UAAU,IAAC,SAAS,EAAE,SAAS,GAAI,GAC1B,CACb,IACA,CACJ,IACkB,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import { remToPx, stripUnit } from 'polished';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { useArrows, useDirection, useElement, useI18n, useTheme } from '../../hooks';\nimport type { ForwardProps } from '../../types';\nimport { tryCatch } from '../../utils';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Tooltip from '../Tooltip';\nimport Button from '../Button';\nimport InfoDialog from '../Dialog/InfoDialog';\n\nimport {\n CurrentStepPopover,\n StepMarker,\n StyledBar,\n StyledFill,\n StyledFormProgress,\n StyledHorizontalBarSegment,\n StyledHorizontalStepText,\n StyleHorizontalBarList,\n StyleHorizontalStepMarkers\n} from './FormProgress.styles';\nimport type { MultiStepFormProps } from './MultiStepForm.types';\nimport VerticalFormProgress from './VerticalFormProgress';\nimport { useFormProgressOverflow } from './useFormProgressOverflow';\n\ninterface FormProgressProps {\n steps: MultiStepFormProps['steps'];\n currentStepId: MultiStepFormProps['currentStepId'];\n variant?: MultiStepFormProps['variant'];\n showStepNames?: boolean;\n}\n\nconst HorizontalFormProgress = ({\n steps,\n currentStepId,\n showStepNames = false,\n variant = 'dot',\n ...restProps\n}: FormProgressProps & ForwardProps) => {\n const t = useI18n();\n const theme = useTheme();\n const isBarsMode = variant === 'bar';\n\n const [stepsDialogButtonEl, setStepsDialogButtonEl] = useElement<HTMLButtonElement>();\n const [showStepsDialog, setShowStepsDialog] = useState(false);\n\n const { ref: formProgressRef, state: stepsAreOverflowing } = useFormProgressOverflow(\n steps.length,\n showStepNames,\n isBarsMode\n );\n\n const curIdx = steps.findIndex(step => step.id === currentStepId);\n const curStep = steps[curIdx];\n const fillScale = curIdx / (steps.length - 1);\n\n const [currentStepEl, setCurrentStepEl] = useElement();\n const [stepEls, setStepEls] = useState<Record<string, HTMLElement>>({});\n const stepsRef = useRef(null);\n const { rtl } = useDirection();\n\n let popoverPlacement: 'bottom' | 'bottom-start' | 'bottom-end' = 'bottom';\n if (curIdx === 0) popoverPlacement = rtl ? 'bottom-end' : 'bottom-start';\n else if (curIdx === steps.length - 1) popoverPlacement = rtl ? 'bottom-start' : 'bottom-end';\n\n const numberOfSteps = steps.length;\n\n const setStepElement = (stepId: string) => (el: HTMLElement | null) => {\n setStepEls(curr => {\n const newEls = { ...curr };\n\n if (!el && newEls[stepId]) {\n delete newEls[stepId];\n return newEls;\n }\n\n if (el) return { ...newEls, [stepId]: el };\n\n return newEls;\n });\n };\n\n const renderStepName = ({\n isCurrent,\n stepName,\n onMarkerClick\n }: {\n isCurrent: boolean;\n stepName: string;\n onMarkerClick?: MultiStepFormProps['steps'][number]['onMarkerClick'];\n }) => {\n if (!showStepNames) return null;\n\n if (!!onMarkerClick && !isCurrent) {\n return (\n <Button variant='link' onClick={onMarkerClick} as={StyledHorizontalStepText} tabIndex={-1}>\n {stepName}\n </Button>\n );\n }\n\n return (\n <Text variant={isCurrent ? 'h3' : undefined} as={StyledHorizontalStepText}>\n {stepName}\n </Text>\n );\n };\n\n const renderStepItem = (step: MultiStepFormProps['steps'][number], index: number) => {\n const isCurrent = index === curIdx;\n const markerContent =\n !showStepNames && !isCurrent ? (\n <Tooltip\n target={stepEls[step.id]}\n showDelay='none'\n hideDelay='short'\n describeTarget={false}\n >\n {step.name}\n </Tooltip>\n ) : null;\n\n const commonMarkerProps = {\n id: step.id,\n 'data-step-marker': '',\n 'aria-label': `${step.name} - ${t('step_num', [index + 1, steps.length])}`,\n 'aria-current': isCurrent ? ('step' as const) : undefined,\n tabIndex: isCurrent ? 0 : -1,\n current: isCurrent,\n completed: step.completed,\n onClick: step.onMarkerClick,\n clickable: !!step.onMarkerClick && !isCurrent\n };\n\n return (\n <li key={step.id}>\n {isBarsMode ? (\n <StyledHorizontalBarSegment ref={setStepElement(step.id)} {...commonMarkerProps}>\n {markerContent}\n </StyledHorizontalBarSegment>\n ) : (\n <StepMarker ref={setStepElement(step.id)} depth={step.depth} {...commonMarkerProps}>\n {markerContent}\n </StepMarker>\n )}\n\n {renderStepName({\n isCurrent,\n stepName: step.name,\n onMarkerClick: step.onMarkerClick\n })}\n </li>\n );\n };\n\n useArrows(stepsRef, {\n selector: '[data-step-marker]',\n dir: 'left-right',\n initialFocusElement: currentStepEl\n });\n\n useArrows(stepsRef, {\n selector: '[data-step-marker]',\n cycle: false,\n dir: 'up-down',\n initialFocusElement: currentStepEl\n });\n\n useEffect(() => {\n if (stepEls[curStep.id] && stepEls[curStep.id] !== currentStepEl) {\n setCurrentStepEl(stepEls[curStep.id]);\n }\n }, [Object.keys(stepEls), curStep]);\n\n useEffect(() => {\n if (!stepsAreOverflowing) {\n setShowStepsDialog(false);\n }\n }, [stepsAreOverflowing]);\n\n return (\n <StyledFormProgress\n ref={formProgressRef}\n {...restProps}\n container={{ alignItems: 'center' }}\n showStepNames={showStepNames}\n >\n <CurrentStepPopover\n show={!showStepNames}\n target={currentStepEl}\n placement={popoverPlacement}\n strategy='absolute'\n portal={false}\n hideOnTargetHidden\n modifiers={[\n {\n name: 'offset',\n options: {\n offset: [\n 0,\n tryCatch(\n () => stripUnit(remToPx(theme.base.spacing)),\n () => 8\n )\n ]\n }\n },\n {\n name: 'placeAndContain',\n enabled: false\n },\n {\n name: 'flip',\n enabled: false\n },\n {\n name: 'preventOverflow',\n options: {\n padding: 0\n }\n }\n ]}\n >\n <Text variant='h4'>{curStep.name}</Text>\n </CurrentStepPopover>\n\n {stepsAreOverflowing ? (\n <div>\n <Button\n ref={setStepsDialogButtonEl}\n variant='link'\n onClick={() => {\n setShowStepsDialog(true);\n }}\n >\n {t('step_num', [curIdx + 1, numberOfSteps])}\n </Button>\n <Text variant='h4'>{curStep.name}</Text>\n\n {stepsDialogButtonEl && showStepsDialog && (\n <InfoDialog\n heading={t('steps')}\n target={stepsDialogButtonEl}\n onDismiss={() => {\n setShowStepsDialog(false);\n }}\n placement='bottom-start'\n >\n <VerticalFormProgress steps={steps} currentStepId={currentStepId} variant={variant} />\n </InfoDialog>\n )}\n </div>\n ) : (\n <>\n <Flex\n ref={stepsRef}\n as={isBarsMode ? StyleHorizontalBarList : StyleHorizontalStepMarkers}\n container={{ justify: 'between', alignItems: 'start', gap: 1 }}\n item={{ grow: 1 }}\n showStepNames={showStepNames}\n >\n {steps.map(renderStepItem)}\n </Flex>\n\n {!isBarsMode && (\n <StyledBar shifted={showStepNames}>\n <StyledFill fillScale={fillScale} />\n </StyledBar>\n )}\n </>\n )}\n </StyledFormProgress>\n );\n};\n\nexport default HorizontalFormProgress;\n"]}
1
+ {"version":3,"file":"HorizontalFormProgress.js","sourceRoot":"","sources":["../../../src/components/MultiStepForm/HorizontalFormProgress.tsx"],"names":[],"mappings":";A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C,SAAS,EAAE,SAAS,GAAI,GAC1B,CACb,IACA,CACJ,IACkB,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import { remToPx, stripUnit } from 'polished';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { useArrows, useDirection, useElement, useI18n, useTheme } from '../../hooks';\nimport type { ForwardProps } from '../../types';\nimport { tryCatch } from '../../utils';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Tooltip from '../Tooltip';\nimport Button from '../Button';\nimport { InfoDialog } from '../Dialog';\n\nimport {\n CurrentStepPopover,\n StepMarker,\n StyledBar,\n StyledFill,\n StyledFormProgress,\n StyledHorizontalBarSegment,\n StyledHorizontalStepText,\n StyleHorizontalBarList,\n StyleHorizontalStepMarkers\n} from './FormProgress.styles';\nimport type { MultiStepFormProps } from './MultiStepForm.types';\nimport VerticalFormProgress from './VerticalFormProgress';\nimport { useFormProgressOverflow } from './useFormProgressOverflow';\n\ninterface FormProgressProps {\n steps: MultiStepFormProps['steps'];\n currentStepId: MultiStepFormProps['currentStepId'];\n variant?: MultiStepFormProps['variant'];\n showStepNames?: boolean;\n}\n\nconst HorizontalFormProgress = ({\n steps,\n currentStepId,\n showStepNames = false,\n variant = 'dot',\n ...restProps\n}: FormProgressProps & ForwardProps) => {\n const t = useI18n();\n const theme = useTheme();\n const isBarsMode = variant === 'bar';\n\n const [stepsDialogButtonEl, setStepsDialogButtonEl] = useElement<HTMLButtonElement>();\n const [showStepsDialog, setShowStepsDialog] = useState(false);\n\n const { ref: formProgressRef, state: stepsAreOverflowing } = useFormProgressOverflow(\n steps.length,\n showStepNames,\n isBarsMode\n );\n\n const curIdx = steps.findIndex(step => step.id === currentStepId);\n const curStep = steps[curIdx];\n const fillScale = curIdx / (steps.length - 1);\n\n const [currentStepEl, setCurrentStepEl] = useElement();\n const [stepEls, setStepEls] = useState<Record<string, HTMLElement>>({});\n const stepsRef = useRef(null);\n const { rtl } = useDirection();\n\n let popoverPlacement: 'bottom' | 'bottom-start' | 'bottom-end' = 'bottom';\n if (curIdx === 0) popoverPlacement = rtl ? 'bottom-end' : 'bottom-start';\n else if (curIdx === steps.length - 1) popoverPlacement = rtl ? 'bottom-start' : 'bottom-end';\n\n const numberOfSteps = steps.length;\n\n const setStepElement = (stepId: string) => (el: HTMLElement | null) => {\n setStepEls(curr => {\n const newEls = { ...curr };\n\n if (!el && newEls[stepId]) {\n delete newEls[stepId];\n return newEls;\n }\n\n if (el) return { ...newEls, [stepId]: el };\n\n return newEls;\n });\n };\n\n const renderStepName = ({\n isCurrent,\n stepName,\n onMarkerClick\n }: {\n isCurrent: boolean;\n stepName: string;\n onMarkerClick?: MultiStepFormProps['steps'][number]['onMarkerClick'];\n }) => {\n if (!showStepNames) return null;\n\n if (!!onMarkerClick && !isCurrent) {\n return (\n <Button variant='link' onClick={onMarkerClick} as={StyledHorizontalStepText} tabIndex={-1}>\n {stepName}\n </Button>\n );\n }\n\n return (\n <Text variant={isCurrent ? 'h3' : undefined} as={StyledHorizontalStepText}>\n {stepName}\n </Text>\n );\n };\n\n const renderStepItem = (step: MultiStepFormProps['steps'][number], index: number) => {\n const isCurrent = index === curIdx;\n const markerContent =\n !showStepNames && !isCurrent ? (\n <Tooltip\n target={stepEls[step.id]}\n showDelay='none'\n hideDelay='short'\n describeTarget={false}\n >\n {step.name}\n </Tooltip>\n ) : null;\n\n const commonMarkerProps = {\n id: step.id,\n 'data-step-marker': '',\n 'aria-label': `${step.name} - ${t('step_num', [index + 1, steps.length])}`,\n 'aria-current': isCurrent ? ('step' as const) : undefined,\n tabIndex: isCurrent ? 0 : -1,\n current: isCurrent,\n completed: step.completed,\n onClick: step.onMarkerClick,\n clickable: !!step.onMarkerClick && !isCurrent\n };\n\n return (\n <li key={step.id}>\n {isBarsMode ? (\n <StyledHorizontalBarSegment ref={setStepElement(step.id)} {...commonMarkerProps}>\n {markerContent}\n </StyledHorizontalBarSegment>\n ) : (\n <StepMarker ref={setStepElement(step.id)} depth={step.depth} {...commonMarkerProps}>\n {markerContent}\n </StepMarker>\n )}\n\n {renderStepName({\n isCurrent,\n stepName: step.name,\n onMarkerClick: step.onMarkerClick\n })}\n </li>\n );\n };\n\n useArrows(stepsRef, {\n selector: '[data-step-marker]',\n dir: 'left-right',\n initialFocusElement: currentStepEl\n });\n\n useArrows(stepsRef, {\n selector: '[data-step-marker]',\n cycle: false,\n dir: 'up-down',\n initialFocusElement: currentStepEl\n });\n\n useEffect(() => {\n if (stepEls[curStep.id] && stepEls[curStep.id] !== currentStepEl) {\n setCurrentStepEl(stepEls[curStep.id]);\n }\n }, [Object.keys(stepEls), curStep]);\n\n useEffect(() => {\n if (!stepsAreOverflowing) {\n setShowStepsDialog(false);\n }\n }, [stepsAreOverflowing]);\n\n return (\n <StyledFormProgress\n ref={formProgressRef}\n {...restProps}\n container={{ alignItems: 'center' }}\n showStepNames={showStepNames}\n >\n <CurrentStepPopover\n show={!showStepNames}\n target={currentStepEl}\n placement={popoverPlacement}\n strategy='absolute'\n portal={false}\n hideOnTargetHidden\n modifiers={[\n {\n name: 'offset',\n options: {\n offset: [\n 0,\n tryCatch(\n () => stripUnit(remToPx(theme.base.spacing)),\n () => 8\n )\n ]\n }\n },\n {\n name: 'placeAndContain',\n enabled: false\n },\n {\n name: 'flip',\n enabled: false\n },\n {\n name: 'preventOverflow',\n options: {\n padding: 0\n }\n }\n ]}\n >\n <Text variant='h4'>{curStep.name}</Text>\n </CurrentStepPopover>\n\n {stepsAreOverflowing ? (\n <div>\n <Button\n ref={setStepsDialogButtonEl}\n variant='link'\n onClick={() => {\n setShowStepsDialog(true);\n }}\n >\n {t('step_num', [curIdx + 1, numberOfSteps])}\n </Button>\n <Text variant='h4'>{curStep.name}</Text>\n\n {stepsDialogButtonEl && showStepsDialog && (\n <InfoDialog\n heading={t('steps')}\n target={stepsDialogButtonEl}\n onDismiss={() => {\n setShowStepsDialog(false);\n }}\n placement='bottom-start'\n >\n <VerticalFormProgress steps={steps} currentStepId={currentStepId} variant={variant} />\n </InfoDialog>\n )}\n </div>\n ) : (\n <>\n <Flex\n ref={stepsRef}\n as={isBarsMode ? StyleHorizontalBarList : StyleHorizontalStepMarkers}\n container={{ justify: 'between', alignItems: 'start', gap: 1 }}\n item={{ grow: 1 }}\n showStepNames={showStepNames}\n >\n {steps.map(renderStepItem)}\n </Flex>\n\n {!isBarsMode && (\n <StyledBar shifted={showStepNames}>\n <StyledFill fillScale={fillScale} />\n </StyledBar>\n )}\n </>\n )}\n </StyledFormProgress>\n );\n};\n\nexport default HorizontalFormProgress;\n"]}
@@ -1,7 +1,7 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  export function getDecimalSign(locale, options) {
3
3
  return (new Intl.NumberFormat(locale, options)
4
- .formatToParts(0.1)
4
+ .formatToParts(1.1)
5
5
  .filter((part) => part.type === 'decimal')[0]?.value || '');
6
6
  }
7
7
  export function getFraction(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/Number/utils.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,MAAM,UAAU,cAAc,CAC5B,MAAyC,EACzC,OAAkC;IAElC,OAAO,CACL,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC;SACnC,aAAa,CAAC,GAAG,CAAC;SAClB,MAAM,CAAC,CAAC,IAAqC,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE,CAC9F,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,YAAY,GAAG,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IAC3D,OAAO,KAAK,CAAC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GAAG,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,EAAE,IAAY;IACvF,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,IAAI,SAAS,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACxD,IAAI,cAAc,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;QAClD,OAAO,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IACD,IAAI,GAAG,KAAK,SAAS,IAAI,QAAQ,CAAC,QAAQ,EAAE,GAAG,GAAG,EAAE,CAAC;QACnD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAOD,MAAM,UAAU,YAAY,CAAC,KAAsB,EAAE,EAAE,MAAM,EAAE,OAAO,EAAuB;IAC3F,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzD,OAAO,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import BigNumber from 'bignumber.js';\n\nexport function getDecimalSign(\n locale: Intl.UnicodeBCP47LocaleIdentifier,\n options?: Intl.NumberFormatOptions\n): string {\n return (\n new Intl.NumberFormat(locale, options)\n .formatToParts(0.1)\n .filter((part: { type: string; value: string }) => part.type === 'decimal')[0]?.value || ''\n );\n}\n\nexport function getFraction(value: string) {\n const decPos = value.indexOf('.');\n const substrLength = decPos === -1 ? value.length : decPos;\n return value.substring(substrLength);\n}\n\nexport function getCleanedValue(\n value: string,\n decimalSign: string,\n maximumFractionDigits: number\n): string {\n let rawValue = value.replace(new RegExp(`[^${decimalSign}\\\\d-]+`, 'gu'), '');\n if (decimalSign && decimalSign !== '.') rawValue = rawValue.replace(decimalSign, '.');\n const match = rawValue.match(new RegExp(`-?\\\\d*(\\\\.\\\\d{0,${maximumFractionDigits}})?`));\n if (match && match.length > 0) {\n rawValue = match[0];\n }\n return rawValue;\n}\n\nconst isValidUnit = (unit: string) => {\n try {\n // eslint-disable-next-line no-new\n new Intl.NumberFormat(undefined, { style: 'unit', unit });\n return true;\n } catch {\n return false;\n }\n};\n\nexport const getFormattedValue = (\n value: string,\n locale: string,\n unit?: string,\n {\n notation = 'standard',\n useGrouping = false,\n maximumFractionDigits,\n minimumFractionDigits\n }: Pick<\n Intl.NumberFormatOptions,\n 'notation' | 'useGrouping' | 'maximumFractionDigits' | 'minimumFractionDigits'\n > = {}\n) => {\n const isUnit = unit ? isValidUnit(unit) : false;\n const [integer, fractionPart] = value.split('.', 2) as [string, string?];\n\n const formatter = new Intl.NumberFormat(locale, {\n notation,\n useGrouping,\n minimumFractionDigits:\n minimumFractionDigits ?? Math.min(maximumFractionDigits ?? 0, fractionPart?.length ?? 0),\n maximumFractionDigits,\n style: isUnit ? 'unit' : undefined,\n unit: isUnit ? unit : undefined,\n numberingSystem: 'latn'\n });\n\n let formatted = value;\n\n if (value && !Number.isNaN(parseFloat(integer))) {\n const endsWithDot = fractionPart === '';\n const valueNumber = endsWithDot ? `${value}1` : value;\n formatted =\n formatter\n .formatToParts(valueNumber as `${number}`)\n .reduce((result, { type, value: part }) => {\n if (type === 'fraction' && endsWithDot) return result;\n return result + part;\n }, '') + (!isUnit && unit ? `\\u00a0${unit}` : '');\n } else if (unit) {\n if (isUnit)\n formatted = formatter\n .formatToParts(value.startsWith('-') ? -1 : 1)\n .reduce(\n (result, { type, value: part }) =>\n ['unit', 'minusSign'].includes(type) ? result + part : result,\n ''\n );\n else formatted = value.startsWith('-') ? `- ${unit}` : unit;\n }\n\n return formatted;\n};\n\nexport function isValueInRange(value: number, min?: number, max?: number): boolean {\n return !((min !== undefined && value < min) || (max !== undefined && value > max));\n}\n\nexport function getIncrementedValue(value: string, min: number, max: number, step: number): string {\n const numberValue = parseFloat(value) || 0;\n const newValue = new BigNumber(numberValue).plus(step);\n if (isValueInRange(newValue.toNumber(), min, max)) {\n return newValue.toFixed();\n }\n if (min !== undefined && newValue.toNumber() < min) {\n return min.toString();\n }\n return value;\n}\n\nexport function getDecrementedValue(value: string, min: number, max: number, step: number): string {\n const numberValue = parseFloat(value) || 0;\n const newValue = new BigNumber(numberValue).minus(step);\n if (isValueInRange(newValue.toNumber(), min, max)) {\n return newValue.toFixed();\n }\n if (max !== undefined && newValue.toNumber() > max) {\n return max.toString();\n }\n return value;\n}\n\ninterface NumberFormatOptions {\n locale: string;\n options?: Intl.NumberFormatOptions;\n}\n\nexport function formatNumber(value: number | bigint, { locale, options }: NumberFormatOptions) {\n const formatter = new Intl.NumberFormat(locale, options);\n\n return formatter.format(value);\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/Number/utils.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,MAAM,UAAU,cAAc,CAC5B,MAAyC,EACzC,OAAkC;IAElC,OAAO,CACL,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC;SACnC,aAAa,CAAC,GAAG,CAAC;SAClB,MAAM,CAAC,CAAC,IAAqC,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE,CAC9F,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,YAAY,GAAG,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IAC3D,OAAO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QACnD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,EAAE,IAAY;IACvF,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,IAAI,SAAS,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACxD,IAAI,cAAc,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;QAClD,OAAO,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IACD,IAAI,GAAG,KAAK,SAAS,IAAI,QAAQ,CAAC,QAAQ,EAAE,GAAG,GAAG,EAAE,CAAC;QACnD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAOD,MAAM,UAAU,YAAY,CAAC,KAAsB,EAAE,EAAE,MAAM,EAAE,OAAO,EAAuB;IAC3F,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzD,OAAO,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import BigNumber from 'bignumber.js';\n\nexport function getDecimalSign(\n locale: Intl.UnicodeBCP47LocaleIdentifier,\n options?: Intl.NumberFormatOptions\n): string {\n return (\n new Intl.NumberFormat(locale, options)\n .formatToParts(1.1)\n .filter((part: { type: string; value: string }) => part.type === 'decimal')[0]?.value || ''\n );\n}\n\nexport function getFraction(value: string) {\n const decPos = value.indexOf('.');\n const substrLength = decPos === -1 ? value.length : decPos;\n return value.substring(substrLength);\n}\n\nexport function getCleanedValue(\n value: string,\n decimalSign: string,\n maximumFractionDigits: number\n): string {\n let rawValue = value.replace(new RegExp(`[^${decimalSign}\\\\d-]+`, 'gu'), '');\n if (decimalSign && decimalSign !== '.') rawValue = rawValue.replace(decimalSign, '.');\n const match = rawValue.match(new RegExp(`-?\\\\d*(\\\\.\\\\d{0,${maximumFractionDigits}})?`));\n if (match && match.length > 0) {\n rawValue = match[0];\n }\n return rawValue;\n}\n\nconst isValidUnit = (unit: string) => {\n try {\n // eslint-disable-next-line no-new\n new Intl.NumberFormat(undefined, { style: 'unit', unit });\n return true;\n } catch {\n return false;\n }\n};\n\nexport const getFormattedValue = (\n value: string,\n locale: string,\n unit?: string,\n {\n notation = 'standard',\n useGrouping = false,\n maximumFractionDigits,\n minimumFractionDigits\n }: Pick<\n Intl.NumberFormatOptions,\n 'notation' | 'useGrouping' | 'maximumFractionDigits' | 'minimumFractionDigits'\n > = {}\n) => {\n const isUnit = unit ? isValidUnit(unit) : false;\n const [integer, fractionPart] = value.split('.', 2) as [string, string?];\n\n const formatter = new Intl.NumberFormat(locale, {\n notation,\n useGrouping,\n minimumFractionDigits:\n minimumFractionDigits ?? Math.min(maximumFractionDigits ?? 0, fractionPart?.length ?? 0),\n maximumFractionDigits,\n style: isUnit ? 'unit' : undefined,\n unit: isUnit ? unit : undefined,\n numberingSystem: 'latn'\n });\n\n let formatted = value;\n\n if (value && !Number.isNaN(parseFloat(integer))) {\n const endsWithDot = fractionPart === '';\n const valueNumber = endsWithDot ? `${value}1` : value;\n formatted =\n formatter\n .formatToParts(valueNumber as `${number}`)\n .reduce((result, { type, value: part }) => {\n if (type === 'fraction' && endsWithDot) return result;\n return result + part;\n }, '') + (!isUnit && unit ? `\\u00a0${unit}` : '');\n } else if (unit) {\n if (isUnit)\n formatted = formatter\n .formatToParts(value.startsWith('-') ? -1 : 1)\n .reduce(\n (result, { type, value: part }) =>\n ['unit', 'minusSign'].includes(type) ? result + part : result,\n ''\n );\n else formatted = value.startsWith('-') ? `- ${unit}` : unit;\n }\n\n return formatted;\n};\n\nexport function isValueInRange(value: number, min?: number, max?: number): boolean {\n return !((min !== undefined && value < min) || (max !== undefined && value > max));\n}\n\nexport function getIncrementedValue(value: string, min: number, max: number, step: number): string {\n const numberValue = parseFloat(value) || 0;\n const newValue = new BigNumber(numberValue).plus(step);\n if (isValueInRange(newValue.toNumber(), min, max)) {\n return newValue.toFixed();\n }\n if (min !== undefined && newValue.toNumber() < min) {\n return min.toString();\n }\n return value;\n}\n\nexport function getDecrementedValue(value: string, min: number, max: number, step: number): string {\n const numberValue = parseFloat(value) || 0;\n const newValue = new BigNumber(numberValue).minus(step);\n if (isValueInRange(newValue.toNumber(), min, max)) {\n return newValue.toFixed();\n }\n if (max !== undefined && newValue.toNumber() > max) {\n return max.toString();\n }\n return value;\n}\n\ninterface NumberFormatOptions {\n locale: string;\n options?: Intl.NumberFormatOptions;\n}\n\nexport function formatNumber(value: number | bigint, { locale, options }: NumberFormatOptions) {\n const formatter = new Intl.NumberFormat(locale, options);\n\n return formatter.format(value);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ResponsiveActions.d.ts","sourceRoot":"","sources":["../../../src/components/ResponsiveActions/ResponsiveActions.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlD,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE1D,KAAK,sBAAsB,GAAG,cAAc,CAC1C,KAAK,EACL,MAAM,GAAG;IAEP,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAEnC,SAAS,EAAE,SAAS,CAAC;CACtB,CACF,CAAC;AAEF,eAAO,MAAM,gCAAgC;cAA0B,OAAO;YAuB7E,CAAC;AAEF,QAAA,MAAM,iBAAiB,GAAI,6CAA6C,sBAAsB,4CAoE7F,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"ResponsiveActions.d.ts","sourceRoot":"","sources":["../../../src/components/ResponsiveActions/ResponsiveActions.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlD,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE1D,KAAK,sBAAsB,GAAG,cAAc,CAC1C,KAAK,EACL,MAAM,GAAG;IAEP,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAEnC,SAAS,EAAE,SAAS,CAAC;CACtB,CACF,CAAC;AAEF,eAAO,MAAM,gCAAgC;cAA0B,OAAO;YAwB7E,CAAC;AAEF,QAAA,MAAM,iBAAiB,GAAI,6CAA6C,sBAAsB,4CAoE7F,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -23,6 +23,7 @@ export const StyledResponsiveActionsContainer = styled.div(({ stacked }) => css
23
23
  &[aria-hidden='true'] {
24
24
  position: fixed;
25
25
  visibility: hidden;
26
+ inset-inline-end: 100lvi;
26
27
  }
27
28
  `);
28
29
  const ResponsiveActions = ({ actionsRef, actionsEl, as, ...restProps }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"ResponsiveActions.js","sourceRoot":"","sources":["../../../src/components/ResponsiveActions/ResponsiveActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAazC,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAC,GAAG,CACxD,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;MAChB,YAAY,MAAM,YAAY;;;;;;;;MAQ9B,CAAC,OAAO;IACV,GAAG,CAAA;;;;;KAKF;;;;;;GAMF,CACF,CAAC;AAEF,MAAM,iB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AAC,IAAI,CAAC,EAAE,CAAC;gBAC9B,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;YACD,IAAI,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE,CAAC;gBACvC,MAAM,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;YACxC,CAAC;YACD,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,8BACE,KAAC,IAAI,OACC,SAAS,EACb,EAAE,EAAE,gCAAgC,EACpC,WAAW,EAAE,EAAE,EACf,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE;oBACT,GAAG,EAAE,CAAC;oBACN,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;iBAC5D,YAEA,SAAS,GACL,EACP,KAAC,IAAI,IACH,EAAE,EAAE,gCAAgC,EACpC,GAAG,EAAE,gBAAgB,uBAErB,KAAK,EAAC,EAAE,EACR,SAAS,EAAE;oBACT,GAAG,EAAE,CAAC;oBACN,SAAS,EAAE,KAAK;oBAChB,OAAO,EAAE,KAAK;iBACf,YAEA,SAAS,GACL,IACN,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { useLayoutEffect, useRef, useState } from 'react';\nimport type { ReactNode, RefObject } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Flex from '../Flex';\nimport { StyledButton } from '../Button';\nimport type { AsProp, WithAttributes } from '../../types';\n\ntype ResponsiveActionsProps = WithAttributes<\n 'div',\n AsProp & {\n /* Ref assigned to the actions region. */\n actionsRef: RefObject<HTMLElement>;\n /* Actions region content. */\n actionsEl: ReactNode;\n }\n>;\n\nexport const StyledResponsiveActionsContainer = styled.div<{ stacked?: boolean }>(\n ({ stacked }) => css`\n ${StyledButton} + ${StyledButton} {\n margin-inline-start: unset;\n }\n\n & > :not(a, button) {\n display: contents;\n }\n\n ${!stacked &&\n css`\n & > :is(a, button):first-child:not(:last-child),\n & > :first-child:not(:last-child) :is(a, button):first-child {\n margin-inline-end: auto;\n }\n `}\n\n &[aria-hidden='true'] {\n position: fixed;\n visibility: hidden;\n }\n `\n);\n\nconst ResponsiveActions = ({ actionsRef, actionsEl, as, ...restProps }: ResponsiveActionsProps) => {\n const hiddenActionsRef = useRef<HTMLDivElement>(null);\n const [stacked, setStacked] = useState(false);\n\n useLayoutEffect(() => {\n if (hiddenActionsRef.current && actionsRef.current) {\n const minInlineWidth = hiddenActionsRef.current.getBoundingClientRect().width;\n\n const resizeObserver = new ResizeObserver(entries => {\n setTimeout(() => {\n if (stacked && entries[0].borderBoxSize[0].inlineSize > minInlineWidth) {\n setStacked(false);\n } else if (!stacked && entries[0].borderBoxSize[0].inlineSize <= minInlineWidth) {\n setStacked(true);\n }\n }, 0);\n });\n\n resizeObserver.observe(actionsRef.current);\n\n return () => {\n resizeObserver.disconnect();\n };\n }\n });\n\n useLayoutEffect(() => {\n hiddenActionsRef.current?.querySelectorAll('a, button').forEach(action => {\n if (action.hasAttribute('id')) {\n action.removeAttribute('id');\n }\n if (action.hasAttribute('data-testid')) {\n action.removeAttribute('data-testid');\n }\n action.setAttribute('role', 'none');\n });\n });\n\n return (\n <>\n <Flex\n {...restProps}\n as={StyledResponsiveActionsContainer}\n forwardedAs={as}\n ref={actionsRef}\n stacked={stacked}\n container={{\n gap: 1,\n ...(stacked ? { direction: 'column' } : { justify: 'end' })\n }}\n >\n {actionsEl}\n </Flex>\n <Flex\n as={StyledResponsiveActionsContainer}\n ref={hiddenActionsRef}\n aria-hidden\n inert=''\n container={{\n gap: 1,\n direction: 'row',\n justify: 'end'\n }}\n >\n {actionsEl}\n </Flex>\n </>\n );\n};\n\nexport default ResponsiveActions;\n"]}
1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AE,EAAE,gCAAgC,EACpC,GAAG,EAAE,gBAAgB,uBAErB,KAAK,EAAC,EAAE,EACR,SAAS,EAAE;oBACT,GAAG,EAAE,CAAC;oBACN,SAAS,EAAE,KAAK;oBAChB,OAAO,EAAE,KAAK;iBACf,YAEA,SAAS,GACL,IACN,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { useLayoutEffect, useRef, useState } from 'react';\nimport type { ReactNode, RefObject } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Flex from '../Flex';\nimport { StyledButton } from '../Button';\nimport type { AsProp, WithAttributes } from '../../types';\n\ntype ResponsiveActionsProps = WithAttributes<\n 'div',\n AsProp & {\n /* Ref assigned to the actions region. */\n actionsRef: RefObject<HTMLElement>;\n /* Actions region content. */\n actionsEl: ReactNode;\n }\n>;\n\nexport const StyledResponsiveActionsContainer = styled.div<{ stacked?: boolean }>(\n ({ stacked }) => css`\n ${StyledButton} + ${StyledButton} {\n margin-inline-start: unset;\n }\n\n & > :not(a, button) {\n display: contents;\n }\n\n ${!stacked &&\n css`\n & > :is(a, button):first-child:not(:last-child),\n & > :first-child:not(:last-child) :is(a, button):first-child {\n margin-inline-end: auto;\n }\n `}\n\n &[aria-hidden='true'] {\n position: fixed;\n visibility: hidden;\n inset-inline-end: 100lvi;\n }\n `\n);\n\nconst ResponsiveActions = ({ actionsRef, actionsEl, as, ...restProps }: ResponsiveActionsProps) => {\n const hiddenActionsRef = useRef<HTMLDivElement>(null);\n const [stacked, setStacked] = useState(false);\n\n useLayoutEffect(() => {\n if (hiddenActionsRef.current && actionsRef.current) {\n const minInlineWidth = hiddenActionsRef.current.getBoundingClientRect().width;\n\n const resizeObserver = new ResizeObserver(entries => {\n setTimeout(() => {\n if (stacked && entries[0].borderBoxSize[0].inlineSize > minInlineWidth) {\n setStacked(false);\n } else if (!stacked && entries[0].borderBoxSize[0].inlineSize <= minInlineWidth) {\n setStacked(true);\n }\n }, 0);\n });\n\n resizeObserver.observe(actionsRef.current);\n\n return () => {\n resizeObserver.disconnect();\n };\n }\n });\n\n useLayoutEffect(() => {\n hiddenActionsRef.current?.querySelectorAll('a, button').forEach(action => {\n if (action.hasAttribute('id')) {\n action.removeAttribute('id');\n }\n if (action.hasAttribute('data-testid')) {\n action.removeAttribute('data-testid');\n }\n action.setAttribute('role', 'none');\n });\n });\n\n return (\n <>\n <Flex\n {...restProps}\n as={StyledResponsiveActionsContainer}\n forwardedAs={as}\n ref={actionsRef}\n stacked={stacked}\n container={{\n gap: 1,\n ...(stacked ? { direction: 'column' } : { justify: 'end' })\n }}\n >\n {actionsEl}\n </Flex>\n <Flex\n as={StyledResponsiveActionsContainer}\n ref={hiddenActionsRef}\n aria-hidden\n inert=''\n container={{\n gap: 1,\n direction: 'row',\n justify: 'end'\n }}\n >\n {actionsEl}\n </Flex>\n </>\n );\n};\n\nexport default ResponsiveActions;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,EAAE,EAIF,kBAAkB,EAElB,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGvF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAgBvD,MAAM,WAAW,aAAc,SAAQ,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU;IAC5F,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,QAAQ,CAAC,EAAE,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IACnD,OAAO,CAAC,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IACjD,MAAM,CAAC,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;CACjD;;;;AA+ND,wBAAyD"}
1
+ {"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,EAAE,EAIF,kBAAkB,EAElB,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGvF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAgBvD,MAAM,WAAW,aAAc,SAAQ,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU;IAC5F,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,QAAQ,CAAC,EAAE,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IACnD,OAAO,CAAC,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IACjD,MAAM,CAAC,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;CACjD;;;;AA+MD,wBAAyD"}
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useCallback, useState, useEffect, useRef, useLayoutEffect } from 'react';
2
+ import { forwardRef, useCallback, useState, useEffect, useRef } from 'react';
3
3
  import FormField from '../FormField';
4
4
  import { StyledFormControl } from '../FormControl';
5
5
  import { hasProp, withTestIds } from '../../utils';
6
6
  import { useConsolidatedRef, useElement, useI18n, useLiveLog, useTestIds, useUID } from '../../hooks';
7
7
  import Text from '../Text';
8
8
  import VisuallyHiddenText from '../VisuallyHiddenText';
9
- import StyledTextArea, { textAreaMaxHeight } from './TextArea.styles';
9
+ import StyledTextArea from './TextArea.styles';
10
10
  import { getTextAreaTestIds } from './TextArea.test-ids';
11
11
  const warnCharCount = 30;
12
12
  const TextArea = forwardRef(function TextArea(props, ref) {
@@ -19,7 +19,6 @@ const TextArea = forwardRef(function TextArea(props, ref) {
19
19
  const [textAreaEl, setTextAreaEl] = useElement();
20
20
  const textAreaRef = useConsolidatedRef(ref, setTextAreaEl);
21
21
  const prevHeightRef = useRef(0);
22
- const heightPxRef = useRef(0);
23
22
  const focusTimeoutRef = useRef(NaN);
24
23
  const { announceAssertive } = useLiveLog();
25
24
  const controlProp = {};
@@ -54,12 +53,7 @@ const TextArea = forwardRef(function TextArea(props, ref) {
54
53
  const recalculateHeight = useCallback(() => {
55
54
  if (!textAreaRef.current)
56
55
  return;
57
- const baseHeightPx = heightPxRef.current;
58
- const currentHeight = parseFloat(getComputedStyle(textAreaRef.current).getPropertyValue('--textarea-height'));
59
- textAreaRef.current.style.marginBlockEnd =
60
- currentHeight > baseHeightPx
61
- ? `calc(min(${textAreaMaxHeight}, ${currentHeight}px) - ${baseHeightPx}px)`
62
- : '0';
56
+ const scrollY = window.scrollY;
63
57
  textAreaRef.current.style.setProperty('--textarea-height', 'auto');
64
58
  // Remove scrollbar width to avoid interference with calculation.
65
59
  textAreaRef.current.style.setProperty('scrollbar-width', 'none');
@@ -67,14 +61,12 @@ const TextArea = forwardRef(function TextArea(props, ref) {
67
61
  const borderWidth = textAreaRef.current.offsetHeight - textAreaRef.current.clientHeight;
68
62
  // Set height to auto then scrollHeight + borderWidth to resize TextArea to content
69
63
  textAreaRef.current.style.setProperty('--textarea-height', `${scrollHeight + borderWidth}px`);
70
- textAreaRef.current.style.removeProperty('margin-block-end');
71
64
  textAreaRef.current.style.removeProperty('scrollbar-width');
65
+ // height:auto can trigger browser caret scroll-into-view; undo if it moved.
66
+ if (window.scrollY !== scrollY) {
67
+ window.scrollTo(window.scrollX, scrollY);
68
+ }
72
69
  }, []);
73
- useLayoutEffect(() => {
74
- if (!textAreaRef.current)
75
- return;
76
- heightPxRef.current = textAreaRef.current.offsetHeight;
77
- }, [textAreaEl]);
78
70
  useEffect(() => {
79
71
  if (!textAreaRef.current)
80
72
  return;
@@ -93,12 +85,6 @@ const TextArea = forwardRef(function TextArea(props, ref) {
93
85
  const observer = new ResizeObserver(entries => {
94
86
  const currentHeight = entries[0].contentRect.height;
95
87
  if (prevHeightRef.current === 0 && currentHeight > 0) {
96
- const textareaHeight = getComputedStyle(textAreaEl)
97
- .getPropertyValue('--textarea-height')
98
- .trim();
99
- if (!textareaHeight || textareaHeight === 'auto' || textareaHeight === 'unset') {
100
- heightPxRef.current = textAreaEl.offsetHeight;
101
- }
102
88
  recalculateHeight();
103
89
  }
104
90
  prevHeightRef.current = currentHeight;
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAY9F,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,OAAO,EACP,UAAU,EACV,UAAU,EACV,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,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,mBAAmB,EAAE,mBAAmB,YAEvC,eAAe,GACN,CACb,CAAC,CAAC,CAAC,CACF,eAAe,CAChB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { forwardRef, useCallback, useState, useEffect, useRef, useLayoutEffect } from 'react';\nimport type {\n FC,\n Ref,\n PropsWithoutRef,\n ChangeEvent,\n ChangeEventHandler,\n FocusEvent,\n FocusEventHandler\n} from 'react';\n\nimport type { BaseProps, ForwardProps, NoChildrenProp, TestIdProp } from '../../types';\nimport FormField from '../FormField';\nimport { StyledFormControl } from '../FormControl';\nimport type { FormControlProps } from '../FormControl';\nimport { hasProp, withTestIds } from '../../utils';\nimport {\n useConsolidatedRef,\n useElement,\n useI18n,\n useLiveLog,\n useTestIds,\n useUID\n} from '../../hooks';\nimport Text from '../Text';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\n\nimport StyledTextArea, { textAreaMaxHeight } from './TextArea.styles';\nimport { getTextAreaTestIds } from './TextArea.test-ids';\n\nexport interface TextAreaProps extends FormControlProps, BaseProps, NoChildrenProp, TestIdProp {\n /** Minimum length of characters that can be input. */\n minLength?: number;\n /** Maximum length of characters that can be input. */\n maxLength?: number;\n /**\n * Allows the user to resize the Text Area. This prop is ignored if autoResize is true.\n * @default false\n */\n resizable?: boolean;\n /**\n * Enables the Text Area to resize itself automatically.\n * @default true\n */\n autoResize?: boolean;\n /**\n * Display a live character count in relation to the maxLength.\n * @default false\n */\n displayCharCount?: boolean;\n /**\n * Allow or disallow a value beyond the maxLength.\n * @default true\n */\n hardStop?: boolean;\n\n onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n onFocus?: FocusEventHandler<HTMLTextAreaElement>;\n onBlur?: FocusEventHandler<HTMLTextAreaElement>;\n}\n\nconst warnCharCount = 30;\n\nconst TextArea: FC<TextAreaProps & ForwardProps> = forwardRef(function TextArea(\n props: PropsWithoutRef<TextAreaProps>,\n ref: Ref<HTMLTextAreaElement>\n) {\n const uid = useUID();\n const {\n testId,\n additionalInfo,\n id = uid,\n value,\n defaultValue,\n required = false,\n disabled = false,\n readOnly = false,\n label,\n labelHidden,\n info,\n status,\n resizable = false,\n autoResize = true,\n maxLength,\n displayCharCount = false,\n hardStop = true,\n onChange: onChangeProp,\n onResolveSuggestion,\n ...restProps\n } = props;\n const t = useI18n();\n\n const testIds = useTestIds(testId, getTextAreaTestIds);\n const [charCount, setCharCount] = useState(value?.length ?? defaultValue?.length ?? 0);\n const [focused, setFocused] = useState(false);\n const [textAreaEl, setTextAreaEl] = useElement<HTMLTextAreaElement>();\n const textAreaRef = useConsolidatedRef(ref, setTextAreaEl);\n const prevHeightRef = useRef(0);\n const heightPxRef = useRef(0);\n const focusTimeoutRef = useRef(NaN);\n const { announceAssertive } = useLiveLog();\n\n const controlProp: {\n value?: string;\n defaultValue?: string;\n } = {};\n\n // Conditionally render component as controlled/uncontrolled\n if (hasProp(props, 'value')) {\n controlProp.value = value ?? '';\n } else if (hasProp(props, 'defaultValue')) {\n controlProp.defaultValue = defaultValue ?? '';\n }\n\n const onChange = useCallback(\n (e: ChangeEvent<HTMLTextAreaElement>) => {\n if (maxLength !== undefined) {\n if (e.target.value.length >= maxLength) {\n announceAssertive({ message: t('text_area_character_limit'), type: 'warning' });\n } else if (maxLength > warnCharCount) {\n const prevCharsRemaining = maxLength - charCount;\n const charsRemaining = maxLength - e.target.value.length;\n\n if (charsRemaining < warnCharCount && prevCharsRemaining >= warnCharCount) {\n announceAssertive({\n message: t('text_area_characters_remaining', [`${warnCharCount}`]),\n type: 'warning'\n });\n }\n }\n }\n\n if (!hardStop || maxLength === undefined || e.target.value.length <= maxLength) {\n onChangeProp?.(e);\n setCharCount(e.target.value.length);\n }\n },\n [onChangeProp, charCount, hardStop, maxLength, announceAssertive, t]\n );\n\n const recalculateHeight = useCallback(() => {\n if (!textAreaRef.current) return;\n\n const baseHeightPx = heightPxRef.current;\n const currentHeight = parseFloat(\n getComputedStyle(textAreaRef.current).getPropertyValue('--textarea-height')\n );\n textAreaRef.current.style.marginBlockEnd =\n currentHeight > baseHeightPx\n ? `calc(min(${textAreaMaxHeight}, ${currentHeight}px) - ${baseHeightPx}px)`\n : '0';\n\n textAreaRef.current.style.setProperty('--textarea-height', 'auto');\n\n // Remove scrollbar width to avoid interference with calculation.\n textAreaRef.current.style.setProperty('scrollbar-width', 'none');\n\n const scrollHeight = textAreaRef.current.scrollHeight;\n const borderWidth = textAreaRef.current.offsetHeight - textAreaRef.current.clientHeight;\n // Set height to auto then scrollHeight + borderWidth to resize TextArea to content\n textAreaRef.current.style.setProperty('--textarea-height', `${scrollHeight + borderWidth}px`);\n\n textAreaRef.current.style.removeProperty('margin-block-end');\n\n textAreaRef.current.style.removeProperty('scrollbar-width');\n }, []);\n\n useLayoutEffect(() => {\n if (!textAreaRef.current) return;\n heightPxRef.current = textAreaRef.current.offsetHeight;\n }, [textAreaEl]);\n\n useEffect(() => {\n if (!textAreaRef.current) return;\n\n if (autoResize) {\n recalculateHeight();\n } else {\n textAreaRef.current.style.removeProperty('--textarea-height');\n }\n }, [value, autoResize, recalculateHeight]);\n\n // Recalculate height when the element becomes visible after being displayed none.\n useEffect(() => {\n if (!textAreaEl || !autoResize) return;\n\n prevHeightRef.current = textAreaEl.offsetHeight;\n\n const observer = new ResizeObserver(entries => {\n const currentHeight = entries[0].contentRect.height;\n if (prevHeightRef.current === 0 && currentHeight > 0) {\n const textareaHeight = getComputedStyle(textAreaEl)\n .getPropertyValue('--textarea-height')\n .trim();\n if (!textareaHeight || textareaHeight === 'auto' || textareaHeight === 'unset') {\n heightPxRef.current = textAreaEl.offsetHeight;\n }\n recalculateHeight();\n }\n prevHeightRef.current = currentHeight;\n });\n\n observer.observe(textAreaEl);\n return () => observer.disconnect();\n }, [autoResize, recalculateHeight, textAreaEl]);\n\n useEffect(\n () => () => {\n clearTimeout(focusTimeoutRef.current);\n },\n []\n );\n\n const TextAreaControl = (\n <StyledFormControl\n data-testid={testIds.control}\n ref={textAreaRef}\n id={id}\n aria-describedby={\n // Remove when focused to prevent each change in character count from being announced.\n !focused && displayCharCount && typeof maxLength === 'number'\n ? `${id}-charCount`\n : undefined\n }\n required={required}\n disabled={disabled}\n status={status}\n readOnly={readOnly}\n autoResize={autoResize}\n resizable={autoResize ? false : resizable}\n maxLength={hardStop ? maxLength : undefined}\n hasSuggestion={status === 'pending' && !!onResolveSuggestion}\n {...controlProp}\n {...restProps}\n onChange={onChange}\n onFocus={(e: FocusEvent<HTMLTextAreaElement>) => {\n // Need to delay so screen readers will include the character count in announcement on initial focus.\n // Shorter delays did not seem to work.\n focusTimeoutRef.current = window.setTimeout(() => {\n setFocused(true);\n }, 250);\n\n restProps.onFocus?.(e);\n }}\n onBlur={(e: FocusEvent<HTMLTextAreaElement>) => {\n clearTimeout(focusTimeoutRef.current);\n setFocused(false);\n restProps.onBlur?.(e);\n }}\n as={StyledTextArea}\n />\n );\n\n return label || displayCharCount ? (\n <FormField\n testId={testIds}\n additionalInfo={additionalInfo}\n label={label}\n labelHidden={labelHidden}\n id={id}\n readOnly={readOnly}\n info={info}\n status={status}\n charLimitDisplay={\n displayCharCount && typeof maxLength === 'number' ? (\n <Text id={`${id}-charCount`} readOnly={readOnly} variant='secondary'>\n {maxLength >= 0 ? t('x_of_y', [charCount || '0', maxLength]) : charCount}{' '}\n <VisuallyHiddenText>{t('characters_typed')}</VisuallyHiddenText>\n </Text>\n ) : undefined\n }\n required={required}\n disabled={disabled}\n onResolveSuggestion={onResolveSuggestion}\n >\n {TextAreaControl}\n </FormField>\n ) : (\n TextAreaControl\n );\n});\n\nexport default withTestIds(TextArea, getTextAreaTestIds);\n"]}
1
+ {"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,SAA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ACD,EAAE,EAAE,cAAc,GAClB,CACH,CAAC;IAEF,OAAO,KAAK,IAAI,gBAAgB,CAAC,CAAC,CAAC,CACjC,KAAC,SAAS,IACR,MAAM,EAAE,OAAO,EACf,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,gBAAgB,EACd,gBAAgB,IAAI,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CAClD,MAAC,IAAI,IAAC,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAC,WAAW,aACjE,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,IAAI,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,GAAG,EAC7E,KAAC,kBAAkB,cAAE,CAAC,CAAC,kBAAkB,CAAC,GAAsB,IAC3D,CACR,CAAC,CAAC,CAAC,SAAS,EAEf,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,mBAAmB,EAAE,mBAAmB,YAEvC,eAAe,GACN,CACb,CAAC,CAAC,CAAC,CACF,eAAe,CAChB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { forwardRef, useCallback, useState, useEffect, useRef } from 'react';\nimport type {\n FC,\n Ref,\n PropsWithoutRef,\n ChangeEvent,\n ChangeEventHandler,\n FocusEvent,\n FocusEventHandler\n} from 'react';\n\nimport type { BaseProps, ForwardProps, NoChildrenProp, TestIdProp } from '../../types';\nimport FormField from '../FormField';\nimport { StyledFormControl } from '../FormControl';\nimport type { FormControlProps } from '../FormControl';\nimport { hasProp, withTestIds } from '../../utils';\nimport {\n useConsolidatedRef,\n useElement,\n useI18n,\n useLiveLog,\n useTestIds,\n useUID\n} from '../../hooks';\nimport Text from '../Text';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\n\nimport StyledTextArea from './TextArea.styles';\nimport { getTextAreaTestIds } from './TextArea.test-ids';\n\nexport interface TextAreaProps extends FormControlProps, BaseProps, NoChildrenProp, TestIdProp {\n /** Minimum length of characters that can be input. */\n minLength?: number;\n /** Maximum length of characters that can be input. */\n maxLength?: number;\n /**\n * Allows the user to resize the Text Area. This prop is ignored if autoResize is true.\n * @default false\n */\n resizable?: boolean;\n /**\n * Enables the Text Area to resize itself automatically.\n * @default true\n */\n autoResize?: boolean;\n /**\n * Display a live character count in relation to the maxLength.\n * @default false\n */\n displayCharCount?: boolean;\n /**\n * Allow or disallow a value beyond the maxLength.\n * @default true\n */\n hardStop?: boolean;\n\n onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n onFocus?: FocusEventHandler<HTMLTextAreaElement>;\n onBlur?: FocusEventHandler<HTMLTextAreaElement>;\n}\n\nconst warnCharCount = 30;\n\nconst TextArea: FC<TextAreaProps & ForwardProps> = forwardRef(function TextArea(\n props: PropsWithoutRef<TextAreaProps>,\n ref: Ref<HTMLTextAreaElement>\n) {\n const uid = useUID();\n const {\n testId,\n additionalInfo,\n id = uid,\n value,\n defaultValue,\n required = false,\n disabled = false,\n readOnly = false,\n label,\n labelHidden,\n info,\n status,\n resizable = false,\n autoResize = true,\n maxLength,\n displayCharCount = false,\n hardStop = true,\n onChange: onChangeProp,\n onResolveSuggestion,\n ...restProps\n } = props;\n const t = useI18n();\n\n const testIds = useTestIds(testId, getTextAreaTestIds);\n const [charCount, setCharCount] = useState(value?.length ?? defaultValue?.length ?? 0);\n const [focused, setFocused] = useState(false);\n const [textAreaEl, setTextAreaEl] = useElement<HTMLTextAreaElement>();\n const textAreaRef = useConsolidatedRef(ref, setTextAreaEl);\n const prevHeightRef = useRef(0);\n const focusTimeoutRef = useRef(NaN);\n const { announceAssertive } = useLiveLog();\n\n const controlProp: {\n value?: string;\n defaultValue?: string;\n } = {};\n\n // Conditionally render component as controlled/uncontrolled\n if (hasProp(props, 'value')) {\n controlProp.value = value ?? '';\n } else if (hasProp(props, 'defaultValue')) {\n controlProp.defaultValue = defaultValue ?? '';\n }\n\n const onChange = useCallback(\n (e: ChangeEvent<HTMLTextAreaElement>) => {\n if (maxLength !== undefined) {\n if (e.target.value.length >= maxLength) {\n announceAssertive({ message: t('text_area_character_limit'), type: 'warning' });\n } else if (maxLength > warnCharCount) {\n const prevCharsRemaining = maxLength - charCount;\n const charsRemaining = maxLength - e.target.value.length;\n\n if (charsRemaining < warnCharCount && prevCharsRemaining >= warnCharCount) {\n announceAssertive({\n message: t('text_area_characters_remaining', [`${warnCharCount}`]),\n type: 'warning'\n });\n }\n }\n }\n\n if (!hardStop || maxLength === undefined || e.target.value.length <= maxLength) {\n onChangeProp?.(e);\n setCharCount(e.target.value.length);\n }\n },\n [onChangeProp, charCount, hardStop, maxLength, announceAssertive, t]\n );\n\n const recalculateHeight = useCallback(() => {\n if (!textAreaRef.current) return;\n\n const scrollY = window.scrollY;\n\n textAreaRef.current.style.setProperty('--textarea-height', 'auto');\n\n // Remove scrollbar width to avoid interference with calculation.\n textAreaRef.current.style.setProperty('scrollbar-width', 'none');\n\n const scrollHeight = textAreaRef.current.scrollHeight;\n const borderWidth = textAreaRef.current.offsetHeight - textAreaRef.current.clientHeight;\n // Set height to auto then scrollHeight + borderWidth to resize TextArea to content\n textAreaRef.current.style.setProperty('--textarea-height', `${scrollHeight + borderWidth}px`);\n\n textAreaRef.current.style.removeProperty('scrollbar-width');\n\n // height:auto can trigger browser caret scroll-into-view; undo if it moved.\n if (window.scrollY !== scrollY) {\n window.scrollTo(window.scrollX, scrollY);\n }\n }, []);\n\n useEffect(() => {\n if (!textAreaRef.current) return;\n\n if (autoResize) {\n recalculateHeight();\n } else {\n textAreaRef.current.style.removeProperty('--textarea-height');\n }\n }, [value, autoResize, recalculateHeight]);\n\n // Recalculate height when the element becomes visible after being displayed none.\n useEffect(() => {\n if (!textAreaEl || !autoResize) return;\n\n prevHeightRef.current = textAreaEl.offsetHeight;\n\n const observer = new ResizeObserver(entries => {\n const currentHeight = entries[0].contentRect.height;\n if (prevHeightRef.current === 0 && currentHeight > 0) {\n recalculateHeight();\n }\n prevHeightRef.current = currentHeight;\n });\n\n observer.observe(textAreaEl);\n return () => observer.disconnect();\n }, [autoResize, recalculateHeight, textAreaEl]);\n\n useEffect(\n () => () => {\n clearTimeout(focusTimeoutRef.current);\n },\n []\n );\n\n const TextAreaControl = (\n <StyledFormControl\n data-testid={testIds.control}\n ref={textAreaRef}\n id={id}\n aria-describedby={\n // Remove when focused to prevent each change in character count from being announced.\n !focused && displayCharCount && typeof maxLength === 'number'\n ? `${id}-charCount`\n : undefined\n }\n required={required}\n disabled={disabled}\n status={status}\n readOnly={readOnly}\n autoResize={autoResize}\n resizable={autoResize ? false : resizable}\n maxLength={hardStop ? maxLength : undefined}\n hasSuggestion={status === 'pending' && !!onResolveSuggestion}\n {...controlProp}\n {...restProps}\n onChange={onChange}\n onFocus={(e: FocusEvent<HTMLTextAreaElement>) => {\n // Need to delay so screen readers will include the character count in announcement on initial focus.\n // Shorter delays did not seem to work.\n focusTimeoutRef.current = window.setTimeout(() => {\n setFocused(true);\n }, 250);\n\n restProps.onFocus?.(e);\n }}\n onBlur={(e: FocusEvent<HTMLTextAreaElement>) => {\n clearTimeout(focusTimeoutRef.current);\n setFocused(false);\n restProps.onBlur?.(e);\n }}\n as={StyledTextArea}\n />\n );\n\n return label || displayCharCount ? (\n <FormField\n testId={testIds}\n additionalInfo={additionalInfo}\n label={label}\n labelHidden={labelHidden}\n id={id}\n readOnly={readOnly}\n info={info}\n status={status}\n charLimitDisplay={\n displayCharCount && typeof maxLength === 'number' ? (\n <Text id={`${id}-charCount`} readOnly={readOnly} variant='secondary'>\n {maxLength >= 0 ? t('x_of_y', [charCount || '0', maxLength]) : charCount}{' '}\n <VisuallyHiddenText>{t('characters_typed')}</VisuallyHiddenText>\n </Text>\n ) : undefined\n }\n required={required}\n disabled={disabled}\n onResolveSuggestion={onResolveSuggestion}\n >\n {TextAreaControl}\n </FormField>\n ) : (\n TextAreaControl\n );\n});\n\nexport default withTestIds(TextArea, getTextAreaTestIds);\n"]}
@@ -1,4 +1,3 @@
1
- export declare const textAreaMaxHeight = "90vh";
2
1
  declare const StyledTextArea: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, {
3
2
  resizable: boolean;
4
3
  autoResize: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.styles.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,SAAS,CAAC;AAExC,QAAA,MAAM,cAAc;eAAgC,OAAO;gBAAc,OAAO;YAuB/E,CAAC;AAIF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"TextArea.styles.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.styles.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,cAAc;eAAgC,OAAO;gBAAc,OAAO;YAuB/E,CAAC;AAIF,eAAe,cAAc,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { defaultThemeProp } from '../../theme';
3
- export const textAreaMaxHeight = '90vh';
4
3
  const StyledTextArea = styled.textarea(({ resizable, autoResize }) => {
5
4
  return css `
6
5
  width: 100%;
@@ -19,7 +18,7 @@ const StyledTextArea = styled.textarea(({ resizable, autoResize }) => {
19
18
  : css `
20
19
  resize: none;
21
20
  overflow: auto;
22
- max-height: ${textAreaMaxHeight};
21
+ max-height: 90vh;
23
22
  `}
24
23
  `;
25
24
  });
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.styles.js","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAExC,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CACpC,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE;IAC5B,OAAO,GAAG,CAAA;;oBAEM,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC;iBAC7D,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,OAAO;;QAE7D,UAAU;QACZ,GAAG,CAAA;;OAEF;QACC,SAAS;QACT,CAAC,CAAC,GAAG,CAAA;;;WAGF;QACH,CAAC,CAAC,GAAG,CAAA;;;0BAGa,iBAAiB;WAChC;KACN,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE/C,eAAe,cAAc,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\n\nexport const textAreaMaxHeight = '90vh';\n\nconst StyledTextArea = styled.textarea<{ resizable: boolean; autoResize: boolean }>(\n ({ resizable, autoResize }) => {\n return css`\n width: 100%;\n min-height: ${props => props.theme.components['text-area']['min-height']};\n padding: ${props => props.theme.components['text-area'].padding};\n appearance: none;\n ${autoResize &&\n css`\n height: var(--textarea-height, auto);\n `}\n ${resizable\n ? css`\n resize: vertical;\n overflow: hidden;\n `\n : css`\n resize: none;\n overflow: auto;\n max-height: ${textAreaMaxHeight};\n `}\n `;\n }\n);\n\nStyledTextArea.defaultProps = defaultThemeProp;\n\nexport default StyledTextArea;\n"]}
1
+ {"version":3,"file":"TextArea.styles.js","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CACpC,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE;IAC5B,OAAO,GAAG,CAAA;;oBAEM,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC;iBAC7D,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,OAAO;;QAE7D,UAAU;QACZ,GAAG,CAAA;;OAEF;QACC,SAAS;QACT,CAAC,CAAC,GAAG,CAAA;;;WAGF;QACH,CAAC,CAAC,GAAG,CAAA;;;;WAIF;KACN,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE/C,eAAe,cAAc,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\n\nconst StyledTextArea = styled.textarea<{ resizable: boolean; autoResize: boolean }>(\n ({ resizable, autoResize }) => {\n return css`\n width: 100%;\n min-height: ${props => props.theme.components['text-area']['min-height']};\n padding: ${props => props.theme.components['text-area'].padding};\n appearance: none;\n ${autoResize &&\n css`\n height: var(--textarea-height, auto);\n `}\n ${resizable\n ? css`\n resize: vertical;\n overflow: hidden;\n `\n : css`\n resize: none;\n overflow: auto;\n max-height: 90vh;\n `}\n `;\n }\n);\n\nStyledTextArea.defaultProps = defaultThemeProp;\n\nexport default StyledTextArea;\n"]}
@@ -737,6 +737,7 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
737
737
  rte_add_image: string;
738
738
  rte_add_link: string;
739
739
  rte_action_url: string;
740
+ agent_image: string;
740
741
  rte_underline: string;
741
742
  rte_subscript: string;
742
743
  rte_superscript: string;
@@ -1 +1 @@
1
- {"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -733,6 +733,7 @@ declare const _default: {
733
733
  rte_add_image: string;
734
734
  rte_add_link: string;
735
735
  rte_action_url: string;
736
+ agent_image: string;
736
737
  rte_underline: string;
737
738
  rte_subscript: string;
738
739
  rte_superscript: string;
@@ -1 +1 @@
1
- {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/i18n/default.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkPxB,6CAA6C;;;;;;;;;;;;;;IAgB7C,6CAA6C;;;;;;;;IAS7C,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwGzC,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2C/B,wCAAwC;;IAGxC,oCAAoC;;;;;;;;IASpC,oCAAoC;;;;;;IAOpC,uCAAuC;;;;;;;;;;;IAavC,6CAA6C;;;;;;;IAQ7C,uCAAuC;;;;;;;;IAUvC,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA/sE3C,wBA+vEE"}
@@ -806,6 +806,7 @@ export default {
806
806
  rte_add_image: 'Add image',
807
807
  rte_add_link: 'Add link',
808
808
  rte_action_url: 'Action URL',
809
+ agent_image: 'Image {0}',
809
810
  rte_underline: 'Underline',
810
811
  rte_subscript: 'Subscript',
811
812
  rte_superscript: 'Superscript',