@cloudscape-design/components 3.0.294 → 3.0.296
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/alert/internal.d.ts.map +1 -1
- package/alert/internal.js +1 -1
- package/alert/internal.js.map +1 -1
- package/area-chart/elements/use-highlight-details.d.ts.map +1 -1
- package/area-chart/elements/use-highlight-details.js +3 -1
- package/area-chart/elements/use-highlight-details.js.map +1 -1
- package/area-chart/interfaces.d.ts +1 -0
- package/area-chart/interfaces.d.ts.map +1 -1
- package/area-chart/interfaces.js.map +1 -1
- package/breadcrumb-group/index.d.ts +1 -1
- package/breadcrumb-group/index.d.ts.map +1 -1
- package/breadcrumb-group/index.js +2 -2
- package/breadcrumb-group/index.js.map +1 -1
- package/breadcrumb-group/internal.d.ts +1 -2
- package/breadcrumb-group/internal.d.ts.map +1 -1
- package/breadcrumb-group/internal.js +8 -1
- package/breadcrumb-group/internal.js.map +1 -1
- package/breadcrumb-group/item/item.d.ts.map +1 -1
- package/breadcrumb-group/item/item.js +9 -6
- package/breadcrumb-group/item/item.js.map +1 -1
- package/button/internal.d.ts.map +1 -1
- package/button/internal.js +6 -1
- package/button/internal.js.map +1 -1
- package/cards/index.d.ts.map +1 -1
- package/cards/index.js +6 -1
- package/cards/index.js.map +1 -1
- package/code-editor/index.d.ts.map +1 -1
- package/code-editor/index.js +18 -16
- package/code-editor/index.js.map +1 -1
- package/code-editor/interfaces.d.ts +1 -1
- package/code-editor/interfaces.d.ts.map +1 -1
- package/code-editor/interfaces.js.map +1 -1
- package/code-editor/pane.d.ts +2 -2
- package/code-editor/pane.d.ts.map +1 -1
- package/code-editor/pane.js +8 -5
- package/code-editor/pane.js.map +1 -1
- package/code-editor/preferences-modal.d.ts +7 -7
- package/code-editor/preferences-modal.d.ts.map +1 -1
- package/code-editor/preferences-modal.js.map +1 -1
- package/code-editor/status-bar.d.ts +2 -2
- 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/container/index.d.ts.map +1 -1
- package/container/index.js +3 -1
- package/container/index.js.map +1 -1
- package/container/internal.d.ts.map +1 -1
- package/container/internal.js +4 -2
- package/container/internal.js.map +1 -1
- package/form/index.d.ts.map +1 -1
- package/form/index.js +5 -1
- package/form/index.js.map +1 -1
- package/form/internal.d.ts.map +1 -1
- package/form/internal.js +11 -2
- package/form/internal.js.map +1 -1
- package/form-field/internal.d.ts.map +1 -1
- package/form-field/internal.js +28 -2
- package/form-field/internal.js.map +1 -1
- package/header/internal.d.ts.map +1 -1
- package/header/internal.js +1 -1
- package/header/internal.js.map +1 -1
- package/help-panel/index.d.ts.map +1 -1
- package/help-panel/index.js +3 -1
- package/help-panel/index.js.map +1 -1
- package/internal/analytics/hooks/use-funnel.d.ts.map +1 -1
- package/internal/analytics/hooks/use-funnel.js +17 -11
- package/internal/analytics/hooks/use-funnel.js.map +1 -1
- package/internal/components/cartesian-chart/bottom-labels.d.ts.map +1 -1
- package/internal/components/cartesian-chart/bottom-labels.js +3 -1
- package/internal/components/cartesian-chart/bottom-labels.js.map +1 -1
- package/internal/components/cartesian-chart/interfaces.d.ts +4 -0
- package/internal/components/cartesian-chart/interfaces.d.ts.map +1 -1
- package/internal/components/cartesian-chart/interfaces.js.map +1 -1
- package/internal/components/cartesian-chart/left-labels.d.ts.map +1 -1
- package/internal/components/cartesian-chart/left-labels.js +3 -1
- package/internal/components/cartesian-chart/left-labels.js.map +1 -1
- package/internal/components/chart-filter/index.d.ts.map +1 -1
- package/internal/components/chart-filter/index.js +4 -2
- package/internal/components/chart-filter/index.js.map +1 -1
- package/internal/components/chart-legend/index.d.ts.map +1 -1
- package/internal/components/chart-legend/index.js +3 -1
- package/internal/components/chart-legend/index.js.map +1 -1
- package/internal/components/chart-plot/index.d.ts.map +1 -1
- package/internal/components/chart-plot/index.js +3 -1
- package/internal/components/chart-plot/index.js.map +1 -1
- package/internal/components/chart-status-container/index.d.ts.map +1 -1
- package/internal/components/chart-status-container/index.js +7 -4
- package/internal/components/chart-status-container/index.js.map +1 -1
- package/internal/components/token-list/token-limit-toggle.d.ts.map +1 -1
- package/internal/components/token-list/token-limit-toggle.js +4 -2
- package/internal/components/token-list/token-limit-toggle.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/i18n/testing.d.ts +8 -0
- package/internal/i18n/testing.d.ts.map +1 -0
- package/internal/i18n/testing.js +8 -0
- package/internal/i18n/testing.js.map +1 -0
- package/internal/manifest.json +1 -1
- package/link/internal.d.ts.map +1 -1
- package/link/internal.js +39 -2
- package/link/internal.js.map +1 -1
- package/multiselect/internal.d.ts.map +1 -1
- package/multiselect/internal.js +3 -1
- package/multiselect/internal.js.map +1 -1
- package/package.json +1 -1
- package/pie-chart/interfaces.d.ts +4 -0
- package/pie-chart/interfaces.d.ts.map +1 -1
- package/pie-chart/interfaces.js.map +1 -1
- package/pie-chart/pie-chart.d.ts.map +1 -1
- package/pie-chart/pie-chart.js +3 -1
- package/pie-chart/pie-chart.js.map +1 -1
- package/pie-chart/segments.d.ts.map +1 -1
- package/pie-chart/segments.js +3 -1
- package/pie-chart/segments.js.map +1 -1
- package/pie-chart/utils.d.ts +2 -1
- package/pie-chart/utils.d.ts.map +1 -1
- package/pie-chart/utils.js +3 -3
- package/pie-chart/utils.js.map +1 -1
- package/popover/body.d.ts.map +1 -1
- package/popover/body.js +3 -1
- package/popover/body.js.map +1 -1
- package/popover/interfaces.d.ts +1 -0
- package/popover/interfaces.d.ts.map +1 -1
- package/popover/interfaces.js.map +1 -1
- package/table/styles.css.js +35 -33
- package/table/styles.scoped.css +49 -43
- package/table/styles.selectors.js +35 -33
- package/table/use-sticky-scrollbar.d.ts +1 -0
- package/table/use-sticky-scrollbar.d.ts.map +1 -1
- package/table/use-sticky-scrollbar.js +10 -36
- package/table/use-sticky-scrollbar.js.map +1 -1
- package/tabs/interfaces.d.ts +2 -2
- package/tabs/interfaces.d.ts.map +1 -1
- package/tabs/interfaces.js.map +1 -1
- package/tabs/tab-header-bar.d.ts.map +1 -1
- package/tabs/tab-header-bar.js +4 -2
- package/tabs/tab-header-bar.js.map +1 -1
- package/tiles/interfaces.d.ts +4 -0
- package/tiles/interfaces.d.ts.map +1 -1
- package/tiles/interfaces.js.map +1 -1
- package/tiles/internal.d.ts.map +1 -1
- package/tiles/internal.js +2 -2
- package/tiles/internal.js.map +1 -1
- package/top-navigation/interfaces.d.ts +2 -0
- package/top-navigation/interfaces.d.ts.map +1 -1
- package/top-navigation/interfaces.js.map +1 -1
- package/top-navigation/parts/overflow-menu/menu-item.d.ts +1 -0
- package/top-navigation/parts/overflow-menu/menu-item.d.ts.map +1 -1
- package/top-navigation/parts/overflow-menu/menu-item.js +2 -0
- package/top-navigation/parts/overflow-menu/menu-item.js.map +1 -1
- package/top-navigation/parts/overflow-menu/views/submenu.d.ts.map +1 -1
- package/top-navigation/parts/overflow-menu/views/submenu.js +1 -0
- package/top-navigation/parts/overflow-menu/views/submenu.js.map +1 -1
- package/top-navigation/parts/overflow-menu/views/utilities.d.ts.map +1 -1
- package/top-navigation/parts/overflow-menu/views/utilities.js +1 -1
- package/top-navigation/parts/overflow-menu/views/utilities.js.map +1 -1
package/code-editor/index.js
CHANGED
|
@@ -27,6 +27,7 @@ import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
|
27
27
|
import { useControllable } from '../internal/hooks/use-controllable';
|
|
28
28
|
import LiveRegion from '../internal/components/live-region';
|
|
29
29
|
import styles from './styles.css.js';
|
|
30
|
+
import { useInternalI18n } from '../internal/i18n/context';
|
|
30
31
|
const CodeEditor = forwardRef((props, ref) => {
|
|
31
32
|
const codeEditorRef = useRef(null);
|
|
32
33
|
const { __internalRootRef } = useBaseComponent('CodeEditor');
|
|
@@ -38,6 +39,7 @@ const CodeEditor = forwardRef((props, ref) => {
|
|
|
38
39
|
controlledProp: 'editorContentHeight',
|
|
39
40
|
});
|
|
40
41
|
const baseProps = getBaseProps(rest);
|
|
42
|
+
const i18n = useInternalI18n('code-editor');
|
|
41
43
|
const [editor, setEditor] = useState();
|
|
42
44
|
const mode = useCurrentMode(__internalRootRef);
|
|
43
45
|
const defaultTheme = mode === 'dark' ? DEFAULT_DARK_THEME : DEFAULT_LIGHT_THEME;
|
|
@@ -176,29 +178,29 @@ const CodeEditor = forwardRef((props, ref) => {
|
|
|
176
178
|
const isPaneVisible = paneStatus !== 'hidden';
|
|
177
179
|
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(styles['code-editor'], baseProps.className, { [styles['code-editor-refresh']]: isRefresh }), ref: mergedRef }),
|
|
178
180
|
props.loading && (React.createElement(LoadingScreen, null,
|
|
179
|
-
React.createElement(LiveRegion, { visible: true }, i18nStrings.loadingState))),
|
|
180
|
-
!ace && !props.loading && (React.createElement(ErrorScreen, { recoveryText: i18nStrings.errorStateRecovery, onRecoveryClick: props.onRecoveryClick }, i18nStrings.errorState)),
|
|
181
|
+
React.createElement(LiveRegion, { visible: true }, i18n('i18nStrings.loadingState', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.loadingState)))),
|
|
182
|
+
!ace && !props.loading && (React.createElement(ErrorScreen, { recoveryText: i18n('i18nStrings.errorStateRecovery', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.errorStateRecovery), onRecoveryClick: props.onRecoveryClick }, i18n('i18nStrings.errorState', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.errorState))),
|
|
181
183
|
ace && !props.loading && (React.createElement(React.Fragment, null,
|
|
182
184
|
React.createElement(ResizableBox, { height: Math.max(editorHeight, 20), minHeight: 20, onResize: height => {
|
|
183
185
|
setEditorHeight(height);
|
|
184
186
|
onResize();
|
|
185
187
|
fireNonCancelableEvent(onEditorContentResize, { height });
|
|
186
188
|
} },
|
|
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 })),
|
|
188
|
-
React.createElement("div", { role: "group", "aria-label": i18nStrings.statusBarGroupAriaLabel },
|
|
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 }),
|
|
190
|
-
React.createElement(Pane, { id: paneId, visible: isPaneVisible, annotations: currentAnnotations, highlighted: highlightedAnnotation, onAnnotationClick: onAnnotationClick, onAnnotationClear: onAnnotationClear, onClose: onPaneClose, cursorPositionLabel: i18nStrings.cursorPosition, closeButtonAriaLabel: i18nStrings.paneCloseButtonAriaLabel })),
|
|
189
|
+
React.createElement("div", { ref: codeEditorRef, className: clsx(styles.editor, styles.ace, isRefresh && styles['editor-refresh']), onKeyDown: onEditorKeydown, tabIndex: 0, role: "group", "aria-label": i18n('i18nStrings.editorGroupAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.editorGroupAriaLabel) })),
|
|
190
|
+
React.createElement("div", { role: "group", "aria-label": i18n('i18nStrings.statusBarGroupAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.statusBarGroupAriaLabel) },
|
|
191
|
+
React.createElement(StatusBar, { languageLabel: languageLabel, cursorPosition: i18n('i18nStrings.cursorPosition', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.cursorPosition(cursorPosition.row + 1, cursorPosition.column + 1), format => format({ row: cursorPosition.row + 1, column: 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 }),
|
|
192
|
+
React.createElement(Pane, { id: paneId, visible: isPaneVisible, annotations: currentAnnotations, highlighted: highlightedAnnotation, onAnnotationClick: onAnnotationClick, onAnnotationClear: onAnnotationClear, onClose: onPaneClose, cursorPositionLabel: i18n('i18nStrings.cursorPosition', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.cursorPosition, format => (row, column) => format({ row, column })), closeButtonAriaLabel: i18n('i18nStrings.paneCloseButtonAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.paneCloseButtonAriaLabel) })),
|
|
191
193
|
isPreferencesModalVisible && (React.createElement(PreferencesModal, { onConfirm: onPreferencesConfirm, onDismiss: onPreferencesDismiss, themes: props.themes, preferences: props.preferences, defaultTheme: defaultTheme, i18nStrings: {
|
|
192
|
-
header: i18nStrings.preferencesModalHeader,
|
|
193
|
-
cancel: i18nStrings.preferencesModalCancel,
|
|
194
|
-
confirm: i18nStrings.preferencesModalConfirm,
|
|
195
|
-
wrapLines: i18nStrings.preferencesModalWrapLines,
|
|
196
|
-
theme: i18nStrings.preferencesModalTheme,
|
|
197
|
-
lightThemes: i18nStrings.preferencesModalLightThemes,
|
|
198
|
-
darkThemes: i18nStrings.preferencesModalDarkThemes,
|
|
199
|
-
themeFilteringAriaLabel: i18nStrings.preferencesModalThemeFilteringAriaLabel,
|
|
200
|
-
themeFilteringClearAriaLabel: i18nStrings.preferencesModalThemeFilteringClearAriaLabel,
|
|
201
|
-
themeFilteringPlaceholder: i18nStrings.preferencesModalThemeFilteringPlaceholder,
|
|
194
|
+
header: i18n('i18nStrings.preferencesModalHeader', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalHeader),
|
|
195
|
+
cancel: i18n('i18nStrings.preferencesModalCancel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalCancel),
|
|
196
|
+
confirm: i18n('i18nStrings.preferencesModalConfirm', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalConfirm),
|
|
197
|
+
wrapLines: i18n('i18nStrings.preferencesModalWrapLines', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalWrapLines),
|
|
198
|
+
theme: i18n('i18nStrings.preferencesModalTheme', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalTheme),
|
|
199
|
+
lightThemes: i18n('i18nStrings.preferencesModalLightThemes', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalLightThemes),
|
|
200
|
+
darkThemes: i18n('i18nStrings.preferencesModalDarkThemes', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalDarkThemes),
|
|
201
|
+
themeFilteringAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalThemeFilteringAriaLabel,
|
|
202
|
+
themeFilteringClearAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalThemeFilteringClearAriaLabel,
|
|
203
|
+
themeFilteringPlaceholder: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalThemeFilteringPlaceholder,
|
|
202
204
|
} }))))));
|
|
203
205
|
});
|
|
204
206
|
applyDisplayName(CodeEditor, 'CodeEditor');
|
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,EAA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E,WAAW,CAAC,cAAc,EAC/C,oBAAoB,EAAE,WAAW,CAAC,wBAAwB,GAC1D,CACE;YACL,yBAAyB,IAAI,CAC5B,oBAAC,gBAAgB,IACf,SAAS,EAAE,oBAAoB,EAC/B,SAAS,EAAE,oBAAoB,EAC/B,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,YAAY,EAAE,YAAY,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"]}
|
|
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;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CAAC,qCAAqC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,uBAAuB,CAAC;oBAC1F,SAAS,EAAE,IAAI,CAAC,uCAAuC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,yBAAyB,CAAC;oBAChG,KAAK,EAAE,IAAI,CAAC,mCAAmC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,qBAAqB,CAAC;oBACpF,WAAW,EAAE,IAAI,CAAC,yCAAyC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,2BAA2B,CAAC;oBACtG,UAAU,EAAE,IAAI,CAAC,wCAAwC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,0BAA0B,CAAC;oBACnG,uBAAuB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,uCAAuC;oBAC7E,4BAA4B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,4CAA4C;oBACvF,yBAAyB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,yCAAyC;iBAClF,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';\nimport { useInternalI18n } from '../internal/i18n/context';\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 const i18n = useInternalI18n('code-editor');\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}>{i18n('i18nStrings.loadingState', i18nStrings?.loadingState)}</LiveRegion>\n </LoadingScreen>\n )}\n\n {!ace && !props.loading && (\n <ErrorScreen\n recoveryText={i18n('i18nStrings.errorStateRecovery', i18nStrings?.errorStateRecovery)}\n onRecoveryClick={props.onRecoveryClick}\n >\n {i18n('i18nStrings.errorState', 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={i18n('i18nStrings.editorGroupAriaLabel', i18nStrings?.editorGroupAriaLabel)}\n />\n </ResizableBox>\n <div\n role=\"group\"\n aria-label={i18n('i18nStrings.statusBarGroupAriaLabel', i18nStrings?.statusBarGroupAriaLabel)}\n >\n <StatusBar\n languageLabel={languageLabel}\n cursorPosition={i18n(\n 'i18nStrings.cursorPosition',\n i18nStrings?.cursorPosition(cursorPosition.row + 1, cursorPosition.column + 1),\n format => format({ row: cursorPosition.row + 1, column: cursorPosition.column + 1 })\n )}\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={i18n(\n 'i18nStrings.cursorPosition',\n i18nStrings?.cursorPosition,\n format => (row, column) => format({ row, column })\n )}\n closeButtonAriaLabel={i18n('i18nStrings.paneCloseButtonAriaLabel', 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: i18n('i18nStrings.preferencesModalHeader', i18nStrings?.preferencesModalHeader),\n cancel: i18n('i18nStrings.preferencesModalCancel', i18nStrings?.preferencesModalCancel),\n confirm: i18n('i18nStrings.preferencesModalConfirm', i18nStrings?.preferencesModalConfirm),\n wrapLines: i18n('i18nStrings.preferencesModalWrapLines', i18nStrings?.preferencesModalWrapLines),\n theme: i18n('i18nStrings.preferencesModalTheme', i18nStrings?.preferencesModalTheme),\n lightThemes: i18n('i18nStrings.preferencesModalLightThemes', i18nStrings?.preferencesModalLightThemes),\n darkThemes: i18n('i18nStrings.preferencesModalDarkThemes', 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"]}
|
|
@@ -83,7 +83,7 @@ export interface CodeEditorProps extends BaseComponentProps, FormFieldControlPro
|
|
|
83
83
|
* * `errorStateRecovery`: Specifies the text for the recovery button that's displayed next to the error text.
|
|
84
84
|
* Use the `recoveryClick` event to do a recovery action (for example, retrying the request).
|
|
85
85
|
*/
|
|
86
|
-
i18nStrings
|
|
86
|
+
i18nStrings?: CodeEditorProps.I18nStrings;
|
|
87
87
|
/**
|
|
88
88
|
* Specifies the height of the code editor document.
|
|
89
89
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["code-editor/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E,MAAM,WAAW,eAAgB,SAAQ,kBAAkB,EAAE,qBAAqB;IAChF;;OAEG;IACH,GAAG,EAAE,GAAG,CAAC;IAET;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC;IAEnC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,QAAQ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AC;KAC/B;IAED,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["code-editor/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Ace } from 'ace-builds';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { AceModes } from './ace-modes';\nimport { DarkThemes, LightThemes } from './ace-themes';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\n\nexport interface CodeEditorProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * The ace object.\n */\n ace: any;\n\n /**\n * Specifies the content that's displayed in the code editor.\n */\n value: string;\n\n /**\n * Specifies the programming language. You can use any of the programming languages supported by the `ace` object that you provide.\n * Alternatively, this can be used to set a language that is not supported by the default `language` list. Make sure you've added the highlighting support for this language to the Ace instance.\n * For more info on custom languages, see the [Code editor API](/components/code-editor?tabId=api) page.\n */\n language: CodeEditorProps.Language;\n\n /**\n * Specifies a custom label language. If set, it overrides the default language label.\n */\n languageLabel?: string;\n\n /**\n * An event handler called when the value changes.\n * The event `detail` contains the current value of the code editor content.\n * **Deprecated** Replaced by `onDelayedChange`.\n */\n onChange?: NonCancelableEventHandler<CodeEditorProps.ChangeDetail>;\n\n /**\n * An event handler called when the value changes.\n * The event `detail` contains the current value of the code editor content.\n * A user interaction can cause multiple change events to be emitted by the Ace editor. They are batched together into a single `onDelayedChange` event to avoid bugs when controlling the `value` field.\n */\n onDelayedChange?: NonCancelableEventHandler<CodeEditorProps.ChangeDetail>;\n\n /**\n * Annotations returned from Ace syntax checker after code validation.\n */\n onValidate?: NonCancelableEventHandler<CodeEditorProps.ValidateDetail>;\n\n /**\n * Specifies the component preferences.\n *\n * If set to `undefined`, the component uses the following default value:\n *\n * ```\n * {\n * wrapLines: true,\n * theme: 'dawn'\n * }\n * ```\n *\n * You can use any theme provided by Ace.\n */\n preferences?: Partial<CodeEditorProps.Preferences>;\n\n /**\n * List of Ace themes available for selection in preferences dialog. Make sure you include at least one light and at\n * least one dark theme. If not set explicitly, it will render all Ace themes available for selection.\n */\n themes?: CodeEditorProps.AvailableThemes;\n\n /**\n * Called when any of the preferences change.\n * The event `detail` contains the value of all the preferences as submitted by the user.\n *\n */\n onPreferencesChange: NonCancelableEventHandler<CodeEditorProps.Preferences>;\n\n /**\n * Renders the code editor in a loading state.\n */\n loading?: boolean;\n\n /**\n * Called when the user clicks the recovery button in the error state.\n * Use this to retry loading the code editor or to provide another option for the user to recover from the error.\n */\n onRecoveryClick?: NonCancelableEventHandler<void>;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * The object should contain, among others:\n *\n * * `loadingState` - Specifies the text to display while the component is loading.\n * * `errorState` - Specifies the text to display if there is an error loading Ace.\n * * `errorStateRecovery`: Specifies the text for the recovery button that's displayed next to the error text.\n * Use the `recoveryClick` event to do a recovery action (for example, retrying the request).\n */\n i18nStrings
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["code-editor/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Ace } from 'ace-builds';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { AceModes } from './ace-modes';\nimport { DarkThemes, LightThemes } from './ace-themes';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\n\nexport interface CodeEditorProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * The ace object.\n */\n ace: any;\n\n /**\n * Specifies the content that's displayed in the code editor.\n */\n value: string;\n\n /**\n * Specifies the programming language. You can use any of the programming languages supported by the `ace` object that you provide.\n * Alternatively, this can be used to set a language that is not supported by the default `language` list. Make sure you've added the highlighting support for this language to the Ace instance.\n * For more info on custom languages, see the [Code editor API](/components/code-editor?tabId=api) page.\n */\n language: CodeEditorProps.Language;\n\n /**\n * Specifies a custom label language. If set, it overrides the default language label.\n */\n languageLabel?: string;\n\n /**\n * An event handler called when the value changes.\n * The event `detail` contains the current value of the code editor content.\n * **Deprecated** Replaced by `onDelayedChange`.\n */\n onChange?: NonCancelableEventHandler<CodeEditorProps.ChangeDetail>;\n\n /**\n * An event handler called when the value changes.\n * The event `detail` contains the current value of the code editor content.\n * A user interaction can cause multiple change events to be emitted by the Ace editor. They are batched together into a single `onDelayedChange` event to avoid bugs when controlling the `value` field.\n */\n onDelayedChange?: NonCancelableEventHandler<CodeEditorProps.ChangeDetail>;\n\n /**\n * Annotations returned from Ace syntax checker after code validation.\n */\n onValidate?: NonCancelableEventHandler<CodeEditorProps.ValidateDetail>;\n\n /**\n * Specifies the component preferences.\n *\n * If set to `undefined`, the component uses the following default value:\n *\n * ```\n * {\n * wrapLines: true,\n * theme: 'dawn'\n * }\n * ```\n *\n * You can use any theme provided by Ace.\n */\n preferences?: Partial<CodeEditorProps.Preferences>;\n\n /**\n * List of Ace themes available for selection in preferences dialog. Make sure you include at least one light and at\n * least one dark theme. If not set explicitly, it will render all Ace themes available for selection.\n */\n themes?: CodeEditorProps.AvailableThemes;\n\n /**\n * Called when any of the preferences change.\n * The event `detail` contains the value of all the preferences as submitted by the user.\n *\n */\n onPreferencesChange: NonCancelableEventHandler<CodeEditorProps.Preferences>;\n\n /**\n * Renders the code editor in a loading state.\n */\n loading?: boolean;\n\n /**\n * Called when the user clicks the recovery button in the error state.\n * Use this to retry loading the code editor or to provide another option for the user to recover from the error.\n */\n onRecoveryClick?: NonCancelableEventHandler<void>;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * The object should contain, among others:\n *\n * * `loadingState` - Specifies the text to display while the component is loading.\n * * `errorState` - Specifies the text to display if there is an error loading Ace.\n * * `errorStateRecovery`: Specifies the text for the recovery button that's displayed next to the error text.\n * Use the `recoveryClick` event to do a recovery action (for example, retrying the request).\n */\n i18nStrings?: CodeEditorProps.I18nStrings;\n\n /**\n * Specifies the height of the code editor document.\n */\n editorContentHeight?: number;\n\n /**\n * Called when the user resizes the editor by dragging the resize icon.\n * The event `detail` contains the new height of the editor in pixels.\n */\n onEditorContentResize?: NonCancelableEventHandler<CodeEditorProps.ResizeDetail>;\n}\n\n// Prevents typescript from collapsing a string union type into a string type while still allowing any string.\n// This leads to more helpful editor suggestions for known values.\n// See: https://github.com/microsoft/TypeScript/issues/29729\ntype LiteralUnion<LiteralType, BaseType extends string> = LiteralType | (BaseType & { _?: never });\n\ntype BuiltInLanguage = typeof AceModes[number]['value'];\n\nexport namespace CodeEditorProps {\n export type Language = LiteralUnion<BuiltInLanguage, string>;\n export type Theme = typeof LightThemes[number]['value'] | typeof DarkThemes[number]['value'];\n\n export interface AvailableThemes {\n light: ReadonlyArray<string>;\n dark: ReadonlyArray<string>;\n }\n\n export interface Preferences {\n wrapLines: boolean;\n theme: Theme;\n }\n\n export interface I18nStrings {\n loadingState: string;\n errorState: string;\n errorStateRecovery: string;\n\n editorGroupAriaLabel: string;\n statusBarGroupAriaLabel: string;\n\n cursorPosition: (row: number, column: number) => string;\n errorsTab: string;\n warningsTab: string;\n preferencesButtonAriaLabel: string;\n paneCloseButtonAriaLabel: string;\n\n preferencesModalHeader: string;\n preferencesModalCancel: string;\n preferencesModalConfirm: string;\n preferencesModalWrapLines: string;\n preferencesModalTheme: string;\n preferencesModalLightThemes: string;\n preferencesModalDarkThemes: string;\n\n preferencesModalThemeFilteringPlaceholder?: string;\n preferencesModalThemeFilteringAriaLabel?: string;\n preferencesModalThemeFilteringClearAriaLabel?: string;\n }\n export interface ResizeDetail {\n height: number;\n }\n export interface ChangeDetail {\n value: string;\n }\n\n export interface ValidateDetail {\n annotations: Ace.Annotation[];\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the code editor control.\n */\n focus(): void;\n }\n}\n"]}
|
package/code-editor/pane.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export interface PaneProps {
|
|
|
5
5
|
visible: boolean;
|
|
6
6
|
annotations: Ace.Annotation[];
|
|
7
7
|
highlighted?: Ace.Annotation;
|
|
8
|
-
cursorPositionLabel
|
|
9
|
-
closeButtonAriaLabel
|
|
8
|
+
cursorPositionLabel?: (row: number, column: number) => string;
|
|
9
|
+
closeButtonAriaLabel?: string;
|
|
10
10
|
onClose: () => void;
|
|
11
11
|
onAnnotationClick: (annotation: Ace.Annotation) => void;
|
|
12
12
|
onAnnotationClear: () => void;
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9D,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,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
|
@@ -65,11 +65,14 @@ export const Pane = ({ id, visible, annotations, highlighted, onClose, onAnnotat
|
|
|
65
65
|
React.createElement("colgroup", null,
|
|
66
66
|
React.createElement("col", { style: { width: 1 } /* shrink to fit content */ }),
|
|
67
67
|
React.createElement("col", { style: { width: 'auto' } })),
|
|
68
|
-
React.createElement("tbody", { ref: listRef }, annotations.map((annotation, i) =>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
React.createElement("tbody", { ref: listRef }, annotations.map((annotation, i) => {
|
|
69
|
+
var _a;
|
|
70
|
+
return (React.createElement("tr", { key: i, className: clsx(styles.pane__item, {
|
|
71
|
+
[styles['pane__item--highlighted']]: annotation === highlighted,
|
|
72
|
+
}), onFocus: onItemFocus, onMouseOver: onAnnotationClear, onClick: onItemClick.bind(null, annotation), onKeyDown: onItemKeyDown.bind(null, annotation), tabIndex: 0, role: "link" },
|
|
73
|
+
React.createElement("td", { className: clsx(styles.pane__location, styles.pane__cell), tabIndex: -1 }, (_a = cursorPositionLabel === null || cursorPositionLabel === void 0 ? void 0 : cursorPositionLabel((annotation.row || 0) + 1, (annotation.column || 0) + 1)) !== null && _a !== void 0 ? _a : ''),
|
|
74
|
+
React.createElement("td", { className: clsx(styles.pane__description, styles.pane__cell), tabIndex: -1 }, annotation.text)));
|
|
75
|
+
})))),
|
|
73
76
|
React.createElement("div", { className: styles['pane__close-container'] },
|
|
74
77
|
React.createElement(InternalButton, { formAction: "none", variant: "icon", iconName: "close", onClick: onClose, ariaLabel: closeButtonAriaLabel }))))));
|
|
75
78
|
};
|
package/code-editor/pane.js.map
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,EAAE,QAAQ,EAAE,CAAC,CAAC,IACxE,MAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAG,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,mCAAI,EAAE,CAClF;gCACL,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,CAAA;yBAAA,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"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CodeEditorProps } from './interfaces';
|
|
3
3
|
interface PreferencesModali18nStrings {
|
|
4
|
-
header
|
|
5
|
-
cancel
|
|
6
|
-
confirm
|
|
7
|
-
wrapLines
|
|
8
|
-
theme
|
|
9
|
-
lightThemes
|
|
10
|
-
darkThemes
|
|
4
|
+
header?: string;
|
|
5
|
+
cancel?: string;
|
|
6
|
+
confirm?: string;
|
|
7
|
+
wrapLines?: string;
|
|
8
|
+
theme?: string;
|
|
9
|
+
lightThemes?: string;
|
|
10
|
+
darkThemes?: string;
|
|
11
11
|
themeFilteringPlaceholder?: string;
|
|
12
12
|
themeFilteringAriaLabel?: string;
|
|
13
13
|
themeFilteringClearAriaLabel?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preferences-modal.d.ts","sourceRoot":"lib/default/","sources":["code-editor/preferences-modal.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,UAAU,2BAA2B;IACnC,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"preferences-modal.d.ts","sourceRoot":"lib/default/","sources":["code-editor/preferences-modal.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,UAAU,2BAA2B;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC;AAED,UAAU,qBAAqB;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IAEnD,WAAW,EAAE,2BAA2B,CAAC;IAEzC,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;IAClC,YAAY,EAAE,eAAe,CAAC,KAAK,CAAC;IAEpC,SAAS,EAAE,CAAC,WAAW,EAAE,eAAe,CAAC,WAAW,KAAK,IAAI,CAAC;IAC9D,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;gCASsB,qBAAqB;AAA5C,wBA8DE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preferences-modal.js","sourceRoot":"lib/default/","sources":["code-editor/preferences-modal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE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YACnD;gBACE,oBAAC,gBAAgB,IAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAChF,KAAK,CAAC,WAAW,CAAC,SAAS,CACX,CACf;YACN;gBACE,oBAAC,iBAAiB,IAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,KAAK;oBAC/C,oBAAC,cAAc,IACb,cAAc,EAAE,mBAAmB,EACnC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,YAAY,EACrB,aAAa,EAAC,MAAM,EACpB,kBAAkB,EAAE,KAAK,CAAC,WAAW,CAAC,uBAAuB,EAC7D,uBAAuB,EAAE,KAAK,CAAC,WAAW,CAAC,4BAA4B,EACvE,oBAAoB,EAAE,KAAK,CAAC,WAAW,CAAC,yBAAyB,GACjE,CACgB,CAChB,CACe,CACT,CACjB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\n\nimport InternalBox from '../box/internal';\nimport { InternalButton } from '../button/internal';\nimport InternalCheckbox from '../checkbox/internal';\nimport InternalColumnLayout from '../column-layout/internal';\nimport InternalFormField from '../form-field/internal';\nimport InternalModal from '../modal/internal';\nimport { SelectProps } from '../select/interfaces';\nimport InternalSelect from '../select/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { NonCancelableCustomEvent } from '../internal/events';\nimport { LightThemes, DarkThemes } from './ace-themes';\nimport { CodeEditorProps } from './interfaces';\n\ninterface PreferencesModali18nStrings {\n header
|
|
1
|
+
{"version":3,"file":"preferences-modal.js","sourceRoot":"lib/default/","sources":["code-editor/preferences-modal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,WAAW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E,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAChF,KAAK,CAAC,WAAW,CAAC,SAAS,CACX,CACf;YACN;gBACE,oBAAC,iBAAiB,IAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,KAAK;oBAC/C,oBAAC,cAAc,IACb,cAAc,EAAE,mBAAmB,EACnC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,YAAY,EACrB,aAAa,EAAC,MAAM,EACpB,kBAAkB,EAAE,KAAK,CAAC,WAAW,CAAC,uBAAuB,EAC7D,uBAAuB,EAAE,KAAK,CAAC,WAAW,CAAC,4BAA4B,EACvE,oBAAoB,EAAE,KAAK,CAAC,WAAW,CAAC,yBAAyB,GACjE,CACgB,CAChB,CACe,CACT,CACjB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\n\nimport InternalBox from '../box/internal';\nimport { InternalButton } from '../button/internal';\nimport InternalCheckbox from '../checkbox/internal';\nimport InternalColumnLayout from '../column-layout/internal';\nimport InternalFormField from '../form-field/internal';\nimport InternalModal from '../modal/internal';\nimport { SelectProps } from '../select/interfaces';\nimport InternalSelect from '../select/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { NonCancelableCustomEvent } from '../internal/events';\nimport { LightThemes, DarkThemes } from './ace-themes';\nimport { CodeEditorProps } from './interfaces';\n\ninterface PreferencesModali18nStrings {\n header?: string;\n cancel?: string;\n confirm?: string;\n wrapLines?: string;\n theme?: string;\n lightThemes?: string;\n darkThemes?: string;\n themeFilteringPlaceholder?: string;\n themeFilteringAriaLabel?: string;\n themeFilteringClearAriaLabel?: string;\n}\n\ninterface PreferencesModalProps {\n preferences?: Partial<CodeEditorProps.Preferences>;\n\n i18nStrings: PreferencesModali18nStrings;\n\n themes: CodeEditorProps['themes'];\n defaultTheme: CodeEditorProps.Theme;\n\n onConfirm: (preferences: CodeEditorProps.Preferences) => void;\n onDismiss: () => void;\n}\n\nfunction filterThemes(allThemes: ReadonlyArray<SelectProps.Option>, available: ReadonlyArray<string> | undefined) {\n if (!available) {\n return allThemes;\n }\n return allThemes.filter(theme => available.indexOf(theme.value!) > -1);\n}\n\nexport default (props: PreferencesModalProps) => {\n const [wrapLines, setWrapLines] = useState<boolean>(props.preferences?.wrapLines ?? true);\n const [theme, setTheme] = useState<CodeEditorProps.Theme>(props.preferences?.theme ?? props.defaultTheme);\n const themeOptions = [\n {\n label: props.i18nStrings.lightThemes,\n options: filterThemes(LightThemes, props.themes?.light),\n },\n {\n label: props.i18nStrings.darkThemes,\n options: filterThemes(DarkThemes, props.themes?.dark),\n },\n ];\n const [selectedThemeOption, setSelectedThemeOption] = useState<SelectProps.Option>(\n () => [...LightThemes, ...DarkThemes].filter(t => t.value === theme)[0]\n );\n\n const onThemeSelected = (e: NonCancelableCustomEvent<SelectProps.ChangeDetail>) => {\n setTheme(e.detail.selectedOption.value as CodeEditorProps.Theme);\n setSelectedThemeOption(e.detail.selectedOption);\n };\n\n return (\n <InternalModal\n size=\"medium\"\n visible={true}\n onDismiss={props.onDismiss}\n header={props.i18nStrings.header}\n closeAriaLabel={props.i18nStrings.cancel}\n footer={\n <InternalBox float=\"right\">\n <InternalSpaceBetween direction=\"horizontal\" size=\"xs\">\n <InternalButton onClick={props.onDismiss}>{props.i18nStrings.cancel}</InternalButton>\n <InternalButton onClick={() => props.onConfirm({ wrapLines, theme })} variant=\"primary\">\n {props.i18nStrings.confirm}\n </InternalButton>\n </InternalSpaceBetween>\n </InternalBox>\n }\n >\n <InternalColumnLayout columns={2} variant=\"text-grid\">\n <div>\n <InternalCheckbox checked={wrapLines} onChange={e => setWrapLines(e.detail.checked)}>\n {props.i18nStrings.wrapLines}\n </InternalCheckbox>\n </div>\n <div>\n <InternalFormField label={props.i18nStrings.theme}>\n <InternalSelect\n selectedOption={selectedThemeOption}\n onChange={onThemeSelected}\n options={themeOptions}\n filteringType=\"auto\"\n filteringAriaLabel={props.i18nStrings.themeFilteringAriaLabel}\n filteringClearAriaLabel={props.i18nStrings.themeFilteringClearAriaLabel}\n filteringPlaceholder={props.i18nStrings.themeFilteringPlaceholder}\n />\n </InternalFormField>\n </div>\n </InternalColumnLayout>\n </InternalModal>\n );\n};\n"]}
|
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { CodeEditorProps } from './interfaces';
|
|
3
3
|
interface StatusBarProps {
|
|
4
4
|
languageLabel: string;
|
|
5
|
-
cursorPosition
|
|
5
|
+
cursorPosition?: string;
|
|
6
6
|
paneStatus: string;
|
|
7
7
|
isTabFocused: boolean;
|
|
8
8
|
paneId?: string;
|
|
9
|
-
i18nStrings
|
|
9
|
+
i18nStrings?: CodeEditorProps.I18nStrings;
|
|
10
10
|
errorCount: number;
|
|
11
11
|
warningCount: number;
|
|
12
12
|
isRefresh: boolean;
|
|
@@ -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;
|
|
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;AAG/C,UAAU,cAAc;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC;IAC1C,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;AAgHD,eAAO,MAAM,SAAS,mDAAoD,cAAc,gBAqBvF,CAAC"}
|
|
@@ -8,9 +8,11 @@ import LiveRegion from '../internal/components/live-region/index';
|
|
|
8
8
|
import { TabButton } from './tab-button';
|
|
9
9
|
import { InternalButton } from '../button/internal';
|
|
10
10
|
import { useContainerQuery } from '../internal/hooks/container-queries/use-container-query';
|
|
11
|
+
import { useInternalI18n } from '../internal/i18n/context.js';
|
|
11
12
|
function InternalStatusBar({ languageLabel, cursorPosition, paneStatus, onErrorPaneToggle, onWarningPaneToggle, onTabFocus, onTabBlur, errorsTabRef, warningsTabRef, isTabFocused, paneId, onPreferencesOpen, i18nStrings, errorCount, warningCount, leftBarRef, isVirtual, minifyCounters, isRefresh, }) {
|
|
12
|
-
const
|
|
13
|
-
const
|
|
13
|
+
const i18n = useInternalI18n('code-editor');
|
|
14
|
+
const errorText = `${i18n('i18nStrings.errorsTab', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.errorsTab)}: ${errorCount}`;
|
|
15
|
+
const warningText = `${i18n('i18nStrings.warningsTab', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.warningsTab)}: ${warningCount}`;
|
|
14
16
|
// Virtual status bar is inaccessible for screen readers and keyboard interactions.
|
|
15
17
|
return (React.createElement("div", { className: clsx(styles['status-bar'], {
|
|
16
18
|
[styles['status-bar-with-hidden-pane']]: paneStatus === 'hidden',
|
|
@@ -32,7 +34,7 @@ function InternalStatusBar({ languageLabel, cursorPosition, paneStatus, onErrorP
|
|
|
32
34
|
React.createElement("span", null, warningText))),
|
|
33
35
|
React.createElement("div", { className: styles['status-bar__right'] },
|
|
34
36
|
React.createElement("div", { className: styles['status-bar__cog-button'] },
|
|
35
|
-
React.createElement(InternalButton, { disabled: isVirtual, formAction: "none", variant: "icon", iconName: "settings", iconAlt: "Settings", ariaLabel: i18nStrings.preferencesButtonAriaLabel, onClick: onPreferencesOpen, __nativeAttributes: {
|
|
37
|
+
React.createElement(InternalButton, { disabled: isVirtual, formAction: "none", variant: "icon", iconName: "settings", iconAlt: "Settings", ariaLabel: i18n('i18nStrings.preferencesButtonAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesButtonAriaLabel), onClick: onPreferencesOpen, __nativeAttributes: {
|
|
36
38
|
tabIndex: paneStatus !== 'hidden' && isTabFocused ? -1 : undefined,
|
|
37
39
|
'aria-hidden': paneStatus !== 'hidden' && isTabFocused ? true : undefined,
|
|
38
40
|
} })))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-bar.js","sourceRoot":"lib/default/","sources":["code-editor/status-bar.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,UAAU,MAAM,0CAA0C,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM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S,cAA5C,kCAA8C,CAAF;IACpE,yFAAyF;IACzF,oDAAoD;IACpD,MAAM,CAAC,SAAS,EAAE,gBAAgB,CAAC,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5E,MAAM,CAAC,YAAY,EAAE,uBAAuB,CAAC,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAEtF,MAAM,cAAc,GAAG,YAAY,KAAK,IAAI,IAAI,SAAS,KAAK,IAAI,IAAI,YAAY,GAAG,SAAS,CAAC;IAE/F,OAAO,CACL;QACE,oBAAC,iBAAiB,oBACZ,SAAS,IACb,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,gBAAgB,EAC5B,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,IAC9B;QACF,oBAAC,iBAAiB,oBAAK,SAAS,IAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,uBAAuB,EAAE,cAAc,EAAE,KAAK,IAAI,CAChH,CACJ,CAAC;AACJ,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';\nimport styles from './styles.css.js';\nimport LiveRegion from '../internal/components/live-region/index';\nimport { TabButton } from './tab-button';\nimport { InternalButton } from '../button/internal';\nimport { useContainerQuery } from '../internal/hooks/container-queries/use-container-query';\nimport { CodeEditorProps } from './interfaces';\nimport { useInternalI18n } from '../internal/i18n/context.js';\n\ninterface StatusBarProps {\n languageLabel: string;\n cursorPosition?: string;\n paneStatus: string;\n isTabFocused: boolean;\n paneId?: string;\n i18nStrings?: CodeEditorProps.I18nStrings;\n errorCount: number;\n warningCount: number;\n isRefresh: boolean;\n\n errorsTabRef?: React.RefObject<HTMLButtonElement>;\n warningsTabRef?: React.RefObject<HTMLButtonElement>;\n\n onErrorPaneToggle: () => void;\n onWarningPaneToggle: () => void;\n onTabFocus?: React.FocusEventHandler<HTMLButtonElement>;\n onTabBlur?: React.FocusEventHandler<HTMLButtonElement>;\n onPreferencesOpen: () => void;\n onHeightChange?: (height: number | null) => void;\n}\n\ntype InternalStatusBarProps = StatusBarProps & {\n leftBarRef: React.Ref<HTMLDivElement>;\n isVirtual: boolean;\n minifyCounters: boolean;\n};\n\nfunction InternalStatusBar({\n languageLabel,\n cursorPosition,\n paneStatus,\n onErrorPaneToggle,\n onWarningPaneToggle,\n onTabFocus,\n onTabBlur,\n errorsTabRef,\n warningsTabRef,\n isTabFocused,\n paneId,\n onPreferencesOpen,\n i18nStrings,\n errorCount,\n warningCount,\n leftBarRef,\n isVirtual,\n minifyCounters,\n isRefresh,\n}: InternalStatusBarProps) {\n const i18n = useInternalI18n('code-editor');\n const errorText = `${i18n('i18nStrings.errorsTab', i18nStrings?.errorsTab)}: ${errorCount}`;\n const warningText = `${i18n('i18nStrings.warningsTab', i18nStrings?.warningsTab)}: ${warningCount}`;\n\n // Virtual status bar is inaccessible for screen readers and keyboard interactions.\n\n return (\n <div\n className={clsx(styles['status-bar'], {\n [styles['status-bar-with-hidden-pane']]: paneStatus === 'hidden',\n [styles['status-bar-virtual']]: isVirtual,\n })}\n aria-hidden={isVirtual}\n >\n <div\n className={clsx(styles['status-bar__left'], {\n [styles['status-bar__left-virtual']]: isVirtual,\n })}\n ref={leftBarRef}\n >\n <span className={styles['status-bar__language-mode']}>{languageLabel}</span>\n <span className={styles['status-bar__cursor-position']}>{cursorPosition}</span>\n\n <div role=\"tablist\">\n <TabButton\n text={minifyCounters ? ` ${errorCount}` : errorText}\n className={styles['tab-button--errors']}\n iconName=\"status-negative\"\n disabled={errorCount === 0 || isVirtual}\n active={paneStatus === 'error'}\n onClick={onErrorPaneToggle}\n onFocus={onTabFocus}\n onBlur={onTabBlur}\n ref={errorsTabRef}\n ariaLabel={errorText}\n paneId={paneId}\n isRefresh={isRefresh}\n />\n <span className={styles['tab-button--divider']}></span>\n <TabButton\n text={minifyCounters ? ` ${warningCount}` : warningText}\n className={styles['tab-button--warnings']}\n iconName=\"status-warning\"\n disabled={warningCount === 0 || isVirtual}\n active={paneStatus === 'warning'}\n onClick={onWarningPaneToggle}\n onFocus={onTabFocus}\n onBlur={onTabBlur}\n ref={warningsTabRef}\n tabIndex={paneStatus === 'error' && isTabFocused ? -1 : undefined}\n ariaHidden={paneStatus === 'error' && isTabFocused ? true : undefined}\n ariaLabel={warningText}\n paneId={paneId}\n isRefresh={isRefresh}\n />\n </div>\n <LiveRegion assertive={true}>\n <span>{errorText} </span>\n <span>{warningText}</span>\n </LiveRegion>\n </div>\n\n <div className={styles['status-bar__right']}>\n <div className={styles['status-bar__cog-button']}>\n <InternalButton\n disabled={isVirtual}\n formAction=\"none\"\n variant=\"icon\"\n iconName=\"settings\"\n iconAlt=\"Settings\"\n ariaLabel={i18n('i18nStrings.preferencesButtonAriaLabel', i18nStrings?.preferencesButtonAriaLabel)}\n onClick={onPreferencesOpen}\n __nativeAttributes={{\n tabIndex: paneStatus !== 'hidden' && isTabFocused ? -1 : undefined,\n 'aria-hidden': paneStatus !== 'hidden' && isTabFocused ? true : undefined,\n }}\n />\n </div>\n </div>\n </div>\n );\n}\n\nexport const StatusBar = ({ errorsTabRef, warningsTabRef, ...restProps }: StatusBarProps) => {\n // create a virtual status bar, in order to calculate the width with full tab button text\n // and decide if tab button text needs to be reduced\n const [realWidth, statusLeftBarRef] = useContainerQuery(rect => rect.width);\n const [virtualWidth, virtualStatusLeftBarRef] = useContainerQuery(rect => rect.width);\n\n const minifyCounters = virtualWidth !== null && realWidth !== null && virtualWidth > realWidth;\n\n return (\n <>\n <InternalStatusBar\n {...restProps}\n isVirtual={false}\n leftBarRef={statusLeftBarRef}\n errorsTabRef={errorsTabRef}\n warningsTabRef={warningsTabRef}\n minifyCounters={minifyCounters}\n />\n <InternalStatusBar {...restProps} isVirtual={true} leftBarRef={virtualStatusLeftBarRef} minifyCounters={false} />\n </>\n );\n};\n"]}
|
package/container/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["container/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["container/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAM9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,OAAmB,EACnB,qBAA6B,EAC7B,sBAA8B,EAC9B,GAAG,KAAK,EACT,EAAE,cAAc,eAchB"}
|
package/container/index.js
CHANGED
|
@@ -6,11 +6,13 @@ import InternalContainer from './internal';
|
|
|
6
6
|
import { getExternalProps } from '../internal/utils/external-props';
|
|
7
7
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
8
8
|
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
9
|
+
import { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';
|
|
9
10
|
export default function Container(_a) {
|
|
10
11
|
var { variant = 'default', disableHeaderPaddings = false, disableContentPaddings = false } = _a, props = __rest(_a, ["variant", "disableHeaderPaddings", "disableContentPaddings"]);
|
|
11
12
|
const baseComponentProps = useBaseComponent('Container');
|
|
12
13
|
const externalProps = getExternalProps(props);
|
|
13
|
-
return (React.createElement(
|
|
14
|
+
return (React.createElement(AnalyticsFunnelSubStep, null,
|
|
15
|
+
React.createElement(InternalContainer, Object.assign({ variant: variant, disableHeaderPaddings: disableHeaderPaddings, disableContentPaddings: disableContentPaddings }, externalProps, baseComponentProps))));
|
|
14
16
|
}
|
|
15
17
|
applyDisplayName(Container, 'Container');
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
package/container/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["container/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,iBAAiB,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["container/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,iBAAiB,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAI3F,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAKjB;QALiB,EAChC,OAAO,GAAG,SAAS,EACnB,qBAAqB,GAAG,KAAK,EAC7B,sBAAsB,GAAG,KAAK,OAEf,EADZ,KAAK,cAJwB,8DAKjC,CADS;IAER,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACzD,MAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,CACL,oBAAC,sBAAsB;QACrB,oBAAC,iBAAiB,kBAChB,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,qBAAqB,EAC5C,sBAAsB,EAAE,sBAAsB,IAC1C,aAAa,EACb,kBAAkB,EACtB,CACqB,CAC1B,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,SAAS,EAAE,WAAW,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 InternalContainer from './internal';\nimport { ContainerProps } from './interfaces';\nimport { getExternalProps } from '../internal/utils/external-props';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\n\nexport { ContainerProps };\n\nexport default function Container({\n variant = 'default',\n disableHeaderPaddings = false,\n disableContentPaddings = false,\n ...props\n}: ContainerProps) {\n const baseComponentProps = useBaseComponent('Container');\n const externalProps = getExternalProps(props);\n return (\n <AnalyticsFunnelSubStep>\n <InternalContainer\n variant={variant}\n disableHeaderPaddings={disableHeaderPaddings}\n disableContentPaddings={disableContentPaddings}\n {...externalProps}\n {...baseComponentProps}\n />\n </AnalyticsFunnelSubStep>\n );\n}\n\napplyDisplayName(Container, 'Container');\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["container/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["container/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AASlF,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE,0BAA0B;IACzG,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc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