@cloudscape-design/components 3.0.900 → 3.0.902
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/flashbar/flash.d.ts.map +1 -1
- package/flashbar/flash.js +6 -3
- package/flashbar/flash.js.map +1 -1
- package/i18n/provider.d.ts.map +1 -1
- package/i18n/provider.js +31 -16
- package/i18n/provider.js.map +1 -1
- package/internal/components/dropdown/dropdown-fit-handler.js +1 -1
- package/internal/components/dropdown/dropdown-fit-handler.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/prompt-input/interfaces.d.ts +8 -0
- package/prompt-input/interfaces.d.ts.map +1 -1
- package/prompt-input/interfaces.js.map +1 -1
- package/prompt-input/internal.d.ts.map +1 -1
- package/prompt-input/internal.js +4 -0
- package/prompt-input/internal.js.map +1 -1
- package/select/parts/plain-list.d.ts.map +1 -1
- package/select/parts/plain-list.js +6 -2
- package/select/parts/plain-list.js.map +1 -1
- package/tabs/index.d.ts +1 -1
- package/tabs/index.d.ts.map +1 -1
- package/tabs/index.js +25 -7
- package/tabs/index.js.map +1 -1
- package/tabs/interfaces.d.ts +28 -0
- package/tabs/interfaces.d.ts.map +1 -1
- package/tabs/interfaces.js.map +1 -1
- package/tabs/styles.css.js +30 -28
- package/tabs/styles.scoped.css +64 -49
- package/tabs/styles.selectors.js +30 -28
- package/tabs/tab-header-bar.d.ts +3 -1
- package/tabs/tab-header-bar.d.ts.map +1 -1
- package/tabs/tab-header-bar.js +26 -12
- package/tabs/tab-header-bar.js.map +1 -1
- package/test-utils/dom/tabs/index.d.ts +1 -0
- package/test-utils/dom/tabs/index.js +3 -0
- package/test-utils/dom/tabs/index.js.map +1 -1
- package/test-utils/selectors/tabs/index.d.ts +1 -0
- package/test-utils/selectors/tabs/index.js +3 -0
- package/test-utils/selectors/tabs/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
package/tabs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TabsProps } from './interfaces';
|
|
3
3
|
export { TabsProps };
|
|
4
|
-
export default function Tabs({ tabs, variant, onChange, activeTabId: controlledTabId, ariaLabel, ariaLabelledby, disableContentPaddings, i18nStrings, fitHeight, ...rest }: TabsProps): JSX.Element;
|
|
4
|
+
export default function Tabs({ tabs, variant, onChange, activeTabId: controlledTabId, ariaLabel, ariaLabelledby, disableContentPaddings, i18nStrings, fitHeight, keyboardActivationMode, actions, ...rest }: TabsProps): JSX.Element;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/tabs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tabs/index.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMzC,OAAO,EAAE,SAAS,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tabs/index.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMzC,OAAO,EAAE,SAAS,EAAE,CAAC;AAsBrB,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAC3B,IAAI,EACJ,OAAmB,EACnB,QAAQ,EACR,WAAW,EAAE,eAAe,EAC5B,SAAS,EACT,cAAc,EACd,sBAA8B,EAC9B,WAAW,EACX,SAAS,EACT,sBAAoC,EACpC,OAAO,EACP,GAAG,IAAI,EACR,EAAE,SAAS,eAkIX"}
|
package/tabs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { useRef } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
7
7
|
import InternalContainer from '../container/internal';
|
|
@@ -22,17 +22,31 @@ function firstEnabledTab(tabs) {
|
|
|
22
22
|
}
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
|
+
function shouldRenderTabContent(tab, viewedTabs) {
|
|
26
|
+
switch (tab.contentRenderStrategy) {
|
|
27
|
+
case 'active':
|
|
28
|
+
return false; // rendering active tab is handled directly in component
|
|
29
|
+
case 'eager':
|
|
30
|
+
return true;
|
|
31
|
+
case 'lazy':
|
|
32
|
+
return viewedTabs.has(tab.id);
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
25
36
|
export default function Tabs(_a) {
|
|
26
37
|
var _b, _c;
|
|
27
|
-
var { tabs, variant = 'default', onChange, activeTabId: controlledTabId, ariaLabel, ariaLabelledby, disableContentPaddings = false, i18nStrings, fitHeight } = _a, rest = __rest(_a, ["tabs", "variant", "onChange", "activeTabId", "ariaLabel", "ariaLabelledby", "disableContentPaddings", "i18nStrings", "fitHeight"]);
|
|
38
|
+
var { tabs, variant = 'default', onChange, activeTabId: controlledTabId, ariaLabel, ariaLabelledby, disableContentPaddings = false, i18nStrings, fitHeight, keyboardActivationMode = 'automatic', actions } = _a, rest = __rest(_a, ["tabs", "variant", "onChange", "activeTabId", "ariaLabel", "ariaLabelledby", "disableContentPaddings", "i18nStrings", "fitHeight", "keyboardActivationMode", "actions"]);
|
|
28
39
|
for (const tab of tabs) {
|
|
29
40
|
checkSafeUrl('Tabs', tab.href);
|
|
30
41
|
}
|
|
31
42
|
const { __internalRootRef } = useBaseComponent('Tabs', {
|
|
32
|
-
props: { disableContentPaddings, variant, fitHeight },
|
|
43
|
+
props: { disableContentPaddings, variant, fitHeight, keyboardActivationMode },
|
|
33
44
|
metadata: {
|
|
34
45
|
hasActions: tabs.some(tab => !!tab.action),
|
|
46
|
+
hasHeaderActions: !!actions,
|
|
35
47
|
hasDisabledReasons: tabs.some(tab => !!tab.disabledReason),
|
|
48
|
+
hasEagerLoadedTabs: tabs.some(tab => tab.contentRenderStrategy === 'eager'),
|
|
49
|
+
hasLazyLoadedTabs: tabs.some(tab => tab.contentRenderStrategy === 'lazy'),
|
|
36
50
|
},
|
|
37
51
|
});
|
|
38
52
|
const idNamespace = useUniqueId('awsui-tabs-');
|
|
@@ -41,6 +55,10 @@ export default function Tabs(_a) {
|
|
|
41
55
|
controlledProp: 'activeTabId',
|
|
42
56
|
changeHandler: 'onChange',
|
|
43
57
|
});
|
|
58
|
+
const viewedTabs = useRef(new Set());
|
|
59
|
+
if (activeTabId !== undefined) {
|
|
60
|
+
viewedTabs.current.add(activeTabId);
|
|
61
|
+
}
|
|
44
62
|
const baseProps = getBaseProps(rest);
|
|
45
63
|
const analyticsComponentMetadata = {
|
|
46
64
|
name: 'awsui.Tabs',
|
|
@@ -70,8 +88,8 @@ export default function Tabs(_a) {
|
|
|
70
88
|
tabIndex: 0,
|
|
71
89
|
'aria-labelledby': getTabElementId({ namespace: idNamespace, tabId: tab.id }),
|
|
72
90
|
};
|
|
73
|
-
const isContentShown =
|
|
74
|
-
return React.createElement("div", Object.assign({}, contentAttributes), isContentShown &&
|
|
91
|
+
const isContentShown = !tab.disabled && (isTabSelected || shouldRenderTabContent(tab, viewedTabs.current));
|
|
92
|
+
return React.createElement("div", Object.assign({}, contentAttributes), isContentShown && tab.content);
|
|
75
93
|
};
|
|
76
94
|
return (React.createElement("div", { className: clsx(variant === 'container' || variant === 'stacked'
|
|
77
95
|
? styles['tabs-container-content-wrapper']
|
|
@@ -79,10 +97,10 @@ export default function Tabs(_a) {
|
|
|
79
97
|
[styles['with-paddings']]: !disableContentPaddings,
|
|
80
98
|
}) }, tabs.map(renderContent)));
|
|
81
99
|
};
|
|
82
|
-
const header = (React.createElement(TabHeaderBar, { activeTabId: activeTabId, variant: variant, idNamespace: idNamespace, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, tabs: tabs, onChange: changeDetail => {
|
|
100
|
+
const header = (React.createElement(TabHeaderBar, { activeTabId: activeTabId, variant: variant, idNamespace: idNamespace, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, tabs: tabs, actions: actions, onChange: changeDetail => {
|
|
83
101
|
setActiveTabId(changeDetail.activeTabId);
|
|
84
102
|
fireNonCancelableEvent(onChange, changeDetail);
|
|
85
|
-
}, i18nStrings: i18nStrings }));
|
|
103
|
+
}, i18nStrings: i18nStrings, keyboardActivationMode: keyboardActivationMode }));
|
|
86
104
|
if (variant === 'container' || variant === 'stacked') {
|
|
87
105
|
return (React.createElement(InternalContainer, Object.assign({ header: header, disableHeaderPaddings: true }, baseProps, { className: clsx(baseProps.className, styles.root), __internalRootRef: __internalRootRef, disableContentPaddings: true, variant: variant === 'stacked' ? 'stacked' : 'default', fitHeight: fitHeight }, getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })), content()));
|
|
88
106
|
}
|
package/tabs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tabs/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,iBAAiB,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAA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AW,EAAE,WAAW,GACxB,CACH,CAAC;IAEF,IAAI,OAAO,KAAK,WAAW,IAAI,OAAO,KAAK,SAAS,EAAE;QACpD,OAAO,CACL,oBAAC,iBAAiB,kBAChB,MAAM,EAAE,MAAM,EACd,qBAAqB,EAAE,IAAI,IACvB,SAAS,IACb,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,EACjD,iBAAiB,EAAE,iBAAiB,EACpC,sBAAsB,EAAE,IAAI,EAC5B,OAAO,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EACtD,SAAS,EAAE,SAAS,IAChB,6BAA6B,CAAC,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC,GAE3E,OAAO,EAAE,CACQ,CACrB,CAAC;KACH;IAED,OAAO,CACL,6CACM,SAAS,IACb,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EACrG,GAAG,EAAE,iBAAiB,IAClB,6BAA6B,CAAC,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC;QAE3E,MAAM;QACN,OAAO,EAAE,CACN,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,IAAI,EAAE,MAAM,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 { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalContainer from '../container/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport { GeneratedAnalyticsMetadataTabsComponent } from './analytics-metadata/interfaces';\nimport { TabsProps } from './interfaces';\nimport { getTabElementId, TabHeaderBar } from './tab-header-bar';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nexport { TabsProps };\n\nfunction firstEnabledTab(tabs: ReadonlyArray<TabsProps.Tab>) {\n const enabledTabs = tabs.filter(tab => !tab.disabled);\n if (enabledTabs.length > 0) {\n return enabledTabs[0];\n }\n return null;\n}\n\nexport default function Tabs({\n tabs,\n variant = 'default',\n onChange,\n activeTabId: controlledTabId,\n ariaLabel,\n ariaLabelledby,\n disableContentPaddings = false,\n i18nStrings,\n fitHeight,\n ...rest\n}: TabsProps) {\n for (const tab of tabs) {\n checkSafeUrl('Tabs', tab.href);\n }\n const { __internalRootRef } = useBaseComponent('Tabs', {\n props: { disableContentPaddings, variant, fitHeight },\n metadata: {\n hasActions: tabs.some(tab => !!tab.action),\n hasDisabledReasons: tabs.some(tab => !!tab.disabledReason),\n },\n });\n const idNamespace = useUniqueId('awsui-tabs-');\n\n const [activeTabId, setActiveTabId] = useControllable(controlledTabId, onChange, firstEnabledTab(tabs)?.id ?? '', {\n componentName: 'Tabs',\n controlledProp: 'activeTabId',\n changeHandler: 'onChange',\n });\n\n const baseProps = getBaseProps(rest);\n\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataTabsComponent = {\n name: 'awsui.Tabs',\n label: `.${analyticsSelectors['tabs-header-list']}`,\n };\n\n if (activeTabId) {\n analyticsComponentMetadata.properties = {\n activeTabId,\n activeTabLabel: `.${analyticsSelectors['active-tab-header']} .${analyticsSelectors['tab-label']}`,\n activeTabPosition: `${tabs.findIndex(tab => tab.id === activeTabId) + 1}`,\n tabsCount: `${tabs.length}`,\n };\n }\n\n const content = () => {\n const selectedTab = tabs.filter(tab => tab.id === activeTabId)[0];\n const renderContent = (tab: TabsProps.Tab) => {\n const isTabSelected = tab === selectedTab;\n\n const classes = clsx({\n [styles['tabs-content']]: true,\n [styles['tabs-content-active']]: isTabSelected,\n });\n\n const contentAttributes: JSX.IntrinsicElements['div'] = {\n className: classes,\n role: 'tabpanel',\n id: `${idNamespace}-${tab.id}-panel`,\n key: `${idNamespace}-${tab.id}-panel`,\n tabIndex: 0,\n 'aria-labelledby': getTabElementId({ namespace: idNamespace, tabId: tab.id }),\n };\n\n const isContentShown = isTabSelected && !selectedTab.disabled;\n return <div {...contentAttributes}>{isContentShown && selectedTab.content}</div>;\n };\n\n return (\n <div\n className={clsx(\n variant === 'container' || variant === 'stacked'\n ? styles['tabs-container-content-wrapper']\n : styles['tabs-content-wrapper'],\n {\n [styles['with-paddings']]: !disableContentPaddings,\n }\n )}\n >\n {tabs.map(renderContent)}\n </div>\n );\n };\n\n const header = (\n <TabHeaderBar\n activeTabId={activeTabId}\n variant={variant}\n idNamespace={idNamespace}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n tabs={tabs}\n onChange={changeDetail => {\n setActiveTabId(changeDetail.activeTabId);\n fireNonCancelableEvent(onChange, changeDetail);\n }}\n i18nStrings={i18nStrings}\n />\n );\n\n if (variant === 'container' || variant === 'stacked') {\n return (\n <InternalContainer\n header={header}\n disableHeaderPaddings={true}\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n __internalRootRef={__internalRootRef}\n disableContentPaddings={true}\n variant={variant === 'stacked' ? 'stacked' : 'default'}\n fitHeight={fitHeight}\n {...getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })}\n >\n {content()}\n </InternalContainer>\n );\n }\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root, styles.tabs, { [styles['fit-height']]: fitHeight })}\n ref={__internalRootRef}\n {...getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })}\n >\n {header}\n {content()}\n </div>\n );\n}\n\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SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalContainer from '../container/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport { GeneratedAnalyticsMetadataTabsComponent } from './analytics-metadata/interfaces';\nimport { TabsProps } from './interfaces';\nimport { getTabElementId, TabHeaderBar } from './tab-header-bar';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nexport { TabsProps };\n\nfunction firstEnabledTab(tabs: ReadonlyArray<TabsProps.Tab>) {\n const enabledTabs = tabs.filter(tab => !tab.disabled);\n if (enabledTabs.length > 0) {\n return enabledTabs[0];\n }\n return null;\n}\n\nfunction shouldRenderTabContent(tab: TabsProps.Tab, viewedTabs: Set<string>) {\n switch (tab.contentRenderStrategy) {\n case 'active':\n return false; // rendering active tab is handled directly in component\n case 'eager':\n return true;\n case 'lazy':\n return viewedTabs.has(tab.id);\n }\n return false;\n}\n\nexport default function Tabs({\n tabs,\n variant = 'default',\n onChange,\n activeTabId: controlledTabId,\n ariaLabel,\n ariaLabelledby,\n disableContentPaddings = false,\n i18nStrings,\n fitHeight,\n keyboardActivationMode = 'automatic',\n actions,\n ...rest\n}: TabsProps) {\n for (const tab of tabs) {\n checkSafeUrl('Tabs', tab.href);\n }\n const { __internalRootRef } = useBaseComponent('Tabs', {\n props: { disableContentPaddings, variant, fitHeight, keyboardActivationMode },\n metadata: {\n hasActions: tabs.some(tab => !!tab.action),\n hasHeaderActions: !!actions,\n hasDisabledReasons: tabs.some(tab => !!tab.disabledReason),\n hasEagerLoadedTabs: tabs.some(tab => tab.contentRenderStrategy === 'eager'),\n hasLazyLoadedTabs: tabs.some(tab => tab.contentRenderStrategy === 'lazy'),\n },\n });\n const idNamespace = useUniqueId('awsui-tabs-');\n\n const [activeTabId, setActiveTabId] = useControllable(controlledTabId, onChange, firstEnabledTab(tabs)?.id ?? '', {\n componentName: 'Tabs',\n controlledProp: 'activeTabId',\n changeHandler: 'onChange',\n });\n\n const viewedTabs = useRef(new Set<string>());\n if (activeTabId !== undefined) {\n viewedTabs.current.add(activeTabId);\n }\n\n const baseProps = getBaseProps(rest);\n\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataTabsComponent = {\n name: 'awsui.Tabs',\n label: `.${analyticsSelectors['tabs-header-list']}`,\n };\n\n if (activeTabId) {\n analyticsComponentMetadata.properties = {\n activeTabId,\n activeTabLabel: `.${analyticsSelectors['active-tab-header']} .${analyticsSelectors['tab-label']}`,\n activeTabPosition: `${tabs.findIndex(tab => tab.id === activeTabId) + 1}`,\n tabsCount: `${tabs.length}`,\n };\n }\n\n const content = () => {\n const selectedTab = tabs.filter(tab => tab.id === activeTabId)[0];\n const renderContent = (tab: TabsProps.Tab) => {\n const isTabSelected = tab === selectedTab;\n\n const classes = clsx({\n [styles['tabs-content']]: true,\n [styles['tabs-content-active']]: isTabSelected,\n });\n\n const contentAttributes: JSX.IntrinsicElements['div'] = {\n className: classes,\n role: 'tabpanel',\n id: `${idNamespace}-${tab.id}-panel`,\n key: `${idNamespace}-${tab.id}-panel`,\n tabIndex: 0,\n 'aria-labelledby': getTabElementId({ namespace: idNamespace, tabId: tab.id }),\n };\n\n const isContentShown = !tab.disabled && (isTabSelected || shouldRenderTabContent(tab, viewedTabs.current));\n\n return <div {...contentAttributes}>{isContentShown && tab.content}</div>;\n };\n\n return (\n <div\n className={clsx(\n variant === 'container' || variant === 'stacked'\n ? styles['tabs-container-content-wrapper']\n : styles['tabs-content-wrapper'],\n {\n [styles['with-paddings']]: !disableContentPaddings,\n }\n )}\n >\n {tabs.map(renderContent)}\n </div>\n );\n };\n\n const header = (\n <TabHeaderBar\n activeTabId={activeTabId}\n variant={variant}\n idNamespace={idNamespace}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n tabs={tabs}\n actions={actions}\n onChange={changeDetail => {\n setActiveTabId(changeDetail.activeTabId);\n fireNonCancelableEvent(onChange, changeDetail);\n }}\n i18nStrings={i18nStrings}\n keyboardActivationMode={keyboardActivationMode}\n />\n );\n\n if (variant === 'container' || variant === 'stacked') {\n return (\n <InternalContainer\n header={header}\n disableHeaderPaddings={true}\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n __internalRootRef={__internalRootRef}\n disableContentPaddings={true}\n variant={variant === 'stacked' ? 'stacked' : 'default'}\n fitHeight={fitHeight}\n {...getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })}\n >\n {content()}\n </InternalContainer>\n );\n }\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root, styles.tabs, { [styles['fit-height']]: fitHeight })}\n ref={__internalRootRef}\n {...getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })}\n >\n {header}\n {content()}\n </div>\n );\n}\n\napplyDisplayName(Tabs, 'Tabs');\n"]}
|
package/tabs/interfaces.d.ts
CHANGED
|
@@ -23,8 +23,19 @@ export interface TabsProps extends BaseComponentProps {
|
|
|
23
23
|
* ALT, SHIFT, META). This enables the user to open new browser tabs with an initially selected component tab,
|
|
24
24
|
* if your application routing can handle such deep links. You can manually update routing on the current page
|
|
25
25
|
* using the `activeTabHref` property of the `change` event's detail.
|
|
26
|
+
* - `contentRenderStrategy` (string) - (Optional) Determines when tab content is rendered:
|
|
27
|
+
- `'active'`: (Default) Only render content when the tab is active.
|
|
28
|
+
* - `'eager'`: Always render tab content (hidden when the tab is not active).
|
|
29
|
+
* - `'lazy'`: Like 'eager', but content is only rendered after the tab is first activated.
|
|
26
30
|
*/
|
|
27
31
|
tabs: ReadonlyArray<TabsProps.Tab>;
|
|
32
|
+
/**
|
|
33
|
+
* Actions for the tabs header, displayed next to the list of tabs.
|
|
34
|
+
* Use this to add a button or button dropdown that performs actions on the
|
|
35
|
+
* entire tab list. We recommend a maximum of one interactive element to
|
|
36
|
+
* minimize the number of keyboard tab stops between the tab list and content.
|
|
37
|
+
*/
|
|
38
|
+
actions?: React.ReactNode;
|
|
28
39
|
/**
|
|
29
40
|
* The possible visual variants of tabs are the following:
|
|
30
41
|
* * `default` - Use in any context.
|
|
@@ -69,6 +80,16 @@ export interface TabsProps extends BaseComponentProps {
|
|
|
69
80
|
* If the tab content is too short, it will stretch. If the tab content is too long, a vertical scrollbar will be shown.
|
|
70
81
|
*/
|
|
71
82
|
fitHeight?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Determines how the active tab is switched when navigating using
|
|
85
|
+
* the keyboard. The options are:
|
|
86
|
+
* - 'automatic' (default): the active tab is switched using the arrow keys.
|
|
87
|
+
* - 'manual': a tab must be explicitly activated using the enter/space key.
|
|
88
|
+
* We recommend using 'automatic' in most situations to provide consistent
|
|
89
|
+
* and quick switching between tabs. Use 'manual' only if there is a specific
|
|
90
|
+
* need to introduce friction to the switching of tabs.
|
|
91
|
+
*/
|
|
92
|
+
keyboardActivationMode?: 'automatic' | 'manual';
|
|
72
93
|
}
|
|
73
94
|
export declare namespace TabsProps {
|
|
74
95
|
type Variant = 'default' | 'container' | 'stacked';
|
|
@@ -124,6 +145,13 @@ export declare namespace TabsProps {
|
|
|
124
145
|
* using the `activeTabHref` property of the `change` event's detail.
|
|
125
146
|
*/
|
|
126
147
|
href?: string;
|
|
148
|
+
/**
|
|
149
|
+
* Determines when tab content is rendered:
|
|
150
|
+
* - 'active' (default): Only render content when the tab is active.
|
|
151
|
+
* - 'eager': Always render tab content (hidden when the tab is not active).
|
|
152
|
+
* - 'lazy': Like 'eager', but content is only rendered after the tab is first activated.
|
|
153
|
+
*/
|
|
154
|
+
contentRenderStrategy?: 'active' | 'eager' | 'lazy';
|
|
127
155
|
}
|
|
128
156
|
interface ChangeDetail {
|
|
129
157
|
/**
|
package/tabs/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/tabs/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,SAAU,SAAQ,kBAAkB;IACnD
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/tabs/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,SAAU,SAAQ,kBAAkB;IACnD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAEnC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC;IAE5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAE7D;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;OAGG;IACH,WAAW,CAAC,EAAE,SAA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/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/tabs/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonProps } from '../button/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface TabsProps extends BaseComponentProps {\n /**\n * Specifies the tabs to display. Each tab object has the following properties:\n *\n * - `id` (string) - The tab identifier. This value needs to be passed to the Tabs component as `activeTabId` to select this tab.\n * - `label` (ReactNode) - Tab label shown in the UI.\n * - `content` (ReactNode) - (Optional) Tab content to render in the container.\n * - `disabled` (boolean) - (Optional) Specifies if this tab is disabled.\n * - `disabledReason` (string) - (Optional) Displays tooltip near the tab when disabled. Use to provide additional context.\n * - `dismissible` (boolean) - (Optional) Determines whether the tab includes a dismiss icon button. By default, the dismiss button is not included.\n * - `dismissLabel` (boolean) - (Optional) Specifies an aria-label for the dismiss icon button.\n * - `dismissDisabled` (boolean) - (Optional) Determines whether the dismiss button is disabled.\n * - `action` (ReactNode) - (Optional) Action for the tab, rendered next to its corresponding label.\n * Although it is technically possible to insert any content, our UX guidelines only allow you to add\n * an icon button or icon button dropdown.\n * - `onDismiss` (ButtonProps['onClick']) - (Optional) Called when a user clicks on the dismiss button.\n * - `href` (string) - (Optional) You can use this parameter to change the default `href` of the internal tab anchor. The\n * `click` event default behavior is prevented, unless the user clicks the tab with a key modifier (that is, CTRL,\n * ALT, SHIFT, META). This enables the user to open new browser tabs with an initially selected component tab,\n * if your application routing can handle such deep links. You can manually update routing on the current page\n * using the `activeTabHref` property of the `change` event's detail.\n */\n tabs: ReadonlyArray<TabsProps.Tab>;\n\n /**\n * The possible visual variants of tabs are the following:\n * * `default` - Use in any context.\n * * `container` - Use this variant to have the tabs displayed within a container header.\n * * `stacked` - Use this variant directly adjacent to other stacked containers (such as a container, table).\n * @visualrefresh `stacked` variant\n */\n variant?: TabsProps.Variant;\n\n /**\n * Called whenever the user selects a different tab.\n * The event's `detail` contains the new `activeTabId`.\n */\n onChange?: NonCancelableEventHandler<TabsProps.ChangeDetail>;\n\n /**\n * The `id` of the currently active tab.\n * * If you don't set this property, the component activates the first tab and switches tabs automatically when a tab header is clicked (that is, uncontrolled behavior).\n * * If you explicitly set this property, you must set define an `onChange` handler to update the property when a tab header is clicked (that is, controlled behavior).\n */\n activeTabId?: string;\n\n /**\n * Provides an `aria-label` to the tab container.\n * Don't use `ariaLabel` and `ariaLabelledby` at the same time.\n */\n ariaLabel?: string;\n\n /**\n * Sets the `aria-labelledby` property on the tab container.\n * If there's a visible label element that you can reference, use this instead of `ariaLabel`.\n * Don't use `ariaLabel` and `ariaLabelledby` at the same time.\n */\n ariaLabelledby?: string;\n\n /**\n * Determines whether the tab content has padding. If `true`, removes the default padding from the tab content area.\n */\n disableContentPaddings?: boolean;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: TabsProps.I18nStrings;\n /**\n * Enabling this property makes the tab content fit to the available height.\n * If the tab content is too short, it will stretch. If the tab content is too long, a vertical scrollbar will be shown.\n */\n fitHeight?: boolean;\n}\nexport namespace TabsProps {\n export type Variant = 'default' | 'container' | 'stacked';\n\n export interface Tab {\n /**\n * The tab id. This value will be need to be passed to the Tabs component as `activeTabId` to select this tab.\n */\n id: string;\n /**\n * Tab label shown in the UI.\n */\n label: React.ReactNode;\n /**\n * Tab content to render in the container.\n */\n content?: React.ReactNode;\n /**\n * Whether this tab is disabled.\n */\n disabled?: boolean;\n /**\n * Provides a reason why this tab is disabled.\n */\n disabledReason?: string;\n /**\n * (Optional) Determines whether the tab includes a dismiss icon button. By default, the dismiss button is not included.\n * When a user clicks on this button the onDismiss handler is called.\n */\n dismissible?: boolean;\n /**\n * (Optional) Specifies an aria-label for the dismiss icon button.\n */\n dismissLabel?: string;\n /**\n * (Optional) Determines whether the dismiss button is disabled.\n */\n dismissDisabled?: boolean;\n /**\n * (Optional) Action for the tab, rendered next to its corresponding label.\n * Although it is technically possible to insert any content, our UX guidelines only allow you to add\n * an icon button or icon button dropdown.\n */\n action?: React.ReactNode;\n /**\n * (event => void) Called when a user clicks on the dismiss button.\n */\n onDismiss?: ButtonProps['onClick'];\n /**\n * You can use this parameter to change the default `href` of the internal tab anchor. The\n * `click` event default behavior is prevented, unless the user clicks the tab with a key modifier (CTRL,\n * ALT, SHIFT, META). This allows to open new browser tabs with an initially selected component tab,\n * when the routing can handle such deep links. You can manually update routing on the current page\n * using the `activeTabHref` property of the `change` event's detail.\n */\n href?: string;\n }\n\n export interface ChangeDetail {\n /**\n * The ID of the clicked tab.\n */\n activeTabId: string;\n /**\n * The `href` attribute of the clicked tab, if defined.\n */\n activeTabHref?: string;\n }\n\n export interface I18nStrings {\n /**\n * ARIA label for the scroll left button that appears when the tab header is wider than the container.\n */\n scrollLeftAriaLabel?: string;\n /**\n * ARIA label for the scroll right button that appears when the tab header is wider than the container.\n */\n scrollRightAriaLabel?: string;\n /**\n * ARIA role description for the Tabs component when an action or dismissible prop is in use. This is used\n * with role=\"application\" to provide further information on the purpose of this component\n */\n tabsWithActionsAriaRoleDescription?: string;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/tabs/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonProps } from '../button/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface TabsProps extends BaseComponentProps {\n /**\n * Specifies the tabs to display. Each tab object has the following properties:\n *\n * - `id` (string) - The tab identifier. This value needs to be passed to the Tabs component as `activeTabId` to select this tab.\n * - `label` (ReactNode) - Tab label shown in the UI.\n * - `content` (ReactNode) - (Optional) Tab content to render in the container.\n * - `disabled` (boolean) - (Optional) Specifies if this tab is disabled.\n * - `disabledReason` (string) - (Optional) Displays tooltip near the tab when disabled. Use to provide additional context.\n * - `dismissible` (boolean) - (Optional) Determines whether the tab includes a dismiss icon button. By default, the dismiss button is not included.\n * - `dismissLabel` (boolean) - (Optional) Specifies an aria-label for the dismiss icon button.\n * - `dismissDisabled` (boolean) - (Optional) Determines whether the dismiss button is disabled.\n * - `action` (ReactNode) - (Optional) Action for the tab, rendered next to its corresponding label.\n * Although it is technically possible to insert any content, our UX guidelines only allow you to add\n * an icon button or icon button dropdown.\n * - `onDismiss` (ButtonProps['onClick']) - (Optional) Called when a user clicks on the dismiss button.\n * - `href` (string) - (Optional) You can use this parameter to change the default `href` of the internal tab anchor. The\n * `click` event default behavior is prevented, unless the user clicks the tab with a key modifier (that is, CTRL,\n * ALT, SHIFT, META). This enables the user to open new browser tabs with an initially selected component tab,\n * if your application routing can handle such deep links. You can manually update routing on the current page\n * using the `activeTabHref` property of the `change` event's detail.\n * - `contentRenderStrategy` (string) - (Optional) Determines when tab content is rendered:\n - `'active'`: (Default) Only render content when the tab is active.\n * - `'eager'`: Always render tab content (hidden when the tab is not active).\n * - `'lazy'`: Like 'eager', but content is only rendered after the tab is first activated.\n */\n tabs: ReadonlyArray<TabsProps.Tab>;\n\n /**\n * Actions for the tabs header, displayed next to the list of tabs.\n * Use this to add a button or button dropdown that performs actions on the\n * entire tab list. We recommend a maximum of one interactive element to\n * minimize the number of keyboard tab stops between the tab list and content.\n */\n actions?: React.ReactNode;\n\n /**\n * The possible visual variants of tabs are the following:\n * * `default` - Use in any context.\n * * `container` - Use this variant to have the tabs displayed within a container header.\n * * `stacked` - Use this variant directly adjacent to other stacked containers (such as a container, table).\n * @visualrefresh `stacked` variant\n */\n variant?: TabsProps.Variant;\n\n /**\n * Called whenever the user selects a different tab.\n * The event's `detail` contains the new `activeTabId`.\n */\n onChange?: NonCancelableEventHandler<TabsProps.ChangeDetail>;\n\n /**\n * The `id` of the currently active tab.\n * * If you don't set this property, the component activates the first tab and switches tabs automatically when a tab header is clicked (that is, uncontrolled behavior).\n * * If you explicitly set this property, you must set define an `onChange` handler to update the property when a tab header is clicked (that is, controlled behavior).\n */\n activeTabId?: string;\n\n /**\n * Provides an `aria-label` to the tab container.\n * Don't use `ariaLabel` and `ariaLabelledby` at the same time.\n */\n ariaLabel?: string;\n\n /**\n * Sets the `aria-labelledby` property on the tab container.\n * If there's a visible label element that you can reference, use this instead of `ariaLabel`.\n * Don't use `ariaLabel` and `ariaLabelledby` at the same time.\n */\n ariaLabelledby?: string;\n\n /**\n * Determines whether the tab content has padding. If `true`, removes the default padding from the tab content area.\n */\n disableContentPaddings?: boolean;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: TabsProps.I18nStrings;\n /**\n * Enabling this property makes the tab content fit to the available height.\n * If the tab content is too short, it will stretch. If the tab content is too long, a vertical scrollbar will be shown.\n */\n fitHeight?: boolean;\n /**\n * Determines how the active tab is switched when navigating using\n * the keyboard. The options are:\n * - 'automatic' (default): the active tab is switched using the arrow keys.\n * - 'manual': a tab must be explicitly activated using the enter/space key.\n * We recommend using 'automatic' in most situations to provide consistent\n * and quick switching between tabs. Use 'manual' only if there is a specific\n * need to introduce friction to the switching of tabs.\n */\n keyboardActivationMode?: 'automatic' | 'manual';\n}\nexport namespace TabsProps {\n export type Variant = 'default' | 'container' | 'stacked';\n\n export interface Tab {\n /**\n * The tab id. This value will be need to be passed to the Tabs component as `activeTabId` to select this tab.\n */\n id: string;\n /**\n * Tab label shown in the UI.\n */\n label: React.ReactNode;\n /**\n * Tab content to render in the container.\n */\n content?: React.ReactNode;\n /**\n * Whether this tab is disabled.\n */\n disabled?: boolean;\n /**\n * Provides a reason why this tab is disabled.\n */\n disabledReason?: string;\n /**\n * (Optional) Determines whether the tab includes a dismiss icon button. By default, the dismiss button is not included.\n * When a user clicks on this button the onDismiss handler is called.\n */\n dismissible?: boolean;\n /**\n * (Optional) Specifies an aria-label for the dismiss icon button.\n */\n dismissLabel?: string;\n /**\n * (Optional) Determines whether the dismiss button is disabled.\n */\n dismissDisabled?: boolean;\n /**\n * (Optional) Action for the tab, rendered next to its corresponding label.\n * Although it is technically possible to insert any content, our UX guidelines only allow you to add\n * an icon button or icon button dropdown.\n */\n action?: React.ReactNode;\n /**\n * (event => void) Called when a user clicks on the dismiss button.\n */\n onDismiss?: ButtonProps['onClick'];\n /**\n * You can use this parameter to change the default `href` of the internal tab anchor. The\n * `click` event default behavior is prevented, unless the user clicks the tab with a key modifier (CTRL,\n * ALT, SHIFT, META). This allows to open new browser tabs with an initially selected component tab,\n * when the routing can handle such deep links. You can manually update routing on the current page\n * using the `activeTabHref` property of the `change` event's detail.\n */\n href?: string;\n /**\n * Determines when tab content is rendered:\n * - 'active' (default): Only render content when the tab is active.\n * - 'eager': Always render tab content (hidden when the tab is not active).\n * - 'lazy': Like 'eager', but content is only rendered after the tab is first activated.\n */\n contentRenderStrategy?: 'active' | 'eager' | 'lazy';\n }\n\n export interface ChangeDetail {\n /**\n * The ID of the clicked tab.\n */\n activeTabId: string;\n /**\n * The `href` attribute of the clicked tab, if defined.\n */\n activeTabHref?: string;\n }\n\n export interface I18nStrings {\n /**\n * ARIA label for the scroll left button that appears when the tab header is wider than the container.\n */\n scrollLeftAriaLabel?: string;\n /**\n * ARIA label for the scroll right button that appears when the tab header is wider than the container.\n */\n scrollRightAriaLabel?: string;\n /**\n * ARIA role description for the Tabs component when an action or dismissible prop is in use. This is used\n * with role=\"application\" to provide further information on the purpose of this component\n */\n tabsWithActionsAriaRoleDescription?: string;\n }\n}\n"]}
|
package/tabs/styles.css.js
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"tabs-header": "awsui_tabs-
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"pagination-button
|
|
8
|
-
"pagination-button-left
|
|
9
|
-
"pagination-button-
|
|
10
|
-
"pagination-button-right
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"tabs-tab
|
|
14
|
-
"tabs-tab-
|
|
15
|
-
"tabs-tab-
|
|
16
|
-
"
|
|
17
|
-
"tabs-tab-
|
|
18
|
-
"
|
|
19
|
-
"tabs-tab-
|
|
20
|
-
"tabs-
|
|
21
|
-
"tabs-tab-
|
|
22
|
-
"
|
|
23
|
-
"tabs": "
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"tabs-content
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"tabs-
|
|
30
|
-
"
|
|
31
|
-
"tabs-
|
|
4
|
+
"tabs-header": "awsui_tabs-header_14rmt_11l2w_290",
|
|
5
|
+
"tab-header-scroll-container": "awsui_tab-header-scroll-container_14rmt_11l2w_299",
|
|
6
|
+
"tabs-header-list": "awsui_tabs-header-list_14rmt_11l2w_305",
|
|
7
|
+
"pagination-button": "awsui_pagination-button_14rmt_11l2w_323",
|
|
8
|
+
"pagination-button-left": "awsui_pagination-button-left_14rmt_11l2w_330",
|
|
9
|
+
"pagination-button-left-scrollable": "awsui_pagination-button-left-scrollable_14rmt_11l2w_333",
|
|
10
|
+
"pagination-button-right": "awsui_pagination-button-right_14rmt_11l2w_337",
|
|
11
|
+
"pagination-button-right-scrollable": "awsui_pagination-button-right-scrollable_14rmt_11l2w_340",
|
|
12
|
+
"actions-container": "awsui_actions-container_14rmt_11l2w_345",
|
|
13
|
+
"tabs-tab": "awsui_tabs-tab_14rmt_11l2w_353",
|
|
14
|
+
"tabs-tab-label": "awsui_tabs-tab-label_14rmt_11l2w_363",
|
|
15
|
+
"tabs-tab-header-container": "awsui_tabs-tab-header-container_14rmt_11l2w_374",
|
|
16
|
+
"tabs-tab-dismiss": "awsui_tabs-tab-dismiss_14rmt_11l2w_385",
|
|
17
|
+
"tabs-tab-action": "awsui_tabs-tab-action_14rmt_11l2w_385",
|
|
18
|
+
"refresh": "awsui_refresh_14rmt_11l2w_390",
|
|
19
|
+
"tabs-tab-disabled": "awsui_tabs-tab-disabled_14rmt_11l2w_394",
|
|
20
|
+
"tabs-tab-link": "awsui_tabs-tab-link_14rmt_11l2w_436",
|
|
21
|
+
"tabs-tab-active": "awsui_tabs-tab-active_14rmt_11l2w_514",
|
|
22
|
+
"tabs-header-with-divider": "awsui_tabs-header-with-divider_14rmt_11l2w_521",
|
|
23
|
+
"tabs-tab-focusable": "awsui_tabs-tab-focusable_14rmt_11l2w_525",
|
|
24
|
+
"root": "awsui_root_14rmt_11l2w_529",
|
|
25
|
+
"tabs": "awsui_tabs_14rmt_11l2w_290",
|
|
26
|
+
"tabs-content": "awsui_tabs-content_14rmt_11l2w_567",
|
|
27
|
+
"fit-height": "awsui_fit-height_14rmt_11l2w_571",
|
|
28
|
+
"tabs-content-active": "awsui_tabs-content-active_14rmt_11l2w_577",
|
|
29
|
+
"tabs-content-wrapper": "awsui_tabs-content-wrapper_14rmt_11l2w_591",
|
|
30
|
+
"with-paddings": "awsui_with-paddings_14rmt_11l2w_591",
|
|
31
|
+
"tabs-container-content-wrapper": "awsui_tabs-container-content-wrapper_14rmt_11l2w_602",
|
|
32
|
+
"disabled-reason-tooltip": "awsui_disabled-reason-tooltip_14rmt_11l2w_613",
|
|
33
|
+
"tabs-tab-focused": "awsui_tabs-tab-focused_14rmt_11l2w_617"
|
|
32
34
|
};
|
|
33
35
|
|