@pega/cosmos-react-core 6.0.14 → 6.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  2. package/lib/components/AppShell/AppHeader.js +4 -6
  3. package/lib/components/AppShell/AppHeader.js.map +1 -1
  4. package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -1
  5. package/lib/components/AppShell/AppHeader.styles.js +6 -2
  6. package/lib/components/AppShell/AppHeader.styles.js.map +1 -1
  7. package/lib/components/AppShell/Drawer.d.ts.map +1 -1
  8. package/lib/components/AppShell/Drawer.js +3 -2
  9. package/lib/components/AppShell/Drawer.js.map +1 -1
  10. package/lib/components/AppShell/style-utils.d.ts +1 -0
  11. package/lib/components/AppShell/style-utils.d.ts.map +1 -1
  12. package/lib/components/AppShell/style-utils.js +4 -2
  13. package/lib/components/AppShell/style-utils.js.map +1 -1
  14. package/lib/components/Badges/Selection.d.ts.map +1 -1
  15. package/lib/components/Badges/Selection.js +19 -18
  16. package/lib/components/Badges/Selection.js.map +1 -1
  17. package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
  18. package/lib/components/FieldGroup/FieldGroupList.js +23 -4
  19. package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
  20. package/lib/components/HiddenText/HiddenText.d.ts +11 -0
  21. package/lib/components/HiddenText/HiddenText.d.ts.map +1 -0
  22. package/lib/components/HiddenText/HiddenText.js +15 -0
  23. package/lib/components/HiddenText/HiddenText.js.map +1 -0
  24. package/lib/components/HiddenText/index.d.ts +2 -0
  25. package/lib/components/HiddenText/index.d.ts.map +1 -0
  26. package/lib/components/HiddenText/index.js +2 -0
  27. package/lib/components/HiddenText/index.js.map +1 -0
  28. package/lib/components/Icon/Icon.d.ts.map +1 -1
  29. package/lib/components/Icon/Icon.js +2 -2
  30. package/lib/components/Icon/Icon.js.map +1 -1
  31. package/lib/components/Icon/streamline-icons/arrow-micro-up-down.icon.d.ts +5 -0
  32. package/lib/components/Icon/streamline-icons/arrow-micro-up-down.icon.d.ts.map +1 -0
  33. package/lib/components/Icon/streamline-icons/arrow-micro-up-down.icon.js +7 -0
  34. package/lib/components/Icon/streamline-icons/arrow-micro-up-down.icon.js.map +1 -0
  35. package/lib/components/Icon/streamlineIconNames.d.ts +1 -1
  36. package/lib/components/Icon/streamlineIconNames.d.ts.map +1 -1
  37. package/lib/components/Icon/streamlineIconNames.js +1 -0
  38. package/lib/components/Icon/streamlineIconNames.js.map +1 -1
  39. package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
  40. package/lib/components/Menu/Menu.styles.js +1 -2
  41. package/lib/components/Menu/Menu.styles.js.map +1 -1
  42. package/lib/components/MenuButton/MenuButton.js +1 -1
  43. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  44. package/lib/components/Modal/Modal.d.ts.map +1 -1
  45. package/lib/components/Modal/Modal.js +10 -3
  46. package/lib/components/Modal/Modal.js.map +1 -1
  47. package/lib/components/Modal/Modal.styles.d.ts +3 -1
  48. package/lib/components/Modal/Modal.styles.d.ts.map +1 -1
  49. package/lib/components/Modal/Modal.styles.js +22 -12
  50. package/lib/components/Modal/Modal.styles.js.map +1 -1
  51. package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -1
  52. package/lib/components/MultiStepForm/MultiStepForm.js +28 -1
  53. package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -1
  54. package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  55. package/lib/components/Tooltip/Tooltip.js +4 -1
  56. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  57. package/lib/hooks/index.d.ts +1 -0
  58. package/lib/hooks/index.d.ts.map +1 -1
  59. package/lib/hooks/index.js +1 -0
  60. package/lib/hooks/index.js.map +1 -1
  61. package/lib/hooks/useI18n.d.ts +13 -1
  62. package/lib/hooks/useI18n.d.ts.map +1 -1
  63. package/lib/hooks/useRefMap.d.ts +8 -0
  64. package/lib/hooks/useRefMap.d.ts.map +1 -0
  65. package/lib/hooks/useRefMap.js +27 -0
  66. package/lib/hooks/useRefMap.js.map +1 -0
  67. package/lib/i18n/default.d.ts +13 -1
  68. package/lib/i18n/default.d.ts.map +1 -1
  69. package/lib/i18n/default.js +16 -2
  70. package/lib/i18n/default.js.map +1 -1
  71. package/lib/i18n/i18n.d.ts +13 -1
  72. package/lib/i18n/i18n.d.ts.map +1 -1
  73. package/lib/index.d.ts +1 -0
  74. package/lib/index.d.ts.map +1 -1
  75. package/lib/index.js +1 -0
  76. package/lib/index.js.map +1 -1
  77. package/lib/utils/index.d.ts +1 -0
  78. package/lib/utils/index.d.ts.map +1 -1
  79. package/lib/utils/index.js +1 -0
  80. package/lib/utils/index.js.map +1 -1
  81. package/lib/utils/mouseState.d.ts +9 -0
  82. package/lib/utils/mouseState.d.ts.map +1 -0
  83. package/lib/utils/mouseState.js +26 -0
  84. package/lib/utils/mouseState.js.map +1 -0
  85. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AppHeader.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,OAAO,CAAC;AAMjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAavD,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CAwG9D,CAAC;AAEH,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"AppHeader.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,OAAO,CAAC;AAMjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAavD,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CAoG9D,CAAC;AAEH,eAAe,SAAS,CAAC"}
@@ -1,16 +1,16 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useContext, useEffect } from 'react';
3
3
  import Flex from '../Flex';
4
4
  import Image from '../Image';
5
5
  import SearchInput from '../SearchInput';
6
- import { useBreakpoint, useElement } from '../../hooks';
7
- import BareButton from '../Button/BareButton';
6
+ import { useBreakpoint, useElement, useI18n } from '../../hooks';
8
7
  import VisuallyHiddenText from '../VisuallyHiddenText';
9
8
  import AppShellOperator from './Operator';
10
9
  import ContextSwitcher from './ContextSwitcher';
11
10
  import { StyledAppHeader, StyledAppHeaderInfo, StyledAppHeaderSearchForm, StyledAppHeaderSpacer, StyledAppHeaderText, StyledAppHeaderOperator } from './AppHeader.styles';
12
11
  import AppShellContext from './AppShellContext';
13
12
  const AppHeader = forwardRef(function AppHeader({ appName, contextSwitcher: { contexts, onContextClick, label: contextSwitcherLabel } = {}, fullImageSrc, imageSrc, href, onClick, portalName, target, appNameHidden, operator, searchInput, searchLabel, searchPage }, ref) {
13
+ const t = useI18n();
14
14
  const isMediumOrAbove = useBreakpoint('md');
15
15
  const [searchContainer, setSearchContainer] = useElement();
16
16
  const { drawerOpen, setSearchContainerEl } = useContext(AppShellContext);
@@ -25,9 +25,7 @@ const AppHeader = forwardRef(function AppHeader({ appName, contextSwitcher: { co
25
25
  let appInfoAs = 'div';
26
26
  if (href)
27
27
  appInfoAs = 'a';
28
- else if (onClick)
29
- appInfoAs = BareButton;
30
- return (_jsxs(Flex, { as: StyledAppHeader, container: { alignItems: 'center', pad: 1 }, hideTitle: !isMediumOrAbove, drawerOpen: drawerOpen, ref: ref, children: [contexts && contexts.length > 1 && onContextClick && (_jsx(ContextSwitcher, { contexts: contexts, onContextClick: onContextClick, label: contextSwitcherLabel })), _jsx(StyledAppHeaderInfo, { centerLogo: !fullImageSrc, children: _jsxs(Flex, { container: { inline: true, alignItems: 'center', gap: 1 }, as: appInfoAs, href: href, onClick: onClick, target: target, children: [_jsx(Image, { src: fullImageSrc || imageSrc, alt: '', "aria-hidden": 'true' }), isMediumOrAbove && (_jsxs(_Fragment, { children: [_jsx(StyledAppHeaderText, { as: appNameHidden ? VisuallyHiddenText : 'span', variant: 'primary', children: appName }), portalName && (_jsx(StyledAppHeaderText, { as: appNameHidden ? VisuallyHiddenText : 'span', variant: 'secondary', children: portalName }))] }))] }) }), _jsx(Flex, { item: { grow: 1 }, container: { justify: 'end' }, children: searchInput ? (_jsx(StyledAppHeaderSearchForm, { ref: setSearchContainer, role: 'search', "aria-label": searchLabel, onSubmit: e => e.preventDefault(), isMediumOrAbove: isMediumOrAbove, children: !searchPage && _jsx(SearchInput, { ...searchInput }) })) : (_jsx(StyledAppHeaderSpacer, {})) }), _jsx(AppShellOperator, { as: StyledAppHeaderOperator, actions: operator.actions, popover: { placement: 'bottom-start' }, children: operator.avatar })] }));
28
+ return (_jsxs(Flex, { as: StyledAppHeader, container: { alignItems: 'center', pad: 1 }, hideTitle: !isMediumOrAbove, drawerOpen: drawerOpen, ref: ref, children: [contexts && contexts.length > 1 && onContextClick && (_jsx(ContextSwitcher, { contexts: contexts, onContextClick: onContextClick, label: contextSwitcherLabel })), _jsx(StyledAppHeaderInfo, { centerLogo: !fullImageSrc, children: _jsxs(Flex, { container: { inline: true, alignItems: 'center', gap: 1 }, as: appInfoAs, href: href, onClick: href ? onClick : undefined, target: target, children: [_jsx(Image, { src: fullImageSrc || imageSrc, alt: t('application_logo') }), _jsx(StyledAppHeaderText, { as: appNameHidden || !isMediumOrAbove ? VisuallyHiddenText : 'span', variant: 'primary', children: appName }), portalName && (_jsx(StyledAppHeaderText, { as: appNameHidden || !isMediumOrAbove ? VisuallyHiddenText : 'span', variant: 'secondary', children: portalName }))] }) }), _jsx(Flex, { item: { grow: 1 }, container: { justify: 'end' }, children: searchInput ? (_jsx(StyledAppHeaderSearchForm, { ref: setSearchContainer, role: 'search', "aria-label": searchLabel, onSubmit: e => e.preventDefault(), isMediumOrAbove: isMediumOrAbove, children: !searchPage && _jsx(SearchInput, { ...searchInput }) })) : (_jsx(StyledAppHeaderSpacer, {})) }), _jsx(AppShellOperator, { as: StyledAppHeaderOperator, actions: operator.actions, popover: { placement: 'bottom-start' }, children: operator.avatar })] }));
31
29
  });
32
30
  export default AppHeader;
33
31
  //# sourceMappingURL=AppHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppHeader.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG1D,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAGvD,OAAO,gBAAgB,MAAM,YAAY,CAAC;AAC1C,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,MAAM,SAAS,GAAqD,UAAU,CAAC,SAAS,SAAS,CAC/F,EACE,OAAO,EACP,eAAe,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,oBAAoB,EAAE,GAAG,EAAE,EAC/E,YAAY,EACZ,QAAQ,EACR,IAAI,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 'react';\nimport type { FunctionComponent, Ref, ElementType } from 'react';\n\nimport Flex from '../Flex';\nimport Image from '../Image';\nimport SearchInput from '../SearchInput';\nimport { useBreakpoint, useElement } from '../../hooks';\nimport type { ForwardProps } from '../../types';\nimport BareButton from '../Button/BareButton';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\n\nimport type { AppHeaderProps } from './AppShell.types';\nimport AppShellOperator from './Operator';\nimport ContextSwitcher from './ContextSwitcher';\nimport {\n StyledAppHeader,\n StyledAppHeaderInfo,\n StyledAppHeaderSearchForm,\n StyledAppHeaderSpacer,\n StyledAppHeaderText,\n StyledAppHeaderOperator\n} from './AppHeader.styles';\nimport AppShellContext from './AppShellContext';\n\nconst AppHeader: FunctionComponent<AppHeaderProps & ForwardProps> = forwardRef(function AppHeader(\n {\n appName,\n contextSwitcher: { contexts, onContextClick, label: contextSwitcherLabel } = {},\n fullImageSrc,\n imageSrc,\n href,\n onClick,\n portalName,\n target,\n appNameHidden,\n operator,\n searchInput,\n searchLabel,\n searchPage\n }: AppHeaderProps,\n ref: Ref<Element>\n) {\n const isMediumOrAbove = useBreakpoint('md');\n const [searchContainer, setSearchContainer] = useElement<HTMLElement>();\n const { drawerOpen, setSearchContainerEl } = useContext(AppShellContext);\n\n useEffect(() => {\n if (searchPage && searchContainer) {\n setSearchContainerEl(searchContainer);\n } else {\n setSearchContainerEl(null);\n }\n }, [searchPage, searchContainer, setSearchContainerEl]);\n\n let appInfoAs: ElementType = 'div';\n if (href) appInfoAs = 'a';\n else if (onClick) appInfoAs = BareButton;\n\n return (\n <Flex\n as={StyledAppHeader}\n container={{ alignItems: 'center', pad: 1 }}\n hideTitle={!isMediumOrAbove}\n drawerOpen={drawerOpen}\n ref={ref}\n >\n {contexts && contexts.length > 1 && onContextClick && (\n <ContextSwitcher\n contexts={contexts}\n onContextClick={onContextClick}\n label={contextSwitcherLabel}\n />\n )}\n\n <StyledAppHeaderInfo centerLogo={!fullImageSrc}>\n <Flex\n container={{ inline: true, alignItems: 'center', gap: 1 }}\n as={appInfoAs}\n href={href}\n onClick={onClick}\n target={target}\n >\n <Image src={fullImageSrc || imageSrc} alt='' aria-hidden='true' />\n {isMediumOrAbove && (\n <>\n <StyledAppHeaderText\n as={appNameHidden ? VisuallyHiddenText : 'span'}\n variant='primary'\n >\n {appName}\n </StyledAppHeaderText>\n {portalName && (\n <StyledAppHeaderText\n as={appNameHidden ? VisuallyHiddenText : 'span'}\n variant='secondary'\n >\n {portalName}\n </StyledAppHeaderText>\n )}\n </>\n )}\n </Flex>\n </StyledAppHeaderInfo>\n <Flex item={{ grow: 1 }} container={{ justify: 'end' }}>\n {searchInput ? (\n <StyledAppHeaderSearchForm\n ref={setSearchContainer}\n role='search'\n aria-label={searchLabel}\n onSubmit={e => e.preventDefault()}\n isMediumOrAbove={isMediumOrAbove}\n >\n {!searchPage && <SearchInput {...searchInput} />}\n </StyledAppHeaderSearchForm>\n ) : (\n <StyledAppHeaderSpacer />\n )}\n </Flex>\n\n <AppShellOperator\n as={StyledAppHeaderOperator}\n actions={operator.actions}\n popover={{ placement: 'bottom-start' }}\n >\n {operator.avatar}\n </AppShellOperator>\n </Flex>\n );\n});\n\nexport default AppHeader;\n"]}
1
+ {"version":3,"file":"AppHeader.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG1D,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAGvD,OAAO,gBAAgB,MAAM,YAAY,CAAC;AAC1C,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,eAAe,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/B,CAAC,UAAU,IAAI,KAAC,WAAW,OAAK,WAAW,GAAI,GACtB,CAC7B,CAAC,CAAC,CAAC,CACF,KAAC,qBAAqB,KAAG,CAC1B,GACI,EAEP,KAAC,gBAAgB,IACf,EAAE,EAAE,uBAAuB,EAC3B,OAAO,EAAE,QAAQ,CAAC,OAAO,EACzB,OAAO,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,YAErC,QAAQ,CAAC,MAAM,GACC,IACd,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC","sourcesContent":["import { forwardRef, useContext, useEffect } from 'react';\nimport type { FunctionComponent, Ref, ElementType } from 'react';\n\nimport Flex from '../Flex';\nimport Image from '../Image';\nimport SearchInput from '../SearchInput';\nimport { useBreakpoint, useElement, useI18n } from '../../hooks';\nimport type { ForwardProps } from '../../types';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\n\nimport type { AppHeaderProps } from './AppShell.types';\nimport AppShellOperator from './Operator';\nimport ContextSwitcher from './ContextSwitcher';\nimport {\n StyledAppHeader,\n StyledAppHeaderInfo,\n StyledAppHeaderSearchForm,\n StyledAppHeaderSpacer,\n StyledAppHeaderText,\n StyledAppHeaderOperator\n} from './AppHeader.styles';\nimport AppShellContext from './AppShellContext';\n\nconst AppHeader: FunctionComponent<AppHeaderProps & ForwardProps> = forwardRef(function AppHeader(\n {\n appName,\n contextSwitcher: { contexts, onContextClick, label: contextSwitcherLabel } = {},\n fullImageSrc,\n imageSrc,\n href,\n onClick,\n portalName,\n target,\n appNameHidden,\n operator,\n searchInput,\n searchLabel,\n searchPage\n }: AppHeaderProps,\n ref: Ref<Element>\n) {\n const t = useI18n();\n const isMediumOrAbove = useBreakpoint('md');\n const [searchContainer, setSearchContainer] = useElement<HTMLElement>();\n const { drawerOpen, setSearchContainerEl } = useContext(AppShellContext);\n\n useEffect(() => {\n if (searchPage && searchContainer) {\n setSearchContainerEl(searchContainer);\n } else {\n setSearchContainerEl(null);\n }\n }, [searchPage, searchContainer, setSearchContainerEl]);\n\n let appInfoAs: ElementType = 'div';\n if (href) appInfoAs = 'a';\n\n return (\n <Flex\n as={StyledAppHeader}\n container={{ alignItems: 'center', pad: 1 }}\n hideTitle={!isMediumOrAbove}\n drawerOpen={drawerOpen}\n ref={ref}\n >\n {contexts && contexts.length > 1 && onContextClick && (\n <ContextSwitcher\n contexts={contexts}\n onContextClick={onContextClick}\n label={contextSwitcherLabel}\n />\n )}\n\n <StyledAppHeaderInfo centerLogo={!fullImageSrc}>\n <Flex\n container={{ inline: true, alignItems: 'center', gap: 1 }}\n as={appInfoAs}\n href={href}\n onClick={href ? onClick : undefined}\n target={target}\n >\n <Image src={fullImageSrc || imageSrc} alt={t('application_logo')} />\n <StyledAppHeaderText\n as={appNameHidden || !isMediumOrAbove ? VisuallyHiddenText : 'span'}\n variant='primary'\n >\n {appName}\n </StyledAppHeaderText>\n {portalName && (\n <StyledAppHeaderText\n as={appNameHidden || !isMediumOrAbove ? VisuallyHiddenText : 'span'}\n variant='secondary'\n >\n {portalName}\n </StyledAppHeaderText>\n )}\n </Flex>\n </StyledAppHeaderInfo>\n <Flex item={{ grow: 1 }} container={{ justify: 'end' }}>\n {searchInput ? (\n <StyledAppHeaderSearchForm\n ref={setSearchContainer}\n role='search'\n aria-label={searchLabel}\n onSubmit={e => e.preventDefault()}\n isMediumOrAbove={isMediumOrAbove}\n >\n {!searchPage && <SearchInput {...searchInput} />}\n </StyledAppHeaderSearchForm>\n ) : (\n <StyledAppHeaderSpacer />\n )}\n </Flex>\n\n <AppShellOperator\n as={StyledAppHeaderOperator}\n actions={operator.actions}\n popover={{ placement: 'bottom-start' }}\n >\n {operator.avatar}\n </AppShellOperator>\n </Flex>\n );\n});\n\nexport default AppHeader;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AppHeader.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.styles.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC,eAAO,MAAM,qBAAqB,yGAIhC,CAAC;AAIH,eAAO,MAAM,mBAAmB;gBAA4B,OAAO;SAuBjE,CAAC;AAIH,eAAO,MAAM,yBAAyB;qBAAkC,OAAO;SAuC9E,CAAC;AAIF,eAAO,MAAM,qBAAqB,yGAEjC,CAAC;AAEF,eAAO,MAAM,mBAAmB;aAA2B,SAAS,CAAC,SAAS,CAAC;SA0B9E,CAAC;AAIF,eAAO,MAAM,uBAAuB,4GAQnC,CAAC;AAIF,eAAO,MAAM,eAAe;eAA8B,OAAO;gBAAc,OAAO;SAqDrF,CAAC"}
1
+ {"version":3,"file":"AppHeader.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.styles.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC,eAAO,MAAM,qBAAqB,yGAIhC,CAAC;AAIH,eAAO,MAAM,mBAAmB;gBAA4B,OAAO;SA2BjE,CAAC;AAIH,eAAO,MAAM,yBAAyB;qBAAkC,OAAO;SAuC9E,CAAC;AAIF,eAAO,MAAM,qBAAqB,yGAEjC,CAAC;AAEF,eAAO,MAAM,mBAAmB;aAA2B,SAAS,CAAC,SAAS,CAAC;SA0B9E,CAAC;AAIF,eAAO,MAAM,uBAAuB,4GAQnC,CAAC;AAIF,eAAO,MAAM,eAAe;eAA8B,OAAO;gBAAc,OAAO;SAqDrF,CAAC"}
@@ -22,14 +22,18 @@ export const StyledAppHeaderInfo = styled.div(({ centerLogo, theme }) => {
22
22
  vertical-align: top;
23
23
  }
24
24
 
25
- & > a,
26
- & > button {
25
+ & > :is(a, button) {
27
26
  cursor: pointer;
28
27
  text-decoration: none;
29
28
  user-select: none;
30
29
  -webkit-user-select: none;
31
30
  }
32
31
 
32
+ & > :is(a, button):focus {
33
+ box-shadow: ${theme.base.shadow.focus};
34
+ outline: none;
35
+ }
36
+
33
37
  ${StyledImage} {
34
38
  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W,EAAE,WAAW,CAAC,CAAC,CAAC;IAE3F,OAAO,GAAG,CAAA;;sBAEQ,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ;QAC5C,UAAU;QACZ,GAAG,CAAA;wBACe,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ;OAC/C;;aAEM,KAAK,CAAC,IAAI,CAAC,OAAO;;gBAEf,YAAY;0BACF,WAAW;uCACE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;;QAEhE,mBAAmB;;;;UAIjB,SAAS;QACX,GAAG,CAAA;;SAEF;;;UAGC,uBAAuB;;;YAGrB,aAAa;;YAEb,uBAAuB;gCACH,WAAW;;;YAG/B,uBAAuB;qBACd,aAAa;;;;;uBAKX,WAAW,CAAC,UAAU;kCACX,WAAW,CAAC,UAAU;;;;;KAKnD,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { mix, readableColor, rgba } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport { calculateFontSize, getHoverColors } from '../../styles';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { StyledImage } from '../Image';\nimport { StyledMenuListContainer } from '../Menu/Menu.styles';\nimport { StyledPopover } from '../Popover';\nimport { StyledSearchInput } from '../SearchInput';\nimport { StyledSearchButton, StyledSearchTextInput } from '../SearchInput/SearchInput.styles';\nimport Text from '../Text';\nimport type { TextProps } from '../Text';\n\nimport { headerHeight, navWidth } from './AppShell.styles';\n\nexport const StyledContextSwitcher = styled.div(({ theme }) => {\n return css`\n width: calc(${navWidth} - 2 * ${theme.base.spacing});\n `;\n});\n\nStyledContextSwitcher.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderInfo = styled.div<{ centerLogo: boolean }>(({ centerLogo, theme }) => {\n return css`\n & > :first-child {\n vertical-align: top;\n }\n\n & > a,\n & > button {\n cursor: pointer;\n text-decoration: none;\n user-select: none;\n -webkit-user-select: none;\n }\n\n ${StyledImage} {\n height: 1.625rem;\n\n ${centerLogo &&\n css`\n padding-inline-start: ${theme.base.spacing};\n `}\n }\n `;\n});\n\nStyledAppHeaderInfo.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSearchForm = styled.form<{ isMediumOrAbove: boolean }>(\n ({ isMediumOrAbove, theme }) => {\n const headerColor = theme.components['app-shell'].header['background-color'];\n const contrastColor = tryCatch(() => readableColor(headerColor));\n\n return css`\n max-width: 33vw;\n min-width: 10rem;\n width: 100%;\n justify-self: center;\n margin-inline-start: 0;\n margin-inline-end: auto;\n transition: max-width ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n\n ${!isMediumOrAbove &&\n css`\n max-width: 75%;\n min-width: 2rem;\n margin-inline-start: auto;\n\n &:not([focused]) {\n ${StyledSearchInput} {\n ${StyledSearchButton} {\n background: ${headerColor};\n color: ${contrastColor};\n }\n\n ${StyledSearchTextInput} {\n background: ${headerColor};\n }\n }\n }\n\n &:focus-within {\n min-width: 10rem;\n }\n `}\n `;\n }\n);\n\nStyledAppHeaderSearchForm.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSpacer = styled.div`\n margin: auto;\n`;\n\nexport const StyledAppHeaderText = styled(Text)<{ variant: TextProps['variant'] }>(\n ({ theme, variant }) => {\n const contrastColor = tryCatch(() =>\n readableColor(theme.components['app-shell'].header['background-color'])\n );\n const secondaryColor = tryCatch(() =>\n rgba(\n contrastColor ?? theme.base.palette['foreground-color'],\n theme.base.transparency['transparent-2']\n )\n );\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n color: ${variant === 'secondary' ? secondaryColor : contrastColor};\n font-size: ${fontSize.s};\n\n ${variant !== 'secondary' &&\n css`\n font-weight: ${theme.base['font-weight']['semi-bold']};\n `}\n `;\n }\n);\n\nStyledAppHeaderText.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderOperator = styled.button(\n ({ theme }) => css`\n border-radius: 50%;\n\n :focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n `\n);\n\nStyledAppHeaderOperator.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeader = styled.header<{ hideTitle: boolean; drawerOpen: boolean }>(\n ({ hideTitle, drawerOpen, theme }) => {\n const headerColor = theme.components['app-shell'].header['background-color'];\n const contrastColor = tryCatch(() => readableColor(headerColor));\n const hoverColors = getHoverColors(mix(0.01, theme.base.palette.interactive, headerColor));\n\n return css`\n position: sticky;\n z-index: calc(${theme.base['z-index'].backdrop} - 1);\n ${drawerOpen &&\n css`\n z-index: calc(${theme.base['z-index'].backdrop} - 2);\n `}\n top: 0;\n gap: ${theme.base.spacing};\n max-width: 100%;\n height: ${headerHeight};\n background-color: ${headerColor};\n border-bottom: solid 0.0625rem ${theme.base.palette['border-line']};\n\n ${StyledAppHeaderInfo} {\n justify-self: flex-start;\n min-width: 33vw;\n\n ${hideTitle &&\n css`\n min-width: fit-content;\n `}\n }\n\n > ${StyledAppHeaderOperator} {\n justify-self: flex-end;\n\n + ${StyledPopover} {\n &,\n ${StyledMenuListContainer} {\n background-color: ${headerColor};\n }\n\n ${StyledMenuListContainer} li {\n color: ${contrastColor};\n background-color: transparent;\n\n &:hover,\n &[data-current='true'] {\n color: ${hoverColors.foreground};\n background-color: ${hoverColors.background};\n }\n }\n }\n }\n `;\n }\n);\n\nStyledAppHeader.defaultProps = defaultThemeProp;\n"]}
1
+ {"version":3,"file":"AppHeader.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;A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F,WAAW;uCACE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;;QAEhE,mBAAmB;;;;UAIjB,SAAS;QACX,GAAG,CAAA;;SAEF;;;UAGC,uBAAuB;;;YAGrB,aAAa;;YAEb,uBAAuB;gCACH,WAAW;;;YAG/B,uBAAuB;qBACd,aAAa;;;;;uBAKX,WAAW,CAAC,UAAU;kCACX,WAAW,CAAC,UAAU;;;;;KAKnD,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { mix, readableColor, rgba } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport { calculateFontSize, getHoverColors } from '../../styles';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { StyledImage } from '../Image';\nimport { StyledMenuListContainer } from '../Menu/Menu.styles';\nimport { StyledPopover } from '../Popover';\nimport { StyledSearchInput } from '../SearchInput';\nimport { StyledSearchButton, StyledSearchTextInput } from '../SearchInput/SearchInput.styles';\nimport Text from '../Text';\nimport type { TextProps } from '../Text';\n\nimport { headerHeight, navWidth } from './AppShell.styles';\n\nexport const StyledContextSwitcher = styled.div(({ theme }) => {\n return css`\n width: calc(${navWidth} - 2 * ${theme.base.spacing});\n `;\n});\n\nStyledContextSwitcher.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderInfo = styled.div<{ centerLogo: boolean }>(({ centerLogo, theme }) => {\n return css`\n & > :first-child {\n vertical-align: top;\n }\n\n & > :is(a, button) {\n cursor: pointer;\n text-decoration: none;\n user-select: none;\n -webkit-user-select: none;\n }\n\n & > :is(a, button):focus {\n box-shadow: ${theme.base.shadow.focus};\n outline: none;\n }\n\n ${StyledImage} {\n height: 1.625rem;\n\n ${centerLogo &&\n css`\n padding-inline-start: ${theme.base.spacing};\n `}\n }\n `;\n});\n\nStyledAppHeaderInfo.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSearchForm = styled.form<{ isMediumOrAbove: boolean }>(\n ({ isMediumOrAbove, theme }) => {\n const headerColor = theme.components['app-shell'].header['background-color'];\n const contrastColor = tryCatch(() => readableColor(headerColor));\n\n return css`\n max-width: 33vw;\n min-width: 10rem;\n width: 100%;\n justify-self: center;\n margin-inline-start: 0;\n margin-inline-end: auto;\n transition: max-width ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n\n ${!isMediumOrAbove &&\n css`\n max-width: 75%;\n min-width: 2rem;\n margin-inline-start: auto;\n\n &:not([focused]) {\n ${StyledSearchInput} {\n ${StyledSearchButton} {\n background: ${headerColor};\n color: ${contrastColor};\n }\n\n ${StyledSearchTextInput} {\n background: ${headerColor};\n }\n }\n }\n\n &:focus-within {\n min-width: 10rem;\n }\n `}\n `;\n }\n);\n\nStyledAppHeaderSearchForm.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSpacer = styled.div`\n margin: auto;\n`;\n\nexport const StyledAppHeaderText = styled(Text)<{ variant: TextProps['variant'] }>(\n ({ theme, variant }) => {\n const contrastColor = tryCatch(() =>\n readableColor(theme.components['app-shell'].header['background-color'])\n );\n const secondaryColor = tryCatch(() =>\n rgba(\n contrastColor ?? theme.base.palette['foreground-color'],\n theme.base.transparency['transparent-2']\n )\n );\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n color: ${variant === 'secondary' ? secondaryColor : contrastColor};\n font-size: ${fontSize.s};\n\n ${variant !== 'secondary' &&\n css`\n font-weight: ${theme.base['font-weight']['semi-bold']};\n `}\n `;\n }\n);\n\nStyledAppHeaderText.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderOperator = styled.button(\n ({ theme }) => css`\n border-radius: 50%;\n\n :focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n `\n);\n\nStyledAppHeaderOperator.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeader = styled.header<{ hideTitle: boolean; drawerOpen: boolean }>(\n ({ hideTitle, drawerOpen, theme }) => {\n const headerColor = theme.components['app-shell'].header['background-color'];\n const contrastColor = tryCatch(() => readableColor(headerColor));\n const hoverColors = getHoverColors(mix(0.01, theme.base.palette.interactive, headerColor));\n\n return css`\n position: sticky;\n z-index: calc(${theme.base['z-index'].backdrop} - 1);\n ${drawerOpen &&\n css`\n z-index: calc(${theme.base['z-index'].backdrop} - 2);\n `}\n top: 0;\n gap: ${theme.base.spacing};\n max-width: 100%;\n height: ${headerHeight};\n background-color: ${headerColor};\n border-bottom: solid 0.0625rem ${theme.base.palette['border-line']};\n\n ${StyledAppHeaderInfo} {\n justify-self: flex-start;\n min-width: 33vw;\n\n ${hideTitle &&\n css`\n min-width: fit-content;\n `}\n }\n\n > ${StyledAppHeaderOperator} {\n justify-self: flex-end;\n\n + ${StyledPopover} {\n &,\n ${StyledMenuListContainer} {\n background-color: ${headerColor};\n }\n\n ${StyledMenuListContainer} li {\n color: ${contrastColor};\n background-color: transparent;\n\n &:hover,\n &[data-current='true'] {\n color: ${hoverColors.foreground};\n background-color: ${hoverColors.background};\n }\n }\n }\n }\n `;\n }\n);\n\nStyledAppHeader.defaultProps = defaultThemeProp;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/Drawer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AA+BvC,UAAU,eAAe;IACvB,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;sGASE,eAAe;AAPlB,wBAyFE"}
1
+ {"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/Drawer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AA+BvC,UAAU,eAAe;IACvB,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;sGASE,eAAe;AAPlB,wBA0FE"}
@@ -26,13 +26,14 @@ export default ({ content, header, onDrawerOpen, onDrawerClose, drawerOpen, setD
26
26
  setDrawerOpen(false);
27
27
  }, drawerEl, [drawerEl]);
28
28
  useFocusTrap(drawerRef);
29
- const { foreground, interactive } = navContrastColors(theme);
29
+ const { foreground, interactive, urgent } = navContrastColors(theme);
30
30
  const navTheme = {
31
31
  base: {
32
32
  palette: {
33
33
  'primary-background': theme.components['app-shell'].nav['background-color'],
34
34
  'foreground-color': foreground,
35
- interactive
35
+ interactive,
36
+ urgent
36
37
  }
37
38
  }
38
39
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/components/AppShell/Drawer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG3C,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAC;AAC/D,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,YAAY,EACZ,OAAO,EACP,QAAQ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,IAAC,IAAI,EAAE,SAAS,KAAK,EAAE,GAAI,GACrB,EACb,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,EAAC,EAAE,EAAE,QAAQ,YAC5B,MAAM,GACF,IACF,EACP,KAAC,IAAI,IACH,EAAE,EAAE,yBAAyB,EAC7B,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,qBACjB,QAAQ,YAExB,OAAO,GACH,IACA,GACK,CACjB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useContext, useRef } from 'react';\nimport type { ReactNode } from 'react';\n\nimport BareButton from '../Button/BareButton';\nimport Drawer from '../Drawer';\nimport Flex from '../Flex';\nimport Icon, { registerIcon } from '../Icon';\nimport * as arrowLeftIcon from '../Icon/icons/arrow-left.icon';\nimport Text from '../Text';\nimport {\n useConsolidatedRef,\n useDirection,\n useElement,\n useEscape,\n useFocusTrap,\n useI18n,\n useTheme,\n useUID\n} from '../../hooks';\nimport Configuration from '../Configuration/Configuration';\n\nimport AppShellContext from './AppShellContext';\nimport {\n StyledDrawerWrapper,\n StyledDrawerBackButton,\n StyledDrawerHeading,\n StyledDrawerListContainer\n} from './Drawer.styles';\nimport { navContrastColors } from './style-utils';\n\nregisterIcon(arrowLeftIcon);\n\ninterface DrawerViewProps {\n content: ReactNode;\n header: string;\n onDrawerOpen?: () => void;\n onDrawerClose?: () => void;\n drawerOpen: boolean;\n setDrawerOpen: (open: boolean) => void;\n}\n\nexport default ({\n content,\n header,\n onDrawerOpen,\n onDrawerClose,\n drawerOpen,\n setDrawerOpen\n}: DrawerViewProps) => {\n const t = useI18n();\n const theme = useTheme();\n const { focusedImperatively } = useContext(AppShellContext);\n const { start } = useDirection();\n const returnFocusRef = useRef<HTMLElement>();\n const [drawerEl, setDrawerEl] = useElement<HTMLDivElement>();\n const drawerRef = useConsolidatedRef(setDrawerEl);\n const backButtonRef = useRef<HTMLButtonElement>(null);\n const headerId = useUID();\n\n useEscape(\n () => {\n setDrawerOpen(false);\n },\n drawerEl,\n [drawerEl]\n );\n\n useFocusTrap(drawerRef);\n\n const { foreground, interactive } = navContrastColors(theme);\n const navTheme = {\n base: {\n palette: {\n 'primary-background': theme.components['app-shell'].nav['background-color'],\n 'foreground-color': foreground,\n interactive\n }\n }\n };\n\n return (\n <Configuration theme={navTheme} portalTarget={drawerEl ?? undefined}>\n <Drawer\n role='dialog'\n aria-labelledby={headerId}\n as={StyledDrawerWrapper}\n position='fixed'\n placement={start}\n open={drawerOpen}\n nullWhenClosed\n onBeforeOpen={() => {\n returnFocusRef.current = (document.activeElement as HTMLElement) ?? undefined;\n }}\n onAfterOpen={() => {\n if (backButtonRef.current && document.activeElement !== backButtonRef.current) {\n focusedImperatively.current = true;\n backButtonRef.current.focus();\n }\n onDrawerOpen?.();\n }}\n onAfterClose={() => {\n onDrawerClose?.();\n returnFocusRef.current?.focus();\n }}\n onOuterClick={() => setDrawerOpen(false)}\n ref={drawerRef}\n >\n <Flex as={StyledDrawerHeading} container={{ alignItems: 'center' }}>\n <BareButton\n as={StyledDrawerBackButton}\n ref={backButtonRef}\n onClick={() => setDrawerOpen(false)}\n aria-label={t('close_noun', [header])}\n >\n <Icon name={`arrow-${start}`} />\n </BareButton>\n <Text variant='h2' id={headerId}>\n {header}\n </Text>\n </Flex>\n <Flex\n as={StyledDrawerListContainer}\n container={{ direction: 'column' }}\n aria-labelledby={headerId}\n >\n {content}\n </Flex>\n </Drawer>\n </Configuration>\n );\n};\n"]}
1
+ {"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/components/AppShell/Drawer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG3C,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,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U,IACT,EAAE,EAAE,sBAAsB,EAC1B,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,gBACvB,CAAC,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC,YAErC,KAAC,IAAI,IAAC,IAAI,EAAE,SAAS,KAAK,EAAE,GAAI,GACrB,EACb,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,EAAC,EAAE,EAAE,QAAQ,YAC5B,MAAM,GACF,IACF,EACP,KAAC,IAAI,IACH,EAAE,EAAE,yBAAyB,EAC7B,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,qBACjB,QAAQ,YAExB,OAAO,GACH,IACA,GACK,CACjB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useContext, useRef } from 'react';\nimport type { ReactNode } from 'react';\n\nimport BareButton from '../Button/BareButton';\nimport Drawer from '../Drawer';\nimport Flex from '../Flex';\nimport Icon, { registerIcon } from '../Icon';\nimport * as arrowLeftIcon from '../Icon/icons/arrow-left.icon';\nimport Text from '../Text';\nimport {\n useConsolidatedRef,\n useDirection,\n useElement,\n useEscape,\n useFocusTrap,\n useI18n,\n useTheme,\n useUID\n} from '../../hooks';\nimport Configuration from '../Configuration/Configuration';\n\nimport AppShellContext from './AppShellContext';\nimport {\n StyledDrawerWrapper,\n StyledDrawerBackButton,\n StyledDrawerHeading,\n StyledDrawerListContainer\n} from './Drawer.styles';\nimport { navContrastColors } from './style-utils';\n\nregisterIcon(arrowLeftIcon);\n\ninterface DrawerViewProps {\n content: ReactNode;\n header: string;\n onDrawerOpen?: () => void;\n onDrawerClose?: () => void;\n drawerOpen: boolean;\n setDrawerOpen: (open: boolean) => void;\n}\n\nexport default ({\n content,\n header,\n onDrawerOpen,\n onDrawerClose,\n drawerOpen,\n setDrawerOpen\n}: DrawerViewProps) => {\n const t = useI18n();\n const theme = useTheme();\n const { focusedImperatively } = useContext(AppShellContext);\n const { start } = useDirection();\n const returnFocusRef = useRef<HTMLElement>();\n const [drawerEl, setDrawerEl] = useElement<HTMLDivElement>();\n const drawerRef = useConsolidatedRef(setDrawerEl);\n const backButtonRef = useRef<HTMLButtonElement>(null);\n const headerId = useUID();\n\n useEscape(\n () => {\n setDrawerOpen(false);\n },\n drawerEl,\n [drawerEl]\n );\n\n useFocusTrap(drawerRef);\n\n const { foreground, interactive, urgent } = navContrastColors(theme);\n const navTheme = {\n base: {\n palette: {\n 'primary-background': theme.components['app-shell'].nav['background-color'],\n 'foreground-color': foreground,\n interactive,\n urgent\n }\n }\n };\n\n return (\n <Configuration theme={navTheme} portalTarget={drawerEl ?? undefined}>\n <Drawer\n role='dialog'\n aria-labelledby={headerId}\n as={StyledDrawerWrapper}\n position='fixed'\n placement={start}\n open={drawerOpen}\n nullWhenClosed\n onBeforeOpen={() => {\n returnFocusRef.current = (document.activeElement as HTMLElement) ?? undefined;\n }}\n onAfterOpen={() => {\n if (backButtonRef.current && document.activeElement !== backButtonRef.current) {\n focusedImperatively.current = true;\n backButtonRef.current.focus();\n }\n onDrawerOpen?.();\n }}\n onAfterClose={() => {\n onDrawerClose?.();\n returnFocusRef.current?.focus();\n }}\n onOuterClick={() => setDrawerOpen(false)}\n ref={drawerRef}\n >\n <Flex as={StyledDrawerHeading} container={{ alignItems: 'center' }}>\n <BareButton\n as={StyledDrawerBackButton}\n ref={backButtonRef}\n onClick={() => setDrawerOpen(false)}\n aria-label={t('close_noun', [header])}\n >\n <Icon name={`arrow-${start}`} />\n </BareButton>\n <Text variant='h2' id={headerId}>\n {header}\n </Text>\n </Flex>\n <Flex\n as={StyledDrawerListContainer}\n container={{ direction: 'column' }}\n aria-labelledby={headerId}\n >\n {content}\n </Flex>\n </Drawer>\n </Configuration>\n );\n};\n"]}
@@ -4,6 +4,7 @@ export declare const navContrastColors: (theme: DefaultTheme) => {
4
4
  foreground: string;
5
5
  border: string;
6
6
  interactive: string;
7
+ urgent: string;
7
8
  };
8
9
  export declare const pxToRem: (n: number) => string;
9
10
  //# sourceMappingURL=style-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"style-utils.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/style-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,eAAO,MAAM,iBAAiB,UACrB,YAAY;aAEV,MAAM;gBACH,MAAM;YACV,MAAM;iBACD,MAAM;CA2BpB,CAAC;AAEF,eAAO,MAAM,OAAO,MAAO,MAAM,KAAG,MAA4B,CAAC"}
1
+ {"version":3,"file":"style-utils.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/style-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,eAAO,MAAM,iBAAiB,UACrB,YAAY;aAEV,MAAM;gBACH,MAAM;YACV,MAAM;iBACD,MAAM;YACX,MAAM;CA6Bf,CAAC;AAEF,eAAO,MAAM,OAAO,MAAO,MAAM,KAAG,MAA4B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { darken, getContrast, lighten, readableColor, transparentize } from 'polished';
2
2
  import { readableHue } from '../../styles';
3
3
  export const navContrastColors = (theme) => {
4
- const { base: { palette: { interactive } }, components: { 'app-shell': { nav: { 'background-color': navBg } } } } = theme;
4
+ const { base: { palette: { interactive, urgent } }, components: { 'app-shell': { nav: { 'background-color': navBg } } } } = theme;
5
5
  let hoverBg = darken(0.05, navBg);
6
6
  if (getContrast(navBg, hoverBg) === 1) {
7
7
  hoverBg = lighten(0.15, navBg);
@@ -9,11 +9,13 @@ export const navContrastColors = (theme) => {
9
9
  const foregroundColor = readableColor(navBg);
10
10
  const borderColor = transparentize(0.8, foregroundColor);
11
11
  const interactiveColor = readableHue(interactive, navBg);
12
+ const urgentColor = readableHue(urgent, navBg);
12
13
  return {
13
14
  hoverBg,
14
15
  foreground: foregroundColor,
15
16
  border: borderColor,
16
- interactive: interactiveColor
17
+ interactive: interactiveColor,
18
+ urgent: urgentColor
17
19
  };
18
20
  };
19
21
  export const pxToRem = (n) => `${n * 0.0625}rem`;
@@ -1 +1 @@
1
- {"version":3,"file":"style-utils.js","sourceRoot":"","sources":["../../../src/components/AppShell/style-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGvF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,KAAmB,EAMnB,EAAE;IACF,MAAM,EACJ,IAAI,EAAE,EACJ,OAAO,EAAE,EAAE,WAAW,EAAE,EACzB,EACD,UAAU,EAAE,EACV,WAAW,EAAE,EACX,GAAG,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,EACnC,EACF,EACF,GAAG,KAAK,CAAC;IACV,IAAI,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,IAAI,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE;QACrC,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;KAChC;IAED,MAAM,eAAe,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IACzD,MAAM,gBAAgB,GAAG,WAAW,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAEzD,OAAO;QACL,OAAO;QACP,UAAU,EAAE,eAAe;QAC3B,MAAM,EAAE,WAAW;QACnB,WAAW,EAAE,gBAAgB;KAC9B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,GAAG,CAAC,GAAG,MAAM,KAAK,CAAC","sourcesContent":["import { darken, getContrast, lighten, readableColor, transparentize } from 'polished';\nimport type { DefaultTheme } from 'styled-components';\n\nimport { readableHue } from '../../styles';\n\nexport const navContrastColors = (\n theme: DefaultTheme\n): {\n hoverBg: string;\n foreground: string;\n border: string;\n interactive: string;\n} => {\n const {\n base: {\n palette: { interactive }\n },\n components: {\n 'app-shell': {\n nav: { 'background-color': navBg }\n }\n }\n } = theme;\n let hoverBg = darken(0.05, navBg);\n if (getContrast(navBg, hoverBg) === 1) {\n hoverBg = lighten(0.15, navBg);\n }\n\n const foregroundColor = readableColor(navBg);\n const borderColor = transparentize(0.8, foregroundColor);\n const interactiveColor = readableHue(interactive, navBg);\n\n return {\n hoverBg,\n foreground: foregroundColor,\n border: borderColor,\n interactive: interactiveColor\n };\n};\n\nexport const pxToRem = (n: number): string => `${n * 0.0625}rem`;\n"]}
1
+ {"version":3,"file":"style-utils.js","sourceRoot":"","sources":["../../../src/components/AppShell/style-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGvF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,KAAmB,EAOnB,EAAE;IACF,MAAM,EACJ,IAAI,EAAE,EACJ,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,EACjC,EACD,UAAU,EAAE,EACV,WAAW,EAAE,EACX,GAAG,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,EACnC,EACF,EACF,GAAG,KAAK,CAAC;IACV,IAAI,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,IAAI,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE;QACrC,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;KAChC;IAED,MAAM,eAAe,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IACzD,MAAM,gBAAgB,GAAG,WAAW,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IACzD,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAE/C,OAAO;QACL,OAAO;QACP,UAAU,EAAE,eAAe;QAC3B,MAAM,EAAE,WAAW;QACnB,WAAW,EAAE,gBAAgB;QAC7B,MAAM,EAAE,WAAW;KACpB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,GAAG,CAAC,GAAG,MAAM,KAAK,CAAC","sourcesContent":["import { darken, getContrast, lighten, readableColor, transparentize } from 'polished';\nimport type { DefaultTheme } from 'styled-components';\n\nimport { readableHue } from '../../styles';\n\nexport const navContrastColors = (\n theme: DefaultTheme\n): {\n hoverBg: string;\n foreground: string;\n border: string;\n interactive: string;\n urgent: string;\n} => {\n const {\n base: {\n palette: { interactive, urgent }\n },\n components: {\n 'app-shell': {\n nav: { 'background-color': navBg }\n }\n }\n } = theme;\n let hoverBg = darken(0.05, navBg);\n if (getContrast(navBg, hoverBg) === 1) {\n hoverBg = lighten(0.15, navBg);\n }\n\n const foregroundColor = readableColor(navBg);\n const borderColor = transparentize(0.8, foregroundColor);\n const interactiveColor = readableHue(interactive, navBg);\n const urgentColor = readableHue(urgent, navBg);\n\n return {\n hoverBg,\n foreground: foregroundColor,\n border: borderColor,\n interactive: interactiveColor,\n urgent: urgentColor\n };\n};\n\nexport const pxToRem = (n: number): string => `${n * 0.0625}rem`;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Selection.d.ts","sourceRoot":"","sources":["../../../src/components/Badges/Selection.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,UAAU,EAAwB,aAAa,EAAE,MAAM,OAAO,CAAC;AA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KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;CAC1C;AAED,eAAO,MAAM,gBAAgB,4GAgE5B,CAAC;;;;AAkEF,wBAA6D"}
@@ -1,27 +1,27 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
- import { mix, transparentize } from 'polished';
4
+ import { mix, readableColor, transparentize } from 'polished';
5
5
  import { tryCatch, withTestIds } from '../../utils';
6
6
  import BareButton, { StyledBareButton } from '../Button/BareButton';
7
7
  import Icon, { registerIcon, StyledIcon } from '../Icon';
8
8
  import * as timesIcon from '../Icon/icons/times.icon';
9
9
  import { useConsolidatedRef, useI18n, useTestIds } from '../../hooks';
10
10
  import { defaultThemeProp } from '../../theme';
11
+ import { readableHue } from '../../styles';
11
12
  import { getSelectableTestIds } from './Badges.test-ids';
12
13
  registerIcon(timesIcon);
13
- export const StyledSelectable = styled.button(({ theme: { base: { spacing, palette, 'border-radius': borderRadius }, components: { badges: { selectable } } } }) => {
14
- const { foreground, background } = selectable.base;
14
+ export const StyledSelectable = styled.button(({ theme: { base: { spacing, palette, 'border-radius': borderRadius } } }) => {
15
15
  const { dark, 'primary-background': primaryBackground, interactive } = palette;
16
- const displayBackground = tryCatch(() => mix(0.15, background, primaryBackground));
17
- const hoverBorder = tryCatch(() => mix(0.3, background, primaryBackground));
16
+ const displayBackground = tryCatch(() => mix(0.15, interactive, primaryBackground));
17
+ const hoverBorder = tryCatch(() => mix(0.3, interactive, primaryBackground));
18
18
  const boxShadowColor = tryCatch(() => transparentize(0.45, dark));
19
19
  const height = 1.125;
20
20
  return css `
21
- background: ${displayBackground};
21
+ background-color: ${displayBackground};
22
22
  border: 0 solid transparent;
23
23
  border-radius: calc(${height} * ${borderRadius});
24
- color: ${foreground};
24
+ color: ${tryCatch(() => readableColor(displayBackground))};
25
25
  cursor: default;
26
26
  display: inline-flex;
27
27
  font-size: 0.75rem;
@@ -37,27 +37,28 @@ export const StyledSelectable = styled.button(({ theme: { base: { spacing, palet
37
37
  line-height: normal;
38
38
  }
39
39
 
40
- &:hover {
41
- color: ${interactive};
42
- box-shadow: inset 0 0 0 0.0625rem ${hoverBorder};
40
+ &hover,
41
+ &:focus,
42
+ [data-active-scope='true'] &[data-current='true'] {
43
+ color: ${tryCatch(() => readableHue(interactive, displayBackground))};
43
44
 
44
45
  ${StyledBareButton} {
45
- color: ${interactive};
46
+ color: inherit;
46
47
  }
47
48
  }
48
49
 
50
+ &:hover {
51
+ box-shadow: inset 0 0 0 0.0625rem ${hoverBorder};
52
+ }
53
+
49
54
  &:active {
50
- box-shadow: inset 0 0 0 0.0625rem ${background};
55
+ box-shadow: inset 0 0 0 0.0625rem ${interactive};
51
56
  }
52
57
 
53
58
  &:focus {
54
59
  color: ${interactive};
55
- box-shadow: 0 0 0.5rem -0.125rem ${boxShadowColor}, inset 0 0 0 0.125rem ${background};
60
+ box-shadow: 0 0 0.5rem -0.125rem ${boxShadowColor}, inset 0 0 0 0.125rem ${interactive};
56
61
  outline: none;
57
-
58
- ${StyledBareButton} {
59
- color: ${interactive};
60
- }
61
62
  }
62
63
 
63
64
  ${StyledIcon} {
@@ -90,7 +91,7 @@ const Selectable = forwardRef(function Selectable({ testId, id, children, onSele
90
91
  onRemove?.(id);
91
92
  }
92
93
  };
93
- return (_jsxs(StyledSelectable, { "data-testid": testIds.root, ref: consolidatedRef, onClick: handleClick, onKeyUp: handleKeyUp, ...restProps, children: [_jsx("span", { children: children }), onRemove && (_jsx(BareButton, { "data-testid": testIds.remove, tabIndex: '-1', onClick: handleCloseClick, "aria-label": t('remove'), children: _jsx(Icon, { name: 'times' }) }))] }));
94
+ return (_jsxs(StyledSelectable, { "data-testid": testIds.root, ref: consolidatedRef, onClick: handleClick, onKeyUp: handleKeyUp, ...restProps, children: [_jsx("span", { "aria-hidden": true, children: children }), onRemove && (_jsx(BareButton, { "data-testid": testIds.remove, tabIndex: '-1', onClick: handleCloseClick, "aria-label": t('remove_noun', [children]), children: _jsx(Icon, { name: 'times' }) }))] }));
94
95
  });
95
96
  export default withTestIds(Selectable, getSelectableTestIds);
96
97
  //# sourceMappingURL=Selection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Selection.js","sourceRoot":"","sources":["../../../src/components/Badges/Selection.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,UAAU,EAAE,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,YAAY,CAAC,SAAS,CAAC,CAAC;AAiBxB,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAC3C,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,EACzD,UAAU,EAAE,EACV,MAAM,EAAE,EAAE,UAAU,EAAE,EACvB,EACF,EACF,EAAE,EAAE;IACH,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC;IACnD,MAAM,EAAE,IAAI,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,WAAW,EAAE,GAAG,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AE,CAAC,CAAC;IACjB,CAAC,CAAC;IAEF,MAAM,gBAAgB,GAAG,CAAC,CAAa,EAAE,EAAE;QACzC,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,CAAgB,EAAE,EAAE;QACvC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;QACb,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE;YACrB,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;SAChB;QAED,IAAI,CAAC,CAAC,GAAG,KAAK,WAAW,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,EAAE;YAC/C,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;SAChB;IACH,CAAC,CAAC;IAEF,OAAO,CACL,MAAC,gBAAgB,mBACF,OAAO,CAAC,IAAI,EACzB,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,KAChB,SAAS,aAEb,yBAAO,QAAQ,GAAQ,EACtB,QAAQ,IAAI,CACX,KAAC,UAAU,mBACI,OAAO,CAAC,MAAM,EAC3B,QAAQ,EAAC,IAAI,EACb,OAAO,EAAE,gBAAgB,gBACb,CAAC,CAAC,QAAQ,CAAC,YAEvB,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,GACV,CACd,IACgB,CACpB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { FC, MouseEvent, PropsWithoutRef, Ref, KeyboardEvent } from 'react';\nimport styled, { css } from 'styled-components';\nimport { mix, transparentize } from 'polished';\n\nimport type { ForwardProps, TestIdProp } from '../../types';\nimport { tryCatch, withTestIds } from '../../utils';\nimport BareButton, { StyledBareButton } from '../Button/BareButton';\nimport Icon, { registerIcon, StyledIcon } from '../Icon';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport { useConsolidatedRef, useI18n, useTestIds } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\n\nimport { getSelectableTestIds } from './Badges.test-ids';\n\nregisterIcon(timesIcon);\n\nexport interface SelectableProps extends TestIdProp {\n /** An id that is used by the onSelect and onRemove functions if they are provided. */\n id: string;\n /** The content of the Badge. */\n children: string;\n /** Takes an ID that represents the Badge. This function is called when the Badge is clicked. */\n onSelect?: (id: string) => void;\n /** Takes an ID that represents the Badge. This function is called when the Badge is closed by clicking the X. */\n onRemove?: (id: string) => void;\n /** Event handler called when the Badge is clicked. */\n onClick?: (event: MouseEvent) => void;\n /** Event handler fired on every keyup event. */\n onKeyUp?: (event: KeyboardEvent) => void;\n}\n\nexport const StyledSelectable = styled.button(\n ({\n theme: {\n base: { spacing, palette, 'border-radius': borderRadius },\n components: {\n badges: { selectable }\n }\n }\n }) => {\n const { foreground, background } = selectable.base;\n const { dark, 'primary-background': primaryBackground, interactive } = palette;\n\n const displayBackground = tryCatch(() => mix(0.15, background, primaryBackground));\n const hoverBorder = tryCatch(() => mix(0.3, background, primaryBackground));\n const boxShadowColor = tryCatch(() => transparentize(0.45, dark));\n\n const height = 1.125;\n return css`\n background: ${displayBackground};\n border: 0 solid transparent;\n border-radius: calc(${height} * ${borderRadius});\n color: ${foreground};\n cursor: default;\n display: inline-flex;\n font-size: 0.75rem;\n height: ${height}rem;\n padding: 0 ${spacing};\n max-width: 100%;\n line-height: 1;\n\n span {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n line-height: normal;\n }\n\n &:hover {\n color: ${interactive};\n box-shadow: inset 0 0 0 0.0625rem ${hoverBorder};\n\n ${StyledBareButton} {\n color: ${interactive};\n }\n }\n\n &:active {\n box-shadow: inset 0 0 0 0.0625rem ${background};\n }\n\n &:focus {\n color: ${interactive};\n box-shadow: 0 0 0.5rem -0.125rem ${boxShadowColor}, inset 0 0 0 0.125rem ${background};\n outline: none;\n\n ${StyledBareButton} {\n color: ${interactive};\n }\n }\n\n ${StyledIcon} {\n margin-inline-start: ${spacing};\n height: 1em;\n width: 1em;\n }\n `;\n }\n);\n\nStyledSelectable.defaultProps = defaultThemeProp;\n\nconst Selectable: FC<SelectableProps & ForwardProps> = forwardRef(function Selectable(\n {\n testId,\n id,\n children,\n onSelect,\n onRemove,\n onClick,\n onKeyUp,\n ...restProps\n }: PropsWithoutRef<SelectableProps>,\n ref: Ref<HTMLButtonElement>\n) {\n const consolidatedRef = useConsolidatedRef(ref);\n const t = useI18n();\n const testIds = useTestIds(testId, getSelectableTestIds);\n\n const handleClick = (e: MouseEvent<HTMLButtonElement>) => {\n onClick?.(e);\n onSelect?.(id);\n };\n\n const handleCloseClick = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n onRemove?.(id);\n };\n\n const handleKeyUp = (e: KeyboardEvent) => {\n onKeyUp?.(e);\n if (e.key === 'Enter') {\n onSelect?.(id);\n }\n\n if (e.key === 'Backspace' || e.key === 'Delete') {\n onRemove?.(id);\n }\n };\n\n return (\n <StyledSelectable\n data-testid={testIds.root}\n ref={consolidatedRef}\n onClick={handleClick}\n onKeyUp={handleKeyUp}\n {...restProps}\n >\n <span>{children}</span>\n {onRemove && (\n <BareButton\n data-testid={testIds.remove}\n tabIndex='-1'\n onClick={handleCloseClick}\n aria-label={t('remove')}\n >\n <Icon name='times' />\n </BareButton>\n )}\n </StyledSelectable>\n );\n});\n\nexport default withTestIds(Selectable, getSelectableTestIds);\n"]}
1
+ {"version":3,"file":"Selection.js","sourceRoot":"","sources":["../../../src/components/Badges/Selection.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,cAAc,EAAE,M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EAAE;YACrB,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;SAChB;QAED,IAAI,CAAC,CAAC,GAAG,KAAK,WAAW,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,EAAE;YAC/C,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;SAChB;IACH,CAAC,CAAC;IAEF,OAAO,CACL,MAAC,gBAAgB,mBACF,OAAO,CAAC,IAAI,EACzB,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,KAChB,SAAS,aAEb,8CAAmB,QAAQ,GAAQ,EAClC,QAAQ,IAAI,CACX,KAAC,UAAU,mBACI,OAAO,CAAC,MAAM,EAC3B,QAAQ,EAAC,IAAI,EACb,OAAO,EAAE,gBAAgB,gBACb,CAAC,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,CAAC,YAExC,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,GACV,CACd,IACgB,CACpB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { FC, MouseEvent, PropsWithoutRef, Ref, KeyboardEvent } from 'react';\nimport styled, { css } from 'styled-components';\nimport { mix, readableColor, transparentize } from 'polished';\n\nimport type { ForwardProps, TestIdProp } from '../../types';\nimport { tryCatch, withTestIds } from '../../utils';\nimport BareButton, { StyledBareButton } from '../Button/BareButton';\nimport Icon, { registerIcon, StyledIcon } from '../Icon';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport { useConsolidatedRef, useI18n, useTestIds } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { readableHue } from '../../styles';\n\nimport { getSelectableTestIds } from './Badges.test-ids';\n\nregisterIcon(timesIcon);\n\nexport interface SelectableProps extends TestIdProp {\n /** An id that is used by the onSelect and onRemove functions if they are provided. */\n id: string;\n /** The content of the Badge. */\n children: string;\n /** Takes an ID that represents the Badge. This function is called when the Badge is clicked. */\n onSelect?: (id: string) => void;\n /** Takes an ID that represents the Badge. This function is called when the Badge is closed by clicking the X. */\n onRemove?: (id: string) => void;\n /** Event handler called when the Badge is clicked. */\n onClick?: (event: MouseEvent) => void;\n /** Event handler fired on every keyup event. */\n onKeyUp?: (event: KeyboardEvent) => void;\n}\n\nexport const StyledSelectable = styled.button(\n ({\n theme: {\n base: { spacing, palette, 'border-radius': borderRadius }\n }\n }) => {\n const { dark, 'primary-background': primaryBackground, interactive } = palette;\n\n const displayBackground = tryCatch(() => mix(0.15, interactive, primaryBackground));\n const hoverBorder = tryCatch(() => mix(0.3, interactive, primaryBackground));\n const boxShadowColor = tryCatch(() => transparentize(0.45, dark));\n\n const height = 1.125;\n return css`\n background-color: ${displayBackground};\n border: 0 solid transparent;\n border-radius: calc(${height} * ${borderRadius});\n color: ${tryCatch(() => readableColor(displayBackground!))};\n cursor: default;\n display: inline-flex;\n font-size: 0.75rem;\n height: ${height}rem;\n padding: 0 ${spacing};\n max-width: 100%;\n line-height: 1;\n\n span {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n line-height: normal;\n }\n\n &hover,\n &:focus,\n [data-active-scope='true'] &[data-current='true'] {\n color: ${tryCatch(() => readableHue(interactive, displayBackground!))};\n\n ${StyledBareButton} {\n color: inherit;\n }\n }\n\n &:hover {\n box-shadow: inset 0 0 0 0.0625rem ${hoverBorder};\n }\n\n &:active {\n box-shadow: inset 0 0 0 0.0625rem ${interactive};\n }\n\n &:focus {\n color: ${interactive};\n box-shadow: 0 0 0.5rem -0.125rem ${boxShadowColor}, inset 0 0 0 0.125rem ${interactive};\n outline: none;\n }\n\n ${StyledIcon} {\n margin-inline-start: ${spacing};\n height: 1em;\n width: 1em;\n }\n `;\n }\n);\n\nStyledSelectable.defaultProps = defaultThemeProp;\n\nconst Selectable: FC<SelectableProps & ForwardProps> = forwardRef(function Selectable(\n {\n testId,\n id,\n children,\n onSelect,\n onRemove,\n onClick,\n onKeyUp,\n ...restProps\n }: PropsWithoutRef<SelectableProps>,\n ref: Ref<HTMLButtonElement>\n) {\n const consolidatedRef = useConsolidatedRef(ref);\n const t = useI18n();\n const testIds = useTestIds(testId, getSelectableTestIds);\n\n const handleClick = (e: MouseEvent<HTMLButtonElement>) => {\n onClick?.(e);\n onSelect?.(id);\n };\n\n const handleCloseClick = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n onRemove?.(id);\n };\n\n const handleKeyUp = (e: KeyboardEvent) => {\n onKeyUp?.(e);\n if (e.key === 'Enter') {\n onSelect?.(id);\n }\n\n if (e.key === 'Backspace' || e.key === 'Delete') {\n onRemove?.(id);\n }\n };\n\n return (\n <StyledSelectable\n data-testid={testIds.root}\n ref={consolidatedRef}\n onClick={handleClick}\n onKeyUp={handleKeyUp}\n {...restProps}\n >\n <span aria-hidden>{children}</span>\n {onRemove && (\n <BareButton\n data-testid={testIds.remove}\n tabIndex='-1'\n onClick={handleCloseClick}\n aria-label={t('remove_noun', [children])}\n >\n <Icon name='times' />\n </BareButton>\n )}\n </StyledSelectable>\n );\n});\n\nexport default withTestIds(Selectable, getSelectableTestIds);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FieldGroupList.d.ts","sourceRoot":"","sources":["../../../src/components/FieldGroup/FieldGroupList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAGrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIpD,MAAM,MAAM,uBAAuB,GAAG,eAAe,GAAG;IACtD,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,oCAAoC;IACpC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,WAAW,mBAAmB;IACl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jsxs } from "react/jsx-runtime";
2
- import { forwardRef } from 'react';
2
+ import { forwardRef, useEffect, useRef } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import Button from '../Button';
5
5
  import Icon, { registerIcon } from '../Icon';
6
6
  import * as plusIcon from '../Icon/icons/plus.icon';
7
7
  import { useI18n } from '../../hooks';
8
8
  import { defaultThemeProp } from '../../theme';
9
+ import { getActiveElement, getFocusables } from '../../utils';
9
10
  import FieldGroup, { StyledFieldGroup } from './FieldGroup';
10
11
  registerIcon(plusIcon);
11
12
  const StyledFieldGroupList = styled.div(({ theme }) => css `
@@ -35,7 +36,25 @@ const StyledAddButton = styled(Button)(({ theme }) => css `
35
36
  StyledAddButton.defaultProps = defaultThemeProp;
36
37
  const FieldGroupList = forwardRef(function FieldGroupList({ items, onAdd, onDelete, ...restProps }, ref) {
37
38
  const t = useI18n();
38
- return (_jsxs(StyledFieldGroupList, { ref: ref, ...restProps, children: [items.map(({ id, children, name, headingTag, onDelete: itemOnDelete, ...restItemProps }) => {
39
+ const lastItemRef = useRef(null);
40
+ const addBtnRef = useRef(null);
41
+ useEffect(() => {
42
+ const currentActiveEl = getActiveElement();
43
+ if (currentActiveEl === addBtnRef.current && lastItemRef.current) {
44
+ const groupItemLegend = lastItemRef.current.querySelector(':scope > legend');
45
+ const focusables = getFocusables(lastItemRef.current);
46
+ const groupActionButtons = focusables.filter(focusable => groupItemLegend?.contains(focusable));
47
+ const groupContentFocusables = focusables.filter(focusable => !groupItemLegend?.contains(focusable));
48
+ if (groupContentFocusables.length > 0) {
49
+ groupContentFocusables[0].focus();
50
+ }
51
+ else {
52
+ groupActionButtons[0]?.focus();
53
+ }
54
+ }
55
+ }, [items.length]);
56
+ return (_jsxs(StyledFieldGroupList, { ref: ref, ...restProps, children: [items.map(({ id, children, name, headingTag, onDelete: itemOnDelete, ...restItemProps }, index) => {
57
+ const isLastItem = index === items.length - 1;
39
58
  return (_jsx(StyledListItem, { name: name, headingTag: headingTag, ...restItemProps, actions: onDelete || itemOnDelete
40
59
  ? [
41
60
  {
@@ -49,8 +68,8 @@ const FieldGroupList = forwardRef(function FieldGroupList({ items, onAdd, onDele
49
68
  }
50
69
  }
51
70
  ]
52
- : undefined, children: children }, id));
53
- }), onAdd && (_jsxs(StyledAddButton, { variant: 'link', onClick: onAdd, children: [_jsx(Icon, { name: 'plus' }), " ", t('add')] }))] }));
71
+ : undefined, ref: isLastItem ? lastItemRef : undefined, children: children }, id));
72
+ }), onAdd && (_jsxs(StyledAddButton, { variant: 'link', onClick: onAdd, ref: addBtnRef, children: [_jsx(Icon, { name: 'plus' }), " ", t('add')] }))] }));
54
73
  });
55
74
  export default FieldGroupList;
56
75
  //# sourceMappingURL=FieldGroupList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FieldGroupList.js","sourceRoot":"","sources":["../../../src/components/FieldGroup/FieldGroupList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,UAAU,EAAE,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAG5D,YAAY,CAAC,QAAQ,CAAC,CAAC;AAgBvB,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CACrC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACZ,GAAG,CAAA;4BACqB,KAAK,CAAC,IAAI,CAAC,OAAO;;QAEtC,gBAAgB;;;KAGnB,CACJ,CAAC;AAEF,oBAAoB,CAAC,YAAY,GAAG,g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E,IAAI;gCACd,OAAO,EAAE,GAAG,EAAE;oCACZ,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC;oCACnB,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;gCACjB,CAAC;6BACF;yBACF;wBACH,CAAC,CAAC,SAAS,YAGd,QAAQ,IArBJ,EAAE,CAsBQ,CAClB,CAAC;YACJ,CAAC,CACF,EACA,KAAK,IAAI,CACR,MAAC,eAAe,IAAC,OAAO,EAAC,MAAM,EAAC,OAAO,EAAE,KAAK,aAC5C,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,OAAE,CAAC,CAAC,KAAK,CAAC,IACd,CACnB,IACoB,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport type { ForwardProps } from '../../types';\nimport Button from '../Button';\nimport Icon, { registerIcon } from '../Icon';\nimport * as plusIcon from '../Icon/icons/plus.icon';\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\n\nimport FieldGroup, { StyledFieldGroup } from './FieldGroup';\nimport type { FieldGroupProps } from './FieldGroup';\n\nregisterIcon(plusIcon);\n\nexport type FieldGroupListItemProps = FieldGroupProps & {\n /** The ID of the field group list item */\n id: string;\n /** Item level onDelete callback. */\n onDelete?: (id: string) => void;\n};\n\nexport interface FieldGroupListProps {\n items: FieldGroupListItemProps[];\n onAdd?: () => void;\n onDelete?: (id: string) => void;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledFieldGroupList = styled.div(\n ({ theme }) =>\n css`\n margin-block-start: ${theme.base.spacing};\n\n ${StyledFieldGroup} {\n margin-block-start: 0;\n }\n `\n);\n\nStyledFieldGroupList.defaultProps = defaultThemeProp;\n\nexport const StyledListItem = styled(FieldGroup)(\n ({ theme }) =>\n css`\n padding: ${theme.base.spacing} 0 calc(2 * ${theme.base.spacing});\n\n &:not(:last-of-type) {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n margin-block-end: calc(2 * ${theme.base.spacing});\n }\n\n legend {\n margin-block-end: 0;\n }\n `\n);\n\nStyledListItem.defaultProps = defaultThemeProp;\n\nconst StyledAddButton = styled(Button)(\n ({ theme }) =>\n css`\n margin-top: ${theme.base.spacing};\n `\n);\n\nStyledAddButton.defaultProps = defaultThemeProp;\n\nconst FieldGroupList: FunctionComponent<FieldGroupListProps & ForwardProps> = forwardRef(\n function FieldGroupList(\n { items, onAdd, onDelete, ...restProps }: PropsWithoutRef<FieldGroupListProps>,\n ref: FieldGroupListProps['ref']\n ) {\n const t = useI18n();\n\n return (\n <StyledFieldGroupList ref={ref} {...restProps}>\n {items.map(\n ({\n id,\n children,\n name,\n headingTag,\n onDelete: itemOnDelete,\n ...restItemProps\n }: FieldGroupListItemProps) => {\n return (\n <StyledListItem\n key={id}\n name={name}\n headingTag={headingTag}\n {...restItemProps}\n actions={\n onDelete || itemOnDelete\n ? [\n {\n id: 'delete',\n text: t('delete'),\n icon: 'trash',\n iconOnly: true,\n onClick: () => {\n itemOnDelete?.(id);\n onDelete?.(id);\n }\n }\n ]\n : undefined\n }\n >\n {children}\n </StyledListItem>\n );\n }\n )}\n {onAdd && (\n <StyledAddButton variant='link' onClick={onAdd}>\n <Icon name='plus' /> {t('add')}\n </StyledAddButton>\n )}\n </StyledFieldGroupList>\n );\n }\n);\n\nexport default FieldGroupList;\n"]}
1
+ {"version":3,"file":"FieldGroupList.js","sourceRoot":"","sources":["../../../src/components/FieldGroup/FieldGroupList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE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K,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;gBAC9C,OAAO,CACL,KAAC,cAAc,IAEb,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,KAClB,aAAa,EACjB,OAAO,EACL,QAAQ,IAAI,YAAY;wBACtB,CAAC,CAAC;4BACE;gCACE,EAAE,EAAE,QAAQ;gCACZ,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC;gCACjB,IAAI,EAAE,OAAO;gCACb,QAAQ,EAAE,IAAI;gCACd,OAAO,EAAE,GAAG,EAAE;oCACZ,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC;oCACnB,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;gCACjB,CAAC;6BACF;yBACF;wBACH,CAAC,CAAC,SAAS,EAEf,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,YAExC,QAAQ,IAtBJ,EAAE,CAuBQ,CAClB,CAAC;YACJ,CAAC,CACF,EACA,KAAK,IAAI,CACR,MAAC,eAAe,IAAC,OAAO,EAAC,MAAM,EAAC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,aAC5D,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,OAAE,CAAC,CAAC,KAAK,CAAC,IACd,CACnB,IACoB,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { forwardRef, useEffect, useRef } from 'react';\nimport type { FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport type { ForwardProps } from '../../types';\nimport Button from '../Button';\nimport Icon, { registerIcon } from '../Icon';\nimport * as plusIcon from '../Icon/icons/plus.icon';\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { getActiveElement, getFocusables } from '../../utils';\n\nimport FieldGroup, { StyledFieldGroup } from './FieldGroup';\nimport type { FieldGroupProps } from './FieldGroup';\n\nregisterIcon(plusIcon);\n\nexport type FieldGroupListItemProps = FieldGroupProps & {\n /** The ID of the field group list item */\n id: string;\n /** Item level onDelete callback. */\n onDelete?: (id: string) => void;\n};\n\nexport interface FieldGroupListProps {\n items: FieldGroupListItemProps[];\n onAdd?: () => void;\n onDelete?: (id: string) => void;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledFieldGroupList = styled.div(\n ({ theme }) =>\n css`\n margin-block-start: ${theme.base.spacing};\n\n ${StyledFieldGroup} {\n margin-block-start: 0;\n }\n `\n);\n\nStyledFieldGroupList.defaultProps = defaultThemeProp;\n\nexport const StyledListItem = styled(FieldGroup)(\n ({ theme }) =>\n css`\n padding: ${theme.base.spacing} 0 calc(2 * ${theme.base.spacing});\n\n &:not(:last-of-type) {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n margin-block-end: calc(2 * ${theme.base.spacing});\n }\n\n legend {\n margin-block-end: 0;\n }\n `\n);\n\nStyledListItem.defaultProps = defaultThemeProp;\n\nconst StyledAddButton = styled(Button)(\n ({ theme }) =>\n css`\n margin-top: ${theme.base.spacing};\n `\n);\n\nStyledAddButton.defaultProps = defaultThemeProp;\n\nconst FieldGroupList: FunctionComponent<FieldGroupListProps & ForwardProps> = forwardRef(\n function FieldGroupList(\n { items, onAdd, onDelete, ...restProps }: PropsWithoutRef<FieldGroupListProps>,\n ref: FieldGroupListProps['ref']\n ) {\n const t = useI18n();\n const lastItemRef = useRef<HTMLDivElement>(null);\n const addBtnRef = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n const currentActiveEl = getActiveElement();\n if (currentActiveEl === addBtnRef.current && lastItemRef.current) {\n const groupItemLegend = lastItemRef.current.querySelector(':scope > legend');\n const focusables = getFocusables(lastItemRef.current);\n\n const groupActionButtons = focusables.filter(focusable =>\n groupItemLegend?.contains(focusable)\n );\n\n const groupContentFocusables = focusables.filter(\n focusable => !groupItemLegend?.contains(focusable)\n );\n\n if (groupContentFocusables.length > 0) {\n groupContentFocusables[0].focus();\n } else {\n groupActionButtons[0]?.focus();\n }\n }\n }, [items.length]);\n\n return (\n <StyledFieldGroupList ref={ref} {...restProps}>\n {items.map(\n (\n {\n id,\n children,\n name,\n headingTag,\n onDelete: itemOnDelete,\n ...restItemProps\n }: FieldGroupListItemProps,\n index\n ) => {\n const isLastItem = index === items.length - 1;\n return (\n <StyledListItem\n key={id}\n name={name}\n headingTag={headingTag}\n {...restItemProps}\n actions={\n onDelete || itemOnDelete\n ? [\n {\n id: 'delete',\n text: t('delete'),\n icon: 'trash',\n iconOnly: true,\n onClick: () => {\n itemOnDelete?.(id);\n onDelete?.(id);\n }\n }\n ]\n : undefined\n }\n ref={isLastItem ? lastItemRef : undefined}\n >\n {children}\n </StyledListItem>\n );\n }\n )}\n {onAdd && (\n <StyledAddButton variant='link' onClick={onAdd} ref={addBtnRef}>\n <Icon name='plus' /> {t('add')}\n </StyledAddButton>\n )}\n </StyledFieldGroupList>\n );\n }\n);\n\nexport default FieldGroupList;\n"]}
@@ -0,0 +1,11 @@
1
+ import type { WithAttributes } from '../../types';
2
+ type HiddenTextProps = WithAttributes<'span', {
3
+ /** A DOM id that other elements can reference for an accessible label/description text. */
4
+ id: string;
5
+ /** Text content for an accessible label/description. */
6
+ children: string;
7
+ }>;
8
+ export declare const StyledHiddenText: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
9
+ declare const _default: import("react").ForwardRefExoticComponent<Omit<HiddenTextProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
10
+ export default _default;
11
+ //# sourceMappingURL=HiddenText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HiddenText.d.ts","sourceRoot":"","sources":["../../../src/components/HiddenText/HiddenText.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,aAAa,CAAC;AAG9D,KAAK,eAAe,GAAG,cAAc,CACnC,MAAM,EACN;IACE,2FAA2F;IAC3F,EAAE,EAAE,MAAM,CAAC;IACX,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;CAClB,CACF,CAAC;AAEF,eAAO,MAAM,gBAAgB,0GAE5B,CAAC;;AAEF,wBAQE"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { createPortal } from 'react-dom';
4
+ import styled from 'styled-components';
5
+ import { useConfiguration } from '../../hooks';
6
+ export const StyledHiddenText = styled.span `
7
+ display: none;
8
+ `;
9
+ export default forwardRef(function HiddenText(props, ref) {
10
+ const { portalTarget } = useConfiguration();
11
+ return portalTarget
12
+ ? createPortal(_jsx(StyledHiddenText, { ...props, ref: ref }), portalTarget)
13
+ : null;
14
+ });
15
+ //# sourceMappingURL=HiddenText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HiddenText.js","sourceRoot":"","sources":["../../../src/components/HiddenText/HiddenText.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAY/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAA;;CAE1C,CAAC;AAEF,eAAe,UAAU,CACvB,SAAS,UAAU,CAAC,KAAK,EAAE,GAAG;IAC5B,MAAM,EAAE,YAAY,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAE5C,OAAO,YAAY;QACjB,CAAC,CAAC,YAAY,CAAC,KAAC,gBAAgB,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,GAAI,EAAE,YAAY,CAAC;QACvE,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CACF,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport { createPortal } from 'react-dom';\nimport type { PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\n\nimport type { RefElement, WithAttributes } from '../../types';\nimport { useConfiguration } from '../../hooks';\n\ntype HiddenTextProps = WithAttributes<\n 'span',\n {\n /** A DOM id that other elements can reference for an accessible label/description text. */\n id: string;\n /** Text content for an accessible label/description. */\n children: string;\n }\n>;\n\nexport const StyledHiddenText = styled.span`\n display: none;\n`;\n\nexport default forwardRef<RefElement<HiddenTextProps>, PropsWithoutRef<HiddenTextProps>>(\n function HiddenText(props, ref) {\n const { portalTarget } = useConfiguration();\n\n return portalTarget\n ? createPortal(<StyledHiddenText {...props} ref={ref} />, portalTarget)\n : null;\n }\n);\n"]}
@@ -0,0 +1,2 @@
1
+ export { default } from './HiddenText';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/HiddenText/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from './HiddenText';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/HiddenText/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { default } from './HiddenText';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAwB,aAAa,EAAE,yBAAyB,EAAE,MAAM,OAAO,CAAC;AAK5F,OAAO,KAAK,EAAE,cAAc,EAAc,cAAc,EAAE,MAAM,aAAa,CAAC;AAG9E,KAAK,aAAa,GAAG,cAAc,GAAG;IACpC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gGAAgG;IAChG,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,GAAG,GAAG,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AC;WAC7B,SAAS,CAAC,MAAM,CAAC;YAChB,SAAS,CAAC,OAAO,CAAC;SAgE1B,CAAC;AAMH,QAAA,MAAM,IAAI,sCAwFgC,CAAC;AAE3C,eAAe,IAAI,CAAC"}
@@ -121,7 +121,7 @@ export const StyledIconShape = styled.div(({ theme, background, foreground, size
121
121
  });
122
122
  StyledIconShape.defaultProps = defaultThemeProp;
123
123
  const emptyIconDefinition = Object.freeze({ Component: () => null });
124
- const Icon = forwardRef(function Icon({ set: setProp, name, size, ...restProps }, ref) {
124
+ const Icon = forwardRef(function Icon({ set: setProp, name, size, 'aria-label': ariaLabel, ...restProps }, ref) {
125
125
  const { base: { 'icon-set': setTheme } } = useTheme();
126
126
  const set = setProp ?? setTheme ?? 'budicon';
127
127
  const [iconDef, setIconDef] = useState(iconRegistry.get(set)?.get(name) ?? emptyIconDefinition);
@@ -166,7 +166,7 @@ const Icon = forwardRef(function Icon({ set: setProp, name, size, ...restProps }
166
166
  })();
167
167
  return () => controller.abort();
168
168
  }, [name, set]);
169
- return typeof restProps.background === 'string' ? (_jsx(StyledIconShape, { role: 'presentation', ...restProps, background: restProps.background, foreground: restProps.foreground, shape: restProps.shape, size: size, ref: ref, children: _jsx(StyledIcon, { viewBox: iconDef.viewBox, children: _jsx(iconDef.Component, {}) }) })) : (_jsx(StyledIcon, { role: 'presentation', ...restProps, viewBox: iconDef.viewBox, size: size, ref: ref, children: _jsx(iconDef.Component, {}) }));
169
+ return typeof restProps.background === 'string' ? (_jsx(StyledIconShape, { ...restProps, background: restProps.background, foreground: restProps.foreground, shape: restProps.shape, size: size, ref: ref, children: _jsx(StyledIcon, { role: ariaLabel !== undefined ? 'img' : 'presentation', "aria-label": ariaLabel, viewBox: iconDef.viewBox, children: _jsx(iconDef.Component, {}) }) })) : (_jsx(StyledIcon, { ...restProps, role: ariaLabel !== undefined ? 'img' : 'presentation', "aria-label": ariaLabel, viewBox: iconDef.viewBox, size: size, ref: ref, children: _jsx(iconDef.Component, {}) }));
170
170
  });
171
171
  export default Icon;
172
172
  //# sourceMappingURL=Icon.js.map