@cloudscape-design/components-themeable 3.0.1238 → 3.0.1240

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 (70) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
  3. package/lib/internal/template/app-layout/index.d.ts.map +1 -1
  4. package/lib/internal/template/app-layout/index.js +3 -15
  5. package/lib/internal/template/app-layout/index.js.map +1 -1
  6. package/lib/internal/template/app-layout/utils/use-aria-labels.d.ts +3 -0
  7. package/lib/internal/template/app-layout/utils/use-aria-labels.d.ts.map +1 -0
  8. package/lib/internal/template/app-layout/utils/use-aria-labels.js +19 -0
  9. package/lib/internal/template/app-layout/utils/use-aria-labels.js.map +1 -0
  10. package/lib/internal/template/app-layout/visual-refresh-toolbar/index.d.ts.map +1 -1
  11. package/lib/internal/template/app-layout/visual-refresh-toolbar/index.js +17 -9
  12. package/lib/internal/template/app-layout/visual-refresh-toolbar/index.js.map +1 -1
  13. package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.d.ts +1 -0
  14. package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.d.ts.map +1 -1
  15. package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.js +1 -0
  16. package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.js.map +1 -1
  17. package/lib/internal/template/app-layout-toolbar/index.d.ts.map +1 -1
  18. package/lib/internal/template/app-layout-toolbar/index.js +1 -16
  19. package/lib/internal/template/app-layout-toolbar/index.js.map +1 -1
  20. package/lib/internal/template/attribute-editor/internal.d.ts.map +1 -1
  21. package/lib/internal/template/attribute-editor/internal.js +7 -1
  22. package/lib/internal/template/attribute-editor/internal.js.map +1 -1
  23. package/lib/internal/template/button/index.d.ts.map +1 -1
  24. package/lib/internal/template/button/index.js +2 -2
  25. package/lib/internal/template/button/index.js.map +1 -1
  26. package/lib/internal/template/button/interfaces.d.ts +4 -0
  27. package/lib/internal/template/button/interfaces.d.ts.map +1 -1
  28. package/lib/internal/template/button/interfaces.js.map +1 -1
  29. package/lib/internal/template/button/internal.d.ts.map +1 -1
  30. package/lib/internal/template/button/internal.js +2 -1
  31. package/lib/internal/template/button/internal.js.map +1 -1
  32. package/lib/internal/template/button-dropdown/internal.d.ts.map +1 -1
  33. package/lib/internal/template/button-dropdown/internal.js +2 -4
  34. package/lib/internal/template/button-dropdown/internal.js.map +1 -1
  35. package/lib/internal/template/i18n/dynamic.js +1 -1
  36. package/lib/internal/template/i18n/provider.d.ts +4 -12
  37. package/lib/internal/template/i18n/provider.d.ts.map +1 -1
  38. package/lib/internal/template/i18n/provider.js +4 -106
  39. package/lib/internal/template/i18n/provider.js.map +1 -1
  40. package/lib/internal/template/i18n/providers/local-provider.d.ts +9 -0
  41. package/lib/internal/template/i18n/providers/local-provider.d.ts.map +1 -0
  42. package/lib/internal/template/i18n/providers/local-provider.js +56 -0
  43. package/lib/internal/template/i18n/providers/local-provider.js.map +1 -0
  44. package/lib/internal/template/i18n/providers/remote-provider.d.ts +24 -0
  45. package/lib/internal/template/i18n/providers/remote-provider.d.ts.map +1 -0
  46. package/lib/internal/template/i18n/providers/remote-provider.js +42 -0
  47. package/lib/internal/template/i18n/providers/remote-provider.js.map +1 -0
  48. package/lib/internal/template/i18n/utils/i18n-formatter.d.ts +30 -0
  49. package/lib/internal/template/i18n/utils/i18n-formatter.d.ts.map +1 -0
  50. package/lib/internal/template/i18n/utils/i18n-formatter.js +61 -0
  51. package/lib/internal/template/i18n/utils/i18n-formatter.js.map +1 -0
  52. package/lib/internal/template/i18n/utils/locales.d.ts +3 -0
  53. package/lib/internal/template/i18n/utils/locales.d.ts.map +1 -0
  54. package/lib/internal/template/i18n/utils/locales.js +28 -0
  55. package/lib/internal/template/i18n/utils/locales.js.map +1 -0
  56. package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
  57. package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts.map +1 -1
  58. package/lib/internal/template/internal/components/drag-handle-wrapper/index.js +4 -2
  59. package/lib/internal/template/internal/components/drag-handle-wrapper/index.js.map +1 -1
  60. package/lib/internal/template/internal/environment.js +2 -2
  61. package/lib/internal/template/internal/environment.json +2 -2
  62. package/lib/internal/template/internal/widget-exports.d.ts +1 -0
  63. package/lib/internal/template/internal/widget-exports.d.ts.map +1 -1
  64. package/lib/internal/template/internal/widget-exports.js +2 -0
  65. package/lib/internal/template/internal/widget-exports.js.map +1 -1
  66. package/package.json +1 -1
  67. package/lib/internal/template/i18n/get-matchable-locales.d.ts +0 -2
  68. package/lib/internal/template/i18n/get-matchable-locales.d.ts.map +0 -1
  69. package/lib/internal/template/i18n/get-matchable-locales.js +0 -14
  70. package/lib/internal/template/i18n/get-matchable-locales.js.map +0 -1
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "7d1f3038e0e8f2335e644b5ee3873fee59cbca3c"
2
+ "commit": "41acf98edabd4c5afcb00bc56409cf4ee688064d"
3
3
  }
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Build environment
3
- $awsui-commit-hash: "7d1f3038";
3
+ $awsui-commit-hash: "41acf98e";
4
4
  // Manually managed CSS-variables
5
5
  $maxContentWidth: --awsui-max-content-width-n6lfw8;
6
6
  $minContentWidth: --awsui-min-content-width-n6lfw8;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app-layout/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,QAAA,MAAM,SAAS,2FAwGd,CAAC;AAGF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app-layout/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAK9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,QAAA,MAAM,SAAS,2FA4Fd,CAAC;AAGF,eAAe,SAAS,CAAC"}
@@ -3,7 +3,6 @@
3
3
  'use client';
4
4
  import React from 'react';
5
5
  import { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';
6
- import { useInternalI18n } from '../i18n/context';
7
6
  import { getBaseProps } from '../internal/base-component';
8
7
  import useBaseComponent from '../internal/hooks/use-base-component';
9
8
  import { useControllable } from '../internal/hooks/use-controllable';
@@ -14,8 +13,9 @@ import { applyDisplayName } from '../internal/utils/apply-display-name';
14
13
  import { applyDefaults } from './defaults';
15
14
  import { AppLayoutInternal } from './internal';
16
15
  import { useAppLayoutPlacement } from './utils/use-app-layout-placement';
16
+ import { useAriaLabels } from './utils/use-aria-labels';
17
17
  const AppLayout = React.forwardRef(({ contentType = 'default', headerSelector = '#b #h', footerSelector = '#b #f', navigationWidth = 280, toolsWidth = 290, maxContentWidth, minContentWidth, navigationOpen: controlledNavigationOpen, onNavigationChange: controlledOnNavigationChange, analyticsMetadata, ...rest }, ref) => {
18
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
18
+ var _a, _b;
19
19
  if (isDevelopment) {
20
20
  if (rest.toolsOpen && rest.toolsHide) {
21
21
  warnOnce('AppLayout', `You have enabled both the \`toolsOpen\` prop and the \`toolsHide\` prop. This is not supported. Set \`toolsOpen\` to \`false\` when you set \`toolsHide\` to \`true\`.`);
@@ -42,19 +42,7 @@ const AppLayout = React.forwardRef(({ contentType = 'default', headerSelector =
42
42
  }, analyticsMetadata);
43
43
  const isRefresh = useVisualRefresh();
44
44
  const isMobile = useMobile();
45
- const i18n = useInternalI18n('app-layout');
46
- const ariaLabels = {
47
- navigation: i18n('ariaLabels.navigation', (_c = rest.ariaLabels) === null || _c === void 0 ? void 0 : _c.navigation),
48
- navigationClose: i18n('ariaLabels.navigationClose', (_d = rest.ariaLabels) === null || _d === void 0 ? void 0 : _d.navigationClose),
49
- navigationToggle: i18n('ariaLabels.navigationToggle', (_e = rest.ariaLabels) === null || _e === void 0 ? void 0 : _e.navigationToggle),
50
- notifications: i18n('ariaLabels.notifications', (_f = rest.ariaLabels) === null || _f === void 0 ? void 0 : _f.notifications),
51
- tools: i18n('ariaLabels.tools', (_g = rest.ariaLabels) === null || _g === void 0 ? void 0 : _g.tools),
52
- toolsClose: i18n('ariaLabels.toolsClose', (_h = rest.ariaLabels) === null || _h === void 0 ? void 0 : _h.toolsClose),
53
- toolsToggle: i18n('ariaLabels.toolsToggle', (_j = rest.ariaLabels) === null || _j === void 0 ? void 0 : _j.toolsToggle),
54
- drawers: i18n('ariaLabels.drawers', (_k = rest.ariaLabels) === null || _k === void 0 ? void 0 : _k.drawers),
55
- drawersOverflow: i18n('ariaLabels.drawersOverflow', (_l = rest.ariaLabels) === null || _l === void 0 ? void 0 : _l.drawersOverflow),
56
- drawersOverflowWithBadge: i18n('ariaLabels.drawersOverflowWithBadge', (_m = rest.ariaLabels) === null || _m === void 0 ? void 0 : _m.drawersOverflowWithBadge),
57
- };
45
+ const ariaLabels = useAriaLabels(rest.ariaLabels);
58
46
  const { navigationOpen: defaultNavigationOpen, ...restDefaults } = applyDefaults(contentType, { maxContentWidth, minContentWidth }, isRefresh);
59
47
  const [navigationOpen = false, setNavigationOpen] = useControllable(controlledNavigationOpen, controlledOnNavigationChange, isMobile ? false : defaultNavigationOpen, { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' });
60
48
  const onNavigationChange = (event) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app-layout/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,eA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AAG,KAAM,KAAK,GAAI,CACtC,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AACzC,eAAe,SAAS,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { NonCancelableCustomEvent } from '../internal/events';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { isDevelopment } from '../internal/is-development';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { applyDefaults } from './defaults';\nimport { AppLayoutProps } from './interfaces';\nimport { AppLayoutInternal } from './internal';\nimport { useAppLayoutPlacement } from './utils/use-app-layout-placement';\n\nexport { AppLayoutProps };\n\nconst AppLayout = React.forwardRef(\n (\n {\n contentType = 'default',\n headerSelector = '#b #h',\n footerSelector = '#b #f',\n navigationWidth = 280,\n toolsWidth = 290,\n maxContentWidth,\n minContentWidth,\n navigationOpen: controlledNavigationOpen,\n onNavigationChange: controlledOnNavigationChange,\n analyticsMetadata,\n ...rest\n }: AppLayoutProps,\n ref: React.Ref<AppLayoutProps.Ref>\n ) => {\n if (isDevelopment) {\n if (rest.toolsOpen && rest.toolsHide) {\n warnOnce(\n 'AppLayout',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n const { __internalRootRef } = useBaseComponent(\n 'AppLayout',\n {\n props: {\n contentType,\n disableContentPaddings: rest.disableContentPaddings,\n disableBodyScroll: rest.disableBodyScroll,\n navigationWidth,\n navigationHide: rest.navigationHide,\n toolsHide: rest.toolsHide,\n toolsWidth,\n maxContentWidth,\n minContentWidth,\n stickyNotifications: rest.stickyNotifications,\n disableContentHeaderOverlap: rest.disableContentHeaderOverlap,\n },\n metadata: {\n drawersCount: rest.drawers?.length ?? null,\n hasContentHeader: !!rest.contentHeader,\n },\n },\n analyticsMetadata\n );\n const isRefresh = useVisualRefresh();\n const isMobile = useMobile();\n\n const i18n = useInternalI18n('app-layout');\n const ariaLabels = {\n navigation: i18n('ariaLabels.navigation', rest.ariaLabels?.navigation),\n navigationClose: i18n('ariaLabels.navigationClose', rest.ariaLabels?.navigationClose),\n navigationToggle: i18n('ariaLabels.navigationToggle', rest.ariaLabels?.navigationToggle),\n notifications: i18n('ariaLabels.notifications', rest.ariaLabels?.notifications),\n tools: i18n('ariaLabels.tools', rest.ariaLabels?.tools),\n toolsClose: i18n('ariaLabels.toolsClose', rest.ariaLabels?.toolsClose),\n toolsToggle: i18n('ariaLabels.toolsToggle', rest.ariaLabels?.toolsToggle),\n drawers: i18n('ariaLabels.drawers', rest.ariaLabels?.drawers),\n drawersOverflow: i18n('ariaLabels.drawersOverflow', rest.ariaLabels?.drawersOverflow),\n drawersOverflowWithBadge: i18n('ariaLabels.drawersOverflowWithBadge', rest.ariaLabels?.drawersOverflowWithBadge),\n };\n const { navigationOpen: defaultNavigationOpen, ...restDefaults } = applyDefaults(\n contentType,\n { maxContentWidth, minContentWidth },\n isRefresh\n );\n\n const [navigationOpen = false, setNavigationOpen] = useControllable(\n controlledNavigationOpen,\n controlledOnNavigationChange,\n isMobile ? false : defaultNavigationOpen,\n { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n const onNavigationChange = (event: NonCancelableCustomEvent<AppLayoutProps.ChangeDetail>) => {\n setNavigationOpen(event.detail.open);\n controlledOnNavigationChange?.(event);\n };\n\n const [rootRef, placement] = useAppLayoutPlacement(headerSelector, footerSelector);\n\n // This re-builds the props including the default values\n const props = {\n contentType,\n navigationWidth,\n toolsWidth,\n navigationOpen,\n onNavigationChange,\n ...restDefaults,\n ...rest,\n ariaLabels,\n placement,\n };\n\n const baseProps = getBaseProps(rest);\n\n return (\n <div ref={useMergeRefs(__internalRootRef, rootRef)} {...baseProps}>\n <AppLayoutInternal ref={ref} {...props} />\n </div>\n );\n }\n);\n\napplyDisplayName(AppLayout, 'AppLayout');\nexport default AppLayout;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app-layout/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAIxD,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAChC,CACE,EACE,WAAW,GAAG,SAAS,EACvB,cAAc,GAAG,OAAO,EACxB,cAAc,GAAG,OAAO,EACxB,eAAe,GAAG,GAAG,EACrB,UAAU,GAAG,GAAG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Ae,CACjE,wBAAwB,EACxB,4BAA4B,EAC5B,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,qBAAqB,EACxC,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,oBAAoB,EAAE,CACtG,CAAC;IACF,MAAM,kBAAkB,GAAG,CAAC,KAA4D,EAAE,EAAE;QAC1F,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACrC,4BAA4B,aAA5B,4BAA4B,uBAA5B,4BAA4B,CAAG,KAAK,CAAC,CAAC;IACxC,CAAC,CAAC;IAEF,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,qBAAqB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IAEnF,wDAAwD;IACxD,MAAM,KAAK,GAAG;QACZ,WAAW;QACX,eAAe;QACf,UAAU;QACV,cAAc;QACd,kBAAkB;QAClB,GAAG,YAAY;QACf,GAAG,IAAI;QACP,UAAU;QACV,SAAS;KACV,CAAC;IAEF,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAErC,OAAO,CACL,6BAAK,GAAG,EAAE,YAAY,CAAC,iBAAiB,EAAE,OAAO,CAAC,KAAM,SAAS;QAC/D,oBAAC,iBAAiB,IAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAI,CACtC,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AACzC,eAAe,SAAS,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { NonCancelableCustomEvent } from '../internal/events';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { isDevelopment } from '../internal/is-development';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { applyDefaults } from './defaults';\nimport { AppLayoutProps } from './interfaces';\nimport { AppLayoutInternal } from './internal';\nimport { useAppLayoutPlacement } from './utils/use-app-layout-placement';\nimport { useAriaLabels } from './utils/use-aria-labels';\n\nexport { AppLayoutProps };\n\nconst AppLayout = React.forwardRef(\n (\n {\n contentType = 'default',\n headerSelector = '#b #h',\n footerSelector = '#b #f',\n navigationWidth = 280,\n toolsWidth = 290,\n maxContentWidth,\n minContentWidth,\n navigationOpen: controlledNavigationOpen,\n onNavigationChange: controlledOnNavigationChange,\n analyticsMetadata,\n ...rest\n }: AppLayoutProps,\n ref: React.Ref<AppLayoutProps.Ref>\n ) => {\n if (isDevelopment) {\n if (rest.toolsOpen && rest.toolsHide) {\n warnOnce(\n 'AppLayout',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n const { __internalRootRef } = useBaseComponent(\n 'AppLayout',\n {\n props: {\n contentType,\n disableContentPaddings: rest.disableContentPaddings,\n disableBodyScroll: rest.disableBodyScroll,\n navigationWidth,\n navigationHide: rest.navigationHide,\n toolsHide: rest.toolsHide,\n toolsWidth,\n maxContentWidth,\n minContentWidth,\n stickyNotifications: rest.stickyNotifications,\n disableContentHeaderOverlap: rest.disableContentHeaderOverlap,\n },\n metadata: {\n drawersCount: rest.drawers?.length ?? null,\n hasContentHeader: !!rest.contentHeader,\n },\n },\n analyticsMetadata\n );\n const isRefresh = useVisualRefresh();\n const isMobile = useMobile();\n\n const ariaLabels = useAriaLabels(rest.ariaLabels);\n const { navigationOpen: defaultNavigationOpen, ...restDefaults } = applyDefaults(\n contentType,\n { maxContentWidth, minContentWidth },\n isRefresh\n );\n\n const [navigationOpen = false, setNavigationOpen] = useControllable(\n controlledNavigationOpen,\n controlledOnNavigationChange,\n isMobile ? false : defaultNavigationOpen,\n { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n const onNavigationChange = (event: NonCancelableCustomEvent<AppLayoutProps.ChangeDetail>) => {\n setNavigationOpen(event.detail.open);\n controlledOnNavigationChange?.(event);\n };\n\n const [rootRef, placement] = useAppLayoutPlacement(headerSelector, footerSelector);\n\n // This re-builds the props including the default values\n const props = {\n contentType,\n navigationWidth,\n toolsWidth,\n navigationOpen,\n onNavigationChange,\n ...restDefaults,\n ...rest,\n ariaLabels,\n placement,\n };\n\n const baseProps = getBaseProps(rest);\n\n return (\n <div ref={useMergeRefs(__internalRootRef, rootRef)} {...baseProps}>\n <AppLayoutInternal ref={ref} {...props} />\n </div>\n );\n }\n);\n\napplyDisplayName(AppLayout, 'AppLayout');\nexport default AppLayout;\n"]}
@@ -0,0 +1,3 @@
1
+ import { AppLayoutProps } from '../interfaces';
2
+ export declare function useAriaLabels(ariaLabelsOverride: AppLayoutProps.Labels | undefined): AppLayoutProps.Labels;
3
+ //# sourceMappingURL=use-aria-labels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-aria-labels.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-aria-labels.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,wBAAgB,aAAa,CAAC,kBAAkB,EAAE,cAAc,CAAC,MAAM,GAAG,SAAS,GAAG,cAAc,CAAC,MAAM,CAc1G"}
@@ -0,0 +1,19 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { useInternalI18n } from '../../i18n/context';
4
+ export function useAriaLabels(ariaLabelsOverride) {
5
+ const i18n = useInternalI18n('app-layout');
6
+ return {
7
+ navigation: i18n('ariaLabels.navigation', ariaLabelsOverride === null || ariaLabelsOverride === void 0 ? void 0 : ariaLabelsOverride.navigation),
8
+ navigationClose: i18n('ariaLabels.navigationClose', ariaLabelsOverride === null || ariaLabelsOverride === void 0 ? void 0 : ariaLabelsOverride.navigationClose),
9
+ navigationToggle: i18n('ariaLabels.navigationToggle', ariaLabelsOverride === null || ariaLabelsOverride === void 0 ? void 0 : ariaLabelsOverride.navigationToggle),
10
+ notifications: i18n('ariaLabels.notifications', ariaLabelsOverride === null || ariaLabelsOverride === void 0 ? void 0 : ariaLabelsOverride.notifications),
11
+ tools: i18n('ariaLabels.tools', ariaLabelsOverride === null || ariaLabelsOverride === void 0 ? void 0 : ariaLabelsOverride.tools),
12
+ toolsClose: i18n('ariaLabels.toolsClose', ariaLabelsOverride === null || ariaLabelsOverride === void 0 ? void 0 : ariaLabelsOverride.toolsClose),
13
+ toolsToggle: i18n('ariaLabels.toolsToggle', ariaLabelsOverride === null || ariaLabelsOverride === void 0 ? void 0 : ariaLabelsOverride.toolsToggle),
14
+ drawers: i18n('ariaLabels.drawers', ariaLabelsOverride === null || ariaLabelsOverride === void 0 ? void 0 : ariaLabelsOverride.drawers),
15
+ drawersOverflow: i18n('ariaLabels.drawersOverflow', ariaLabelsOverride === null || ariaLabelsOverride === void 0 ? void 0 : ariaLabelsOverride.drawersOverflow),
16
+ drawersOverflowWithBadge: i18n('ariaLabels.drawersOverflowWithBadge', ariaLabelsOverride === null || ariaLabelsOverride === void 0 ? void 0 : ariaLabelsOverride.drawersOverflowWithBadge),
17
+ };
18
+ }
19
+ //# sourceMappingURL=use-aria-labels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-aria-labels.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-aria-labels.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,MAAM,UAAU,aAAa,CAAC,kBAAqD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from '../../i18n/context';\nimport { AppLayoutProps } from '../interfaces';\n\nexport function useAriaLabels(ariaLabelsOverride: AppLayoutProps.Labels | undefined): AppLayoutProps.Labels {\n const i18n = useInternalI18n('app-layout');\n return {\n navigation: i18n('ariaLabels.navigation', ariaLabelsOverride?.navigation),\n navigationClose: i18n('ariaLabels.navigationClose', ariaLabelsOverride?.navigationClose),\n navigationToggle: i18n('ariaLabels.navigationToggle', ariaLabelsOverride?.navigationToggle),\n notifications: i18n('ariaLabels.notifications', ariaLabelsOverride?.notifications),\n tools: i18n('ariaLabels.tools', ariaLabelsOverride?.tools),\n toolsClose: i18n('ariaLabels.toolsClose', ariaLabelsOverride?.toolsClose),\n toolsToggle: i18n('ariaLabels.toolsToggle', ariaLabelsOverride?.toolsToggle),\n drawers: i18n('ariaLabels.drawers', ariaLabelsOverride?.drawers),\n drawersOverflow: i18n('ariaLabels.drawersOverflow', ariaLabelsOverride?.drawersOverflow),\n drawersOverflowWithBadge: i18n('ariaLabels.drawersOverflowWithBadge', ariaLabelsOverride?.drawersOverflowWithBadge),\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAK5E,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAyB,MAAM,cAAc,CAAC;AAsD7E,QAAA,MAAM,6BAA6B,mGAkClC,CAAC;AAEF,eAAe,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAM5E,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAyB,MAAM,cAAc,CAAC;AAsD7E,QAAA,MAAM,6BAA6B,mGAclC,CAAC;AAmDF,eAAe,6BAA6B,CAAC"}
@@ -3,9 +3,11 @@
3
3
  import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
4
4
  import { unstable_batchedUpdates } from 'react-dom';
5
5
  import { AppLayoutBuiltInErrorBoundary } from '../../error-boundary/internal';
6
+ import RemoteI18nProvider from '../../i18n/providers/remote-provider';
6
7
  import ScreenreaderOnly from '../../internal/components/screenreader-only';
8
+ import { useAriaLabels } from '../utils/use-aria-labels';
7
9
  import { AppLayoutVisibilityContext } from './contexts';
8
- import { AppLayoutWidgetizedState } from './internal';
10
+ import { AppLayoutWidgetizedState, loadFormatter } from './internal';
9
11
  import { SkeletonLayout } from './skeleton';
10
12
  import { useMultiAppLayout } from './skeleton/multi-layout';
11
13
  import { getPropsToMerge, mergeProps } from './state/props-merger';
@@ -35,14 +37,20 @@ const AppLayoutStateProvider = ({ forceDeduplicationType, appLayoutProps, stateM
35
37
  return React.createElement(React.Fragment, null, children(registered, appLayoutState, toolbarProps, skeletonAttributes));
36
38
  };
37
39
  const AppLayoutVisualRefreshToolbar = React.forwardRef((props, forwardRef) => {
38
- const stateManager = useRef({ setState: undefined, hasToolbar: false, setToolbar: undefined });
39
- const { __forceDeduplicationType: forceDeduplicationType, __embeddedViewMode: embeddedViewMode } = props;
40
- return (React.createElement(React.Fragment, null,
41
- React.createElement(AppLayoutStateProvider, { forceDeduplicationType: forceDeduplicationType, appLayoutProps: props, stateManager: stateManager }, (registered, appLayoutState, toolbarProps, skeletonAttributes) => (React.createElement(AppLayoutVisibilityContext.Provider, { value: appLayoutState.isIntersecting },
42
- (embeddedViewMode || !toolbarProps) && props.breadcrumbs ? (React.createElement(AppLayoutBuiltInErrorBoundary, null,
43
- React.createElement(ScreenreaderOnly, null, props.breadcrumbs))) : null,
44
- React.createElement(SkeletonLayout, { registered: registered, toolbarProps: toolbarProps, appLayoutProps: props, appLayoutState: appLayoutState, skeletonSlotsAttributes: skeletonAttributes })))),
45
- React.createElement(AppLayoutWidgetizedState, { forwardRef: forwardRef, appLayoutProps: props, stateManager: stateManager })));
40
+ const stateManagerRef = useRef({ setState: undefined, hasToolbar: false, setToolbar: undefined });
41
+ return (React.createElement(RemoteI18nProvider, { loadFormatter: loadFormatter },
42
+ React.createElement(AppLayoutVisualRefreshToolbarWithI18n, { appLayoutRef: forwardRef, stateManagerRef: stateManagerRef, appLayoutProps: props })));
46
43
  });
44
+ function AppLayoutVisualRefreshToolbarWithI18n({ appLayoutRef, stateManagerRef, appLayoutProps, }) {
45
+ const { __forceDeduplicationType: forceDeduplicationType, __embeddedViewMode: embeddedViewMode } = appLayoutProps;
46
+ const ariaLabels = useAriaLabels(appLayoutProps.ariaLabels);
47
+ const appLayoutPropsWithI18n = { ...appLayoutProps, ariaLabels };
48
+ return (React.createElement(React.Fragment, null,
49
+ React.createElement(AppLayoutStateProvider, { forceDeduplicationType: forceDeduplicationType, appLayoutProps: appLayoutPropsWithI18n, stateManager: stateManagerRef }, (registered, appLayoutState, toolbarProps, skeletonAttributes) => (React.createElement(AppLayoutVisibilityContext.Provider, { value: appLayoutState.isIntersecting },
50
+ (embeddedViewMode || !toolbarProps) && appLayoutPropsWithI18n.breadcrumbs ? (React.createElement(AppLayoutBuiltInErrorBoundary, null,
51
+ React.createElement(ScreenreaderOnly, null, appLayoutPropsWithI18n.breadcrumbs))) : null,
52
+ React.createElement(SkeletonLayout, { registered: registered, toolbarProps: toolbarProps, appLayoutProps: appLayoutPropsWithI18n, appLayoutState: appLayoutState, skeletonSlotsAttributes: skeletonAttributes })))),
53
+ React.createElement(AppLayoutWidgetizedState, { forwardRef: appLayoutRef, appLayoutProps: appLayoutPropsWithI18n, stateManager: stateManagerRef })));
54
+ }
47
55
  export default AppLayoutVisualRefreshToolbar;
48
56
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/index.tsx"],"names":[],"mappings":"AA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E,sBAAsB,EAC9C,cAAc,EAAE,KAAK,EACrB,YAAY,EAAE,YAAY,IAEzB,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,kBAAkB,EAAE,EAAE,CAAC,CACjE,oBAAC,0BAA0B,CAAC,QAAQ,IAAC,KAAK,EAAE,cAAc,CAAC,cAAc;YAEtE,CAAC,gBAAgB,IAAI,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAC1D,oBAAC,6BAA6B;gBAC5B,oBAAC,gBAAgB,QAAE,KAAK,CAAC,WAAW,CAAoB,CAC1B,CACjC,CAAC,CAAC,CAAC,IAAI;YACR,oBAAC,cAAc,IACb,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,KAAK,EACrB,cAAc,EAAE,cAAc,EAC9B,uBAAuB,EAAE,kBAAkB,GAC3C,CACkC,CACvC,CACsB;QACzB,oBAAC,wBAAwB,IAAC,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,GAAI,CACtG,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,6BAA6B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { unstable_batchedUpdates } from 'react-dom';\n\nimport { AppLayoutBuiltInErrorBoundary } from '../../error-boundary/internal';\nimport ScreenreaderOnly from '../../internal/components/screenreader-only';\nimport { AppLayoutProps } from '../interfaces';\nimport { AppLayoutVisibilityContext } from './contexts';\nimport { AppLayoutInternalProps, AppLayoutPendingState } from './interfaces';\nimport { AppLayoutWidgetizedState } from './internal';\nimport { SkeletonLayout } from './skeleton';\nimport { SkeletonSlotsAttributes } from './skeleton/interfaces';\nimport { DeduplicationType, useMultiAppLayout } from './skeleton/multi-layout';\nimport { StateManager } from './state';\nimport { SharedProps } from './state/interfaces';\nimport { getPropsToMerge, mergeProps } from './state/props-merger';\nimport { ToolbarProps } from './toolbar';\n\nconst AppLayoutStateProvider: React.FC<{\n forceDeduplicationType: DeduplicationType;\n appLayoutProps: AppLayoutInternalProps;\n stateManager: React.MutableRefObject<StateManager>;\n children: (\n registered: boolean,\n appLayoutState: AppLayoutPendingState,\n toolbarProps: ToolbarProps | null,\n skeletonAttributes: SkeletonSlotsAttributes\n ) => React.ReactNode;\n}> = ({ forceDeduplicationType, appLayoutProps, stateManager, children }) => {\n const [appLayoutState, setAppLayoutState] = useState<AppLayoutPendingState>({ isIntersecting: true });\n const [skeletonAttributes, setSkeletonAttributes] = useState<SkeletonSlotsAttributes>({});\n // use { fn: } object wrapper to avoid confusion with callback form of setState\n const [deduplicator, setDeduplicator] = useState({ fn: mergeProps });\n const [deduplicationProps, setDeduplicationProps] = useState<SharedProps | undefined>(undefined);\n\n const { registered, toolbarProps } = useMultiAppLayout(\n forceDeduplicationType,\n appLayoutState.isIntersecting,\n deduplicationProps ?? getPropsToMerge(appLayoutProps, appLayoutState),\n deduplicator.fn\n );\n\n useLayoutEffect(() => {\n stateManager.current.setState = (appLayoutState, skeletonAttributes, deduplicationProps, mergeProps) => {\n unstable_batchedUpdates(() => {\n setAppLayoutState(appLayoutState);\n setSkeletonAttributes(skeletonAttributes);\n setDeduplicationProps(deduplicationProps);\n setDeduplicator({ fn: mergeProps });\n });\n };\n }, [stateManager]);\n\n const hasToolbar = !!toolbarProps;\n useEffect(() => {\n stateManager.current.hasToolbar = hasToolbar;\n stateManager.current.setToolbar?.(hasToolbar);\n }, [stateManager, hasToolbar]);\n\n return <>{children(registered, appLayoutState, toolbarProps, skeletonAttributes)}</>;\n};\n\nconst AppLayoutVisualRefreshToolbar = React.forwardRef<AppLayoutProps.Ref, AppLayoutInternalProps>(\n (props, forwardRef) => {\n const stateManager = useRef<StateManager>({ setState: undefined, hasToolbar: false, setToolbar: undefined });\n const { __forceDeduplicationType: forceDeduplicationType, __embeddedViewMode: embeddedViewMode } = props as any;\n\n return (\n <>\n <AppLayoutStateProvider\n forceDeduplicationType={forceDeduplicationType}\n appLayoutProps={props}\n stateManager={stateManager}\n >\n {(registered, appLayoutState, toolbarProps, skeletonAttributes) => (\n <AppLayoutVisibilityContext.Provider value={appLayoutState.isIntersecting}>\n {/* Rendering a hidden copy of breadcrumbs to trigger their deduplication */}\n {(embeddedViewMode || !toolbarProps) && props.breadcrumbs ? (\n <AppLayoutBuiltInErrorBoundary>\n <ScreenreaderOnly>{props.breadcrumbs}</ScreenreaderOnly>\n </AppLayoutBuiltInErrorBoundary>\n ) : null}\n <SkeletonLayout\n registered={registered}\n toolbarProps={toolbarProps}\n appLayoutProps={props}\n appLayoutState={appLayoutState}\n skeletonSlotsAttributes={skeletonAttributes}\n />\n </AppLayoutVisibilityContext.Provider>\n )}\n </AppLayoutStateProvider>\n <AppLayoutWidgetizedState forwardRef={forwardRef} appLayoutProps={props} stateManager={stateManager} />\n </>\n );\n }\n);\n\nexport default AppLayoutVisualRefreshToolbar;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,kBAAkB,MAAM,sCAAsC,CAAC;AACtE,OAAO,gBAAgB,MAAM,6CAA6C,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACrE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BAAsB,IACrB,sBAAsB,EAAE,sBAAsB,EAC9C,cAAc,EAAE,sBAAsB,EACtC,YAAY,EAAE,eAAe,IAE5B,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,kBAAkB,EAAE,EAAE,CAAC,CACjE,oBAAC,0BAA0B,CAAC,QAAQ,IAAC,KAAK,EAAE,cAAc,CAAC,cAAc;YAEtE,CAAC,gBAAgB,IAAI,CAAC,YAAY,CAAC,IAAI,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC,CAC3E,oBAAC,6BAA6B;gBAC5B,oBAAC,gBAAgB,QAAE,sBAAsB,CAAC,WAAW,CAAoB,CAC3C,CACjC,CAAC,CAAC,CAAC,IAAI;YACR,oBAAC,cAAc,IACb,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,sBAAsB,EACtC,cAAc,EAAE,cAAc,EAC9B,uBAAuB,EAAE,kBAAkB,GAC3C,CACkC,CACvC,CACsB;QACzB,oBAAC,wBAAwB,IACvB,UAAU,EAAE,YAAY,EACxB,cAAc,EAAE,sBAAsB,EACtC,YAAY,EAAE,eAAe,GAC7B,CACD,CACJ,CAAC;AACJ,CAAC;AAED,eAAe,6BAA6B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { unstable_batchedUpdates } from 'react-dom';\n\nimport { AppLayoutBuiltInErrorBoundary } from '../../error-boundary/internal';\nimport RemoteI18nProvider from '../../i18n/providers/remote-provider';\nimport ScreenreaderOnly from '../../internal/components/screenreader-only';\nimport { AppLayoutProps } from '../interfaces';\nimport { useAriaLabels } from '../utils/use-aria-labels';\nimport { AppLayoutVisibilityContext } from './contexts';\nimport { AppLayoutInternalProps, AppLayoutPendingState } from './interfaces';\nimport { AppLayoutWidgetizedState, loadFormatter } from './internal';\nimport { SkeletonLayout } from './skeleton';\nimport { SkeletonSlotsAttributes } from './skeleton/interfaces';\nimport { DeduplicationType, useMultiAppLayout } from './skeleton/multi-layout';\nimport { StateManager } from './state';\nimport { SharedProps } from './state/interfaces';\nimport { getPropsToMerge, mergeProps } from './state/props-merger';\nimport { ToolbarProps } from './toolbar';\n\nconst AppLayoutStateProvider: React.FC<{\n forceDeduplicationType: DeduplicationType;\n appLayoutProps: AppLayoutInternalProps;\n stateManager: React.MutableRefObject<StateManager>;\n children: (\n registered: boolean,\n appLayoutState: AppLayoutPendingState,\n toolbarProps: ToolbarProps | null,\n skeletonAttributes: SkeletonSlotsAttributes\n ) => React.ReactNode;\n}> = ({ forceDeduplicationType, appLayoutProps, stateManager, children }) => {\n const [appLayoutState, setAppLayoutState] = useState<AppLayoutPendingState>({ isIntersecting: true });\n const [skeletonAttributes, setSkeletonAttributes] = useState<SkeletonSlotsAttributes>({});\n // use { fn: } object wrapper to avoid confusion with callback form of setState\n const [deduplicator, setDeduplicator] = useState({ fn: mergeProps });\n const [deduplicationProps, setDeduplicationProps] = useState<SharedProps | undefined>(undefined);\n\n const { registered, toolbarProps } = useMultiAppLayout(\n forceDeduplicationType,\n appLayoutState.isIntersecting,\n deduplicationProps ?? getPropsToMerge(appLayoutProps, appLayoutState),\n deduplicator.fn\n );\n\n useLayoutEffect(() => {\n stateManager.current.setState = (appLayoutState, skeletonAttributes, deduplicationProps, mergeProps) => {\n unstable_batchedUpdates(() => {\n setAppLayoutState(appLayoutState);\n setSkeletonAttributes(skeletonAttributes);\n setDeduplicationProps(deduplicationProps);\n setDeduplicator({ fn: mergeProps });\n });\n };\n }, [stateManager]);\n\n const hasToolbar = !!toolbarProps;\n useEffect(() => {\n stateManager.current.hasToolbar = hasToolbar;\n stateManager.current.setToolbar?.(hasToolbar);\n }, [stateManager, hasToolbar]);\n\n return <>{children(registered, appLayoutState, toolbarProps, skeletonAttributes)}</>;\n};\n\nconst AppLayoutVisualRefreshToolbar = React.forwardRef<AppLayoutProps.Ref, AppLayoutInternalProps>(\n (props, forwardRef) => {\n const stateManagerRef = useRef<StateManager>({ setState: undefined, hasToolbar: false, setToolbar: undefined });\n\n return (\n <RemoteI18nProvider loadFormatter={loadFormatter}>\n <AppLayoutVisualRefreshToolbarWithI18n\n appLayoutRef={forwardRef}\n stateManagerRef={stateManagerRef}\n appLayoutProps={props}\n />\n </RemoteI18nProvider>\n );\n }\n);\n\nfunction AppLayoutVisualRefreshToolbarWithI18n({\n appLayoutRef,\n stateManagerRef,\n appLayoutProps,\n}: {\n appLayoutRef: React.ForwardedRef<AppLayoutProps.Ref>;\n stateManagerRef: React.MutableRefObject<StateManager>;\n appLayoutProps: AppLayoutInternalProps;\n}) {\n const { __forceDeduplicationType: forceDeduplicationType, __embeddedViewMode: embeddedViewMode } =\n appLayoutProps as any;\n\n const ariaLabels = useAriaLabels(appLayoutProps.ariaLabels);\n const appLayoutPropsWithI18n = { ...appLayoutProps, ariaLabels };\n\n return (\n <>\n <AppLayoutStateProvider\n forceDeduplicationType={forceDeduplicationType}\n appLayoutProps={appLayoutPropsWithI18n}\n stateManager={stateManagerRef}\n >\n {(registered, appLayoutState, toolbarProps, skeletonAttributes) => (\n <AppLayoutVisibilityContext.Provider value={appLayoutState.isIntersecting}>\n {/* Rendering a hidden copy of breadcrumbs to trigger their deduplication */}\n {(embeddedViewMode || !toolbarProps) && appLayoutPropsWithI18n.breadcrumbs ? (\n <AppLayoutBuiltInErrorBoundary>\n <ScreenreaderOnly>{appLayoutPropsWithI18n.breadcrumbs}</ScreenreaderOnly>\n </AppLayoutBuiltInErrorBoundary>\n ) : null}\n <SkeletonLayout\n registered={registered}\n toolbarProps={toolbarProps}\n appLayoutProps={appLayoutPropsWithI18n}\n appLayoutState={appLayoutState}\n skeletonSlotsAttributes={skeletonAttributes}\n />\n </AppLayoutVisibilityContext.Provider>\n )}\n </AppLayoutStateProvider>\n <AppLayoutWidgetizedState\n forwardRef={appLayoutRef}\n appLayoutProps={appLayoutPropsWithI18n}\n stateManager={stateManagerRef}\n />\n </>\n );\n}\n\nexport default AppLayoutVisualRefreshToolbar;\n"]}
@@ -3,4 +3,5 @@ export declare const AppLayoutAfterMainSlot: (props: import("./skeleton/interfac
3
3
  export declare const AppLayoutTopContentSlot: (props: import("./skeleton/interfaces").SkeletonPartProps) => JSX.Element;
4
4
  export declare const AppLayoutBottomContentSlot: (props: import("./skeleton/interfaces").SkeletonPartProps) => JSX.Element;
5
5
  export declare const AppLayoutWidgetizedState: (props: import("./state").AppLayoutStateProps) => JSX.Element;
6
+ export declare const loadFormatter: () => Promise<null>;
6
7
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/internal.tsx"],"names":[],"mappings":"AAaA,eAAO,MAAM,uBAAuB,2EAEnC,CAAC;AACF,eAAO,MAAM,sBAAsB,2EAElC,CAAC;AACF,eAAO,MAAM,uBAAuB,2EAEnC,CAAC;AACF,eAAO,MAAM,0BAA0B,2EAEtC,CAAC;AACF,eAAO,MAAM,wBAAwB,+DAEpC,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/internal.tsx"],"names":[],"mappings":"AAaA,eAAO,MAAM,uBAAuB,2EAEnC,CAAC;AACF,eAAO,MAAM,sBAAsB,2EAElC,CAAC;AACF,eAAO,MAAM,uBAAuB,2EAEnC,CAAC;AACF,eAAO,MAAM,0BAA0B,2EAEtC,CAAC;AACF,eAAO,MAAM,wBAAwB,+DAEpC,CAAC;AACF,eAAO,MAAM,aAAa,qBAA8B,CAAC"}
@@ -11,4 +11,5 @@ export const AppLayoutAfterMainSlot = createWidgetizedAppLayoutAfterMainSlot(cre
11
11
  export const AppLayoutTopContentSlot = createWidgetizedAppLayoutTopContentSlot(createLoadableComponent(TopContentSlotImplementation));
12
12
  export const AppLayoutBottomContentSlot = createWidgetizedAppLayoutBottomContentSlot(createLoadableComponent(BottomContentSlotImplementation));
13
13
  export const AppLayoutWidgetizedState = createWidgetizedAppLayoutState(createLoadableComponent(AppLayoutStateImplementation));
14
+ export const loadFormatter = () => Promise.resolve(null);
14
15
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,IAAI,4BAA4B,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AACjH,OAAO,EAAE,2BAA2B,EAAE,sCAAsC,EAAE,MAAM,gCAAgC,CAAC;AACrH,OAAO,EAAE,4BAA4B,EAAE,uCAAuC,EAAE,MAAM,iCAAiC,CAAC;AACxH,OAAO,EACL,+BAA+B,EAC/B,0CAA0C,GAC3C,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,uCAAuC,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAExH,MAAM,CAAC,MAAM,uBAAuB,GAAG,uCAAuC,CAC5E,uBAAuB,CAAC,4BAA4B,CAAC,CACtD,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAG,sCAAsC,CAC1E,uBAAuB,CAAC,2BAA2B,CAAC,CACrD,CAAC;AACF,MAAM,CAAC,MAAM,uBAAuB,GAAG,uCAAuC,CAC5E,uBAAuB,CAAC,4BAA4B,CAAC,CACtD,CAAC;AACF,MAAM,CAAC,MAAM,0BAA0B,GAAG,0CAA0C,CAClF,uBAAuB,CAAC,+BAA+B,CAAC,CACzD,CAAC;AACF,MAAM,CAAC,MAAM,wBAAwB,GAAG,8BAA8B,CACpE,uBAAuB,CAAC,4BAA4B,CAAC,CACtD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { createLoadableComponent } from '../../internal/widgets/loader-mock';\nimport { AppLayoutStateProvider as AppLayoutStateImplementation, createWidgetizedAppLayoutState } from './state';\nimport { AfterMainSlotImplementation, createWidgetizedAppLayoutAfterMainSlot } from './widget-areas/after-main-slot';\nimport { BeforeMainSlotImplementation, createWidgetizedAppLayoutBeforeMainSlot } from './widget-areas/before-main-slot';\nimport {\n BottomContentSlotImplementation,\n createWidgetizedAppLayoutBottomContentSlot,\n} from './widget-areas/bottom-content-slot';\nimport { createWidgetizedAppLayoutTopContentSlot, TopContentSlotImplementation } from './widget-areas/top-content-slot';\n\nexport const AppLayoutBeforeMainSlot = createWidgetizedAppLayoutBeforeMainSlot(\n createLoadableComponent(BeforeMainSlotImplementation)\n);\nexport const AppLayoutAfterMainSlot = createWidgetizedAppLayoutAfterMainSlot(\n createLoadableComponent(AfterMainSlotImplementation)\n);\nexport const AppLayoutTopContentSlot = createWidgetizedAppLayoutTopContentSlot(\n createLoadableComponent(TopContentSlotImplementation)\n);\nexport const AppLayoutBottomContentSlot = createWidgetizedAppLayoutBottomContentSlot(\n createLoadableComponent(BottomContentSlotImplementation)\n);\nexport const AppLayoutWidgetizedState = createWidgetizedAppLayoutState(\n createLoadableComponent(AppLayoutStateImplementation)\n);\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,IAAI,4BAA4B,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AACjH,OAAO,EAAE,2BAA2B,EAAE,sCAAsC,EAAE,MAAM,gCAAgC,CAAC;AACrH,OAAO,EAAE,4BAA4B,EAAE,uCAAuC,EAAE,MAAM,iCAAiC,CAAC;AACxH,OAAO,EACL,+BAA+B,EAC/B,0CAA0C,GAC3C,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,uCAAuC,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAExH,MAAM,CAAC,MAAM,uBAAuB,GAAG,uCAAuC,CAC5E,uBAAuB,CAAC,4BAA4B,CAAC,CACtD,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAG,sCAAsC,CAC1E,uBAAuB,CAAC,2BAA2B,CAAC,CACrD,CAAC;AACF,MAAM,CAAC,MAAM,uBAAuB,GAAG,uCAAuC,CAC5E,uBAAuB,CAAC,4BAA4B,CAAC,CACtD,CAAC;AACF,MAAM,CAAC,MAAM,0BAA0B,GAAG,0CAA0C,CAClF,uBAAuB,CAAC,+BAA+B,CAAC,CACzD,CAAC;AACF,MAAM,CAAC,MAAM,wBAAwB,GAAG,8BAA8B,CACpE,uBAAuB,CAAC,4BAA4B,CAAC,CACtD,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { createLoadableComponent } from '../../internal/widgets/loader-mock';\nimport { AppLayoutStateProvider as AppLayoutStateImplementation, createWidgetizedAppLayoutState } from './state';\nimport { AfterMainSlotImplementation, createWidgetizedAppLayoutAfterMainSlot } from './widget-areas/after-main-slot';\nimport { BeforeMainSlotImplementation, createWidgetizedAppLayoutBeforeMainSlot } from './widget-areas/before-main-slot';\nimport {\n BottomContentSlotImplementation,\n createWidgetizedAppLayoutBottomContentSlot,\n} from './widget-areas/bottom-content-slot';\nimport { createWidgetizedAppLayoutTopContentSlot, TopContentSlotImplementation } from './widget-areas/top-content-slot';\n\nexport const AppLayoutBeforeMainSlot = createWidgetizedAppLayoutBeforeMainSlot(\n createLoadableComponent(BeforeMainSlotImplementation)\n);\nexport const AppLayoutAfterMainSlot = createWidgetizedAppLayoutAfterMainSlot(\n createLoadableComponent(AfterMainSlotImplementation)\n);\nexport const AppLayoutTopContentSlot = createWidgetizedAppLayoutTopContentSlot(\n createLoadableComponent(TopContentSlotImplementation)\n);\nexport const AppLayoutBottomContentSlot = createWidgetizedAppLayoutBottomContentSlot(\n createLoadableComponent(BottomContentSlotImplementation)\n);\nexport const AppLayoutWidgetizedState = createWidgetizedAppLayoutState(\n createLoadableComponent(AppLayoutStateImplementation)\n);\nexport const loadFormatter = () => Promise.resolve(null);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app-layout-toolbar/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAa1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,QAAA,MAAM,gBAAgB,kGA+GrB,CAAC;AAGF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app-layout-toolbar/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAY1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,QAAA,MAAM,gBAAgB,kGAiGrB,CAAC;AAGF,eAAe,gBAAgB,CAAC"}
@@ -7,7 +7,6 @@ import { applyDefaults } from '../app-layout/defaults';
7
7
  import { useAppLayoutPlacement } from '../app-layout/utils/use-app-layout-placement';
8
8
  import AppLayoutToolbarInternal from '../app-layout/visual-refresh-toolbar';
9
9
  import { AppLayoutToolbarPublicContext } from '../app-layout/visual-refresh-toolbar/contexts';
10
- import { useInternalI18n } from '../i18n/context';
11
10
  import { getBaseProps } from '../internal/base-component';
12
11
  import useBaseComponent from '../internal/hooks/use-base-component';
13
12
  import { useControllable } from '../internal/hooks/use-controllable';
@@ -16,7 +15,7 @@ import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
16
15
  import { isDevelopment } from '../internal/is-development';
17
16
  import { applyDisplayName } from '../internal/utils/apply-display-name';
18
17
  const AppLayoutToolbar = React.forwardRef(({ contentType = 'default', headerSelector = '#b #h', footerSelector = '#b #f', navigationWidth = 280, toolsWidth = 290, maxContentWidth, minContentWidth, navigationOpen: controlledNavigationOpen, onNavigationChange: controlledOnNavigationChange, analyticsMetadata, ...rest }, ref) => {
19
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
18
+ var _a, _b;
20
19
  const isRefresh = useVisualRefresh();
21
20
  if (!isRefresh) {
22
21
  throw new Error(`AppLayoutToolbar component is not supported in the Classic theme. Please switch to the Refresh theme. For more details, refer to the documentation.`);
@@ -46,19 +45,6 @@ const AppLayoutToolbar = React.forwardRef(({ contentType = 'default', headerSele
46
45
  },
47
46
  }, analyticsMetadata);
48
47
  const isMobile = useMobile();
49
- const i18n = useInternalI18n('app-layout');
50
- const ariaLabels = {
51
- navigation: i18n('ariaLabels.navigation', (_c = rest.ariaLabels) === null || _c === void 0 ? void 0 : _c.navigation),
52
- navigationClose: i18n('ariaLabels.navigationClose', (_d = rest.ariaLabels) === null || _d === void 0 ? void 0 : _d.navigationClose),
53
- navigationToggle: i18n('ariaLabels.navigationToggle', (_e = rest.ariaLabels) === null || _e === void 0 ? void 0 : _e.navigationToggle),
54
- notifications: i18n('ariaLabels.notifications', (_f = rest.ariaLabels) === null || _f === void 0 ? void 0 : _f.notifications),
55
- tools: i18n('ariaLabels.tools', (_g = rest.ariaLabels) === null || _g === void 0 ? void 0 : _g.tools),
56
- toolsClose: i18n('ariaLabels.toolsClose', (_h = rest.ariaLabels) === null || _h === void 0 ? void 0 : _h.toolsClose),
57
- toolsToggle: i18n('ariaLabels.toolsToggle', (_j = rest.ariaLabels) === null || _j === void 0 ? void 0 : _j.toolsToggle),
58
- drawers: i18n('ariaLabels.drawers', (_k = rest.ariaLabels) === null || _k === void 0 ? void 0 : _k.drawers),
59
- drawersOverflow: i18n('ariaLabels.drawersOverflow', (_l = rest.ariaLabels) === null || _l === void 0 ? void 0 : _l.drawersOverflow),
60
- drawersOverflowWithBadge: i18n('ariaLabels.drawersOverflowWithBadge', (_m = rest.ariaLabels) === null || _m === void 0 ? void 0 : _m.drawersOverflowWithBadge),
61
- };
62
48
  const { navigationOpen: defaultNavigationOpen, ...restDefaults } = applyDefaults(contentType, { maxContentWidth, minContentWidth }, isRefresh);
63
49
  const [navigationOpen = false, setNavigationOpen] = useControllable(controlledNavigationOpen, controlledOnNavigationChange, isMobile ? false : defaultNavigationOpen, { componentName: 'AppLayoutToolbar', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' });
64
50
  const onNavigationChange = (event) => {
@@ -75,7 +61,6 @@ const AppLayoutToolbar = React.forwardRef(({ contentType = 'default', headerSele
75
61
  onNavigationChange,
76
62
  ...restDefaults,
77
63
  ...rest,
78
- ariaLabels,
79
64
  placement,
80
65
  };
81
66
  const baseProps = getBaseProps(rest);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app-layout-toolbar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,wBAAwB,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EA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CACiC,CAC1C,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;AACvD,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { applyDefaults } from '../app-layout/defaults';\nimport { AppLayoutProps } from '../app-layout/interfaces';\nimport { useAppLayoutPlacement } from '../app-layout/utils/use-app-layout-placement';\nimport AppLayoutToolbarInternal from '../app-layout/visual-refresh-toolbar';\nimport { AppLayoutToolbarPublicContext } from '../app-layout/visual-refresh-toolbar/contexts';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { NonCancelableCustomEvent } from '../internal/events';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { isDevelopment } from '../internal/is-development';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { AppLayoutToolbarProps } from './interfaces';\n\nexport { AppLayoutToolbarProps };\n\nconst AppLayoutToolbar = React.forwardRef(\n (\n {\n contentType = 'default',\n headerSelector = '#b #h',\n footerSelector = '#b #f',\n navigationWidth = 280,\n toolsWidth = 290,\n maxContentWidth,\n minContentWidth,\n navigationOpen: controlledNavigationOpen,\n onNavigationChange: controlledOnNavigationChange,\n analyticsMetadata,\n ...rest\n }: AppLayoutToolbarProps,\n ref: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isRefresh = useVisualRefresh();\n if (!isRefresh) {\n throw new Error(\n `AppLayoutToolbar component is not supported in the Classic theme. Please switch to the Refresh theme. For more details, refer to the documentation.`\n );\n }\n if (isDevelopment) {\n if (rest.toolsOpen && rest.toolsHide) {\n warnOnce(\n 'AppLayoutToolbar',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n const { __internalRootRef } = useBaseComponent(\n 'AppLayoutToolbar',\n {\n props: {\n contentType,\n disableContentPaddings: rest.disableContentPaddings,\n navigationWidth,\n navigationHide: rest.navigationHide,\n toolsHide: rest.toolsHide,\n toolsWidth,\n maxContentWidth,\n minContentWidth,\n stickyNotifications: rest.stickyNotifications,\n disableContentHeaderOverlap: rest.disableContentHeaderOverlap,\n navigationTriggerHide: rest.navigationTriggerHide,\n },\n metadata: {\n drawersCount: rest.drawers?.length ?? null,\n hasContentHeader: !!rest.contentHeader,\n },\n },\n analyticsMetadata\n );\n const isMobile = useMobile();\n\n const i18n = useInternalI18n('app-layout');\n const ariaLabels = {\n navigation: i18n('ariaLabels.navigation', rest.ariaLabels?.navigation),\n navigationClose: i18n('ariaLabels.navigationClose', rest.ariaLabels?.navigationClose),\n navigationToggle: i18n('ariaLabels.navigationToggle', rest.ariaLabels?.navigationToggle),\n notifications: i18n('ariaLabels.notifications', rest.ariaLabels?.notifications),\n tools: i18n('ariaLabels.tools', rest.ariaLabels?.tools),\n toolsClose: i18n('ariaLabels.toolsClose', rest.ariaLabels?.toolsClose),\n toolsToggle: i18n('ariaLabels.toolsToggle', rest.ariaLabels?.toolsToggle),\n drawers: i18n('ariaLabels.drawers', rest.ariaLabels?.drawers),\n drawersOverflow: i18n('ariaLabels.drawersOverflow', rest.ariaLabels?.drawersOverflow),\n drawersOverflowWithBadge: i18n('ariaLabels.drawersOverflowWithBadge', rest.ariaLabels?.drawersOverflowWithBadge),\n };\n const { navigationOpen: defaultNavigationOpen, ...restDefaults } = applyDefaults(\n contentType,\n { maxContentWidth, minContentWidth },\n isRefresh\n );\n\n const [navigationOpen = false, setNavigationOpen] = useControllable(\n controlledNavigationOpen,\n controlledOnNavigationChange,\n isMobile ? false : defaultNavigationOpen,\n { componentName: 'AppLayoutToolbar', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n const onNavigationChange = (event: NonCancelableCustomEvent<AppLayoutProps.ChangeDetail>) => {\n setNavigationOpen(event.detail.open);\n controlledOnNavigationChange?.(event);\n };\n\n const [rootRef, placement] = useAppLayoutPlacement(headerSelector, footerSelector);\n\n // This re-builds the props including the default values\n const props = {\n contentType,\n navigationWidth,\n toolsWidth,\n navigationOpen,\n onNavigationChange,\n ...restDefaults,\n ...rest,\n ariaLabels,\n placement,\n };\n\n const baseProps = getBaseProps(rest);\n\n return (\n <AppLayoutToolbarPublicContext.Provider value={true}>\n <div ref={useMergeRefs(__internalRootRef, rootRef)} {...baseProps}>\n <AppLayoutToolbarInternal ref={ref} {...props} />\n </div>\n </AppLayoutToolbarPublicContext.Provider>\n );\n }\n);\n\napplyDisplayName(AppLayoutToolbar, 'AppLayoutToolbar');\nexport default AppLayoutToolbar;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app-layout-toolbar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,wBAAwB,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;A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C,wBAAwB,IAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAI,CAC7C,CACiC,CAC1C,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;AACvD,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { applyDefaults } from '../app-layout/defaults';\nimport { AppLayoutProps } from '../app-layout/interfaces';\nimport { useAppLayoutPlacement } from '../app-layout/utils/use-app-layout-placement';\nimport AppLayoutToolbarInternal from '../app-layout/visual-refresh-toolbar';\nimport { AppLayoutToolbarPublicContext } from '../app-layout/visual-refresh-toolbar/contexts';\nimport { getBaseProps } from '../internal/base-component';\nimport { NonCancelableCustomEvent } from '../internal/events';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { isDevelopment } from '../internal/is-development';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { AppLayoutToolbarProps } from './interfaces';\n\nexport { AppLayoutToolbarProps };\n\nconst AppLayoutToolbar = React.forwardRef(\n (\n {\n contentType = 'default',\n headerSelector = '#b #h',\n footerSelector = '#b #f',\n navigationWidth = 280,\n toolsWidth = 290,\n maxContentWidth,\n minContentWidth,\n navigationOpen: controlledNavigationOpen,\n onNavigationChange: controlledOnNavigationChange,\n analyticsMetadata,\n ...rest\n }: AppLayoutToolbarProps,\n ref: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isRefresh = useVisualRefresh();\n if (!isRefresh) {\n throw new Error(\n `AppLayoutToolbar component is not supported in the Classic theme. Please switch to the Refresh theme. For more details, refer to the documentation.`\n );\n }\n if (isDevelopment) {\n if (rest.toolsOpen && rest.toolsHide) {\n warnOnce(\n 'AppLayoutToolbar',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n const { __internalRootRef } = useBaseComponent(\n 'AppLayoutToolbar',\n {\n props: {\n contentType,\n disableContentPaddings: rest.disableContentPaddings,\n navigationWidth,\n navigationHide: rest.navigationHide,\n toolsHide: rest.toolsHide,\n toolsWidth,\n maxContentWidth,\n minContentWidth,\n stickyNotifications: rest.stickyNotifications,\n disableContentHeaderOverlap: rest.disableContentHeaderOverlap,\n navigationTriggerHide: rest.navigationTriggerHide,\n },\n metadata: {\n drawersCount: rest.drawers?.length ?? null,\n hasContentHeader: !!rest.contentHeader,\n },\n },\n analyticsMetadata\n );\n const isMobile = useMobile();\n\n const { navigationOpen: defaultNavigationOpen, ...restDefaults } = applyDefaults(\n contentType,\n { maxContentWidth, minContentWidth },\n isRefresh\n );\n\n const [navigationOpen = false, setNavigationOpen] = useControllable(\n controlledNavigationOpen,\n controlledOnNavigationChange,\n isMobile ? false : defaultNavigationOpen,\n { componentName: 'AppLayoutToolbar', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n const onNavigationChange = (event: NonCancelableCustomEvent<AppLayoutProps.ChangeDetail>) => {\n setNavigationOpen(event.detail.open);\n controlledOnNavigationChange?.(event);\n };\n\n const [rootRef, placement] = useAppLayoutPlacement(headerSelector, footerSelector);\n\n // This re-builds the props including the default values\n const props = {\n contentType,\n navigationWidth,\n toolsWidth,\n navigationOpen,\n onNavigationChange,\n ...restDefaults,\n ...rest,\n placement,\n };\n\n const baseProps = getBaseProps(rest);\n\n return (\n <AppLayoutToolbarPublicContext.Provider value={true}>\n <div ref={useMergeRefs(__internalRootRef, rootRef)} {...baseProps}>\n <AppLayoutToolbarInternal ref={ref} {...props} />\n </div>\n </AppLayoutToolbarPublicContext.Provider>\n );\n }\n);\n\napplyDisplayName(AppLayoutToolbar, 'AppLayoutToolbar');\nexport default AppLayoutToolbar;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/attribute-editor/internal.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAE,6BAA6B,EAAwB,MAAM,cAAc,CAAC;AASnF,QAAA,MAAM,uBAAuB,EAwKxB,6BAA6B,CAAC;AAEnC,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/attribute-editor/internal.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAE,6BAA6B,EAAwB,MAAM,cAAc,CAAC;AASnF,QAAA,MAAM,uBAAuB,EAkLxB,6BAA6B,CAAC;AAEnC,eAAe,uBAAuB,CAAC"}
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import React, { useImperativeHandle, useRef, useState } from 'react';
4
4
  import clsx from 'clsx';
5
- import { useMergeRefs, useUniqueId } from '@cloudscape-design/component-toolkit/internal';
5
+ import { useMergeRefs, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';
6
6
  import { InternalButton } from '../button/internal';
7
7
  import { useInternalI18n } from '../i18n/context';
8
8
  import { getBaseProps } from '../internal/base-component';
@@ -54,6 +54,12 @@ const InternalAttributeEditor = React.forwardRef(({ additionalInfo, disableAddBu
54
54
  // we only want to announce when the number of items decreases (i.e. when an item is removed)
55
55
  // eslint-disable-next-line react-hooks/exhaustive-deps
56
56
  }, [items, i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.itemRemovedAriaLive]);
57
+ for (const def of definition) {
58
+ if (def && !def.label) {
59
+ warnOnce('AttributeEditor', 'A `label` should be provided for each field definition. It is used as `aria-label` for accessibility.');
60
+ break;
61
+ }
62
+ }
57
63
  if (!gridLayout) {
58
64
  gridLayout = gridDefaults[definition.length];
59
65
  if (!gridLayout) {
@@ -1 +1 @@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,EACxC,qBAAqB,EAAE,qBAAqB,GAC5C,CACH,CAAC;QAEF,6BAAK,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC;YAC9B,CAAC,CAAC,aAAa,IAAI,iBAAiB,CAAC,IAAI,CACxC,oBAAC,oBAAoB,IAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAC,YAAY;gBACnD,CAAC,aAAa,IAAI,CACjB,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,EAC/B,QAAQ,EAAE,gBAAgB;oBAC1B,qEAAqE;oBACrE,mEAAmE;oBACnE,iCAAiC;oBACjC,sBAAsB,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAChE,8BAA8B,EAAE,IAAI,EACpC,WAAW,EAAE,IAAI,EACjB,OAAO,EAAE,gBAAgB,EACzB,UAAU,EAAC,MAAM,EACjB,GAAG,EAAE,YAAY,EACjB,eAAe,EAAE,mBAAmB,EACpC,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,gBAAgB,KAAK,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,IAEpE,aAAa,CACC,CAClB;gBACA,iBAAiB,CACG,CACxB;YACD,oBAAC,kBAAkB,mBACL,sBAAsB,EAClC,OAAO,EAAC,MAAM,EACd,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,CAAC,EACR,GAAG,EAAE,KAAK,CAAC,MAAM,IAEhB,mBAAmB,CACD;YACpB,CAAC,CAAC,cAAc,IAAI,oBAAC,cAAc,IAAC,EAAE,EAAE,mBAAmB,IAAG,cAAc,CAAkB,CAC3F,CACF,CACP,CAAC;AACJ,CAAC,CAC+B,CAAC;AAEnC,eAAe,uBAAuB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useImperativeHandle, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { matchBreakpointMapping } from '../internal/breakpoints';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { usePrevious } from '../internal/hooks/use-previous';\nimport { SomeRequired } from '../internal/types';\nimport InternalLiveRegion from '../live-region/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { AdditionalInfo } from './additional-info';\nimport { gridDefaults } from './grid-defaults';\nimport { AttributeEditorForwardRefType, AttributeEditorProps } from './interfaces';\nimport { Row } from './row';\nimport { getGridTemplateColumns } from './utils';\n\nimport styles from './styles.css.js';\n\ntype InternalAttributeEditorProps<T> = SomeRequired<AttributeEditorProps<T>, 'items' | 'addButtonVariant'> &\n InternalBaseComponentProps;\n\nconst InternalAttributeEditor = React.forwardRef(\n <T,>(\n {\n additionalInfo,\n disableAddButton,\n definition = [{}],\n gridLayout,\n items,\n isItemRemovable = () => true,\n empty,\n addButtonText,\n addButtonVariant,\n removeButtonText,\n removeButtonAriaLabel,\n customRowActions,\n i18nStrings,\n onAddButtonClick,\n onRemoveButtonClick,\n __internalRootRef,\n hideAddButton,\n additionalActions,\n ...props\n }: InternalAttributeEditorProps<T>,\n ref: React.Ref<AttributeEditorProps.Ref>\n ) => {\n const removeButtonRefs = useRef<Array<ButtonProps.Ref | undefined>>([]);\n const addButtonRef = useRef<ButtonProps.Ref>(null);\n const wasNonEmpty = useRef<boolean>(false);\n const [removalAnnouncement, setRemovalAnnouncement] = useState<string>('');\n\n const baseProps = getBaseProps(props);\n const isEmpty = items && items.length === 0;\n\n wasNonEmpty.current = wasNonEmpty.current || !isEmpty;\n\n useImperativeHandle(ref, () => ({\n focusRemoveButton(rowIndex: number) {\n removeButtonRefs.current[rowIndex]?.focus();\n },\n focusAddButton() {\n addButtonRef.current?.focus();\n },\n }));\n\n const additionalInfoId = useUniqueId('attribute-editor-info');\n const infoAriaDescribedBy = additionalInfo ? additionalInfoId : undefined;\n\n const prevItemsLength = usePrevious(items.length);\n const i18n = useInternalI18n('attribute-editor');\n\n React.useEffect(() => {\n if (prevItemsLength && prevItemsLength > items.length) {\n const announcement = i18n('i18nStrings.itemRemovedAriaLive', i18nStrings?.itemRemovedAriaLive);\n if (announcement) {\n setRemovalAnnouncement(announcement);\n } else {\n setRemovalAnnouncement('');\n }\n } else {\n setRemovalAnnouncement('');\n }\n // we only want to announce when the number of items decreases (i.e. when an item is removed)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [items, i18nStrings?.itemRemovedAriaLive]);\n\n if (!gridLayout) {\n gridLayout = gridDefaults[definition.length];\n if (!gridLayout) {\n console.warn('AttributeEditor', '`gridLayout` is required for more than 6 attributes. Cannot render.');\n gridLayout = [];\n }\n }\n\n const gridLayoutBreakpoints = gridLayout.reduce(\n (acc, layout) => ({\n ...acc,\n [layout.breakpoint || 'default']: layout,\n }),\n {} as Record<AttributeEditorProps.Breakpoint, AttributeEditorProps.GridLayout>\n );\n\n const [breakpoint, breakpointRef] = useContainerBreakpoints(\n Object.keys(gridLayoutBreakpoints) as AttributeEditorProps.Breakpoint[]\n );\n const mergedRef = useMergeRefs(breakpointRef, __internalRootRef);\n\n const gridLayoutForBreakpoint = matchBreakpointMapping(gridLayoutBreakpoints, breakpoint || 'default');\n\n if (!gridLayoutForBreakpoint) {\n console.warn('AttributeEditor', `No \\`gridLayout\\` entry found for breakpoint ${breakpoint}. Cannot render.`);\n return <div />;\n }\n\n const totalColumnsInLayout = gridLayoutForBreakpoint.rows.reduce((total, columns) => total + columns.length, 0);\n if (totalColumnsInLayout !== definition.length) {\n console.warn(\n 'AttributeEditor',\n `Incorrect number of columns in layout (${totalColumnsInLayout}) for definition (${definition.length}). Cannot render.`\n );\n return <div />;\n }\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(baseProps.className, styles.root)}\n style={{ gridTemplateColumns: getGridTemplateColumns(gridLayoutForBreakpoint) }}\n >\n {isEmpty && <div className={clsx(styles.empty, wasNonEmpty.current && styles['empty-appear'])}>{empty}</div>}\n {items.map((item, index) => (\n <Row<T>\n key={index}\n index={index}\n breakpoint={breakpoint}\n layout={gridLayoutForBreakpoint}\n item={item}\n definition={definition}\n i18nStrings={i18nStrings}\n removable={isItemRemovable(item)}\n removeButtonText={removeButtonText}\n removeButtonRefs={removeButtonRefs.current}\n customRowActions={customRowActions}\n onRemoveButtonClick={onRemoveButtonClick}\n removeButtonAriaLabel={removeButtonAriaLabel}\n />\n ))}\n\n <div className={styles['add-row']}>\n {(!hideAddButton || additionalActions) && (\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\">\n {!hideAddButton && (\n <InternalButton\n className={styles['add-button']}\n disabled={disableAddButton}\n // Using aria-disabled=\"true\" and tabindex=\"-1\" instead of \"disabled\"\n // because focus can be dynamically moved to this button by calling\n // `focusAddButton()` on the ref.\n nativeButtonAttributes={disableAddButton ? { tabIndex: -1 } : {}}\n __skipNativeAttributesWarnings={true}\n __focusable={true}\n onClick={onAddButtonClick}\n formAction=\"none\"\n ref={addButtonRef}\n ariaDescribedby={infoAriaDescribedBy}\n variant={addButtonVariant}\n iconName={addButtonVariant === 'inline-link' ? 'add-plus' : undefined}\n >\n {addButtonText}\n </InternalButton>\n )}\n {additionalActions}\n </InternalSpaceBetween>\n )}\n <InternalLiveRegion\n data-testid=\"removal-announcement\"\n tagName=\"span\"\n hidden={true}\n delay={5}\n key={items.length}\n >\n {removalAnnouncement}\n </InternalLiveRegion>\n {!!additionalInfo && <AdditionalInfo id={infoAriaDescribedBy}>{additionalInfo}</AdditionalInfo>}\n </div>\n </div>\n );\n }\n) as AttributeEditorForwardRefType;\n\nexport default InternalAttributeEditor;\n"]}
1
+ {"version":3,"file":"internal.js","sour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AAkB,CAC3F,CACF,CACP,CAAC;AACJ,CAAC,CAC+B,CAAC;AAEnC,eAAe,uBAAuB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useImperativeHandle, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { matchBreakpointMapping } from '../internal/breakpoints';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { usePrevious } from '../internal/hooks/use-previous';\nimport { SomeRequired } from '../internal/types';\nimport InternalLiveRegion from '../live-region/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { AdditionalInfo } from './additional-info';\nimport { gridDefaults } from './grid-defaults';\nimport { AttributeEditorForwardRefType, AttributeEditorProps } from './interfaces';\nimport { Row } from './row';\nimport { getGridTemplateColumns } from './utils';\n\nimport styles from './styles.css.js';\n\ntype InternalAttributeEditorProps<T> = SomeRequired<AttributeEditorProps<T>, 'items' | 'addButtonVariant'> &\n InternalBaseComponentProps;\n\nconst InternalAttributeEditor = React.forwardRef(\n <T,>(\n {\n additionalInfo,\n disableAddButton,\n definition = [{}],\n gridLayout,\n items,\n isItemRemovable = () => true,\n empty,\n addButtonText,\n addButtonVariant,\n removeButtonText,\n removeButtonAriaLabel,\n customRowActions,\n i18nStrings,\n onAddButtonClick,\n onRemoveButtonClick,\n __internalRootRef,\n hideAddButton,\n additionalActions,\n ...props\n }: InternalAttributeEditorProps<T>,\n ref: React.Ref<AttributeEditorProps.Ref>\n ) => {\n const removeButtonRefs = useRef<Array<ButtonProps.Ref | undefined>>([]);\n const addButtonRef = useRef<ButtonProps.Ref>(null);\n const wasNonEmpty = useRef<boolean>(false);\n const [removalAnnouncement, setRemovalAnnouncement] = useState<string>('');\n\n const baseProps = getBaseProps(props);\n const isEmpty = items && items.length === 0;\n\n wasNonEmpty.current = wasNonEmpty.current || !isEmpty;\n\n useImperativeHandle(ref, () => ({\n focusRemoveButton(rowIndex: number) {\n removeButtonRefs.current[rowIndex]?.focus();\n },\n focusAddButton() {\n addButtonRef.current?.focus();\n },\n }));\n\n const additionalInfoId = useUniqueId('attribute-editor-info');\n const infoAriaDescribedBy = additionalInfo ? additionalInfoId : undefined;\n\n const prevItemsLength = usePrevious(items.length);\n const i18n = useInternalI18n('attribute-editor');\n\n React.useEffect(() => {\n if (prevItemsLength && prevItemsLength > items.length) {\n const announcement = i18n('i18nStrings.itemRemovedAriaLive', i18nStrings?.itemRemovedAriaLive);\n if (announcement) {\n setRemovalAnnouncement(announcement);\n } else {\n setRemovalAnnouncement('');\n }\n } else {\n setRemovalAnnouncement('');\n }\n // we only want to announce when the number of items decreases (i.e. when an item is removed)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [items, i18nStrings?.itemRemovedAriaLive]);\n\n for (const def of definition) {\n if (def && !def.label) {\n warnOnce(\n 'AttributeEditor',\n 'A `label` should be provided for each field definition. It is used as `aria-label` for accessibility.'\n );\n break;\n }\n }\n\n if (!gridLayout) {\n gridLayout = gridDefaults[definition.length];\n if (!gridLayout) {\n console.warn('AttributeEditor', '`gridLayout` is required for more than 6 attributes. Cannot render.');\n gridLayout = [];\n }\n }\n\n const gridLayoutBreakpoints = gridLayout.reduce(\n (acc, layout) => ({\n ...acc,\n [layout.breakpoint || 'default']: layout,\n }),\n {} as Record<AttributeEditorProps.Breakpoint, AttributeEditorProps.GridLayout>\n );\n\n const [breakpoint, breakpointRef] = useContainerBreakpoints(\n Object.keys(gridLayoutBreakpoints) as AttributeEditorProps.Breakpoint[]\n );\n const mergedRef = useMergeRefs(breakpointRef, __internalRootRef);\n\n const gridLayoutForBreakpoint = matchBreakpointMapping(gridLayoutBreakpoints, breakpoint || 'default');\n\n if (!gridLayoutForBreakpoint) {\n console.warn('AttributeEditor', `No \\`gridLayout\\` entry found for breakpoint ${breakpoint}. Cannot render.`);\n return <div />;\n }\n\n const totalColumnsInLayout = gridLayoutForBreakpoint.rows.reduce((total, columns) => total + columns.length, 0);\n if (totalColumnsInLayout !== definition.length) {\n console.warn(\n 'AttributeEditor',\n `Incorrect number of columns in layout (${totalColumnsInLayout}) for definition (${definition.length}). Cannot render.`\n );\n return <div />;\n }\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(baseProps.className, styles.root)}\n style={{ gridTemplateColumns: getGridTemplateColumns(gridLayoutForBreakpoint) }}\n >\n {isEmpty && <div className={clsx(styles.empty, wasNonEmpty.current && styles['empty-appear'])}>{empty}</div>}\n {items.map((item, index) => (\n <Row<T>\n key={index}\n index={index}\n breakpoint={breakpoint}\n layout={gridLayoutForBreakpoint}\n item={item}\n definition={definition}\n i18nStrings={i18nStrings}\n removable={isItemRemovable(item)}\n removeButtonText={removeButtonText}\n removeButtonRefs={removeButtonRefs.current}\n customRowActions={customRowActions}\n onRemoveButtonClick={onRemoveButtonClick}\n removeButtonAriaLabel={removeButtonAriaLabel}\n />\n ))}\n\n <div className={styles['add-row']}>\n {(!hideAddButton || additionalActions) && (\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\">\n {!hideAddButton && (\n <InternalButton\n className={styles['add-button']}\n disabled={disableAddButton}\n // Using aria-disabled=\"true\" and tabindex=\"-1\" instead of \"disabled\"\n // because focus can be dynamically moved to this button by calling\n // `focusAddButton()` on the ref.\n nativeButtonAttributes={disableAddButton ? { tabIndex: -1 } : {}}\n __skipNativeAttributesWarnings={true}\n __focusable={true}\n onClick={onAddButtonClick}\n formAction=\"none\"\n ref={addButtonRef}\n ariaDescribedby={infoAriaDescribedBy}\n variant={addButtonVariant}\n iconName={addButtonVariant === 'inline-link' ? 'add-plus' : undefined}\n >\n {addButtonText}\n </InternalButton>\n )}\n {additionalActions}\n </InternalSpaceBetween>\n )}\n <InternalLiveRegion\n data-testid=\"removal-announcement\"\n tagName=\"span\"\n hidden={true}\n delay={5}\n key={items.length}\n >\n {removalAnnouncement}\n </InternalLiveRegion>\n {!!additionalInfo && <AdditionalInfo id={infoAriaDescribedBy}>{additionalInfo}</AdditionalInfo>}\n </div>\n </div>\n );\n }\n) as AttributeEditorForwardRefType;\n\nexport default InternalAttributeEditor;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/button/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,QAAA,MAAM,MAAM,qFAkFX,CAAC;AAGF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/button/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,QAAA,MAAM,MAAM,qFAoFX,CAAC;AAGF,eAAe,MAAM,CAAC"}
@@ -6,13 +6,13 @@ import { getBaseProps } from '../internal/base-component';
6
6
  import useBaseComponent from '../internal/hooks/use-base-component';
7
7
  import { applyDisplayName } from '../internal/utils/apply-display-name';
8
8
  import { InternalButton } from './internal';
9
- const Button = React.forwardRef(({ children, iconName, iconAlign = 'left', iconUrl, iconSvg, iconAlt, variant = 'normal', loading = false, loadingText, disabled = false, disabledReason, wrapText = true, href, target, rel, external = false, download, formAction = 'submit', ariaLabel, ariaDescribedby, onClick, onFollow, ariaExpanded, ariaControls, fullWidth, form, i18nStrings, style, nativeButtonAttributes, nativeAnchorAttributes, ...props }, ref) => {
9
+ const Button = React.forwardRef(({ children, iconName, iconAlign = 'left', iconUrl, iconSvg, iconAlt, variant = 'normal', loading = false, loadingText, disabled = false, disabledReason, wrapText = true, href, target, rel, external = false, download, formAction = 'submit', ariaLabel, ariaDescribedby, onClick, onFollow, ariaExpanded, ariaHaspopup, ariaControls, fullWidth, form, i18nStrings, style, nativeButtonAttributes, nativeAnchorAttributes, ...props }, ref) => {
10
10
  const baseComponentProps = useBaseComponent('Button', {
11
11
  props: { formAction, fullWidth, iconAlign, iconName, rel, target, external, variant, wrapText },
12
12
  metadata: { hasDisabledReason: Boolean(disabledReason) },
13
13
  });
14
14
  const baseProps = getBaseProps(props);
15
- return (React.createElement(InternalButton, { ...baseProps, ...baseComponentProps, ref: ref, iconName: iconName, iconAlign: iconAlign, iconUrl: iconUrl, iconSvg: iconSvg, iconAlt: iconAlt, variant: variant, loading: loading, loadingText: loadingText, disabled: disabled, disabledReason: disabledReason, wrapText: wrapText, href: href, target: target, rel: rel, external: external, download: download, formAction: formAction, ariaLabel: ariaLabel, ariaDescribedby: ariaDescribedby, onClick: onClick, onFollow: onFollow, ariaExpanded: ariaExpanded, ariaControls: ariaControls, fullWidth: fullWidth, form: form, i18nStrings: i18nStrings, style: style, nativeButtonAttributes: nativeButtonAttributes, nativeAnchorAttributes: nativeAnchorAttributes, __injectAnalyticsComponentMetadata: true }, children));
15
+ return (React.createElement(InternalButton, { ...baseProps, ...baseComponentProps, ref: ref, iconName: iconName, iconAlign: iconAlign, iconUrl: iconUrl, iconSvg: iconSvg, iconAlt: iconAlt, variant: variant, loading: loading, loadingText: loadingText, disabled: disabled, disabledReason: disabledReason, wrapText: wrapText, href: href, target: target, rel: rel, external: external, download: download, formAction: formAction, ariaLabel: ariaLabel, ariaDescribedby: ariaDescribedby, onClick: onClick, onFollow: onFollow, ariaExpanded: ariaExpanded, ariaHaspopup: ariaHaspopup, ariaControls: ariaControls, fullWidth: fullWidth, form: form, i18nStrings: i18nStrings, style: style, nativeButtonAttributes: nativeButtonAttributes, nativeAnchorAttributes: nativeAnchorAttributes, __injectAnalyticsComponentMetadata: true }, children));
16
16
  });
17
17
  applyDisplayName(Button, 'Button');
18
18
  export default Button;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/button/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI5C,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAC7B,CACE,EACE,QAAQ,EACR,QAAQ,EACR,SAAS,GAAG,MAAM,EAClB,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,GAAG,QAAQ,EAClB,OAAO,GAAG,KAAK,EACf,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,cAAc,EACd,QAAQ,GAAG,IAAI,EACf,IAAI,EACJ,MAAM,EACN,GAAG,EACH,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,UAAU,GAAG,QAAQ,EACrB,SAAS,EACT,eAAe,EACf,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,IAAI,EACJ,WAAW,EACX,KAAK,EACL,sBAAsB,EACtB,sBAAsB,EACtB,GAAG,KAAK,EACI,EACd,GAA+B,EAC/B,EAAE;IACF,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,QAAQ,EAAE;QACpD,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC/F,QAAQ,EAAE,EAAE,iBAAiB,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE;KACzD,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACtC,OAAO,CACL,oBAAC,cAAc,OACT,SAAS,KACT,kBAAkB,EACtB,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,EACZ,sBAAsB,EAAE,sBAAsB,EAC9C,sBAAsB,EAAE,sBAAsB,EAC9C,kCAAkC,EAAE,IAAI,IAEvC,QAAQ,CACM,CAClB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACnC,eAAe,MAAM,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { ButtonProps } from './interfaces';\nimport { InternalButton } from './internal';\n\nexport { ButtonProps };\n\nconst Button = React.forwardRef(\n (\n {\n children,\n iconName,\n iconAlign = 'left',\n iconUrl,\n iconSvg,\n iconAlt,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n disabledReason,\n wrapText = true,\n href,\n target,\n rel,\n external = false,\n download,\n formAction = 'submit',\n ariaLabel,\n ariaDescribedby,\n onClick,\n onFollow,\n ariaExpanded,\n ariaControls,\n fullWidth,\n form,\n i18nStrings,\n style,\n nativeButtonAttributes,\n nativeAnchorAttributes,\n ...props\n }: ButtonProps,\n ref: React.Ref<ButtonProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('Button', {\n props: { formAction, fullWidth, iconAlign, iconName, rel, target, external, variant, wrapText },\n metadata: { hasDisabledReason: Boolean(disabledReason) },\n });\n const baseProps = getBaseProps(props);\n return (\n <InternalButton\n {...baseProps}\n {...baseComponentProps}\n ref={ref}\n iconName={iconName}\n iconAlign={iconAlign}\n iconUrl={iconUrl}\n iconSvg={iconSvg}\n iconAlt={iconAlt}\n variant={variant}\n loading={loading}\n loadingText={loadingText}\n disabled={disabled}\n disabledReason={disabledReason}\n wrapText={wrapText}\n href={href}\n target={target}\n rel={rel}\n external={external}\n download={download}\n formAction={formAction}\n ariaLabel={ariaLabel}\n ariaDescribedby={ariaDescribedby}\n onClick={onClick}\n onFollow={onFollow}\n ariaExpanded={ariaExpanded}\n ariaControls={ariaControls}\n fullWidth={fullWidth}\n form={form}\n i18nStrings={i18nStrings}\n style={style}\n nativeButtonAttributes={nativeButtonAttributes}\n nativeAnchorAttributes={nativeAnchorAttributes}\n __injectAnalyticsComponentMetadata={true}\n >\n {children}\n </InternalButton>\n );\n }\n);\n\napplyDisplayName(Button, 'Button');\nexport default Button;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/button/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAA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EACpB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,EACZ,sBAAsB,EAAE,sBAAsB,EAC9C,sBAAsB,EAAE,sBAAsB,EAC9C,kCAAkC,EAAE,IAAI,IAEvC,QAAQ,CACM,CAClB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACnC,eAAe,MAAM,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { ButtonProps } from './interfaces';\nimport { InternalButton } from './internal';\n\nexport { ButtonProps };\n\nconst Button = React.forwardRef(\n (\n {\n children,\n iconName,\n iconAlign = 'left',\n iconUrl,\n iconSvg,\n iconAlt,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n disabledReason,\n wrapText = true,\n href,\n target,\n rel,\n external = false,\n download,\n formAction = 'submit',\n ariaLabel,\n ariaDescribedby,\n onClick,\n onFollow,\n ariaExpanded,\n ariaHaspopup,\n ariaControls,\n fullWidth,\n form,\n i18nStrings,\n style,\n nativeButtonAttributes,\n nativeAnchorAttributes,\n ...props\n }: ButtonProps,\n ref: React.Ref<ButtonProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('Button', {\n props: { formAction, fullWidth, iconAlign, iconName, rel, target, external, variant, wrapText },\n metadata: { hasDisabledReason: Boolean(disabledReason) },\n });\n const baseProps = getBaseProps(props);\n return (\n <InternalButton\n {...baseProps}\n {...baseComponentProps}\n ref={ref}\n iconName={iconName}\n iconAlign={iconAlign}\n iconUrl={iconUrl}\n iconSvg={iconSvg}\n iconAlt={iconAlt}\n variant={variant}\n loading={loading}\n loadingText={loadingText}\n disabled={disabled}\n disabledReason={disabledReason}\n wrapText={wrapText}\n href={href}\n target={target}\n rel={rel}\n external={external}\n download={download}\n formAction={formAction}\n ariaLabel={ariaLabel}\n ariaDescribedby={ariaDescribedby}\n onClick={onClick}\n onFollow={onFollow}\n ariaExpanded={ariaExpanded}\n ariaHaspopup={ariaHaspopup}\n ariaControls={ariaControls}\n fullWidth={fullWidth}\n form={form}\n i18nStrings={i18nStrings}\n style={style}\n nativeButtonAttributes={nativeButtonAttributes}\n nativeAnchorAttributes={nativeAnchorAttributes}\n __injectAnalyticsComponentMetadata={true}\n >\n {children}\n </InternalButton>\n );\n }\n);\n\napplyDisplayName(Button, 'Button');\nexport default Button;\n"]}
@@ -154,6 +154,10 @@ export interface ButtonProps extends BaseComponentProps, BaseButtonProps {
154
154
  * Adds aria-expanded to the button element. Use when the button controls an expandable element.
155
155
  */
156
156
  ariaExpanded?: boolean;
157
+ /**
158
+ * Adds `aria-haspopup` to the button element. Use when the button triggers a popup element such as a menu, listbox, tree, grid, or dialog.
159
+ */
160
+ ariaHaspopup?: boolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
157
161
  /**
158
162
  * Called when the user clicks on the button and the button is not disabled or in loading state.
159
163
  */
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/button/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC/G;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;OAKG;IACH,WAAW,CAAC,E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