@cloudscape-design/components 3.0.924 → 3.0.925
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/code-editor/index.d.ts.map +1 -1
- package/code-editor/index.js +2 -2
- package/code-editor/index.js.map +1 -1
- package/code-editor/interfaces.d.ts +2 -0
- package/code-editor/interfaces.d.ts.map +1 -1
- package/code-editor/interfaces.js.map +1 -1
- package/code-editor/pane.d.ts +3 -1
- package/code-editor/pane.d.ts.map +1 -1
- package/code-editor/pane.js +2 -2
- package/code-editor/pane.js.map +1 -1
- package/code-editor/resizable-box/index.d.ts +3 -1
- package/code-editor/resizable-box/index.d.ts.map +1 -1
- package/code-editor/resizable-box/index.js +40 -8
- package/code-editor/resizable-box/index.js.map +1 -1
- package/code-editor/resizable-box/styles.css.js +4 -3
- package/code-editor/resizable-box/styles.scoped.css +16 -24
- package/code-editor/resizable-box/styles.selectors.js +4 -3
- package/i18n/messages/all.all.js +1 -1
- package/i18n/messages/all.all.json +1 -1
- package/i18n/messages/all.ar.js +1 -1
- package/i18n/messages/all.ar.json +1 -1
- package/i18n/messages/all.de.js +1 -1
- package/i18n/messages/all.de.json +1 -1
- package/i18n/messages/all.en-GB.js +1 -1
- package/i18n/messages/all.en-GB.json +1 -1
- package/i18n/messages/all.en.js +1 -1
- package/i18n/messages/all.en.json +1 -1
- package/i18n/messages/all.es.js +1 -1
- package/i18n/messages/all.es.json +1 -1
- package/i18n/messages/all.fr.js +1 -1
- package/i18n/messages/all.fr.json +1 -1
- package/i18n/messages/all.id.js +1 -1
- package/i18n/messages/all.id.json +1 -1
- package/i18n/messages/all.it.js +1 -1
- package/i18n/messages/all.it.json +1 -1
- package/i18n/messages/all.ja.js +1 -1
- package/i18n/messages/all.ja.json +1 -1
- package/i18n/messages/all.ko.js +1 -1
- package/i18n/messages/all.ko.json +1 -1
- package/i18n/messages/all.pt-BR.js +1 -1
- package/i18n/messages/all.pt-BR.json +1 -1
- package/i18n/messages/all.tr.js +1 -1
- package/i18n/messages/all.tr.json +1 -1
- package/i18n/messages/all.zh-CN.js +1 -1
- package/i18n/messages/all.zh-CN.json +1 -1
- package/i18n/messages/all.zh-TW.js +1 -1
- package/i18n/messages/all.zh-TW.json +1 -1
- package/i18n/messages-types.d.ts +2 -0
- package/i18n/messages-types.d.ts.map +1 -1
- package/i18n/messages-types.js.map +1 -1
- package/internal/base-component/styles.scoped.css +14 -0
- package/internal/components/drag-handle/button.d.ts +5 -0
- package/internal/components/drag-handle/button.d.ts.map +1 -0
- package/internal/components/drag-handle/button.js +35 -0
- package/internal/components/drag-handle/button.js.map +1 -0
- package/internal/components/drag-handle/index.d.ts.map +1 -1
- package/internal/components/drag-handle/index.js +6 -30
- package/internal/components/drag-handle/index.js.map +1 -1
- package/internal/components/drag-handle/interfaces.d.ts +7 -1
- package/internal/components/drag-handle/interfaces.d.ts.map +1 -1
- package/internal/components/drag-handle/interfaces.js.map +1 -1
- package/internal/components/drag-handle-wrapper/direction-button.d.ts +11 -0
- package/internal/components/drag-handle-wrapper/direction-button.d.ts.map +1 -0
- package/internal/components/drag-handle-wrapper/direction-button.js +30 -0
- package/internal/components/drag-handle-wrapper/direction-button.js.map +1 -0
- package/internal/components/drag-handle-wrapper/index.d.ts +4 -0
- package/internal/components/drag-handle-wrapper/index.d.ts.map +1 -0
- package/internal/components/drag-handle-wrapper/index.js +138 -0
- package/internal/components/drag-handle-wrapper/index.js.map +1 -0
- package/internal/components/drag-handle-wrapper/interfaces.d.ts +10 -0
- package/internal/components/drag-handle-wrapper/interfaces.d.ts.map +1 -0
- package/internal/components/drag-handle-wrapper/interfaces.js +4 -0
- package/internal/components/drag-handle-wrapper/interfaces.js.map +1 -0
- package/internal/components/drag-handle-wrapper/portal-overlay.d.ts +6 -0
- package/internal/components/drag-handle-wrapper/portal-overlay.d.ts.map +1 -0
- package/internal/components/drag-handle-wrapper/portal-overlay.js +56 -0
- package/internal/components/drag-handle-wrapper/portal-overlay.js.map +1 -0
- package/internal/components/drag-handle-wrapper/styles.css.js +32 -0
- package/internal/components/drag-handle-wrapper/styles.scoped.css +508 -0
- package/internal/components/drag-handle-wrapper/styles.selectors.js +33 -0
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/generated/styles/tokens.d.ts +6 -0
- package/internal/generated/styles/tokens.js +6 -0
- package/internal/generated/theming/index.cjs +186 -0
- package/internal/generated/theming/index.js +186 -0
- package/internal/manifest.json +1 -1
- package/internal/utils/pointer-events-mock.d.ts +5 -0
- package/internal/utils/pointer-events-mock.d.ts.map +1 -0
- package/internal/utils/pointer-events-mock.js +10 -0
- package/internal/utils/pointer-events-mock.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code-editor/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAqB7F,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAqB/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code-editor/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAqB7F,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAqB/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,QAAA,MAAM,UAAU,6FA2Qd,CAAC;AAGH,eAAe,UAAU,CAAC"}
|
package/code-editor/index.js
CHANGED
|
@@ -135,11 +135,11 @@ const CodeEditor = forwardRef((props, ref) => {
|
|
|
135
135
|
setEditorHeight(height);
|
|
136
136
|
onResize();
|
|
137
137
|
fireNonCancelableEvent(onEditorContentResize, { height });
|
|
138
|
-
} },
|
|
138
|
+
}, handleAriaLabel: i18n('i18nStrings.resizeHandleAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.resizeHandleAriaLabel), handleTooltipText: i18n('i18nStrings.resizeHandleTooltipText', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.resizeHandleTooltipText) },
|
|
139
139
|
React.createElement("div", { ref: editorRef, 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) })),
|
|
140
140
|
React.createElement("div", { role: "group", "aria-label": i18n('i18nStrings.statusBarGroupAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.statusBarGroupAriaLabel) },
|
|
141
141
|
React.createElement(StatusBar, { languageLabel: languageLabel, cursorPosition: i18n('i18nStrings.cursorPosition', (_b = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.cursorPosition) === null || _b === void 0 ? void 0 : _b.call(i18nStrings, 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 }),
|
|
142
|
-
React.createElement(Pane, { id: paneId, paneStatus: paneStatus, 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) })),
|
|
142
|
+
React.createElement(Pane, { id: paneId, paneStatus: paneStatus, 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), handleAriaLabel: i18n('i18nStrings.resizeHandleAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.resizeHandleAriaLabel), handleTooltipText: i18n('i18nStrings.resizeHandleTooltipText', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.resizeHandleTooltipText) })),
|
|
143
143
|
isPreferencesModalVisible && (React.createElement(PreferencesModal, { getModalRoot: getModalRoot, removeModalRoot: removeModalRoot, onConfirm: onPreferencesConfirm, onDismiss: onPreferencesDismiss, themes: themes !== null && themes !== void 0 ? themes : DEFAULT_AVAILABLE_THEMES, preferences: preferences, defaultTheme: defaultTheme, i18nStrings: {
|
|
144
144
|
header: i18n('i18nStrings.preferencesModalHeader', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalHeader),
|
|
145
145
|
cancel: i18n('i18nStrings.preferencesModalCancel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalCancel),
|
package/code-editor/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/code-editor/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,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rD;oBACD,yBAAyB,EAAE,IAAI,CAC7B,uDAAuD,EACvD,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,yCAAyC,CACvD;oBACD,4BAA4B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,4CAA4C;iBACxF,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, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Ace } from 'ace-builds';\nimport clsx from 'clsx';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { useCurrentMode } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { KeyCode } from '../internal/keycode';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport InternalLiveRegion from '../live-region/internal';\nimport ErrorScreen from './error-screen';\nimport { CodeEditorProps } from './interfaces';\nimport { useChangeEffect } from './listeners';\nimport LoadingScreen from './loading-screen';\nimport { Pane } from './pane';\nimport PreferencesModal from './preferences-modal';\nimport { ResizableBox } from './resizable-box';\nimport { setupEditor } from './setup-editor';\nimport { StatusBar } from './status-bar';\nimport {\n useEditor,\n useSyncEditorLabels,\n useSyncEditorLanguage,\n useSyncEditorSize,\n useSyncEditorTheme,\n useSyncEditorValue,\n useSyncEditorWrapLines,\n} from './use-editor';\nimport { DEFAULT_AVAILABLE_THEMES, getDefaultTheme, getLanguageLabel, PaneStatus } from './util';\n\nimport styles from './styles.css.js';\n\nexport { CodeEditorProps };\n\nconst CodeEditor = forwardRef((props: CodeEditorProps, ref: React.Ref<CodeEditorProps.Ref>) => {\n const {\n ace,\n value,\n language,\n i18nStrings,\n editorContentHeight,\n onEditorContentResize,\n ariaLabel,\n languageLabel: customLanguageLabel,\n preferences,\n loading,\n themes,\n getModalRoot,\n removeModalRoot,\n ...rest\n } = props;\n const { __internalRootRef } = useBaseComponent('CodeEditor', { props: { language } });\n const { controlId, ariaLabelledby, ariaDescribedby } = useFormFieldContext(props);\n const [editorHeight = 480, setEditorHeight] = useControllable(editorContentHeight, onEditorContentResize, 480, {\n componentName: 'code-editor',\n changeHandler: 'onEditorContentResize',\n controlledProp: 'editorContentHeight',\n });\n const mode = useCurrentMode(__internalRootRef);\n const isRefresh = useVisualRefresh();\n const baseProps = getBaseProps(rest);\n const i18n = useInternalI18n('code-editor');\n\n const errorsTabRef = useRef<HTMLButtonElement>(null);\n const warningsTabRef = useRef<HTMLButtonElement>(null);\n const [codeEditorWidth, codeEditorMeasureRef] = useContainerQuery(rect => rect.contentBoxWidth);\n const mergedRef = useMergeRefs(codeEditorMeasureRef, __internalRootRef);\n\n const paneId = useUniqueId('code-editor-pane');\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 { editorRef, editor } = useEditor(ace, themes, loading);\n\n useForwardFocus(ref, editorRef);\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]);\n\n useSyncEditorLabels(editor, { controlId, ariaLabel, ariaLabelledby, ariaDescribedby });\n\n const { onResize } = useSyncEditorSize(editor, { width: codeEditorWidth, height: editorContentHeight });\n\n useSyncEditorValue(editor, value);\n\n useSyncEditorLanguage(editor, language);\n\n useSyncEditorWrapLines(editor, preferences?.wrapLines);\n\n const defaultTheme = getDefaultTheme(mode, themes);\n useSyncEditorTheme(editor, preferences?.theme ?? defaultTheme);\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 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 = () => {\n setPaneStatus('hidden');\n };\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 {loading && (\n <LoadingScreen>\n <InternalLiveRegion tagName=\"span\">\n {i18n('i18nStrings.loadingState', i18nStrings?.loadingState)}\n </InternalLiveRegion>\n </LoadingScreen>\n )}\n\n {!ace && !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 && !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={editorRef}\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 paneStatus={paneStatus}\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 getModalRoot={getModalRoot}\n removeModalRoot={removeModalRoot}\n onConfirm={onPreferencesConfirm}\n onDismiss={onPreferencesDismiss}\n themes={themes ?? DEFAULT_AVAILABLE_THEMES}\n preferences={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: i18n(\n 'i18nStrings.preferencesModalThemeFilteringAriaLabel',\n i18nStrings?.preferencesModalThemeFilteringAriaLabel\n ),\n themeFilteringPlaceholder: i18n(\n 'i18nStrings.preferencesModalThemeFilteringPlaceholder',\n i18nStrings?.preferencesModalThemeFilteringPlaceholder\n ),\n themeFilteringClearAriaLabel: i18nStrings?.preferencesModalThemeFilteringClearAriaLabel,\n }}\n />\n )}\n </>\n )}\n </div>\n );\n});\n\napplyDisplayName(CodeEditor, 'CodeEditor');\nexport default CodeEditor;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/code-editor/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,M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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, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Ace } from 'ace-builds';\nimport clsx from 'clsx';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { useCurrentMode } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { KeyCode } from '../internal/keycode';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport InternalLiveRegion from '../live-region/internal';\nimport ErrorScreen from './error-screen';\nimport { CodeEditorProps } from './interfaces';\nimport { useChangeEffect } from './listeners';\nimport LoadingScreen from './loading-screen';\nimport { Pane } from './pane';\nimport PreferencesModal from './preferences-modal';\nimport { ResizableBox } from './resizable-box';\nimport { setupEditor } from './setup-editor';\nimport { StatusBar } from './status-bar';\nimport {\n useEditor,\n useSyncEditorLabels,\n useSyncEditorLanguage,\n useSyncEditorSize,\n useSyncEditorTheme,\n useSyncEditorValue,\n useSyncEditorWrapLines,\n} from './use-editor';\nimport { DEFAULT_AVAILABLE_THEMES, getDefaultTheme, getLanguageLabel, PaneStatus } from './util';\n\nimport styles from './styles.css.js';\n\nexport { CodeEditorProps };\n\nconst CodeEditor = forwardRef((props: CodeEditorProps, ref: React.Ref<CodeEditorProps.Ref>) => {\n const {\n ace,\n value,\n language,\n i18nStrings,\n editorContentHeight,\n onEditorContentResize,\n ariaLabel,\n languageLabel: customLanguageLabel,\n preferences,\n loading,\n themes,\n getModalRoot,\n removeModalRoot,\n ...rest\n } = props;\n const { __internalRootRef } = useBaseComponent('CodeEditor', { props: { language } });\n const { controlId, ariaLabelledby, ariaDescribedby } = useFormFieldContext(props);\n const [editorHeight = 480, setEditorHeight] = useControllable(editorContentHeight, onEditorContentResize, 480, {\n componentName: 'code-editor',\n changeHandler: 'onEditorContentResize',\n controlledProp: 'editorContentHeight',\n });\n const mode = useCurrentMode(__internalRootRef);\n const isRefresh = useVisualRefresh();\n const baseProps = getBaseProps(rest);\n const i18n = useInternalI18n('code-editor');\n\n const errorsTabRef = useRef<HTMLButtonElement>(null);\n const warningsTabRef = useRef<HTMLButtonElement>(null);\n const [codeEditorWidth, codeEditorMeasureRef] = useContainerQuery(rect => rect.contentBoxWidth);\n const mergedRef = useMergeRefs(codeEditorMeasureRef, __internalRootRef);\n\n const paneId = useUniqueId('code-editor-pane');\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 { editorRef, editor } = useEditor(ace, themes, loading);\n\n useForwardFocus(ref, editorRef);\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]);\n\n useSyncEditorLabels(editor, { controlId, ariaLabel, ariaLabelledby, ariaDescribedby });\n\n const { onResize } = useSyncEditorSize(editor, { width: codeEditorWidth, height: editorContentHeight });\n\n useSyncEditorValue(editor, value);\n\n useSyncEditorLanguage(editor, language);\n\n useSyncEditorWrapLines(editor, preferences?.wrapLines);\n\n const defaultTheme = getDefaultTheme(mode, themes);\n useSyncEditorTheme(editor, preferences?.theme ?? defaultTheme);\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 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 = () => {\n setPaneStatus('hidden');\n };\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 {loading && (\n <LoadingScreen>\n <InternalLiveRegion tagName=\"span\">\n {i18n('i18nStrings.loadingState', i18nStrings?.loadingState)}\n </InternalLiveRegion>\n </LoadingScreen>\n )}\n\n {!ace && !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 && !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 handleAriaLabel={i18n('i18nStrings.resizeHandleAriaLabel', i18nStrings?.resizeHandleAriaLabel)}\n handleTooltipText={i18n('i18nStrings.resizeHandleTooltipText', i18nStrings?.resizeHandleTooltipText)}\n >\n <div\n ref={editorRef}\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 paneStatus={paneStatus}\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 handleAriaLabel={i18n('i18nStrings.resizeHandleAriaLabel', i18nStrings?.resizeHandleAriaLabel)}\n handleTooltipText={i18n('i18nStrings.resizeHandleTooltipText', i18nStrings?.resizeHandleTooltipText)}\n />\n </div>\n {isPreferencesModalVisible && (\n <PreferencesModal\n getModalRoot={getModalRoot}\n removeModalRoot={removeModalRoot}\n onConfirm={onPreferencesConfirm}\n onDismiss={onPreferencesDismiss}\n themes={themes ?? DEFAULT_AVAILABLE_THEMES}\n preferences={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: i18n(\n 'i18nStrings.preferencesModalThemeFilteringAriaLabel',\n i18nStrings?.preferencesModalThemeFilteringAriaLabel\n ),\n themeFilteringPlaceholder: i18n(\n 'i18nStrings.preferencesModalThemeFilteringPlaceholder',\n i18nStrings?.preferencesModalThemeFilteringPlaceholder\n ),\n themeFilteringClearAriaLabel: i18nStrings?.preferencesModalThemeFilteringClearAriaLabel,\n }}\n />\n )}\n </>\n )}\n </div>\n );\n});\n\napplyDisplayName(CodeEditor, 'CodeEditor');\nexport default CodeEditor;\n"]}
|
|
@@ -137,6 +137,8 @@ export declare namespace CodeEditorProps {
|
|
|
137
137
|
preferencesModalThemeFilteringPlaceholder?: string;
|
|
138
138
|
preferencesModalThemeFilteringAriaLabel?: string;
|
|
139
139
|
preferencesModalThemeFilteringClearAriaLabel?: string;
|
|
140
|
+
resizeHandleAriaLabel?: string;
|
|
141
|
+
resizeHandleTooltipText?: string;
|
|
140
142
|
}
|
|
141
143
|
interface ResizeDetail {
|
|
142
144
|
height: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/code-editor/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,WAAW,eAAgB,SAAQ,kBAAkB,EAAE,qBAAqB,EAAE,cAAc;IAChG;;OAEG;IACH,GAA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Content":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Ace } from 'ace-builds';\n\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { BaseModalProps } from '../modal/interfaces';\nimport { AceModes } from './ace-modes';\nimport { DarkThemes, LightThemes } from './ace-themes';\n\nexport interface CodeEditorProps extends BaseComponentProps, FormFieldControlProps, BaseModalProps {\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, except\n * \"cloud_editor\" and \"cloud_editor_dark\".\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 * @i18n\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 * Adds `aria-label` to the code editor's textarea element.\n */\n ariaLabel?: string;\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"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/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';\n\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { BaseModalProps } from '../modal/interfaces';\nimport { AceModes } from './ace-modes';\nimport { DarkThemes, LightThemes } from './ace-themes';\n\nexport interface CodeEditorProps extends BaseComponentProps, FormFieldControlProps, BaseModalProps {\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, except\n * \"cloud_editor\" and \"cloud_editor_dark\".\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 * @i18n\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 * Adds `aria-label` to the code editor's textarea element.\n */\n ariaLabel?: string;\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 resizeHandleAriaLabel?: string;\n resizeHandleTooltipText?: 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
|
@@ -9,10 +9,12 @@ interface PaneProps {
|
|
|
9
9
|
highlighted?: Ace.Annotation;
|
|
10
10
|
cursorPositionLabel?: (row: number, column: number) => string;
|
|
11
11
|
closeButtonAriaLabel?: string;
|
|
12
|
+
handleAriaLabel?: string;
|
|
13
|
+
handleTooltipText?: string;
|
|
12
14
|
onClose: () => void;
|
|
13
15
|
onAnnotationClick: (annotation: Ace.Annotation) => void;
|
|
14
16
|
onAnnotationClear: () => void;
|
|
15
17
|
}
|
|
16
|
-
export declare const Pane: ({ id, paneStatus, visible, annotations, highlighted, onClose, onAnnotationClick, onAnnotationClear, cursorPositionLabel, closeButtonAriaLabel, }: PaneProps) => JSX.Element | null;
|
|
18
|
+
export declare const Pane: ({ id, paneStatus, visible, annotations, highlighted, onClose, onAnnotationClick, onAnnotationClear, cursorPositionLabel, closeButtonAriaLabel, handleAriaLabel, handleTooltipText, }: PaneProps) => JSX.Element | null;
|
|
17
19
|
export {};
|
|
18
20
|
//# sourceMappingURL=pane.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pane.d.ts","sourceRoot":"","sources":["../../../src/code-editor/pane.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAOjC,OAAO,EAAqB,UAAU,EAAE,MAAM,QAAQ,CAAC;AAQvD,UAAU,SAAS;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,UAAU,CAAC;IAEvB,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;
|
|
1
|
+
{"version":3,"file":"pane.d.ts","sourceRoot":"","sources":["../../../src/code-editor/pane.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAOjC,OAAO,EAAqB,UAAU,EAAE,MAAM,QAAQ,CAAC;AAQvD,UAAU,SAAS;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,UAAU,CAAC;IAEvB,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;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,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,yLAad,SAAS,uBA8FX,CAAC"}
|
package/code-editor/pane.js
CHANGED
|
@@ -11,7 +11,7 @@ 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, paneStatus, visible, annotations, highlighted, onClose, onAnnotationClick, onAnnotationClear, cursorPositionLabel, closeButtonAriaLabel, }) => {
|
|
14
|
+
export const Pane = ({ id, paneStatus, visible, annotations, highlighted, onClose, onAnnotationClick, onAnnotationClear, cursorPositionLabel, closeButtonAriaLabel, handleAriaLabel, handleTooltipText, }) => {
|
|
15
15
|
const [paneHeight, setPaneHeight] = useState(MIN_HEIGHT);
|
|
16
16
|
const listRef = useRef(null);
|
|
17
17
|
useEffect(() => {
|
|
@@ -46,7 +46,7 @@ export const Pane = ({ id, paneStatus, visible, annotations, highlighted, onClos
|
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
48
|
return (React.createElement("div", { id: id, className: styles.pane, onKeyDown: onEscKeyDown, role: "tabpanel", "aria-labelledby": ariaLabelledBy },
|
|
49
|
-
React.createElement(ResizableBox, { height: paneHeight, minHeight: MIN_HEIGHT, onResize: newHeight => setPaneHeight(newHeight) },
|
|
49
|
+
React.createElement(ResizableBox, { height: paneHeight, minHeight: MIN_HEIGHT, onResize: newHeight => setPaneHeight(newHeight), handleAriaLabel: handleAriaLabel, handleTooltipText: handleTooltipText },
|
|
50
50
|
React.createElement(FocusLock, { className: styles['focus-lock'], autoFocus: true, restoreFocus: true },
|
|
51
51
|
React.createElement("div", { className: styles.pane__list, tabIndex: -1 },
|
|
52
52
|
React.createElement("table", { className: styles.pane__table, role: "presentation" },
|
package/code-editor/pane.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pane.js","sourceRoot":"","sources":["../../../src/code-editor/pane.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAi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,CAAC,EAC/C,QAAQ,EAAE,CAAC;gCAEX,4BAAI,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,UAAU,CAAC,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 { Ace } from 'ace-builds';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../button/internal';\nimport FocusLock from '../internal/components/focus-lock';\nimport { KeyCode } from '../internal/keycode';\nimport { ResizableBox } from './resizable-box';\nimport { getStatusButtonId, PaneStatus } from './util';\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\ninterface PaneProps {\n id: string;\n paneStatus: PaneStatus;\n\n visible: boolean;\n annotations: Ace.Annotation[];\n highlighted?: Ace.Annotation;\n\n cursorPositionLabel?: (row: number, column: number) => string;\n closeButtonAriaLabel?: string;\n handleAriaLabel?: string;\n handleTooltipText?: string;\n\n onClose: () => void;\n onAnnotationClick: (annotation: Ace.Annotation) => void;\n onAnnotationClear: () => void;\n}\n\nexport const Pane = ({\n id,\n paneStatus,\n visible,\n annotations,\n highlighted,\n onClose,\n onAnnotationClick,\n onAnnotationClear,\n cursorPositionLabel,\n closeButtonAriaLabel,\n handleAriaLabel,\n handleTooltipText,\n}: PaneProps) => {\n const [paneHeight, setPaneHeight] = useState(MIN_HEIGHT);\n const listRef = useRef<HTMLTableSectionElement>(null);\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 errorItem?.focus();\n }\n }, [highlighted, annotations]);\n\n const onItemClick = (annotation: Ace.Annotation) => {\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 onAnnotationClick(annotation);\n }\n };\n\n const onEscKeyDown = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n event.preventDefault();\n onClose();\n }\n };\n\n const ariaLabelledBy = getStatusButtonId({ paneId: id, paneStatus: paneStatus });\n\n if (!visible) {\n return null;\n }\n\n return (\n <div id={id} className={styles.pane} onKeyDown={onEscKeyDown} role=\"tabpanel\" aria-labelledby={ariaLabelledBy}>\n <ResizableBox\n height={paneHeight}\n minHeight={MIN_HEIGHT}\n onResize={newHeight => setPaneHeight(newHeight)}\n handleAriaLabel={handleAriaLabel}\n handleTooltipText={handleTooltipText}\n >\n <FocusLock className={styles['focus-lock']} autoFocus={true} restoreFocus={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 role=\"link\"\n className={styles.pane__item}\n onMouseOver={onAnnotationClear}\n onClick={onItemClick.bind(null, annotation)}\n onKeyDown={onItemKeyDown.bind(null, annotation)}\n tabIndex={0}\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,6 +4,8 @@ export interface ResizeBoxProps {
|
|
|
4
4
|
height: number;
|
|
5
5
|
minHeight: number;
|
|
6
6
|
onResize: (newHeight: number) => void;
|
|
7
|
+
handleAriaLabel?: string;
|
|
8
|
+
handleTooltipText?: string;
|
|
7
9
|
}
|
|
8
|
-
export declare function ResizableBox({ children, height, minHeight, onResize }: ResizeBoxProps): JSX.Element;
|
|
10
|
+
export declare function ResizableBox({ children, height, minHeight, onResize, handleAriaLabel, handleTooltipText, }: ResizeBoxProps): JSX.Element;
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAU3D,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAEtC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,MAAM,EACN,SAAS,EACT,QAAQ,EACR,eAAe,EACf,iBAAiB,GAClB,EAAE,cAAc,eAoFhB"}
|
|
@@ -2,42 +2,74 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React, { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { useStableCallback } from '@cloudscape-design/component-toolkit/internal';
|
|
5
|
+
import InternalDragHandle from '../../internal/components/drag-handle';
|
|
5
6
|
import styles from './styles.css.js';
|
|
6
|
-
|
|
7
|
+
const KEYBOARD_STEP_SIZE = 20;
|
|
8
|
+
export function ResizableBox({ children, height, minHeight, onResize, handleAriaLabel, handleTooltipText, }) {
|
|
7
9
|
const [dragOffset, setDragOffset] = useState(null);
|
|
8
10
|
const onResizeStable = useStableCallback(onResize);
|
|
9
11
|
const containerRef = useRef(null);
|
|
10
|
-
const
|
|
11
|
-
if (event.button !== 0 || !containerRef.current) {
|
|
12
|
+
const onPointerDown = event => {
|
|
13
|
+
if ((event.pointerType === 'mouse' && event.button !== 0) || !containerRef.current) {
|
|
12
14
|
return;
|
|
13
15
|
}
|
|
14
16
|
const containerBottom = containerRef.current.getBoundingClientRect().bottom;
|
|
15
17
|
setDragOffset(containerBottom - event.clientY);
|
|
16
18
|
};
|
|
19
|
+
const onKeyDown = event => {
|
|
20
|
+
switch (event.key) {
|
|
21
|
+
case 'ArrowDown':
|
|
22
|
+
case 'ArrowRight':
|
|
23
|
+
onResizeStable(height + KEYBOARD_STEP_SIZE);
|
|
24
|
+
break;
|
|
25
|
+
case 'ArrowUp':
|
|
26
|
+
case 'ArrowLeft':
|
|
27
|
+
onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
17
31
|
useEffect(() => {
|
|
18
32
|
if (dragOffset === null || !containerRef.current) {
|
|
19
33
|
return;
|
|
20
34
|
}
|
|
21
35
|
const container = containerRef.current;
|
|
22
|
-
const
|
|
36
|
+
const onPointerMove = (event) => {
|
|
23
37
|
const { top } = container.getBoundingClientRect();
|
|
24
38
|
const cursor = event.clientY;
|
|
25
39
|
onResizeStable(Math.max(cursor + dragOffset - top, minHeight));
|
|
26
40
|
};
|
|
27
|
-
const
|
|
41
|
+
const onPointerUp = () => {
|
|
28
42
|
setDragOffset(null);
|
|
29
43
|
};
|
|
30
44
|
const controller = new AbortController();
|
|
31
45
|
document.body.classList.add(styles['resize-active']);
|
|
32
|
-
|
|
33
|
-
document.addEventListener('
|
|
46
|
+
container.classList.add(styles['cursor-active']);
|
|
47
|
+
document.addEventListener('pointermove', onPointerMove, { signal: controller.signal });
|
|
48
|
+
document.addEventListener('pointerup', onPointerUp, { signal: controller.signal });
|
|
34
49
|
return () => {
|
|
35
50
|
controller.abort();
|
|
36
51
|
document.body.classList.remove(styles['resize-active']);
|
|
52
|
+
container.classList.remove(styles['cursor-active']);
|
|
37
53
|
};
|
|
38
54
|
}, [dragOffset, minHeight, onResizeStable]);
|
|
39
55
|
return (React.createElement("div", { ref: containerRef, className: styles['resizable-box'], style: { height } },
|
|
40
56
|
children,
|
|
41
|
-
React.createElement("
|
|
57
|
+
React.createElement("div", { className: styles['resizable-box-handle'] },
|
|
58
|
+
React.createElement(InternalDragHandle, { ariaLabel: handleAriaLabel, variant: "resize-area",
|
|
59
|
+
// Provide an arbitrary large value to valueMax since the editor can be
|
|
60
|
+
// resized to be infinitely large.
|
|
61
|
+
ariaValue: { valueMin: minHeight, valueMax: 1000000, valueNow: height }, tooltipText: handleTooltipText, onPointerDown: onPointerDown, onKeyDown: onKeyDown, directions: {
|
|
62
|
+
'block-start': height > minHeight ? 'active' : 'disabled',
|
|
63
|
+
'block-end': 'active',
|
|
64
|
+
}, onDirectionClick: direction => {
|
|
65
|
+
switch (direction) {
|
|
66
|
+
case 'block-end':
|
|
67
|
+
onResizeStable(height + KEYBOARD_STEP_SIZE);
|
|
68
|
+
break;
|
|
69
|
+
case 'block-start':
|
|
70
|
+
onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
} }))));
|
|
42
74
|
}
|
|
43
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,MAAM,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,kBAAkB,MAAM,uCAAuC,CAAC;AAEvE,OA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EAAE,EAAE,MAAM,EAAE;QAC1E,QAAQ;QAET,6BAAK,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC;YAC5C,oBAAC,kBAAkB,IACjB,SAAS,EAAE,eAAe,EAC1B,OAAO,EAAC,aAAa;gBACrB,uEAAuE;gBACvE,kCAAkC;gBAClC,SAAS,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EACvE,WAAW,EAAE,iBAAiB,EAC9B,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE;oBACV,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU;oBACzD,WAAW,EAAE,QAAQ;iBACtB,EACD,gBAAgB,EAAE,SAAS,CAAC,EAAE;oBAC5B,QAAQ,SAAS,EAAE;wBACjB,KAAK,WAAW;4BACd,cAAc,CAAC,MAAM,GAAG,kBAAkB,CAAC,CAAC;4BAC5C,MAAM;wBACR,KAAK,aAAa;4BAChB,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,kBAAkB,EAAE,SAAS,CAAC,CAAC,CAAC;4BACjE,MAAM;qBACT;gBACH,CAAC,GACD,CACE,CACF,CACP,CAAC;AACJ,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';\n\nimport { useStableCallback } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalDragHandle from '../../internal/components/drag-handle';\n\nimport styles from './styles.css.js';\n\nconst KEYBOARD_STEP_SIZE = 20;\n\nexport interface ResizeBoxProps {\n children: React.ReactNode;\n height: number;\n minHeight: number;\n onResize: (newHeight: number) => void;\n\n handleAriaLabel?: string;\n handleTooltipText?: string;\n}\n\nexport function ResizableBox({\n children,\n height,\n minHeight,\n onResize,\n handleAriaLabel,\n handleTooltipText,\n}: ResizeBoxProps) {\n const [dragOffset, setDragOffset] = useState<null | number>(null);\n const onResizeStable = useStableCallback(onResize);\n const containerRef = useRef<HTMLDivElement>(null);\n\n const onPointerDown: React.PointerEventHandler = event => {\n if ((event.pointerType === 'mouse' && event.button !== 0) || !containerRef.current) {\n return;\n }\n const containerBottom = containerRef.current.getBoundingClientRect().bottom;\n setDragOffset(containerBottom - event.clientY);\n };\n\n const onKeyDown: React.KeyboardEventHandler = event => {\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowRight':\n onResizeStable(height + KEYBOARD_STEP_SIZE);\n break;\n case 'ArrowUp':\n case 'ArrowLeft':\n onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));\n break;\n }\n };\n\n useEffect(() => {\n if (dragOffset === null || !containerRef.current) {\n return;\n }\n const container = containerRef.current;\n\n const onPointerMove = (event: PointerEvent) => {\n const { top } = container.getBoundingClientRect();\n const cursor = event.clientY;\n onResizeStable(Math.max(cursor + dragOffset - top, minHeight));\n };\n const onPointerUp = () => {\n setDragOffset(null);\n };\n const controller = new AbortController();\n document.body.classList.add(styles['resize-active']);\n container.classList.add(styles['cursor-active']);\n document.addEventListener('pointermove', onPointerMove, { signal: controller.signal });\n document.addEventListener('pointerup', onPointerUp, { signal: controller.signal });\n return () => {\n controller.abort();\n document.body.classList.remove(styles['resize-active']);\n container.classList.remove(styles['cursor-active']);\n };\n }, [dragOffset, minHeight, onResizeStable]);\n\n return (\n <div ref={containerRef} className={styles['resizable-box']} style={{ height }}>\n {children}\n\n <div className={styles['resizable-box-handle']}>\n <InternalDragHandle\n ariaLabel={handleAriaLabel}\n variant=\"resize-area\"\n // Provide an arbitrary large value to valueMax since the editor can be\n // resized to be infinitely large.\n ariaValue={{ valueMin: minHeight, valueMax: 1000000, valueNow: height }}\n tooltipText={handleTooltipText}\n onPointerDown={onPointerDown}\n onKeyDown={onKeyDown}\n directions={{\n 'block-start': height > minHeight ? 'active' : 'disabled',\n 'block-end': 'active',\n }}\n onDirectionClick={direction => {\n switch (direction) {\n case 'block-end':\n onResizeStable(height + KEYBOARD_STEP_SIZE);\n break;\n case 'block-start':\n onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));\n break;\n }\n }}\n />\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"resizable-box": "awsui_resizable-
|
|
5
|
-
"
|
|
6
|
-
"
|
|
4
|
+
"resizable-box": "awsui_resizable-box_cufu9_1ct0m_149",
|
|
5
|
+
"cursor-active": "awsui_cursor-active_cufu9_1ct0m_153",
|
|
6
|
+
"resizable-box-handle": "awsui_resizable-box-handle_cufu9_1ct0m_167",
|
|
7
|
+
"resize-active": "awsui_resize-active_cufu9_1ct0m_176"
|
|
7
8
|
};
|
|
8
9
|
|
|
@@ -146,42 +146,34 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
146
146
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
147
147
|
SPDX-License-Identifier: Apache-2.0
|
|
148
148
|
*/
|
|
149
|
-
.awsui_resizable-
|
|
149
|
+
.awsui_resizable-box_cufu9_1ct0m_149:not(#\9) {
|
|
150
150
|
position: relative;
|
|
151
151
|
inline-size: 100%;
|
|
152
152
|
}
|
|
153
|
+
.awsui_resizable-box_cufu9_1ct0m_149:not(#\9):not(.awsui_cursor-active_cufu9_1ct0m_153) {
|
|
154
|
+
transition: height var(--motion-duration-complex-vy4sma, 250ms) var(--motion-easing-responsive-vbn2t8, cubic-bezier(0, 0, 0, 1));
|
|
155
|
+
}
|
|
156
|
+
@media (prefers-reduced-motion: reduce) {
|
|
157
|
+
.awsui_resizable-box_cufu9_1ct0m_149:not(#\9):not(.awsui_cursor-active_cufu9_1ct0m_153) {
|
|
158
|
+
animation: none;
|
|
159
|
+
transition: none;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
.awsui-motion-disabled .awsui_resizable-box_cufu9_1ct0m_149:not(#\9):not(.awsui_cursor-active_cufu9_1ct0m_153), .awsui-mode-entering .awsui_resizable-box_cufu9_1ct0m_149:not(#\9):not(.awsui_cursor-active_cufu9_1ct0m_153) {
|
|
163
|
+
animation: none;
|
|
164
|
+
transition: none;
|
|
165
|
+
}
|
|
153
166
|
|
|
154
|
-
.awsui_resizable-box-
|
|
167
|
+
.awsui_resizable-box-handle_cufu9_1ct0m_167:not(#\9) {
|
|
155
168
|
position: absolute;
|
|
156
169
|
inset-inline-end: 0;
|
|
157
170
|
inset-block-end: 0;
|
|
158
171
|
z-index: 10;
|
|
159
172
|
inline-size: var(--space-l-t419sm, 20px);
|
|
160
173
|
block-size: var(--space-l-t419sm, 20px);
|
|
161
|
-
background-repeat: no-repeat;
|
|
162
|
-
background-origin: content-box;
|
|
163
|
-
box-sizing: border-box;
|
|
164
|
-
background-position: bottom right;
|
|
165
|
-
background-size: var(--space-l-t419sm, 20px);
|
|
166
|
-
cursor: ns-resize;
|
|
167
|
-
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' stroke='%23424650' fill-opacity='0' stroke-width='1'%3E %3Cpath d='M 8 13 L 13 8 M 13 11 L 11 13 M 5 13 L 13 5'/%3E %3C/svg%3E");
|
|
168
|
-
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
169
|
-
}
|
|
170
|
-
@supports (--css-variable-support-check: #000) {
|
|
171
|
-
@media not print {
|
|
172
|
-
.awsui_resizable-box-handle_cufu9_1yze9_154:not(#\9) {
|
|
173
|
-
/* stylelint-disable selector-combinator-disallowed-list, selector-class-pattern */
|
|
174
|
-
}
|
|
175
|
-
.awsui-polaris-dark-mode .awsui_resizable-box-handle_cufu9_1yze9_154:not(#\9), .awsui-dark-mode .awsui_resizable-box-handle_cufu9_1yze9_154:not(#\9) {
|
|
176
|
-
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' stroke='%23dedee3' fill-opacity='0' stroke-width='1'%3E %3Cpath d='M 8 13 L 13 8 M 13 11 L 11 13 M 5 13 L 13 5'/%3E %3C/svg%3E");
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
.awsui_resizable-box-handle_cufu9_1yze9_154:not(#\9):dir(rtl) {
|
|
181
|
-
transform: scaleX(-1);
|
|
182
174
|
}
|
|
183
175
|
|
|
184
|
-
.awsui_resize-
|
|
176
|
+
.awsui_resize-active_cufu9_1ct0m_176:not(#\9) {
|
|
185
177
|
-webkit-user-select: none;
|
|
186
178
|
user-select: none;
|
|
187
179
|
}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"resizable-box": "awsui_resizable-
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"resizable-box": "awsui_resizable-box_cufu9_1ct0m_149",
|
|
6
|
+
"cursor-active": "awsui_cursor-active_cufu9_1ct0m_153",
|
|
7
|
+
"resizable-box-handle": "awsui_resizable-box-handle_cufu9_1ct0m_167",
|
|
8
|
+
"resize-active": "awsui_resize-active_cufu9_1ct0m_176"
|
|
8
9
|
};
|
|
9
10
|
|