@pega/cosmos-react-core 10.0.0-build.5.4 → 10.0.0-build.5.6

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 (39) 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/AppShell/AppHeader.styles.d.ts.map +1 -1
  4. package/lib/components/AppShell/AppHeader.styles.js +8 -3
  5. package/lib/components/AppShell/AppHeader.styles.js.map +1 -1
  6. package/lib/components/Dialog/Dialog.types.d.ts +23 -13
  7. package/lib/components/Dialog/Dialog.types.d.ts.map +1 -1
  8. package/lib/components/Dialog/Dialog.types.js.map +1 -1
  9. package/lib/components/Dialog/FormDialog.d.ts.map +1 -1
  10. package/lib/components/Dialog/FormDialog.js +50 -18
  11. package/lib/components/Dialog/FormDialog.js.map +1 -1
  12. package/lib/components/Dialog/InfoDialog.d.ts.map +1 -1
  13. package/lib/components/Dialog/InfoDialog.js +6 -4
  14. package/lib/components/Dialog/InfoDialog.js.map +1 -1
  15. package/lib/components/InlineEdit/InlineEdit.d.ts +6 -0
  16. package/lib/components/InlineEdit/InlineEdit.d.ts.map +1 -1
  17. package/lib/components/InlineEdit/InlineEdit.js +45 -4
  18. package/lib/components/InlineEdit/InlineEdit.js.map +1 -1
  19. package/lib/components/InlineEdit/InlineEdit.styles.d.ts +19 -3
  20. package/lib/components/InlineEdit/InlineEdit.styles.d.ts.map +1 -1
  21. package/lib/components/InlineEdit/InlineEdit.styles.js +38 -20
  22. package/lib/components/InlineEdit/InlineEdit.styles.js.map +1 -1
  23. package/lib/components/Link/Link.js +1 -1
  24. package/lib/components/Link/Link.js.map +1 -1
  25. package/lib/components/ListToolbar/ListToolbar.styles.d.ts +19 -3
  26. package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
  27. package/lib/components/Popover/getResolvedTarget.d.ts +11 -0
  28. package/lib/components/Popover/getResolvedTarget.d.ts.map +1 -0
  29. package/lib/components/Popover/getResolvedTarget.js +13 -0
  30. package/lib/components/Popover/getResolvedTarget.js.map +1 -0
  31. package/lib/components/Popover/index.d.ts +1 -0
  32. package/lib/components/Popover/index.d.ts.map +1 -1
  33. package/lib/components/Popover/index.js +1 -0
  34. package/lib/components/Popover/index.js.map +1 -1
  35. package/lib/theme/theme.d.ts +7 -0
  36. package/lib/theme/theme.d.ts.map +1 -1
  37. package/lib/theme/themeDefinition.json +8 -3
  38. package/lib/theme/themeOverrides.schema.json +3 -0
  39. 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 +1 @@
1
- {"version":3,"file":"AppHeader.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.styles.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC,eAAO,MAAM,qBAAqB,6NAIhC,CAAC;AAIH,eAAO,MAAM,mBAAmB;gBAA4B,OAAO;YA2BjE,CAAC;AAIH,eAAO,MAAM,yBAAyB;oBACpB,MAAM,GAAG,MAAM,GAAG,WAAW;YAkF7C,CAAC;AAIH,eAAO,MAAM,qBAAqB,6NAEjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,6NAI9B,CAAC;AAIH,eAAO,MAAM,mBAAmB;cAA0B,OAAO;YAQhE,CAAC;AAGF,eAAO,MAAM,mBAAmB;;;aACrB,SAAS,CAAC,SAAS,CAAC;cACnB,OAAO;8HAwCjB,CAAC;AAIH,eAAO,MAAM,uBAAuB,yOAQnC,CAAC;AAIF,eAAO,MAAM,eAAe;aAA4B,OAAO;gBAAc,OAAO;YAmEnF,CAAC"}
1
+ {"version":3,"file":"AppHeader.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.styles.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC,eAAO,MAAM,qBAAqB,6NAIhC,CAAC;AAIH,eAAO,MAAM,mBAAmB;gBAA4B,OAAO;YA2BjE,CAAC;AAIH,eAAO,MAAM,yBAAyB;oBACpB,MAAM,GAAG,MAAM,GAAG,WAAW;YAkF7C,CAAC;AAIH,eAAO,MAAM,qBAAqB,6NAEjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,6NAI9B,CAAC;AAIH,eAAO,MAAM,mBAAmB;cAA0B,OAAO;YAQhE,CAAC;AAGF,eAAO,MAAM,mBAAmB;;;aACrB,SAAS,CAAC,SAAS,CAAC;cACnB,OAAO;8HA+CjB,CAAC;AAIH,eAAO,MAAM,uBAAuB,yOAQnC,CAAC;AAIF,eAAO,MAAM,eAAe;aAA4B,OAAO;gBAAc,OAAO;YAmEnF,CAAC"}
@@ -136,7 +136,9 @@ export const StyledAppHeaderText = styled(Text)(({ theme, variant, stacked }) =>
136
136
  const foregroundColor = theme.components['app-shell'].header['app-name-color'] === 'auto'
137
137
  ? calculateForegroundColor(headerBg, headerFgColor, theme)
138
138
  : theme.components['app-shell'].header['app-name-color'];
139
- const secondaryColor = tryCatch(() => rgba(foregroundColor ?? theme.base.palette['foreground-color'], theme.base.transparency['transparent-2']));
139
+ const secondaryColor = theme.components['app-shell'].header['portal-name-color'] === 'auto'
140
+ ? tryCatch(() => rgba(foregroundColor ?? theme.base.palette['foreground-color'], theme.base.transparency['transparent-2']))
141
+ : theme.components['app-shell'].header['portal-name-color'];
140
142
  const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
141
143
  return css `
142
144
  display: inline-block;
@@ -156,8 +158,11 @@ export const StyledAppHeaderText = styled(Text)(({ theme, variant, stacked }) =>
156
158
 
157
159
  ${variant === 'secondary' &&
158
160
  css `
159
- font-size: ${fontSize};
160
- align-self: ${stacked ? 'flex-start' : 'flex-end'};
161
+ font-size: ${fontSize[theme.components.text.secondary['font-size']]};
162
+ ${stacked &&
163
+ css `
164
+ align-self: flex-start;
165
+ `}
161
166
  `}
162
167
  `;
163
168
  });
@@ -1 +1 @@
1
- {"version":3,"file":"AppHeader.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EAEzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,IAAI,MAAM,SAAS,CAAC;AAG3B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAA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G,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,EACzD,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CACrC,EACD,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAC3B,CAAC;IAEF,OAAO,GAAG,CAAA;;sBAEQ,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ;QAC5C,UAAU;QACZ,GAAG,CAAA;wBACe,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ;OAC/C;;aAEM,KAAK,CAAC,IAAI,CAAC,OAAO;;gBAEf,YAAY;oBACR,QAAQ;eACb,eAAe;uCACS,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC;;QAEnF,mBAAmB;;;;UAIjB,OAAO;QACT,GAAG,CAAA;;SAEF;;;QAGD,yBAAyB;iBAChB,eAAe;;;UAGtB,uBAAuB;;;YAGrB,aAAa;;YAEb,uBAAuB;0BACT,QAAQ;;;YAGtB,uBAAuB;qBACd,eAAe;;;;;uBAKb,WAAW,CAAC,UAAU;kCACX,WAAW,CAAC,UAAU;;;;;KAKnD,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { mix, rgba, transparentize } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport {\n calculateFontSize,\n getHoverColors,\n calculateForegroundColor,\n type FontSize\n} from '../../styles';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { StyledImage } from '../Image';\nimport { StyledMenuListContainer } from '../Menu/Menu.styles';\nimport { StyledPopover } from '../Popover';\nimport { StyledSearchInput } from '../SearchInput';\nimport {\n StyledSearchButton,\n StyledSearchFiltersButton,\n StyledSearchTextInput\n} from '../SearchInput/SearchInput.styles';\nimport Text from '../Text';\nimport type { TextProps } from '../Text';\n\nimport { headerHeight, navWidth } from './AppShell.styles';\n\nexport const StyledContextSwitcher = styled.div(({ theme }) => {\n return css`\n width: calc(${navWidth} - 2 * ${theme.base.spacing});\n `;\n});\n\nStyledContextSwitcher.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderInfo = styled.div<{ centerLogo: boolean }>(({ centerLogo, theme }) => {\n return css`\n & > :first-child {\n vertical-align: top;\n }\n\n & > :is(a, button) {\n cursor: pointer;\n text-decoration: none;\n user-select: none;\n -webkit-user-select: none;\n }\n\n & > :is(a, button):focus-visible {\n box-shadow: ${theme.base.shadow.focus};\n outline: none;\n }\n\n ${StyledImage} {\n height: 1.0725rem;\n\n ${centerLogo &&\n css`\n padding-inline-start: ${theme.base.spacing};\n `}\n }\n `;\n});\n\nStyledAppHeaderInfo.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSearchForm = styled.form<{\n searchDisplay?: 'icon' | 'grow' | 'fullWidth';\n}>(({ searchDisplay, theme }) => {\n const {\n base: { animation },\n components: {\n 'app-shell': { header },\n input\n }\n } = theme;\n\n const {\n background: headerBg,\n 'search-input': {\n 'background-color': searchInputBg,\n 'foreground-color': searchInputFg,\n 'border-color': searchInputBorder\n }\n } = header;\n\n const searchBg = searchInputBg;\n const searchFg = calculateForegroundColor(headerBg, searchInputFg, theme);\n const searchBorder = calculateForegroundColor(headerBg, searchInputBorder, theme);\n\n return css`\n max-width: 33vw;\n min-width: 10rem;\n width: 100%;\n justify-self: center;\n margin-inline-start: 0;\n margin-inline-end: auto;\n transition: max-width ${animation.speed} ${animation.timing.ease};\n\n ${StyledSearchInput} input::placeholder {\n color: ${transparentize(0.4, searchFg)};\n }\n\n ${searchDisplay === 'icon' &&\n css`\n max-width: ${input.height};\n min-width: ${input.height};\n width: auto;\n margin-inline-start: auto;\n margin-inline-end: 0;\n `}\n\n ${searchDisplay === 'grow' &&\n css`\n flex-grow: 1;\n max-width: 100%;\n margin-inline-end: 0;\n `}\n\n ${searchDisplay === 'fullWidth' &&\n css`\n max-width: 100%;\n margin-inline-end: 0;\n `}\n\n &:not([focused]) {\n ${StyledSearchInput} {\n background: ${searchBg};\n border-color: ${searchBorder};\n ${StyledSearchButton} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n\n ${StyledSearchTextInput} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n\n ${StyledSearchFiltersButton} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n }\n }\n `;\n});\n\nStyledAppHeaderSearchForm.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSpacer = styled.div`\n margin: auto;\n`;\n\nexport const StyledAppHeaderLogo = styled.div(({ theme }) => {\n return css`\n max-width: min(${theme.base['content-width'].sm}, 25vw);\n `;\n});\nStyledAppHeaderLogo.defaultProps = defaultThemeProp;\n\n// Shrinks the app/portal name for ellipsis truncation; stacks vertically below `md` where there's no room for both names side by side.\nexport const StyledAppHeaderName = styled.div<{ stacked?: boolean }>(\n ({ theme, stacked }) => css`\n display: flex;\n flex-direction: ${stacked ? 'column' : 'row'};\n align-items: ${stacked ? 'stretch' : 'baseline'};\n gap: ${stacked ? 0 : theme.base.spacing};\n min-width: 0;\n `\n);\nStyledAppHeaderName.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderText = styled(Text)<{\n variant: TextProps['variant'];\n stacked?: boolean;\n}>(({ theme, variant, stacked }) => {\n const headerBg = theme.components['app-shell'].header.background;\n const headerFgColor = theme.components['app-shell'].header['foreground-color'];\n\n const foregroundColor =\n theme.components['app-shell'].header['app-name-color'] === 'auto'\n ? calculateForegroundColor(headerBg, headerFgColor, theme)\n : theme.components['app-shell'].header['app-name-color'];\n\n const secondaryColor = tryCatch(() =>\n rgba(\n foregroundColor ?? theme.base.palette['foreground-color'],\n theme.base.transparency['transparent-2']\n )\n );\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n display: inline-block;\n max-width: 100%;\n min-width: 0;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n color: ${variant === 'secondary' ? secondaryColor : foregroundColor};\n font-family: ${theme.components.text['brand-primary']['font-family']};\n\n ${variant === 'primary' &&\n css`\n font-size: ${fontSize[theme.components.text['brand-primary']['font-size'] as FontSize]};\n font-weight: ${theme.components.text['brand-primary']['font-weight']};\n `}\n\n ${variant === 'secondary' &&\n css`\n font-size: ${fontSize};\n align-self: ${stacked ? 'flex-start' : 'flex-end'};\n `}\n `;\n});\n\nStyledAppHeaderText.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderOperator = styled.button(\n ({ theme }) => css`\n border-radius: 50%;\n\n :focus-visible {\n box-shadow: ${theme.base.shadow.focus};\n }\n `\n);\n\nStyledAppHeaderOperator.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeader = styled.header<{ stacked: boolean; drawerOpen: boolean }>(\n ({ stacked, drawerOpen, theme }) => {\n const headerBg = theme.components['app-shell'].header.background;\n const headerFgColor = theme.components['app-shell'].header['foreground-color'];\n\n const foregroundColor = calculateForegroundColor(headerBg, headerFgColor, theme);\n\n const hoverColors = getHoverColors(\n tryCatch(\n () => mix(0.01, theme.base.palette.interactive, headerBg),\n () => theme.base.palette.interactive\n ),\n theme.base['min-contrast']\n );\n\n return css`\n position: sticky;\n z-index: calc(${theme.base['z-index'].backdrop} - 1);\n ${drawerOpen &&\n css`\n z-index: calc(${theme.base['z-index'].backdrop} - 2);\n `}\n top: var(--appshell-hard-top-offset, 0);\n gap: ${theme.base.spacing};\n max-width: 100%;\n height: ${headerHeight};\n background: ${headerBg};\n color: ${foregroundColor};\n border-bottom: solid 0.0625rem ${theme.components['app-shell'].header['border-color']};\n\n ${StyledAppHeaderInfo} {\n justify-self: flex-start;\n min-width: 33vw;\n\n ${stacked &&\n css`\n min-width: 0;\n `}\n }\n\n ${StyledSearchFiltersButton} {\n color: ${foregroundColor};\n }\n\n > ${StyledAppHeaderOperator} {\n justify-self: flex-end;\n\n + ${StyledPopover} {\n &,\n ${StyledMenuListContainer} {\n background: ${headerBg};\n }\n\n ${StyledMenuListContainer} li {\n color: ${foregroundColor};\n background-color: transparent;\n\n &:hover,\n &[data-current='true'] {\n color: ${hoverColors.foreground};\n background-color: ${hoverColors.background};\n }\n }\n }\n }\n `;\n }\n);\n\nStyledAppHeader.defaultProps = defaultThemeProp;\n"]}
1
+ {"version":3,"file":"AppHeader.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EAEzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,IAAI,MAAM,SAAS,CAAC;AAG3B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE3D,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC5D,OAAO,GAAG,CAAA;kBACM,QAAQ,UAAU,KAAK,CAAC,IAAI,CAAC,OAAO;GACnD,CAAC;AACJ,CAA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EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,EACzD,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CACrC,EACD,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAC3B,CAAC;IAEF,OAAO,GAAG,CAAA;;sBAEQ,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ;QAC5C,UAAU;QACZ,GAAG,CAAA;wBACe,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ;OAC/C;;aAEM,KAAK,CAAC,IAAI,CAAC,OAAO;;gBAEf,YAAY;oBACR,QAAQ;eACb,eAAe;uCACS,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC;;QAEnF,mBAAmB;;;;UAIjB,OAAO;QACT,GAAG,CAAA;;SAEF;;;QAGD,yBAAyB;iBAChB,eAAe;;;UAGtB,uBAAuB;;;YAGrB,aAAa;;YAEb,uBAAuB;0BACT,QAAQ;;;YAGtB,uBAAuB;qBACd,eAAe;;;;;uBAKb,WAAW,CAAC,UAAU;kCACX,WAAW,CAAC,UAAU;;;;;KAKnD,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { mix, rgba, transparentize } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport {\n calculateFontSize,\n getHoverColors,\n calculateForegroundColor,\n type FontSize\n} from '../../styles';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { StyledImage } from '../Image';\nimport { StyledMenuListContainer } from '../Menu/Menu.styles';\nimport { StyledPopover } from '../Popover';\nimport { StyledSearchInput } from '../SearchInput';\nimport {\n StyledSearchButton,\n StyledSearchFiltersButton,\n StyledSearchTextInput\n} from '../SearchInput/SearchInput.styles';\nimport Text from '../Text';\nimport type { TextProps } from '../Text';\n\nimport { headerHeight, navWidth } from './AppShell.styles';\n\nexport const StyledContextSwitcher = styled.div(({ theme }) => {\n return css`\n width: calc(${navWidth} - 2 * ${theme.base.spacing});\n `;\n});\n\nStyledContextSwitcher.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderInfo = styled.div<{ centerLogo: boolean }>(({ centerLogo, theme }) => {\n return css`\n & > :first-child {\n vertical-align: top;\n }\n\n & > :is(a, button) {\n cursor: pointer;\n text-decoration: none;\n user-select: none;\n -webkit-user-select: none;\n }\n\n & > :is(a, button):focus-visible {\n box-shadow: ${theme.base.shadow.focus};\n outline: none;\n }\n\n ${StyledImage} {\n height: 1.0725rem;\n\n ${centerLogo &&\n css`\n padding-inline-start: ${theme.base.spacing};\n `}\n }\n `;\n});\n\nStyledAppHeaderInfo.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSearchForm = styled.form<{\n searchDisplay?: 'icon' | 'grow' | 'fullWidth';\n}>(({ searchDisplay, theme }) => {\n const {\n base: { animation },\n components: {\n 'app-shell': { header },\n input\n }\n } = theme;\n\n const {\n background: headerBg,\n 'search-input': {\n 'background-color': searchInputBg,\n 'foreground-color': searchInputFg,\n 'border-color': searchInputBorder\n }\n } = header;\n\n const searchBg = searchInputBg;\n const searchFg = calculateForegroundColor(headerBg, searchInputFg, theme);\n const searchBorder = calculateForegroundColor(headerBg, searchInputBorder, theme);\n\n return css`\n max-width: 33vw;\n min-width: 10rem;\n width: 100%;\n justify-self: center;\n margin-inline-start: 0;\n margin-inline-end: auto;\n transition: max-width ${animation.speed} ${animation.timing.ease};\n\n ${StyledSearchInput} input::placeholder {\n color: ${transparentize(0.4, searchFg)};\n }\n\n ${searchDisplay === 'icon' &&\n css`\n max-width: ${input.height};\n min-width: ${input.height};\n width: auto;\n margin-inline-start: auto;\n margin-inline-end: 0;\n `}\n\n ${searchDisplay === 'grow' &&\n css`\n flex-grow: 1;\n max-width: 100%;\n margin-inline-end: 0;\n `}\n\n ${searchDisplay === 'fullWidth' &&\n css`\n max-width: 100%;\n margin-inline-end: 0;\n `}\n\n &:not([focused]) {\n ${StyledSearchInput} {\n background: ${searchBg};\n border-color: ${searchBorder};\n ${StyledSearchButton} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n\n ${StyledSearchTextInput} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n\n ${StyledSearchFiltersButton} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n }\n }\n `;\n});\n\nStyledAppHeaderSearchForm.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSpacer = styled.div`\n margin: auto;\n`;\n\nexport const StyledAppHeaderLogo = styled.div(({ theme }) => {\n return css`\n max-width: min(${theme.base['content-width'].sm}, 25vw);\n `;\n});\nStyledAppHeaderLogo.defaultProps = defaultThemeProp;\n\n// Shrinks the app/portal name for ellipsis truncation; stacks vertically below `md` where there's no room for both names side by side.\nexport const StyledAppHeaderName = styled.div<{ stacked?: boolean }>(\n ({ theme, stacked }) => css`\n display: flex;\n flex-direction: ${stacked ? 'column' : 'row'};\n align-items: ${stacked ? 'stretch' : 'baseline'};\n gap: ${stacked ? 0 : theme.base.spacing};\n min-width: 0;\n `\n);\nStyledAppHeaderName.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderText = styled(Text)<{\n variant: TextProps['variant'];\n stacked?: boolean;\n}>(({ theme, variant, stacked }) => {\n const headerBg = theme.components['app-shell'].header.background;\n const headerFgColor = theme.components['app-shell'].header['foreground-color'];\n\n const foregroundColor =\n theme.components['app-shell'].header['app-name-color'] === 'auto'\n ? calculateForegroundColor(headerBg, headerFgColor, theme)\n : theme.components['app-shell'].header['app-name-color'];\n\n const secondaryColor =\n theme.components['app-shell'].header['portal-name-color'] === 'auto'\n ? tryCatch(() =>\n rgba(\n foregroundColor ?? theme.base.palette['foreground-color'],\n theme.base.transparency['transparent-2']\n )\n )\n : theme.components['app-shell'].header['portal-name-color'];\n\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n display: inline-block;\n max-width: 100%;\n min-width: 0;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n color: ${variant === 'secondary' ? secondaryColor : foregroundColor};\n font-family: ${theme.components.text['brand-primary']['font-family']};\n\n ${variant === 'primary' &&\n css`\n font-size: ${fontSize[theme.components.text['brand-primary']['font-size'] as FontSize]};\n font-weight: ${theme.components.text['brand-primary']['font-weight']};\n `}\n\n ${variant === 'secondary' &&\n css`\n font-size: ${fontSize[theme.components.text.secondary['font-size'] as FontSize]};\n ${stacked &&\n css`\n align-self: flex-start;\n `}\n `}\n `;\n});\n\nStyledAppHeaderText.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderOperator = styled.button(\n ({ theme }) => css`\n border-radius: 50%;\n\n :focus-visible {\n box-shadow: ${theme.base.shadow.focus};\n }\n `\n);\n\nStyledAppHeaderOperator.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeader = styled.header<{ stacked: boolean; drawerOpen: boolean }>(\n ({ stacked, drawerOpen, theme }) => {\n const headerBg = theme.components['app-shell'].header.background;\n const headerFgColor = theme.components['app-shell'].header['foreground-color'];\n\n const foregroundColor = calculateForegroundColor(headerBg, headerFgColor, theme);\n\n const hoverColors = getHoverColors(\n tryCatch(\n () => mix(0.01, theme.base.palette.interactive, headerBg),\n () => theme.base.palette.interactive\n ),\n theme.base['min-contrast']\n );\n\n return css`\n position: sticky;\n z-index: calc(${theme.base['z-index'].backdrop} - 1);\n ${drawerOpen &&\n css`\n z-index: calc(${theme.base['z-index'].backdrop} - 2);\n `}\n top: var(--appshell-hard-top-offset, 0);\n gap: ${theme.base.spacing};\n max-width: 100%;\n height: ${headerHeight};\n background: ${headerBg};\n color: ${foregroundColor};\n border-bottom: solid 0.0625rem ${theme.components['app-shell'].header['border-color']};\n\n ${StyledAppHeaderInfo} {\n justify-self: flex-start;\n min-width: 33vw;\n\n ${stacked &&\n css`\n min-width: 0;\n `}\n }\n\n ${StyledSearchFiltersButton} {\n color: ${foregroundColor};\n }\n\n > ${StyledAppHeaderOperator} {\n justify-self: flex-end;\n\n + ${StyledPopover} {\n &,\n ${StyledMenuListContainer} {\n background: ${headerBg};\n }\n\n ${StyledMenuListContainer} li {\n color: ${foregroundColor};\n background-color: transparent;\n\n &:hover,\n &[data-current='true'] {\n color: ${hoverColors.foreground};\n background-color: ${hoverColors.background};\n }\n }\n }\n }\n `;\n }\n);\n\nStyledAppHeader.defaultProps = defaultThemeProp;\n"]}
@@ -1,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,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,m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AGG;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,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA,EAAE,CAAC;AAEjD,MAAM,UAAU,GAAG,UAAU,CAC3B,SAAS,UAAU,CACjB,EACE,KAAK,GAAG,IAAI,EACZ,MAAM,EACN,OAAO,EACP,YAAY,EAAE,SAAS,EACvB,QAAQ,EACR,QAAQ,EACR,SA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CAAC,EAAE,EAC/D,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EACnB,EAAE,EAAE,kBAAkB,aAEtB,KAAC,MAAM,IACL,OAAO,EAAE,GAAG,EAAE;4BACZ,eAAe,EAAE,CAAC;wBACpB,CAAC,EACD,QAAQ,EAAE,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,YAEvE,OAAO,QAAQ,KAAK,UAAU,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GACvE,EAET,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,GAAG,EAAE;4BACZ,CAAC,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;wBACnE,CAAC,EACD,QAAQ,EAAE,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,YAEvE,OAAO,QAAQ,KAAK,UAAU,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GACvE,IACJ,IACU,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 } 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":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AE,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: 'simple', onClick: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"InfoDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/InfoDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGvE,OAAO,EACL,kBAAkB,EAClB,kBAA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AAE,GAAG,EAAE,CAAC,EAAE,EAC5E,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EACnB,EAAE,EAAE,kBAAkB,aAErB,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,CACjC,OAAO,CACR,CAAC,CAAC,CAAC,CACF,KAAC,WAAW,IACV,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,OAAO,EAChB,SAAS,EACP,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CACtB,KAAC,IAAI,IAAC,OAAO,EAAC,WAAW,YAAE,WAAW,CAAC,SAAS,GAAQ,CACzD,CAAC,CAAC,CAAC,SAAS,EAEf,MAAM,EAAE,WAAW,CAAC,MAAM,GAC1B,CACH,EACA,aAAa,IACT,CACR,EAEA,CAAC,CAAC,WAAW,IAAI,QAAQ,IAAI,YAAY,CAAC,IAAI,CAC7C,MAAC,IAAI,IACH,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAClC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EACjB,EAAE,EAAE,mBAAmB,EACvB,GAAG,EAAE,gBAAgB,EACrB,QAAQ,EAAE,eAAe,aAExB,CAAC,WAAW,IAAI,aAAa,EAC7B,QAAQ,IAAI,CACX,KAAC,kBAAkB,IAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,YACrD,QAAQ,GACU,CACtB,EACA,QAAQ,IACJ,CACR,IACgB,CACpB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,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';\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"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGvE,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,SAAS,EACT,OAAO,EACP,aAAa,EACb,MAAM,EACP,MAAM,aAAa,CAAC;AACrB,OAAO,IAAI,MAAM,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,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAC5E,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EACnB,EAAE,EAAE,kBAAkB,aAErB,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,CACjC,OAAO,CACR,CAAC,CAAC,CAAC,CACF,KAAC,WAAW,IACV,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,OAAO,EAChB,SAAS,EACP,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CACtB,KAAC,IAAI,IAAC,OAAO,EAAC,WAAW,YAAE,WAAW,CAAC,SAAS,GAAQ,CACzD,CAAC,CAAC,CAAC,SAAS,EAEf,MAAM,EAAE,WAAW,CAAC,MAAM,GAC1B,CACH,EACA,aAAa,IACT,CACR,EAEA,CAAC,CAAC,WAAW,IAAI,QAAQ,IAAI,YAAY,CAAC,IAAI,CAC7C,MAAC,IAAI,IACH,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAClC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EACjB,EAAE,EAAE,mBAAmB,EACvB,GAAG,EAAE,gBAAgB,EACrB,QAAQ,EAAE,eAAe,aAExB,CAAC,WAAW,IAAI,aAAa,EAC7B,QAAQ,IAAI,CACX,KAAC,kBAAkB,IAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,YACrD,QAAQ,GACU,CACtB,EACA,QAAQ,IACJ,CACR,IACgB,CACpB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,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,GAA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