@cloudscape-design/components-themeable 3.0.930 → 3.0.932
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.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/template/app-layout/interfaces.d.ts +8 -6
- package/lib/internal/template/app-layout/interfaces.d.ts.map +1 -1
- package/lib/internal/template/app-layout/interfaces.js.map +1 -1
- package/lib/internal/template/app-layout/internal.js +2 -2
- package/lib/internal/template/app-layout/internal.js.map +1 -1
- package/lib/internal/template/app-layout/utils/feature-flags.d.ts +2 -1
- package/lib/internal/template/app-layout/utils/feature-flags.d.ts.map +1 -1
- package/lib/internal/template/app-layout/utils/feature-flags.js +14 -1
- package/lib/internal/template/app-layout/utils/feature-flags.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/contexts.d.ts +1 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/contexts.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/contexts.js +1 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/contexts.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/index.js +1 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/multi-layout.d.ts +3 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/multi-layout.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/multi-layout.js +12 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/multi-layout.js.map +1 -1
- package/lib/internal/template/app-layout-toolbar/index.d.ts +7 -0
- package/lib/internal/template/app-layout-toolbar/index.d.ts.map +1 -0
- package/lib/internal/template/app-layout-toolbar/index.js +85 -0
- package/lib/internal/template/app-layout-toolbar/index.js.map +1 -0
- package/lib/internal/template/app-layout-toolbar/interfaces.d.ts +52 -0
- package/lib/internal/template/app-layout-toolbar/interfaces.d.ts.map +1 -0
- package/lib/internal/template/app-layout-toolbar/interfaces.js +2 -0
- package/lib/internal/template/app-layout-toolbar/interfaces.js.map +1 -0
- package/lib/internal/template/drawer/implementation.js +2 -2
- package/lib/internal/template/drawer/implementation.js.map +1 -1
- package/lib/internal/template/help-panel/implementation.js +2 -2
- package/lib/internal/template/help-panel/implementation.js.map +1 -1
- package/lib/internal/template/i18n/messages/all.all.js +1 -1
- package/lib/internal/template/i18n/messages/all.all.json +1 -1
- package/lib/internal/template/i18n/messages/all.ar.js +1 -1
- package/lib/internal/template/i18n/messages/all.ar.json +1 -1
- package/lib/internal/template/i18n/messages/all.de.js +1 -1
- package/lib/internal/template/i18n/messages/all.de.json +1 -1
- package/lib/internal/template/i18n/messages/all.en-GB.js +1 -1
- package/lib/internal/template/i18n/messages/all.en-GB.json +1 -1
- package/lib/internal/template/i18n/messages/all.en.js +1 -1
- package/lib/internal/template/i18n/messages/all.en.json +1 -1
- package/lib/internal/template/i18n/messages/all.es.js +1 -1
- package/lib/internal/template/i18n/messages/all.es.json +1 -1
- package/lib/internal/template/i18n/messages/all.fr.js +1 -1
- package/lib/internal/template/i18n/messages/all.fr.json +1 -1
- package/lib/internal/template/i18n/messages/all.id.js +1 -1
- package/lib/internal/template/i18n/messages/all.id.json +1 -1
- package/lib/internal/template/i18n/messages/all.it.js +1 -1
- package/lib/internal/template/i18n/messages/all.it.json +1 -1
- package/lib/internal/template/i18n/messages/all.ja.js +1 -1
- package/lib/internal/template/i18n/messages/all.ja.json +1 -1
- package/lib/internal/template/i18n/messages/all.ko.js +1 -1
- package/lib/internal/template/i18n/messages/all.ko.json +1 -1
- package/lib/internal/template/i18n/messages/all.pt-BR.js +1 -1
- package/lib/internal/template/i18n/messages/all.pt-BR.json +1 -1
- package/lib/internal/template/i18n/messages/all.tr.js +1 -1
- package/lib/internal/template/i18n/messages/all.tr.json +1 -1
- package/lib/internal/template/i18n/messages/all.zh-CN.js +1 -1
- package/lib/internal/template/i18n/messages/all.zh-CN.json +1 -1
- package/lib/internal/template/i18n/messages/all.zh-TW.js +1 -1
- package/lib/internal/template/i18n/messages/all.zh-TW.json +1 -1
- package/lib/internal/template/index.d.ts +1 -0
- package/lib/internal/template/index.d.ts.map +1 -1
- package/lib/internal/template/index.js +1 -0
- package/lib/internal/template/index.js.map +1 -1
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/internal/environment.json +1 -1
- package/lib/internal/template/internal/plugins/helpers/use-global-breadcrumbs.js +2 -2
- package/lib/internal/template/internal/plugins/helpers/use-global-breadcrumbs.js.map +1 -1
- package/lib/internal/template/package.json +1 -0
- package/lib/internal/template/side-navigation/implementation.js +2 -2
- package/lib/internal/template/side-navigation/implementation.js.map +1 -1
- package/lib/internal/template/split-panel/bottom.js +2 -2
- package/lib/internal/template/split-panel/bottom.js.map +1 -1
- package/lib/internal/template/split-panel/implementation.js +2 -2
- package/lib/internal/template/split-panel/implementation.js.map +1 -1
- package/lib/internal/template/split-panel/side.js +2 -2
- package/lib/internal/template/split-panel/side.js.map +1 -1
- package/lib/internal/template/test-utils/dom/app-layout-toolbar/index.d.ts +4 -0
- package/lib/internal/template/test-utils/dom/app-layout-toolbar/index.js +11 -0
- package/lib/internal/template/test-utils/dom/app-layout-toolbar/index.js.map +1 -0
- package/lib/internal/template/test-utils/dom/index.d.ts +20 -0
- package/lib/internal/template/test-utils/dom/index.js +13 -2
- package/lib/internal/template/test-utils/dom/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/app-layout-toolbar/index.d.ts +4 -0
- package/lib/internal/template/test-utils/selectors/app-layout-toolbar/index.js +11 -0
- package/lib/internal/template/test-utils/selectors/app-layout-toolbar/index.js.map +1 -0
- package/lib/internal/template/test-utils/selectors/index.d.ts +18 -0
- package/lib/internal/template/test-utils/selectors/index.js +13 -2
- package/lib/internal/template/test-utils/selectors/index.js.map +1 -1
- package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
|
|
6
|
+
import { applyDefaults } from '../app-layout/defaults';
|
|
7
|
+
import { useAppLayoutPlacement } from '../app-layout/utils/use-app-layout-placement';
|
|
8
|
+
import AppLayoutToolbarInternal from '../app-layout/visual-refresh-toolbar';
|
|
9
|
+
import { AppLayoutToolbarPublicContext } from '../app-layout/visual-refresh-toolbar/contexts';
|
|
10
|
+
import { useInternalI18n } from '../i18n/context';
|
|
11
|
+
import { getBaseProps } from '../internal/base-component';
|
|
12
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
13
|
+
import { useControllable } from '../internal/hooks/use-controllable';
|
|
14
|
+
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
15
|
+
import { useMobile } from '../internal/hooks/use-mobile';
|
|
16
|
+
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
17
|
+
import { isDevelopment } from '../internal/is-development';
|
|
18
|
+
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
19
|
+
const AppLayoutToolbar = React.forwardRef((_a, ref) => {
|
|
20
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
21
|
+
var { contentType = 'default', headerSelector = '#b #h', footerSelector = '#b #f', navigationWidth = 280, toolsWidth = 290, maxContentWidth, minContentWidth, navigationOpen: controlledNavigationOpen, onNavigationChange: controlledOnNavigationChange, analyticsMetadata } = _a, rest = __rest(_a, ["contentType", "headerSelector", "footerSelector", "navigationWidth", "toolsWidth", "maxContentWidth", "minContentWidth", "navigationOpen", "onNavigationChange", "analyticsMetadata"]);
|
|
22
|
+
const isRefresh = useVisualRefresh();
|
|
23
|
+
if (!isRefresh) {
|
|
24
|
+
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.`);
|
|
25
|
+
}
|
|
26
|
+
if (isDevelopment) {
|
|
27
|
+
if (rest.toolsOpen && rest.toolsHide) {
|
|
28
|
+
warnOnce('AppLayoutToolbar', `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\`.`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const { __internalRootRef } = useBaseComponent('AppLayoutToolbar', {
|
|
32
|
+
props: {
|
|
33
|
+
contentType,
|
|
34
|
+
disableContentPaddings: rest.disableContentPaddings,
|
|
35
|
+
navigationWidth,
|
|
36
|
+
navigationHide: rest.navigationHide,
|
|
37
|
+
toolsHide: rest.toolsHide,
|
|
38
|
+
toolsWidth,
|
|
39
|
+
maxContentWidth,
|
|
40
|
+
minContentWidth,
|
|
41
|
+
stickyNotifications: rest.stickyNotifications,
|
|
42
|
+
disableContentHeaderOverlap: rest.disableContentHeaderOverlap,
|
|
43
|
+
navigationTriggerHide: rest.navigationTriggerHide,
|
|
44
|
+
},
|
|
45
|
+
metadata: {
|
|
46
|
+
drawersCount: (_c = (_b = rest.drawers) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : null,
|
|
47
|
+
hasContentHeader: !!rest.contentHeader,
|
|
48
|
+
},
|
|
49
|
+
}, analyticsMetadata);
|
|
50
|
+
const isMobile = useMobile();
|
|
51
|
+
const i18n = useInternalI18n('app-layout');
|
|
52
|
+
const ariaLabels = {
|
|
53
|
+
navigation: i18n('ariaLabels.navigation', (_d = rest.ariaLabels) === null || _d === void 0 ? void 0 : _d.navigation),
|
|
54
|
+
navigationClose: i18n('ariaLabels.navigationClose', (_e = rest.ariaLabels) === null || _e === void 0 ? void 0 : _e.navigationClose),
|
|
55
|
+
navigationToggle: i18n('ariaLabels.navigationToggle', (_f = rest.ariaLabels) === null || _f === void 0 ? void 0 : _f.navigationToggle),
|
|
56
|
+
notifications: i18n('ariaLabels.notifications', (_g = rest.ariaLabels) === null || _g === void 0 ? void 0 : _g.notifications),
|
|
57
|
+
tools: i18n('ariaLabels.tools', (_h = rest.ariaLabels) === null || _h === void 0 ? void 0 : _h.tools),
|
|
58
|
+
toolsClose: i18n('ariaLabels.toolsClose', (_j = rest.ariaLabels) === null || _j === void 0 ? void 0 : _j.toolsClose),
|
|
59
|
+
toolsToggle: i18n('ariaLabels.toolsToggle', (_k = rest.ariaLabels) === null || _k === void 0 ? void 0 : _k.toolsToggle),
|
|
60
|
+
drawers: i18n('ariaLabels.drawers', (_l = rest.ariaLabels) === null || _l === void 0 ? void 0 : _l.drawers),
|
|
61
|
+
drawersOverflow: i18n('ariaLabels.drawersOverflow', (_m = rest.ariaLabels) === null || _m === void 0 ? void 0 : _m.drawersOverflow),
|
|
62
|
+
drawersOverflowWithBadge: i18n('ariaLabels.drawersOverflowWithBadge', (_o = rest.ariaLabels) === null || _o === void 0 ? void 0 : _o.drawersOverflowWithBadge),
|
|
63
|
+
};
|
|
64
|
+
const _p = applyDefaults(contentType, { maxContentWidth, minContentWidth }, isRefresh), { navigationOpen: defaultNavigationOpen } = _p, restDefaults = __rest(_p, ["navigationOpen"]);
|
|
65
|
+
const [navigationOpen = false, setNavigationOpen] = useControllable(controlledNavigationOpen, controlledOnNavigationChange, isMobile ? false : defaultNavigationOpen, { componentName: 'AppLayoutToolbar', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' });
|
|
66
|
+
const onNavigationChange = (event) => {
|
|
67
|
+
setNavigationOpen(event.detail.open);
|
|
68
|
+
controlledOnNavigationChange === null || controlledOnNavigationChange === void 0 ? void 0 : controlledOnNavigationChange(event);
|
|
69
|
+
};
|
|
70
|
+
const [rootRef, placement] = useAppLayoutPlacement(headerSelector, footerSelector);
|
|
71
|
+
// This re-builds the props including the default values
|
|
72
|
+
const props = Object.assign(Object.assign(Object.assign({ contentType,
|
|
73
|
+
navigationWidth,
|
|
74
|
+
toolsWidth,
|
|
75
|
+
navigationOpen,
|
|
76
|
+
onNavigationChange }, restDefaults), rest), { ariaLabels,
|
|
77
|
+
placement });
|
|
78
|
+
const baseProps = getBaseProps(rest);
|
|
79
|
+
return (React.createElement(AppLayoutToolbarPublicContext.Provider, { value: true },
|
|
80
|
+
React.createElement("div", Object.assign({ ref: useMergeRefs(__internalRootRef, rootRef) }, baseProps),
|
|
81
|
+
React.createElement(AppLayoutToolbarInternal, Object.assign({ ref: ref }, props)))));
|
|
82
|
+
});
|
|
83
|
+
applyDisplayName(AppLayoutToolbar, 'AppLayoutToolbar');
|
|
84
|
+
export default AppLayoutToolbar;
|
|
85
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app-layout-toolbar/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,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,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAA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JiD,YAAY,cAAxD,kBAA0D,CAI/D,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,KAAK,EAAE,iBAAiB,CAAC,GAAG,eAAe,CACjE,wBAAwB,EACxB,4BAA4B,EAC5B,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,qBAAqB,EACxC,EAAE,aAAa,EAAE,kBAAkB,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAC7G,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,+CACT,WAAW;QACX,eAAe;QACf,UAAU;QACV,cAAc;QACd,kBAAkB,IACf,YAAY,GACZ,IAAI,KACP,UAAU;QACV,SAAS,GACV,CAAC;IAEF,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAErC,OAAO,CACL,oBAAC,6BAA6B,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI;QACjD,2CAAK,GAAG,EAAE,YAAY,CAAC,iBAAiB,EAAE,OAAO,CAAC,IAAM,SAAS;YAC/D,oBAAC,wBAAwB,kBAAC,GAAG,EAAE,GAAG,IAAM,KAAK,EAAI,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\nimport React from 'react';\n\nimport { 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 { useMergeRefs } from '../internal/hooks/use-merge-refs';\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<HTMLDivElement>(\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"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AppLayoutProps, BaseLayoutProps } from '../app-layout/interfaces';
|
|
2
|
+
export interface AppLayoutToolbarProps extends BaseLayoutProps {
|
|
3
|
+
/**
|
|
4
|
+
* If `true`, the navigation trigger is not displayed at all,
|
|
5
|
+
* while navigation drawer might be displayed, but opened using a custom trigger.
|
|
6
|
+
*/
|
|
7
|
+
navigationTriggerHide?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Drawers property. If you set both `drawers` and `tools`, `drawers` will take precedence.
|
|
10
|
+
|
|
11
|
+
* Each Drawer is an item in the drawers wrapper with the following properties:
|
|
12
|
+
* * id (string) - the id of the drawer.
|
|
13
|
+
* * content (React.ReactNode) - the content in the drawer.
|
|
14
|
+
* * trigger (DrawerTrigger) - (Optional) the button that opens and closes the active drawer.
|
|
15
|
+
* If not set, a corresponding trigger button is not displayed, while the drawer might be displayed, but opened using a custom trigger.
|
|
16
|
+
* * ariaLabels (DrawerAriaLabels) - the labels for the interactive elements of the drawer.
|
|
17
|
+
* * badge (boolean) - (Optional) Adds a badge to the corner of the icon to indicate a state change. For example: Unread notifications.
|
|
18
|
+
* * resizable (boolean) - (Optional) if the drawer is resizable or not.
|
|
19
|
+
* * defaultSize (number) - (Optional) starting size of the drawer. if not set, defaults to 290.
|
|
20
|
+
* * onResize (({ size: number }) => void) - (Optional) Fired when the active drawer is resized.
|
|
21
|
+
*
|
|
22
|
+
* #### DrawerTrigger
|
|
23
|
+
* - `iconName` (IconProps.Name) - (Optional) Specifies the icon to be displayed.
|
|
24
|
+
* - `iconSvg` (React.ReactNode) - (Optional) Specifies the SVG of a custom icon. For more information, see [SVG icon guidelines](/components/icon/?tabId=api#slots)
|
|
25
|
+
*
|
|
26
|
+
* #### DrawerAriaLabels
|
|
27
|
+
* - `drawerName` (string) - Label for the drawer itself, and for the drawer trigger button tooltip text.
|
|
28
|
+
* - `closeButton` (string) - (Optional) Label for the close button.
|
|
29
|
+
* - `triggerButton` (string) - (Optional) Label for the trigger button.
|
|
30
|
+
* - `resizeHandle` (string) - (Optional) Label for the resize handle.
|
|
31
|
+
*/
|
|
32
|
+
drawers?: Array<AppLayoutToolbarProps.Drawer>;
|
|
33
|
+
}
|
|
34
|
+
export declare namespace AppLayoutToolbarProps {
|
|
35
|
+
type AnalyticsMetadata = AppLayoutProps.AnalyticsMetadata;
|
|
36
|
+
type ContentType = AppLayoutProps.ContentType;
|
|
37
|
+
interface Ref extends AppLayoutProps.Ref {
|
|
38
|
+
/**
|
|
39
|
+
* Focuses the navigation. Use this to focus the navigation after opening it programmatically.
|
|
40
|
+
*/
|
|
41
|
+
focusNavigation(): void;
|
|
42
|
+
}
|
|
43
|
+
type Drawer = AppLayoutProps.Drawer;
|
|
44
|
+
type DrawerAriaLabels = AppLayoutProps.DrawerAriaLabels;
|
|
45
|
+
type Labels = AppLayoutProps.Labels;
|
|
46
|
+
type ChangeDetail = AppLayoutProps.ChangeDetail;
|
|
47
|
+
type SplitPanelResizeDetail = AppLayoutProps.SplitPanelResizeDetail;
|
|
48
|
+
type SplitPanelPreferences = AppLayoutProps.SplitPanelPreferences;
|
|
49
|
+
type SplitPanelPosition = AppLayoutProps.SplitPanelPosition;
|
|
50
|
+
type DrawerChangeDetail = AppLayoutProps.DrawerChangeDetail;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/app-layout-toolbar/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3E,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;CAC/C;AAED,yBAAiB,qBAAqB,CAAC;IACrC,KAAY,iBAAiB,GAAG,cAAc,CAAC,iBAAiB,CAAC;IACjE,KAAY,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC;IACrD,UAAiB,GAAI,SAAQ,cAAc,CAAC,GAAG;QAC7C;;WAEG;QACH,eAAe,IAAI,IAAI,CAAC;KACzB;IACD,KAAY,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC;IAC3C,KAAY,gBAAgB,GAAG,cAAc,CAAC,gBAAgB,CAAC;IAC/D,KAAY,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC;IAC3C,KAAY,YAAY,GAAG,cAAc,CAAC,YAAY,CAAC;IACvD,KAAY,sBAAsB,GAAG,cAAc,CAAC,sBAAsB,CAAC;IAC3E,KAAY,qBAAqB,GAAG,cAAc,CAAC,qBAAqB,CAAC;IACzE,KAAY,kBAAkB,GAAG,cAAc,CAAC,kBAAkB,CAAC;IACnE,KAAY,kBAAkB,GAAG,cAAc,CAAC,kBAAkB,CAAC;CACpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/app-layout-toolbar/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AppLayoutProps, BaseLayoutProps } from '../app-layout/interfaces';\n\nexport interface AppLayoutToolbarProps extends BaseLayoutProps {\n /**\n * If `true`, the navigation trigger is not displayed at all,\n * while navigation drawer might be displayed, but opened using a custom trigger.\n */\n navigationTriggerHide?: boolean;\n\n /**\n * Drawers property. If you set both `drawers` and `tools`, `drawers` will take precedence.\n\n * Each Drawer is an item in the drawers wrapper with the following properties:\n * * id (string) - the id of the drawer.\n * * content (React.ReactNode) - the content in the drawer.\n * * trigger (DrawerTrigger) - (Optional) the button that opens and closes the active drawer.\n * If not set, a corresponding trigger button is not displayed, while the drawer might be displayed, but opened using a custom trigger.\n * * ariaLabels (DrawerAriaLabels) - the labels for the interactive elements of the drawer.\n * * badge (boolean) - (Optional) Adds a badge to the corner of the icon to indicate a state change. For example: Unread notifications.\n * * resizable (boolean) - (Optional) if the drawer is resizable or not.\n * * defaultSize (number) - (Optional) starting size of the drawer. if not set, defaults to 290.\n * * onResize (({ size: number }) => void) - (Optional) Fired when the active drawer is resized.\n *\n * #### DrawerTrigger\n * - `iconName` (IconProps.Name) - (Optional) Specifies the icon to be displayed.\n * - `iconSvg` (React.ReactNode) - (Optional) Specifies the SVG of a custom icon. For more information, see [SVG icon guidelines](/components/icon/?tabId=api#slots)\n *\n * #### DrawerAriaLabels\n * - `drawerName` (string) - Label for the drawer itself, and for the drawer trigger button tooltip text.\n * - `closeButton` (string) - (Optional) Label for the close button.\n * - `triggerButton` (string) - (Optional) Label for the trigger button.\n * - `resizeHandle` (string) - (Optional) Label for the resize handle.\n */\n drawers?: Array<AppLayoutToolbarProps.Drawer>;\n}\n\nexport namespace AppLayoutToolbarProps {\n export type AnalyticsMetadata = AppLayoutProps.AnalyticsMetadata;\n export type ContentType = AppLayoutProps.ContentType;\n export interface Ref extends AppLayoutProps.Ref {\n /**\n * Focuses the navigation. Use this to focus the navigation after opening it programmatically.\n */\n focusNavigation(): void;\n }\n export type Drawer = AppLayoutProps.Drawer;\n export type DrawerAriaLabels = AppLayoutProps.DrawerAriaLabels;\n export type Labels = AppLayoutProps.Labels;\n export type ChangeDetail = AppLayoutProps.ChangeDetail;\n export type SplitPanelResizeDetail = AppLayoutProps.SplitPanelResizeDetail;\n export type SplitPanelPreferences = AppLayoutProps.SplitPanelPreferences;\n export type SplitPanelPosition = AppLayoutProps.SplitPanelPosition;\n export type DrawerChangeDetail = AppLayoutProps.DrawerChangeDetail;\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { __rest } from "tslib";
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import {
|
|
6
|
+
import { useAppLayoutToolbarDesignEnabled } from '../app-layout/utils/feature-flags';
|
|
7
7
|
import { useInternalI18n } from '../i18n/context';
|
|
8
8
|
import { getBaseProps } from '../internal/base-component';
|
|
9
9
|
import { createWidgetizedComponent } from '../internal/widgets';
|
|
@@ -13,7 +13,7 @@ import styles from './styles.css.js';
|
|
|
13
13
|
export function DrawerImplementation(_a) {
|
|
14
14
|
var { header, children, loading, i18nStrings, __internalRootRef } = _a, restProps = __rest(_a, ["header", "children", "loading", "i18nStrings", "__internalRootRef"]);
|
|
15
15
|
const baseProps = getBaseProps(restProps);
|
|
16
|
-
const isToolbar =
|
|
16
|
+
const isToolbar = useAppLayoutToolbarDesignEnabled();
|
|
17
17
|
const i18n = useInternalI18n('drawer');
|
|
18
18
|
const containerProps = Object.assign(Object.assign({}, baseProps), { className: clsx(baseProps.className, styles.drawer, isToolbar && styles['with-toolbar']) });
|
|
19
19
|
return loading ? (React.createElement("div", Object.assign({}, containerProps, { ref: __internalRootRef }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/drawer/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAA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C/B,IAAI,CAAC,yBAAyB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,CAAC,CACvC,CACG,CACtB,CACP,CAAC,CAAC,CAAC,CACF,6CAAS,cAAc,IAAE,GAAG,EAAE,iBAAiB;QAC5C,MAAM,IAAI,6BAAK,SAAS,EAAE,MAAM,CAAC,MAAM,IAAG,MAAM,CAAO;QACxD,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,2BAA2B,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,IAAG,QAAQ,CAAO,CACvF,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC,oBAAoB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { useAppLayoutToolbarDesignEnabled } from '../app-layout/utils/feature-flags';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { createWidgetizedComponent } from '../internal/widgets';\nimport InternalLiveRegion from '../live-region/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { DrawerProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ntype DrawerInternalProps = DrawerProps & InternalBaseComponentProps;\n\nexport function DrawerImplementation({\n header,\n children,\n loading,\n i18nStrings,\n __internalRootRef,\n ...restProps\n}: DrawerInternalProps) {\n const baseProps = getBaseProps(restProps);\n const isToolbar = useAppLayoutToolbarDesignEnabled();\n const i18n = useInternalI18n('drawer');\n const containerProps = {\n ...baseProps,\n className: clsx(baseProps.className, styles.drawer, isToolbar && styles['with-toolbar']),\n };\n return loading ? (\n <div {...containerProps} ref={__internalRootRef}>\n <InternalStatusIndicator type=\"loading\">\n <InternalLiveRegion tagName=\"span\">\n {i18n('i18nStrings.loadingText', i18nStrings?.loadingText)}\n </InternalLiveRegion>\n </InternalStatusIndicator>\n </div>\n ) : (\n <div {...containerProps} ref={__internalRootRef}>\n {header && <div className={styles.header}>{header}</div>}\n <div className={clsx(styles['test-utils-drawer-content'], styles.content)}>{children}</div>\n </div>\n );\n}\n\nexport const createWidgetizedDrawer = createWidgetizedComponent(DrawerImplementation);\n"]}
|
|
@@ -3,7 +3,7 @@ import { __rest } from "tslib";
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import {
|
|
6
|
+
import { useAppLayoutToolbarDesignEnabled } from '../app-layout/utils/feature-flags';
|
|
7
7
|
import { useInternalI18n } from '../i18n/context';
|
|
8
8
|
import { getBaseProps } from '../internal/base-component';
|
|
9
9
|
import { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';
|
|
@@ -14,7 +14,7 @@ import styles from './styles.css.js';
|
|
|
14
14
|
export function HelpPanelImplementation(_a) {
|
|
15
15
|
var { header, footer, children, loading, loadingText, __internalRootRef } = _a, restProps = __rest(_a, ["header", "footer", "children", "loading", "loadingText", "__internalRootRef"]);
|
|
16
16
|
const baseProps = getBaseProps(restProps);
|
|
17
|
-
const isToolbar =
|
|
17
|
+
const isToolbar = useAppLayoutToolbarDesignEnabled();
|
|
18
18
|
const i18n = useInternalI18n('help-panel');
|
|
19
19
|
const containerProps = Object.assign(Object.assign({}, baseProps), { className: clsx(baseProps.className, styles['help-panel'], isToolbar && styles['with-toolbar'], loading && styles.loading) });
|
|
20
20
|
return loading ? (React.createElement("div", Object.assign({}, containerProps, { ref: __internalRootRef }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/help-panel/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/help-panel/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAE7F,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAGnE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,UAAU,uBAAuB,CAAC,EAQf;QARe,EACtC,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,EACP,WAAW,EACX,iBAAiB,OAEM,EADpB,SAAS,cAP0B,+EAQvC,CADa;IAEZ,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,gCAAgC,EAAE,CAAC;IACrD,MAAM,IAAI,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IAC3C,MAAM,cAAc,mCACf,SAAS,KACZ,SAAS,EAAE,IAAI,CACb,SAAS,CAAC,SAAS,EACnB,MAAM,CAAC,YAAY,CAAC,EACpB,SAAS,IAAI,MAAM,CAAC,cAAc,CAAC,EACnC,OAAO,IAAI,MAAM,CAAC,OAAO,CAC1B,GACF,CAAC;IACF,OAAO,OAAO,CAAC,CAAC,CAAC,CACf,6CAAS,cAAc,IAAE,GAAG,EAAE,iBAAiB;QAC7C,oBAAC,uBAAuB,IAAC,IAAI,EAAC,SAAS;YACrC,oBAAC,kBAAkB,IAAC,OAAO,EAAC,MAAM,IAAE,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAsB,CAClE,CACtB,CACP,CAAC,CAAC,CAAC,CACF,6CAAS,cAAc,IAAE,GAAG,EAAE,iBAAiB;QAC5C,MAAM,IAAI,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAG,MAAM,CAAO;QAC9D,oBAAC,yBAAyB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,cAAc,EAAE,SAAS,EAAE;YACtE,6BAAK,SAAS,EAAE,MAAM,CAAC,OAAO,IAAG,QAAQ,CAAO,CACb;QACpC,MAAM,IAAI,CACT,6BAAK,SAAS,EAAE,MAAM,CAAC,MAAM;YAC3B,4BAAI,IAAI,EAAC,cAAc,GAAG;YACzB,MAAM,CACH,CACP,CACG,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,yBAAyB,CAAC,uBAAuB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { useAppLayoutToolbarDesignEnabled } from '../app-layout/utils/feature-flags';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { createWidgetizedComponent } from '../internal/widgets';\nimport InternalLiveRegion from '../live-region/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { HelpPanelProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ntype HelpPanelInternalProps = HelpPanelProps & InternalBaseComponentProps;\n\nexport function HelpPanelImplementation({\n header,\n footer,\n children,\n loading,\n loadingText,\n __internalRootRef,\n ...restProps\n}: HelpPanelInternalProps) {\n const baseProps = getBaseProps(restProps);\n const isToolbar = useAppLayoutToolbarDesignEnabled();\n const i18n = useInternalI18n('help-panel');\n const containerProps = {\n ...baseProps,\n className: clsx(\n baseProps.className,\n styles['help-panel'],\n isToolbar && styles['with-toolbar'],\n loading && styles.loading\n ),\n };\n return loading ? (\n <div {...containerProps} ref={__internalRootRef}>\n <InternalStatusIndicator type=\"loading\">\n <InternalLiveRegion tagName=\"span\">{i18n('loadingText', loadingText)}</InternalLiveRegion>\n </InternalStatusIndicator>\n </div>\n ) : (\n <div {...containerProps} ref={__internalRootRef}>\n {header && <div className={clsx(styles.header)}>{header}</div>}\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <div className={styles.content}>{children}</div>\n </LinkDefaultVariantContext.Provider>\n {footer && (\n <div className={styles.footer}>\n <hr role=\"presentation\" />\n {footer}\n </div>\n )}\n </div>\n );\n}\n\nexport const createWidgetizedHelpPanel = createWidgetizedComponent(HelpPanelImplementation);\n"]}
|