@cloudscape-design/components 3.0.258 → 3.0.260
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/app-layout/visual-refresh/drawers.d.ts.map +1 -1
- package/app-layout/visual-refresh/drawers.js +2 -1
- package/app-layout/visual-refresh/drawers.js.map +1 -1
- package/app-layout/visual-refresh/navigation.d.ts.map +1 -1
- package/app-layout/visual-refresh/navigation.js +3 -2
- package/app-layout/visual-refresh/navigation.js.map +1 -1
- package/app-layout/visual-refresh/styles.css.js +71 -71
- package/app-layout/visual-refresh/styles.scoped.css +212 -185
- package/app-layout/visual-refresh/styles.selectors.js +71 -71
- package/app-layout/visual-refresh/tools.d.ts.map +1 -1
- package/app-layout/visual-refresh/tools.js +3 -2
- package/app-layout/visual-refresh/tools.js.map +1 -1
- package/code-editor/index.d.ts.map +1 -1
- package/code-editor/index.js +1 -14
- package/code-editor/index.js.map +1 -1
- package/code-editor/pane.d.ts +1 -2
- package/code-editor/pane.d.ts.map +1 -1
- package/code-editor/pane.js +8 -3
- package/code-editor/pane.js.map +1 -1
- package/code-editor/status-bar.d.ts +3 -3
- package/code-editor/status-bar.d.ts.map +1 -1
- package/code-editor/status-bar.js +5 -3
- package/code-editor/status-bar.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/manifest.json +1 -1
- package/modal/internal.d.ts +1 -1
- package/modal/internal.d.ts.map +1 -1
- package/modal/internal.js +24 -15
- package/modal/internal.js.map +1 -1
- package/package.json +1 -1
- package/table/body-cell/index.d.ts +2 -1
- package/table/body-cell/index.d.ts.map +1 -1
- package/table/body-cell/index.js +9 -4
- package/table/body-cell/index.js.map +1 -1
- package/table/body-cell/inline-editor.d.ts +1 -1
- package/table/body-cell/inline-editor.d.ts.map +1 -1
- package/table/body-cell/inline-editor.js +5 -3
- package/table/body-cell/inline-editor.js.map +1 -1
- package/table/body-cell/styles.css.js +40 -18
- package/table/body-cell/styles.scoped.css +222 -52
- package/table/body-cell/styles.selectors.js +40 -18
- package/table/header-cell/index.js +1 -1
- package/table/header-cell/index.js.map +1 -1
- package/table/interfaces.d.ts +6 -0
- package/table/interfaces.d.ts.map +1 -1
- package/table/interfaces.js.map +1 -1
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +20 -18
- package/table/internal.js.map +1 -1
- package/table/selection-control/index.d.ts +2 -8
- package/table/selection-control/index.d.ts.map +1 -1
- package/table/selection-control/index.js.map +1 -1
- package/table/table-wrapper.d.ts +13 -0
- package/table/table-wrapper.d.ts.map +1 -0
- package/table/table-wrapper.js +15 -0
- package/table/table-wrapper.js.map +1 -0
- package/table/thead.d.ts +2 -2
- package/table/thead.d.ts.map +1 -1
- package/table/thead.js +3 -3
- package/table/thead.js.map +1 -1
- package/table/use-column-widths.js +1 -1
- package/table/use-column-widths.js.map +1 -1
- package/table/use-selection.d.ts +12 -18
- package/table/use-selection.d.ts.map +1 -1
- package/table/use-selection.js +20 -12
- package/table/use-selection.js.map +1 -1
- package/table/use-table-focus-navigation.d.ts.map +1 -1
- package/table/use-table-focus-navigation.js +9 -34
- package/table/use-table-focus-navigation.js.map +1 -1
- package/test-utils/dom/table/index.d.ts +3 -0
- package/test-utils/dom/table/index.js +16 -15
- package/test-utils/dom/table/index.js.map +1 -1
- package/test-utils/selectors/table/index.d.ts +3 -0
- package/test-utils/selectors/table/index.js +16 -15
- package/test-utils/selectors/table/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/table/header-cell/styles.css.js +0 -24
- package/table/header-cell/styles.scoped.css +0 -252
- package/table/header-cell/styles.selectors.js +0 -25
|
@@ -2,76 +2,76 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"appbar": "
|
|
6
|
-
"appbar-nav": "awsui_appbar-
|
|
7
|
-
"breadcrumbs": "
|
|
8
|
-
"appbar-tools": "awsui_appbar-
|
|
9
|
-
"drawers-mobile-triggers-container": "awsui_drawers-mobile-triggers-
|
|
10
|
-
"has-breadcrumbs": "awsui_has-
|
|
11
|
-
"has-notifications-content": "awsui_has-notifications-
|
|
12
|
-
"has-header": "awsui_has-
|
|
13
|
-
"has-dynamic-overlap-height": "awsui_has-dynamic-overlap-
|
|
14
|
-
"content-type-wizard": "awsui_content-type-
|
|
15
|
-
"content-type-cards": "awsui_content-type-
|
|
16
|
-
"content-type-table": "awsui_content-type-
|
|
17
|
-
"has-sticky-background": "awsui_has-sticky-
|
|
18
|
-
"background": "
|
|
19
|
-
"notifications-appbar-header": "awsui_notifications-appbar-
|
|
20
|
-
"sticky-notifications": "awsui_sticky-
|
|
21
|
-
"overlap": "
|
|
22
|
-
"drawers-container": "awsui_drawers-
|
|
23
|
-
"has-open-drawer": "awsui_has-open-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"drawer
|
|
29
|
-
"drawer-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"content-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"has-sticky-notifications": "awsui_has-sticky-
|
|
38
|
-
"has-split-panel": "awsui_has-split-
|
|
39
|
-
"split-panel-position-bottom": "awsui_split-panel-position-
|
|
40
|
-
"has-content-gap-left": "awsui_has-content-gap-
|
|
41
|
-
"has-content-gap-right": "awsui_has-content-gap-
|
|
42
|
-
"block-body-scroll": "awsui_block-body-
|
|
43
|
-
"container": "
|
|
44
|
-
"disable-content-paddings": "awsui_disable-content-
|
|
45
|
-
"is-navigation-open": "awsui_is-navigation-
|
|
46
|
-
"is-tools-open": "awsui_is-tools-
|
|
47
|
-
"is-split-panel-open": "awsui_is-split-panel-
|
|
48
|
-
"split-panel-position-side": "awsui_split-panel-position-
|
|
49
|
-
"content-type-default": "awsui_content-type-
|
|
50
|
-
"content-type-form": "awsui_content-type-
|
|
51
|
-
"unfocusable": "
|
|
52
|
-
"navigation-container": "awsui_navigation-
|
|
53
|
-
"show-navigation": "awsui_show-
|
|
54
|
-
"animating": "
|
|
55
|
-
"showButtons": "
|
|
56
|
-
"navigation": "
|
|
57
|
-
"openNavigation": "
|
|
58
|
-
"animated-content": "awsui_animated-
|
|
59
|
-
"hide-navigation": "awsui_hide-
|
|
60
|
-
"notifications": "
|
|
61
|
-
"split-panel-bottom": "awsui_split-panel-
|
|
62
|
-
"position-bottom": "awsui_position-
|
|
63
|
-
"openSplitPanelBottom": "
|
|
64
|
-
"split-panel-side": "awsui_split-panel-
|
|
65
|
-
"position-side": "awsui_position-
|
|
66
|
-
"openSplitPanelSide": "
|
|
67
|
-
"tools-container": "awsui_tools-
|
|
68
|
-
"tools": "
|
|
69
|
-
"openTools": "
|
|
70
|
-
"has-tools-form-persistence": "awsui_has-tools-form-
|
|
71
|
-
"hide-tools": "awsui_hide-
|
|
72
|
-
"show-tools": "awsui_show-
|
|
73
|
-
"has-tools-form": "awsui_has-tools-
|
|
74
|
-
"trigger": "
|
|
75
|
-
"selected": "
|
|
5
|
+
"appbar": "awsui_appbar_hyvsj_iwse1_93",
|
|
6
|
+
"appbar-nav": "awsui_appbar-nav_hyvsj_iwse1_117",
|
|
7
|
+
"breadcrumbs": "awsui_breadcrumbs_hyvsj_iwse1_121",
|
|
8
|
+
"appbar-tools": "awsui_appbar-tools_hyvsj_iwse1_125",
|
|
9
|
+
"drawers-mobile-triggers-container": "awsui_drawers-mobile-triggers-container_hyvsj_iwse1_126",
|
|
10
|
+
"has-breadcrumbs": "awsui_has-breadcrumbs_hyvsj_iwse1_167",
|
|
11
|
+
"has-notifications-content": "awsui_has-notifications-content_hyvsj_iwse1_175",
|
|
12
|
+
"has-header": "awsui_has-header_hyvsj_iwse1_181",
|
|
13
|
+
"has-dynamic-overlap-height": "awsui_has-dynamic-overlap-height_hyvsj_iwse1_181",
|
|
14
|
+
"content-type-wizard": "awsui_content-type-wizard_hyvsj_iwse1_182",
|
|
15
|
+
"content-type-cards": "awsui_content-type-cards_hyvsj_iwse1_185",
|
|
16
|
+
"content-type-table": "awsui_content-type-table_hyvsj_iwse1_186",
|
|
17
|
+
"has-sticky-background": "awsui_has-sticky-background_hyvsj_iwse1_189",
|
|
18
|
+
"background": "awsui_background_hyvsj_iwse1_224",
|
|
19
|
+
"notifications-appbar-header": "awsui_notifications-appbar-header_hyvsj_iwse1_227",
|
|
20
|
+
"sticky-notifications": "awsui_sticky-notifications_hyvsj_iwse1_240",
|
|
21
|
+
"overlap": "awsui_overlap_hyvsj_iwse1_246",
|
|
22
|
+
"drawers-container": "awsui_drawers-container_hyvsj_iwse1_270",
|
|
23
|
+
"has-open-drawer": "awsui_has-open-drawer_hyvsj_iwse1_282",
|
|
24
|
+
"disable-body-scroll": "awsui_disable-body-scroll_hyvsj_iwse1_316",
|
|
25
|
+
"drawers-desktop-triggers-container": "awsui_drawers-desktop-triggers-container_hyvsj_iwse1_321",
|
|
26
|
+
"has-multiple-triggers": "awsui_has-multiple-triggers_hyvsj_iwse1_339",
|
|
27
|
+
"drawers-trigger-content": "awsui_drawers-trigger-content_hyvsj_iwse1_371",
|
|
28
|
+
"drawer": "awsui_drawer_hyvsj_iwse1_126",
|
|
29
|
+
"drawer-close-button": "awsui_drawer-close-button_hyvsj_iwse1_415",
|
|
30
|
+
"drawer-content": "awsui_drawer-content_hyvsj_iwse1_420",
|
|
31
|
+
"is-drawer-open": "awsui_is-drawer-open_hyvsj_iwse1_425",
|
|
32
|
+
"content": "awsui_content_hyvsj_iwse1_182",
|
|
33
|
+
"layout": "awsui_layout_hyvsj_iwse1_527",
|
|
34
|
+
"has-max-content-width": "awsui_has-max-content-width_hyvsj_iwse1_610",
|
|
35
|
+
"content-type-dashboard": "awsui_content-type-dashboard_hyvsj_iwse1_625",
|
|
36
|
+
"is-overlap-disabled": "awsui_is-overlap-disabled_hyvsj_iwse1_652",
|
|
37
|
+
"has-sticky-notifications": "awsui_has-sticky-notifications_hyvsj_iwse1_659",
|
|
38
|
+
"has-split-panel": "awsui_has-split-panel_hyvsj_iwse1_673",
|
|
39
|
+
"split-panel-position-bottom": "awsui_split-panel-position-bottom_hyvsj_iwse1_673",
|
|
40
|
+
"has-content-gap-left": "awsui_has-content-gap-left_hyvsj_iwse1_685",
|
|
41
|
+
"has-content-gap-right": "awsui_has-content-gap-right_hyvsj_iwse1_688",
|
|
42
|
+
"block-body-scroll": "awsui_block-body-scroll_hyvsj_iwse1_703",
|
|
43
|
+
"container": "awsui_container_hyvsj_iwse1_711",
|
|
44
|
+
"disable-content-paddings": "awsui_disable-content-paddings_hyvsj_iwse1_737",
|
|
45
|
+
"is-navigation-open": "awsui_is-navigation-open_hyvsj_iwse1_742",
|
|
46
|
+
"is-tools-open": "awsui_is-tools-open_hyvsj_iwse1_745",
|
|
47
|
+
"is-split-panel-open": "awsui_is-split-panel-open_hyvsj_iwse1_745",
|
|
48
|
+
"split-panel-position-side": "awsui_split-panel-position-side_hyvsj_iwse1_745",
|
|
49
|
+
"content-type-default": "awsui_content-type-default_hyvsj_iwse1_765",
|
|
50
|
+
"content-type-form": "awsui_content-type-form_hyvsj_iwse1_765",
|
|
51
|
+
"unfocusable": "awsui_unfocusable_hyvsj_iwse1_806",
|
|
52
|
+
"navigation-container": "awsui_navigation-container_hyvsj_iwse1_816",
|
|
53
|
+
"show-navigation": "awsui_show-navigation_hyvsj_iwse1_860",
|
|
54
|
+
"animating": "awsui_animating_hyvsj_iwse1_882",
|
|
55
|
+
"showButtons": "awsui_showButtons_hyvsj_iwse1_1",
|
|
56
|
+
"navigation": "awsui_navigation_hyvsj_iwse1_816",
|
|
57
|
+
"openNavigation": "awsui_openNavigation_hyvsj_iwse1_1",
|
|
58
|
+
"animated-content": "awsui_animated-content_hyvsj_iwse1_943",
|
|
59
|
+
"hide-navigation": "awsui_hide-navigation_hyvsj_iwse1_952",
|
|
60
|
+
"notifications": "awsui_notifications_hyvsj_iwse1_227",
|
|
61
|
+
"split-panel-bottom": "awsui_split-panel-bottom_hyvsj_iwse1_1019",
|
|
62
|
+
"position-bottom": "awsui_position-bottom_hyvsj_iwse1_1065",
|
|
63
|
+
"openSplitPanelBottom": "awsui_openSplitPanelBottom_hyvsj_iwse1_1",
|
|
64
|
+
"split-panel-side": "awsui_split-panel-side_hyvsj_iwse1_1094",
|
|
65
|
+
"position-side": "awsui_position-side_hyvsj_iwse1_1122",
|
|
66
|
+
"openSplitPanelSide": "awsui_openSplitPanelSide_hyvsj_iwse1_1",
|
|
67
|
+
"tools-container": "awsui_tools-container_hyvsj_iwse1_1159",
|
|
68
|
+
"tools": "awsui_tools_hyvsj_iwse1_1159",
|
|
69
|
+
"openTools": "awsui_openTools_hyvsj_iwse1_1",
|
|
70
|
+
"has-tools-form-persistence": "awsui_has-tools-form-persistence_hyvsj_iwse1_1253",
|
|
71
|
+
"hide-tools": "awsui_hide-tools_hyvsj_iwse1_1263",
|
|
72
|
+
"show-tools": "awsui_show-tools_hyvsj_iwse1_1275",
|
|
73
|
+
"has-tools-form": "awsui_has-tools-form_hyvsj_iwse1_1253",
|
|
74
|
+
"trigger": "awsui_trigger_hyvsj_iwse1_1342",
|
|
75
|
+
"selected": "awsui_selected_hyvsj_iwse1_1381"
|
|
76
76
|
};
|
|
77
77
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/tools.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,UAAU,UAAU;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,QAAQ,EAAE,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/tools.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,UAAU,UAAU;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,QAAQ,EAAE,EAAE,UAAU,sBAiIrD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,CAAC,EAAE,OAAO,WAU/E"}
|
|
@@ -19,7 +19,7 @@ import customCssProps from '../../internal/generated/custom-css-properties';
|
|
|
19
19
|
* split panel in large viewports;
|
|
20
20
|
*/
|
|
21
21
|
export default function Tools({ children }) {
|
|
22
|
-
const { ariaLabels, drawers, handleSplitPanelClick, handleToolsClick, hasDefaultToolsWidth, hasDrawerViewportOverlay, isMobile, isSplitPanelOpen, isToolsOpen, loseToolsFocus, splitPanelDisplayed, splitPanelPosition, splitPanelRefs, splitPanelToggle, tools, toolsHide, toolsRefs, toolsWidth, } = useAppLayoutInternals();
|
|
22
|
+
const { ariaLabels, disableBodyScroll, drawers, handleSplitPanelClick, handleToolsClick, hasDefaultToolsWidth, hasDrawerViewportOverlay, isMobile, isSplitPanelOpen, isToolsOpen, loseToolsFocus, splitPanelDisplayed, splitPanelPosition, splitPanelRefs, splitPanelToggle, tools, toolsHide, toolsRefs, toolsWidth, } = useAppLayoutInternals();
|
|
23
23
|
const hasSplitPanel = getSplitPanelStatus(splitPanelDisplayed, splitPanelPosition);
|
|
24
24
|
const hasToolsForm = getToolsFormStatus(hasSplitPanel, isMobile, isSplitPanelOpen, isToolsOpen, toolsHide);
|
|
25
25
|
const hasToolsFormPersistence = getToolsFormPersistence(hasSplitPanel, isSplitPanelOpen, isToolsOpen, toolsHide);
|
|
@@ -34,8 +34,9 @@ export default function Tools({ children }) {
|
|
|
34
34
|
return (React.createElement(Transition, { in: isToolsOpen !== null && isToolsOpen !== void 0 ? isToolsOpen : false }, (state, transitionEventsRef) => {
|
|
35
35
|
var _a, _b, _c;
|
|
36
36
|
return (React.createElement("div", { className: clsx(styles['tools-container'], {
|
|
37
|
-
[
|
|
37
|
+
[styles['disable-body-scroll']]: disableBodyScroll,
|
|
38
38
|
[styles.unfocusable]: isUnfocusable,
|
|
39
|
+
[testutilStyles['drawer-closed']]: !isToolsOpen,
|
|
39
40
|
}), style: {
|
|
40
41
|
[customCssProps.toolsAnimationStartingOpacity]: `${hasSplitPanel && isSplitPanelOpen ? 1 : 0}`,
|
|
41
42
|
// Overwrite the default tools width (depends on breakpoints) only when the `toolsWidth` property has been set.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/tools.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAC/D,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,cAAc,MAAM,gDAAgD,CAAC;AAM5E;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,QAAQ,EAAc;IACpD,MAAM,EACJ,UAAU,EACV,OAAO,EACP,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,KAAK,EACL,SAAS,EACT,SAAS,EACT,UAAU,GACX,GAAG,qBAAqB,EAAE,CAAC;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WAAW,GAAG,KAAK,CAAC;KACrB;SAAM;QACL,WAAW,GAAG,cAAc,CAAC;KAC9B;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;GAGG;AACH,SAAS,mBAAmB,CAAC,mBAA4B,EAAE,kBAA0B;IACnF,OAAO,mBAAmB,IAAI,kBAAkB,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7E,CAAC;AAED;;;;;GAKG;AACH,SAAS,kBAAkB,CACzB,aAAsB,EACtB,QAAiB,EACjB,gBAA0B,EAC1B,WAAqB,EACrB,SAAmB;IAEnB,IAAI,YAAY,GAAG,KAAK,CAAC;IAEzB,IAAI,CAAC,QAAQ,EAAE;QACb,mDAAmD;QACnD,IAAI,aAAa,IAAI,CAAC,SAAS,EAAE;YAC/B,YAAY,GAAG,IAAI,CAAC;SACrB;QAED,mCAAmC;QACnC,IAAI,aAAa,IAAI,CAAC,gBAAgB,IAAI,SAAS,EAAE;YACnD,YAAY,GAAG,IAAI,CAAC;SACrB;QAED,6BAA6B;QAC7B,IAAI,CAAC,aAAa,IAAI,CAAC,SAAS,IAAI,CAAC,WAAW,EAAE;YAChD,YAAY,GAAG,IAAI,CAAC;SACrB;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,uBAAuB,CAC9B,aAAsB,EACtB,gBAA0B,EAC1B,WAAqB,EACrB,SAAmB;IAEnB,IAAI,uBAAuB,GAAG,KAAK,CAAC;IAEpC,2DAA2D;IAC3D,IAAI,aAAa,IAAI,CAAC,SAAS,IAAI,CAAC,gBAAgB,IAAI,WAAW,CAAC,EAAE;QACpE,uBAAuB,GAAG,IAAI,CAAC;KAChC;IAED,OAAO,uBAAuB,CAAC;AACjC,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';\nimport { InternalButton } from '../../button/internal';\nimport { useAppLayoutInternals } from './context';\nimport TriggerButton from './trigger-button';\nimport styles from './styles.css.js';\nimport splitPanelStyles from '../../split-panel/styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\nimport { Transition } from '../../internal/components/transition';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\ninterface ToolsProps {\n children: React.ReactNode;\n}\n\n/**\n * The Tools component consists of the following elements:\n * the container, or root element, that sits as a direct child to the Layout grid definition;\n * the split panel, which exists only if there is a split panel in side position;\n * the tools, or drawer, that contains the hide tools form and the children passed through the API;\n * the show tools form that contains the triggers for both the drawer and the\n * split panel in large viewports;\n */\nexport default function Tools({ children }: ToolsProps) {\n const {\n ariaLabels,\n drawers,\n handleSplitPanelClick,\n handleToolsClick,\n hasDefaultToolsWidth,\n hasDrawerViewportOverlay,\n isMobile,\n isSplitPanelOpen,\n isToolsOpen,\n loseToolsFocus,\n splitPanelDisplayed,\n splitPanelPosition,\n splitPanelRefs,\n splitPanelToggle,\n tools,\n toolsHide,\n toolsRefs,\n toolsWidth,\n } = useAppLayoutInternals();\n\n const hasSplitPanel = getSplitPanelStatus(splitPanelDisplayed, splitPanelPosition);\n const hasToolsForm = getToolsFormStatus(hasSplitPanel, isMobile, isSplitPanelOpen, isToolsOpen, toolsHide);\n const hasToolsFormPersistence = getToolsFormPersistence(hasSplitPanel, isSplitPanelOpen, isToolsOpen, toolsHide);\n const isUnfocusable = hasDrawerViewportOverlay && !isToolsOpen;\n\n /**\n * If the drawers property is defined the Tools and SplitPanel will be mounted and rendered\n * by the Drawers component.\n */\n if ((toolsHide && !hasSplitPanel) || drawers) {\n return null;\n }\n\n return (\n <Transition in={isToolsOpen ?? false}>\n {(state, transitionEventsRef) => (\n <div\n className={clsx(styles['tools-container'], {\n [testutilStyles['drawer-closed']]: !isToolsOpen,\n [styles.unfocusable]: isUnfocusable,\n })}\n style={{\n [customCssProps.toolsAnimationStartingOpacity]: `${hasSplitPanel && isSplitPanelOpen ? 1 : 0}`,\n // Overwrite the default tools width (depends on breakpoints) only when the `toolsWidth` property has been set.\n [customCssProps.toolsWidth]: hasDefaultToolsWidth ? '' : `${toolsWidth}px`,\n }}\n onBlur={e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n loseToolsFocus();\n }\n }}\n >\n {children}\n\n {!toolsHide && (\n <aside\n aria-hidden={!isToolsOpen ? true : false}\n aria-label={ariaLabels?.tools ?? undefined}\n className={clsx(\n styles.tools,\n {\n [styles.animating]: state === 'entering',\n [styles['has-tools-form-persistence']]: hasToolsFormPersistence,\n [styles['is-tools-open']]: isToolsOpen,\n },\n testutilStyles.tools\n )}\n ref={state !== 'exiting' ? transitionEventsRef : undefined}\n >\n <div className={clsx(styles['animated-content'])}>\n <div className={clsx(styles['hide-tools'])}>\n <InternalButton\n ariaLabel={ariaLabels?.toolsClose ?? undefined}\n iconName={isMobile ? 'close' : 'angle-right'}\n onClick={() => handleToolsClick(false)}\n variant=\"icon\"\n formAction=\"none\"\n className={testutilStyles['tools-close']}\n ref={toolsRefs.close}\n />\n </div>\n\n {tools}\n </div>\n </aside>\n )}\n\n {!isMobile && (\n <aside\n aria-hidden={!hasToolsForm ? true : false}\n aria-label={ariaLabels?.tools ?? undefined}\n className={clsx(styles['show-tools'], {\n [styles.animating]: state === 'exiting',\n [styles['has-tools-form']]: hasToolsForm,\n [styles['has-tools-form-persistence']]: hasToolsFormPersistence,\n })}\n ref={state === 'exiting' ? transitionEventsRef : undefined}\n >\n {!toolsHide && (\n <TriggerButton\n ariaLabel={ariaLabels?.toolsToggle}\n iconName=\"status-info\"\n onClick={() => handleToolsClick(!isToolsOpen)}\n selected={hasSplitPanel && isToolsOpen}\n className={testutilStyles['tools-toggle']}\n ref={toolsRefs.toggle}\n />\n )}\n\n {hasSplitPanel && splitPanelToggle.displayed && (\n <TriggerButton\n ariaLabel={splitPanelToggle.ariaLabel}\n iconName=\"view-vertical\"\n onClick={() => handleSplitPanelClick()}\n selected={hasSplitPanel && isSplitPanelOpen}\n className={splitPanelStyles['open-button']}\n ref={splitPanelRefs.toggle}\n />\n )}\n </aside>\n )}\n </div>\n )}\n </Transition>\n );\n}\n\n/**\n * Determine the default state of the Tools component. Mobile viewports should be\n * closed by default under all circumstances. If the toolsOpen prop has not been\n * set then it should be closed as well. Otherwise, default to the toolsOpen prop.\n */\nexport function getToolsDefaultState(isMobile: boolean, stateFromProps?: boolean) {\n let isToolsOpen;\n\n if (isMobile || stateFromProps === undefined) {\n isToolsOpen = false;\n } else {\n isToolsOpen = stateFromProps;\n }\n\n return isToolsOpen;\n}\n\n/**\n * This simple function returns the presence of the split panel as a child of the\n * Tools component. It must exist and be in side position.\n */\nfunction getSplitPanelStatus(splitPanelDisplayed: boolean, splitPanelPosition: string) {\n return splitPanelDisplayed && splitPanelPosition === 'side' ? true : false;\n}\n\n/**\n * By default the Tools form is styled as display: none; This behavior should\n * be unchanged in mobile viewports where the Tools form is always suppressed.\n * In large viewports, however the Tools form and its corresponding buttons\n * should be present in the UI under the below circumstances.\n */\nfunction getToolsFormStatus(\n hasSplitPanel: boolean,\n isMobile: boolean,\n isSplitPanelOpen?: boolean,\n isToolsOpen?: boolean,\n toolsHide?: boolean\n) {\n let hasToolsForm = false;\n\n if (!isMobile) {\n // Both the Split Panel and Tools button are needed\n if (hasSplitPanel && !toolsHide) {\n hasToolsForm = true;\n }\n\n // The Split Panel button is needed\n if (hasSplitPanel && !isSplitPanelOpen && toolsHide) {\n hasToolsForm = true;\n }\n\n // The Tools button is needed\n if (!hasSplitPanel && !toolsHide && !isToolsOpen) {\n hasToolsForm = true;\n }\n }\n\n return hasToolsForm;\n}\n\n/**\n * Under two scenarios the Tools form that contains the triggers\n * for the Tools content and the Split Panel may be persistent\n * in the UI (as opposed to disappearing when one of the drawers\n * is open). This will also add a white background as opposed to the\n * default transparent background. The buttons will present and in a\n * selected / not selected state.\n */\nfunction getToolsFormPersistence(\n hasSplitPanel: boolean,\n isSplitPanelOpen?: boolean,\n isToolsOpen?: boolean,\n toolsHide?: boolean\n) {\n let hasToolsFormPersistence = false;\n\n // Both Tools and Split Panel exist and one or both is open\n if (hasSplitPanel && !toolsHide && (isSplitPanelOpen || isToolsOpen)) {\n hasToolsFormPersistence = true;\n }\n\n return hasToolsFormPersistence;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/tools.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAC/D,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,cAAc,MAAM,gDAAgD,CAAC;AAM5E;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,QAAQ,EAAc;IACpD,MAAM,EACJ,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,KAAK,EACL,SAAS,EACT,SAAS,EACT,UAAU,GACX,GAAG,qBAAqB,EAAE,CAAC;IAE5B,MAAM,aAAa,GAAG,mBAAmB,CAAC,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;IACnF,MAAM,YAAY,GAAG,kBAAkB,CAAC,aAAa,EAAE,QAAQ,EAAE,g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O,WAAW,CAAC;AACrB,CAAC;AAED;;;GAGG;AACH,SAAS,mBAAmB,CAAC,mBAA4B,EAAE,kBAA0B;IACnF,OAAO,mBAAmB,IAAI,kBAAkB,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7E,CAAC;AAED;;;;;GAKG;AACH,SAAS,kBAAkB,CACzB,aAAsB,EACtB,QAAiB,EACjB,gBAA0B,EAC1B,WAAqB,EACrB,SAAmB;IAEnB,IAAI,YAAY,GAAG,KAAK,CAAC;IAEzB,IAAI,CAAC,QAAQ,EAAE;QACb,mDAAmD;QACnD,IAAI,aAAa,IAAI,CAAC,SAAS,EAAE;YAC/B,YAAY,GAAG,IAAI,CAAC;SACrB;QAED,mCAAmC;QACnC,IAAI,aAAa,IAAI,CAAC,gBAAgB,IAAI,SAAS,EAAE;YACnD,YAAY,GAAG,IAAI,CAAC;SACrB;QAED,6BAA6B;QAC7B,IAAI,CAAC,aAAa,IAAI,CAAC,SAAS,IAAI,CAAC,WAAW,EAAE;YAChD,YAAY,GAAG,IAAI,CAAC;SACrB;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,uBAAuB,CAC9B,aAAsB,EACtB,gBAA0B,EAC1B,WAAqB,EACrB,SAAmB;IAEnB,IAAI,uBAAuB,GAAG,KAAK,CAAC;IAEpC,2DAA2D;IAC3D,IAAI,aAAa,IAAI,CAAC,SAAS,IAAI,CAAC,gBAAgB,IAAI,WAAW,CAAC,EAAE;QACpE,uBAAuB,GAAG,IAAI,CAAC;KAChC;IAED,OAAO,uBAAuB,CAAC;AACjC,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';\nimport { InternalButton } from '../../button/internal';\nimport { useAppLayoutInternals } from './context';\nimport TriggerButton from './trigger-button';\nimport styles from './styles.css.js';\nimport splitPanelStyles from '../../split-panel/styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\nimport { Transition } from '../../internal/components/transition';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\ninterface ToolsProps {\n children: React.ReactNode;\n}\n\n/**\n * The Tools component consists of the following elements:\n * the container, or root element, that sits as a direct child to the Layout grid definition;\n * the split panel, which exists only if there is a split panel in side position;\n * the tools, or drawer, that contains the hide tools form and the children passed through the API;\n * the show tools form that contains the triggers for both the drawer and the\n * split panel in large viewports;\n */\nexport default function Tools({ children }: ToolsProps) {\n const {\n ariaLabels,\n disableBodyScroll,\n drawers,\n handleSplitPanelClick,\n handleToolsClick,\n hasDefaultToolsWidth,\n hasDrawerViewportOverlay,\n isMobile,\n isSplitPanelOpen,\n isToolsOpen,\n loseToolsFocus,\n splitPanelDisplayed,\n splitPanelPosition,\n splitPanelRefs,\n splitPanelToggle,\n tools,\n toolsHide,\n toolsRefs,\n toolsWidth,\n } = useAppLayoutInternals();\n\n const hasSplitPanel = getSplitPanelStatus(splitPanelDisplayed, splitPanelPosition);\n const hasToolsForm = getToolsFormStatus(hasSplitPanel, isMobile, isSplitPanelOpen, isToolsOpen, toolsHide);\n const hasToolsFormPersistence = getToolsFormPersistence(hasSplitPanel, isSplitPanelOpen, isToolsOpen, toolsHide);\n const isUnfocusable = hasDrawerViewportOverlay && !isToolsOpen;\n\n /**\n * If the drawers property is defined the Tools and SplitPanel will be mounted and rendered\n * by the Drawers component.\n */\n if ((toolsHide && !hasSplitPanel) || drawers) {\n return null;\n }\n\n return (\n <Transition in={isToolsOpen ?? false}>\n {(state, transitionEventsRef) => (\n <div\n className={clsx(styles['tools-container'], {\n [styles['disable-body-scroll']]: disableBodyScroll,\n [styles.unfocusable]: isUnfocusable,\n [testutilStyles['drawer-closed']]: !isToolsOpen,\n })}\n style={{\n [customCssProps.toolsAnimationStartingOpacity]: `${hasSplitPanel && isSplitPanelOpen ? 1 : 0}`,\n // Overwrite the default tools width (depends on breakpoints) only when the `toolsWidth` property has been set.\n [customCssProps.toolsWidth]: hasDefaultToolsWidth ? '' : `${toolsWidth}px`,\n }}\n onBlur={e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n loseToolsFocus();\n }\n }}\n >\n {children}\n\n {!toolsHide && (\n <aside\n aria-hidden={!isToolsOpen ? true : false}\n aria-label={ariaLabels?.tools ?? undefined}\n className={clsx(\n styles.tools,\n {\n [styles.animating]: state === 'entering',\n [styles['has-tools-form-persistence']]: hasToolsFormPersistence,\n [styles['is-tools-open']]: isToolsOpen,\n },\n testutilStyles.tools\n )}\n ref={state !== 'exiting' ? transitionEventsRef : undefined}\n >\n <div className={clsx(styles['animated-content'])}>\n <div className={clsx(styles['hide-tools'])}>\n <InternalButton\n ariaLabel={ariaLabels?.toolsClose ?? undefined}\n iconName={isMobile ? 'close' : 'angle-right'}\n onClick={() => handleToolsClick(false)}\n variant=\"icon\"\n formAction=\"none\"\n className={testutilStyles['tools-close']}\n ref={toolsRefs.close}\n />\n </div>\n\n {tools}\n </div>\n </aside>\n )}\n\n {!isMobile && (\n <aside\n aria-hidden={!hasToolsForm ? true : false}\n aria-label={ariaLabels?.tools ?? undefined}\n className={clsx(styles['show-tools'], {\n [styles.animating]: state === 'exiting',\n [styles['has-tools-form']]: hasToolsForm,\n [styles['has-tools-form-persistence']]: hasToolsFormPersistence,\n })}\n ref={state === 'exiting' ? transitionEventsRef : undefined}\n >\n {!toolsHide && (\n <TriggerButton\n ariaLabel={ariaLabels?.toolsToggle}\n iconName=\"status-info\"\n onClick={() => handleToolsClick(!isToolsOpen)}\n selected={hasSplitPanel && isToolsOpen}\n className={testutilStyles['tools-toggle']}\n ref={toolsRefs.toggle}\n />\n )}\n\n {hasSplitPanel && splitPanelToggle.displayed && (\n <TriggerButton\n ariaLabel={splitPanelToggle.ariaLabel}\n iconName=\"view-vertical\"\n onClick={() => handleSplitPanelClick()}\n selected={hasSplitPanel && isSplitPanelOpen}\n className={splitPanelStyles['open-button']}\n ref={splitPanelRefs.toggle}\n />\n )}\n </aside>\n )}\n </div>\n )}\n </Transition>\n );\n}\n\n/**\n * Determine the default state of the Tools component. Mobile viewports should be\n * closed by default under all circumstances. If the toolsOpen prop has not been\n * set then it should be closed as well. Otherwise, default to the toolsOpen prop.\n */\nexport function getToolsDefaultState(isMobile: boolean, stateFromProps?: boolean) {\n let isToolsOpen;\n\n if (isMobile || stateFromProps === undefined) {\n isToolsOpen = false;\n } else {\n isToolsOpen = stateFromProps;\n }\n\n return isToolsOpen;\n}\n\n/**\n * This simple function returns the presence of the split panel as a child of the\n * Tools component. It must exist and be in side position.\n */\nfunction getSplitPanelStatus(splitPanelDisplayed: boolean, splitPanelPosition: string) {\n return splitPanelDisplayed && splitPanelPosition === 'side' ? true : false;\n}\n\n/**\n * By default the Tools form is styled as display: none; This behavior should\n * be unchanged in mobile viewports where the Tools form is always suppressed.\n * In large viewports, however the Tools form and its corresponding buttons\n * should be present in the UI under the below circumstances.\n */\nfunction getToolsFormStatus(\n hasSplitPanel: boolean,\n isMobile: boolean,\n isSplitPanelOpen?: boolean,\n isToolsOpen?: boolean,\n toolsHide?: boolean\n) {\n let hasToolsForm = false;\n\n if (!isMobile) {\n // Both the Split Panel and Tools button are needed\n if (hasSplitPanel && !toolsHide) {\n hasToolsForm = true;\n }\n\n // The Split Panel button is needed\n if (hasSplitPanel && !isSplitPanelOpen && toolsHide) {\n hasToolsForm = true;\n }\n\n // The Tools button is needed\n if (!hasSplitPanel && !toolsHide && !isToolsOpen) {\n hasToolsForm = true;\n }\n }\n\n return hasToolsForm;\n}\n\n/**\n * Under two scenarios the Tools form that contains the triggers\n * for the Tools content and the Split Panel may be persistent\n * in the UI (as opposed to disappearing when one of the drawers\n * is open). This will also add a white background as opposed to the\n * default transparent background. The buttons will present and in a\n * selected / not selected state.\n */\nfunction getToolsFormPersistence(\n hasSplitPanel: boolean,\n isSplitPanelOpen?: boolean,\n isToolsOpen?: boolean,\n toolsHide?: boolean\n) {\n let hasToolsFormPersistence = false;\n\n // Both Tools and Split Panel exist and one or both is open\n if (hasSplitPanel && !toolsHide && (isSplitPanelOpen || isToolsOpen)) {\n hasToolsFormPersistence = true;\n }\n\n return hasToolsFormPersistence;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["code-editor/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAQ7F,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAgC/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["code-editor/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAQ7F,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAgC/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,QAAA,MAAM,UAAU,6FAiSd,CAAC;AAGH,eAAe,UAAU,CAAC"}
|
package/code-editor/index.js
CHANGED
|
@@ -166,19 +166,6 @@ const CodeEditor = forwardRef((props, ref) => {
|
|
|
166
166
|
const onAnnotationClear = useCallback(() => {
|
|
167
167
|
setHighlightedAnnotation(undefined);
|
|
168
168
|
}, []);
|
|
169
|
-
/**
|
|
170
|
-
* Ignore focus lock if focused element is the pane tab button or within editor tree.
|
|
171
|
-
* This check is required:
|
|
172
|
-
* - When closing the pane with `ESC` key: The panel closes asynchronously and its focus lock
|
|
173
|
-
* still exists when trying to focus the tab button in higher-order component.
|
|
174
|
-
* - When clicking or hittin `Enter` on an annotation: The panel remains open but focus lock
|
|
175
|
-
* deactivates asynchronously.
|
|
176
|
-
*/
|
|
177
|
-
const shouldHandleFocus = useCallback((activeElement) => {
|
|
178
|
-
return (activeElement !== errorsTabRef.current &&
|
|
179
|
-
activeElement !== warningsTabRef.current &&
|
|
180
|
-
!(editor === null || editor === void 0 ? void 0 : editor.container.contains(activeElement)));
|
|
181
|
-
}, [editor]);
|
|
182
169
|
const [isPreferencesModalVisible, setPreferencesModalVisible] = useState(false);
|
|
183
170
|
const onPreferencesOpen = () => setPreferencesModalVisible(true);
|
|
184
171
|
const onPreferencesConfirm = (p) => {
|
|
@@ -200,7 +187,7 @@ const CodeEditor = forwardRef((props, ref) => {
|
|
|
200
187
|
React.createElement("div", { ref: codeEditorRef, className: clsx(styles.editor, styles.ace, isRefresh && styles['editor-refresh']), onKeyDown: onEditorKeydown, tabIndex: 0, role: "group", "aria-label": i18nStrings.editorGroupAriaLabel })),
|
|
201
188
|
React.createElement("div", { role: "group", "aria-label": i18nStrings.statusBarGroupAriaLabel },
|
|
202
189
|
React.createElement(StatusBar, { languageLabel: languageLabel, cursorPosition: i18nStrings.cursorPosition(cursorPosition.row + 1, cursorPosition.column + 1), errorCount: errorCount, warningCount: warningCount, paneStatus: paneStatus, onErrorPaneToggle: onErrorPaneToggle, onWarningPaneToggle: onWarningPaneToggle, onTabFocus: onTabFocus, onTabBlur: onTabBlur, errorsTabRef: errorsTabRef, warningsTabRef: warningsTabRef, i18nStrings: i18nStrings, isTabFocused: isTabFocused, paneId: isPaneVisible ? paneId : undefined, onPreferencesOpen: onPreferencesOpen, isRefresh: isRefresh }),
|
|
203
|
-
React.createElement(Pane, { id: paneId, visible: isPaneVisible, annotations: currentAnnotations, highlighted: highlightedAnnotation, onAnnotationClick: onAnnotationClick, onAnnotationClear: onAnnotationClear, onClose: onPaneClose,
|
|
190
|
+
React.createElement(Pane, { id: paneId, visible: isPaneVisible, annotations: currentAnnotations, highlighted: highlightedAnnotation, onAnnotationClick: onAnnotationClick, onAnnotationClear: onAnnotationClear, onClose: onPaneClose, cursorPositionLabel: i18nStrings.cursorPosition, closeButtonAriaLabel: i18nStrings.paneCloseButtonAriaLabel })),
|
|
204
191
|
isPreferencesModalVisible && (React.createElement(PreferencesModal, { onConfirm: onPreferencesConfirm, onDismiss: onPreferencesDismiss, themes: props.themes, preferences: props.preferences, defaultTheme: defaultTheme, i18nStrings: {
|
|
205
192
|
header: i18nStrings.preferencesModalHeader,
|
|
206
193
|
cancel: i18nStrings.preferencesModalCancel,
|
package/code-editor/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["code-editor/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE7F,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAChB,WAAW,EAEX,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,GAChB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACnD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC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C,WAAW,EAAE,WAAW,CAAC,2BAA2B;oBACpD,UAAU,EAAE,WAAW,CAAC,0BAA0B;oBAClD,uBAAuB,EAAE,WAAW,CAAC,uCAAuC;oBAC5E,4BAA4B,EAAE,WAAW,CAAC,4CAA4C;oBACtF,yBAAyB,EAAE,WAAW,CAAC,yCAAyC;iBACjF,GACD,CACH,CACA,CACJ,CACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAC3C,eAAe,UAAU,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState, forwardRef } from 'react';\nimport { Ace } from 'ace-builds';\nimport clsx from 'clsx';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { KeyCode } from '../internal/keycode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { CodeEditorProps } from './interfaces';\nimport { Pane } from './pane';\nimport { useChangeEffect } from './listeners';\nimport {\n getDefaultConfig,\n getAceTheme,\n PaneStatus,\n getLanguageLabel,\n DEFAULT_DARK_THEME,\n DEFAULT_LIGHT_THEME,\n getDefaultTheme,\n} from './util';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { setupEditor } from './setup-editor';\nimport { ResizableBox } from './resizable-box';\nimport PreferencesModal from './preferences-modal';\nimport LoadingScreen from './loading-screen';\nimport ErrorScreen from './error-screen';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { useContainerQuery } from '../internal/hooks/container-queries/use-container-query';\nimport { useCurrentMode } from '../internal/hooks/use-visual-mode';\nimport { StatusBar } from './status-bar';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport LiveRegion from '../internal/components/live-region';\n\nimport styles from './styles.css.js';\n\nexport { CodeEditorProps };\n\nconst CodeEditor = forwardRef((props: CodeEditorProps, ref: React.Ref<CodeEditorProps.Ref>) => {\n const codeEditorRef = useRef<HTMLDivElement>(null);\n const { __internalRootRef } = useBaseComponent('CodeEditor');\n const { controlId, ariaLabelledby, ariaDescribedby } = useFormFieldContext(props);\n const {\n ace,\n value,\n language,\n i18nStrings,\n editorContentHeight,\n onEditorContentResize,\n languageLabel: customLanguageLabel,\n ...rest\n } = props;\n const [editorHeight = 480, setEditorHeight] = useControllable(editorContentHeight, onEditorContentResize, 480, {\n componentName: 'code-editor',\n changeHandler: 'onEditorContentResize',\n controlledProp: 'editorContentHeight',\n });\n const baseProps = getBaseProps(rest);\n\n const [editor, setEditor] = useState<Ace.Editor>();\n const mode = useCurrentMode(__internalRootRef);\n const defaultTheme = mode === 'dark' ? DEFAULT_DARK_THEME : DEFAULT_LIGHT_THEME;\n\n useEffect(() => {\n if (!editor) {\n return;\n }\n const { textarea } = editor.renderer as unknown as { textarea: HTMLTextAreaElement };\n if (!textarea) {\n return;\n }\n const updateAttribute = (attribute: string, value: string | undefined) =>\n value ? textarea.setAttribute(attribute, value) : textarea.removeAttribute(attribute);\n updateAttribute('id', controlId);\n updateAttribute('aria-labelledby', ariaLabelledby);\n updateAttribute('aria-describedby', ariaDescribedby);\n }, [ariaDescribedby, ariaLabelledby, controlId, editor]);\n\n const [paneStatus, setPaneStatus] = useState<PaneStatus>('hidden');\n const [annotations, setAnnotations] = useState<Ace.Annotation[]>([]);\n const [highlightedAnnotation, setHighlightedAnnotation] = useState<Ace.Annotation>();\n const [cursorPosition, setCursorPosition] = useState<Ace.Point>({ row: 0, column: 0 });\n const [isTabFocused, setTabFocused] = useState<boolean>(false);\n\n const errorsTabRef = useRef<HTMLButtonElement>(null);\n const warningsTabRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n const elem = codeEditorRef.current;\n if (!ace || !elem) {\n return;\n }\n const config = getDefaultConfig();\n setEditor(\n ace.edit(elem, {\n ...config,\n theme: getAceTheme(getDefaultTheme(elem)),\n })\n );\n }, [ace, props.loading]);\n const [codeEditorWidth, codeEditorMeasureRef] = useContainerQuery(rect => rect.width);\n const mergedRef = useMergeRefs(codeEditorMeasureRef, __internalRootRef);\n useForwardFocus(ref, codeEditorRef);\n const isRefresh = useVisualRefresh();\n\n useEffect(() => {\n editor?.resize();\n }, [editor, editorContentHeight, codeEditorWidth]);\n\n const paneId = useUniqueId('code-editor-pane');\n\n useEffect(() => {\n if (!ace || !editor) {\n return;\n }\n\n setupEditor(ace, editor, setAnnotations, setCursorPosition, setHighlightedAnnotation, setPaneStatus);\n\n return () => {\n editor?.destroy();\n };\n }, [ace, editor, __internalRootRef]);\n\n useEffect(() => {\n if (!editor) {\n return;\n }\n if (value === editor.getValue()) {\n return;\n }\n // TODO maintain cursor position?\n const pos = editor.session.selection.toJSON();\n editor.setValue(value, -1);\n editor.session.selection.fromJSON(pos);\n }, [editor, value]);\n\n useEffect(() => {\n editor?.session.setMode(`ace/mode/${language}`);\n }, [editor, language]);\n\n useEffect(() => {\n if (!editor) {\n return;\n }\n\n const theme: CodeEditorProps.Theme = props.preferences?.theme ?? defaultTheme;\n editor.setTheme(getAceTheme(theme));\n\n editor.session.setUseWrapMode(props.preferences?.wrapLines ?? true);\n }, [editor, defaultTheme, props.preferences]);\n\n // Change listeners\n useChangeEffect(editor, props.onChange, props.onDelayedChange);\n\n // Hide error panel when there are no errors to show.\n useEffect(() => {\n if (annotations.length === 0) {\n setPaneStatus('hidden');\n }\n\n if (props.onValidate) {\n fireNonCancelableEvent(props.onValidate, { annotations });\n }\n }, [annotations, props.onValidate]);\n\n const languageLabel = customLanguageLabel ?? getLanguageLabel(language);\n\n const errorCount = annotations.filter(a => a.type === 'error').length;\n const warningCount = annotations.filter(a => a.type === 'warning').length;\n const currentAnnotations = useMemo(() => annotations.filter(a => a.type === paneStatus), [annotations, paneStatus]);\n\n /*\n * Callbacks\n */\n\n const onEditorKeydown = useCallback(\n (e: React.KeyboardEvent) => {\n if (editor && e.target === editor.container && e.keyCode === KeyCode.enter) {\n e.stopPropagation();\n e.preventDefault();\n editor.focus();\n }\n },\n [editor]\n );\n\n const onTabFocus = useCallback(() => setTabFocused(true), []);\n const onTabBlur = useCallback(() => setTabFocused(false), []);\n\n const onResize = useCallback(() => {\n editor?.resize();\n }, [editor]);\n\n const onErrorPaneToggle = useCallback(() => {\n setPaneStatus(paneStatus !== 'error' ? 'error' : 'hidden');\n }, [paneStatus]);\n\n const onWarningPaneToggle = useCallback(() => {\n setPaneStatus(paneStatus !== 'warning' ? 'warning' : 'hidden');\n }, [paneStatus]);\n\n const onPaneClose = useCallback(() => {\n if (paneStatus === 'error' && errorsTabRef.current) {\n errorsTabRef.current.focus();\n }\n if (paneStatus === 'warning' && warningsTabRef.current) {\n warningsTabRef.current.focus();\n }\n setPaneStatus('hidden');\n }, [paneStatus]);\n\n const onAnnotationClick = ({ row = 0, column = 0 }: Ace.Annotation) => {\n if (!editor) {\n return;\n }\n editor.focus();\n editor.gotoLine(row + 1, column, false);\n setHighlightedAnnotation(undefined);\n };\n\n const onAnnotationClear = useCallback(() => {\n setHighlightedAnnotation(undefined);\n }, []);\n\n /**\n * Ignore focus lock if focused element is the pane tab button or within editor tree.\n * This check is required:\n * - When closing the pane with `ESC` key: The panel closes asynchronously and its focus lock\n * still exists when trying to focus the tab button in higher-order component.\n * - When clicking or hittin `Enter` on an annotation: The panel remains open but focus lock\n * deactivates asynchronously.\n */\n const shouldHandleFocus = useCallback(\n (activeElement: HTMLElement): boolean => {\n return (\n activeElement !== errorsTabRef.current &&\n activeElement !== warningsTabRef.current &&\n !editor?.container.contains(activeElement)\n );\n },\n [editor]\n );\n\n const [isPreferencesModalVisible, setPreferencesModalVisible] = useState(false);\n const onPreferencesOpen = () => setPreferencesModalVisible(true);\n const onPreferencesConfirm = (p: CodeEditorProps.Preferences) => {\n fireNonCancelableEvent(props.onPreferencesChange, p);\n setPreferencesModalVisible(false);\n };\n const onPreferencesDismiss = () => setPreferencesModalVisible(false);\n\n const isPaneVisible = paneStatus !== 'hidden';\n\n return (\n <div\n {...baseProps}\n className={clsx(styles['code-editor'], baseProps.className, { [styles['code-editor-refresh']]: isRefresh })}\n ref={mergedRef}\n >\n {props.loading && (\n <LoadingScreen>\n <LiveRegion visible={true}>{i18nStrings.loadingState}</LiveRegion>\n </LoadingScreen>\n )}\n\n {!ace && !props.loading && (\n <ErrorScreen recoveryText={i18nStrings.errorStateRecovery} onRecoveryClick={props.onRecoveryClick}>\n {i18nStrings.errorState}\n </ErrorScreen>\n )}\n\n {ace && !props.loading && (\n <>\n <ResizableBox\n height={Math.max(editorHeight, 20)}\n minHeight={20}\n onResize={height => {\n setEditorHeight(height);\n onResize();\n fireNonCancelableEvent(onEditorContentResize, { height });\n }}\n >\n <div\n ref={codeEditorRef}\n className={clsx(styles.editor, styles.ace, isRefresh && styles['editor-refresh'])}\n onKeyDown={onEditorKeydown}\n tabIndex={0}\n role=\"group\"\n aria-label={i18nStrings.editorGroupAriaLabel}\n />\n </ResizableBox>\n <div role=\"group\" aria-label={i18nStrings.statusBarGroupAriaLabel}>\n <StatusBar\n languageLabel={languageLabel}\n cursorPosition={i18nStrings.cursorPosition(cursorPosition.row + 1, cursorPosition.column + 1)}\n errorCount={errorCount}\n warningCount={warningCount}\n paneStatus={paneStatus}\n onErrorPaneToggle={onErrorPaneToggle}\n onWarningPaneToggle={onWarningPaneToggle}\n onTabFocus={onTabFocus}\n onTabBlur={onTabBlur}\n errorsTabRef={errorsTabRef}\n warningsTabRef={warningsTabRef}\n i18nStrings={i18nStrings}\n isTabFocused={isTabFocused}\n paneId={isPaneVisible ? paneId : undefined}\n onPreferencesOpen={onPreferencesOpen}\n isRefresh={isRefresh}\n />\n <Pane\n id={paneId}\n visible={isPaneVisible}\n annotations={currentAnnotations}\n highlighted={highlightedAnnotation}\n onAnnotationClick={onAnnotationClick}\n onAnnotationClear={onAnnotationClear}\n onClose={onPaneClose}\n onAllowlist={shouldHandleFocus}\n cursorPositionLabel={i18nStrings.cursorPosition}\n closeButtonAriaLabel={i18nStrings.paneCloseButtonAriaLabel}\n />\n </div>\n {isPreferencesModalVisible && (\n <PreferencesModal\n onConfirm={onPreferencesConfirm}\n onDismiss={onPreferencesDismiss}\n themes={props.themes}\n preferences={props.preferences}\n defaultTheme={defaultTheme}\n i18nStrings={{\n header: i18nStrings.preferencesModalHeader,\n cancel: i18nStrings.preferencesModalCancel,\n confirm: i18nStrings.preferencesModalConfirm,\n wrapLines: i18nStrings.preferencesModalWrapLines,\n theme: i18nStrings.preferencesModalTheme,\n lightThemes: i18nStrings.preferencesModalLightThemes,\n darkThemes: i18nStrings.preferencesModalDarkThemes,\n themeFilteringAriaLabel: i18nStrings.preferencesModalThemeFilteringAriaLabel,\n themeFilteringClearAriaLabel: i18nStrings.preferencesModalThemeFilteringClearAriaLabel,\n themeFilteringPlaceholder: i18nStrings.preferencesModalThemeFilteringPlaceholder,\n }}\n />\n )}\n </>\n )}\n </div>\n );\n});\n\napplyDisplayName(CodeEditor, 'CodeEditor');\nexport default CodeEditor;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["code-editor/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE7F,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;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AAY,EAC1B,WAAW,EAAE;oBACX,MAAM,EAAE,WAAW,CAAC,sBAAsB;oBAC1C,MAAM,EAAE,WAAW,CAAC,sBAAsB;oBAC1C,OAAO,EAAE,WAAW,CAAC,uBAAuB;oBAC5C,SAAS,EAAE,WAAW,CAAC,yBAAyB;oBAChD,KAAK,EAAE,WAAW,CAAC,qBAAqB;oBACxC,WAAW,EAAE,WAAW,CAAC,2BAA2B;oBACpD,UAAU,EAAE,WAAW,CAAC,0BAA0B;oBAClD,uBAAuB,EAAE,WAAW,CAAC,uCAAuC;oBAC5E,4BAA4B,EAAE,WAAW,CAAC,4CAA4C;oBACtF,yBAAyB,EAAE,WAAW,CAAC,yCAAyC;iBACjF,GACD,CACH,CACA,CACJ,CACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAC3C,eAAe,UAAU,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState, forwardRef } from 'react';\nimport { Ace } from 'ace-builds';\nimport clsx from 'clsx';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { KeyCode } from '../internal/keycode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { CodeEditorProps } from './interfaces';\nimport { Pane } from './pane';\nimport { useChangeEffect } from './listeners';\nimport {\n getDefaultConfig,\n getAceTheme,\n PaneStatus,\n getLanguageLabel,\n DEFAULT_DARK_THEME,\n DEFAULT_LIGHT_THEME,\n getDefaultTheme,\n} from './util';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { setupEditor } from './setup-editor';\nimport { ResizableBox } from './resizable-box';\nimport PreferencesModal from './preferences-modal';\nimport LoadingScreen from './loading-screen';\nimport ErrorScreen from './error-screen';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { useContainerQuery } from '../internal/hooks/container-queries/use-container-query';\nimport { useCurrentMode } from '../internal/hooks/use-visual-mode';\nimport { StatusBar } from './status-bar';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport LiveRegion from '../internal/components/live-region';\n\nimport styles from './styles.css.js';\n\nexport { CodeEditorProps };\n\nconst CodeEditor = forwardRef((props: CodeEditorProps, ref: React.Ref<CodeEditorProps.Ref>) => {\n const codeEditorRef = useRef<HTMLDivElement>(null);\n const { __internalRootRef } = useBaseComponent('CodeEditor');\n const { controlId, ariaLabelledby, ariaDescribedby } = useFormFieldContext(props);\n const {\n ace,\n value,\n language,\n i18nStrings,\n editorContentHeight,\n onEditorContentResize,\n languageLabel: customLanguageLabel,\n ...rest\n } = props;\n const [editorHeight = 480, setEditorHeight] = useControllable(editorContentHeight, onEditorContentResize, 480, {\n componentName: 'code-editor',\n changeHandler: 'onEditorContentResize',\n controlledProp: 'editorContentHeight',\n });\n const baseProps = getBaseProps(rest);\n\n const [editor, setEditor] = useState<Ace.Editor>();\n const mode = useCurrentMode(__internalRootRef);\n const defaultTheme = mode === 'dark' ? DEFAULT_DARK_THEME : DEFAULT_LIGHT_THEME;\n\n useEffect(() => {\n if (!editor) {\n return;\n }\n const { textarea } = editor.renderer as unknown as { textarea: HTMLTextAreaElement };\n if (!textarea) {\n return;\n }\n const updateAttribute = (attribute: string, value: string | undefined) =>\n value ? textarea.setAttribute(attribute, value) : textarea.removeAttribute(attribute);\n updateAttribute('id', controlId);\n updateAttribute('aria-labelledby', ariaLabelledby);\n updateAttribute('aria-describedby', ariaDescribedby);\n }, [ariaDescribedby, ariaLabelledby, controlId, editor]);\n\n const [paneStatus, setPaneStatus] = useState<PaneStatus>('hidden');\n const [annotations, setAnnotations] = useState<Ace.Annotation[]>([]);\n const [highlightedAnnotation, setHighlightedAnnotation] = useState<Ace.Annotation>();\n const [cursorPosition, setCursorPosition] = useState<Ace.Point>({ row: 0, column: 0 });\n const [isTabFocused, setTabFocused] = useState<boolean>(false);\n\n const errorsTabRef = useRef<HTMLButtonElement>(null);\n const warningsTabRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n const elem = codeEditorRef.current;\n if (!ace || !elem) {\n return;\n }\n const config = getDefaultConfig();\n setEditor(\n ace.edit(elem, {\n ...config,\n theme: getAceTheme(getDefaultTheme(elem)),\n })\n );\n }, [ace, props.loading]);\n const [codeEditorWidth, codeEditorMeasureRef] = useContainerQuery(rect => rect.width);\n const mergedRef = useMergeRefs(codeEditorMeasureRef, __internalRootRef);\n useForwardFocus(ref, codeEditorRef);\n const isRefresh = useVisualRefresh();\n\n useEffect(() => {\n editor?.resize();\n }, [editor, editorContentHeight, codeEditorWidth]);\n\n const paneId = useUniqueId('code-editor-pane');\n\n useEffect(() => {\n if (!ace || !editor) {\n return;\n }\n\n setupEditor(ace, editor, setAnnotations, setCursorPosition, setHighlightedAnnotation, setPaneStatus);\n\n return () => {\n editor?.destroy();\n };\n }, [ace, editor, __internalRootRef]);\n\n useEffect(() => {\n if (!editor) {\n return;\n }\n if (value === editor.getValue()) {\n return;\n }\n // TODO maintain cursor position?\n const pos = editor.session.selection.toJSON();\n editor.setValue(value, -1);\n editor.session.selection.fromJSON(pos);\n }, [editor, value]);\n\n useEffect(() => {\n editor?.session.setMode(`ace/mode/${language}`);\n }, [editor, language]);\n\n useEffect(() => {\n if (!editor) {\n return;\n }\n\n const theme: CodeEditorProps.Theme = props.preferences?.theme ?? defaultTheme;\n editor.setTheme(getAceTheme(theme));\n\n editor.session.setUseWrapMode(props.preferences?.wrapLines ?? true);\n }, [editor, defaultTheme, props.preferences]);\n\n // Change listeners\n useChangeEffect(editor, props.onChange, props.onDelayedChange);\n\n // Hide error panel when there are no errors to show.\n useEffect(() => {\n if (annotations.length === 0) {\n setPaneStatus('hidden');\n }\n\n if (props.onValidate) {\n fireNonCancelableEvent(props.onValidate, { annotations });\n }\n }, [annotations, props.onValidate]);\n\n const languageLabel = customLanguageLabel ?? getLanguageLabel(language);\n\n const errorCount = annotations.filter(a => a.type === 'error').length;\n const warningCount = annotations.filter(a => a.type === 'warning').length;\n const currentAnnotations = useMemo(() => annotations.filter(a => a.type === paneStatus), [annotations, paneStatus]);\n\n /*\n * Callbacks\n */\n\n const onEditorKeydown = useCallback(\n (e: React.KeyboardEvent) => {\n if (editor && e.target === editor.container && e.keyCode === KeyCode.enter) {\n e.stopPropagation();\n e.preventDefault();\n editor.focus();\n }\n },\n [editor]\n );\n\n const onTabFocus = useCallback(() => setTabFocused(true), []);\n const onTabBlur = useCallback(() => setTabFocused(false), []);\n\n const onResize = useCallback(() => {\n editor?.resize();\n }, [editor]);\n\n const onErrorPaneToggle = useCallback(() => {\n setPaneStatus(paneStatus !== 'error' ? 'error' : 'hidden');\n }, [paneStatus]);\n\n const onWarningPaneToggle = useCallback(() => {\n setPaneStatus(paneStatus !== 'warning' ? 'warning' : 'hidden');\n }, [paneStatus]);\n\n const onPaneClose = useCallback(() => {\n if (paneStatus === 'error' && errorsTabRef.current) {\n errorsTabRef.current.focus();\n }\n if (paneStatus === 'warning' && warningsTabRef.current) {\n warningsTabRef.current.focus();\n }\n setPaneStatus('hidden');\n }, [paneStatus]);\n\n const onAnnotationClick = ({ row = 0, column = 0 }: Ace.Annotation) => {\n if (!editor) {\n return;\n }\n editor.focus();\n editor.gotoLine(row + 1, column, false);\n setHighlightedAnnotation(undefined);\n };\n\n const onAnnotationClear = useCallback(() => {\n setHighlightedAnnotation(undefined);\n }, []);\n\n const [isPreferencesModalVisible, setPreferencesModalVisible] = useState(false);\n const onPreferencesOpen = () => setPreferencesModalVisible(true);\n const onPreferencesConfirm = (p: CodeEditorProps.Preferences) => {\n fireNonCancelableEvent(props.onPreferencesChange, p);\n setPreferencesModalVisible(false);\n };\n const onPreferencesDismiss = () => setPreferencesModalVisible(false);\n\n const isPaneVisible = paneStatus !== 'hidden';\n\n return (\n <div\n {...baseProps}\n className={clsx(styles['code-editor'], baseProps.className, { [styles['code-editor-refresh']]: isRefresh })}\n ref={mergedRef}\n >\n {props.loading && (\n <LoadingScreen>\n <LiveRegion visible={true}>{i18nStrings.loadingState}</LiveRegion>\n </LoadingScreen>\n )}\n\n {!ace && !props.loading && (\n <ErrorScreen recoveryText={i18nStrings.errorStateRecovery} onRecoveryClick={props.onRecoveryClick}>\n {i18nStrings.errorState}\n </ErrorScreen>\n )}\n\n {ace && !props.loading && (\n <>\n <ResizableBox\n height={Math.max(editorHeight, 20)}\n minHeight={20}\n onResize={height => {\n setEditorHeight(height);\n onResize();\n fireNonCancelableEvent(onEditorContentResize, { height });\n }}\n >\n <div\n ref={codeEditorRef}\n className={clsx(styles.editor, styles.ace, isRefresh && styles['editor-refresh'])}\n onKeyDown={onEditorKeydown}\n tabIndex={0}\n role=\"group\"\n aria-label={i18nStrings.editorGroupAriaLabel}\n />\n </ResizableBox>\n <div role=\"group\" aria-label={i18nStrings.statusBarGroupAriaLabel}>\n <StatusBar\n languageLabel={languageLabel}\n cursorPosition={i18nStrings.cursorPosition(cursorPosition.row + 1, cursorPosition.column + 1)}\n errorCount={errorCount}\n warningCount={warningCount}\n paneStatus={paneStatus}\n onErrorPaneToggle={onErrorPaneToggle}\n onWarningPaneToggle={onWarningPaneToggle}\n onTabFocus={onTabFocus}\n onTabBlur={onTabBlur}\n errorsTabRef={errorsTabRef}\n warningsTabRef={warningsTabRef}\n i18nStrings={i18nStrings}\n isTabFocused={isTabFocused}\n paneId={isPaneVisible ? paneId : undefined}\n onPreferencesOpen={onPreferencesOpen}\n isRefresh={isRefresh}\n />\n <Pane\n id={paneId}\n visible={isPaneVisible}\n annotations={currentAnnotations}\n highlighted={highlightedAnnotation}\n onAnnotationClick={onAnnotationClick}\n onAnnotationClear={onAnnotationClear}\n onClose={onPaneClose}\n cursorPositionLabel={i18nStrings.cursorPosition}\n closeButtonAriaLabel={i18nStrings.paneCloseButtonAriaLabel}\n />\n </div>\n {isPreferencesModalVisible && (\n <PreferencesModal\n onConfirm={onPreferencesConfirm}\n onDismiss={onPreferencesDismiss}\n themes={props.themes}\n preferences={props.preferences}\n defaultTheme={defaultTheme}\n i18nStrings={{\n header: i18nStrings.preferencesModalHeader,\n cancel: i18nStrings.preferencesModalCancel,\n confirm: i18nStrings.preferencesModalConfirm,\n wrapLines: i18nStrings.preferencesModalWrapLines,\n theme: i18nStrings.preferencesModalTheme,\n lightThemes: i18nStrings.preferencesModalLightThemes,\n darkThemes: i18nStrings.preferencesModalDarkThemes,\n themeFilteringAriaLabel: i18nStrings.preferencesModalThemeFilteringAriaLabel,\n themeFilteringClearAriaLabel: i18nStrings.preferencesModalThemeFilteringClearAriaLabel,\n themeFilteringPlaceholder: i18nStrings.preferencesModalThemeFilteringPlaceholder,\n }}\n />\n )}\n </>\n )}\n </div>\n );\n});\n\napplyDisplayName(CodeEditor, 'CodeEditor');\nexport default CodeEditor;\n"]}
|
package/code-editor/pane.d.ts
CHANGED
|
@@ -7,10 +7,9 @@ export interface PaneProps {
|
|
|
7
7
|
highlighted?: Ace.Annotation;
|
|
8
8
|
cursorPositionLabel: (row: number, column: number) => string;
|
|
9
9
|
closeButtonAriaLabel: string;
|
|
10
|
-
onAllowlist: (activeElement: HTMLElement) => boolean;
|
|
11
10
|
onClose: () => void;
|
|
12
11
|
onAnnotationClick: (annotation: Ace.Annotation) => void;
|
|
13
12
|
onAnnotationClear: () => void;
|
|
14
13
|
}
|
|
15
|
-
export declare const Pane: ({ id, visible, annotations, highlighted,
|
|
14
|
+
export declare const Pane: ({ id, visible, annotations, highlighted, onClose, onAnnotationClick, onAnnotationClear, cursorPositionLabel, closeButtonAriaLabel, }: PaneProps) => JSX.Element | null;
|
|
16
15
|
//# sourceMappingURL=pane.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pane.d.ts","sourceRoot":"lib/default/","sources":["code-editor/pane.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"pane.d.ts","sourceRoot":"lib/default/","sources":["code-editor/pane.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAejC,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IAEX,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC;IAC9B,WAAW,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC;IAE7B,mBAAmB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7D,oBAAoB,EAAE,MAAM,CAAC;IAE7B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,iBAAiB,EAAE,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,KAAK,IAAI,CAAC;IACxD,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,IAAI,yIAUd,SAAS,uBAwGX,CAAC"}
|
package/code-editor/pane.js
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React, { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import FocusLock from 'react-focus-lock';
|
|
6
5
|
import { KeyCode } from '../internal/keycode';
|
|
7
6
|
import { scrollElementIntoView } from '../internal/utils/scrollable-containers';
|
|
7
|
+
import FocusLock from '../internal/components/focus-lock';
|
|
8
8
|
import { InternalButton } from '../button/internal';
|
|
9
9
|
import { ResizableBox } from './resizable-box';
|
|
10
10
|
import styles from './styles.css.js';
|
|
11
11
|
const ANNOTATION_ITEM_HEIGHT = 31;
|
|
12
12
|
const PANE_ANNOTATIONS_PADDING = 12;
|
|
13
13
|
const MIN_HEIGHT = 3 * ANNOTATION_ITEM_HEIGHT + 2 * PANE_ANNOTATIONS_PADDING;
|
|
14
|
-
export const Pane = ({ id, visible, annotations, highlighted,
|
|
14
|
+
export const Pane = ({ id, visible, annotations, highlighted, onClose, onAnnotationClick, onAnnotationClear, cursorPositionLabel, closeButtonAriaLabel, }) => {
|
|
15
15
|
const [paneHeight, setPaneHeight] = useState(MIN_HEIGHT);
|
|
16
16
|
const listRef = useRef(null);
|
|
17
17
|
const [isFocusTrapActive, setFocusTrapActive] = useState(false);
|
|
@@ -27,6 +27,11 @@ export const Pane = ({ id, visible, annotations, highlighted, onAllowlist, onClo
|
|
|
27
27
|
scrollElementIntoView(errorItem);
|
|
28
28
|
}
|
|
29
29
|
}, [highlighted, annotations]);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!visible) {
|
|
32
|
+
setFocusTrapActive(false);
|
|
33
|
+
}
|
|
34
|
+
}, [visible]);
|
|
30
35
|
const onItemFocus = () => {
|
|
31
36
|
setFocusTrapActive(true);
|
|
32
37
|
onAnnotationClear();
|
|
@@ -54,7 +59,7 @@ export const Pane = ({ id, visible, annotations, highlighted, onAllowlist, onClo
|
|
|
54
59
|
}
|
|
55
60
|
return (React.createElement("div", { id: id, className: styles.pane, onKeyDown: onEscKeyDown, role: "tabpanel" },
|
|
56
61
|
React.createElement(ResizableBox, { height: paneHeight, minHeight: MIN_HEIGHT, onResize: newHeight => setPaneHeight(newHeight) },
|
|
57
|
-
React.createElement(FocusLock, { disabled: !isFocusTrapActive, className: styles['focus-lock'], autoFocus:
|
|
62
|
+
React.createElement(FocusLock, { disabled: !isFocusTrapActive, className: styles['focus-lock'], autoFocus: true },
|
|
58
63
|
React.createElement("div", { className: styles.pane__list, tabIndex: -1 },
|
|
59
64
|
React.createElement("table", { className: styles.pane__table, role: "presentation" },
|
|
60
65
|
React.createElement("colgroup", null,
|
package/code-editor/pane.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pane.js","sourceRoot":"lib/default/","sources":["code-editor/pane.tsx"],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AAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,EAAE,UAAU,KAAK,WAAW;6BAChE,CAAC,EACF,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,iBAAiB,EAC9B,OAAO,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,EAC3C,SAAS,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,EAC/C,QAAQ,EAAE,CAAC,EACX,IAAI,EAAC,MAAM;4BAEX,4BAAI,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,IACxE,mBAAmB,CAAC,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAC1E;4BACL,4BAAI,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,IAC3E,UAAU,CAAC,IAAI,CACb,CACF,CACN,CAAC,CACI,CACF,CACJ;gBACN,6BAAK,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC;oBAC7C,oBAAC,cAAc,IACb,UAAU,EAAC,MAAM,EACjB,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,oBAAoB,GAC/B,CACE,CACI,CACC,CACX,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { Ace } from 'ace-builds';\n\nimport { KeyCode } from '../internal/keycode';\nimport { scrollElementIntoView } from '../internal/utils/scrollable-containers';\nimport FocusLock from '../internal/components/focus-lock';\n\nimport { InternalButton } from '../button/internal';\nimport { ResizableBox } from './resizable-box';\n\nimport styles from './styles.css.js';\n\nconst ANNOTATION_ITEM_HEIGHT = 31;\nconst PANE_ANNOTATIONS_PADDING = 12;\nconst MIN_HEIGHT = 3 * ANNOTATION_ITEM_HEIGHT + 2 * PANE_ANNOTATIONS_PADDING;\n\nexport interface PaneProps {\n id: string;\n\n visible: boolean;\n annotations: Ace.Annotation[];\n highlighted?: Ace.Annotation;\n\n cursorPositionLabel: (row: number, column: number) => string;\n closeButtonAriaLabel: string;\n\n onClose: () => void;\n onAnnotationClick: (annotation: Ace.Annotation) => void;\n onAnnotationClear: () => void;\n}\n\nexport const Pane = ({\n id,\n visible,\n annotations,\n highlighted,\n onClose,\n onAnnotationClick,\n onAnnotationClear,\n cursorPositionLabel,\n closeButtonAriaLabel,\n}: PaneProps) => {\n const [paneHeight, setPaneHeight] = useState(MIN_HEIGHT);\n const listRef = useRef<HTMLTableSectionElement>(null);\n const [isFocusTrapActive, setFocusTrapActive] = useState(false);\n\n useEffect(() => {\n if (!highlighted) {\n return;\n }\n const { row, column } = highlighted;\n const highlightedAnnotationIndex = annotations.indexOf(\n annotations.filter(a => a.row === row && a.column === column)[0]\n );\n\n if (highlightedAnnotationIndex > -1) {\n const errorItem = listRef.current?.children[highlightedAnnotationIndex] as HTMLElement | undefined;\n scrollElementIntoView(errorItem);\n }\n }, [highlighted, annotations]);\n\n useEffect(() => {\n if (!visible) {\n setFocusTrapActive(false);\n }\n }, [visible]);\n\n const onItemFocus = () => {\n setFocusTrapActive(true);\n onAnnotationClear();\n };\n\n const onItemClick = (annotation: Ace.Annotation) => {\n setFocusTrapActive(false);\n onAnnotationClick(annotation);\n };\n\n const onItemKeyDown = (annotation: Ace.Annotation, event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.enter || event.keyCode === KeyCode.space) {\n event.preventDefault();\n setFocusTrapActive(false);\n onAnnotationClick(annotation);\n }\n };\n\n const onEscKeyDown = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n event.preventDefault();\n setFocusTrapActive(false);\n onClose();\n }\n };\n\n if (!visible) {\n return null;\n }\n\n return (\n <div id={id} className={styles.pane} onKeyDown={onEscKeyDown} role=\"tabpanel\">\n <ResizableBox height={paneHeight} minHeight={MIN_HEIGHT} onResize={newHeight => setPaneHeight(newHeight)}>\n <FocusLock disabled={!isFocusTrapActive} className={styles['focus-lock']} autoFocus={true}>\n <div className={styles.pane__list} tabIndex={-1}>\n <table className={styles.pane__table} role=\"presentation\">\n <colgroup>\n <col style={{ width: 1 } /* shrink to fit content */} />\n <col style={{ width: 'auto' }} />\n </colgroup>\n <tbody ref={listRef}>\n {annotations.map((annotation, i) => (\n <tr\n key={i}\n className={clsx(styles.pane__item, {\n [styles['pane__item--highlighted']]: annotation === highlighted,\n })}\n onFocus={onItemFocus}\n onMouseOver={onAnnotationClear}\n onClick={onItemClick.bind(null, annotation)}\n onKeyDown={onItemKeyDown.bind(null, annotation)}\n tabIndex={0}\n role=\"link\"\n >\n <td className={clsx(styles.pane__location, styles.pane__cell)} tabIndex={-1}>\n {cursorPositionLabel((annotation.row || 0) + 1, (annotation.column || 0) + 1)}\n </td>\n <td className={clsx(styles.pane__description, styles.pane__cell)} tabIndex={-1}>\n {annotation.text}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n <div className={styles['pane__close-container']}>\n <InternalButton\n formAction=\"none\"\n variant=\"icon\"\n iconName=\"close\"\n onClick={onClose}\n ariaLabel={closeButtonAriaLabel}\n />\n </div>\n </FocusLock>\n </ResizableBox>\n </div>\n );\n};\n"]}
|
|
@@ -4,14 +4,14 @@ interface StatusBarProps {
|
|
|
4
4
|
languageLabel: string;
|
|
5
5
|
cursorPosition: string;
|
|
6
6
|
paneStatus: string;
|
|
7
|
-
errorsTabRef: React.RefObject<HTMLButtonElement>;
|
|
8
|
-
warningsTabRef: React.RefObject<HTMLButtonElement>;
|
|
9
7
|
isTabFocused: boolean;
|
|
10
8
|
paneId?: string;
|
|
11
9
|
i18nStrings: CodeEditorProps.I18nStrings;
|
|
12
10
|
errorCount: number;
|
|
13
11
|
warningCount: number;
|
|
14
12
|
isRefresh: boolean;
|
|
13
|
+
errorsTabRef?: React.RefObject<HTMLButtonElement>;
|
|
14
|
+
warningsTabRef?: React.RefObject<HTMLButtonElement>;
|
|
15
15
|
onErrorPaneToggle: () => void;
|
|
16
16
|
onWarningPaneToggle: () => void;
|
|
17
17
|
onTabFocus?: React.FocusEventHandler<HTMLButtonElement>;
|
|
@@ -19,6 +19,6 @@ interface StatusBarProps {
|
|
|
19
19
|
onPreferencesOpen: () => void;
|
|
20
20
|
onHeightChange?: (height: number | null) => void;
|
|
21
21
|
}
|
|
22
|
-
export declare const StatusBar: (
|
|
22
|
+
export declare const StatusBar: ({ errorsTabRef, warningsTabRef, ...restProps }: StatusBarProps) => JSX.Element;
|
|
23
23
|
export {};
|
|
24
24
|
//# sourceMappingURL=status-bar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-bar.d.ts","sourceRoot":"lib/default/","sources":["code-editor/status-bar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,UAAU,cAAc;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"status-bar.d.ts","sourceRoot":"lib/default/","sources":["code-editor/status-bar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,UAAU,cAAc;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,eAAe,CAAC,WAAW,CAAC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IAEnB,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAClD,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAEpD,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,UAAU,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACxD,SAAS,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACvD,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAClD;AA+GD,eAAO,MAAM,SAAS,mDAAoD,cAAc,gBAqBvF,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
1
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
4
|
import React from 'react';
|
|
@@ -36,14 +37,15 @@ function InternalStatusBar({ languageLabel, cursorPosition, paneStatus, onErrorP
|
|
|
36
37
|
'aria-hidden': paneStatus !== 'hidden' && isTabFocused ? true : undefined,
|
|
37
38
|
} })))));
|
|
38
39
|
}
|
|
39
|
-
export const StatusBar = (
|
|
40
|
+
export const StatusBar = (_a) => {
|
|
41
|
+
var { errorsTabRef, warningsTabRef } = _a, restProps = __rest(_a, ["errorsTabRef", "warningsTabRef"]);
|
|
40
42
|
// create a virtual status bar, in order to calculate the width with full tab button text
|
|
41
43
|
// and decide if tab button text needs to be reduced
|
|
42
44
|
const [realWidth, statusLeftBarRef] = useContainerQuery(rect => rect.width);
|
|
43
45
|
const [virtualWidth, virtualStatusLeftBarRef] = useContainerQuery(rect => rect.width);
|
|
44
46
|
const minifyCounters = virtualWidth !== null && realWidth !== null && virtualWidth > realWidth;
|
|
45
47
|
return (React.createElement(React.Fragment, null,
|
|
46
|
-
React.createElement(InternalStatusBar, Object.assign({ isVirtual: false
|
|
47
|
-
React.createElement(InternalStatusBar, Object.assign({ isVirtual: true
|
|
48
|
+
React.createElement(InternalStatusBar, Object.assign({}, restProps, { isVirtual: false, leftBarRef: statusLeftBarRef, errorsTabRef: errorsTabRef, warningsTabRef: warningsTabRef, minifyCounters: minifyCounters })),
|
|
49
|
+
React.createElement(InternalStatusBar, Object.assign({}, restProps, { isVirtual: true, leftBarRef: virtualStatusLeftBarRef, minifyCounters: false }))));
|
|
48
50
|
};
|
|
49
51
|
//# sourceMappingURL=status-bar.js.map
|