@pega/cosmos-react-core 4.0.0-dev.14.2 → 4.0.0-dev.15.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/AppShell.d.ts.map +1 -1
  2. package/lib/components/AppShell/AppShell.js +42 -3
  3. package/lib/components/AppShell/AppShell.js.map +1 -1
  4. package/lib/components/AppShell/utils.d.ts +2 -0
  5. package/lib/components/AppShell/utils.d.ts.map +1 -0
  6. package/lib/components/AppShell/utils.js +15 -0
  7. package/lib/components/AppShell/utils.js.map +1 -0
  8. package/lib/components/Badges/Keyboard.d.ts.map +1 -1
  9. package/lib/components/Badges/Keyboard.js +10 -5
  10. package/lib/components/Badges/Keyboard.js.map +1 -1
  11. package/lib/components/ComboBox/ComboBox.styles.d.ts.map +1 -1
  12. package/lib/components/ComboBox/ComboBox.styles.js +10 -0
  13. package/lib/components/ComboBox/ComboBox.styles.js.map +1 -1
  14. package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
  15. package/lib/components/ListToolbar/ListToolbar.js +10 -40
  16. package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
  17. package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
  18. package/lib/components/ListToolbar/ListToolbar.styles.js +2 -5
  19. package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
  20. package/lib/components/Menu/NavItemsList.d.ts.map +1 -1
  21. package/lib/components/Menu/NavItemsList.js +0 -2
  22. package/lib/components/Menu/NavItemsList.js.map +1 -1
  23. package/lib/components/Modal/MinimizedModal.d.ts.map +1 -1
  24. package/lib/components/Modal/MinimizedModal.js +1 -1
  25. package/lib/components/Modal/MinimizedModal.js.map +1 -1
  26. package/lib/components/Modal/Modal.d.ts.map +1 -1
  27. package/lib/components/Modal/Modal.js +3 -2
  28. package/lib/components/Modal/Modal.js.map +1 -1
  29. package/lib/components/Modal/ModalManager.d.ts.map +1 -1
  30. package/lib/components/Modal/ModalManager.js +3 -2
  31. package/lib/components/Modal/ModalManager.js.map +1 -1
  32. package/lib/components/SearchInput/SearchInput.js +2 -2
  33. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  34. package/lib/components/ShortcutManager/Context.d.ts +8 -0
  35. package/lib/components/ShortcutManager/Context.d.ts.map +1 -0
  36. package/lib/components/ShortcutManager/Context.js +6 -0
  37. package/lib/components/ShortcutManager/Context.js.map +1 -0
  38. package/lib/components/ShortcutManager/ShortcutManager.d.ts +17 -0
  39. package/lib/components/ShortcutManager/ShortcutManager.d.ts.map +1 -0
  40. package/lib/components/ShortcutManager/ShortcutManager.js +88 -0
  41. package/lib/components/ShortcutManager/ShortcutManager.js.map +1 -0
  42. package/lib/components/ShortcutManager/ShortcutManager.types.d.ts +30 -0
  43. package/lib/components/ShortcutManager/ShortcutManager.types.d.ts.map +1 -0
  44. package/lib/components/ShortcutManager/ShortcutManager.types.js +2 -0
  45. package/lib/components/ShortcutManager/ShortcutManager.types.js.map +1 -0
  46. package/lib/components/ShortcutManager/index.d.ts +4 -0
  47. package/lib/components/ShortcutManager/index.d.ts.map +1 -0
  48. package/lib/components/ShortcutManager/index.js +3 -0
  49. package/lib/components/ShortcutManager/index.js.map +1 -0
  50. package/lib/components/SkipLinks/SkipLinks.d.ts.map +1 -1
  51. package/lib/components/SkipLinks/SkipLinks.js +53 -13
  52. package/lib/components/SkipLinks/SkipLinks.js.map +1 -1
  53. package/lib/components/TextArea/TextArea.d.ts +1 -1
  54. package/lib/components/TextArea/TextArea.js +2 -2
  55. package/lib/components/TextArea/TextArea.js.map +1 -1
  56. package/lib/hooks/index.d.ts +2 -0
  57. package/lib/hooks/index.d.ts.map +1 -1
  58. package/lib/hooks/index.js +2 -0
  59. package/lib/hooks/index.js.map +1 -1
  60. package/lib/hooks/useAutoResize.d.ts.map +1 -1
  61. package/lib/hooks/useAutoResize.js +10 -4
  62. package/lib/hooks/useAutoResize.js.map +1 -1
  63. package/lib/hooks/useI18n.d.ts +32 -5
  64. package/lib/hooks/useI18n.d.ts.map +1 -1
  65. package/lib/hooks/useShortcut.d.ts +12 -0
  66. package/lib/hooks/useShortcut.d.ts.map +1 -0
  67. package/lib/hooks/useShortcut.js +23 -0
  68. package/lib/hooks/useShortcut.js.map +1 -0
  69. package/lib/hooks/useShortcutManager.d.ts +4 -0
  70. package/lib/hooks/useShortcutManager.d.ts.map +1 -0
  71. package/lib/hooks/useShortcutManager.js +12 -0
  72. package/lib/hooks/useShortcutManager.js.map +1 -0
  73. package/lib/i18n/default.d.ts +32 -5
  74. package/lib/i18n/default.d.ts.map +1 -1
  75. package/lib/i18n/default.js +40 -11
  76. package/lib/i18n/default.js.map +1 -1
  77. package/lib/i18n/i18n.d.ts +32 -5
  78. package/lib/i18n/i18n.d.ts.map +1 -1
  79. package/lib/index.d.ts +1 -0
  80. package/lib/index.d.ts.map +1 -1
  81. package/lib/index.js +1 -0
  82. package/lib/index.js.map +1 -1
  83. package/lib/register-contexts.js +2 -0
  84. package/lib/register-contexts.js.map +1 -1
  85. package/lib/theme/theme.d.ts +4 -4
  86. package/lib/theme/themeDefinition.json +4 -4
  87. package/lib/utils/focusHeadingOrContainer.d.ts +1 -1
  88. package/lib/utils/focusHeadingOrContainer.d.ts.map +1 -1
  89. package/lib/utils/focusHeadingOrContainer.js +2 -1
  90. package/lib/utils/focusHeadingOrContainer.js.map +1 -1
  91. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput.js","sourceRoot":"","sources":["../../../src/components/SearchInput/SearchInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,UAAU,EACV,QAAQ,EAER,WAAW,EAEX,SAAS,EACT,MAAM,EACP,MAAM,OAAO,CAAC;AAGf,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AAExD,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,OAAO,EACP,aAAa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,\n KeyboardEvent,\n useEffect,\n useRef\n} from 'react';\n\nimport { ForwardProps, NoChildrenProp, OmitStrict } from '../../types';\nimport Icon, { registerIcon } from '../Icon';\nimport * as searchIcon from '../Icon/icons/search.icon';\nimport { FormControlProps } from '../FormControl';\nimport {\n useConsolidatedRef,\n useEscape,\n useI18n,\n useOuterEvent,\n useLiveLog,\n useUID\n} from '../../hooks';\nimport Flex from '../Flex';\nimport Popover from '../Popover';\nimport { sameWidth } from '../Popover/modifiers';\nimport Menu, { MenuItemProps } from '../Menu';\nimport Link, { LinkProps } from '../Link';\nimport Text from '../Text';\nimport { createStringMatcher } from '../../utils';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\n\nimport {\n StyledCancelButton,\n StyledResultsPopover,\n StyledSearchButton,\n StyledSearchFilterText,\n StyledSearchInput,\n StyledSearchMenu,\n StyledSearchResultsContainer,\n StyledSearchTextInput,\n StyledMenuButton\n} from './SearchInput.styles';\n\nregisterIcon(searchIcon);\n\nexport type SearchResult = Pick<MenuItemProps, 'id' | 'primary' | 'secondary' | 'href' | 'onClick'>;\n\nexport type RecentSearch = Pick<MenuItemProps, 'id' | 'primary' | 'href' | 'onClick'>;\n\nexport interface SearchInputProps extends NoChildrenProp {\n /**\n * Placeholder text. The default value is a locale translation of 'Search…'\n * @default 'Search…'\n */\n placeholder?: FormControlProps['placeholder'];\n /**\n * Creates a controlled input and sets the value. Requires an onChange handler to update value.\n * value + onChange is the recommended method per React team.\n */\n value?: FormControlProps['value'];\n /** Called when the SearchInput value changes. */\n onSearchChange?: (value: string) => void;\n /**\n * Called when the SearchButton is clicked or when the Enter key is pressed while SearchInput is in focus.\n * NOTE: this does not trigger an actual form submit event. It simply represents an explicit action by the user to search as opposed to onSearchChange.\n */\n onSearchSubmit?: (value: string) => void;\n /** A list of user selectable scopes to filter search with. */\n filters?: string[];\n /** The selected scope filter on initial render. */\n defaultFilter?: string;\n /** Called when user changes scope filter. */\n onFilterChange?: (value: string) => void;\n /** A list of matching results presented in the input's dropdown menu. */\n searchResults?: SearchResult[];\n /** A list of recent searches presented in the input's dropdown menu. */\n recentSearches?: RecentSearch[];\n /** Places the menu into an indeterminate loading state. */\n loading?: boolean;\n /** Prop passed to the advanced search page link. */\n advancedSearchLink?: OmitStrict<LinkProps, 'children'>;\n /** Aria label for search input, used by screen readers. */\n searchInputAriaLabel?: string;\n /**\n * Boolean for determining for whether the search results will render in a popover.\n * @default true\n */\n resultsPopover?: boolean;\n}\n\nconst SearchInput: FunctionComponent<SearchInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<SearchInputProps>, ref: Ref<HTMLInputElement>) => {\n const t = useI18n();\n\n const {\n value = '',\n defaultFilter,\n filters,\n onFilterChange,\n searchResults,\n recentSearches,\n loading: loadingProp,\n advancedSearchLink,\n placeholder = t('search_placeholder_default'),\n onSearchChange,\n onSearchSubmit,\n searchInputAriaLabel,\n resultsPopover = true,\n ...restProps\n } = props;\n const instructionTextId = useUID();\n const { announcePolite } = useLiveLog();\n const inputRef = useConsolidatedRef(ref);\n const filterButtonRef = useRef<HTMLButtonElement>(null);\n const filtersRef = useRef<HTMLDivElement>(null);\n const searchResultsRef = useRef<HTMLDivElement>(null);\n\n const [searchMenuOpen, setSearchMenuOpen] = useState(false);\n const [filterMenuOpen, setFilterMenuOpen] = useState(false);\n const [searchResultItems, setSearchResultItems] = useState<MenuItemProps[] | undefined>(\n undefined\n );\n const [selectedFilter, setSelectedFilter] = useState(defaultFilter ?? '');\n const [downPressed, setDownPressed] = useState(false);\n\n const completeFilters = [t('all'), ...(filters ?? [])];\n const hasFilters = completeFilters.length > 1;\n const hasSearchResults = !!(searchResults && searchResults.length);\n const hasRecentSearches = !!(recentSearches && recentSearches.length);\n const showSearchMenu = (value || recentSearches?.length) && (searchResultItems || loadingProp);\n const useRecents = hasRecentSearches && !value;\n const loading = useRecents ? false : !!loadingProp;\n const [selectedFilterValue, setSelectedFilterValue] = useState('All');\n const searchMenuVisible =\n (resultsPopover && showSearchMenu && searchMenuOpen) || (!resultsPopover && showSearchMenu);\n\n useEscape(e => {\n e.preventDefault();\n if (searchMenuOpen) {\n setSearchMenuOpen(false);\n }\n if (filterMenuOpen) {\n setFilterMenuOpen(false);\n }\n });\n\n const onKeyDown = useCallback(\n (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter') {\n onSearchSubmit?.(value);\n }\n if (e.key === 'ArrowDown') {\n setDownPressed(true);\n }\n },\n [onSearchSubmit, value]\n );\n\n useOuterEvent('click', [filterButtonRef], () => {\n setFilterMenuOpen(false);\n });\n\n useOuterEvent('click', [searchResultsRef, inputRef, filtersRef], () => {\n setSearchMenuOpen(false);\n });\n\n useEffect(() => {\n setDownPressed(false);\n }, [value]);\n\n useEffect(() => {\n let items: MenuItemProps[] | undefined = [];\n if (hasSearchResults && value) {\n items = searchResults;\n } else if (useRecents) {\n items = recentSearches;\n } else if (!searchResults && (!recentSearches || recentSearches.length === 0)) {\n items = undefined;\n }\n setSearchResultItems(items);\n }, [searchResults, recentSearches, searchMenuOpen, hasSearchResults, hasRecentSearches, value]);\n\n // Announce results\n useEffect(() => {\n if (!searchMenuVisible || loading) return;\n\n const timeout = setTimeout(() => {\n announcePolite({\n message: t(\n useRecents ? 'recent_results_count' : 'results_count',\n [searchResultItems?.length ?? 0],\n {\n count: searchResultItems?.length ?? 0\n }\n ),\n type: 'status'\n });\n }, 1000);\n\n return () => {\n clearTimeout(timeout);\n };\n }, [loading, searchMenuVisible, searchResultItems]);\n\n const searchMenu = (\n <Menu\n as={StyledSearchMenu}\n header={\n recentSearches && !value ? (\n <Text variant='secondary'>{t('recent_searches')}</Text>\n ) : undefined\n }\n mode='action'\n items={searchResultItems ?? []}\n loading={loading}\n footer={\n advancedSearchLink ? (\n <Link {...advancedSearchLink}>{t('advanced_search')}</Link>\n ) : undefined\n }\n accent={hasSearchResults ? createStringMatcher(value, undefined, 'gi') : undefined}\n focusControlEl={(downPressed && inputRef.current) || undefined}\n aria-label={searchInputAriaLabel || t('search')}\n />\n );\n return (\n <>\n <Flex container as={StyledSearchInput} hasFilters={hasFilters}>\n {hasFilters ? (\n <StyledMenuButton\n text={selectedFilterValue}\n variant='text'\n icon='search'\n aria-label={\n selectedFilterValue === 'All'\n ? t('select_search_filter')\n : t('selected_search_filter', [selectedFilterValue])\n }\n menu={{\n mode: 'single-select',\n items: completeFilters.map(filter => ({\n primary: filter,\n id: filter,\n selected: filter === t('all') ? selectedFilter === '' : selectedFilter === filter,\n onClick: () => {\n setSelectedFilterValue(filter);\n setSelectedFilter(filter === t('all') ? '' : filter);\n onFilterChange?.(filter);\n inputRef.current?.focus();\n }\n }))\n }}\n />\n ) : (\n <Flex\n as={StyledSearchButton}\n ref={filterButtonRef}\n forwardedAs={hasFilters ? undefined : 'div'}\n container={{\n justify: 'center',\n alignItems: 'center',\n gap: selectedFilter ? 0.5 : undefined\n }}\n decoupled={hasFilters}\n aria-label={hasFilters ? t('select_search_filter') : undefined}\n >\n <Icon name='search' />\n {selectedFilter && <StyledSearchFilterText>{selectedFilter}</StyledSearchFilterText>}\n {hasFilters && <Icon name='arrow-micro-down' />}\n </Flex>\n )}\n\n <StyledSearchTextInput\n ref={inputRef}\n type='search'\n aria-label={searchInputAriaLabel}\n placeholder={placeholder}\n {...restProps}\n aria-describedby={searchMenuVisible ? instructionTextId : undefined}\n value={value}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n onSearchChange?.(e.target.value);\n if (e.target.value) setSearchMenuOpen(true);\n }}\n onKeyDown={onKeyDown}\n onFocus={() => {\n setSearchMenuOpen(true);\n }}\n decoupled={hasFilters}\n onBlur={() => {\n setDownPressed(false);\n if (!advancedSearchLink) {\n setSearchMenuOpen(false);\n }\n }}\n autoComplete='off'\n />\n {value && (\n <StyledCancelButton\n icon\n onClick={() => {\n onSearchChange?.('');\n inputRef.current?.focus();\n }}\n variant='simple'\n compact\n label={t('clear')}\n >\n <Icon name='times' />\n </StyledCancelButton>\n )}\n </Flex>\n {showSearchMenu && resultsPopover && (\n <Popover\n as={StyledResultsPopover}\n target={inputRef.current}\n show={searchMenuOpen}\n placement='bottom-start'\n modifiers={[sameWidth]}\n onBlur={() => {\n setSearchMenuOpen(false);\n }}\n ref={searchResultsRef}\n >\n {searchMenu}\n </Popover>\n )}\n {!resultsPopover && showSearchMenu && (\n <StyledSearchResultsContainer>{searchMenu}</StyledSearchResultsContainer>\n )}\n {searchMenuVisible && (\n <VisuallyHiddenText id={instructionTextId}>\n {`${t('search_instructions')} `}\n </VisuallyHiddenText>\n )}\n </>\n );\n }\n);\n\nexport default SearchInput;\n"]}
1
+ {"version":3,"file":"SearchInput.js","sourceRoot":"","sources":["../../../src/components/SearchInput/SearchInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,UAAU,EACV,QAAQ,EAER,WAAW,EAEX,SAAS,EACT,MAAM,EACP,MAAM,OAAO,CAAC;AAGf,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AAExD,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,OAAO,EACP,aAAa,EACb,UAAU,EACV,MAAM,EACP,MAAM,aAAa,CAAC;AACrB,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,IAAuB,MAAM,SAAS,CAAC;AAC9C,OAAO,IAAmB,MAAM,SAAS,CAAC;AAC1C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,4BAA4B,EAC5B,qBAAqB,EACrB,gBAAgB,EACjB,MAA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B,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,GACF,CACtB,IACI,EACN,cAAc,IAAI,cAAc,IAAI,CACnC,KAAC,OAAO,IACN,EAAE,EAAE,oBAAoB,EACxB,MAAM,EAAE,QAAQ,CAAC,OAAO,EACxB,IAAI,EAAE,cAAc,EACpB,SAAS,EAAC,cAAc,EACxB,SAAS,EAAE,CAAC,SAAS,CAAC,EACtB,MAAM,EAAE,GAAG,EAAE;oBACX,iBAAiB,CAAC,KAAK,CAAC,CAAC;gBAC3B,CAAC,EACD,GAAG,EAAE,gBAAgB,YAEpB,UAAU,GACH,CACX,EACA,CAAC,cAAc,IAAI,cAAc,IAAI,CACpC,KAAC,4BAA4B,cAAE,UAAU,GAAgC,CAC1E,EACA,iBAAiB,IAAI,CACpB,KAAC,kBAAkB,IAAC,EAAE,EAAE,iBAAiB,YACtC,GAAG,CAAC,CAAC,qBAAqB,CAAC,GAAG,GACZ,CACtB,IACA,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import {\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n forwardRef,\n useState,\n ChangeEvent,\n useCallback,\n KeyboardEvent,\n useEffect,\n useRef\n} from 'react';\n\nimport { ForwardProps, NoChildrenProp, OmitStrict } from '../../types';\nimport Icon, { registerIcon } from '../Icon';\nimport * as searchIcon from '../Icon/icons/search.icon';\nimport { FormControlProps } from '../FormControl';\nimport {\n useConsolidatedRef,\n useEscape,\n useI18n,\n useOuterEvent,\n useLiveLog,\n useUID\n} from '../../hooks';\nimport Flex from '../Flex';\nimport Popover from '../Popover';\nimport { sameWidth } from '../Popover/modifiers';\nimport Menu, { MenuItemProps } from '../Menu';\nimport Link, { LinkProps } from '../Link';\nimport Text from '../Text';\nimport { createStringMatcher } from '../../utils';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\n\nimport {\n StyledCancelButton,\n StyledResultsPopover,\n StyledSearchButton,\n StyledSearchFilterText,\n StyledSearchInput,\n StyledSearchMenu,\n StyledSearchResultsContainer,\n StyledSearchTextInput,\n StyledMenuButton\n} from './SearchInput.styles';\n\nregisterIcon(searchIcon);\n\nexport type SearchResult = Pick<MenuItemProps, 'id' | 'primary' | 'secondary' | 'href' | 'onClick'>;\n\nexport type RecentSearch = Pick<MenuItemProps, 'id' | 'primary' | 'href' | 'onClick'>;\n\nexport interface SearchInputProps extends NoChildrenProp {\n /**\n * Placeholder text. The default value is a locale translation of 'Search…'\n * @default 'Search…'\n */\n placeholder?: FormControlProps['placeholder'];\n /**\n * Creates a controlled input and sets the value. Requires an onChange handler to update value.\n * value + onChange is the recommended method per React team.\n */\n value?: FormControlProps['value'];\n /** Called when the SearchInput value changes. */\n onSearchChange?: (value: string) => void;\n /**\n * Called when the SearchButton is clicked or when the Enter key is pressed while SearchInput is in focus.\n * NOTE: this does not trigger an actual form submit event. It simply represents an explicit action by the user to search as opposed to onSearchChange.\n */\n onSearchSubmit?: (value: string) => void;\n /** A list of user selectable scopes to filter search with. */\n filters?: string[];\n /** The selected scope filter on initial render. */\n defaultFilter?: string;\n /** Called when user changes scope filter. */\n onFilterChange?: (value: string) => void;\n /** A list of matching results presented in the input's dropdown menu. */\n searchResults?: SearchResult[];\n /** A list of recent searches presented in the input's dropdown menu. */\n recentSearches?: RecentSearch[];\n /** Places the menu into an indeterminate loading state. */\n loading?: boolean;\n /** Prop passed to the advanced search page link. */\n advancedSearchLink?: OmitStrict<LinkProps, 'children'>;\n /** Aria label for search input, used by screen readers. */\n searchInputAriaLabel?: string;\n /**\n * Boolean for determining for whether the search results will render in a popover.\n * @default true\n */\n resultsPopover?: boolean;\n}\n\nconst SearchInput: FunctionComponent<SearchInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<SearchInputProps>, ref: Ref<HTMLInputElement>) => {\n const t = useI18n();\n\n const {\n value = '',\n defaultFilter,\n filters,\n onFilterChange,\n searchResults,\n recentSearches,\n loading: loadingProp,\n advancedSearchLink,\n placeholder = t('search_placeholder_default'),\n onSearchChange,\n onSearchSubmit,\n searchInputAriaLabel,\n resultsPopover = true,\n ...restProps\n } = props;\n const instructionTextId = useUID();\n const { announcePolite } = useLiveLog();\n const inputRef = useConsolidatedRef(ref);\n const filterButtonRef = useRef<HTMLButtonElement>(null);\n const filtersRef = useRef<HTMLDivElement>(null);\n const searchResultsRef = useRef<HTMLDivElement>(null);\n\n const [searchMenuOpen, setSearchMenuOpen] = useState(false);\n const [filterMenuOpen, setFilterMenuOpen] = useState(false);\n const [searchResultItems, setSearchResultItems] = useState<MenuItemProps[] | undefined>(\n undefined\n );\n const [selectedFilter, setSelectedFilter] = useState(defaultFilter ?? '');\n const [downPressed, setDownPressed] = useState(false);\n\n const completeFilters = [t('all'), ...(filters ?? [])];\n const hasFilters = completeFilters.length > 1;\n const hasSearchResults = !!(searchResults && searchResults.length);\n const hasRecentSearches = !!(recentSearches && recentSearches.length);\n const showSearchMenu = (value || recentSearches?.length) && (searchResultItems || loadingProp);\n const useRecents = hasRecentSearches && !value;\n const loading = useRecents ? false : !!loadingProp;\n const [selectedFilterValue, setSelectedFilterValue] = useState('All');\n const searchMenuVisible =\n (resultsPopover && showSearchMenu && searchMenuOpen) || (!resultsPopover && showSearchMenu);\n\n useEscape(e => {\n e.preventDefault();\n if (searchMenuOpen) {\n setSearchMenuOpen(false);\n }\n if (filterMenuOpen) {\n setFilterMenuOpen(false);\n }\n });\n\n const onKeyDown = useCallback(\n (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter' && !downPressed) {\n onSearchSubmit?.(value);\n }\n if (e.key === 'ArrowDown') {\n setDownPressed(true);\n }\n },\n [onSearchSubmit, downPressed, value]\n );\n\n useOuterEvent('click', [filterButtonRef], () => {\n setFilterMenuOpen(false);\n });\n\n useOuterEvent('click', [searchResultsRef, inputRef, filtersRef], () => {\n setSearchMenuOpen(false);\n });\n\n useEffect(() => {\n setDownPressed(false);\n }, [value]);\n\n useEffect(() => {\n let items: MenuItemProps[] | undefined = [];\n if (hasSearchResults && value) {\n items = searchResults;\n } else if (useRecents) {\n items = recentSearches;\n } else if (!searchResults && (!recentSearches || recentSearches.length === 0)) {\n items = undefined;\n }\n setSearchResultItems(items);\n }, [searchResults, recentSearches, searchMenuOpen, hasSearchResults, hasRecentSearches, value]);\n\n // Announce results\n useEffect(() => {\n if (!searchMenuVisible || loading) return;\n\n const timeout = setTimeout(() => {\n announcePolite({\n message: t(\n useRecents ? 'recent_results_count' : 'results_count',\n [searchResultItems?.length ?? 0],\n {\n count: searchResultItems?.length ?? 0\n }\n ),\n type: 'status'\n });\n }, 1000);\n\n return () => {\n clearTimeout(timeout);\n };\n }, [loading, searchMenuVisible, searchResultItems]);\n\n const searchMenu = (\n <Menu\n as={StyledSearchMenu}\n header={\n recentSearches && !value ? (\n <Text variant='secondary'>{t('recent_searches')}</Text>\n ) : undefined\n }\n mode='action'\n items={searchResultItems ?? []}\n loading={loading}\n footer={\n advancedSearchLink ? (\n <Link {...advancedSearchLink}>{t('advanced_search')}</Link>\n ) : undefined\n }\n accent={hasSearchResults ? createStringMatcher(value, undefined, 'gi') : undefined}\n focusControlEl={(downPressed && inputRef.current) || undefined}\n aria-label={searchInputAriaLabel || t('search')}\n />\n );\n return (\n <>\n <Flex container as={StyledSearchInput} hasFilters={hasFilters}>\n {hasFilters ? (\n <StyledMenuButton\n text={selectedFilterValue}\n variant='text'\n icon='search'\n aria-label={\n selectedFilterValue === 'All'\n ? t('select_search_filter')\n : t('selected_search_filter', [selectedFilterValue])\n }\n menu={{\n mode: 'single-select',\n items: completeFilters.map(filter => ({\n primary: filter,\n id: filter,\n selected: filter === t('all') ? selectedFilter === '' : selectedFilter === filter,\n onClick: () => {\n setSelectedFilterValue(filter);\n setSelectedFilter(filter === t('all') ? '' : filter);\n onFilterChange?.(filter);\n inputRef.current?.focus();\n }\n }))\n }}\n />\n ) : (\n <Flex\n as={StyledSearchButton}\n ref={filterButtonRef}\n forwardedAs={hasFilters ? undefined : 'div'}\n container={{\n justify: 'center',\n alignItems: 'center',\n gap: selectedFilter ? 0.5 : undefined\n }}\n decoupled={hasFilters}\n aria-label={hasFilters ? t('select_search_filter') : undefined}\n >\n <Icon name='search' />\n {selectedFilter && <StyledSearchFilterText>{selectedFilter}</StyledSearchFilterText>}\n {hasFilters && <Icon name='arrow-micro-down' />}\n </Flex>\n )}\n\n <StyledSearchTextInput\n ref={inputRef}\n type='search'\n aria-label={searchInputAriaLabel}\n placeholder={placeholder}\n {...restProps}\n aria-describedby={searchMenuVisible ? instructionTextId : undefined}\n value={value}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n onSearchChange?.(e.target.value);\n if (e.target.value) setSearchMenuOpen(true);\n }}\n onKeyDown={onKeyDown}\n onFocus={() => {\n setSearchMenuOpen(true);\n }}\n decoupled={hasFilters}\n onBlur={() => {\n setDownPressed(false);\n if (!advancedSearchLink) {\n setSearchMenuOpen(false);\n }\n }}\n autoComplete='off'\n />\n {value && (\n <StyledCancelButton\n icon\n onClick={() => {\n onSearchChange?.('');\n inputRef.current?.focus();\n }}\n variant='simple'\n compact\n label={t('clear')}\n >\n <Icon name='times' />\n </StyledCancelButton>\n )}\n </Flex>\n {showSearchMenu && resultsPopover && (\n <Popover\n as={StyledResultsPopover}\n target={inputRef.current}\n show={searchMenuOpen}\n placement='bottom-start'\n modifiers={[sameWidth]}\n onBlur={() => {\n setSearchMenuOpen(false);\n }}\n ref={searchResultsRef}\n >\n {searchMenu}\n </Popover>\n )}\n {!resultsPopover && showSearchMenu && (\n <StyledSearchResultsContainer>{searchMenu}</StyledSearchResultsContainer>\n )}\n {searchMenuVisible && (\n <VisuallyHiddenText id={instructionTextId}>\n {`${t('search_instructions')} `}\n </VisuallyHiddenText>\n )}\n </>\n );\n }\n);\n\nexport default SearchInput;\n"]}
@@ -0,0 +1,8 @@
1
+ import { KeyBindings } from './ShortcutManager.types';
2
+ export interface ShortcutManagerContextValue {
3
+ bindings: Readonly<KeyBindings>;
4
+ /** @internal */
5
+ initialized: boolean;
6
+ }
7
+ export declare const ShortcutManagerContext: import("react").Context<ShortcutManagerContextValue>;
8
+ //# sourceMappingURL=Context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/components/ShortcutManager/Context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IAChC,gBAAgB;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,sBAAsB,sDAGjC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { createContext } from 'react';
2
+ export const ShortcutManagerContext = createContext({
3
+ bindings: {},
4
+ initialized: false
5
+ });
6
+ //# sourceMappingURL=Context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Context.js","sourceRoot":"","sources":["../../../src/components/ShortcutManager/Context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAUtC,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAA8B;IAC/E,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,KAAK;CACnB,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nimport { KeyBindings } from './ShortcutManager.types';\n\nexport interface ShortcutManagerContextValue {\n bindings: Readonly<KeyBindings>;\n /** @internal */\n initialized: boolean;\n}\n\nexport const ShortcutManagerContext = createContext<ShortcutManagerContextValue>({\n bindings: {},\n initialized: false\n});\n"]}
@@ -0,0 +1,17 @@
1
+ import { FunctionComponent, Context } from 'react';
2
+ import { type ShortcutManagerContextValue } from './Context';
3
+ import type { ShortcutAction, ShortcutManagerProps } from './ShortcutManager.types';
4
+ declare module '../../init' {
5
+ interface CosmosGlobals {
6
+ shortcutManagerContext?: Context<ShortcutManagerContextValue>;
7
+ }
8
+ }
9
+ /**
10
+ * Function to register an action triggerable using a shortcut. All actions must be registered before
11
+ * binding a callback.
12
+ * @param actions actions with definitions to be registered.
13
+ */
14
+ export declare const registerAction: (...actions: ShortcutAction[]) => void;
15
+ declare const ShortcutManager: FunctionComponent<ShortcutManagerProps>;
16
+ export default ShortcutManager;
17
+ //# sourceMappingURL=ShortcutManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShortcutManager.d.ts","sourceRoot":"","sources":["../../../src/components/ShortcutManager/ShortcutManager.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA8B,OAAO,EAAc,MAAM,OAAO,CAAC;AAM3F,OAAO,EAA0B,KAAK,2BAA2B,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,KAAK,EACV,cAAc,EAEd,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,QAAQ,YAAY,CAAC;IAC1B,UAAiB,aAAa;QAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC;KAC/D;CACF;AAID;;;;GAIG;AACH,eAAO,MAAM,cAAc,eAAgB,cAAc,EAAE,KAAG,IAM7D,CAAC;AAUF,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,CAkF5D,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,88 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useMemo, useContext } from 'react';
3
+ import { Shortcuts } from 'shortcuts';
4
+ import { useAfterInitialEffect } from '../../hooks';
5
+ import { windowIsAvailable } from '../../utils';
6
+ import { ShortcutManagerContext } from './Context';
7
+ const actionRegistry = new Map();
8
+ /**
9
+ * Function to register an action triggerable using a shortcut. All actions must be registered before
10
+ * binding a callback.
11
+ * @param actions actions with definitions to be registered.
12
+ */
13
+ export const registerAction = (...actions) => {
14
+ actions.forEach(({ id, defaultKeyBinding: defaultShortcut }) => {
15
+ if (!actionRegistry.has(id)) {
16
+ actionRegistry.set(id, { defaultKeyBinding: defaultShortcut });
17
+ }
18
+ });
19
+ };
20
+ const dispatchShortcutEvent = (actionId, e) => {
21
+ const shortcutEvent = new CustomEvent('shortcut', {
22
+ bubbles: true,
23
+ detail: { actionId }
24
+ });
25
+ e.target?.dispatchEvent(shortcutEvent);
26
+ };
27
+ const ShortcutManager = ({ children, target, bindings: customBindings = {} }) => {
28
+ const shortcutsRef = useRef();
29
+ const bindings = Object.fromEntries(Array.from(actionRegistry.entries()).map(([action, actionDef]) => [
30
+ action,
31
+ customBindings[action] ?? actionDef.defaultKeyBinding
32
+ ]));
33
+ const context = windowIsAvailable
34
+ ? window.cosmos.shortcutManagerContext ?? ShortcutManagerContext
35
+ : ShortcutManagerContext;
36
+ const priorCtxValue = useContext(context);
37
+ useEffect(() => {
38
+ // bail out if ShortcutManager has been initialized
39
+ if (priorCtxValue.initialized)
40
+ return;
41
+ shortcutsRef.current = new Shortcuts({
42
+ target,
43
+ shouldHandleEvent: e =>
44
+ // both 'keydown' and 'keypress' events are handled by default ('shortcuts' bug?)
45
+ e.type === 'keydown' &&
46
+ !e.defaultPrevented &&
47
+ // don't process event during typing letters/digits into inputs without modifier keys
48
+ !(e.target instanceof HTMLElement &&
49
+ ['input', 'textarea'].includes(e.target.nodeName.toLowerCase()) &&
50
+ e.key.match(/a-zA-Z0-9/) &&
51
+ !['Control', 'Meta'].some(modifier => e.getModifierState(modifier))),
52
+ shortcuts: Object.entries(bindings).map(([action, shortcut]) => ({
53
+ shortcut,
54
+ handler: e => {
55
+ e.preventDefault();
56
+ dispatchShortcutEvent(action, e);
57
+ }
58
+ }))
59
+ });
60
+ return () => {
61
+ shortcutsRef.current?.reset();
62
+ shortcutsRef.current = undefined;
63
+ };
64
+ }, [target]);
65
+ useAfterInitialEffect(() => {
66
+ // bail out if ShortcutManager has been initialized
67
+ if (priorCtxValue.initialized)
68
+ return;
69
+ const shortcutInstance = shortcutsRef.current;
70
+ if (shortcutInstance) {
71
+ shortcutInstance.reset();
72
+ shortcutInstance.add(Object.entries(bindings).map(([action, shortcut]) => ({
73
+ shortcut,
74
+ handler: e => dispatchShortcutEvent(action, e)
75
+ })));
76
+ }
77
+ }, [JSON.stringify(bindings)]);
78
+ const ctxValue = useMemo(() => ({
79
+ bindings: Object.freeze(bindings),
80
+ initialized: true
81
+ }), [JSON.stringify(bindings)]);
82
+ if (priorCtxValue.initialized) {
83
+ return _jsx(context.Provider, { value: priorCtxValue, children: children });
84
+ }
85
+ return (_jsx(ShortcutManagerContext.Provider, { value: ctxValue, children: children }));
86
+ };
87
+ export default ShortcutManager;
88
+ //# sourceMappingURL=ShortcutManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShortcutManager.js","sourceRoot":"","sources":["../../../src/components/ShortcutManager/ShortcutManager.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,SAAS,EAAE,MAAM,EAAE,OAAO,EAAW,UAAU,EAAE,MAAM,OAAO,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,sBAAsB,EAAoC,MAAM,WAAW,CAAC;AAarF,MAAM,cAAc,GAAG,IAAI,GAAG,EAAgC,CAAC;AAE/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAG,OAAyB,EAAQ,EAAE;IACnE,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,iBAAiB,EAAE,eAAe,EAAE,EAAE,EAAE;QAC7D,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;YAC3B,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,iBAAiB,EAAE,eAAe,EAAE,CAAC,CAAC;SAChE;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAA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aAC/C,CAAC,CAAC,CACJ,CAAC;SACH;IACH,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE/B,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;QACjC,WAAW,EAAE,IAAI;KAClB,CAAC,EACF,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAC3B,CAAC;IAEF,IAAI,aAAa,CAAC,WAAW,EAAE;QAC7B,OAAO,KAAC,OAAO,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,YAAG,QAAQ,GAAoB,CAAC;KAC9E;IAED,OAAO,CACL,KAAC,sBAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,YAAG,QAAQ,GAAmC,CAC/F,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { FunctionComponent, useEffect, useRef, useMemo, Context, useContext } from 'react';\nimport { Shortcuts } from 'shortcuts';\n\nimport { useAfterInitialEffect } from '../../hooks';\nimport { windowIsAvailable } from '../../utils';\n\nimport { ShortcutManagerContext, type ShortcutManagerContextValue } from './Context';\nimport type {\n ShortcutAction,\n ShortcutActionConfig,\n ShortcutManagerProps\n} from './ShortcutManager.types';\n\ndeclare module '../../init' {\n export interface CosmosGlobals {\n shortcutManagerContext?: Context<ShortcutManagerContextValue>;\n }\n}\n\nconst actionRegistry = new Map<string, ShortcutActionConfig>();\n\n/**\n * Function to register an action triggerable using a shortcut. All actions must be registered before\n * binding a callback.\n * @param actions actions with definitions to be registered.\n */\nexport const registerAction = (...actions: ShortcutAction[]): void => {\n actions.forEach(({ id, defaultKeyBinding: defaultShortcut }) => {\n if (!actionRegistry.has(id)) {\n actionRegistry.set(id, { defaultKeyBinding: defaultShortcut });\n }\n });\n};\n\nconst dispatchShortcutEvent = (actionId: ShortcutAction['id'], e: KeyboardEvent) => {\n const shortcutEvent = new CustomEvent('shortcut', {\n bubbles: true,\n detail: { actionId }\n });\n e.target?.dispatchEvent(shortcutEvent);\n};\n\nconst ShortcutManager: FunctionComponent<ShortcutManagerProps> = ({\n children,\n target,\n bindings: customBindings = {}\n}) => {\n const shortcutsRef = useRef<Shortcuts>();\n\n const bindings = Object.fromEntries(\n Array.from(actionRegistry.entries()).map(([action, actionDef]) => [\n action,\n customBindings[action] ?? actionDef.defaultKeyBinding\n ])\n );\n\n const context = windowIsAvailable\n ? window.cosmos.shortcutManagerContext ?? ShortcutManagerContext\n : ShortcutManagerContext;\n const priorCtxValue = useContext(context);\n\n useEffect(() => {\n // bail out if ShortcutManager has been initialized\n if (priorCtxValue.initialized) return;\n\n shortcutsRef.current = new Shortcuts({\n target,\n shouldHandleEvent: e =>\n // both 'keydown' and 'keypress' events are handled by default ('shortcuts' bug?)\n e.type === 'keydown' &&\n !e.defaultPrevented &&\n // don't process event during typing letters/digits into inputs without modifier keys\n !(\n e.target instanceof HTMLElement &&\n ['input', 'textarea'].includes(e.target.nodeName.toLowerCase()) &&\n e.key.match(/a-zA-Z0-9/) &&\n !['Control', 'Meta'].some(modifier => e.getModifierState(modifier))\n ),\n shortcuts: Object.entries(bindings).map(([action, shortcut]) => ({\n shortcut,\n handler: e => {\n e.preventDefault();\n dispatchShortcutEvent(action, e);\n }\n }))\n });\n\n return () => {\n shortcutsRef.current?.reset();\n shortcutsRef.current = undefined;\n };\n }, [target]);\n\n useAfterInitialEffect(() => {\n // bail out if ShortcutManager has been initialized\n if (priorCtxValue.initialized) return;\n\n const shortcutInstance = shortcutsRef.current;\n if (shortcutInstance) {\n shortcutInstance.reset();\n shortcutInstance.add(\n Object.entries(bindings).map(([action, shortcut]) => ({\n shortcut,\n handler: e => dispatchShortcutEvent(action, e)\n }))\n );\n }\n }, [JSON.stringify(bindings)]);\n\n const ctxValue = useMemo(\n () => ({\n bindings: Object.freeze(bindings),\n initialized: true\n }),\n [JSON.stringify(bindings)]\n );\n\n if (priorCtxValue.initialized) {\n return <context.Provider value={priorCtxValue}>{children}</context.Provider>;\n }\n\n return (\n <ShortcutManagerContext.Provider value={ctxValue}>{children}</ShortcutManagerContext.Provider>\n );\n};\n\nexport default ShortcutManager;\n"]}
@@ -0,0 +1,30 @@
1
+ import { ReactNode } from 'react';
2
+ interface ShortcutEventDetails {
3
+ actionId: string;
4
+ }
5
+ declare global {
6
+ type ShortcutEvent = CustomEvent<ShortcutEventDetails>;
7
+ interface GlobalEventHandlersEventMap {
8
+ shortcut: ShortcutEvent;
9
+ }
10
+ }
11
+ export interface ShortcutActionConfig {
12
+ defaultKeyBinding: string;
13
+ }
14
+ export interface ShortcutAction extends ShortcutActionConfig {
15
+ id: string;
16
+ }
17
+ export type ShortcutActionCallback = (e: ShortcutEvent) => void;
18
+ export interface KeyBindings {
19
+ [key: string]: string;
20
+ }
21
+ export interface ShortcutManagerProps {
22
+ /** The element(s) that may bind callbacks to actions. */
23
+ children: ReactNode;
24
+ /** Pre-populated key bindings for actions. */
25
+ bindings?: KeyBindings;
26
+ /** HTML element that global event handler will be attached to. Document will be used if not passed. */
27
+ target?: HTMLElement;
28
+ }
29
+ export {};
30
+ //# sourceMappingURL=ShortcutManager.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShortcutManager.types.d.ts","sourceRoot":"","sources":["../../../src/components/ShortcutManager/ShortcutManager.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,KAAK,aAAa,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC;IAEvD,UAAU,2BAA2B;QACnC,QAAQ,EAAE,aAAa,CAAC;KACzB;CACF;AAED,MAAM,WAAW,oBAAoB;IACnC,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,cAAe,SAAQ,oBAAoB;IAC1D,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;AAEhE,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,yDAAyD;IACzD,QAAQ,EAAE,SAAS,CAAC;IACpB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,uGAAuG;IACvG,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ShortcutManager.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShortcutManager.types.js","sourceRoot":"","sources":["../../../src/components/ShortcutManager/ShortcutManager.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactNode } from 'react';\n\ninterface ShortcutEventDetails {\n actionId: string;\n}\n\ndeclare global {\n type ShortcutEvent = CustomEvent<ShortcutEventDetails>;\n\n interface GlobalEventHandlersEventMap {\n shortcut: ShortcutEvent;\n }\n}\n\nexport interface ShortcutActionConfig {\n defaultKeyBinding: string;\n}\n\nexport interface ShortcutAction extends ShortcutActionConfig {\n id: string;\n}\n\nexport type ShortcutActionCallback = (e: ShortcutEvent) => void;\n\nexport interface KeyBindings {\n [key: string]: string;\n}\n\nexport interface ShortcutManagerProps {\n /** The element(s) that may bind callbacks to actions. */\n children: ReactNode;\n /** Pre-populated key bindings for actions. */\n bindings?: KeyBindings;\n /** HTML element that global event handler will be attached to. Document will be used if not passed. */\n target?: HTMLElement;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export { default as ShortcutManager, registerAction } from './ShortcutManager';
2
+ export { ShortcutManagerContext } from './Context';
3
+ export type { ShortcutActionCallback, ShortcutAction } from './ShortcutManager.types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ShortcutManager/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,YAAY,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as ShortcutManager, registerAction } from './ShortcutManager';
2
+ export { ShortcutManagerContext } from './Context';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ShortcutManager/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export { default as ShortcutManager, registerAction } from './ShortcutManager';\nexport { ShortcutManagerContext } from './Context';\nexport type { ShortcutActionCallback, ShortcutAction } from './ShortcutManager.types';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SkipLinks.d.ts","sourceRoot":"","sources":["../../../src/components/SkipLinks/SkipLinks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAQ,MAAM,OAAO,CAAC;AAUjC,UAAU,QAAQ;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CACjD;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAED,eAAO,MAAM,eAAe,8TAuB1B,CAAC;AAIH,QAAA,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAoChC,CAAC;AAEH,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"SkipLinks.d.ts","sourceRoot":"","sources":["../../../src/components/SkipLinks/SkipLinks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAQ,MAAM,OAAO,CAAC;AAkBjC,UAAU,QAAQ;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CACjD;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AASD,eAAO,MAAM,eAAe,8TAiB1B,CAAC;AA2BH,QAAA,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAkFhC,CAAC;AAEH,eAAe,SAAS,CAAC"}
@@ -1,33 +1,60 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { hideVisually } from 'polished';
5
+ import { Shortcut } from 'shortcuts';
5
6
  import { defaultThemeProp } from '../../theme';
6
7
  import { focusHeadingOrContainer } from '../../utils';
7
- import Button, { StyledButton } from '../Button';
8
+ import Button from '../Button';
8
9
  import Popover from '../Popover';
9
10
  import Flex from '../Flex';
11
+ import { Keyboard } from '../Badges';
12
+ import Text from '../Text';
13
+ import Grid from '../Grid';
14
+ import { useI18n, useShortcutManager, useUID } from '../../hooks';
15
+ import { registerAction } from '../ShortcutManager';
16
+ import { StyledButtonLink } from '../Button/Button';
17
+ const StyledSkipLinksItems = styled.div `
18
+ & > ${StyledButtonLink} {
19
+ display: block;
20
+ margin-inline-start: 0;
21
+ }
22
+ `;
10
23
  export const StyledSkipLinks = styled(Popover)(props => {
11
- const { theme: { base: { 'z-index': zIndices, spacing } } } = props;
24
+ const { theme: { base: { 'z-index': zIndices } } } = props;
12
25
  const z = Math.max(...Object.values(zIndices)) + 1;
13
26
  return css `
14
27
  position: fixed;
15
28
  z-index: ${z};
16
- padding: ${spacing};
17
29
 
18
- & > ${StyledButton} {
19
- margin: 0;
20
- display: block;
21
- }
22
-
23
- &:not(:focus-within) {
30
+ /* &:not(:focus-within) {
24
31
  ${hideVisually}
25
- }
32
+ } */
26
33
  `;
27
34
  });
28
35
  StyledSkipLinks.defaultProps = defaultThemeProp;
36
+ const StyledShortcuts = styled.div(({ theme }) => {
37
+ return css `
38
+ border-block-start: 0.0625rem solid ${theme.base.palette['border-line']};
39
+
40
+ [role='listitem'] {
41
+ display: contents;
42
+ }
43
+ `;
44
+ });
45
+ StyledShortcuts.defaultProps = defaultThemeProp;
46
+ registerAction({
47
+ id: 'GoToIncomingInteraction',
48
+ defaultKeyBinding: 'Alt+Enter'
49
+ }, {
50
+ id: 'DismissIncomingInteraction',
51
+ defaultKeyBinding: 'Alt+Q'
52
+ });
29
53
  const SkipLinks = memo(({ items }) => {
30
- return (_jsx(Flex, { as: StyledSkipLinks, container: { gap: 0.5, direction: 'column' }, show: true, placement: 'bottom-end', target: {
54
+ const { bindings } = useShortcutManager();
55
+ const t = useI18n();
56
+ const shortcutHeadingId = useUID();
57
+ return (_jsxs(Flex, { as: StyledSkipLinks, container: { direction: 'column' }, show: true, placement: 'bottom-end', target: {
31
58
  getBoundingClientRect: () => ({
32
59
  height: 0,
33
60
  width: 0,
@@ -38,7 +65,20 @@ const SkipLinks = memo(({ items }) => {
38
65
  left: 24,
39
66
  right: 24
40
67
  })
41
- }, children: items.map(item => (_jsx(Button, { variant: 'link', onClick: () => focusHeadingOrContainer(document.querySelector(item.target.selector) ?? document, item.target.ariaLabel), children: item.label }, item.label))) }));
68
+ }, modifiers: [
69
+ {
70
+ name: 'placeAndContain',
71
+ enabled: false
72
+ }
73
+ ], "data-app-region": true, "aria-label": t('skip_navigation_menu_label'), children: [_jsx(Flex, { container: { direction: 'column', gap: 0.5, pad: 1 }, as: StyledSkipLinksItems, children: items.map(item => (_jsx(Button, { variant: 'link', onClick: () => focusHeadingOrContainer(document.querySelector(item.target.selector) ?? document, item.target.ariaLabel), children: item.label }, item.label))) }), Object.entries(bindings).length > 0 && (_jsxs(Flex, { container: { direction: 'column', gap: 1, pad: 1 }, as: StyledShortcuts, children: [_jsx(Text, { variant: 'h2', as: 'span', id: shortcutHeadingId, children: t('shortcuts') }), _jsx(Grid, { container: {
74
+ cols: 'auto minmax(0, 1fr)',
75
+ gap: 1,
76
+ alignItems: 'center'
77
+ }, role: 'list', "aria-labelledby": shortcutHeadingId, children: Object.entries(bindings).map(([id, shortcut]) => {
78
+ return (_jsxs("div", { role: 'listitem', children: [_jsx(Text, { children: t(`shortcut_${id}`) }), _jsx(Flex, { container: { gap: 0.5 }, children: Shortcut.shortcut2accelerator(shortcut)
79
+ .split('+')
80
+ .map(key => (_jsx(Keyboard, { keyName: key }, key))) })] }, id));
81
+ }) })] }))] }));
42
82
  });
43
83
  export default SkipLinks;
44
84
  //# sourceMappingURL=SkipLinks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SkipLinks.js","sourceRoot":"","sources":["../../../src/components/SkipLinks/SkipLinks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,IAAI,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,IAAI,MAAM,SAAS,CAAC;AAW3B,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE;IACrD,MAAM,EACJ,KAAK,EAAE,EACL,IAAI,EAAE,EAA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AAe,SAAS,CAAC","sourcesContent":["import { FC, memo } from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { focusHeadingOrContainer } from '../../utils';\nimport Button, { StyledButton } from '../Button';\nimport Popover from '../Popover';\nimport Flex from '../Flex';\n\ninterface SkipLink {\n label: string;\n target: { ariaLabel: string; selector: string };\n}\n\nexport interface SkipLinksProps {\n items: SkipLink[];\n}\n\nexport const StyledSkipLinks = styled(Popover)(props => {\n const {\n theme: {\n base: { 'z-index': zIndices, spacing }\n }\n } = props;\n\n const z = Math.max(...Object.values(zIndices)) + 1;\n\n return css`\n position: fixed;\n z-index: ${z};\n padding: ${spacing};\n\n & > ${StyledButton} {\n margin: 0;\n display: block;\n }\n\n &:not(:focus-within) {\n ${hideVisually}\n }\n `;\n});\n\nStyledSkipLinks.defaultProps = defaultThemeProp;\n\nconst SkipLinks: FC<SkipLinksProps> = memo(({ items }: SkipLinksProps) => {\n return (\n <Flex\n as={StyledSkipLinks}\n container={{ gap: 0.5, direction: 'column' }}\n show\n placement='bottom-end'\n target={{\n getBoundingClientRect: () => ({\n height: 0,\n width: 0,\n x: 24,\n y: 24,\n top: 24,\n bottom: 24,\n left: 24,\n right: 24\n })\n }}\n >\n {items.map(item => (\n <Button\n variant='link'\n key={item.label}\n onClick={() =>\n focusHeadingOrContainer(\n document.querySelector(item.target.selector) ?? document,\n item.target.ariaLabel\n )\n }\n >\n {item.label}\n </Button>\n ))}\n </Flex>\n );\n});\n\nexport default SkipLinks;\n"]}
1
+ {"version":3,"file":"SkipLinks.js","sourceRoot":"","sources":["../../../src/components/SkipLinks/SkipLinks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,IAAI,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,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,EAAE,CAStB,CACP,CAAC;wBACJ,CAAC,CAAC,GACG,IACF,CACR,IACI,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC","sourcesContent":["import { FC, memo } from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually } from 'polished';\nimport { Shortcut } from 'shortcuts';\n\nimport { defaultThemeProp } from '../../theme';\nimport { focusHeadingOrContainer } from '../../utils';\nimport Button from '../Button';\nimport Popover from '../Popover';\nimport Flex from '../Flex';\nimport { Keyboard } from '../Badges';\nimport Text from '../Text';\nimport Grid from '../Grid';\nimport { useI18n, useShortcutManager, useUID } from '../../hooks';\nimport { Translation } from '../../i18n';\nimport { registerAction } from '../ShortcutManager';\nimport { StyledButtonLink } from '../Button/Button';\n\ninterface SkipLink {\n label: string;\n target: { ariaLabel: string; selector: string };\n}\n\nexport interface SkipLinksProps {\n items: SkipLink[];\n}\n\nconst StyledSkipLinksItems = styled.div`\n & > ${StyledButtonLink} {\n display: block;\n margin-inline-start: 0;\n }\n`;\n\nexport const StyledSkipLinks = styled(Popover)(props => {\n const {\n theme: {\n base: { 'z-index': zIndices }\n }\n } = props;\n\n const z = Math.max(...Object.values(zIndices)) + 1;\n\n return css`\n position: fixed;\n z-index: ${z};\n\n /* &:not(:focus-within) {\n ${hideVisually}\n } */\n `;\n});\n\nStyledSkipLinks.defaultProps = defaultThemeProp;\n\nconst StyledShortcuts = styled.div(({ theme }) => {\n return css`\n border-block-start: 0.0625rem solid ${theme.base.palette['border-line']};\n\n [role='listitem'] {\n display: contents;\n }\n `;\n});\n\nStyledShortcuts.defaultProps = defaultThemeProp;\n\nregisterAction(\n {\n id: 'GoToIncomingInteraction',\n defaultKeyBinding: 'Alt+Enter'\n },\n {\n id: 'DismissIncomingInteraction',\n defaultKeyBinding: 'Alt+Q'\n }\n);\n\nconst SkipLinks: FC<SkipLinksProps> = memo(({ items }: SkipLinksProps) => {\n const { bindings } = useShortcutManager();\n const t = useI18n();\n const shortcutHeadingId = useUID();\n\n return (\n <Flex\n as={StyledSkipLinks}\n container={{ direction: 'column' }}\n show\n placement='bottom-end'\n target={{\n getBoundingClientRect: () => ({\n height: 0,\n width: 0,\n x: 24,\n y: 24,\n top: 24,\n bottom: 24,\n left: 24,\n right: 24\n })\n }}\n modifiers={[\n {\n name: 'placeAndContain',\n enabled: false\n }\n ]}\n data-app-region\n aria-label={t('skip_navigation_menu_label')}\n >\n <Flex container={{ direction: 'column', gap: 0.5, pad: 1 }} as={StyledSkipLinksItems}>\n {items.map(item => (\n <Button\n variant='link'\n key={item.label}\n onClick={() =>\n focusHeadingOrContainer(\n document.querySelector(item.target.selector) ?? document,\n item.target.ariaLabel\n )\n }\n >\n {item.label}\n </Button>\n ))}\n </Flex>\n\n {Object.entries(bindings).length > 0 && (\n <Flex container={{ direction: 'column', gap: 1, pad: 1 }} as={StyledShortcuts}>\n <Text variant='h2' as='span' id={shortcutHeadingId}>\n {t('shortcuts')}\n </Text>\n <Grid\n container={{\n cols: 'auto minmax(0, 1fr)',\n gap: 1,\n alignItems: 'center'\n }}\n role='list'\n aria-labelledby={shortcutHeadingId}\n >\n {Object.entries(bindings).map(([id, shortcut]) => {\n return (\n <div role='listitem' key={id}>\n <Text>{t(`shortcut_${id}` as keyof Translation)}</Text>\n <Flex container={{ gap: 0.5 }}>\n {Shortcut.shortcut2accelerator(shortcut)\n .split('+')\n .map(key => (\n <Keyboard keyName={key} key={key} />\n ))}\n </Flex>\n </div>\n );\n })}\n </Grid>\n </Flex>\n )}\n </Flex>\n );\n});\n\nexport default SkipLinks;\n"]}
@@ -13,7 +13,7 @@ export interface TextAreaProps extends FormControlProps, BaseProps, NoChildrenPr
13
13
  resizable?: boolean;
14
14
  /**
15
15
  * Enables the Text Area to resize itself automatically.
16
- * @default false
16
+ * @default true
17
17
  */
18
18
  autoResize?: boolean;
19
19
  /**
@@ -9,10 +9,10 @@ import StyledTextArea from './TextArea.styles';
9
9
  import { getTextAreaTestIds } from './TextArea.test-ids';
10
10
  const TextArea = forwardRef((props, ref) => {
11
11
  const uid = useUID();
12
- const { testId, additionalInfo, id = uid, value, defaultValue, required = false, disabled = false, readOnly = false, label, labelHidden, info, status, resizable = false, autoResize = false, maxLength, displayCharCount = false, hardStop = true, onChange: onChangeProp, onResolveSuggestion, ...restProps } = props;
12
+ const { testId, additionalInfo, id = uid, value, defaultValue, required = false, disabled = false, readOnly = false, label, labelHidden, info, status, resizable = false, autoResize = true, maxLength, displayCharCount = false, hardStop = true, onChange: onChangeProp, onResolveSuggestion, ...restProps } = props;
13
13
  const t = useI18n();
14
14
  const testIds = useTestIds(testId, getTextAreaTestIds);
15
- const [textAreaRef, resizeTextArea] = useAutoResize(undefined, 100);
15
+ const [textAreaRef, resizeTextArea] = useAutoResize();
16
16
  const consolidatedRef = useConsolidatedRef(textAreaRef, ref);
17
17
  const [charCount, setCharCount] = useState(0);
18
18
  const controlProp = {};
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,EAGV,WAAW,EACX,QAAQ,EAER,SAAS,EACV,MAAM,OAAO,CAAC;AAGf,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAoB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AA8BzD,MAAM,QAAQ,GAAqC,UAAU,CAC3D,CAAC,KAAqC,EAAE,GAA6B,EAAE,EAAE;IACvE,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC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AAM;YACN,gBAAgB,EACd,gBAAgB,IAAI,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CAClD,KAAC,IAAI,IACH,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAC,WAAW,eACR,SAAS,IAAI,CAAC,IAAI,SAAS,GAAG,SAAS,IAAI,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,YAE1E,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,IAAI,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,GACnE,CACR,CAAC,CAAC,CAAC,SAAS;YACf,QAAQ;YACR,QAAQ;YACR,mBAAmB;SACpB,YAEA,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import {\n FC,\n Ref,\n forwardRef,\n PropsWithoutRef,\n ChangeEvent,\n useCallback,\n useState,\n ChangeEventHandler,\n useEffect\n} from 'react';\n\nimport { BaseProps, ForwardProps, NoChildrenProp, TestIdProp } from '../../types';\nimport FormField from '../FormField';\nimport { FormControlProps, StyledFormControl } from '../FormControl';\nimport { hasProp } from '../../utils';\nimport { useAutoResize, useConsolidatedRef, useI18n, useTestIds, useUID } from '../../hooks';\nimport Text from '../Text';\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.\n * @default false\n */\n resizable?: boolean;\n /**\n * Enables the Text Area to resize itself automatically.\n * @default false\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 onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n}\n\nconst TextArea: FC<TextAreaProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<TextAreaProps>, ref: Ref<HTMLTextAreaElement>) => {\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 = false,\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\n const [textAreaRef, resizeTextArea] = useAutoResize<HTMLTextAreaElement>(undefined, 100);\n const consolidatedRef = useConsolidatedRef(textAreaRef, ref);\n const [charCount, setCharCount] = useState(0);\n\n const controlProp: {\n value?: string;\n defaultValue?: string;\n } = {};\n\n useEffect(() => {\n if ('value' in props) {\n setCharCount(props.value ? props.value.length : 0);\n } else if ('defaultValue' in props) {\n setCharCount(props.defaultValue ? props.defaultValue.length : 0);\n }\n }, [props]);\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 (!hardStop || maxLength === undefined || e.target.value.length <= maxLength) {\n onChangeProp?.(e);\n setCharCount(e.target.value.length);\n resizeTextArea();\n }\n },\n [onChangeProp, resizeTextArea, hardStop, maxLength]\n );\n\n const Comp = (\n <StyledFormControl\n {...{\n 'data-testid': testIds.control,\n ref: autoResize ? consolidatedRef : ref,\n id,\n required,\n disabled,\n status,\n readOnly,\n resizable,\n maxLength: hardStop ? maxLength : undefined,\n hasSuggestion: status === 'pending' && !!onResolveSuggestion,\n ...controlProp,\n ...restProps,\n onChange,\n as: StyledTextArea\n }}\n />\n );\n\n return label || displayCharCount ? (\n <FormField\n {...{\n testId: testIds,\n additionalInfo,\n label,\n labelHidden,\n id,\n readOnly,\n info,\n status,\n charLimitDisplay:\n displayCharCount && typeof maxLength === 'number' ? (\n <Text\n readOnly={readOnly}\n variant='secondary'\n aria-live={maxLength >= 0 && maxLength - charCount <= 20 ? 'polite' : 'off'}\n >\n {maxLength >= 0 ? t('x_of_y', [charCount || '0', maxLength]) : charCount}\n </Text>\n ) : undefined,\n required,\n disabled,\n onResolveSuggestion\n }}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default TextArea;\n"]}
1
+ {"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,EAGV,WAAW,EACX,QAAQ,EAER,SAAS,EACV,MAAM,OAAO,CAAC;AAGf,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAoB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AA8BzD,MAAM,QAAQ,GAAqC,UAAU,CAC3D,CAAC,KAAqC,EAAE,GAA6B,EAAE,EAAE;IACvE,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,MAAM,EACJ,MAAM,EACN,cAAc,EACd,EAAE,GAAG,GAAG,EACR,KAAK,EACL,YAAY,EACZ,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,KAAK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AAS,IAAI,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,YAE1E,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,IAAI,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,GACnE,CACR,CAAC,CAAC,CAAC,SAAS;YACf,QAAQ;YACR,QAAQ;YACR,mBAAmB;SACpB,YAEA,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import {\n FC,\n Ref,\n forwardRef,\n PropsWithoutRef,\n ChangeEvent,\n useCallback,\n useState,\n ChangeEventHandler,\n useEffect\n} from 'react';\n\nimport { BaseProps, ForwardProps, NoChildrenProp, TestIdProp } from '../../types';\nimport FormField from '../FormField';\nimport { FormControlProps, StyledFormControl } from '../FormControl';\nimport { hasProp } from '../../utils';\nimport { useAutoResize, useConsolidatedRef, useI18n, useTestIds, useUID } from '../../hooks';\nimport Text from '../Text';\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.\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 onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n}\n\nconst TextArea: FC<TextAreaProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<TextAreaProps>, ref: Ref<HTMLTextAreaElement>) => {\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\n const [textAreaRef, resizeTextArea] = useAutoResize<HTMLTextAreaElement>();\n const consolidatedRef = useConsolidatedRef(textAreaRef, ref);\n const [charCount, setCharCount] = useState(0);\n\n const controlProp: {\n value?: string;\n defaultValue?: string;\n } = {};\n\n useEffect(() => {\n if ('value' in props) {\n setCharCount(props.value ? props.value.length : 0);\n } else if ('defaultValue' in props) {\n setCharCount(props.defaultValue ? props.defaultValue.length : 0);\n }\n }, [props]);\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 (!hardStop || maxLength === undefined || e.target.value.length <= maxLength) {\n onChangeProp?.(e);\n setCharCount(e.target.value.length);\n resizeTextArea();\n }\n },\n [onChangeProp, resizeTextArea, hardStop, maxLength]\n );\n\n const Comp = (\n <StyledFormControl\n {...{\n 'data-testid': testIds.control,\n ref: autoResize ? consolidatedRef : ref,\n id,\n required,\n disabled,\n status,\n readOnly,\n resizable,\n maxLength: hardStop ? maxLength : undefined,\n hasSuggestion: status === 'pending' && !!onResolveSuggestion,\n ...controlProp,\n ...restProps,\n onChange,\n as: StyledTextArea\n }}\n />\n );\n\n return label || displayCharCount ? (\n <FormField\n {...{\n testId: testIds,\n additionalInfo,\n label,\n labelHidden,\n id,\n readOnly,\n info,\n status,\n charLimitDisplay:\n displayCharCount && typeof maxLength === 'number' ? (\n <Text\n readOnly={readOnly}\n variant='secondary'\n aria-live={maxLength >= 0 && maxLength - charCount <= 20 ? 'polite' : 'off'}\n >\n {maxLength >= 0 ? t('x_of_y', [charCount || '0', maxLength]) : charCount}\n </Text>\n ) : undefined,\n required,\n disabled,\n onResolveSuggestion\n }}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default TextArea;\n"]}
@@ -25,6 +25,8 @@ export { default as useOuterEvent } from './useOuterEvent';
25
25
  export { default as usePrevious } from './usePrevious';
26
26
  export { default as useScrollStick } from './useScrollStick';
27
27
  export { default as useScrollToggle } from './useScrollToggle';
28
+ export { default as useShortcut } from './useShortcut';
29
+ export { default as useShortcutManager } from './useShortcutManager';
28
30
  export { default as useTestIds } from './useTestIds';
29
31
  export { default as useTheme } from './useTheme';
30
32
  export { default as useToaster } from './useToaster';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,mBAAmB,EAC9B,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MA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rE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -25,6 +25,8 @@ export { default as useOuterEvent } from './useOuterEvent';
25
25
  export { default as usePrevious } from './usePrevious';
26
26
  export { default as useScrollStick } from './useScrollStick';
27
27
  export { default as useScrollToggle } from './useScrollToggle';
28
+ export { default as useShortcut } from './useShortcut';
29
+ export { default as useShortcutManager } from './useShortcutManager';
28
30
  export { default as useTestIds } from './useTestIds';
29
31
  export { default as useTheme } from './useTheme';
30
32
  export { default as useToaster } from './useToaster';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,mBAAmB,EAE9B,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,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EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export {\n default as useActiveDescendant,\n UseActiveDescendantConfig,\n useLazyDescendant\n} from './useActiveDescendant';\nexport { default as useAfterInitialEffect } from './useAfterInitialEffect';\nexport { default as useArrows } from './useArrows';\nexport { default as useAutoResize } from './useAutoResize';\nexport { default as useBreakpoint } from './useBreakpoint';\nexport { default as useChToPxConversionFactor } from './useChToPxConversionFactor';\nexport { default as useConfiguration } from './useConfiguration';\nexport { default as useConsolidatedRef } from './useConsolidatedRef';\nexport { default as useDirection } from './useDirection';\nexport { default as useDraggable } from './useDraggable';\nexport { default as useElement } from './useElement';\nexport { default as useEscape } from './useEscape';\nexport { default as useEvent } from './useEvent';\nexport { default as useFocusTrap } from './useFocusTrap';\nexport { default as useFocusWithin } from './useFocusWithin';\nexport { default as useI18n } from './useI18n';\nexport { default as useInputFormatter } from './useInputFormatter';\nexport { default as useItemIntersection } from './useItemIntersection';\nexport { default as useLiveLog } from './useLiveLog';\nexport { default as useLongPress } from './useLongPress';\nexport { default as useModalContext } from './useModalContext';\nexport { default as useModalManager } from './useModalManager';\nexport { default as useOS } from './useOS';\nexport { default as useOuterEvent } from './useOuterEvent';\nexport { default as usePrevious } from './usePrevious';\nexport { default as useScrollStick } from './useScrollStick';\nexport { default as useScrollToggle } from './useScrollToggle';\nexport { default as useTestIds } from './useTestIds';\nexport { default as useTheme } from './useTheme';\nexport { default as useToaster } from './useToaster';\nexport { default as useTransitionState } from './useTransitionState';\nexport { default as useTriggerableEffect } from './useTriggerableEffect';\nexport { default as useTriggerableLayoutEffect } from './useTriggerableLayoutEffect';\nexport { default as useUID } from './useUID';\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,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export {\n default as useActiveDescendant,\n UseActiveDescendantConfig,\n useLazyDescendant\n} from './useActiveDescendant';\nexport { default as useAfterInitialEffect } from './useAfterInitialEffect';\nexport { default as useArrows } from './useArrows';\nexport { default as useAutoResize } from './useAutoResize';\nexport { default as useBreakpoint } from './useBreakpoint';\nexport { default as useChToPxConversionFactor } from './useChToPxConversionFactor';\nexport { default as useConfiguration } from './useConfiguration';\nexport { default as useConsolidatedRef } from './useConsolidatedRef';\nexport { default as useDirection } from './useDirection';\nexport { default as useDraggable } from './useDraggable';\nexport { default as useElement } from './useElement';\nexport { default as useEscape } from './useEscape';\nexport { default as useEvent } from './useEvent';\nexport { default as useFocusTrap } from './useFocusTrap';\nexport { default as useFocusWithin } from './useFocusWithin';\nexport { default as useI18n } from './useI18n';\nexport { default as useInputFormatter } from './useInputFormatter';\nexport { default as useItemIntersection } from './useItemIntersection';\nexport { default as useLiveLog } from './useLiveLog';\nexport { default as useLongPress } from './useLongPress';\nexport { default as useModalContext } from './useModalContext';\nexport { default as useModalManager } from './useModalManager';\nexport { default as useOS } from './useOS';\nexport { default as useOuterEvent } from './useOuterEvent';\nexport { default as usePrevious } from './usePrevious';\nexport { default as useScrollStick } from './useScrollStick';\nexport { default as useScrollToggle } from './useScrollToggle';\nexport { default as useShortcut } from './useShortcut';\nexport { default as useShortcutManager } from './useShortcutManager';\nexport { default as useTestIds } from './useTestIds';\nexport { default as useTheme } from './useTheme';\nexport { default as useToaster } from './useToaster';\nexport { default as useTransitionState } from './useTransitionState';\nexport { default as useTriggerableEffect } from './useTriggerableEffect';\nexport { default as useTriggerableLayoutEffect } from './useTriggerableLayoutEffect';\nexport { default as useUID } from './useUID';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useAutoResize.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutoResize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAI3D;;;;;;;GAOG;AACH,QAAA,MAAM,aAAa,oDACL,MAAM,kBACF,MAAM,wCACc,IAAI,CAqCzC,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"useAutoResize.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutoResize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAI3D;;;;;;;GAOG;AACH,QAAA,MAAM,aAAa,oDACL,MAAM,kBACF,MAAM,wCACc,IAAI,CA+CzC,CAAC;AAEF,eAAe,aAAa,CAAC"}