@pega/cosmos-react-core 10.0.0-build.5.3 → 10.0.0-build.5.5

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 (32) hide show
  1. package/lib/components/AIRewrite/AIRewrite.styles.d.ts +19 -3
  2. package/lib/components/AIRewrite/AIRewrite.styles.d.ts.map +1 -1
  3. package/lib/components/Dialog/Dialog.types.d.ts +23 -13
  4. package/lib/components/Dialog/Dialog.types.d.ts.map +1 -1
  5. package/lib/components/Dialog/Dialog.types.js.map +1 -1
  6. package/lib/components/Dialog/FormDialog.d.ts.map +1 -1
  7. package/lib/components/Dialog/FormDialog.js +50 -18
  8. package/lib/components/Dialog/FormDialog.js.map +1 -1
  9. package/lib/components/Dialog/InfoDialog.d.ts.map +1 -1
  10. package/lib/components/Dialog/InfoDialog.js +6 -4
  11. package/lib/components/Dialog/InfoDialog.js.map +1 -1
  12. package/lib/components/InlineEdit/InlineEdit.d.ts +6 -0
  13. package/lib/components/InlineEdit/InlineEdit.d.ts.map +1 -1
  14. package/lib/components/InlineEdit/InlineEdit.js +45 -4
  15. package/lib/components/InlineEdit/InlineEdit.js.map +1 -1
  16. package/lib/components/InlineEdit/InlineEdit.styles.d.ts +19 -3
  17. package/lib/components/InlineEdit/InlineEdit.styles.d.ts.map +1 -1
  18. package/lib/components/InlineEdit/InlineEdit.styles.js +38 -20
  19. package/lib/components/InlineEdit/InlineEdit.styles.js.map +1 -1
  20. package/lib/components/Link/Link.js +1 -1
  21. package/lib/components/Link/Link.js.map +1 -1
  22. package/lib/components/ListToolbar/ListToolbar.styles.d.ts +19 -3
  23. package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
  24. package/lib/components/Popover/getResolvedTarget.d.ts +11 -0
  25. package/lib/components/Popover/getResolvedTarget.d.ts.map +1 -0
  26. package/lib/components/Popover/getResolvedTarget.js +13 -0
  27. package/lib/components/Popover/getResolvedTarget.js.map +1 -0
  28. package/lib/components/Popover/index.d.ts +1 -0
  29. package/lib/components/Popover/index.d.ts.map +1 -1
  30. package/lib/components/Popover/index.js +1 -0
  31. package/lib/components/Popover/index.js.map +1 -1
  32. package/package.json +1 -1
@@ -2,21 +2,37 @@ export declare const StyledAIRewriteDialog: import("styled-components/dist/types
2
2
  onDismiss?: () => void;
3
3
  onCancel: import("../Dialog/Dialog.types").FormAction;
4
4
  onSubmit: import("../Dialog/Dialog.types").FormAction;
5
+ } & {
6
+ compact: true;
7
+ } & {
8
+ 'aria-label': string;
9
+ heading?: never;
10
+ additionalInfo?: never;
11
+ } & Omit<import("../..").Attributes<"div">, "compact" | "aria-label" | "onSubmit" | "onCancel" | "heading" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
12
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
13
+ }) | (Omit<Omit<import("../Dialog/Dialog.types").BaseDialogProps & {
14
+ onDismiss?: () => void;
15
+ onCancel: import("../Dialog/Dialog.types").FormAction;
16
+ onSubmit: import("../Dialog/Dialog.types").FormAction;
17
+ } & {
18
+ compact?: false | undefined;
5
19
  } & {
6
20
  heading: string;
7
21
  additionalInfo?: import("../AdditionalInfo").AdditionalInfoProps;
8
22
  'aria-label'?: never;
9
- } & Omit<import("../..").Attributes<"div">, "aria-label" | "onSubmit" | "onCancel" | "heading" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
23
+ } & Omit<import("../..").Attributes<"div">, "compact" | "aria-label" | "onSubmit" | "onCancel" | "heading" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
10
24
  ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
11
25
  }) | (Omit<Omit<import("../Dialog/Dialog.types").BaseDialogProps & {
12
26
  onDismiss?: () => void;
13
27
  onCancel: import("../Dialog/Dialog.types").FormAction;
14
28
  onSubmit: import("../Dialog/Dialog.types").FormAction;
15
29
  } & {
16
- heading?: never;
30
+ compact?: false | undefined;
31
+ } & {
17
32
  'aria-label': string;
33
+ heading?: never;
18
34
  additionalInfo?: never;
19
- } & Omit<import("../..").Attributes<"div">, "aria-label" | "onSubmit" | "onCancel" | "heading" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
35
+ } & Omit<import("../..").Attributes<"div">, "compact" | "aria-label" | "onSubmit" | "onCancel" | "heading" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
20
36
  ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
21
37
  }), import("styled-components/dist/types").BaseObject>> & string & Omit<import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<import("../Dialog").FormDialogProps> & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
22
38
  export declare const StyledFormSection: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -1 +1 @@
1
- {"version":3,"file":"AIRewrite.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;uRAIhC,CAAC;AAIH,eAAO,MAAM,iBAAiB,6NAM5B,CAAC;AAIH,eAAO,MAAM,yBAAyB,6NAIrC,CAAC"}
1
+ {"version":3,"file":"AIRewrite.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uRAIhC,CAAC;AAIH,eAAO,MAAM,iBAAiB,6NAM5B,CAAC;AAIH,eAAO,MAAM,yBAAyB,6NAIrC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { OmitStrict, WithAttributes } from '../../types';
2
+ import type { ExcludeStrict, OmitStrict, WithAttributes } from '../../types';
3
3
  import type { PopoverProps } from '../Popover';
4
4
  import type { ProgressProps } from '../Progress';
5
5
  import type { AdditionalInfoProps } from '../AdditionalInfo';
@@ -14,7 +14,7 @@ export interface BaseDialogProps {
14
14
  * An element the dialog is contextually and visually associated with. Normally a triggering button.
15
15
  * Components rendering Dialog should mount and unmount instances based on this value.
16
16
  */
17
- target: HTMLElement;
17
+ target: NonNullable<PopoverProps['target']>;
18
18
  /** Content for the dialog. Avoid form control buttons within as those should be rendered by way of onCancel and onSubmit with FormDialog. */
19
19
  children: PopoverProps['children'];
20
20
  /** If there is a progress state either on opening, or after submit, you must indicate as such. A custom message is supported as well. */
@@ -43,6 +43,18 @@ export type FormAction = (() => void) | {
43
43
  disabled?: boolean;
44
44
  handler: () => void;
45
45
  };
46
+ type HeadingOrARIALabel = {
47
+ /** A string to indicate context for the dialog. The dialog will be labelled by this value. */
48
+ heading: string;
49
+ /** Show additional info in form dialog header. */
50
+ additionalInfo?: AdditionalInfoProps;
51
+ 'aria-label'?: never;
52
+ } | {
53
+ /** Provide a contextually sufficient aria label if a visible heading is not provided. */
54
+ 'aria-label': string;
55
+ heading?: never;
56
+ additionalInfo?: never;
57
+ };
46
58
  export type FormDialogProps = WithAttributes<'div', BaseDialogProps & {
47
59
  /** Called when the user presses escape or clicks away. */
48
60
  onDismiss?: () => void;
@@ -57,18 +69,15 @@ export type FormDialogProps = WithAttributes<'div', BaseDialogProps & {
57
69
  * Invocation of this indicates the user wishes to submit any changes and close the dialog. Please consider progress states after submit.
58
70
  */
59
71
  onSubmit: FormAction;
60
- } & ({
61
- /** A string to indicate context for the dialog. The dialog will be labelled by this value. */
72
+ } & (({
73
+ /** Renders in a visually compact manner with icon action buttons. */
74
+ compact: true;
75
+ } & ExcludeStrict<HeadingOrARIALabel, {
62
76
  heading: string;
63
- /** Show additional info in form dialog header. */
64
- additionalInfo?: AdditionalInfoProps;
65
- 'aria-label'?: never;
66
- } | {
67
- heading?: never;
68
- /** Provide a contextually sufficient aria label if a visible heading is not provided. */
69
- 'aria-label': string;
70
- additionalInfo?: never;
71
- })>;
77
+ }>) | ({
78
+ /** Renders in a visually compact manner with icon action buttons. */
79
+ compact?: false | undefined;
80
+ } & HeadingOrARIALabel))>;
72
81
  export type InfoDialogProps = WithAttributes<'div', OmitStrict<BaseDialogProps, 'arrow'> & {
73
82
  /** A string or summary item like props to indicate context for the dialog. The dialog will be labelled by either the heading element or primary property. */
74
83
  heading?: string | {
@@ -87,4 +96,5 @@ export interface DialogHandleValue {
87
96
  open: () => void;
88
97
  close: () => void;
89
98
  }
99
+ export {};
90
100
  //# sourceMappingURL=Dialog.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.types.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,S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AC;IAChB,cAAc,CAAC,EAAE,KAAK,CAAC;CACxB,CAAC;AAEN,MAAM,MAAM,eAAe,GAAG,cAAc,CAC1C,KAAK,EACL,eAAe,GAAG;IAChB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IAEvB;;;;OAIG;IACH,QAAQ,EAAE,UAAU,CAAC;IAErB;;;OAGG;IACH,QAAQ,EAAE,UAAU,CAAC;CACtB,GAAG,CACE,CAAC;IACC,qEAAqE;IACrE,OAAO,EAAE,IAAI,CAAC;CACf,GAAG,aAAa,CAAC,kBAAkB,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,GAC3D,CAAC;IACC,qEAAqE;IACrE,OAAO,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;CAC7B,GAAG,kBAAkB,CAAC,CAC1B,CACJ,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,CAC1C,KAAK,EACL,UAAU,CAAC,eAAe,EAAE,OAAO,CAAC,GAAG;IACrC,6JAA6J;IAC7J,OAAO,CAAC,EACJ,MAAM,GACN;QACE,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,SAAS,CAAC;KACpB,CAAC;IAEN,2IAA2I;IAC3I,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB,CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.types.js","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { OmitStrict, WithAttributes } from '../../types';\nimport type { PopoverProps } from '../Popover';\nimport type { ProgressProps } from '../Progress';\nimport type { AdditionalInfoProps } from '../AdditionalInfo';\n\nexport interface BaseDialogProps {\n /**\n * Certain uses of dialogs require a linear edge with an input like control.\n * There an arrow is not desired.\n * @default true\n */\n arrow?: PopoverProps['arrow'];\n\n /**\n * An element the dialog is contextually and visually associated with. Normally a triggering button.\n * Components rendering Dialog should mount and unmount instances based on this value.\n */\n target: HTMLElement;\n\n /** Content for the dialog. Avoid form control buttons within as those should be rendered by way of onCancel and onSubmit with FormDialog. */\n children: PopoverProps['children'];\n\n /** If there is a progress state either on opening, or after submit, you must indicate as such. A custom message is supported as well. */\n progress?: boolean | ProgressProps['message'];\n\n /** Optionally render the dialog element at the end of the body or within a specified element. */\n portal?: PopoverProps['portal'];\n\n /** Positioning strategy for solving rendering scenarios. */\n strategy?: PopoverProps['strategy'];\n\n /**\n * Intended positioning placement for the dialog element.\n * Placement may auto adjust based on screen position and other layout variables.\n */\n placement?: PopoverProps['placement'];\n /**\n * Optionally determines whether to trap the focus inside the dialog, preventing it from being moved outside until the dialog is closed.\n * @default false\n */\n focusTrap?: boolean;\n\n /** Reference to the dialog's root element. */\n ref?: PopoverProps['ref'];\n}\n\nexport type DialogProps = WithAttributes<'div', BaseDialogProps>;\n\n/** A simple callback or an object to customize a subset button properties. */\nexport type FormAction =\n | (() => void)\n | {\n text?: string;\n disabled?: boolean;\n handler: () => void;\n };\n\nexport type FormDialogProps = WithAttributes<\n 'div',\n BaseDialogProps & {\n /** Called when the user presses escape or clicks away. */\n onDismiss?: () => void;\n\n /**\n * Renders a standard design system cancel button.\n * If onDismiss is not provided, onCancel will be invoked when the user presses the Escape key or clicks outside of the dialog.\n * Invocation of this indicates the user wishes to cancel any changes and close the dialog.\n */\n onCancel: FormAction;\n\n /**\n * Renders a standard design system submit button.\n * Invocation of this indicates the user wishes to submit any changes and close the dialog. Please consider progress states after submit.\n */\n onSubmit: FormAction;\n } & (\n | {\n /** A string to indicate context for the dialog. The dialog will be labelled by this value. */\n heading: string;\n /** Show additional info in form dialog header. */\n additionalInfo?: AdditionalInfoProps;\n 'aria-label'?: never;\n }\n | {\n heading?: never;\n /** Provide a contextually sufficient aria label if a visible heading is not provided. */\n 'aria-label': string;\n additionalInfo?: never;\n }\n )\n>;\n\nexport type InfoDialogProps = WithAttributes<\n 'div',\n OmitStrict<BaseDialogProps, 'arrow'> & {\n /** A string or summary item like props to indicate context for the dialog. The dialog will be labelled by either the heading element or primary property. */\n heading?:\n | string\n | {\n primary: string;\n secondary?: string;\n visual?: ReactNode;\n };\n\n /** Renders a standard design system dismiss button to close the dialog when the user clicks this button, presses escape or clicks away. */\n onDismiss: () => void;\n }\n>;\n\n/**\n * Components which render Dialog internally may need to offer some control to consuming components.\n * Use this interface to offer an imperative handle for shared control.\n */\nexport interface DialogHandleValue {\n open: () => void;\n close: () => void;\n}\n"]}
1
+ {"version":3,"file":"Dialog.types.js","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { ExcludeStrict, OmitStrict, WithAttributes } from '../../types';\nimport type { PopoverProps } from '../Popover';\nimport type { ProgressProps } from '../Progress';\nimport type { AdditionalInfoProps } from '../AdditionalInfo';\n\nexport interface BaseDialogProps {\n /**\n * Certain uses of dialogs require a linear edge with an input like control.\n * There an arrow is not desired.\n * @default true\n */\n arrow?: PopoverProps['arrow'];\n\n /**\n * An element the dialog is contextually and visually associated with. Normally a triggering button.\n * Components rendering Dialog should mount and unmount instances based on this value.\n */\n target: NonNullable<PopoverProps['target']>;\n\n /** Content for the dialog. Avoid form control buttons within as those should be rendered by way of onCancel and onSubmit with FormDialog. */\n children: PopoverProps['children'];\n\n /** If there is a progress state either on opening, or after submit, you must indicate as such. A custom message is supported as well. */\n progress?: boolean | ProgressProps['message'];\n\n /** Optionally render the dialog element at the end of the body or within a specified element. */\n portal?: PopoverProps['portal'];\n\n /** Positioning strategy for solving rendering scenarios. */\n strategy?: PopoverProps['strategy'];\n\n /**\n * Intended positioning placement for the dialog element.\n * Placement may auto adjust based on screen position and other layout variables.\n */\n placement?: PopoverProps['placement'];\n /**\n * Optionally determines whether to trap the focus inside the dialog, preventing it from being moved outside until the dialog is closed.\n * @default false\n */\n focusTrap?: boolean;\n\n /** Reference to the dialog's root element. */\n ref?: PopoverProps['ref'];\n}\n\nexport type DialogProps = WithAttributes<'div', BaseDialogProps>;\n\n/** A simple callback or an object to customize a subset button properties. */\nexport type FormAction =\n | (() => void)\n | {\n text?: string;\n disabled?: boolean;\n handler: () => void;\n };\n\ntype HeadingOrARIALabel =\n | {\n /** A string to indicate context for the dialog. The dialog will be labelled by this value. */\n heading: string;\n /** Show additional info in form dialog header. */\n additionalInfo?: AdditionalInfoProps;\n\n 'aria-label'?: never;\n }\n | {\n /** Provide a contextually sufficient aria label if a visible heading is not provided. */\n 'aria-label': string;\n\n heading?: never;\n additionalInfo?: never;\n };\n\nexport type FormDialogProps = WithAttributes<\n 'div',\n BaseDialogProps & {\n /** Called when the user presses escape or clicks away. */\n onDismiss?: () => void;\n\n /**\n * Renders a standard design system cancel button.\n * If onDismiss is not provided, onCancel will be invoked when the user presses the Escape key or clicks outside of the dialog.\n * Invocation of this indicates the user wishes to cancel any changes and close the dialog.\n */\n onCancel: FormAction;\n\n /**\n * Renders a standard design system submit button.\n * Invocation of this indicates the user wishes to submit any changes and close the dialog. Please consider progress states after submit.\n */\n onSubmit: FormAction;\n } & (\n | ({\n /** Renders in a visually compact manner with icon action buttons. */\n compact: true;\n } & ExcludeStrict<HeadingOrARIALabel, { heading: string }>) // Heading is not supported in compact mode, but an aria-label is required for accessibility.\n | ({\n /** Renders in a visually compact manner with icon action buttons. */\n compact?: false | undefined;\n } & HeadingOrARIALabel) // Heading and aria-label are both supported in non-compact mode.\n )\n>;\n\nexport type InfoDialogProps = WithAttributes<\n 'div',\n OmitStrict<BaseDialogProps, 'arrow'> & {\n /** A string or summary item like props to indicate context for the dialog. The dialog will be labelled by either the heading element or primary property. */\n heading?:\n | string\n | {\n primary: string;\n secondary?: string;\n visual?: ReactNode;\n };\n\n /** Renders a standard design system dismiss button to close the dialog when the user clicks this button, presses escape or clicks away. */\n onDismiss: () => void;\n }\n>;\n\n/**\n * Components which render Dialog internally may need to offer some control to consuming components.\n * Use this interface to offer an imperative handle for shared control.\n */\nexport interface DialogHandleValue {\n open: () => void;\n close: () => void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FormDialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/FormDialog.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAyB7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,eAAO,MAAM,gBAAgB;;uNAAmB,CAAC;AAEjD,QAAA,MAAM,UAAU,6HAwKf,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"FormDialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/FormDialog.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AA2B7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAWtD,eAAO,MAAM,gBAAgB;;uNAAmB,CAAC;AAEjD,QAAA,MAAM,UAAU,6HA0Of,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,29 +1,47 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { forwardRef, useEffect, useLayoutEffect, useRef } from 'react';
3
3
  import styled from 'styled-components';
4
4
  import { useConsolidatedRef, useContentTabIndex, useEscape, useI18n, useOuterEvent, useUID } from '../../hooks';
5
- import { getActiveElement, focusNonInteractiveElement } from '../../utils';
6
- import Button from '../Button';
5
+ import { getActiveElement, focusNonInteractiveElement, getFocusables } from '../../utils';
6
+ import Button, { StyledButton } from '../Button';
7
7
  import Text from '../Text';
8
8
  import Progress from '../Progress';
9
9
  import AdditionalInfo from '../AdditionalInfo';
10
10
  import Flex from '../Flex';
11
+ import getResolvedTarget from '../Popover/getResolvedTarget';
12
+ import Icon from '../Icon';
11
13
  import { StyledChildrenWrap, StyledDialogContent, StyledDialogFooter, StyledDialogHeader } from './Dialog.styles';
12
14
  import Dialog from './Dialog';
15
+ const StyledCompactDialogContent = styled.div ``;
16
+ const StyledCompactActions = styled.div `
17
+ ${StyledButton} {
18
+ margin-inline-start: unset;
19
+ }
20
+ `;
13
21
  export const StyledFormDialog = styled(Dialog) ``;
14
- const FormDialog = forwardRef(function FormDialog({ arrow = true, target, heading, 'aria-label': ariaLabel, children, progress, onDismiss, onCancel, onSubmit, additionalInfo, ...restProps }, ref) {
22
+ const FormDialog = forwardRef(function FormDialog({ arrow = true, compact, target, heading, 'aria-label': ariaLabel, children, progress, onDismiss, onCancel, onSubmit, additionalInfo, ...restProps }, ref) {
15
23
  const t = useI18n();
16
24
  const headingId = useUID();
17
25
  const headingRef = useRef(null);
18
26
  const dialogRef = useConsolidatedRef(ref);
19
27
  const dialogContentRef = useRef(null);
20
28
  const contentTabIndex = useContentTabIndex(dialogRef, dialogContentRef, [], [progress]);
29
+ const resolvedTarget = getResolvedTarget(target);
21
30
  const setFocus = () => {
22
31
  if (progress || !dialogRef.current)
23
32
  return;
24
33
  if (headingRef.current) {
25
34
  focusNonInteractiveElement(headingRef.current, heading ?? ariaLabel);
26
35
  }
36
+ else if (compact) {
37
+ const focusables = getFocusables(dialogContentRef);
38
+ if (focusables[0]) {
39
+ focusables[0].focus();
40
+ }
41
+ else {
42
+ focusNonInteractiveElement(dialogRef.current, heading ?? ariaLabel);
43
+ }
44
+ }
27
45
  else {
28
46
  focusNonInteractiveElement(dialogRef.current, heading ?? ariaLabel);
29
47
  }
@@ -38,7 +56,7 @@ const FormDialog = forwardRef(function FormDialog({ arrow = true, target, headin
38
56
  }
39
57
  e.stopPropagation();
40
58
  }, dialogRef, [onDismiss, onCancelHandler]);
41
- useOuterEvent('mousedown', [target, dialogRef], () => {
59
+ useOuterEvent('mousedown', [resolvedTarget, dialogRef], () => {
42
60
  if (onDismiss) {
43
61
  onDismiss();
44
62
  }
@@ -72,22 +90,36 @@ const FormDialog = forwardRef(function FormDialog({ arrow = true, target, headin
72
90
  // The 0 timeout ensures that the dialog will not re-open immediately after the close event is triggered.
73
91
  }, 0);
74
92
  };
75
- target.addEventListener('click', closeDialog);
93
+ resolvedTarget?.addEventListener('click', closeDialog);
76
94
  return () => {
77
- target.removeEventListener('click', closeDialog);
95
+ resolvedTarget?.removeEventListener('click', closeDialog);
78
96
  };
79
- }, []);
80
- return (_jsxs(StyledFormDialog, { ...restProps, ...(heading === undefined
97
+ }, [resolvedTarget, onDismiss, onCancelHandler]);
98
+ const cancelButton = (() => {
99
+ const label = typeof onCancel !== 'function' && onCancel.text ? onCancel.text : t('cancel');
100
+ return (_jsx(Button, { icon: compact, label: compact ? label : undefined, disabled: typeof onCancel !== 'function' ? onCancel.disabled : undefined, onClick: () => {
101
+ onCancelHandler();
102
+ }, children: compact ? _jsx(Icon, { name: 'times' }) : label }));
103
+ })();
104
+ const submitButton = (() => {
105
+ const label = typeof onSubmit !== 'function' && onSubmit.text ? onSubmit.text : t('submit');
106
+ return (_jsx(Button, { icon: compact, label: compact ? label : undefined, variant: 'primary', disabled: typeof onSubmit !== 'function' ? onSubmit.disabled : undefined, onClick: () => {
107
+ (typeof onSubmit !== 'function' ? onSubmit.handler : onSubmit)();
108
+ }, children: compact ? _jsx(Icon, { name: 'check' }) : label }));
109
+ })();
110
+ const layout = (() => {
111
+ if (compact) {
112
+ return (_jsxs(Flex, { container: { alignItems: 'start', pad: 0.75, colGap: 1 }, as: StyledCompactDialogContent, ref: dialogContentRef, children: [progress && (_jsx(Progress, { visible: !!progress, focusOnVisible: true, placement: 'local', message: typeof progress === 'string' ? progress : undefined })), children && (_jsx(Flex, { item: { grow: 1 }, as: StyledChildrenWrap, inert: progress ? '' : undefined, children: children })), _jsxs(Flex, { container: { alignItems: 'start', colGap: 0.5 }, item: { shrink: 0 }, as: StyledCompactActions, children: [cancelButton, submitButton] })] }));
113
+ }
114
+ return (_jsxs(_Fragment, { children: [heading !== undefined && (_jsxs(Flex, { container: {
115
+ alignItems: 'center',
116
+ gap: additionalInfo?.heading ? 1 : undefined,
117
+ pad: [2, 2, 1]
118
+ }, item: { shrink: 0 }, as: StyledDialogHeader, children: [_jsx(Text, { ref: headingRef, id: headingId, variant: 'h2', children: heading }), additionalInfo?.heading && (_jsx(AdditionalInfo, { heading: additionalInfo.heading, children: additionalInfo.children }))] })), _jsxs(Flex, { item: { grow: 1 }, as: StyledDialogContent, ref: dialogContentRef, tabIndex: contentTabIndex, children: [children && (_jsx(StyledChildrenWrap, { inert: progress ? '' : undefined, children: children })), _jsx(Progress, { visible: !!progress, focusOnVisible: true, placement: 'local', message: typeof progress === 'string' ? progress : undefined })] }), _jsxs(Flex, { container: { alignItems: 'center', justify: 'between', pad: 2 }, item: { shrink: 0 }, as: StyledDialogFooter, children: [cancelButton, submitButton] })] }));
119
+ })();
120
+ return (_jsx(StyledFormDialog, { ...restProps, ...(heading === undefined
81
121
  ? { 'aria-label': ariaLabel }
82
- : { 'aria-labelledby': headingId }), arrow: arrow, target: target, progress: progress, ref: dialogRef, children: [heading !== undefined && (_jsxs(Flex, { container: {
83
- alignItems: 'center',
84
- gap: additionalInfo?.heading ? 1 : undefined,
85
- pad: [2, 2, 1]
86
- }, item: { shrink: 0 }, as: StyledDialogHeader, children: [_jsx(Text, { ref: headingRef, id: headingId, variant: 'h2', children: heading }), additionalInfo?.heading && (_jsx(AdditionalInfo, { heading: additionalInfo.heading, children: additionalInfo.children }))] })), _jsxs(Flex, { item: { grow: 1 }, as: StyledDialogContent, ref: dialogContentRef, tabIndex: contentTabIndex, children: [children && (_jsx(StyledChildrenWrap, { inert: progress ? '' : undefined, children: children })), _jsx(Progress, { visible: !!progress, focusOnVisible: true, placement: 'local', message: typeof progress === 'string' ? progress : undefined })] }), _jsxs(Flex, { container: { alignItems: 'center', justify: 'between', pad: 2 }, item: { shrink: 0 }, as: StyledDialogFooter, children: [_jsx(Button, { onClick: () => {
87
- onCancelHandler();
88
- }, disabled: typeof onCancel !== 'function' ? onCancel.disabled : undefined, children: typeof onCancel !== 'function' && onCancel.text ? onCancel.text : t('cancel') }), _jsx(Button, { variant: 'primary', onClick: () => {
89
- (typeof onSubmit !== 'function' ? onSubmit.handler : onSubmit)();
90
- }, disabled: typeof onSubmit !== 'function' ? onSubmit.disabled : undefined, children: typeof onSubmit !== 'function' && onSubmit.text ? onSubmit.text : t('submit') })] })] }));
122
+ : { 'aria-labelledby': headingId }), arrow: arrow, target: target, progress: progress, ref: dialogRef, children: layout }));
91
123
  });
92
124
  export default FormDialog;
93
125
  //# sourceMappingURL=FormDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/FormDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,SAAS,EACT,OAAO,EACP,aAAa,EACb,MAAM,EACP,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAE/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,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{ PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\n\nimport {\n useConsolidatedRef,\n useContentTabIndex,\n useEscape,\n useI18n,\n useOuterEvent,\n useUID\n} from '../../hooks';\nimport { getActiveElement, focusNonInteractiveElement } from '../../utils';\nimport Button from '../Button';\nimport Text from '../Text';\nimport Progress from '../Progress';\nimport AdditionalInfo from '../AdditionalInfo';\nimport type { RefElement } from '../../types';\nimport Flex from '../Flex';\n\nimport {\n StyledChildrenWrap,\n StyledDialogContent,\n StyledDialogFooter,\n StyledDialogHeader\n} from './Dialog.styles';\nimport type { FormDialogProps } from './Dialog.types';\nimport Dialog from './Dialog';\n\nexport const StyledFormDialog = styled(Dialog)``;\n\nconst FormDialog = forwardRef<RefElement<FormDialogProps>, PropsWithoutRef<FormDialogProps>>(\n function FormDialog(\n {\n arrow = true,\n target,\n heading,\n 'aria-label': ariaLabel,\n children,\n progress,\n onDismiss,\n onCancel,\n onSubmit,\n additionalInfo,\n ...restProps\n },\n ref\n ) {\n const t = useI18n();\n const headingId = useUID();\n const headingRef = useRef<HTMLHeadingElement>(null);\n const dialogRef = useConsolidatedRef(ref);\n const dialogContentRef = useRef<HTMLDivElement>(null);\n const contentTabIndex = useContentTabIndex(dialogRef, dialogContentRef, [], [progress]);\n\n const setFocus = () => {\n if (progress || !dialogRef.current) return;\n if (headingRef.current) {\n focusNonInteractiveElement(headingRef.current, heading ?? ariaLabel);\n } else {\n focusNonInteractiveElement(dialogRef.current, heading ?? ariaLabel);\n }\n };\n\n const onCancelHandler = typeof onCancel === 'function' ? onCancel : onCancel.handler;\n\n useEscape(\n e => {\n if (onDismiss) {\n onDismiss();\n } else {\n onCancelHandler();\n }\n e.stopPropagation();\n },\n dialogRef,\n [onDismiss, onCancelHandler]\n );\n\n useOuterEvent('mousedown', [target, dialogRef], () => {\n if (onDismiss) {\n onDismiss();\n } else {\n onCancelHandler();\n }\n });\n\n // Using layout effect to capture the focused element prior to dialog elements taking focus.\n useLayoutEffect(() => {\n const initiatorElement = getActiveElement();\n\n return () => {\n if (initiatorElement instanceof HTMLElement && initiatorElement.isConnected) {\n initiatorElement.focus();\n }\n };\n }, []);\n\n useEffect(() => {\n if (!progress) {\n setFocus();\n }\n }, [progress]);\n\n useEffect(() => {\n const closeDialog = () => {\n setTimeout(() => {\n if (onDismiss) {\n onDismiss();\n } else {\n onCancelHandler();\n }\n // The 0 timeout ensures that the dialog will not re-open immediately after the close event is triggered.\n }, 0);\n };\n\n target.addEventListener('click', closeDialog);\n\n return () => {\n target.removeEventListener('click', closeDialog);\n };\n }, []);\n\n return (\n <StyledFormDialog\n {...restProps}\n {...(heading === undefined\n ? { 'aria-label': ariaLabel }\n : { 'aria-labelledby': headingId })}\n arrow={arrow}\n target={target}\n progress={progress}\n ref={dialogRef}\n >\n {heading !== undefined && (\n <Flex\n container={{\n alignItems: 'center',\n gap: additionalInfo?.heading ? 1 : undefined,\n pad: [2, 2, 1]\n }}\n item={{ shrink: 0 }}\n as={StyledDialogHeader}\n >\n <Text ref={headingRef} id={headingId} variant='h2'>\n {heading}\n </Text>\n {additionalInfo?.heading && (\n <AdditionalInfo heading={additionalInfo.heading}>\n {additionalInfo.children}\n </AdditionalInfo>\n )}\n </Flex>\n )}\n\n <Flex\n item={{ grow: 1 }}\n as={StyledDialogContent}\n ref={dialogContentRef}\n tabIndex={contentTabIndex}\n >\n {children && (\n <StyledChildrenWrap inert={progress ? '' : undefined}>{children}</StyledChildrenWrap>\n )}\n <Progress\n visible={!!progress}\n focusOnVisible\n placement='local'\n message={typeof progress === 'string' ? progress : undefined}\n />\n </Flex>\n\n <Flex\n container={{ alignItems: 'center', justify: 'between', pad: 2 }}\n item={{ shrink: 0 }}\n as={StyledDialogFooter}\n >\n <Button\n onClick={() => {\n onCancelHandler();\n }}\n disabled={typeof onCancel !== 'function' ? onCancel.disabled : undefined}\n >\n {typeof onCancel !== 'function' && onCancel.text ? onCancel.text : t('cancel')}\n </Button>\n\n <Button\n variant='primary'\n onClick={() => {\n (typeof onSubmit !== 'function' ? onSubmit.handler : onSubmit)();\n }}\n disabled={typeof onSubmit !== 'function' ? onSubmit.disabled : undefined}\n >\n {typeof onSubmit !== 'function' && onSubmit.text ? onSubmit.text : t('submit')}\n </Button>\n </Flex>\n </StyledFormDialog>\n );\n }\n);\n\nexport default FormDialog;\n"]}
1
+ {"version":3,"file":"FormDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/FormDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,SAAS,EACT,OAAO,EACP,aAAa,EACb,MAAM,EACP,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC1F,OAAO,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAE/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,iBAAiB,MAAM,8BAA8B,CAAC;AAC7D,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAEhD,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAA;IACnC,YAAY;;;CAGf,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA,EAAE,C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CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,GAC5D,IACG,EACP,MAAC,IAAI,IACH,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE,EAC/D,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EACnB,EAAE,EAAE,kBAAkB,aAErB,YAAY,EACZ,YAAY,IACR,IACN,CACJ,CAAC;IACJ,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO,CACL,KAAC,gBAAgB,OACX,SAAS,KACT,CAAC,OAAO,KAAK,SAAS;YACxB,CAAC,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE;YAC7B,CAAC,CAAC,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC,EACrC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,SAAS,YAEb,MAAM,GACU,CACpB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, useEffect, useLayoutEffect, useRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\n\nimport {\n useConsolidatedRef,\n useContentTabIndex,\n useEscape,\n useI18n,\n useOuterEvent,\n useUID\n} from '../../hooks';\nimport { getActiveElement, focusNonInteractiveElement, getFocusables } from '../../utils';\nimport Button, { StyledButton } from '../Button';\nimport Text from '../Text';\nimport Progress from '../Progress';\nimport AdditionalInfo from '../AdditionalInfo';\nimport type { RefElement } from '../../types';\nimport Flex from '../Flex';\nimport getResolvedTarget from '../Popover/getResolvedTarget';\nimport Icon from '../Icon';\n\nimport {\n StyledChildrenWrap,\n StyledDialogContent,\n StyledDialogFooter,\n StyledDialogHeader\n} from './Dialog.styles';\nimport type { FormDialogProps } from './Dialog.types';\nimport Dialog from './Dialog';\n\nconst StyledCompactDialogContent = styled.div``;\n\nconst StyledCompactActions = styled.div`\n ${StyledButton} {\n margin-inline-start: unset;\n }\n`;\n\nexport const StyledFormDialog = styled(Dialog)``;\n\nconst FormDialog = forwardRef<RefElement<FormDialogProps>, PropsWithoutRef<FormDialogProps>>(\n function FormDialog(\n {\n arrow = true,\n compact,\n target,\n heading,\n 'aria-label': ariaLabel,\n children,\n progress,\n onDismiss,\n onCancel,\n onSubmit,\n additionalInfo,\n ...restProps\n },\n ref\n ) {\n const t = useI18n();\n const headingId = useUID();\n const headingRef = useRef<HTMLHeadingElement>(null);\n const dialogRef = useConsolidatedRef(ref);\n const dialogContentRef = useRef<HTMLDivElement>(null);\n const contentTabIndex = useContentTabIndex(dialogRef, dialogContentRef, [], [progress]);\n const resolvedTarget = getResolvedTarget(target);\n\n const setFocus = () => {\n if (progress || !dialogRef.current) return;\n if (headingRef.current) {\n focusNonInteractiveElement(headingRef.current, heading ?? ariaLabel);\n } else if (compact) {\n const focusables = getFocusables(dialogContentRef);\n if (focusables[0]) {\n focusables[0].focus();\n } else {\n focusNonInteractiveElement(dialogRef.current, heading ?? ariaLabel);\n }\n } else {\n focusNonInteractiveElement(dialogRef.current, heading ?? ariaLabel);\n }\n };\n\n const onCancelHandler = typeof onCancel === 'function' ? onCancel : onCancel.handler;\n\n useEscape(\n e => {\n if (onDismiss) {\n onDismiss();\n } else {\n onCancelHandler();\n }\n e.stopPropagation();\n },\n dialogRef,\n [onDismiss, onCancelHandler]\n );\n\n useOuterEvent('mousedown', [resolvedTarget, dialogRef], () => {\n if (onDismiss) {\n onDismiss();\n } else {\n onCancelHandler();\n }\n });\n\n // Using layout effect to capture the focused element prior to dialog elements taking focus.\n useLayoutEffect(() => {\n const initiatorElement = getActiveElement();\n\n return () => {\n if (initiatorElement instanceof HTMLElement && initiatorElement.isConnected) {\n initiatorElement.focus();\n }\n };\n }, []);\n\n useEffect(() => {\n if (!progress) {\n setFocus();\n }\n }, [progress]);\n\n useEffect(() => {\n const closeDialog = () => {\n setTimeout(() => {\n if (onDismiss) {\n onDismiss();\n } else {\n onCancelHandler();\n }\n // The 0 timeout ensures that the dialog will not re-open immediately after the close event is triggered.\n }, 0);\n };\n\n resolvedTarget?.addEventListener('click', closeDialog);\n\n return () => {\n resolvedTarget?.removeEventListener('click', closeDialog);\n };\n }, [resolvedTarget, onDismiss, onCancelHandler]);\n\n const cancelButton = (() => {\n const label = typeof onCancel !== 'function' && onCancel.text ? onCancel.text : t('cancel');\n\n return (\n <Button\n icon={compact}\n label={compact ? label : undefined}\n disabled={typeof onCancel !== 'function' ? onCancel.disabled : undefined}\n onClick={() => {\n onCancelHandler();\n }}\n >\n {compact ? <Icon name='times' /> : label}\n </Button>\n );\n })();\n\n const submitButton = (() => {\n const label = typeof onSubmit !== 'function' && onSubmit.text ? onSubmit.text : t('submit');\n\n return (\n <Button\n icon={compact}\n label={compact ? label : undefined}\n variant='primary'\n disabled={typeof onSubmit !== 'function' ? onSubmit.disabled : undefined}\n onClick={() => {\n (typeof onSubmit !== 'function' ? onSubmit.handler : onSubmit)();\n }}\n >\n {compact ? <Icon name='check' /> : label}\n </Button>\n );\n })();\n\n const layout = (() => {\n if (compact) {\n return (\n <Flex\n container={{ alignItems: 'start', pad: 0.75, colGap: 1 }}\n as={StyledCompactDialogContent}\n ref={dialogContentRef}\n >\n {progress && (\n <Progress\n visible={!!progress}\n focusOnVisible\n placement='local'\n message={typeof progress === 'string' ? progress : undefined}\n />\n )}\n {children && (\n <Flex item={{ grow: 1 }} as={StyledChildrenWrap} inert={progress ? '' : undefined}>\n {children}\n </Flex>\n )}\n <Flex\n container={{ alignItems: 'start', colGap: 0.5 }}\n item={{ shrink: 0 }}\n as={StyledCompactActions}\n >\n {cancelButton}\n {submitButton}\n </Flex>\n </Flex>\n );\n }\n\n return (\n <>\n {heading !== undefined && (\n <Flex\n container={{\n alignItems: 'center',\n gap: additionalInfo?.heading ? 1 : undefined,\n pad: [2, 2, 1]\n }}\n item={{ shrink: 0 }}\n as={StyledDialogHeader}\n >\n <Text ref={headingRef} id={headingId} variant='h2'>\n {heading}\n </Text>\n {additionalInfo?.heading && (\n <AdditionalInfo heading={additionalInfo.heading}>\n {additionalInfo.children}\n </AdditionalInfo>\n )}\n </Flex>\n )}\n <Flex\n item={{ grow: 1 }}\n as={StyledDialogContent}\n ref={dialogContentRef}\n tabIndex={contentTabIndex}\n >\n {children && (\n <StyledChildrenWrap inert={progress ? '' : undefined}>{children}</StyledChildrenWrap>\n )}\n <Progress\n visible={!!progress}\n focusOnVisible\n placement='local'\n message={typeof progress === 'string' ? progress : undefined}\n />\n </Flex>\n <Flex\n container={{ alignItems: 'center', justify: 'between', pad: 2 }}\n item={{ shrink: 0 }}\n as={StyledDialogFooter}\n >\n {cancelButton}\n {submitButton}\n </Flex>\n </>\n );\n })();\n\n return (\n <StyledFormDialog\n {...restProps}\n {...(heading === undefined\n ? { 'aria-label': ariaLabel }\n : { 'aria-labelledby': headingId })}\n arrow={arrow}\n target={target}\n progress={progress}\n ref={dialogRef}\n >\n {layout}\n </StyledFormDialog>\n );\n }\n);\n\nexport default FormDialog;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"InfoDialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/InfoDialog.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,QAAA,MAAM,UAAU,yHAsJf,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"InfoDialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/InfoDialog.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,QAAA,MAAM,UAAU,yHAuJf,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -7,6 +7,7 @@ import Progress from '../Progress';
7
7
  import Flex from '../Flex';
8
8
  import SummaryItem from '../SummaryItem';
9
9
  import { focusNonInteractiveElement, getActiveElement } from '../../utils';
10
+ import getResolvedTarget from '../Popover/getResolvedTarget';
10
11
  import { StyledChildrenWrap, StyledDialogContent, StyledDialogHeader } from './Dialog.styles';
11
12
  import { StyledDismissButton, StyledInfoDialog } from './InfoDialog.styles';
12
13
  const InfoDialog = forwardRef(function InfoDialog({ target, heading: headingProp, children, progress: progressProp, onDismiss, ...restProps }, ref) {
@@ -17,6 +18,7 @@ const InfoDialog = forwardRef(function InfoDialog({ target, heading: headingProp
17
18
  const dialogRef = useConsolidatedRef(ref);
18
19
  const dialogContentRef = useRef(null);
19
20
  const contentTabIndex = useContentTabIndex(dialogRef, dialogContentRef, [], [progressProp]);
21
+ const resolvedTarget = getResolvedTarget(target);
20
22
  const setFocus = () => {
21
23
  if (progressProp)
22
24
  return;
@@ -31,7 +33,7 @@ const InfoDialog = forwardRef(function InfoDialog({ target, heading: headingProp
31
33
  onDismiss?.();
32
34
  e.stopPropagation();
33
35
  }, dialogRef, [onDismiss]);
34
- useOuterEvent('mousedown', [target, dialogRef], () => {
36
+ useOuterEvent('mousedown', [resolvedTarget, dialogRef], () => {
35
37
  onDismiss?.();
36
38
  });
37
39
  // Using layout effect to capture the focused element prior to dialog elements taking focus.
@@ -55,11 +57,11 @@ const InfoDialog = forwardRef(function InfoDialog({ target, heading: headingProp
55
57
  // The 0 timeout ensures that the dialog will not re-open immediately after the close event is triggered.
56
58
  }, 0);
57
59
  };
58
- target.addEventListener('click', closeDialog);
60
+ resolvedTarget?.addEventListener('click', closeDialog);
59
61
  return () => {
60
- target.removeEventListener('click', closeDialog);
62
+ resolvedTarget?.removeEventListener('click', closeDialog);
61
63
  };
62
- }, []);
64
+ }, [onDismiss, resolvedTarget]);
63
65
  const heading = headingProp ? (_jsx(Text, { ref: headingRef, id: headingId, variant: 'h2', children: headingText })) : null;
64
66
  const progress = (_jsx(Progress, { visible: !!progressProp, focusOnVisible: true, placement: 'local', message: typeof progressProp === 'string' ? progressProp : undefined }));
65
67
  const dismissButton = (_jsx(StyledDismissButton, { icon: true, variant: 'sim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ardRef, useEffect, useLayoutEffect, useRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport {\n useConsolidatedRef,\n useContentTabIndex,\n useEscape,\n useI18n,\n useOuterEvent,\n useUID\n} from '../../hooks';\nimport Text from '../Text';\nimport Icon from '../Icon';\nimport Progress from '../Progress';\nimport Flex from '../Flex';\nimport SummaryItem from '../SummaryItem';\nimport { focusNonInteractiveElement, getActiveElement } from '../../utils';\nimport type { RefElement } from '../../types';\n\nimport { StyledChildrenWrap, StyledDialogContent, StyledDialogHeader } from './Dialog.styles';\nimport type { InfoDialogProps } from './Dialog.types';\nimport { StyledDismissButton, StyledInfoDialog } from './InfoDialog.styles';\n\nconst InfoDialog = forwardRef<RefElement<InfoDialogProps>, PropsWithoutRef<InfoDialogProps>>(\n function InfoDialog(\n { target, heading: headingProp, children, progress: progressProp, onDismiss, ...restProps },\n ref\n ) {\n const t = useI18n();\n const headingId = useUID();\n const headingRef = useRef<HTMLHeadingElement | HTMLSpanElement>(null);\n const headingText = typeof headingProp === 'string' ? headingProp : headingProp?.primary;\n const dialogRef = useConsolidatedRef(ref);\n const dialogContentRef = useRef<HTMLDivElement>(null);\n const contentTabIndex = useContentTabIndex(dialogRef, dialogContentRef, [], [progressProp]);\n\n const setFocus = () => {\n if (progressProp) return;\n if (headingRef.current) {\n focusNonInteractiveElement(headingRef.current, headingText);\n } else if (dialogRef.current) {\n focusNonInteractiveElement(dialogRef.current, headingText);\n }\n };\n\n useEscape(\n e => {\n onDismiss?.();\n e.stopPropagation();\n },\n dialogRef,\n [onDismiss]\n );\n\n useOuterEvent('mousedown', [target, dialogRef], () => {\n onDismiss?.();\n });\n\n // Using layout effect to capture the focused element prior to dialog elements taking focus.\n useLayoutEffect(() => {\n const initiatorElement = getActiveElement();\n\n return () => {\n if (initiatorElement instanceof HTMLElement && initiatorElement.isConnected) {\n initiatorElement.focus();\n }\n };\n }, []);\n\n useEffect(() => {\n if (!progressProp) {\n setFocus();\n }\n }, [progressProp]);\n\n useEffect(() => {\n const closeDialog = () => {\n setTimeout(() => {\n onDismiss?.();\n // The 0 timeout ensures that the dialog will not re-open immediately after the close event is triggered.\n }, 0);\n };\n\n target.addEventListener('click', closeDialog);\n\n return () => {\n target.removeEventListener('click', closeDialog);\n };\n }, []);\n\n const heading = headingProp ? (\n <Text ref={headingRef} id={headingId} variant='h2'>\n {headingText}\n </Text>\n ) : null;\n\n const progress = (\n <Progress\n visible={!!progressProp}\n focusOnVisible\n placement='local'\n message={typeof progressProp === 'string' ? progressProp : undefined}\n />\n );\n\n const dismissButton = (\n <StyledDismissButton\n icon\n variant='simple'\n onClick={() => {\n onDismiss();\n }}\n label={t('close')}\n >\n <Icon name='times' />\n </StyledDismissButton>\n );\n\n return (\n <StyledInfoDialog\n {...restProps}\n {...(typeof headingProp === 'string'\n ? { 'aria-labelledby': headingId }\n : { 'aria-label': headingProp?.primary })}\n arrow\n target={target}\n progress={progressProp}\n ref={dialogRef}\n >\n {headingProp && heading && (\n <Flex\n container={{ alignItems: 'center', justify: 'between', pad: [1, 2], gap: 1 }}\n item={{ shrink: 0 }}\n as={StyledDialogHeader}\n >\n {typeof headingProp === 'string' ? (\n heading\n ) : (\n <SummaryItem\n ref={headingRef}\n primary={heading}\n secondary={\n headingProp.secondary ? (\n <Text variant='secondary'>{headingProp.secondary}</Text>\n ) : undefined\n }\n visual={headingProp.visual}\n />\n )}\n {dismissButton}\n </Flex>\n )}\n\n {(!headingProp || children || progressProp) && (\n <Flex\n container={{ direction: 'column' }}\n item={{ grow: 1 }}\n as={StyledDialogContent}\n ref={dialogContentRef}\n tabIndex={contentTabIndex}\n >\n {!headingProp && dismissButton}\n {children && (\n <StyledChildrenWrap inert={progressProp ? '' : undefined}>\n {children}\n </StyledChildrenWrap>\n )}\n {progress}\n </Flex>\n )}\n </StyledInfoDialog>\n );\n }\n);\n\nexport default InfoDialog;\n"]}
1
+ {"version":3,"file":"InfoDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/InfoDialog.tsx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eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, useEffect, useLayoutEffect, useRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport {\n useConsolidatedRef,\n useContentTabIndex,\n useEscape,\n useI18n,\n useOuterEvent,\n useUID\n} from '../../hooks';\nimport Text from '../Text';\nimport Icon from '../Icon';\nimport Progress from '../Progress';\nimport Flex from '../Flex';\nimport SummaryItem from '../SummaryItem';\nimport { focusNonInteractiveElement, getActiveElement } from '../../utils';\nimport type { RefElement } from '../../types';\nimport getResolvedTarget from '../Popover/getResolvedTarget';\n\nimport { StyledChildrenWrap, StyledDialogContent, StyledDialogHeader } from './Dialog.styles';\nimport type { InfoDialogProps } from './Dialog.types';\nimport { StyledDismissButton, StyledInfoDialog } from './InfoDialog.styles';\n\nconst InfoDialog = forwardRef<RefElement<InfoDialogProps>, PropsWithoutRef<InfoDialogProps>>(\n function InfoDialog(\n { target, heading: headingProp, children, progress: progressProp, onDismiss, ...restProps },\n ref\n ) {\n const t = useI18n();\n const headingId = useUID();\n const headingRef = useRef<HTMLHeadingElement | HTMLSpanElement>(null);\n const headingText = typeof headingProp === 'string' ? headingProp : headingProp?.primary;\n const dialogRef = useConsolidatedRef(ref);\n const dialogContentRef = useRef<HTMLDivElement>(null);\n const contentTabIndex = useContentTabIndex(dialogRef, dialogContentRef, [], [progressProp]);\n const resolvedTarget = getResolvedTarget(target);\n\n const setFocus = () => {\n if (progressProp) return;\n if (headingRef.current) {\n focusNonInteractiveElement(headingRef.current, headingText);\n } else if (dialogRef.current) {\n focusNonInteractiveElement(dialogRef.current, headingText);\n }\n };\n\n useEscape(\n e => {\n onDismiss?.();\n e.stopPropagation();\n },\n dialogRef,\n [onDismiss]\n );\n\n useOuterEvent('mousedown', [resolvedTarget, dialogRef], () => {\n onDismiss?.();\n });\n\n // Using layout effect to capture the focused element prior to dialog elements taking focus.\n useLayoutEffect(() => {\n const initiatorElement = getActiveElement();\n\n return () => {\n if (initiatorElement instanceof HTMLElement && initiatorElement.isConnected) {\n initiatorElement.focus();\n }\n };\n }, []);\n\n useEffect(() => {\n if (!progressProp) {\n setFocus();\n }\n }, [progressProp]);\n\n useEffect(() => {\n const closeDialog = () => {\n setTimeout(() => {\n onDismiss?.();\n // The 0 timeout ensures that the dialog will not re-open immediately after the close event is triggered.\n }, 0);\n };\n\n resolvedTarget?.addEventListener('click', closeDialog);\n\n return () => {\n resolvedTarget?.removeEventListener('click', closeDialog);\n };\n }, [onDismiss, resolvedTarget]);\n\n const heading = headingProp ? (\n <Text ref={headingRef} id={headingId} variant='h2'>\n {headingText}\n </Text>\n ) : null;\n\n const progress = (\n <Progress\n visible={!!progressProp}\n focusOnVisible\n placement='local'\n message={typeof progressProp === 'string' ? progressProp : undefined}\n />\n );\n\n const dismissButton = (\n <StyledDismissButton\n icon\n variant='simple'\n onClick={() => {\n onDismiss();\n }}\n label={t('close')}\n >\n <Icon name='times' />\n </StyledDismissButton>\n );\n\n return (\n <StyledInfoDialog\n {...restProps}\n {...(typeof headingProp === 'string'\n ? { 'aria-labelledby': headingId }\n : { 'aria-label': headingProp?.primary })}\n arrow\n target={target}\n progress={progressProp}\n ref={dialogRef}\n >\n {headingProp && heading && (\n <Flex\n container={{ alignItems: 'center', justify: 'between', pad: [1, 2], gap: 1 }}\n item={{ shrink: 0 }}\n as={StyledDialogHeader}\n >\n {typeof headingProp === 'string' ? (\n heading\n ) : (\n <SummaryItem\n ref={headingRef}\n primary={heading}\n secondary={\n headingProp.secondary ? (\n <Text variant='secondary'>{headingProp.secondary}</Text>\n ) : undefined\n }\n visual={headingProp.visual}\n />\n )}\n {dismissButton}\n </Flex>\n )}\n\n {(!headingProp || children || progressProp) && (\n <Flex\n container={{ direction: 'column' }}\n item={{ grow: 1 }}\n as={StyledDialogContent}\n ref={dialogContentRef}\n tabIndex={contentTabIndex}\n >\n {!headingProp && dismissButton}\n {children && (\n <StyledChildrenWrap inert={progressProp ? '' : undefined}>\n {children}\n </StyledChildrenWrap>\n )}\n {progress}\n </Flex>\n )}\n </StyledInfoDialog>\n );\n }\n);\n\nexport default InfoDialog;\n"]}
@@ -12,6 +12,12 @@ export type InlineEditProps = WithAttributes<'div', TestIdProp<typeof elements>
12
12
  * Pass this value to show the dialog and conversely set to undefined to hide.
13
13
  */
14
14
  editForm?: ReactNode;
15
+ /**
16
+ * Use when the edit form contains multiple input fields.
17
+ * Renders form actions at end of edit dialog.
18
+ * @default false
19
+ */
20
+ multi?: boolean;
15
21
  /** Called when the edit button is clicked. */
16
22
  onEdit: () => void;
17
23
  /** Called when the user cancels the edit. */
@@ -1 +1 @@
1
- {"version":3,"file":"InlineEdit.d.ts","sourceRoot":"","sources":["../../../src/components/InlineEdit/InlineEdit.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EAAE,+BAA+B,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAO/F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAUtD,MAAM,MAAM,eAAe,GAAG,cAAc,CAC1C,KAAK,EACL,UAAU,CAAC,OAAO,QAAQ,CAAC,GACzB,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,GAAG;IAClC,wBAAwB;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,iDAAiD;IACjD,eAAe,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,6CAA6C;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B,CACJ,CAAC;AAEF,QAAA,MAAM,UAAU,EAAE,+BAA+B,CAAC,eAAe,CA4D/D,CAAC;AAEH,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"InlineEdit.d.ts","sourceRoot":"","sources":["../../../src/components/InlineEdit/InlineEdit.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG7D,OAAO,KAAK,EAAE,+BAA+B,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAO/F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAUtD,MAAM,MAAM,eAAe,GAAG,cAAc,CAC1C,KAAK,EACL,UAAU,CAAC,OAAO,QAAQ,CAAC,GACzB,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,GAAG;IAClC,wBAAwB;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,iDAAiD;IACjD,eAAe,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,6CAA6C;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B,CACJ,CAAC;AAEF,QAAA,MAAM,UAAU,EAAE,+BAA+B,CAAC,eAAe,CA2G/D,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef } from 'react';
2
+ import { forwardRef, useLayoutEffect, useMemo } from 'react';
3
3
  import useTestIds from '../../hooks/useTestIds';
4
4
  import useI18n from '../../hooks/useI18n';
5
5
  import Icon, { registerIcon } from '../Icon';
@@ -9,13 +9,54 @@ import { useConsolidatedRef, useElement } from '../../hooks';
9
9
  import { getInlineEditTestIds } from './InlineEdit.test-ids';
10
10
  import { StyledEditButton, StyledInlineEdit, StyledContent, StyledInlineEditDialog } from './InlineEdit.styles';
11
11
  registerIcon(pencilIcon);
12
- const InlineEdit = forwardRef(function InlineEdit({ children, contextualLabel, editForm, progress, onEdit, onCancel, onSubmit, testId, ...restProps }, refProp) {
12
+ const InlineEdit = forwardRef(function InlineEdit({ children, contextualLabel, editForm, multi = false, progress, onEdit, onCancel, onSubmit, testId, ...restProps }, refProp) {
13
13
  const ref = useConsolidatedRef(refProp);
14
14
  const t = useI18n();
15
15
  const testIds = useTestIds(testId, getInlineEditTestIds);
16
16
  const editLabel = `${t('edit')} - ${contextualLabel}`;
17
- const [editButton, setButtonEl] = useElement();
18
- return (_jsxs(Flex, { "data-testid": testIds.root, ...restProps, container: { inline: true, alignItems: 'start', justify: 'between', gap: 0.5 }, as: StyledInlineEdit, onDoubleClick: onEdit, ref: ref, children: [_jsx(StyledContent, { children: children }), _jsx(StyledEditButton, { "data-testid": testIds.button, ref: setButtonEl, icon: true, compact: true, variant: 'simple', onClick: onEdit, label: t('edit'), "aria-label": editLabel, "aria-haspopup": 'dialog', "aria-hidden": !!editForm && !!editButton ? true : undefined, children: _jsx(Icon, { name: 'pencil' }) }), editForm && editButton && (_jsx(StyledInlineEditDialog, { "data-testid": testIds.dialog, progress: progress, target: editButton, placement: 'bottom-start', "aria-label": editLabel, onCancel: onCancel, onSubmit: onSubmit, children: editForm }))] }));
17
+ const [editButtonEl, setButtonEl] = useElement();
18
+ const [editableContent, setEditableContent] = useElement();
19
+ const virtualTarget = useMemo(() => {
20
+ return {
21
+ get contextElement() {
22
+ return editButtonEl ?? undefined;
23
+ },
24
+ getBoundingClientRect() {
25
+ const rect = editableContent?.getBoundingClientRect();
26
+ const top = rect?.top ?? 0;
27
+ const left = rect?.left ?? 0;
28
+ return {
29
+ width: 0,
30
+ height: 0,
31
+ top,
32
+ bottom: top,
33
+ left,
34
+ right: left,
35
+ x: left,
36
+ y: top,
37
+ toJSON() {
38
+ return this;
39
+ }
40
+ };
41
+ }
42
+ };
43
+ }, [editButtonEl, editableContent]);
44
+ useLayoutEffect(() => {
45
+ if (!ref.current || !editButtonEl)
46
+ return;
47
+ const ctnHeight = ref.current.getBoundingClientRect().height;
48
+ const btnHeight = editButtonEl.getBoundingClientRect().height;
49
+ // If the content is shorter than the button, vertically center the button.
50
+ // Otherwise the button is aligned at the vertical start of the content by default.
51
+ if (ctnHeight < btnHeight) {
52
+ const offset = (btnHeight - ctnHeight) / 2;
53
+ ref.current.style.setProperty('--button-offset', `${offset}px`);
54
+ }
55
+ else {
56
+ ref.current.style.removeProperty('--button-offset');
57
+ }
58
+ }, [children, editButtonEl, editableContent]);
59
+ return (_jsxs(Flex, { "data-testid": testIds.root, ...restProps, container: { inline: true, alignItems: 'start', justify: 'between', gap: 0.5 }, as: StyledInlineEdit, onDoubleClick: onEdit, ref: ref, children: [_jsx(StyledContent, { ref: setEditableContent, children: children }), _jsx(StyledEditButton, { "data-testid": testIds.button, ref: setButtonEl, icon: true, compact: true, variant: 'simple', onClick: onEdit, label: t('edit'), "aria-label": editLabel, "aria-haspopup": 'dialog', "aria-hidden": !!editForm && !!editButtonEl ? true : undefined, children: _jsx(Icon, { name: 'pencil' }) }), editForm && editButtonEl && editableContent && (_jsx(StyledInlineEditDialog, { compact: !multi, arrow: false, "data-testid": testIds.dialog, progress: progress, target: virtualTarget, placement: 'bottom-start', "aria-label": editLabel, onCancel: onCancel, onSubmit: onSubmit, children: editForm }))] }));
19
60
  });
20
61
  export default InlineEdit;
21
62
  //# sourceMappingURL=InlineEdit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InlineEdit.js","sourceRoot":"","sources":["../../../src/components/InlineE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EAC9E,EAAE,EAAE,gBAAgB,EACpB,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,GAAG,aAER,KAAC,aAAa,cAAE,QAAQ,GAAiB,EAEzC,KAAC,gBAAgB,mBACF,OAAO,CAAC,MAAM,EAC3B,GAAG,EAAE,WAAW,EAChB,IAAI,QACJ,OAAO,QACP,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,gBACJ,SAAS,mBACP,QAAQ,iBACT,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,YAE1D,KAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,GAAG,GACL,EAClB,QAAQ,IAAI,UAAU,IAAI,CACzB,KAAC,sBAAsB,mBACR,OAAO,CAAC,MAAM,EAC3B,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,UAAU,EAClB,SAAS,EAAC,cAAc,gBACZ,SAAS,EACrB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,YAEjB,QAAQ,GACc,CAC1B,IACI,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef, ReactNode, Ref } from 'react';\n\nimport type { ForwardRefForwardPropsComponent, TestIdProp, WithAttributes } from '../../types';\nimport useTestIds from '../../hooks/useTestIds';\nimport useI18n from '../../hooks/useI18n';\nimport Icon, { registerIcon } from '../Icon';\nimport * as pencilIcon from '../Icon/icons/pencil.icon';\nimport Flex from '../Flex';\nimport { useConsolidatedRef, useElement } from '../../hooks';\nimport type { FormDialogProps } from '../Dialog';\n\nimport { getInlineEditTestIds } from './InlineEdit.test-ids';\nimport type { elements } from './InlineEdit.test-ids';\nimport {\n StyledEditButton,\n StyledInlineEdit,\n StyledContent,\n StyledInlineEditDialog\n} from './InlineEdit.styles';\n\nregisterIcon(pencilIcon);\n\nexport type InlineEditProps = WithAttributes<\n 'div',\n TestIdProp<typeof elements> &\n Pick<FormDialogProps, 'progress'> & {\n /** Editable content. */\n children: ReactNode;\n /** Accessible label for the editable content. */\n contextualLabel: string;\n /**\n * Form content for updating the editable content rendered within a dialog.\n * Pass this value to show the dialog and conversely set to undefined to hide.\n */\n editForm?: ReactNode;\n /** Called when the edit button is clicked. */\n onEdit: () => void;\n /** Called when the user cancels the edit. */\n onCancel: () => void;\n /** Called when the user confirms the edit. */\n onSubmit: () => void;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n }\n>;\n\nconst InlineEdit: ForwardRefForwardPropsComponent<InlineEditProps> = forwardRef(function InlineEdit(\n {\n children,\n contextualLabel,\n editForm,\n progress,\n onEdit,\n onCancel,\n onSubmit,\n testId,\n ...restProps\n }: PropsWithoutRef<InlineEditProps>,\n refProp: InlineEditProps['ref']\n) {\n const ref = useConsolidatedRef(refProp);\n const t = useI18n();\n const testIds = useTestIds(testId, getInlineEditTestIds);\n const editLabel = `${t('edit')} - ${contextualLabel}`;\n const [editButton, setButtonEl] = useElement<HTMLButtonElement>();\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n container={{ inline: true, alignItems: 'start', justify: 'between', gap: 0.5 }}\n as={StyledInlineEdit}\n onDoubleClick={onEdit}\n ref={ref}\n >\n <StyledContent>{children}</StyledContent>\n\n <StyledEditButton\n data-testid={testIds.button}\n ref={setButtonEl}\n icon\n compact\n variant='simple'\n onClick={onEdit}\n label={t('edit')}\n aria-label={editLabel}\n aria-haspopup='dialog'\n aria-hidden={!!editForm && !!editButton ? true : undefined}\n >\n <Icon name='pencil' />\n </StyledEditButton>\n {editForm && editButton && (\n <StyledInlineEditDialog\n data-testid={testIds.dialog}\n progress={progress}\n target={editButton}\n placement='bottom-start'\n aria-label={editLabel}\n onCancel={onCancel}\n onSubmit={onSubmit}\n >\n {editForm}\n </StyledInlineEditDialog>\n )}\n </Flex>\n );\n});\n\nexport default InlineEdit;\n"]}
1
+ {"version":3,"file":"InlineEdit.js","sourceRoot":"","sources":["../../../src/components/InlineEdit/InlineEdit.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAK7D,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AACxD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,CAAC,UAAU,CAAC,CAAC;AAgCzB,MAAM,UAAU,GAAqD,UAAU,CAAC,SAAS,UAAU,CACjG,EACE,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,KAAK,GAAG,KAAK,EACb,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,GAAG,SAAS,EACqB,EACnC,OAA+B;IAE/B,MAAM,GAAG,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IACzD,MAAM,SAAS,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,eAAe,EAAE,CAAC;IACtD,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC,GAAG,UAAU,EAAqB,CAAC;IACpE,MAAM,CAAC,eAAe,EAAE,kBAAkB,C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nimport type { PropsWithoutRef, ReactNode, Ref } from 'react';\nimport type { VirtualElement } from '@popperjs/core';\n\nimport type { ForwardRefForwardPropsComponent, TestIdProp, WithAttributes } from '../../types';\nimport useTestIds from '../../hooks/useTestIds';\nimport useI18n from '../../hooks/useI18n';\nimport Icon, { registerIcon } from '../Icon';\nimport * as pencilIcon from '../Icon/icons/pencil.icon';\nimport Flex from '../Flex';\nimport { useConsolidatedRef, useElement } from '../../hooks';\nimport type { FormDialogProps } from '../Dialog';\n\nimport { getInlineEditTestIds } from './InlineEdit.test-ids';\nimport type { elements } from './InlineEdit.test-ids';\nimport {\n StyledEditButton,\n StyledInlineEdit,\n StyledContent,\n StyledInlineEditDialog\n} from './InlineEdit.styles';\n\nregisterIcon(pencilIcon);\n\nexport type InlineEditProps = WithAttributes<\n 'div',\n TestIdProp<typeof elements> &\n Pick<FormDialogProps, 'progress'> & {\n /** Editable content. */\n children: ReactNode;\n /** Accessible label for the editable content. */\n contextualLabel: string;\n /**\n * Form content for updating the editable content rendered within a dialog.\n * Pass this value to show the dialog and conversely set to undefined to hide.\n */\n editForm?: ReactNode;\n /**\n * Use when the edit form contains multiple input fields.\n * Renders form actions at end of edit dialog.\n * @default false\n */\n multi?: boolean;\n /** Called when the edit button is clicked. */\n onEdit: () => void;\n /** Called when the user cancels the edit. */\n onCancel: () => void;\n /** Called when the user confirms the edit. */\n onSubmit: () => void;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n }\n>;\n\nconst InlineEdit: ForwardRefForwardPropsComponent<InlineEditProps> = forwardRef(function InlineEdit(\n {\n children,\n contextualLabel,\n editForm,\n multi = false,\n progress,\n onEdit,\n onCancel,\n onSubmit,\n testId,\n ...restProps\n }: PropsWithoutRef<InlineEditProps>,\n refProp: InlineEditProps['ref']\n) {\n const ref = useConsolidatedRef(refProp);\n const t = useI18n();\n const testIds = useTestIds(testId, getInlineEditTestIds);\n const editLabel = `${t('edit')} - ${contextualLabel}`;\n const [editButtonEl, setButtonEl] = useElement<HTMLButtonElement>();\n const [editableContent, setEditableContent] = useElement<HTMLDivElement>();\n\n const virtualTarget: VirtualElement = useMemo(() => {\n return {\n get contextElement() {\n return editButtonEl ?? undefined;\n },\n getBoundingClientRect() {\n const rect = editableContent?.getBoundingClientRect();\n const top = rect?.top ?? 0;\n const left = rect?.left ?? 0;\n\n return {\n width: 0,\n height: 0,\n top,\n bottom: top,\n left,\n right: left,\n x: left,\n y: top,\n toJSON() {\n return this;\n }\n };\n }\n };\n }, [editButtonEl, editableContent]);\n\n useLayoutEffect(() => {\n if (!ref.current || !editButtonEl) return;\n\n const ctnHeight = ref.current.getBoundingClientRect().height;\n const btnHeight = editButtonEl.getBoundingClientRect().height;\n\n // If the content is shorter than the button, vertically center the button.\n // Otherwise the button is aligned at the vertical start of the content by default.\n if (ctnHeight < btnHeight) {\n const offset = (btnHeight - ctnHeight) / 2;\n ref.current.style.setProperty('--button-offset', `${offset}px`);\n } else {\n ref.current.style.removeProperty('--button-offset');\n }\n }, [children, editButtonEl, editableContent]);\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n container={{ inline: true, alignItems: 'start', justify: 'between', gap: 0.5 }}\n as={StyledInlineEdit}\n onDoubleClick={onEdit}\n ref={ref}\n >\n <StyledContent ref={setEditableContent}>{children}</StyledContent>\n\n <StyledEditButton\n data-testid={testIds.button}\n ref={setButtonEl}\n icon\n compact\n variant='simple'\n onClick={onEdit}\n label={t('edit')}\n aria-label={editLabel}\n aria-haspopup='dialog'\n aria-hidden={!!editForm && !!editButtonEl ? true : undefined}\n >\n <Icon name='pencil' />\n </StyledEditButton>\n {editForm && editButtonEl && editableContent && (\n <StyledInlineEditDialog\n compact={!multi}\n arrow={false}\n data-testid={testIds.dialog}\n progress={progress}\n target={virtualTarget}\n placement='bottom-start'\n aria-label={editLabel}\n onCancel={onCancel}\n onSubmit={onSubmit}\n >\n {editForm}\n </StyledInlineEditDialog>\n )}\n </Flex>\n );\n});\n\nexport default InlineEdit;\n"]}
@@ -6,21 +6,37 @@ export declare const StyledInlineEditDialog: import("styled-components/dist/type
6
6
  onDismiss?: () => void;
7
7
  onCancel: import("../Dialog/Dialog.types").FormAction;
8
8
  onSubmit: import("../Dialog/Dialog.types").FormAction;
9
+ } & {
10
+ compact: true;
11
+ } & {
12
+ 'aria-label': string;
13
+ heading?: never;
14
+ additionalInfo?: never;
15
+ } & Omit<import("../..").Attributes<"div">, "compact" | "aria-label" | "onSubmit" | "onCancel" | "heading" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
16
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
17
+ }) | (Omit<Omit<import("../Dialog/Dialog.types").BaseDialogProps & {
18
+ onDismiss?: () => void;
19
+ onCancel: import("../Dialog/Dialog.types").FormAction;
20
+ onSubmit: import("../Dialog/Dialog.types").FormAction;
21
+ } & {
22
+ compact?: false | undefined;
9
23
  } & {
10
24
  heading: string;
11
25
  additionalInfo?: import("../AdditionalInfo").AdditionalInfoProps;
12
26
  'aria-label'?: never;
13
- } & Omit<import("../..").Attributes<"div">, "aria-label" | "onSubmit" | "onCancel" | "heading" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
27
+ } & Omit<import("../..").Attributes<"div">, "compact" | "aria-label" | "onSubmit" | "onCancel" | "heading" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
14
28
  ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
15
29
  }) | (Omit<Omit<import("../Dialog/Dialog.types").BaseDialogProps & {
16
30
  onDismiss?: () => void;
17
31
  onCancel: import("../Dialog/Dialog.types").FormAction;
18
32
  onSubmit: import("../Dialog/Dialog.types").FormAction;
19
33
  } & {
20
- heading?: never;
34
+ compact?: false | undefined;
35
+ } & {
21
36
  'aria-label': string;
37
+ heading?: never;
22
38
  additionalInfo?: never;
23
- } & Omit<import("../..").Attributes<"div">, "aria-label" | "onSubmit" | "onCancel" | "heading" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
39
+ } & Omit<import("../..").Attributes<"div">, "compact" | "aria-label" | "onSubmit" | "onCancel" | "heading" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
24
40
  ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
25
41
  }), import("styled-components/dist/types").BaseObject>> & string & Omit<import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<import("../Dialog").FormDialogProps> & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
26
42
  export declare const StyledInlineEdit: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -1 +1 @@
1
- {"version":3,"file":"InlineEdit.styles.d.ts","sourceRoot":"","sources":["../../../src/components/InlineEdit/InlineEdit.styles.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,aAAa,6NAEzB,CAAC;AAIF,eAAO,MAAM,gBAAgB;;2JAG5B,CAAC;AAIF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;uRAOjC,CAAC;AAIH,eAAO,MAAM,gBAAgB,6NAwB3B,CAAC"}
1
+ {"version":3,"file":"InlineEdit.styles.d.ts","sourceRoot":"","sources":["../../../src/components/InlineEdit/InlineEdit.styles.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,aAAa,6NAEzB,CAAC;AAIF,eAAO,MAAM,gBAAgB;;2JAS3B,CAAC;AAIH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uRAQjC,CAAC;AAIH,eAAO,MAAM,gBAAgB,6NAmC3B,CAAC"}
@@ -1,47 +1,65 @@
1
1
  import styled, { css } from 'styled-components';
2
- import { mix } from 'polished';
3
2
  import { defaultThemeProp } from '../../theme';
4
3
  import Button from '../Button';
5
4
  import { FormDialog } from '../Dialog';
6
- import { StyledDialogContent } from '../Dialog/Dialog.styles';
7
- import { tryCatch } from '../../utils';
5
+ import { animations } from '../../styles';
8
6
  export const StyledContent = styled.div `
9
- margin-block-start: 0.25rem;
7
+ padding-inline-end: var(--inline-end-offset);
10
8
  `;
11
9
  StyledContent.defaultProps = defaultThemeProp;
12
- export const StyledEditButton = styled(Button) `
13
- opacity: 0;
14
- pointer-events: none;
15
- `;
10
+ export const StyledEditButton = styled(Button)(() => {
11
+ return css `
12
+ opacity: 0;
13
+ pointer-events: none;
14
+ position: absolute;
15
+ /* stylelint-disable-next-line unit-allowed-list */
16
+ inset-block-start: calc(var(--button-offset, 0px) * -1);
17
+ inset-inline-end: 0;
18
+ `;
19
+ });
16
20
  StyledEditButton.defaultProps = defaultThemeProp;
17
- export const StyledInlineEditDialog = styled(FormDialog)(({ theme }) => {
21
+ export const StyledInlineEditDialog = styled(FormDialog)(() => {
18
22
  return css `
19
- & > ${StyledDialogContent} {
20
- min-height: unset;
21
- padding-block-start: ${theme.base.spacing};
23
+ &[data-popper-placement] {
24
+ --scale-in-size: 0.9;
25
+ transform-origin: 0 0;
26
+ animation-name: ${animations.reveal}, ${animations.scaleIn};
22
27
  }
23
28
  `;
24
29
  });
25
30
  StyledInlineEditDialog.defaultProps = defaultThemeProp;
26
31
  export const StyledInlineEdit = styled.div(({ theme }) => {
27
- const hoverColor = tryCatch(() => mix(0.95, theme.base.palette['primary-background'], theme.base.palette.interactive));
32
+ // FIXME: Stylelint...
33
+ const br = `calc(${theme.base['border-radius']} * ${theme.components['form-control']['border-radius']})`;
28
34
  return css `
35
+ --inline-end-offset: calc(${theme.base['hit-area'].compact} + ${theme.base.spacing});
36
+ position: relative;
29
37
  width: 100%;
30
- border: solid 0.0625rem transparent;
31
- margin-block-start: -0.25rem;
32
38
 
33
- &:hover,
34
- &:has(${StyledEditButton}:focus) {
35
- background: ${hoverColor};
39
+ &::before {
40
+ display: none;
41
+ content: '';
42
+ position: absolute;
43
+ border: 0.125rem solid rgb(from currentColor r g b / 0.5);
44
+ inset-inline: calc(-0.5 * ${theme.base.spacing})
45
+ calc(var(--inline-end-offset) - ${theme.base.spacing} / 2);
46
+ inset-block: calc(-0.25 * ${theme.base.spacing});
47
+ border-radius: ${br};
48
+ }
36
49
 
50
+ &:hover,
51
+ &:has(:focus-within) {
37
52
  ${StyledEditButton}:not([aria-hidden]) {
38
53
  opacity: 1;
39
54
  pointer-events: auto;
40
55
  }
41
56
  }
42
57
 
43
- &:has(${StyledEditButton}[aria-hidden]) {
44
- background: ${hoverColor};
58
+ &:has(${StyledEditButton}:is(:hover, :focus)) {
59
+ &::before {
60
+ z-index: 0;
61
+ display: block;
62
+ }
45
63
  }
46
64
  `;
47
65
  });
@@ -1 +1 @@
1
- {"version":3,"file":"InlineEdit.styles.js","sourceRoot":"","sources":["../../../src/components/InlineEdit/InlineEdit.styles.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BACR,UAAU;;QAEtB,gBAAgB;;;;;;YAMZ,gBAAgB;oBACR,UAAU;;GAE3B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { mix } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport Button from '../Button';\nimport { FormDialog } from '../Dialog';\nimport { StyledDialogContent } from '../Dialog/Dialog.styles';\nimport { tryCatch } from '../../utils';\n\nexport const StyledContent = styled.div`\n margin-block-start: 0.25rem;\n`;\n\nStyledContent.defaultProps = defaultThemeProp;\n\nexport const StyledEditButton = styled(Button)`\n opacity: 0;\n pointer-events: none;\n`;\n\nStyledEditButton.defaultProps = defaultThemeProp;\n\nexport const StyledInlineEditDialog = styled(FormDialog)(({ theme }) => {\n return css`\n & > ${StyledDialogContent} {\n min-height: unset;\n padding-block-start: ${theme.base.spacing};\n }\n `;\n});\n\nStyledInlineEditDialog.defaultProps = defaultThemeProp;\n\nexport const StyledInlineEdit = styled.div(({ theme }) => {\n const hoverColor = tryCatch(() =>\n mix(0.95, theme.base.palette['primary-background'], theme.base.palette.interactive)\n );\n\n return css`\n width: 100%;\n border: solid 0.0625rem transparent;\n margin-block-start: -0.25rem;\n\n &:hover,\n &:has(${StyledEditButton}:focus) {\n background: ${hoverColor};\n\n ${StyledEditButton}:not([aria-hidden]) {\n opacity: 1;\n pointer-events: auto;\n }\n }\n\n &:has(${StyledEditButton}[aria-hidden]) {\n background: ${hoverColor};\n }\n `;\n});\n\nStyledInlineEdit.defaultProps = defaultThemeProp;\n"]}
1
+ {"version":3,"file":"InlineEdit.styles.js","sourceRoot":"","sources":["../../../src/components/InlineEdit/InlineEdit.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,MAAM,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GAMzB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport Button from '../Button';\nimport { FormDialog } from '../Dialog';\nimport { animations } from '../../styles';\n\nexport const StyledContent = styled.div`\n padding-inline-end: var(--inline-end-offset);\n`;\n\nStyledContent.defaultProps = defaultThemeProp;\n\nexport const StyledEditButton = styled(Button)(() => {\n return css`\n opacity: 0;\n pointer-events: none;\n position: absolute;\n /* stylelint-disable-next-line unit-allowed-list */\n inset-block-start: calc(var(--button-offset, 0px) * -1);\n inset-inline-end: 0;\n `;\n});\n\nStyledEditButton.defaultProps = defaultThemeProp;\n\nexport const StyledInlineEditDialog = styled(FormDialog)(() => {\n return css`\n &[data-popper-placement] {\n --scale-in-size: 0.9;\n transform-origin: 0 0;\n animation-name: ${animations.reveal}, ${animations.scaleIn};\n }\n `;\n});\n\nStyledInlineEditDialog.defaultProps = defaultThemeProp;\n\nexport const StyledInlineEdit = styled.div(({ theme }) => {\n // FIXME: Stylelint...\n const br = `calc(${theme.base['border-radius']} * ${theme.components['form-control']['border-radius']})`;\n\n return css`\n --inline-end-offset: calc(${theme.base['hit-area'].compact} + ${theme.base.spacing});\n position: relative;\n width: 100%;\n\n &::before {\n display: none;\n content: '';\n position: absolute;\n border: 0.125rem solid rgb(from currentColor r g b / 0.5);\n inset-inline: calc(-0.5 * ${theme.base.spacing})\n calc(var(--inline-end-offset) - ${theme.base.spacing} / 2);\n inset-block: calc(-0.25 * ${theme.base.spacing});\n border-radius: ${br};\n }\n\n &:hover,\n &:has(:focus-within) {\n ${StyledEditButton}:not([aria-hidden]) {\n opacity: 1;\n pointer-events: auto;\n }\n }\n\n &:has(${StyledEditButton}:is(:hover, :focus)) {\n &::before {\n z-index: 0;\n display: block;\n }\n }\n `;\n});\n\nStyledInlineEdit.defaultProps = defaultThemeProp;\n"]}
@@ -170,7 +170,7 @@ const Link = forwardRef(function Link({ testId, href: hrefProp, variant = 'link'
170
170
  x: virtualElementCoordsRef.current.x,
171
171
  y: virtualElementCoordsRef.current.y,
172
172
  toJSON() {
173
- return JSON.stringify(this);
173
+ return this;
174
174
  }
175
175
  };
176
176
  }
@@ -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,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAM1E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,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,iBAAiB,EACjB,MAAM,EACN,eAAe,EACf,KAAK,EACL,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAA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C5D,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAAC,OAAO,CAAC;oBAC1D,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI;oBACjD,oGAAoG;oBACpG,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK,CACpD,CAAC;oBACF,IAAI,cAAc,EAAE,CAAC;wBACnB,uBAAuB,CAAC,OAAO,GAAG;4BAChC,CAAC,EAAE,MAAM;4BACT,CAAC,EAAE,cAAc,CAAC,GAAG;yBACtB,CAAC;oBACJ,CAAC;gBACH,CAAC,YAEA,cAAc;qBACZ,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,KAAK,SAAS,IAAI,WAAW,CAAC;qBACzD,GAAG,CAAC,QAAQ,CAAC,EAAE;oBACd,OAAO,CACL,KAAC,QAAQ,cACN,wBAAwB,CAAC,QAAQ,CAAC,IADtB,gBAAgB,QAAQ,EAAE,CAE9B,CACZ,CAAC;gBACJ,CAAC,CAAC,GACI,EAET,WAAW,IAAI,CACd,KAAC,UAAU,IAAC,EAAE,EAAE,GAAG,GAAG,uBAAuB,YAC1C,CAAC,CAAC,0BAA0B,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GACnD,CACd,IACA,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { forwardRef, useState, useRef, useEffect, Fragment } from 'react';\nimport type {\n MouseEvent as ReactMouseEvent,\n PropsWithoutRef,\n KeyboardEvent as ReactKeyboardEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport type { VirtualElement } from '@popperjs/core';\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 { WithAttributes, BaseProps, TestIdProp, RefElement, AsProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport {\n useBreakpoint,\n useConsolidatedRef,\n useI18n,\n usePreviewContext,\n useUID,\n useModalContext,\n useOS,\n useTestIds\n} from '../../hooks';\nimport { isCrossOrigin, tryCatch, withTestIds, disallowedURI } from '../../utils';\nimport { calculateFontSize, readableColor } from '../../styles';\nimport { Keyboard } from '../Badges';\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 HiddenText from '../HiddenText';\nimport { useFullscreenContext } from '../Fullscreen';\n\nimport { getLinkTestIds } from './Link.test-ids';\n\nexport type LinkProps = WithAttributes<\n 'a',\n BaseProps &\n TestIdProp &\n AsProp & {\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 * Hides new tab icon which appears for links with target=\"_blank\".\n * @default false\n */\n hideNewTabIcon?: boolean;\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 /**\n * Determines if the Link should render a popover when focused or hovered over.\n * @default false\n */\n previewable?: boolean;\n /** Callback function that is run when the preview popover is interacted with. */\n onPreview?: (e: { href: string }) => void;\n /** Optional link behavior. When omitted, legacy Link behavior is preserved. */\n linkBehavior?: LinkBehavior;\n }\n>;\n\ntype LinkBehavior = 'preview' | 'open' | 'openInTab';\n\nconst LINK_BEHAVIORS: LinkBehavior[] = ['preview', 'open', 'openInTab'];\n\nfunction isLinkBehavior(behavior: unknown): behavior is LinkBehavior {\n return typeof behavior === 'string' && LINK_BEHAVIORS.some(item => item === behavior);\n}\n\nfunction getAlternateLinkBehaviors(primaryBehavior: LinkBehavior): LinkBehavior[] {\n return LINK_BEHAVIORS.filter(behavior => behavior !== primaryBehavior);\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 --scale-in-size: 0;\n --animation-duration: ${theme.base.animation.speed};\n\n ${preview &&\n css`\n padding: calc(${theme.base.spacing} / 4);\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-visible {\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 StyledLinkPreviewPopoverText = styled.div``;\n\nexport const StyledLinkPreviewPopoverBtn = styled(StyledLinkPopoverBtn)(({ theme }) => {\n return css`\n padding: calc(${theme.base.spacing} / 2);\n\n & + & {\n padding-inline-start: calc(${theme.base.spacing} - ${theme.base.spacing} / 4);\n padding-inline-end: calc(${theme.base.spacing} / 4);\n }\n\n &:hover,\n &:active {\n text-decoration: none;\n ${StyledLinkPreviewPopoverText} span {\n text-decoration: underline;\n }\n ${StyledLinkPreviewPopoverText} ${StyledKeyboard} span {\n text-decoration: none;\n }\n }\n\n ${StyledLinkPreviewPopoverText} {\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 margin-inline: calc(${theme.base.spacing} / 4);\n\n &:first-of-type {\n margin-inline-start: calc(${theme.base.spacing} / 2);\n }\n\n &:last-of-type {\n margin-inline-end: calc(${theme.base.spacing} / 2);\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 = forwardRef<RefElement<LinkProps>, PropsWithoutRef<LinkProps>>(function Link(\n {\n testId,\n href: hrefProp,\n variant = 'link',\n icon = false,\n previewable: showPreviewOpenInTabPopoverProp = false,\n onPreview,\n linkBehavior,\n target: targetProp,\n onClick: onClickProp,\n hideNewTabIcon = false,\n children,\n ...restProps\n },\n ref\n) {\n const href = disallowedURI.test(hrefProp) ? undefined : hrefProp;\n\n const { initialized: inModal } = useModalContext();\n const fullscreen = useFullscreenContext();\n const inFullscreen = !!(fullscreen && fullscreen[0]);\n const { previewTriggerRef } = usePreviewContext();\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 mousePositionRef = useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n const virtualElementCoordsRef = useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n const virtualElementRef = useRef<VirtualElement>({\n get contextElement() {\n return linkRef.current ?? undefined;\n },\n getBoundingClientRect: () => {\n return {\n width: 0,\n height: 0,\n top: virtualElementCoordsRef.current.y,\n bottom: virtualElementCoordsRef.current.y,\n left: virtualElementCoordsRef.current.x,\n right: virtualElementCoordsRef.current.x,\n x: virtualElementCoordsRef.current.x,\n y: virtualElementCoordsRef.current.y,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n });\n\n const previewable = showPreviewOpenInTabPopoverProp && !inModal && !inFullscreen;\n\n const normalizedLinkBehavior = isLinkBehavior(linkBehavior) ? linkBehavior : undefined;\n const hasLinkBehavior = normalizedLinkBehavior !== undefined;\n const target =\n (hasLinkBehavior && normalizedLinkBehavior === 'openInTab') || isCrossOrigin(href ?? '')\n ? '_blank'\n : targetProp;\n\n const defaultPreviewAlternates: LinkBehavior[] = ['preview', 'openInTab'];\n const previewActions =\n hasLinkBehavior && normalizedLinkBehavior\n ? getAlternateLinkBehaviors(normalizedLinkBehavior)\n : defaultPreviewAlternates;\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 if (href !== undefined) {\n onPreview?.({ href });\n }\n };\n\n const getActionLabel = (behavior: LinkBehavior) => {\n if (behavior === 'preview') {\n return t('preview');\n }\n\n if (behavior === 'openInTab') {\n return t('link_open_in_tab_text');\n }\n\n return t('link_open_text');\n };\n\n const renderPreviewPopoverAction = (behavior: LinkBehavior) => {\n if (behavior === 'preview') {\n return (\n <StyledLinkPreviewPopoverBtn\n data-testid={testIds.preview}\n preview\n type='button'\n ref={previewBtnRef}\n onClick={onPreviewClick}\n tabIndex='-1'\n >\n <StyledLinkPreviewPopoverText>\n <span>{getActionLabel(behavior)}</span>\n <Flex container={{ inline: true, justify: 'end' }}>\n <Keyboard keyName='Alt' />\n <Keyboard keyName='P' />\n </Flex>\n </StyledLinkPreviewPopoverText>\n </StyledLinkPreviewPopoverBtn>\n );\n }\n\n if (behavior === 'openInTab') {\n return (\n <StyledLinkPreviewPopoverBtn\n data-testid={testIds.newTab}\n forwardedAs='a'\n href={href}\n target='_blank'\n rel='noreferrer'\n tabIndex='-1'\n >\n <StyledLinkPreviewPopoverText>\n <span>{getActionLabel(behavior)}</span>\n <Flex container={{ inline: true, justify: 'end' }}>\n <Keyboard keyName='CommandOrControl' />\n <Keyboard keyName='Enter' />\n </Flex>\n </StyledLinkPreviewPopoverText>\n </StyledLinkPreviewPopoverBtn>\n );\n }\n\n return (\n <StyledLinkPreviewPopoverBtn\n data-testid={testIds.root}\n forwardedAs='a'\n href={href}\n tabIndex='-1'\n >\n <StyledLinkPreviewPopoverText>\n <span>{getActionLabel(behavior)}</span>\n </StyledLinkPreviewPopoverText>\n </StyledLinkPreviewPopoverBtn>\n );\n };\n\n const renderHoverPopoverAction = (behavior: LinkBehavior) => {\n if (behavior === 'preview') {\n return (\n <StyledLinkPopoverBtn\n data-testid={testIds.preview}\n preview\n type='button'\n ref={previewBtnRef}\n onClick={onPreviewClick}\n tabIndex='-1'\n >\n {getActionLabel(behavior)}\n </StyledLinkPopoverBtn>\n );\n }\n\n if (behavior === 'openInTab') {\n return (\n <StyledLinkPopoverBtn\n data-testid={testIds.newTab}\n forwardedAs='a'\n href={href}\n target='_blank'\n rel='noreferrer'\n tabIndex='-1'\n >\n {getActionLabel(behavior)}\n </StyledLinkPopoverBtn>\n );\n }\n\n return (\n <StyledLinkPopoverBtn data-testid={testIds.root} forwardedAs='a' href={href} tabIndex='-1'>\n {getActionLabel(behavior)}\n </StyledLinkPopoverBtn>\n );\n };\n\n const onKeyUp = (e: ReactKeyboardEvent) => {\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 useEffect(() => {\n const onKeyDown = ({ key }: KeyboardEvent) => {\n if (key === 'Escape' && (popover || previewPopover)) {\n setPopoverHideDelay('none');\n setPopover(false);\n setPreviewPopover(false);\n }\n };\n\n document.addEventListener('keydown', onKeyDown);\n\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n };\n }, [popover, previewPopover]);\n\n return (\n <>\n <StyledLink\n data-testid={testIds.root}\n href={href}\n variant={variant}\n ref={linkRef}\n target={target}\n {...restProps}\n aria-describedby={previewable ? `${uid}-preview-instructions` : undefined}\n onMouseEnter={\n showPreviewOpenInTabPopoverProp\n ? (e: MouseEvent) => {\n mousePositionRef.current = { x: e.clientX, y: e.clientY };\n showPopover();\n }\n : undefined\n }\n onMouseLeave={hidePopover}\n onMouseMove={(e: MouseEvent) => {\n mousePositionRef.current = { x: e.clientX, y: e.clientY };\n }}\n onFocus={\n showPreviewOpenInTabPopoverProp\n ? () => {\n showPreviewPopover();\n }\n : undefined\n }\n onBlur={onBlurLink}\n onKeyUp={onKeyUp}\n onContextMenu={() => {\n contextMenuOpened.current = true;\n\n setPopoverHideDelay('none');\n hidePreviewPopover();\n hidePopover();\n }}\n onClick={(e: ReactMouseEvent<HTMLAnchorElement>) => {\n if (hasLinkBehavior && normalizedLinkBehavior === 'preview') {\n e.preventDefault();\n onPreviewClick();\n return;\n }\n\n onClickProp?.(e);\n }}\n >\n {children}\n {target === '_blank' && <VisuallyHiddenText>{t('opens_in_a_new_tab')}</VisuallyHiddenText>}\n {!icon && target === '_blank' && !hideNewTabIcon && <Icon name='open' />}\n </StyledLink>\n\n {previewable && (\n <Popover\n data-testid={testIds.previewPopover}\n show={previewPopover}\n placement='top'\n groupId='tooltip'\n showDelay='short'\n hideDelay={popoverHideDelay}\n target={linkRef.current}\n as={StyledLinkPopover}\n arrow\n preview\n portal\n onHide={hidePreviewPopover}\n onClick={(e: MouseEvent) => {\n e.stopPropagation();\n }}\n >\n {previewActions.map(behavior => {\n return (\n <Fragment key={`preview-action-${behavior}`}>\n {renderPreviewPopoverAction(behavior)}\n </Fragment>\n );\n })}\n </Popover>\n )}\n\n <Popover\n data-testid={testIds.previewPopover}\n show={popover}\n placement='top'\n groupId='tooltip'\n showDelay='short'\n hideDelay={popoverHideDelay}\n target={virtualElementRef.current}\n onMouseEnter={showPopover}\n onMouseLeave={hidePopover}\n as={StyledLinkPopover}\n arrow\n portal\n onClick={(e: MouseEvent) => {\n e.stopPropagation();\n }}\n onShow={() => {\n const clientRects = linkRef.current?.getClientRects() ?? [];\n const { x: mouseX, y: mouseY } = mousePositionRef.current;\n const containingRect = Array.from(clientRects).find(\n // Assumes the rects are returned in order of appearance (left to right, top down) and don't overlap\n rect => mouseY < rect.bottom && mouseX < rect.right\n );\n if (containingRect) {\n virtualElementCoordsRef.current = {\n x: mouseX,\n y: containingRect.top\n };\n }\n }}\n >\n {previewActions\n .filter(behavior => behavior !== 'preview' || previewable)\n .map(behavior => {\n return (\n <Fragment key={`hover-action-${behavior}`}>\n {renderHoverPopoverAction(behavior)}\n </Fragment>\n );\n })}\n </Popover>\n\n {previewable && (\n <HiddenText id={`${uid}-preview-instructions`}>\n {t('preview_link_instruction', [macintosh ? 'option' : 'alt'])}\n </HiddenText>\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,QA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AAC;wBACnB,uBAAuB,CAAC,OAAO,GAAG;4BAChC,CAAC,EAAE,MAAM;4BACT,CAAC,EAAE,cAAc,CAAC,GAAG;yBACtB,CAAC;oBACJ,CAAC;gBACH,CAAC,YAEA,cAAc;qBACZ,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,KAAK,SAAS,IAAI,WAAW,CAAC;qBACzD,GAAG,CAAC,QAAQ,CAAC,EAAE;oBACd,OAAO,CACL,KAAC,QAAQ,cACN,wBAAwB,CAAC,QAAQ,CAAC,IADtB,gBAAgB,QAAQ,EAAE,CAE9B,CACZ,CAAC;gBACJ,CAAC,CAAC,GACI,EAET,WAAW,IAAI,CACd,KAAC,UAAU,IAAC,EAAE,EAAE,GAAG,GAAG,uBAAuB,YAC1C,CAAC,CAAC,0BAA0B,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GACnD,CACd,IACA,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { forwardRef, useState, useRef, useEffect, Fragment } from 'react';\nimport type {\n MouseEvent as ReactMouseEvent,\n PropsWithoutRef,\n KeyboardEvent as ReactKeyboardEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport type { VirtualElement } from '@popperjs/core';\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 { WithAttributes, BaseProps, TestIdProp, RefElement, AsProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport {\n useBreakpoint,\n useConsolidatedRef,\n useI18n,\n usePreviewContext,\n useUID,\n useModalContext,\n useOS,\n useTestIds\n} from '../../hooks';\nimport { isCrossOrigin, tryCatch, withTestIds, disallowedURI } from '../../utils';\nimport { calculateFontSize, readableColor } from '../../styles';\nimport { Keyboard } from '../Badges';\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 HiddenText from '../HiddenText';\nimport { useFullscreenContext } from '../Fullscreen';\n\nimport { getLinkTestIds } from './Link.test-ids';\n\nexport type LinkProps = WithAttributes<\n 'a',\n BaseProps &\n TestIdProp &\n AsProp & {\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 * Hides new tab icon which appears for links with target=\"_blank\".\n * @default false\n */\n hideNewTabIcon?: boolean;\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 /**\n * Determines if the Link should render a popover when focused or hovered over.\n * @default false\n */\n previewable?: boolean;\n /** Callback function that is run when the preview popover is interacted with. */\n onPreview?: (e: { href: string }) => void;\n /** Optional link behavior. When omitted, legacy Link behavior is preserved. */\n linkBehavior?: LinkBehavior;\n }\n>;\n\ntype LinkBehavior = 'preview' | 'open' | 'openInTab';\n\nconst LINK_BEHAVIORS: LinkBehavior[] = ['preview', 'open', 'openInTab'];\n\nfunction isLinkBehavior(behavior: unknown): behavior is LinkBehavior {\n return typeof behavior === 'string' && LINK_BEHAVIORS.some(item => item === behavior);\n}\n\nfunction getAlternateLinkBehaviors(primaryBehavior: LinkBehavior): LinkBehavior[] {\n return LINK_BEHAVIORS.filter(behavior => behavior !== primaryBehavior);\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 --scale-in-size: 0;\n --animation-duration: ${theme.base.animation.speed};\n\n ${preview &&\n css`\n padding: calc(${theme.base.spacing} / 4);\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-visible {\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 StyledLinkPreviewPopoverText = styled.div``;\n\nexport const StyledLinkPreviewPopoverBtn = styled(StyledLinkPopoverBtn)(({ theme }) => {\n return css`\n padding: calc(${theme.base.spacing} / 2);\n\n & + & {\n padding-inline-start: calc(${theme.base.spacing} - ${theme.base.spacing} / 4);\n padding-inline-end: calc(${theme.base.spacing} / 4);\n }\n\n &:hover,\n &:active {\n text-decoration: none;\n ${StyledLinkPreviewPopoverText} span {\n text-decoration: underline;\n }\n ${StyledLinkPreviewPopoverText} ${StyledKeyboard} span {\n text-decoration: none;\n }\n }\n\n ${StyledLinkPreviewPopoverText} {\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 margin-inline: calc(${theme.base.spacing} / 4);\n\n &:first-of-type {\n margin-inline-start: calc(${theme.base.spacing} / 2);\n }\n\n &:last-of-type {\n margin-inline-end: calc(${theme.base.spacing} / 2);\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 = forwardRef<RefElement<LinkProps>, PropsWithoutRef<LinkProps>>(function Link(\n {\n testId,\n href: hrefProp,\n variant = 'link',\n icon = false,\n previewable: showPreviewOpenInTabPopoverProp = false,\n onPreview,\n linkBehavior,\n target: targetProp,\n onClick: onClickProp,\n hideNewTabIcon = false,\n children,\n ...restProps\n },\n ref\n) {\n const href = disallowedURI.test(hrefProp) ? undefined : hrefProp;\n\n const { initialized: inModal } = useModalContext();\n const fullscreen = useFullscreenContext();\n const inFullscreen = !!(fullscreen && fullscreen[0]);\n const { previewTriggerRef } = usePreviewContext();\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 mousePositionRef = useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n const virtualElementCoordsRef = useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n const virtualElementRef = useRef<VirtualElement>({\n get contextElement() {\n return linkRef.current ?? undefined;\n },\n getBoundingClientRect: () => {\n return {\n width: 0,\n height: 0,\n top: virtualElementCoordsRef.current.y,\n bottom: virtualElementCoordsRef.current.y,\n left: virtualElementCoordsRef.current.x,\n right: virtualElementCoordsRef.current.x,\n x: virtualElementCoordsRef.current.x,\n y: virtualElementCoordsRef.current.y,\n toJSON() {\n return this;\n }\n };\n }\n });\n\n const previewable = showPreviewOpenInTabPopoverProp && !inModal && !inFullscreen;\n\n const normalizedLinkBehavior = isLinkBehavior(linkBehavior) ? linkBehavior : undefined;\n const hasLinkBehavior = normalizedLinkBehavior !== undefined;\n const target =\n (hasLinkBehavior && normalizedLinkBehavior === 'openInTab') || isCrossOrigin(href ?? '')\n ? '_blank'\n : targetProp;\n\n const defaultPreviewAlternates: LinkBehavior[] = ['preview', 'openInTab'];\n const previewActions =\n hasLinkBehavior && normalizedLinkBehavior\n ? getAlternateLinkBehaviors(normalizedLinkBehavior)\n : defaultPreviewAlternates;\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 if (href !== undefined) {\n onPreview?.({ href });\n }\n };\n\n const getActionLabel = (behavior: LinkBehavior) => {\n if (behavior === 'preview') {\n return t('preview');\n }\n\n if (behavior === 'openInTab') {\n return t('link_open_in_tab_text');\n }\n\n return t('link_open_text');\n };\n\n const renderPreviewPopoverAction = (behavior: LinkBehavior) => {\n if (behavior === 'preview') {\n return (\n <StyledLinkPreviewPopoverBtn\n data-testid={testIds.preview}\n preview\n type='button'\n ref={previewBtnRef}\n onClick={onPreviewClick}\n tabIndex='-1'\n >\n <StyledLinkPreviewPopoverText>\n <span>{getActionLabel(behavior)}</span>\n <Flex container={{ inline: true, justify: 'end' }}>\n <Keyboard keyName='Alt' />\n <Keyboard keyName='P' />\n </Flex>\n </StyledLinkPreviewPopoverText>\n </StyledLinkPreviewPopoverBtn>\n );\n }\n\n if (behavior === 'openInTab') {\n return (\n <StyledLinkPreviewPopoverBtn\n data-testid={testIds.newTab}\n forwardedAs='a'\n href={href}\n target='_blank'\n rel='noreferrer'\n tabIndex='-1'\n >\n <StyledLinkPreviewPopoverText>\n <span>{getActionLabel(behavior)}</span>\n <Flex container={{ inline: true, justify: 'end' }}>\n <Keyboard keyName='CommandOrControl' />\n <Keyboard keyName='Enter' />\n </Flex>\n </StyledLinkPreviewPopoverText>\n </StyledLinkPreviewPopoverBtn>\n );\n }\n\n return (\n <StyledLinkPreviewPopoverBtn\n data-testid={testIds.root}\n forwardedAs='a'\n href={href}\n tabIndex='-1'\n >\n <StyledLinkPreviewPopoverText>\n <span>{getActionLabel(behavior)}</span>\n </StyledLinkPreviewPopoverText>\n </StyledLinkPreviewPopoverBtn>\n );\n };\n\n const renderHoverPopoverAction = (behavior: LinkBehavior) => {\n if (behavior === 'preview') {\n return (\n <StyledLinkPopoverBtn\n data-testid={testIds.preview}\n preview\n type='button'\n ref={previewBtnRef}\n onClick={onPreviewClick}\n tabIndex='-1'\n >\n {getActionLabel(behavior)}\n </StyledLinkPopoverBtn>\n );\n }\n\n if (behavior === 'openInTab') {\n return (\n <StyledLinkPopoverBtn\n data-testid={testIds.newTab}\n forwardedAs='a'\n href={href}\n target='_blank'\n rel='noreferrer'\n tabIndex='-1'\n >\n {getActionLabel(behavior)}\n </StyledLinkPopoverBtn>\n );\n }\n\n return (\n <StyledLinkPopoverBtn data-testid={testIds.root} forwardedAs='a' href={href} tabIndex='-1'>\n {getActionLabel(behavior)}\n </StyledLinkPopoverBtn>\n );\n };\n\n const onKeyUp = (e: ReactKeyboardEvent) => {\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 useEffect(() => {\n const onKeyDown = ({ key }: KeyboardEvent) => {\n if (key === 'Escape' && (popover || previewPopover)) {\n setPopoverHideDelay('none');\n setPopover(false);\n setPreviewPopover(false);\n }\n };\n\n document.addEventListener('keydown', onKeyDown);\n\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n };\n }, [popover, previewPopover]);\n\n return (\n <>\n <StyledLink\n data-testid={testIds.root}\n href={href}\n variant={variant}\n ref={linkRef}\n target={target}\n {...restProps}\n aria-describedby={previewable ? `${uid}-preview-instructions` : undefined}\n onMouseEnter={\n showPreviewOpenInTabPopoverProp\n ? (e: MouseEvent) => {\n mousePositionRef.current = { x: e.clientX, y: e.clientY };\n showPopover();\n }\n : undefined\n }\n onMouseLeave={hidePopover}\n onMouseMove={(e: MouseEvent) => {\n mousePositionRef.current = { x: e.clientX, y: e.clientY };\n }}\n onFocus={\n showPreviewOpenInTabPopoverProp\n ? () => {\n showPreviewPopover();\n }\n : undefined\n }\n onBlur={onBlurLink}\n onKeyUp={onKeyUp}\n onContextMenu={() => {\n contextMenuOpened.current = true;\n\n setPopoverHideDelay('none');\n hidePreviewPopover();\n hidePopover();\n }}\n onClick={(e: ReactMouseEvent<HTMLAnchorElement>) => {\n if (hasLinkBehavior && normalizedLinkBehavior === 'preview') {\n e.preventDefault();\n onPreviewClick();\n return;\n }\n\n onClickProp?.(e);\n }}\n >\n {children}\n {target === '_blank' && <VisuallyHiddenText>{t('opens_in_a_new_tab')}</VisuallyHiddenText>}\n {!icon && target === '_blank' && !hideNewTabIcon && <Icon name='open' />}\n </StyledLink>\n\n {previewable && (\n <Popover\n data-testid={testIds.previewPopover}\n show={previewPopover}\n placement='top'\n groupId='tooltip'\n showDelay='short'\n hideDelay={popoverHideDelay}\n target={linkRef.current}\n as={StyledLinkPopover}\n arrow\n preview\n portal\n onHide={hidePreviewPopover}\n onClick={(e: MouseEvent) => {\n e.stopPropagation();\n }}\n >\n {previewActions.map(behavior => {\n return (\n <Fragment key={`preview-action-${behavior}`}>\n {renderPreviewPopoverAction(behavior)}\n </Fragment>\n );\n })}\n </Popover>\n )}\n\n <Popover\n data-testid={testIds.previewPopover}\n show={popover}\n placement='top'\n groupId='tooltip'\n showDelay='short'\n hideDelay={popoverHideDelay}\n target={virtualElementRef.current}\n onMouseEnter={showPopover}\n onMouseLeave={hidePopover}\n as={StyledLinkPopover}\n arrow\n portal\n onClick={(e: MouseEvent) => {\n e.stopPropagation();\n }}\n onShow={() => {\n const clientRects = linkRef.current?.getClientRects() ?? [];\n const { x: mouseX, y: mouseY } = mousePositionRef.current;\n const containingRect = Array.from(clientRects).find(\n // Assumes the rects are returned in order of appearance (left to right, top down) and don't overlap\n rect => mouseY < rect.bottom && mouseX < rect.right\n );\n if (containingRect) {\n virtualElementCoordsRef.current = {\n x: mouseX,\n y: containingRect.top\n };\n }\n }}\n >\n {previewActions\n .filter(behavior => behavior !== 'preview' || previewable)\n .map(behavior => {\n return (\n <Fragment key={`hover-action-${behavior}`}>\n {renderHoverPopoverAction(behavior)}\n </Fragment>\n );\n })}\n </Popover>\n\n {previewable && (\n <HiddenText id={`${uid}-preview-instructions`}>\n {t('preview_link_instruction', [macintosh ? 'option' : 'alt'])}\n </HiddenText>\n )}\n </>\n );\n});\n\nexport default withTestIds(Link, getLinkTestIds);\n"]}
@@ -14,21 +14,37 @@ export declare const StyledListToolbarDialog: import("styled-components/dist/typ
14
14
  onDismiss?: () => void;
15
15
  onCancel: import("../Dialog/Dialog.types").FormAction;
16
16
  onSubmit: import("../Dialog/Dialog.types").FormAction;
17
+ } & {
18
+ compact: true;
19
+ } & {
20
+ 'aria-label': string;
21
+ heading?: never;
22
+ additionalInfo?: never;
23
+ } & Omit<import("../..").Attributes<"div">, "compact" | "aria-label" | "onSubmit" | "onCancel" | "heading" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
24
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
25
+ }) | (Omit<Omit<import("../Dialog/Dialog.types").BaseDialogProps & {
26
+ onDismiss?: () => void;
27
+ onCancel: import("../Dialog/Dialog.types").FormAction;
28
+ onSubmit: import("../Dialog/Dialog.types").FormAction;
29
+ } & {
30
+ compact?: false | undefined;
17
31
  } & {
18
32
  heading: string;
19
33
  additionalInfo?: import("../AdditionalInfo").AdditionalInfoProps;
20
34
  'aria-label'?: never;
21
- } & Omit<import("../..").Attributes<"div">, "aria-label" | "onSubmit" | "onCancel" | "heading" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
35
+ } & Omit<import("../..").Attributes<"div">, "compact" | "aria-label" | "onSubmit" | "onCancel" | "heading" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
22
36
  ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
23
37
  }) | (Omit<Omit<import("../Dialog/Dialog.types").BaseDialogProps & {
24
38
  onDismiss?: () => void;
25
39
  onCancel: import("../Dialog/Dialog.types").FormAction;
26
40
  onSubmit: import("../Dialog/Dialog.types").FormAction;
27
41
  } & {
28
- heading?: never;
42
+ compact?: false | undefined;
43
+ } & {
29
44
  'aria-label': string;
45
+ heading?: never;
30
46
  additionalInfo?: never;
31
- } & Omit<import("../..").Attributes<"div">, "aria-label" | "onSubmit" | "onCancel" | "heading" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
47
+ } & Omit<import("../..").Attributes<"div">, "compact" | "aria-label" | "onSubmit" | "onCancel" | "heading" | "onDismiss" | keyof import("../Dialog/Dialog.types").BaseDialogProps | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
32
48
  ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
33
49
  }), import("styled-components/dist/types").BaseObject>> & string & Omit<import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<import("../Dialog").FormDialogProps> & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
34
50
  export declare const StyledListToolbarContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<(Omit<Omit<Pick<import("../Flex/Flex").BaseFlexProps & import("../..").BaseProps & import("../..").AsProp & {
@@ -1 +1 @@
1
- {"version":3,"file":"ListToolbar.styles.d.ts","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.styles.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQ9C,eAAO,MAAM,wBAAwB;;2JAAmB,CAAC;AAGzD,eAAO,MAAM,gBAAgB,6NAK5B,CAAC;AAEF,eAAO,MAAM,kBAAkB;cAA6B,OAAO;YA0BjE,CAAC;AAIH,eAAO,MAAM,iBAAiB;oBAAgC,OAAO;YAsBpE,CAAC;AAIF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;uRAWlC,CAAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oMAYnC,CAAC;AAIH,eAAO,MAAM,eAAe,kYAK3B,CAAC;AAIF,eAAO,MAAM,aAAa;eACb,OAAO;cACR,OAAO;gBACL,UAAU;YAwDtB,CAAC;AAIH,eAAO,MAAM,eAAe;;;;mBAM1B,CAAC;AAIH,eAAO,MAAM,UAAU,qQAatB,CAAC;AAIF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oMAQjC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { VirtualElement } from '@popperjs/core';
2
+ /**
3
+ * Resolves a target to its underlying DOM element. If the target is already an Element,
4
+ * it is returned directly. Otherwise, the virtual element's `contextElement` is returned.
5
+ *
6
+ * @param target - The target element or virtual element to resolve.
7
+ * @returns The resolved DOM element, or `null` if no element can be resolved.
8
+ */
9
+ declare const getResolvedTarget: (target: Element | VirtualElement | null) => Element | null;
10
+ export default getResolvedTarget;
11
+ //# sourceMappingURL=getResolvedTarget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getResolvedTarget.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/getResolvedTarget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIrD;;;;;;GAMG;AACH,QAAA,MAAM,iBAAiB,GAAI,QAAQ,OAAO,GAAG,cAAc,GAAG,IAAI,mBAEjE,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import isInstance from '../../utils/isInstance';
2
+ /**
3
+ * Resolves a target to its underlying DOM element. If the target is already an Element,
4
+ * it is returned directly. Otherwise, the virtual element's `contextElement` is returned.
5
+ *
6
+ * @param target - The target element or virtual element to resolve.
7
+ * @returns The resolved DOM element, or `null` if no element can be resolved.
8
+ */
9
+ const getResolvedTarget = (target) => {
10
+ return isInstance(target, Element) ? target : target?.contextElement ?? null;
11
+ };
12
+ export default getResolvedTarget;
13
+ //# sourceMappingURL=getResolvedTarget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getResolvedTarget.js","sourceRoot":"","sources":["../../../src/components/Popover/getResolvedTarget.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,CAAC,MAAuC,EAAE,EAAE;IACpE,OAAO,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,cAAc,IAAI,IAAI,CAAC;AAC/E,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import type { VirtualElement } from '@popperjs/core';\n\nimport isInstance from '../../utils/isInstance';\n\n/**\n * Resolves a target to its underlying DOM element. If the target is already an Element,\n * it is returned directly. Otherwise, the virtual element's `contextElement` is returned.\n *\n * @param target - The target element or virtual element to resolve.\n * @returns The resolved DOM element, or `null` if no element can be resolved.\n */\nconst getResolvedTarget = (target: Element | VirtualElement | null) => {\n return isInstance(target, Element) ? target : target?.contextElement ?? null;\n};\n\nexport default getResolvedTarget;\n"]}
@@ -1,5 +1,6 @@
1
1
  export { default } from './Popover';
2
2
  export type { Delay, PopoverProps } from './Popover';
3
+ export { default as getResolvedTarget } from './getResolvedTarget';
3
4
  export { default as PopoverManager } from './PopoverManager';
4
5
  export { PopoverManagerContext } from './PopoverContext';
5
6
  export { StyledPopover } from './Popover.styles';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export { default } from './Popover';
2
+ export { default as getResolvedTarget } from './getResolvedTarget';
2
3
  export { default as PopoverManager } from './PopoverManager';
3
4
  export { PopoverManagerContext } from './PopoverContext';
4
5
  export { StyledPopover } from './Popover.styles';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { default } from './Popover';\nexport type { Delay, PopoverProps } from './Popover';\nexport { default as PopoverManager } from './PopoverManager';\nexport { PopoverManagerContext } from './PopoverContext';\nexport { StyledPopover } from './Popover.styles';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { default } from './Popover';\nexport type { Delay, PopoverProps } from './Popover';\nexport { default as getResolvedTarget } from './getResolvedTarget';\nexport { default as PopoverManager } from './PopoverManager';\nexport { PopoverManagerContext } from './PopoverContext';\nexport { StyledPopover } from './Popover.styles';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-core",
3
- "version": "10.0.0-build.5.3",
3
+ "version": "10.0.0-build.5.5",
4
4
  "description": "Cosmos is a visual design system and UI component collection. Its goal is to empower application developers in their pursuit to create engaging and rewarding user experiences.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Pegasystems",