@pega/cosmos-react-core 7.0.0-build.27.2 → 7.0.0-build.28.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 (51) hide show
  1. package/lib/components/EmptyState/EmptyState.d.ts.map +1 -1
  2. package/lib/components/EmptyState/EmptyState.js +5 -2
  3. package/lib/components/EmptyState/EmptyState.js.map +1 -1
  4. package/lib/components/FieldValueList/FieldValueList.d.ts +12 -8
  5. package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
  6. package/lib/components/FieldValueList/FieldValueList.js +13 -5
  7. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  8. package/lib/components/FieldValueList/index.d.ts +1 -1
  9. package/lib/components/FieldValueList/index.d.ts.map +1 -1
  10. package/lib/components/FieldValueList/index.js.map +1 -1
  11. package/lib/components/Link/Link.d.ts.map +1 -1
  12. package/lib/components/Link/Link.js +15 -11
  13. package/lib/components/Link/Link.js.map +1 -1
  14. package/lib/components/Location/Location.types.d.ts +2 -2
  15. package/lib/components/Location/Location.types.d.ts.map +1 -1
  16. package/lib/components/Location/Location.types.js.map +1 -1
  17. package/lib/components/Menu/Menu.context.d.ts.map +1 -1
  18. package/lib/components/Menu/Menu.context.js +1 -0
  19. package/lib/components/Menu/Menu.context.js.map +1 -1
  20. package/lib/components/Menu/Menu.d.ts.map +1 -1
  21. package/lib/components/Menu/Menu.js +6 -2
  22. package/lib/components/Menu/Menu.js.map +1 -1
  23. package/lib/components/Menu/Menu.styles.d.ts +0 -1
  24. package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
  25. package/lib/components/Menu/Menu.styles.js +0 -8
  26. package/lib/components/Menu/Menu.styles.js.map +1 -1
  27. package/lib/components/Menu/Menu.types.d.ts +14 -2
  28. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  29. package/lib/components/Menu/Menu.types.js.map +1 -1
  30. package/lib/components/Menu/MenuGroup.js +2 -2
  31. package/lib/components/Menu/MenuGroup.js.map +1 -1
  32. package/lib/components/Menu/MenuItem.d.ts.map +1 -1
  33. package/lib/components/Menu/MenuItem.js +3 -3
  34. package/lib/components/Menu/MenuItem.js.map +1 -1
  35. package/lib/components/SummaryItem/SummaryItem.d.ts +5 -0
  36. package/lib/components/SummaryItem/SummaryItem.d.ts.map +1 -1
  37. package/lib/components/SummaryItem/SummaryItem.js +13 -5
  38. package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
  39. package/lib/components/Tooltip/Tooltip.d.ts +2 -2
  40. package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  41. package/lib/components/Tooltip/Tooltip.js +16 -5
  42. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  43. package/lib/hooks/useI18n.d.ts +10 -0
  44. package/lib/hooks/useI18n.d.ts.map +1 -1
  45. package/lib/i18n/default.d.ts +10 -0
  46. package/lib/i18n/default.d.ts.map +1 -1
  47. package/lib/i18n/default.js +11 -0
  48. package/lib/i18n/default.js.map +1 -1
  49. package/lib/i18n/i18n.d.ts +10 -0
  50. package/lib/i18n/i18n.d.ts.map +1 -1
  51. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyState.d.ts","sourceRoot":"","sources":["../../../src/components/EmptyState/EmptyState.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAUrE,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK3E,MAAM,WAAW,eAAgB,SAAQ,SAAS,EAAE,cAAc;IAChE;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,gBAAgB,yGAc3B,CAAC;AAIH,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CAiBjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"EmptyState.d.ts","sourceRoot":"","sources":["../../../src/components/EmptyState/EmptyState.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAWrE,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAM3E,MAAM,WAAW,eAAgB,SAAQ,SAAS,EAAE,cAAc;IAChE;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,gBAAgB,yGAc3B,CAAC;AAIH,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CAoBjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -5,11 +5,13 @@ import { rgba } from 'polished';
5
5
  import Flex from '../Flex';
6
6
  import Icon, { StyledIcon, registerIcon } from '../Icon';
7
7
  import * as galaxyIcon from '../Icon/icons/galaxy.icon';
8
+ import * as folderEmptyIcon from '../Icon/streamline-icons/folder-empty.icon';
8
9
  import Text from '../Text';
9
10
  import { tryCatch } from '../../utils';
10
- import { useI18n } from '../../hooks';
11
+ import { useI18n, useTheme } from '../../hooks';
11
12
  import { defaultThemeProp } from '../../theme';
12
13
  registerIcon(galaxyIcon);
14
+ registerIcon(folderEmptyIcon);
13
15
  export const StyledEmptyState = styled.div(({ theme }) => {
14
16
  const color = tryCatch(() => rgba(theme.base.palette['foreground-color'], theme.base.transparency['transparent-2']));
15
17
  return css `
@@ -25,9 +27,10 @@ export const StyledEmptyState = styled.div(({ theme }) => {
25
27
  });
26
28
  StyledEmptyState.defaultProps = defaultThemeProp;
27
29
  const EmptyState = forwardRef(function EmptyState(props, ref) {
30
+ const { base: { 'icon-set': iconSet } } = useTheme();
28
31
  const t = useI18n();
29
32
  const { message = t('no_items'), ...restProps } = props;
30
- return (_jsxs(Flex, { ...restProps, as: StyledEmptyState, ref: ref, container: { direction: 'column', alignItems: 'center', justify: 'center', gap: 1 }, children: [_jsx(Icon, { name: 'galaxy' }), _jsx(Text, { variant: 'secondary', children: message })] }));
33
+ return (_jsxs(Flex, { ...restProps, as: StyledEmptyState, ref: ref, container: { direction: 'column', alignItems: 'center', justify: 'center', gap: 1 }, children: [_jsx(Icon, { name: iconSet === 'streamline' ? 'folder-empty' : 'galaxy' }), _jsx(Text, { variant: 'secondary', children: message })] }));
31
34
  });
32
35
  export default EmptyState;
33
36
  //# sourceMappingURL=EmptyState.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyState.js","sourceRoot":"","sources":["../../../src/components/EmptyState/EmptyState.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AACxD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,YAAY,CAAC,UAAU,CAAC,CAAC;AAWzB,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACvD,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CAC1B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CACvF,CAAC;IACF,OAAO,GAAG,CAAA;;;MAGN,UAAU;;;;eAID,KAAK;;GAEjB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEjD,MAAM,UAAU,GAAsD,UAAU,CAC9E,SAAS,UAAU,CAAC,KAAuC,EAAE,GAA2B;IACtF,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,OAAO,GAAG,CAAC,CAAC,UAAU,CAAC,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAExD,OAAO,CACL,MAAC,IAAI,OACC,SAAS,EACb,EAAE,EAAE,gBAAgB,EACpB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aAEnF,KAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,GAAG,EACtB,KAAC,IAAI,IAAC,OAAO,EAAC,WAAW,YAAE,OAAO,GAAQ,IACrC,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\n\nimport Flex from '../Flex';\nimport Icon, { StyledIcon, registerIcon } from '../Icon';\nimport * as galaxyIcon from '../Icon/icons/galaxy.icon';\nimport Text from '../Text';\nimport { tryCatch } from '../../utils';\nimport { useI18n } from '../../hooks';\nimport type { BaseProps, NoChildrenProp, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\n\nregisterIcon(galaxyIcon);\n\nexport interface EmptyStateProps extends BaseProps, NoChildrenProp {\n /**\n * Message to display below the icon.\n * @default 'No items'\n */\n message?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledEmptyState = styled.div(({ theme }) => {\n const color = tryCatch(() =>\n rgba(theme.base.palette['foreground-color'], theme.base.transparency['transparent-2'])\n );\n return css`\n height: 100%;\n\n ${StyledIcon} {\n font-size: 1.5rem;\n height: 1.5rem;\n width: 1.5rem;\n color: ${color};\n }\n `;\n});\n\nStyledEmptyState.defaultProps = defaultThemeProp;\n\nconst EmptyState: FunctionComponent<EmptyStateProps & ForwardProps> = forwardRef(\n function EmptyState(props: PropsWithoutRef<EmptyStateProps>, ref: EmptyStateProps['ref']) {\n const t = useI18n();\n const { message = t('no_items'), ...restProps } = props;\n\n return (\n <Flex\n {...restProps}\n as={StyledEmptyState}\n ref={ref}\n container={{ direction: 'column', alignItems: 'center', justify: 'center', gap: 1 }}\n >\n <Icon name='galaxy' />\n <Text variant='secondary'>{message}</Text>\n </Flex>\n );\n }\n);\n\nexport default EmptyState;\n"]}
1
+ {"version":3,"file":"EmptyState.js","sourceRoot":"","sources":["../../../src/components/EmptyState/EmptyState.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,eAAe,MAAM,4CAA4C,CAAC;AAC9E,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAA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ACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\n\nimport Flex from '../Flex';\nimport Icon, { StyledIcon, registerIcon } from '../Icon';\nimport * as galaxyIcon from '../Icon/icons/galaxy.icon';\nimport * as folderEmptyIcon from '../Icon/streamline-icons/folder-empty.icon';\nimport Text from '../Text';\nimport { tryCatch } from '../../utils';\nimport { useI18n, useTheme } from '../../hooks';\nimport type { BaseProps, NoChildrenProp, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\n\nregisterIcon(galaxyIcon);\nregisterIcon(folderEmptyIcon);\n\nexport interface EmptyStateProps extends BaseProps, NoChildrenProp {\n /**\n * Message to display below the icon.\n * @default 'No items'\n */\n message?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledEmptyState = styled.div(({ theme }) => {\n const color = tryCatch(() =>\n rgba(theme.base.palette['foreground-color'], theme.base.transparency['transparent-2'])\n );\n return css`\n height: 100%;\n\n ${StyledIcon} {\n font-size: 1.5rem;\n height: 1.5rem;\n width: 1.5rem;\n color: ${color};\n }\n `;\n});\n\nStyledEmptyState.defaultProps = defaultThemeProp;\n\nconst EmptyState: FunctionComponent<EmptyStateProps & ForwardProps> = forwardRef(\n function EmptyState(props: PropsWithoutRef<EmptyStateProps>, ref: EmptyStateProps['ref']) {\n const {\n base: { 'icon-set': iconSet }\n } = useTheme();\n const t = useI18n();\n const { message = t('no_items'), ...restProps } = props;\n\n return (\n <Flex\n {...restProps}\n as={StyledEmptyState}\n ref={ref}\n container={{ direction: 'column', alignItems: 'center', justify: 'center', gap: 1 }}\n >\n <Icon name={iconSet === 'streamline' ? 'folder-empty' : 'galaxy'} />\n <Text variant='secondary'>{message}</Text>\n </Flex>\n );\n }\n);\n\nexport default EmptyState;\n"]}
@@ -1,17 +1,21 @@
1
1
  import type { ReactNode, FunctionComponent } from 'react';
2
- import type { BaseProps, ForwardProps, NoChildrenProp, TestIdProp } from '../../types';
2
+ import type { BaseProps, ExcludeStrict, ForwardProps, NoChildrenProp, TestIdProp } from '../../types';
3
3
  export type FieldValueVariant = 'inline' | 'stacked';
4
- export interface FieldValueListItemProps extends TestIdProp {
4
+ interface BaseFieldValueListItem extends TestIdProp {
5
5
  name: string;
6
- value?: ReactNode;
7
- variant?: FieldValueVariant;
8
- }
9
- export interface FieldValueListItem extends FieldValueListItemProps {
10
6
  id?: string;
7
+ variant?: FieldValueVariant;
11
8
  }
9
+ export type FieldValueListItemProps = (BaseFieldValueListItem & {
10
+ value?: ExcludeStrict<ReactNode, 'string'>;
11
+ truncate?: never;
12
+ }) | (BaseFieldValueListItem & {
13
+ value: string;
14
+ truncate?: boolean;
15
+ });
12
16
  export interface FieldValueListProps extends BaseProps, NoChildrenProp, TestIdProp {
13
17
  /** The set of field values to render in the list. */
14
- fields: FieldValueListItem[];
18
+ fields: FieldValueListItemProps[];
15
19
  /**
16
20
  * Determines if the field and values should be displayed on the same line, or stacked with the field above the value.
17
21
  * @default 'inline'
@@ -23,7 +27,7 @@ export declare const StyledFieldValue: import("styled-components").StyledCompone
23
27
  export type StyledFieldValueListProps = Pick<FieldValueListProps, 'variant'>;
24
28
  export declare const StyledFieldValueList: import("styled-components").StyledComponent<"dl", import("styled-components").DefaultTheme, StyledFieldValueListProps, never>;
25
29
  export declare const StyledStackedFieldValue: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
26
- export declare const FieldValueItem: (({ testId, name, value, variant }: FieldValueListItemProps) => JSX.Element) & {
30
+ export declare const FieldValueItem: (({ testId, name, value, variant, truncate }: FieldValueListItemProps) => JSX.Element) & {
27
31
  getTestIds: (testIdProp?: string | null | undefined) => import("../../types").TestIdsRecord<readonly ["name", "value"]>;
28
32
  };
29
33
  declare const _default: FunctionComponent<FieldValueListProps & ForwardProps> & {
@@ -1 +1 @@
1
- {"version":3,"file":"FieldValueList.d.ts","sourceRoot":"","sources":["../../../src/components/FieldValueList/FieldValueList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAO,MAAM,OAAO,CAAC;AAG/D,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAWvF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErD,MAAM,WAAW,uBAAwB,SAAQ,UAAU;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAmB,SAAQ,uBAAuB;IACjE,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,mBAAoB,SAAQ,SAAS,EAAE,cAAc,EAAE,UAAU;IAChF,qDAAqD;IACrD,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,GAAG,kBAAkB,CAAC;CAClD;AAED,eAAO,MAAM,eAAe,wGAE3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,wGAE5B,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC;AAE7E,eAAO,MAAM,oBAAoB,+HAuB/B,CAAC;AAIH,eAAO,MAAM,uBAAuB,yGAAe,CAAC;AAEpD,eAAO,MAAM,cAAc,sCACqB,uBAAuB;;CAwBtE,CAAC;;;;AAmDF,wBAAqE"}
1
+ {"version":3,"file":"FieldValueList.d.ts","sourceRoot":"","sources":["../../../src/components/FieldValueList/FieldValueList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAO,MAAM,OAAO,CAAC;AAG/D,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,YAAY,EACZ,cAAc,EACd,UAAU,EACX,MAAM,aAAa,CAAC;AAWrB,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErD,UAAU,sBAAuB,SAAQ,UAAU;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAED,MAAM,MAAM,uBAAuB,GAC/B,CAAC,sBAAsB,GAAG;IACxB,KAAK,CAAC,EAAE,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC3C,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB,CAAC,GACF,CAAC,sBAAsB,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC,CAAC;AAEP,MAAM,WAAW,mBAAoB,SAAQ,SAAS,EAAE,cAAc,EAAE,UAAU;IAChF,qDAAqD;IACrD,MAAM,EAAE,uBAAuB,EAAE,CAAC;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,GAAG,kBAAkB,CAAC;CAClD;AAED,eAAO,MAAM,eAAe,wGAE3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,wGAE5B,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC;AAE7E,eAAO,MAAM,oBAAoB,+HAuB/B,CAAC;AAIH,eAAO,MAAM,uBAAuB,yGAAe,CAAC;AAEpD,eAAO,MAAM,cAAc,gDACsC,uBAAuB;;CA4BvF,CAAC;;;;AAsDF,wBAAqE"}
@@ -41,9 +41,9 @@ export const StyledFieldValueList = styled.dl(({ variant, theme }) => {
41
41
  });
42
42
  StyledFieldValueList.defaultProps = defaultThemeProp;
43
43
  export const StyledStackedFieldValue = styled.div ``;
44
- export const FieldValueItem = withTestIds(({ testId, name, value, variant = 'inline' }) => {
44
+ export const FieldValueItem = withTestIds(({ testId, name, value, variant = 'inline', truncate = true }) => {
45
45
  const testIds = useTestIds(testId, getFieldValueItemTestIds);
46
- const displayValue = typeof value === 'string' ? _jsx(ShowMoreLess, { lines: 3, children: value }) : value;
46
+ const displayValue = typeof value === 'string' && truncate ? (_jsx(ShowMoreLess, { lines: 3, children: value })) : (value);
47
47
  const labelAndValue = (_jsxs(_Fragment, { children: [_jsx(StyledLabel, { "data-testid": testIds.name, as: StyledFieldName, children: name }), _jsx(StyledFieldValue, { "data-testid": testIds.value, children: value ? displayValue : _jsx(NoValue, {}) })] }));
48
48
  return variant === 'stacked' ? (_jsx(StyledStackedFieldValue, { "data-testid": testIds.root, children: labelAndValue })) : (_jsx(_Fragment, { children: labelAndValue }));
49
49
  }, getFieldValueItemTestIds);
@@ -60,10 +60,18 @@ const FieldValueList = forwardRef(function FieldValueList({ testId, fields, vari
60
60
  : 'minmax(0, 1fr)',
61
61
  colGap: variant !== 'value-comparison' ? 2 : 0,
62
62
  rowGap: variant !== 'value-comparison' ? 1 : 0.5
63
- }, as: StyledFieldValueList, variant: isXSContentWidthOrAbove ? variant : 'stacked', children: fields.map(({ id, name, value, variant: fieldVariant }) => {
64
- return (_jsx(FieldValueItem, { name: name, value: value, variant: (fieldVariant ?? variant) === 'stacked' || !isXSContentWidthOrAbove
63
+ }, as: StyledFieldValueList, variant: isXSContentWidthOrAbove ? variant : 'stacked', children: fields.map(({ id, name, value, truncate = true, variant: fieldVariant }) => {
64
+ const sharedProps = {
65
+ name,
66
+ variant: (fieldVariant ?? variant) === 'stacked' || !isXSContentWidthOrAbove
65
67
  ? 'stacked'
66
- : 'inline' }, id ?? name));
68
+ : 'inline',
69
+ key: id ?? name
70
+ };
71
+ if (typeof value === 'string') {
72
+ return _jsx(FieldValueItem, { ...sharedProps, value: value, truncate: truncate });
73
+ }
74
+ return _jsx(FieldValueItem, { ...sharedProps, value: value });
67
75
  }) }));
68
76
  });
69
77
  export default withTestIds(FieldValueList, getFie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AAiB;QAChC,SAAS,EAAE,eAAe;KAC3B,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,IAAI,mBACU,OAAO,CAAC,IAAI,KACrB,SAAS,EACb,GAAG,EAAE,iBAAiB,EACtB,SAAS,EAAE;YACT,IAAI,EACF,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,uBAAuB;gBACzE,CAAC,CAAC,qBAAqB;gBACvB,CAAC,CAAC,gBAAgB;YACtB,MAAM,EAAE,OAAO,KAAK,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9C,MAAM,EAAE,OAAO,KAAK,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;SACjD,EACD,EAAE,EAAE,oBAAoB,EACxB,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,YAErD,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE;YACzD,OAAO,CACL,KAAC,cAAc,IACb,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,OAAO,EACL,CAAC,YAAY,IAAI,OAAO,CAAC,KAAK,SAAS,IAAI,CAAC,uBAAuB;oBACjE,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,QAAQ,IAET,EAAE,IAAI,IAAI,CACf,CACH,CAAC;QACJ,CAAC,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,cAAc,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { ReactNode, FunctionComponent, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport type { BaseProps, ForwardProps, NoChildrenProp, TestIdProp } from '../../types';\nimport Grid from '../Grid';\nimport { StyledLabel } from '../Label';\nimport { useBreakpoint, useConsolidatedRef, useTestIds } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport ShowMoreLess from '../ShowMoreLess';\nimport { withTestIds } from '../../utils';\nimport NoValue from '../NoValue/NoValue';\n\nimport { getFieldValueListTestIds, getFieldValueItemTestIds } from './FieldValueList.test-ids';\n\nexport type FieldValueVariant = 'inline' | 'stacked';\n\nexport interface FieldValueListItemProps extends TestIdProp {\n name: string;\n value?: ReactNode;\n variant?: FieldValueVariant;\n}\n\nexport interface FieldValueListItem extends FieldValueListItemProps {\n id?: string;\n}\n\nexport interface FieldValueListProps extends BaseProps, NoChildrenProp, TestIdProp {\n /** The set of field values to render in the list. */\n fields: FieldValueListItem[];\n /**\n * Determines if the field and values should be displayed on the same line, or stacked with the field above the value.\n * @default 'inline'\n */\n variant?: FieldValueVariant | 'value-comparison';\n}\n\nexport const StyledFieldName = styled.dt`\n word-break: break-word;\n`;\n\nexport const StyledFieldValue = styled.dd`\n word-break: break-word;\n`;\n\nexport type StyledFieldValueListProps = Pick<FieldValueListProps, 'variant'>;\n\nexport const StyledFieldValueList = styled.dl<StyledFieldValueListProps>(({ variant, theme }) => {\n return css`\n width: 100%;\n\n ${variant === 'value-comparison' &&\n css`\n dt {\n width: 100%;\n }\n dd {\n text-align: end;\n padding-inline-start: calc(2 * ${theme.base.spacing});\n }\n ${StyledLabel} {\n max-width: unset;\n }\n dd:not(:last-of-type),\n dt:not(:last-of-type) {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n padding-bottom: calc(0.5 * ${theme.base.spacing});\n }\n `}\n `;\n});\n\nStyledFieldValueList.defaultProps = defaultThemeProp;\n\nexport const StyledStackedFieldValue = styled.div``;\n\nexport const FieldValueItem = withTestIds(\n ({ testId, name, value, variant = 'inline' }: FieldValueListItemProps) => {\n const testIds = useTestIds(testId, getFieldValueItemTestIds);\n\n const displayValue =\n typeof value === 'string' ? <ShowMoreLess lines={3}>{value}</ShowMoreLess> : value;\n\n const labelAndValue = (\n <>\n <StyledLabel data-testid={testIds.name} as={StyledFieldName}>\n {name}\n </StyledLabel>\n <StyledFieldValue data-testid={testIds.value}>\n {value ? displayValue : <NoValue />}\n </StyledFieldValue>\n </>\n );\n\n return variant === 'stacked' ? (\n <StyledStackedFieldValue data-testid={testIds.root}>{labelAndValue}</StyledStackedFieldValue>\n ) : (\n <>{labelAndValue}</>\n );\n },\n getFieldValueItemTestIds\n);\n\nconst FieldValueList: FunctionComponent<FieldValueListProps & ForwardProps> = forwardRef(\n function FieldValueList(\n { testId, fields, variant = 'inline', ...restProps }: FieldValueListProps,\n ref: Ref<HTMLDivElement>\n ) {\n const testIds = useTestIds(testId, getFieldValueListTestIds);\n\n const fieldValueListRef = useConsolidatedRef<HTMLDivElement>(ref);\n\n const isXSContentWidthOrAbove = useBreakpoint('xs', {\n breakpointRef: fieldValueListRef,\n themeProp: 'content-width'\n });\n\n return (\n <Grid\n data-testid={testIds.root}\n {...restProps}\n ref={fieldValueListRef}\n container={{\n cols:\n ['inline', 'value-comparison'].includes(variant) && isXSContentWidthOrAbove\n ? '16ch minmax(0, 1fr)'\n : 'minmax(0, 1fr)',\n colGap: variant !== 'value-comparison' ? 2 : 0,\n rowGap: variant !== 'value-comparison' ? 1 : 0.5\n }}\n as={StyledFieldValueList}\n variant={isXSContentWidthOrAbove ? variant : 'stacked'}\n >\n {fields.map(({ id, name, value, variant: fieldVariant }) => {\n return (\n <FieldValueItem\n name={name}\n value={value}\n variant={\n (fieldVariant ?? variant) === 'stacked' || !isXSContentWidthOrAbove\n ? 'stacked'\n : 'inline'\n }\n key={id ?? name}\n />\n );\n })}\n </Grid>\n );\n }\n);\n\nexport default withTestIds(FieldValueList, getFieldValueListTestIds);\n"]}
1
+ {"version":3,"file":"FieldValueList.js","sourceRoot":"","sources":["../../../src/components/FieldValueList/FieldValueList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EA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 'styled-components';\n\nimport type {\n BaseProps,\n ExcludeStrict,\n ForwardProps,\n NoChildrenProp,\n TestIdProp\n} from '../../types';\nimport Grid from '../Grid';\nimport { StyledLabel } from '../Label';\nimport { useBreakpoint, useConsolidatedRef, useTestIds } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport ShowMoreLess from '../ShowMoreLess';\nimport { withTestIds } from '../../utils';\nimport NoValue from '../NoValue/NoValue';\n\nimport { getFieldValueListTestIds, getFieldValueItemTestIds } from './FieldValueList.test-ids';\n\nexport type FieldValueVariant = 'inline' | 'stacked';\n\ninterface BaseFieldValueListItem extends TestIdProp {\n name: string;\n id?: string;\n variant?: FieldValueVariant;\n}\n\nexport type FieldValueListItemProps =\n | (BaseFieldValueListItem & {\n value?: ExcludeStrict<ReactNode, 'string'>;\n truncate?: never;\n })\n | (BaseFieldValueListItem & {\n value: string;\n truncate?: boolean;\n });\n\nexport interface FieldValueListProps extends BaseProps, NoChildrenProp, TestIdProp {\n /** The set of field values to render in the list. */\n fields: FieldValueListItemProps[];\n /**\n * Determines if the field and values should be displayed on the same line, or stacked with the field above the value.\n * @default 'inline'\n */\n variant?: FieldValueVariant | 'value-comparison';\n}\n\nexport const StyledFieldName = styled.dt`\n word-break: break-word;\n`;\n\nexport const StyledFieldValue = styled.dd`\n word-break: break-word;\n`;\n\nexport type StyledFieldValueListProps = Pick<FieldValueListProps, 'variant'>;\n\nexport const StyledFieldValueList = styled.dl<StyledFieldValueListProps>(({ variant, theme }) => {\n return css`\n width: 100%;\n\n ${variant === 'value-comparison' &&\n css`\n dt {\n width: 100%;\n }\n dd {\n text-align: end;\n padding-inline-start: calc(2 * ${theme.base.spacing});\n }\n ${StyledLabel} {\n max-width: unset;\n }\n dd:not(:last-of-type),\n dt:not(:last-of-type) {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n padding-bottom: calc(0.5 * ${theme.base.spacing});\n }\n `}\n `;\n});\n\nStyledFieldValueList.defaultProps = defaultThemeProp;\n\nexport const StyledStackedFieldValue = styled.div``;\n\nexport const FieldValueItem = withTestIds(\n ({ testId, name, value, variant = 'inline', truncate = true }: FieldValueListItemProps) => {\n const testIds = useTestIds(testId, getFieldValueItemTestIds);\n\n const displayValue =\n typeof value === 'string' && truncate ? (\n <ShowMoreLess lines={3}>{value}</ShowMoreLess>\n ) : (\n value\n );\n\n const labelAndValue = (\n <>\n <StyledLabel data-testid={testIds.name} as={StyledFieldName}>\n {name}\n </StyledLabel>\n <StyledFieldValue data-testid={testIds.value}>\n {value ? displayValue : <NoValue />}\n </StyledFieldValue>\n </>\n );\n\n return variant === 'stacked' ? (\n <StyledStackedFieldValue data-testid={testIds.root}>{labelAndValue}</StyledStackedFieldValue>\n ) : (\n <>{labelAndValue}</>\n );\n },\n getFieldValueItemTestIds\n);\n\nconst FieldValueList: FunctionComponent<FieldValueListProps & ForwardProps> = forwardRef(\n function FieldValueList(\n { testId, fields, variant = 'inline', ...restProps }: FieldValueListProps,\n ref: Ref<HTMLDivElement>\n ) {\n const testIds = useTestIds(testId, getFieldValueListTestIds);\n\n const fieldValueListRef = useConsolidatedRef<HTMLDivElement>(ref);\n\n const isXSContentWidthOrAbove = useBreakpoint('xs', {\n breakpointRef: fieldValueListRef,\n themeProp: 'content-width'\n });\n\n return (\n <Grid\n data-testid={testIds.root}\n {...restProps}\n ref={fieldValueListRef}\n container={{\n cols:\n ['inline', 'value-comparison'].includes(variant) && isXSContentWidthOrAbove\n ? '16ch minmax(0, 1fr)'\n : 'minmax(0, 1fr)',\n colGap: variant !== 'value-comparison' ? 2 : 0,\n rowGap: variant !== 'value-comparison' ? 1 : 0.5\n }}\n as={StyledFieldValueList}\n variant={isXSContentWidthOrAbove ? variant : 'stacked'}\n >\n {fields.map(({ id, name, value, truncate = true, variant: fieldVariant }) => {\n const sharedProps: BaseFieldValueListItem & { key: string } = {\n name,\n variant:\n (fieldVariant ?? variant) === 'stacked' || !isXSContentWidthOrAbove\n ? 'stacked'\n : 'inline',\n\n key: id ?? name\n };\n\n if (typeof value === 'string') {\n return <FieldValueItem {...sharedProps} value={value} truncate={truncate} />;\n }\n\n return <FieldValueItem {...sharedProps} value={value} />;\n })}\n </Grid>\n );\n }\n);\n\nexport default withTestIds(FieldValueList, getFieldValueListTestIds);\n"]}
@@ -1,3 +1,3 @@
1
1
  export { default, FieldValueItem, StyledFieldValueList, StyledFieldName, StyledFieldValue, StyledStackedFieldValue } from './FieldValueList';
2
- export type { FieldValueListProps, FieldValueListItem, FieldValueListItemProps, StyledFieldValueListProps } from './FieldValueList';
2
+ export type { FieldValueListProps, FieldValueListItemProps, StyledFieldValueListProps } from './FieldValueList';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FieldValueList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FieldValueList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/FieldValueList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,kBAAkB,CAAC","sourcesContent":["export {\n default,\n FieldValueItem,\n StyledFieldValueList,\n StyledFieldName,\n StyledFieldValue,\n StyledStackedFieldValue\n} from './FieldValueList';\nexport type {\n FieldValueListProps,\n FieldValueListItem,\n FieldValueListItemProps,\n StyledFieldValueListProps\n} from './FieldValueList';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/FieldValueList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,kBAAkB,CAAC","sourcesContent":["export {\n default,\n FieldValueItem,\n StyledFieldValueList,\n StyledFieldName,\n StyledFieldValue,\n StyledStackedFieldValue\n} from './FieldValueList';\nexport type {\n FieldValueListProps,\n FieldValueListItemProps,\n StyledFieldValueListProps\n} from './FieldValueList';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../src/components/Link/Link.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,EAAkC,MAAM,OAAO,CAAC;AAI/F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAI7C,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAwBvE,MAAM,WAAW,SAAU,SAAQ,SAAS,EAAE,UAAU;IACtD,oCAAoC;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,mFAAmF;IACnF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iFAAiF;IACjF,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,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AO,MAAM,iBAAiB;aAAyB,OAAO;SAU7D,CAAC;AAIF,eAAO,MAAM,oBAAoB,oLA0C/B,CAAC;AAIH,eAAO,MAAM,2BAA2B,oLA+BtC,CAAC;AAIH,eAAO,MAAM,UAAU,iJAQtB,CAAC;;;;AA6MF,wBAAiD"}
@@ -16,6 +16,7 @@ import Flex from '../Flex';
16
16
  import Icon, { StyledIcon, registerIcon } from '../Icon';
17
17
  import * as openIcon from '../Icon/icons/open.icon';
18
18
  import VisuallyHiddenText from '../VisuallyHiddenText';
19
+ import { useFullscreenContext } from '../Fullscreen';
19
20
  import { getLinkTestIds } from './Link.test-ids';
20
21
  export const StyledLinkPopover = styled.div(({ theme, preview }) => css `
21
22
  background-color: ${theme.components.tooltip['background-color']};
@@ -114,8 +115,10 @@ export const StyledLink = styled(Button) `
114
115
  `;
115
116
  StyledLink.defaultProps = defaultThemeProp;
116
117
  registerIcon(openIcon);
117
- const Link = forwardRef(function Link({ testId, href, variant = 'link', icon = false, previewable, onPreview, target: targetProp, children, ...restProps }, ref) {
118
+ const Link = forwardRef(function Link({ testId, href, variant = 'link', icon = false, previewable: previewableProp, onPreview, target: targetProp, children, ...restProps }, ref) {
118
119
  const { initialized: inModal } = useModalContext();
120
+ const fullscreen = useFullscreenContext();
121
+ const inFullscreen = !!(fullscreen && fullscreen[0]);
119
122
  const { previewTriggerRef } = useContext(AppShellContext);
120
123
  const uid = useUID();
121
124
  const linkRef = useConsolidatedRef(ref);
@@ -128,6 +131,7 @@ const Link = forwardRef(function Link({ testId, href, variant = 'link', icon = f
128
131
  const { macintosh } = useOS();
129
132
  const contextMenuOpened = useRef(false);
130
133
  const testIds = useTestIds(testId, getLinkTestIds);
134
+ const previewable = !!previewableProp && !inModal && !inFullscreen;
131
135
  const url = new URL(href, document.location.href);
132
136
  const crossOrigin = documentIsAvailable
133
137
  ? /^https?:$/.test(url.protocol) && document.location.origin !== url.origin
@@ -148,14 +152,6 @@ const Link = forwardRef(function Link({ testId, href, variant = 'link', icon = f
148
152
  const hidePreviewPopover = () => {
149
153
  setPreviewPopover(false);
150
154
  };
151
- const onEnterLink = () => {
152
- if (previewable)
153
- showPopover();
154
- };
155
- const onFocusLink = () => {
156
- if (previewable)
157
- showPreviewPopover();
158
- };
159
155
  const onBlurLink = () => {
160
156
  contextMenuOpened.current = false;
161
157
  hidePreviewPopover();
@@ -174,12 +170,20 @@ const Link = forwardRef(function Link({ testId, href, variant = 'link', icon = f
174
170
  setPopoverHideDelay('short');
175
171
  }
176
172
  }, [popoverHideDelay, popover, previewPopover]);
177
- return (_jsxs(_Fragment, { children: [_jsxs(StyledLink, { "data-testid": testIds.root, href: href, variant: variant, ref: linkRef, target: target, ...restProps, "aria-describedby": previewable ? `${uid}-preview-instructions` : undefined, onMouseEnter: onEnterLink, onMouseLeave: hidePopover, onFocus: onFocusLink, onBlur: onBlurLink, onKeyUp: onKeyUp, onContextMenu: () => {
173
+ return (_jsxs(_Fragment, { children: [_jsxs(StyledLink, { "data-testid": testIds.root, href: href, variant: variant, ref: linkRef, target: target, ...restProps, "aria-describedby": previewable ? `${uid}-preview-instructions` : undefined, onMouseEnter: previewable
174
+ ? () => {
175
+ showPopover();
176
+ }
177
+ : undefined, onMouseLeave: hidePopover, onFocus: previewable
178
+ ? () => {
179
+ showPreviewPopover();
180
+ }
181
+ : undefined, onBlur: onBlurLink, onKeyUp: onKeyUp, onContextMenu: () => {
178
182
  contextMenuOpened.current = true;
179
183
  setPopoverHideDelay('none');
180
184
  setPreviewPopover(false);
181
185
  setPopover(false);
182
- }, children: [children, target === '_blank' && _jsx(VisuallyHiddenText, { children: t('opens_in_a_new_tab') }), !icon && target === '_blank' && _jsx(Icon, { name: 'open' })] }), !inModal && (_jsx(Popover, { "data-testid": testIds.previewPopover, show: previewPopover, groupId: 'link_preview', showDelay: 'short', hideDelay: popoverHideDelay, placement: 'bottom', target: linkRef.current, as: StyledLinkPopover, arrow: true, preview: true, portal: true, onHide: hidePreviewPopover, children: _jsx(StyledLinkPreviewPopoverBtn, { "data-testid": testIds.preview, preview: true, type: 'button', ref: previewBtnRef, onClick: onPreviewClick, tabIndex: '-1', children: _jsxs(Text, { children: [_jsx("span", { children: t('preview') }), _jsxs(Flex, { container: { inline: true, justify: 'end' }, children: [_jsx(Keyboard, { keyName: 'Alt' }), _jsx(Keyboard, { keyName: 'P' })] })] }) }) })), _jsxs(Popover, { "data-testid": testIds.previewPopover, show: popover, groupId: 'link_preview', showDelay: 'short', hideDelay: popoverHideDelay, placement: 'bottom', target: linkRef.current, onMouseEnter: showPopover, onMouseLeave: hidePopover, as: StyledLinkPopover, arrow: true, portal: true, children: [!inModal && (_jsx(StyledLinkPopoverBtn, { "data-testid": testIds.preview, preview: true, type: 'button', ref: previewBtnRef, onClick: onPreviewClick, tabIndex: '-1', children: t('preview') })), _jsx(StyledLinkPopoverBtn, { "data-testid": testIds.newTab, forwardedAs: 'a', href: href, target: '_blank', rel: 'noreferrer', tabIndex: '-1', children: t('link_open_in_tab_text') })] }), previewable && (_jsx("span", { id: `${uid}-preview-instructions`, hidden: true, children: t('preview_link_instruction', [macintosh ? 'option' : 'alt']) }))] }));
186
+ }, children: [children, target === '_blank' && _jsx(VisuallyHiddenText, { children: t('opens_in_a_new_tab') }), !icon && target === '_blank' && _jsx(Icon, { name: 'open' })] }), previewable && (_jsx(Popover, { "data-testid": testIds.previewPopover, show: previewPopover, groupId: 'link_preview', showDelay: 'short', hideDelay: popoverHideDelay, placement: 'bottom', target: linkRef.current, as: StyledLinkPopover, arrow: true, preview: true, portal: true, onHide: hidePreviewPopover, children: _jsx(StyledLinkPreviewPopoverBtn, { "data-testid": testIds.preview, preview: true, type: 'button', ref: previewBtnRef, onClick: onPreviewClick, tabIndex: '-1', children: _jsxs(Text, { children: [_jsx("span", { children: t('preview') }), _jsxs(Flex, { container: { inline: true, justify: 'end' }, children: [_jsx(Keyboard, { keyName: 'Alt' }), _jsx(Keyboard, { keyName: 'P' })] })] }) }) })), _jsxs(Popover, { "data-testid": testIds.previewPopover, show: popover, groupId: 'link_preview', showDelay: 'short', hideDelay: popoverHideDelay, placement: 'bottom', target: linkRef.current, onMouseEnter: showPopover, onMouseLeave: hidePopover, as: StyledLinkPopover, arrow: true, portal: true, children: [!inModal && (_jsx(StyledLinkPopoverBtn, { "data-testid": testIds.preview, preview: true, type: 'button', ref: previewBtnRef, onClick: onPreviewClick, tabIndex: '-1', children: t('preview') })), _jsx(StyledLinkPopoverBtn, { "data-testid": testIds.newTab, forwardedAs: 'a', href: href, target: '_blank', rel: 'noreferrer', tabIndex: '-1', children: t('link_open_in_tab_text') })] }), previewable && (_jsx("span", { id: `${uid}-preview-instructions`, hidden: true, children: t('preview_link_instruction', [macintosh ? 'option' : 'alt']) }))] }));
183
187
  });
184
188
  export default withTestIds(Link, getLinkTestIds);
185
189
  //# sourceMappingURL=Link.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../src/components/Link/Link.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,MAAM,MAAM,WAAW,CAAC;AAE/B,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,OAAO,EACP,MAAM,EACN,eAAe,EACf,KAAK,EACL,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAC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,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GACzD,CACR,IACA,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { forwardRef, useState, useRef, useContext, useEffect } from 'react';\nimport type { ReactNode, FunctionComponent, Ref, PropsWithoutRef, KeyboardEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Button from '../Button';\nimport type { ButtonProps } from '../Button';\nimport Popover from '../Popover';\nimport type { PopoverProps } from '../Popover';\nimport BareButton from '../Button/BareButton';\nimport type { BaseProps, ForwardProps, TestIdProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport {\n useBreakpoint,\n useConsolidatedRef,\n useI18n,\n useUID,\n useModalContext,\n useOS,\n useTestIds\n} from '../../hooks';\nimport { documentIsAvailable, tryCatch, withTestIds } from '../../utils';\nimport { calculateFontSize, readableColor } from '../../styles';\nimport AppShellContext from '../AppShell/AppShellContext';\nimport { Keyboard } from '../Badges';\nimport Text, { StyledText } from '../Text';\nimport { StyledKeyboard } from '../Badges/Keyboard';\nimport Flex from '../Flex';\nimport Icon, { StyledIcon, registerIcon } from '../Icon';\nimport * as openIcon from '../Icon/icons/open.icon';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\n\nimport { getLinkTestIds } from './Link.test-ids';\n\nexport interface LinkProps extends BaseProps, TestIdProp {\n /** Text or content for the Link. */\n children: ReactNode;\n /** URL or DOM id to navigate to. */\n href: string;\n /**\n * Controls the styling of the Link.\n * @default 'link'\n */\n variant?: ButtonProps['variant'];\n /**\n * Set the Icon prop to `true` if you're using just an Icon in your Link. Make sure to pass an Icon as children if `true`.\n * @default false\n */\n icon?: ButtonProps['icon'];\n /** Determines if the Link should render a popover when focused or hovered over. */\n previewable?: boolean;\n /** Callback function that is run when the preview popover is interacted with. */\n onPreview?: (e: { href: string }) => void;\n /** Specifies where to open the link href. */\n target?: string;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement>;\n}\n\nexport const StyledLinkPopover = styled.div<{ preview: boolean }>(\n ({ theme, preview }) => css`\n background-color: ${theme.components.tooltip['background-color']};\n z-index: ${theme.base['z-index'].tooltip};\n\n ${preview &&\n css`\n padding: ${theme.base.spacing};\n `}\n `\n);\n\nStyledLinkPopover.defaultProps = defaultThemeProp;\n\nexport const StyledLinkPopoverBtn = styled(BareButton)(({ theme }) => {\n const contrastColor = tryCatch(() => readableColor(theme.components.tooltip['background-color']));\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n position: relative;\n display: inline-flex;\n align-items: center;\n z-index: 1;\n padding: 0 ${theme.base.spacing};\n min-height: 1.5rem;\n line-height: 1;\n color: ${contrastColor};\n font-size: ${fontSize.xs};\n text-decoration: none;\n\n /* FIXME: Button selector specificity... */\n & + & {\n margin: 0;\n }\n\n & + &::before {\n content: '';\n position: absolute;\n inset-inline-start: 0;\n inset-block: 0;\n width: 1px; /* stylelint-disable-line unit-allowed-list */\n background-color: ${contrastColor};\n opacity: ${theme.base.transparency['transparent-3']};\n }\n\n &:hover,\n &:active {\n text-decoration: underline;\n }\n\n &:focus {\n box-shadow:\n inset 0 0 0 0.0625rem ${theme.base.palette.light},\n 0 0 0.125rem 0.0625rem ${theme.base.palette.interactive};\n }\n `;\n});\n\nStyledLinkPopoverBtn.defaultProps = defaultThemeProp;\n\nexport const StyledLinkPreviewPopoverBtn = styled(StyledLinkPopoverBtn)(({ theme }) => {\n return css`\n width: 100%;\n padding: unset;\n\n &:hover,\n &:active {\n text-decoration: none;\n ${StyledText} span {\n text-decoration: underline;\n }\n }\n\n ${StyledText} {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\n\n ${StyledKeyboard} {\n color: ${theme.base.palette.light};\n background-color: ${theme.base.colors.gray.dark};\n border-color: ${theme.base.colors.gray.medium};\n inset-block-start: unset;\n\n &:first-of-type {\n margin-inline: ${theme.base.spacing};\n }\n }\n `;\n});\n\nStyledLinkPreviewPopoverBtn.defaultProps = defaultThemeProp;\n\nexport const StyledLink = styled(Button)`\n &:has(> img) {\n display: inline-block;\n\n ${StyledIcon} {\n vertical-align: top;\n }\n }\n`;\n\nStyledLink.defaultProps = defaultThemeProp;\n\nregisterIcon(openIcon);\n\nconst Link: FunctionComponent<LinkProps & ForwardProps> = forwardRef(function Link(\n {\n testId,\n href,\n variant = 'link',\n icon = false,\n previewable,\n onPreview,\n target: targetProp,\n children,\n ...restProps\n }: PropsWithoutRef<LinkProps>,\n ref: LinkProps['ref']\n) {\n const { initialized: inModal } = useModalContext();\n const { previewTriggerRef } = useContext(AppShellContext);\n const uid = useUID();\n const linkRef = useConsolidatedRef(ref);\n const [popover, setPopover] = useState(false);\n const [popoverHideDelay, setPopoverHideDelay] = useState<PopoverProps['hideDelay']>('short');\n const [previewPopover, setPreviewPopover] = useState(false);\n const previewBtnRef = useRef<HTMLButtonElement>(null);\n const isSmallOrAbove = useBreakpoint('sm');\n const t = useI18n();\n const { macintosh } = useOS();\n const contextMenuOpened = useRef(false);\n const testIds = useTestIds(testId, getLinkTestIds);\n\n const url = new URL(href, document.location.href);\n const crossOrigin = documentIsAvailable\n ? /^https?:$/.test(url.protocol) && document.location.origin !== url.origin\n : false;\n const target = crossOrigin ? '_blank' : targetProp;\n\n const showPopover = () => {\n if (isSmallOrAbove && !previewPopover) {\n setPopover(true);\n }\n };\n\n const showPreviewPopover = () => {\n if (isSmallOrAbove && !popover && !contextMenuOpened.current) setPreviewPopover(true);\n };\n\n const hidePopover = () => {\n setPopover(false);\n };\n\n const hidePreviewPopover = () => {\n setPreviewPopover(false);\n };\n\n const onEnterLink = () => {\n if (previewable) showPopover();\n };\n\n const onFocusLink = () => {\n if (previewable) showPreviewPopover();\n };\n\n const onBlurLink = () => {\n contextMenuOpened.current = false;\n hidePreviewPopover();\n };\n\n const onPreviewClick = () => {\n previewTriggerRef.current = linkRef.current;\n onPreview?.({ href });\n };\n\n const onKeyUp = (e: KeyboardEvent) => {\n if (e.getModifierState('Alt') && e.code === 'KeyP') {\n onPreviewClick();\n }\n };\n\n useEffect(() => {\n if (popoverHideDelay === 'none' && !popover && !previewPopover) {\n setPopoverHideDelay('short');\n }\n }, [popoverHideDelay, popover, previewPopover]);\n\n return (\n <>\n <StyledLink\n data-testid={testIds.root}\n href={href}\n variant={variant}\n ref={linkRef as any}\n target={target}\n {...restProps}\n aria-describedby={previewable ? `${uid}-preview-instructions` : undefined}\n onMouseEnter={onEnterLink}\n onMouseLeave={hidePopover}\n onFocus={onFocusLink}\n onBlur={onBlurLink}\n onKeyUp={onKeyUp}\n onContextMenu={() => {\n contextMenuOpened.current = true;\n\n setPopoverHideDelay('none');\n setPreviewPopover(false);\n setPopover(false);\n }}\n >\n {children}\n {target === '_blank' && <VisuallyHiddenText>{t('opens_in_a_new_tab')}</VisuallyHiddenText>}\n {!icon && target === '_blank' && <Icon name='open' />}\n </StyledLink>\n\n {!inModal && (\n <Popover\n data-testid={testIds.previewPopover}\n show={previewPopover}\n groupId='link_preview'\n showDelay='short'\n hideDelay={popoverHideDelay}\n placement='bottom'\n target={linkRef.current}\n as={StyledLinkPopover}\n arrow\n preview\n portal\n onHide={hidePreviewPopover}\n >\n <StyledLinkPreviewPopoverBtn\n data-testid={testIds.preview}\n preview\n type='button'\n ref={previewBtnRef}\n onClick={onPreviewClick}\n tabIndex='-1'\n >\n <Text>\n <span>{t('preview')}</span>\n <Flex container={{ inline: true, justify: 'end' }}>\n <Keyboard keyName='Alt' />\n <Keyboard keyName='P' />\n </Flex>\n </Text>\n </StyledLinkPreviewPopoverBtn>\n </Popover>\n )}\n\n <Popover\n data-testid={testIds.previewPopover}\n show={popover}\n groupId='link_preview'\n showDelay='short'\n hideDelay={popoverHideDelay}\n placement='bottom'\n target={linkRef.current}\n onMouseEnter={showPopover}\n onMouseLeave={hidePopover}\n as={StyledLinkPopover}\n arrow\n portal\n >\n {!inModal && (\n <StyledLinkPopoverBtn\n data-testid={testIds.preview}\n preview\n type='button'\n ref={previewBtnRef}\n onClick={onPreviewClick}\n tabIndex='-1'\n >\n {t('preview')}\n </StyledLinkPopoverBtn>\n )}\n <StyledLinkPopoverBtn\n data-testid={testIds.newTab}\n forwardedAs='a'\n href={href}\n target='_blank'\n rel='noreferrer'\n tabIndex='-1'\n >\n {t('link_open_in_tab_text')}\n </StyledLinkPopoverBtn>\n </Popover>\n\n {previewable && (\n <span id={`${uid}-preview-instructions`} hidden>\n {t('preview_link_instruction', [macintosh ? 'option' : 'alt'])}\n </span>\n )}\n </>\n );\n});\n\nexport default withTestIds(Link, getLinkTestIds);\n"]}
1
+ {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../src/components/Link/Link.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,MAAM,MAAM,WAAW,CAAC;AAE/B,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,OAAO,EACP,MAAM,EACN,eAAe,EACf,KAAK,EACL,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,cAAc,EAA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,EAET,WAAW,IAAI,CACd,eAAM,EAAE,EAAE,GAAG,GAAG,uBAAuB,EAAE,MAAM,kBAC5C,CAAC,CAAC,0BAA0B,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GACzD,CACR,IACA,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { forwardRef, useState, useRef, useContext, useEffect } from 'react';\nimport type { ReactNode, FunctionComponent, Ref, PropsWithoutRef, KeyboardEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Button from '../Button';\nimport type { ButtonProps } from '../Button';\nimport Popover from '../Popover';\nimport type { PopoverProps } from '../Popover';\nimport BareButton from '../Button/BareButton';\nimport type { BaseProps, ForwardProps, TestIdProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport {\n useBreakpoint,\n useConsolidatedRef,\n useI18n,\n useUID,\n useModalContext,\n useOS,\n useTestIds\n} from '../../hooks';\nimport { documentIsAvailable, tryCatch, withTestIds } from '../../utils';\nimport { calculateFontSize, readableColor } from '../../styles';\nimport AppShellContext from '../AppShell/AppShellContext';\nimport { Keyboard } from '../Badges';\nimport Text, { StyledText } from '../Text';\nimport { StyledKeyboard } from '../Badges/Keyboard';\nimport Flex from '../Flex';\nimport Icon, { StyledIcon, registerIcon } from '../Icon';\nimport * as openIcon from '../Icon/icons/open.icon';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { useFullscreenContext } from '../Fullscreen';\n\nimport { getLinkTestIds } from './Link.test-ids';\n\nexport interface LinkProps extends BaseProps, TestIdProp {\n /** Text or content for the Link. */\n children: ReactNode;\n /** URL or DOM id to navigate to. */\n href: string;\n /**\n * Controls the styling of the Link.\n * @default 'link'\n */\n variant?: ButtonProps['variant'];\n /**\n * Set the Icon prop to `true` if you're using just an Icon in your Link. Make sure to pass an Icon as children if `true`.\n * @default false\n */\n icon?: ButtonProps['icon'];\n /** Determines if the Link should render a popover when focused or hovered over. */\n previewable?: boolean;\n /** Callback function that is run when the preview popover is interacted with. */\n onPreview?: (e: { href: string }) => void;\n /** Specifies where to open the link href. */\n target?: string;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement>;\n}\n\nexport const StyledLinkPopover = styled.div<{ preview: boolean }>(\n ({ theme, preview }) => css`\n background-color: ${theme.components.tooltip['background-color']};\n z-index: ${theme.base['z-index'].tooltip};\n\n ${preview &&\n css`\n padding: ${theme.base.spacing};\n `}\n `\n);\n\nStyledLinkPopover.defaultProps = defaultThemeProp;\n\nexport const StyledLinkPopoverBtn = styled(BareButton)(({ theme }) => {\n const contrastColor = tryCatch(() => readableColor(theme.components.tooltip['background-color']));\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n position: relative;\n display: inline-flex;\n align-items: center;\n z-index: 1;\n padding: 0 ${theme.base.spacing};\n min-height: 1.5rem;\n line-height: 1;\n color: ${contrastColor};\n font-size: ${fontSize.xs};\n text-decoration: none;\n\n /* FIXME: Button selector specificity... */\n & + & {\n margin: 0;\n }\n\n & + &::before {\n content: '';\n position: absolute;\n inset-inline-start: 0;\n inset-block: 0;\n width: 1px; /* stylelint-disable-line unit-allowed-list */\n background-color: ${contrastColor};\n opacity: ${theme.base.transparency['transparent-3']};\n }\n\n &:hover,\n &:active {\n text-decoration: underline;\n }\n\n &:focus {\n box-shadow:\n inset 0 0 0 0.0625rem ${theme.base.palette.light},\n 0 0 0.125rem 0.0625rem ${theme.base.palette.interactive};\n }\n `;\n});\n\nStyledLinkPopoverBtn.defaultProps = defaultThemeProp;\n\nexport const StyledLinkPreviewPopoverBtn = styled(StyledLinkPopoverBtn)(({ theme }) => {\n return css`\n width: 100%;\n padding: unset;\n\n &:hover,\n &:active {\n text-decoration: none;\n ${StyledText} span {\n text-decoration: underline;\n }\n }\n\n ${StyledText} {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\n\n ${StyledKeyboard} {\n color: ${theme.base.palette.light};\n background-color: ${theme.base.colors.gray.dark};\n border-color: ${theme.base.colors.gray.medium};\n inset-block-start: unset;\n\n &:first-of-type {\n margin-inline: ${theme.base.spacing};\n }\n }\n `;\n});\n\nStyledLinkPreviewPopoverBtn.defaultProps = defaultThemeProp;\n\nexport const StyledLink = styled(Button)`\n &:has(> img) {\n display: inline-block;\n\n ${StyledIcon} {\n vertical-align: top;\n }\n }\n`;\n\nStyledLink.defaultProps = defaultThemeProp;\n\nregisterIcon(openIcon);\n\nconst Link: FunctionComponent<LinkProps & ForwardProps> = forwardRef(function Link(\n {\n testId,\n href,\n variant = 'link',\n icon = false,\n previewable: previewableProp,\n onPreview,\n target: targetProp,\n children,\n ...restProps\n }: PropsWithoutRef<LinkProps>,\n ref: LinkProps['ref']\n) {\n const { initialized: inModal } = useModalContext();\n const fullscreen = useFullscreenContext();\n const inFullscreen = !!(fullscreen && fullscreen[0]);\n const { previewTriggerRef } = useContext(AppShellContext);\n const uid = useUID();\n const linkRef = useConsolidatedRef(ref);\n const [popover, setPopover] = useState(false);\n const [popoverHideDelay, setPopoverHideDelay] = useState<PopoverProps['hideDelay']>('short');\n const [previewPopover, setPreviewPopover] = useState(false);\n const previewBtnRef = useRef<HTMLButtonElement>(null);\n const isSmallOrAbove = useBreakpoint('sm');\n const t = useI18n();\n const { macintosh } = useOS();\n const contextMenuOpened = useRef(false);\n const testIds = useTestIds(testId, getLinkTestIds);\n\n const previewable = !!previewableProp && !inModal && !inFullscreen;\n\n const url = new URL(href, document.location.href);\n const crossOrigin = documentIsAvailable\n ? /^https?:$/.test(url.protocol) && document.location.origin !== url.origin\n : false;\n const target = crossOrigin ? '_blank' : targetProp;\n\n const showPopover = () => {\n if (isSmallOrAbove && !previewPopover) {\n setPopover(true);\n }\n };\n\n const showPreviewPopover = () => {\n if (isSmallOrAbove && !popover && !contextMenuOpened.current) setPreviewPopover(true);\n };\n\n const hidePopover = () => {\n setPopover(false);\n };\n\n const hidePreviewPopover = () => {\n setPreviewPopover(false);\n };\n\n const onBlurLink = () => {\n contextMenuOpened.current = false;\n hidePreviewPopover();\n };\n\n const onPreviewClick = () => {\n previewTriggerRef.current = linkRef.current;\n onPreview?.({ href });\n };\n\n const onKeyUp = (e: KeyboardEvent) => {\n if (e.getModifierState('Alt') && e.code === 'KeyP') {\n onPreviewClick();\n }\n };\n\n useEffect(() => {\n if (popoverHideDelay === 'none' && !popover && !previewPopover) {\n setPopoverHideDelay('short');\n }\n }, [popoverHideDelay, popover, previewPopover]);\n\n return (\n <>\n <StyledLink\n data-testid={testIds.root}\n href={href}\n variant={variant}\n ref={linkRef as any}\n target={target}\n {...restProps}\n aria-describedby={previewable ? `${uid}-preview-instructions` : undefined}\n onMouseEnter={\n previewable\n ? () => {\n showPopover();\n }\n : undefined\n }\n onMouseLeave={hidePopover}\n onFocus={\n previewable\n ? () => {\n showPreviewPopover();\n }\n : undefined\n }\n onBlur={onBlurLink}\n onKeyUp={onKeyUp}\n onContextMenu={() => {\n contextMenuOpened.current = true;\n\n setPopoverHideDelay('none');\n setPreviewPopover(false);\n setPopover(false);\n }}\n >\n {children}\n {target === '_blank' && <VisuallyHiddenText>{t('opens_in_a_new_tab')}</VisuallyHiddenText>}\n {!icon && target === '_blank' && <Icon name='open' />}\n </StyledLink>\n\n {previewable && (\n <Popover\n data-testid={testIds.previewPopover}\n show={previewPopover}\n groupId='link_preview'\n showDelay='short'\n hideDelay={popoverHideDelay}\n placement='bottom'\n target={linkRef.current}\n as={StyledLinkPopover}\n arrow\n preview\n portal\n onHide={hidePreviewPopover}\n >\n <StyledLinkPreviewPopoverBtn\n data-testid={testIds.preview}\n preview\n type='button'\n ref={previewBtnRef}\n onClick={onPreviewClick}\n tabIndex='-1'\n >\n <Text>\n <span>{t('preview')}</span>\n <Flex container={{ inline: true, justify: 'end' }}>\n <Keyboard keyName='Alt' />\n <Keyboard keyName='P' />\n </Flex>\n </Text>\n </StyledLinkPreviewPopoverBtn>\n </Popover>\n )}\n\n <Popover\n data-testid={testIds.previewPopover}\n show={popover}\n groupId='link_preview'\n showDelay='short'\n hideDelay={popoverHideDelay}\n placement='bottom'\n target={linkRef.current}\n onMouseEnter={showPopover}\n onMouseLeave={hidePopover}\n as={StyledLinkPopover}\n arrow\n portal\n >\n {!inModal && (\n <StyledLinkPopoverBtn\n data-testid={testIds.preview}\n preview\n type='button'\n ref={previewBtnRef}\n onClick={onPreviewClick}\n tabIndex='-1'\n >\n {t('preview')}\n </StyledLinkPopoverBtn>\n )}\n <StyledLinkPopoverBtn\n data-testid={testIds.newTab}\n forwardedAs='a'\n href={href}\n target='_blank'\n rel='noreferrer'\n tabIndex='-1'\n >\n {t('link_open_in_tab_text')}\n </StyledLinkPopoverBtn>\n </Popover>\n\n {previewable && (\n <span id={`${uid}-preview-instructions`} hidden>\n {t('preview_link_instruction', [macintosh ? 'option' : 'alt'])}\n </span>\n )}\n </>\n );\n});\n\nexport default withTestIds(Link, getLinkTestIds);\n"]}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="google.maps" />
2
- import type { FieldValueListItem } from '../FieldValueList';
2
+ import type { FieldValueListItemProps } from '../FieldValueList';
3
3
  export declare type LatLng = {
4
4
  /** The latitude representation. */
5
5
  latitude: ReturnType<google.maps.LatLng['lat']>;
@@ -45,7 +45,7 @@ export interface Location {
45
45
  }
46
46
  export interface Pin extends LatLng {
47
47
  title?: string;
48
- additionalInfo?: FieldValueListItem[];
48
+ additionalInfo?: FieldValueListItemProps[];
49
49
  selected?: boolean;
50
50
  }
51
51
  //# sourceMappingURL=Location.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Location.types.d.ts","sourceRoot":"","sources":["../../../src/components/Location/Location.types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,CAAC,OAAO,MAAM,MAAM,GAAG;IAC3B,mCAAmC;IACnC,QA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AQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"Location.types.js","sourceRoot":"","sources":["../../../src/components/Location/Location.types.ts"],"names":[],"mappings":"AAkCA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,UAAU,CAAC,CAAC;AAC3F,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAC1D,MAAM,CAAC,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AACrE,MAAM,CAAC,MAAM,0BAA0B,GAAG,6BAA6B,CAAC;AACxE,MAAM,CAAC,MAAM,kBAAkB,GAAG,sCAAsC,CAAC;AACzE,MAAM,CAAC,MAAM,yBAAyB,GAAG,mCAAmC,CAAC;AAC7E,MAAM,CAAC,MAAM,yBAAyB,GAAG,0BAA0B,CAAC;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,wBAAwB,CAAC","sourcesContent":["import type { FieldValueListItem } from '../FieldValueList';\n\nexport declare type LatLng = {\n /** The latitude representation. */\n latitude: ReturnType<google.maps.LatLng['lat']>;\n /** The longitude representation. */\n longitude: ReturnType<google.maps.LatLng['lng']>;\n};\n\nexport declare type Bias = {\n /** Predictions will be biased towards, but not restricted to, the given bounds. Both location and radius will be ignored if bounds is set.\n * Array stores south-west coordinate of bounding box and north-east coordinate of bounding box. */\n bounds?: [LatLng, LatLng];\n /** Predictions will be biased towards the given location and radius. */\n location?: {\n /** Must to provide both center and radius. */\n /** Location coordinate or current (means user current location). */\n center: LatLng | 'current';\n /** The radius is specified in meters. */\n radius: number;\n };\n};\n\nexport declare type ProviderOpts = {\n [key: string]: any;\n};\n\nexport interface MapsProvider {\n name: string;\n loadAPI: (options: ProviderOpts) => Promise<void>;\n loadedPromise: Promise<void> | null;\n loadedApiKey: string;\n}\n\nexport const QUERY_FIELDS = ['name', 'formatted_address', 'geometry.location', 'place_id'];\nexport const QUERY_TYPES = ['establishment', 'geocode'];\n\nexport const LocationNotFoundError = 'Location not found';\nexport const GeolocationUnsupportedError = 'Geolocation unsupported';\nexport const GoogleMapsAPINotFoundError = 'Cannot load Google Maps API';\nexport const IsNotAnObjectError = 'Provider data given is not an object';\nexport const ProviderNotSupportedError = 'Not supported maps provider given';\nexport const CoordsCannotBeParsedError = 'Coords cannot be parsed!';\nexport const GeocoderFailedError = 'Geocoder failed due to';\n\nexport interface Location {\n name?: google.maps.places.PlaceResult['name'];\n address?: google.maps.places.PlaceResult['formatted_address'];\n latitude?: ReturnType<google.maps.LatLng['lat']>;\n longitude?: ReturnType<google.maps.LatLng['lng']>;\n}\n\nexport interface Pin extends LatLng {\n title?: string;\n additionalInfo?: FieldValueListItem[];\n selected?: boolean;\n}\n"]}
1
+ {"version":3,"file":"Location.types.js","sourceRoot":"","sources":["../../../src/components/Location/Location.types.ts"],"names":[],"mappings":"AAkCA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,UAAU,CAAC,CAAC;AAC3F,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAC1D,MAAM,CAAC,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AACrE,MAAM,CAAC,MAAM,0BAA0B,GAAG,6BAA6B,CAAC;AACxE,MAAM,CAAC,MAAM,kBAAkB,GAAG,sCAAsC,CAAC;AACzE,MAAM,CAAC,MAAM,yBAAyB,GAAG,mCAAmC,CAAC;AAC7E,MAAM,CAAC,MAAM,yBAAyB,GAAG,0BAA0B,CAAC;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,wBAAwB,CAAC","sourcesContent":["import type { FieldValueListItemProps } from '../FieldValueList';\n\nexport declare type LatLng = {\n /** The latitude representation. */\n latitude: ReturnType<google.maps.LatLng['lat']>;\n /** The longitude representation. */\n longitude: ReturnType<google.maps.LatLng['lng']>;\n};\n\nexport declare type Bias = {\n /** Predictions will be biased towards, but not restricted to, the given bounds. Both location and radius will be ignored if bounds is set.\n * Array stores south-west coordinate of bounding box and north-east coordinate of bounding box. */\n bounds?: [LatLng, LatLng];\n /** Predictions will be biased towards the given location and radius. */\n location?: {\n /** Must to provide both center and radius. */\n /** Location coordinate or current (means user current location). */\n center: LatLng | 'current';\n /** The radius is specified in meters. */\n radius: number;\n };\n};\n\nexport declare type ProviderOpts = {\n [key: string]: any;\n};\n\nexport interface MapsProvider {\n name: string;\n loadAPI: (options: ProviderOpts) => Promise<void>;\n loadedPromise: Promise<void> | null;\n loadedApiKey: string;\n}\n\nexport const QUERY_FIELDS = ['name', 'formatted_address', 'geometry.location', 'place_id'];\nexport const QUERY_TYPES = ['establishment', 'geocode'];\n\nexport const LocationNotFoundError = 'Location not found';\nexport const GeolocationUnsupportedError = 'Geolocation unsupported';\nexport const GoogleMapsAPINotFoundError = 'Cannot load Google Maps API';\nexport const IsNotAnObjectError = 'Provider data given is not an object';\nexport const ProviderNotSupportedError = 'Not supported maps provider given';\nexport const CoordsCannotBeParsedError = 'Coords cannot be parsed!';\nexport const GeocoderFailedError = 'Geocoder failed due to';\n\nexport interface Location {\n name?: google.maps.places.PlaceResult['name'];\n address?: google.maps.places.PlaceResult['formatted_address'];\n latitude?: ReturnType<google.maps.LatLng['lat']>;\n longitude?: ReturnType<google.maps.LatLng['lng']>;\n}\n\nexport interface Pin extends LatLng {\n title?: string;\n additionalInfo?: FieldValueListItemProps[];\n selected?: boolean;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.context.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.context.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;;AAErD,wBAcG"}
1
+ {"version":3,"file":"Menu.context.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.context.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;;AAErD,wBAeG"}
@@ -3,6 +3,7 @@ import { createUID } from '../../utils';
3
3
  export default createContext({
4
4
  mode: 'action',
5
5
  variant: 'drill-down',
6
+ itemLayout: 'stacked',
6
7
  scrollAt: 7,
7
8
  loading: false,
8
9
  componentId: createUID(),
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.context.js","sourceRoot":"","sources":["../../../src/components/Menu/Menu.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,eAAe,aAAa,CAAmB;IAC7C,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,SAAS,EAAE;IACxB,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI;IACxB,mBAAmB,EAAE,EAAE;IACvB,YAAY,EAAE,IAAI;IAClB,uBAAuB,EAAE,GAAG,EAAE,CAAC,IAAI;IACnC,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC9B,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC5B,eAAe,EAAE,GAAG,EAAE,CAAC,EAAE;IACzB,2BAA2B,EAAE,GAAG,EAAE,CAAC,IAAI;CACxC,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nimport { createUID } from '../../utils';\n\nimport type { MenuContextProps } from './Menu.types';\n\nexport default createContext<MenuContextProps>({\n mode: 'action',\n variant: 'drill-down',\n scrollAt: 7,\n loading: false,\n componentId: createUID(),\n pushFlyoutId: () => null,\n flyOutActiveIdStack: [],\n focusControl: null,\n updateActiveDescendants: () => null,\n setFocusDescendant: () => null,\n setFocusReturnEl: () => null,\n getScopedItemId: () => '',\n updateParentDescendantStack: () => null\n});\n"]}
1
+ {"version":3,"file":"Menu.context.js","sourceRoot":"","sources":["../../../src/components/Menu/Menu.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,eAAe,aAAa,CAAmB;IAC7C,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,YAAY;IACrB,UAAU,EAAE,SAAS;IACrB,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,SAAS,EAAE;IACxB,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI;IACxB,mBAAmB,EAAE,EAAE;IACvB,YAAY,EAAE,IAAI;IAClB,uBAAuB,EAAE,GAAG,EAAE,CAAC,IAAI;IACnC,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC9B,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC5B,eAAe,EAAE,GAAG,EAAE,CAAC,EAAE;IACzB,2BAA2B,EAAE,GAAG,EAAE,CAAC,IAAI;CACxC,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nimport { createUID } from '../../utils';\n\nimport type { MenuContextProps } from './Menu.types';\n\nexport default createContext<MenuContextProps>({\n mode: 'action',\n variant: 'drill-down',\n itemLayout: 'stacked',\n scrollAt: 7,\n loading: false,\n componentId: createUID(),\n pushFlyoutId: () => null,\n flyOutActiveIdStack: [],\n focusControl: null,\n updateActiveDescendants: () => null,\n setFocusDescendant: () => null,\n setFocusReturnEl: () => null,\n getScopedItemId: () => '',\n updateParentDescendantStack: () => null\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;AAY5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAUhD,OAAO,KAAK,EAEV,SAAS,EAGV,MAAM,cAAc,CAAC;;;;AAyXtB,wBAAiD"}
1
+ {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;AAY5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAUhD,OAAO,KAAK,EAEV,SAAS,EAGV,MAAM,cAAc,CAAC;;;;AA+XtB,wBAAiD"}
@@ -12,7 +12,7 @@ import { getMenuTestIds } from './Menu.test-ids';
12
12
  import MenuList from './MenuList';
13
13
  const Menu = forwardRef(function Menu(props, ref) {
14
14
  const uid = useUID();
15
- const { testId, id = uid, items = [], onCreateNew, mode = 'action', accent, scrollAt = 7, emptyText, onItemClick, onItemActive, onItemExpand, loadMore, onItemCollapse, loading = false, currentItemId, header, footer, variant = 'drill-down', focusControlEl, arrowNavigationUnsupported, 'aria-describedby': ariaDescribedBy, 'aria-label': label, role = 'menu', listId, pauseDescendantEvaluation, ...restProps } = props;
15
+ const { testId, id = uid, items = [], itemLayout = 'stacked', onCreateNew, mode = 'action', accent, scrollAt = 7, emptyText, onItemClick, onItemActive, onItemExpand, loadMore, onItemCollapse, loading = false, currentItemId, header, footer, variant = 'drill-down', focusControlEl, arrowNavigationUnsupported, 'aria-describedby': ariaDescribedBy, 'aria-label': label, role = 'menu', listId, pauseDescendantEvaluation, menuList: customMenuList, ...restProps } = props;
16
16
  const testIds = useTestIds(testId, getMenuTestIds);
17
17
  const t = useI18n();
18
18
  const { end: endDirection, start: startDirection } = useDirection();
@@ -203,6 +203,7 @@ const Menu = forwardRef(function Menu(props, ref) {
203
203
  onItemActive,
204
204
  onItemExpand,
205
205
  onItemCollapse,
206
+ itemLayout,
206
207
  accent,
207
208
  scrollAt,
208
209
  emptyText,
@@ -228,6 +229,7 @@ const Menu = forwardRef(function Menu(props, ref) {
228
229
  onItemActive,
229
230
  onItemExpand,
230
231
  onItemCollapse,
232
+ itemLayout,
231
233
  accent,
232
234
  scrollAt,
233
235
  emptyText,
@@ -244,7 +246,9 @@ const Menu = forwardRef(function Menu(props, ref) {
244
246
  flyOutActiveIdStack,
245
247
  updateParentDescendantStack
246
248
  ]);
247
- return (_jsxs(StyledMenu, { "data-testid": testIds.root, id: id, "aria-describedby": menuAsFocusControl ? `${id}-menuDescription` : undefined, ...restProps, ref: menuRef, tabIndex: menuAsFocusControl ? 0 : undefined, children: [menuAsFocusControl && (_jsx("span", { id: `${id}-menuDescription`, hidden: true, children: (`${t('menu_selection_instructions')} ` && ariaDescribedBy) || '' })), label && _jsx(VisuallyHiddenText, { id: `${id}-menuLabel`, children: label }), header && _jsx("header", { "data-popover-scroll-el": true, children: header }), _jsx(StyledMenuListWrapper, { "data-popover-scroll-el": true, children: _jsx(MenuContext.Provider, { value: contextValue, children: variant === 'drill-down' ? (_jsx(MenuList, { items: items, id: listId, menuRole: role, "aria-labelledby": label ? `${id}-menuLabel` : undefined })) : (_jsx(FlyoutMenuList, { items: items, menuRole: role })) }) }), (onCreateNew || footer) && (_jsx("footer", { "data-popover-scroll-el": true, children: onCreateNew ? (_jsxs(Button, { "data-testid": testIds.createNew, variant: 'link', onClick: onCreateNew, children: [_jsx(Icon, { name: 'plus' }), " ", t('create_new')] })) : (footer) }))] }));
249
+ const menuList = customMenuList ??
250
+ (variant === 'drill-down' ? (_jsx(MenuList, { items: items, id: listId, menuRole: role, "aria-labelledby": label ? `${id}-menuLabel` : undefined })) : (_jsx(FlyoutMenuList, { items: items, menuRole: role })));
251
+ return (_jsxs(StyledMenu, { "data-testid": testIds.root, id: id, "aria-describedby": menuAsFocusControl ? `${id}-menuDescription` : undefined, ...restProps, ref: menuRef, tabIndex: menuAsFocusControl ? 0 : undefined, children: [menuAsFocusControl && (_jsx("span", { id: `${id}-menuDescription`, hidden: true, children: (`${t('menu_selection_instructions')} ` && ariaDescribedBy) || '' })), label && _jsx(VisuallyHiddenText, { id: `${id}-menuLabel`, children: label }), header && _jsx("header", { "data-popover-scroll-el": true, children: header }), _jsx(StyledMenuListWrapper, { "data-popover-scroll-el": true, children: _jsx(MenuContext.Provider, { value: contextValue, children: menuList }) }), (onCreateNew || footer) && (_jsx("footer", { "data-popover-scroll-el": true, children: onCreateNew ? (_jsxs(Button, { "data-testid": testIds.createNew, variant: 'link', onClick: onCreateNew, children: [_jsx(Icon, { name: 'plus' }), " ", t('create_new')] })) : (footer) }))] }));
248
252
  });
249
253
  export default withTestIds(Menu, getMenuTestIds);
250
254
  //# sourceMappingURL=Menu.js.map