@cloudscape-design/components-themeable 3.0.984 → 3.0.986
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/app-layout/test-classes/styles.scss +2 -1
- package/lib/internal/scss/app-layout/visual-refresh-toolbar/drawer/styles.scss +147 -1
- package/lib/internal/scss/app-layout/visual-refresh-toolbar/skeleton/styles.scss +21 -0
- package/lib/internal/scss/drawer/styles.scss +22 -6
- package/lib/internal/scss/internal/components/chart-popover/test-classes/styles.scss +1 -1
- package/lib/internal/scss/internal/components/panel-resize-handle/styles.scss +2 -1
- package/lib/internal/template/app-layout/test-classes/styles.css.js +24 -23
- package/lib/internal/template/app-layout/test-classes/styles.scoped.css +24 -23
- package/lib/internal/template/app-layout/test-classes/styles.selectors.js +24 -23
- package/lib/internal/template/app-layout/utils/use-drawers.d.ts +2 -0
- package/lib/internal/template/app-layout/utils/use-drawers.d.ts.map +1 -1
- package/lib/internal/template/app-layout/utils/use-drawers.js +6 -0
- package/lib/internal/template/app-layout/utils/use-drawers.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +27 -15
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawers.js +2 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawers.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.css.js +17 -10
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +145 -11
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +17 -10
- package/lib/internal/template/app-layout/visual-refresh-toolbar/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/index.js +10 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/interfaces.d.ts +6 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/interfaces.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/interfaces.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/multi-layout.d.ts +2 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/multi-layout.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/multi-layout.js +4 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/multi-layout.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/index.d.ts +2 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/index.js +6 -5
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +21 -19
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +45 -35
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +21 -19
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts +3 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js +33 -6
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.d.ts +2 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.js +12 -3
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
- package/lib/internal/template/code-editor/index.d.ts.map +1 -1
- package/lib/internal/template/code-editor/index.js +3 -0
- package/lib/internal/template/code-editor/index.js.map +1 -1
- package/lib/internal/template/code-editor/interfaces.d.ts +1 -0
- package/lib/internal/template/code-editor/interfaces.d.ts.map +1 -1
- package/lib/internal/template/code-editor/interfaces.js.map +1 -1
- package/lib/internal/template/code-editor/preferences-modal.d.ts +1 -0
- package/lib/internal/template/code-editor/preferences-modal.d.ts.map +1 -1
- package/lib/internal/template/code-editor/preferences-modal.js +1 -1
- package/lib/internal/template/code-editor/preferences-modal.js.map +1 -1
- package/lib/internal/template/collection-preferences/index.d.ts +1 -1
- package/lib/internal/template/collection-preferences/index.d.ts.map +1 -1
- package/lib/internal/template/collection-preferences/index.js +2 -2
- package/lib/internal/template/collection-preferences/index.js.map +1 -1
- package/lib/internal/template/collection-preferences/interfaces.d.ts +5 -0
- package/lib/internal/template/collection-preferences/interfaces.d.ts.map +1 -1
- package/lib/internal/template/collection-preferences/interfaces.js.map +1 -1
- package/lib/internal/template/drawer/implementation.d.ts.map +1 -1
- package/lib/internal/template/drawer/implementation.js +4 -1
- package/lib/internal/template/drawer/implementation.js.map +1 -1
- package/lib/internal/template/drawer/styles.css.js +8 -6
- package/lib/internal/template/drawer/styles.scoped.css +32 -17
- package/lib/internal/template/drawer/styles.selectors.js +8 -6
- package/lib/internal/template/icon/generated/icons.js +1 -1
- package/lib/internal/template/icon/generated/icons.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +11 -0
- package/lib/internal/template/internal/components/drag-handle/resize-icon.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/resize-icon.js +1 -2
- package/lib/internal/template/internal/components/drag-handle/resize-icon.js.map +1 -1
- package/lib/internal/template/internal/components/panel-resize-handle/styles.css.js +2 -2
- package/lib/internal/template/internal/components/panel-resize-handle/styles.scoped.css +8 -7
- package/lib/internal/template/internal/components/panel-resize-handle/styles.selectors.js +2 -2
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/internal/environment.json +1 -1
- package/lib/internal/template/internal/generated/styles/tokens.d.ts +1 -0
- package/lib/internal/template/internal/generated/styles/tokens.js +1 -0
- package/lib/internal/template/internal/generated/theming/index.cjs +31 -0
- package/lib/internal/template/internal/generated/theming/index.js +31 -0
- package/lib/internal/template/internal/plugins/controllers/drawers.d.ts +2 -0
- package/lib/internal/template/internal/plugins/controllers/drawers.d.ts.map +1 -1
- package/lib/internal/template/internal/plugins/controllers/drawers.js.map +1 -1
- package/lib/internal/template/split-panel/implementation.d.ts.map +1 -1
- package/lib/internal/template/split-panel/implementation.js +1 -0
- package/lib/internal/template/split-panel/implementation.js.map +1 -1
- package/lib/internal/template/split-panel/index.d.ts.map +1 -1
- package/lib/internal/template/split-panel/index.js +2 -1
- package/lib/internal/template/split-panel/index.js.map +1 -1
- package/lib/internal/template/split-panel/interfaces.d.ts +1 -0
- package/lib/internal/template/split-panel/interfaces.d.ts.map +1 -1
- package/lib/internal/template/split-panel/interfaces.js.map +1 -1
- package/lib/internal/template/split-panel/preferences-modal.d.ts +1 -0
- package/lib/internal/template/split-panel/preferences-modal.d.ts.map +1 -1
- package/lib/internal/template/split-panel/preferences-modal.js +1 -1
- package/lib/internal/template/split-panel/preferences-modal.js.map +1 -1
- package/package.json +1 -1
- package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +0 -1
|
@@ -43,6 +43,7 @@ const CodeEditor = forwardRef((props, ref) => {
|
|
|
43
43
|
const isRefresh = useVisualRefresh();
|
|
44
44
|
const baseProps = getBaseProps(rest);
|
|
45
45
|
const i18n = useInternalI18n('code-editor');
|
|
46
|
+
const i18nModal = useInternalI18n('modal');
|
|
46
47
|
const errorsTabRef = useRef(null);
|
|
47
48
|
const warningsTabRef = useRef(null);
|
|
48
49
|
const [codeEditorWidth, codeEditorMeasureRef] = useContainerQuery(rect => rect.contentBoxWidth);
|
|
@@ -144,6 +145,8 @@ const CodeEditor = forwardRef((props, ref) => {
|
|
|
144
145
|
header: i18n('i18nStrings.preferencesModalHeader', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalHeader),
|
|
145
146
|
cancel: i18n('i18nStrings.preferencesModalCancel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalCancel),
|
|
146
147
|
confirm: i18n('i18nStrings.preferencesModalConfirm', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalConfirm),
|
|
148
|
+
close: i18nModal('closeAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalCloseAriaLabel) ||
|
|
149
|
+
(i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalCancel),
|
|
147
150
|
wrapLines: i18n('i18nStrings.preferencesModalWrapLines', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalWrapLines),
|
|
148
151
|
theme: i18n('i18nStrings.preferencesModalTheme', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalTheme),
|
|
149
152
|
lightThemes: i18n('i18nStrings.preferencesModalLightThemes', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesModalLightThemes),
|
|
@@ -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,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,E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,uBAAX,WAAW,CAAE,0BAA0B,CAAC;oBACnG,uBAAuB,EAAE,IAAI,CAC3B,qDAAqD,EACrD,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,uCAAuC,CACrD;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 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"]}
|
|
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,EAA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W,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,IAAI,CAC3B,qDAAqD,EACrD,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,uCAAuC,CACrD;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 const i18nModal = useInternalI18n('modal');\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 close:\n i18nModal('closeAriaLabel', i18nStrings?.preferencesModalCloseAriaLabel) ||\n i18nStrings?.preferencesModalCancel,\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"]}
|
|
@@ -130,6 +130,7 @@ export declare namespace CodeEditorProps {
|
|
|
130
130
|
preferencesModalHeader?: string;
|
|
131
131
|
preferencesModalCancel?: string;
|
|
132
132
|
preferencesModalConfirm?: string;
|
|
133
|
+
preferencesModalCloseAriaLabel?: string;
|
|
133
134
|
preferencesModalWrapLines?: string;
|
|
134
135
|
preferencesModalTheme?: string;
|
|
135
136
|
preferencesModalLightThemes?: string;
|
|
@@ -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,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,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IAEnE;;;;OAIG;IACH,eAAe,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IAE1E;;OAEG;IACH,UAAU,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAEvE;;;;;;;;;;;;;OAaG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IAEnD;;;;OAIG;IACH,MAAM,CAAC,E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AM,EAAE,MAAM,KAAK,MAAM,CAAC;QACzD,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,0BAA0B,CAAC,EAAE,MAAM,CAAC;QACpC,wBAAwB,CAAC,EAAE,MAAM,CAAC;QAElC,sBAAsB,CAAC,EAAE,MAAM,CAAC;QAChC,sBAAsB,CAAC,EAAE,MAAM,CAAC;QAChC,uBAAuB,CAAC,EAAE,MAAM,CAAC;QACjC,8BAA8B,CAAC,EAAE,MAAM,CAAC;QACxC,yBAAyB,CAAC,EAAE,MAAM,CAAC;QACnC,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC/B,2BAA2B,CAAC,EAAE,MAAM,CAAC;QACrC,0BAA0B,CAAC,EAAE,MAAM,CAAC;QAEpC,yCAAyC,CAAC,EAAE,MAAM,CAAC;QACnD,uCAAuC,CAAC,EAAE,MAAM,CAAC;QACjD,4CAA4C,CAAC,EAAE,MAAM,CAAC;QAEtD,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;KAClC;IACD,UAAiB,YAAY;QAC3B,MAAM,EAAE,MAAM,CAAC;KAChB;IACD,UAAiB,YAAY;QAC3B,KAAK,EAAE,MAAM,CAAC;KACf;IAED,UAAiB,cAAc;QAC7B,WAAW,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC;KAC/B;IAED,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
|
|
@@ -1 +1 @@
|
|
|
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"]}
|
|
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 preferencesModalCloseAriaLabel?: 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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preferences-modal.d.ts","sourceRoot":"","sources":["../../../src/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;IACnD,YAAY,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC;IAC9C,eAAe,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;IAEpD,WAAW,EAAE,2BAA2B,CAAC;IAEzC,MAAM,EAAE,eAAe,CAAC,eAAe,CAAC;IACxC,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;gCAMsB,qBAAqB;AAA5C,wBAgEE"}
|
|
1
|
+
{"version":3,"file":"preferences-modal.d.ts","sourceRoot":"","sources":["../../../src/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,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,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;IACnD,YAAY,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC;IAC9C,eAAe,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;IAEpD,WAAW,EAAE,2BAA2B,CAAC;IAEzC,MAAM,EAAE,eAAe,CAAC,eAAe,CAAC;IACxC,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;gCAMsB,qBAAqB;AAA5C,wBAgEE"}
|
|
@@ -32,7 +32,7 @@ export default (props) => {
|
|
|
32
32
|
setTheme(e.detail.selectedOption.value);
|
|
33
33
|
setSelectedThemeOption(e.detail.selectedOption);
|
|
34
34
|
};
|
|
35
|
-
return (React.createElement(InternalModal, { size: "medium", visible: true, getModalRoot: props.getModalRoot, removeModalRoot: props.removeModalRoot, onDismiss: props.onDismiss, header: props.i18nStrings.header, closeAriaLabel: props.i18nStrings.
|
|
35
|
+
return (React.createElement(InternalModal, { size: "medium", visible: true, getModalRoot: props.getModalRoot, removeModalRoot: props.removeModalRoot, onDismiss: props.onDismiss, header: props.i18nStrings.header, closeAriaLabel: props.i18nStrings.close, footer: React.createElement(InternalBox, { float: "right" },
|
|
36
36
|
React.createElement(InternalSpaceBetween, { direction: "horizontal", size: "xs" },
|
|
37
37
|
React.createElement(InternalButton, { onClick: props.onDismiss }, props.i18nStrings.cancel),
|
|
38
38
|
React.createElement(InternalButton, { onClick: () => props.onConfirm({ wrapLines, theme }), variant: "primary" }, props.i18nStrings.confirm))) },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preferences-modal.js","sourceRoot":"","sources":["../../../src/code-editor/preferences-modal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAEvD,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAE9C,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"preferences-modal.js","sourceRoot":"","sources":["../../../src/code-editor/preferences-modal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAEvD,OAAO,aAAa,MAAM,m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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 { NonCancelableCustomEvent } from '../internal/events';\nimport InternalModal from '../modal/internal';\nimport { SelectProps } from '../select/interfaces';\nimport InternalSelect from '../select/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { DarkThemes, LightThemes } from './ace-themes';\nimport { CodeEditorProps } from './interfaces';\n\ninterface PreferencesModali18nStrings {\n header?: string;\n cancel?: string;\n confirm?: string;\n close?: 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 getModalRoot: CodeEditorProps['getModalRoot'];\n removeModalRoot: CodeEditorProps['removeModalRoot'];\n\n i18nStrings: PreferencesModali18nStrings;\n\n themes: CodeEditorProps.AvailableThemes;\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>) {\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 getModalRoot={props.getModalRoot}\n removeModalRoot={props.removeModalRoot}\n onDismiss={props.onDismiss}\n header={props.i18nStrings.header}\n closeAriaLabel={props.i18nStrings.close}\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"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CollectionPreferencesProps } from './interfaces';
|
|
3
3
|
export { CollectionPreferencesProps };
|
|
4
|
-
export default function CollectionPreferences({ title, confirmLabel, cancelLabel, disabled, onConfirm, onCancel, visibleContentPreference, contentDisplayPreference, pageSizePreference, wrapLinesPreference, stripedRowsPreference, contentDensityPreference, stickyColumnsPreference, preferences, customPreference, getModalRoot, removeModalRoot, contentBefore, ...rest }: CollectionPreferencesProps): JSX.Element;
|
|
4
|
+
export default function CollectionPreferences({ title, confirmLabel, cancelLabel, closeAriaLabel, disabled, onConfirm, onCancel, visibleContentPreference, contentDisplayPreference, pageSizePreference, wrapLinesPreference, stripedRowsPreference, contentDensityPreference, stickyColumnsPreference, preferences, customPreference, getModalRoot, removeModalRoot, contentBefore, ...rest }: CollectionPreferencesProps): JSX.Element;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":";AAwBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAiB1D,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAItC,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,KAAK,EACL,YAAY,EACZ,WAAW,EACX,QAAgB,EAChB,SAAS,EACT,QAAQ,EACR,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,GAAG,IAAI,EACR,EAAE,0BAA0B,eA+N5B"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":";AAwBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAiB1D,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAItC,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,KAAK,EACL,YAAY,EACZ,WAAW,EACX,cAAc,EACd,QAAgB,EAChB,SAAS,EACT,QAAQ,EACR,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,GAAG,IAAI,EACR,EAAE,0BAA0B,eA+N5B"}
|
|
@@ -27,7 +27,7 @@ import styles from './styles.css.js';
|
|
|
27
27
|
const componentName = 'CollectionPreferences';
|
|
28
28
|
export default function CollectionPreferences(_a) {
|
|
29
29
|
var _b;
|
|
30
|
-
var { title, confirmLabel, cancelLabel, disabled = false, onConfirm, onCancel, visibleContentPreference, contentDisplayPreference, pageSizePreference, wrapLinesPreference, stripedRowsPreference, contentDensityPreference, stickyColumnsPreference, preferences, customPreference, getModalRoot, removeModalRoot, contentBefore } = _a, rest = __rest(_a, ["title", "confirmLabel", "cancelLabel", "disabled", "onConfirm", "onCancel", "visibleContentPreference", "contentDisplayPreference", "pageSizePreference", "wrapLinesPreference", "stripedRowsPreference", "contentDensityPreference", "stickyColumnsPreference", "preferences", "customPreference", "getModalRoot", "removeModalRoot", "contentBefore"]);
|
|
30
|
+
var { title, confirmLabel, cancelLabel, closeAriaLabel, disabled = false, onConfirm, onCancel, visibleContentPreference, contentDisplayPreference, pageSizePreference, wrapLinesPreference, stripedRowsPreference, contentDensityPreference, stickyColumnsPreference, preferences, customPreference, getModalRoot, removeModalRoot, contentBefore } = _a, rest = __rest(_a, ["title", "confirmLabel", "cancelLabel", "closeAriaLabel", "disabled", "onConfirm", "onCancel", "visibleContentPreference", "contentDisplayPreference", "pageSizePreference", "wrapLinesPreference", "stripedRowsPreference", "contentDensityPreference", "stickyColumnsPreference", "preferences", "customPreference", "getModalRoot", "removeModalRoot", "contentBefore"]);
|
|
31
31
|
const parentMetadata = useContext(CollectionPreferencesMetadata);
|
|
32
32
|
const { __internalRootRef } = useBaseComponent('CollectionPreferences', {
|
|
33
33
|
props: {},
|
|
@@ -102,7 +102,7 @@ export default function CollectionPreferences(_a) {
|
|
|
102
102
|
!disabled && modalVisible && (React.createElement(InternalModal, { className: styles['modal-root'], visible: true, getModalRoot: getModalRoot, removeModalRoot: removeModalRoot, header: i18n('title', title), referrerId: referrerId, footer: React.createElement(InternalBox, { float: "right" },
|
|
103
103
|
React.createElement(InternalSpaceBetween, { direction: "horizontal", size: "xs" },
|
|
104
104
|
React.createElement(InternalButton, { className: styles['cancel-button'], variant: "link", formAction: "none", onClick: onCancelListener, analyticsAction: "cancel" }, i18n('cancelLabel', cancelLabel)),
|
|
105
|
-
React.createElement(InternalButton, { className: styles['confirm-button'], variant: "primary", formAction: "none", onClick: onConfirmListener, analyticsAction: "confirm" }, i18n('confirmLabel', confirmLabel)))), closeAriaLabel: cancelLabel, size: hasContentOnTheLeft && hasContentOnTheRight ? 'large' : 'medium', onDismiss: onCancelListener },
|
|
105
|
+
React.createElement(InternalButton, { className: styles['confirm-button'], variant: "primary", formAction: "none", onClick: onConfirmListener, analyticsAction: "confirm" }, i18n('confirmLabel', confirmLabel)))), closeAriaLabel: closeAriaLabel || cancelLabel, size: hasContentOnTheLeft && hasContentOnTheRight ? 'large' : 'medium', onDismiss: onCancelListener },
|
|
106
106
|
React.createElement("div", { className: styles['content-before'] }, contentBefore),
|
|
107
107
|
React.createElement(ModalContentLayout, { left: hasContentOnTheLeft && (React.createElement(InternalSpaceBetween, { size: "l" },
|
|
108
108
|
pageSizePreference && (React.createElement(PageSizePreference, Object.assign({ value: temporaryPreferences.pageSize }, pageSizePreference, { onChange: pageSize => onChange({ pageSize }) }))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,6DAA6D,CAAC;AAC5G,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,wBAAwB,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,q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E,CACH,CACF,GAEH,CACY,CACjB,CACG,CACF,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,qBAAqB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { CollectionPreferencesMetadata } from '../internal/context/collection-preferences-metadata-context';\nimport { useTableComponentsContext } from '../internal/context/table-component-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport InternalModal from '../modal/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { getComponentAnalyticsMetadata } from './analytics-metadata/utils';\nimport ContentDisplayPreference from './content-display';\nimport { CollectionPreferencesProps } from './interfaces';\nimport {\n ContentDensityPreference,\n copyPreferences,\n CustomPreference,\n mergePreferences,\n ModalContentLayout,\n PageSizePreference,\n StickyColumnsPreference,\n StripedRowsPreference,\n WrapLinesPreference,\n} from './utils';\nimport VisibleContentPreference from './visible-content';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nexport { CollectionPreferencesProps };\n\nconst componentName = 'CollectionPreferences';\n\nexport default function CollectionPreferences({\n title,\n confirmLabel,\n cancelLabel,\n disabled = false,\n onConfirm,\n onCancel,\n visibleContentPreference,\n contentDisplayPreference,\n pageSizePreference,\n wrapLinesPreference,\n stripedRowsPreference,\n contentDensityPreference,\n stickyColumnsPreference,\n preferences,\n customPreference,\n getModalRoot,\n removeModalRoot,\n contentBefore,\n ...rest\n}: CollectionPreferencesProps) {\n const parentMetadata = useContext(CollectionPreferencesMetadata);\n const { __internalRootRef } = useBaseComponent('CollectionPreferences', {\n props: {},\n metadata: {\n ...parentMetadata,\n hasStripedRowsPreference: !!stripedRowsPreference,\n hasVisibleContentPreference: !!visibleContentPreference,\n hasContentDisplayPreference: !!contentDisplayPreference,\n hasContentDensityPreference: !!contentDensityPreference,\n hasStickyColumnsPreference: !!stickyColumnsPreference,\n hasContentDisplayColumnFiltering: !!contentDisplayPreference?.enableColumnFiltering,\n visibleContentOptionsCount: visibleContentPreference?.options?.length,\n },\n });\n checkControlled('CollectionPreferences', 'preferences', preferences, 'onConfirm', onConfirm);\n\n const i18n = useInternalI18n('collection-preferences');\n const baseProps = getBaseProps(rest);\n const [modalVisible, setModalVisible] = useState(false);\n const [temporaryPreferences, setTemporaryPreferences] = useState(copyPreferences(preferences || {}));\n const triggerRef = useRef<ButtonProps.Ref>(null);\n const dialogPreviouslyOpen = useRef(false);\n\n useEffect(() => {\n if (!modalVisible) {\n dialogPreviouslyOpen.current && triggerRef.current && triggerRef.current.focus();\n } else {\n dialogPreviouslyOpen.current = true;\n }\n }, [modalVisible]);\n\n const onConfirmListener = () => {\n setModalVisible(false);\n fireNonCancelableEvent(onConfirm, temporaryPreferences);\n };\n\n const onCancelListener = () => {\n fireNonCancelableEvent(onCancel, {});\n setModalVisible(false);\n setTemporaryPreferences(copyPreferences(preferences || {}));\n };\n\n const hasContentOnTheLeft = !!(\n pageSizePreference ||\n wrapLinesPreference ||\n stripedRowsPreference ||\n contentDensityPreference ||\n stickyColumnsPreference ||\n customPreference\n );\n const hasContentOnTheRight = !!(visibleContentPreference || contentDisplayPreference);\n\n const onChange = (changedPreferences: CollectionPreferencesProps.Preferences) =>\n setTemporaryPreferences(mergePreferences(changedPreferences, temporaryPreferences));\n\n if (visibleContentPreference && contentDisplayPreference) {\n warnOnce(\n componentName,\n 'You provided both `visibleContentPreference` and `contentDisplayPreference` props. `visibleContentPreference` will be ignored and only `contentDisplayPreference` will be rendered.'\n );\n }\n\n const referrerId = useUniqueId();\n const tableComponentContext = useTableComponentsContext();\n\n useEffect(() => {\n if (tableComponentContext?.preferencesRef?.current) {\n tableComponentContext.preferencesRef.current.pageSize = preferences?.pageSize;\n\n // When both are used contentDisplayPreference takes preference and so we always prefer to use this as our visible columns if available\n if (preferences?.contentDisplay) {\n tableComponentContext.preferencesRef.current.visibleColumns = preferences?.contentDisplay\n .filter(column => column.visible)\n .map(column => column.id);\n } else if (preferences?.visibleContent) {\n tableComponentContext.preferencesRef.current.visibleColumns = [...preferences.visibleContent];\n }\n\n return () => {\n delete tableComponentContext.preferencesRef.current?.pageSize;\n delete tableComponentContext.preferencesRef.current?.visibleColumns;\n };\n }\n }, [\n tableComponentContext?.preferencesRef,\n preferences?.contentDisplay,\n preferences?.visibleContent,\n preferences?.pageSize,\n ]);\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <div\n id={referrerId}\n {...getAnalyticsMetadataAttribute({ component: getComponentAnalyticsMetadata(disabled, preferences) })}\n >\n <InternalButton\n ref={triggerRef}\n className={clsx(styles['trigger-button'], analyticsSelectors['trigger-button'])}\n disabled={disabled}\n ariaLabel={i18n('title', title)}\n onClick={() => {\n setTemporaryPreferences(copyPreferences(preferences || {}));\n setModalVisible(true);\n }}\n variant=\"icon\"\n iconName=\"settings\"\n formAction=\"none\"\n analyticsAction=\"open\"\n />\n {!disabled && modalVisible && (\n <InternalModal\n className={styles['modal-root']}\n visible={true}\n getModalRoot={getModalRoot}\n removeModalRoot={removeModalRoot}\n header={i18n('title', title)}\n referrerId={referrerId}\n footer={\n <InternalBox float=\"right\">\n <InternalSpaceBetween direction=\"horizontal\" size=\"xs\">\n <InternalButton\n className={styles['cancel-button']}\n variant=\"link\"\n formAction=\"none\"\n onClick={onCancelListener}\n analyticsAction=\"cancel\"\n >\n {i18n('cancelLabel', cancelLabel)}\n </InternalButton>\n <InternalButton\n className={styles['confirm-button']}\n variant=\"primary\"\n formAction=\"none\"\n onClick={onConfirmListener}\n analyticsAction=\"confirm\"\n >\n {i18n('confirmLabel', confirmLabel)}\n </InternalButton>\n </InternalSpaceBetween>\n </InternalBox>\n }\n closeAriaLabel={cancelLabel}\n size={hasContentOnTheLeft && hasContentOnTheRight ? 'large' : 'medium'}\n onDismiss={onCancelListener}\n >\n {/* Content before */}\n <div className={styles['content-before']}>{contentBefore}</div>\n\n {/* Preferences content */}\n <ModalContentLayout\n left={\n hasContentOnTheLeft && (\n <InternalSpaceBetween size=\"l\">\n {pageSizePreference && (\n <PageSizePreference\n value={temporaryPreferences.pageSize}\n {...pageSizePreference}\n onChange={pageSize => onChange({ pageSize })}\n />\n )}\n {wrapLinesPreference && (\n <WrapLinesPreference\n value={temporaryPreferences.wrapLines}\n {...wrapLinesPreference}\n onChange={wrapLines => onChange({ wrapLines })}\n />\n )}\n {stripedRowsPreference && (\n <StripedRowsPreference\n value={temporaryPreferences.stripedRows}\n {...stripedRowsPreference}\n onChange={stripedRows => onChange({ stripedRows })}\n />\n )}\n {contentDensityPreference && (\n <ContentDensityPreference\n value={temporaryPreferences.contentDensity}\n {...contentDensityPreference}\n onChange={contentDensity => onChange({ contentDensity })}\n />\n )}\n {stickyColumnsPreference && (\n <StickyColumnsPreference\n value={temporaryPreferences.stickyColumns}\n {...stickyColumnsPreference}\n onChange={stickyColumns => onChange({ stickyColumns })}\n />\n )}\n {customPreference && (\n <CustomPreference\n value={temporaryPreferences.custom}\n customPreference={customPreference}\n onChange={custom => onChange({ custom })}\n />\n )}\n </InternalSpaceBetween>\n )\n }\n right={\n contentDisplayPreference ? (\n <ContentDisplayPreference\n {...contentDisplayPreference}\n value={temporaryPreferences.contentDisplay}\n onChange={contentDisplay => onChange({ contentDisplay })}\n />\n ) : (\n visibleContentPreference && (\n <VisibleContentPreference\n value={temporaryPreferences.visibleContent}\n {...visibleContentPreference}\n onChange={visibleItems => onChange({ visibleContent: visibleItems })}\n />\n )\n )\n }\n />\n </InternalModal>\n )}\n </div>\n </div>\n );\n}\n\napplyDisplayName(CollectionPreferences, componentName);\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,6DAA6D,CAAC;AAC5G,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,wBAAwB,MAAM,m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kBACvB,KAAK,EAAE,oBAAoB,CAAC,cAAc,IACtC,wBAAwB,IAC5B,QAAQ,EAAE,YAAY,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,IACpE,CACH,CACF,GAEH,CACY,CACjB,CACG,CACF,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,qBAAqB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { CollectionPreferencesMetadata } from '../internal/context/collection-preferences-metadata-context';\nimport { useTableComponentsContext } from '../internal/context/table-component-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport InternalModal from '../modal/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { getComponentAnalyticsMetadata } from './analytics-metadata/utils';\nimport ContentDisplayPreference from './content-display';\nimport { CollectionPreferencesProps } from './interfaces';\nimport {\n ContentDensityPreference,\n copyPreferences,\n CustomPreference,\n mergePreferences,\n ModalContentLayout,\n PageSizePreference,\n StickyColumnsPreference,\n StripedRowsPreference,\n WrapLinesPreference,\n} from './utils';\nimport VisibleContentPreference from './visible-content';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nexport { CollectionPreferencesProps };\n\nconst componentName = 'CollectionPreferences';\n\nexport default function CollectionPreferences({\n title,\n confirmLabel,\n cancelLabel,\n closeAriaLabel,\n disabled = false,\n onConfirm,\n onCancel,\n visibleContentPreference,\n contentDisplayPreference,\n pageSizePreference,\n wrapLinesPreference,\n stripedRowsPreference,\n contentDensityPreference,\n stickyColumnsPreference,\n preferences,\n customPreference,\n getModalRoot,\n removeModalRoot,\n contentBefore,\n ...rest\n}: CollectionPreferencesProps) {\n const parentMetadata = useContext(CollectionPreferencesMetadata);\n const { __internalRootRef } = useBaseComponent('CollectionPreferences', {\n props: {},\n metadata: {\n ...parentMetadata,\n hasStripedRowsPreference: !!stripedRowsPreference,\n hasVisibleContentPreference: !!visibleContentPreference,\n hasContentDisplayPreference: !!contentDisplayPreference,\n hasContentDensityPreference: !!contentDensityPreference,\n hasStickyColumnsPreference: !!stickyColumnsPreference,\n hasContentDisplayColumnFiltering: !!contentDisplayPreference?.enableColumnFiltering,\n visibleContentOptionsCount: visibleContentPreference?.options?.length,\n },\n });\n checkControlled('CollectionPreferences', 'preferences', preferences, 'onConfirm', onConfirm);\n\n const i18n = useInternalI18n('collection-preferences');\n const baseProps = getBaseProps(rest);\n const [modalVisible, setModalVisible] = useState(false);\n const [temporaryPreferences, setTemporaryPreferences] = useState(copyPreferences(preferences || {}));\n const triggerRef = useRef<ButtonProps.Ref>(null);\n const dialogPreviouslyOpen = useRef(false);\n\n useEffect(() => {\n if (!modalVisible) {\n dialogPreviouslyOpen.current && triggerRef.current && triggerRef.current.focus();\n } else {\n dialogPreviouslyOpen.current = true;\n }\n }, [modalVisible]);\n\n const onConfirmListener = () => {\n setModalVisible(false);\n fireNonCancelableEvent(onConfirm, temporaryPreferences);\n };\n\n const onCancelListener = () => {\n fireNonCancelableEvent(onCancel, {});\n setModalVisible(false);\n setTemporaryPreferences(copyPreferences(preferences || {}));\n };\n\n const hasContentOnTheLeft = !!(\n pageSizePreference ||\n wrapLinesPreference ||\n stripedRowsPreference ||\n contentDensityPreference ||\n stickyColumnsPreference ||\n customPreference\n );\n const hasContentOnTheRight = !!(visibleContentPreference || contentDisplayPreference);\n\n const onChange = (changedPreferences: CollectionPreferencesProps.Preferences) =>\n setTemporaryPreferences(mergePreferences(changedPreferences, temporaryPreferences));\n\n if (visibleContentPreference && contentDisplayPreference) {\n warnOnce(\n componentName,\n 'You provided both `visibleContentPreference` and `contentDisplayPreference` props. `visibleContentPreference` will be ignored and only `contentDisplayPreference` will be rendered.'\n );\n }\n\n const referrerId = useUniqueId();\n const tableComponentContext = useTableComponentsContext();\n\n useEffect(() => {\n if (tableComponentContext?.preferencesRef?.current) {\n tableComponentContext.preferencesRef.current.pageSize = preferences?.pageSize;\n\n // When both are used contentDisplayPreference takes preference and so we always prefer to use this as our visible columns if available\n if (preferences?.contentDisplay) {\n tableComponentContext.preferencesRef.current.visibleColumns = preferences?.contentDisplay\n .filter(column => column.visible)\n .map(column => column.id);\n } else if (preferences?.visibleContent) {\n tableComponentContext.preferencesRef.current.visibleColumns = [...preferences.visibleContent];\n }\n\n return () => {\n delete tableComponentContext.preferencesRef.current?.pageSize;\n delete tableComponentContext.preferencesRef.current?.visibleColumns;\n };\n }\n }, [\n tableComponentContext?.preferencesRef,\n preferences?.contentDisplay,\n preferences?.visibleContent,\n preferences?.pageSize,\n ]);\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <div\n id={referrerId}\n {...getAnalyticsMetadataAttribute({ component: getComponentAnalyticsMetadata(disabled, preferences) })}\n >\n <InternalButton\n ref={triggerRef}\n className={clsx(styles['trigger-button'], analyticsSelectors['trigger-button'])}\n disabled={disabled}\n ariaLabel={i18n('title', title)}\n onClick={() => {\n setTemporaryPreferences(copyPreferences(preferences || {}));\n setModalVisible(true);\n }}\n variant=\"icon\"\n iconName=\"settings\"\n formAction=\"none\"\n analyticsAction=\"open\"\n />\n {!disabled && modalVisible && (\n <InternalModal\n className={styles['modal-root']}\n visible={true}\n getModalRoot={getModalRoot}\n removeModalRoot={removeModalRoot}\n header={i18n('title', title)}\n referrerId={referrerId}\n footer={\n <InternalBox float=\"right\">\n <InternalSpaceBetween direction=\"horizontal\" size=\"xs\">\n <InternalButton\n className={styles['cancel-button']}\n variant=\"link\"\n formAction=\"none\"\n onClick={onCancelListener}\n analyticsAction=\"cancel\"\n >\n {i18n('cancelLabel', cancelLabel)}\n </InternalButton>\n <InternalButton\n className={styles['confirm-button']}\n variant=\"primary\"\n formAction=\"none\"\n onClick={onConfirmListener}\n analyticsAction=\"confirm\"\n >\n {i18n('confirmLabel', confirmLabel)}\n </InternalButton>\n </InternalSpaceBetween>\n </InternalBox>\n }\n closeAriaLabel={closeAriaLabel || cancelLabel}\n size={hasContentOnTheLeft && hasContentOnTheRight ? 'large' : 'medium'}\n onDismiss={onCancelListener}\n >\n {/* Content before */}\n <div className={styles['content-before']}>{contentBefore}</div>\n\n {/* Preferences content */}\n <ModalContentLayout\n left={\n hasContentOnTheLeft && (\n <InternalSpaceBetween size=\"l\">\n {pageSizePreference && (\n <PageSizePreference\n value={temporaryPreferences.pageSize}\n {...pageSizePreference}\n onChange={pageSize => onChange({ pageSize })}\n />\n )}\n {wrapLinesPreference && (\n <WrapLinesPreference\n value={temporaryPreferences.wrapLines}\n {...wrapLinesPreference}\n onChange={wrapLines => onChange({ wrapLines })}\n />\n )}\n {stripedRowsPreference && (\n <StripedRowsPreference\n value={temporaryPreferences.stripedRows}\n {...stripedRowsPreference}\n onChange={stripedRows => onChange({ stripedRows })}\n />\n )}\n {contentDensityPreference && (\n <ContentDensityPreference\n value={temporaryPreferences.contentDensity}\n {...contentDensityPreference}\n onChange={contentDensity => onChange({ contentDensity })}\n />\n )}\n {stickyColumnsPreference && (\n <StickyColumnsPreference\n value={temporaryPreferences.stickyColumns}\n {...stickyColumnsPreference}\n onChange={stickyColumns => onChange({ stickyColumns })}\n />\n )}\n {customPreference && (\n <CustomPreference\n value={temporaryPreferences.custom}\n customPreference={customPreference}\n onChange={custom => onChange({ custom })}\n />\n )}\n </InternalSpaceBetween>\n )\n }\n right={\n contentDisplayPreference ? (\n <ContentDisplayPreference\n {...contentDisplayPreference}\n value={temporaryPreferences.contentDisplay}\n onChange={contentDisplay => onChange({ contentDisplay })}\n />\n ) : (\n visibleContentPreference && (\n <VisibleContentPreference\n value={temporaryPreferences.visibleContent}\n {...visibleContentPreference}\n onChange={visibleItems => onChange({ visibleContent: visibleItems })}\n />\n )\n )\n }\n />\n </InternalModal>\n )}\n </div>\n </div>\n );\n}\n\napplyDisplayName(CollectionPreferences, componentName);\n"]}
|
|
@@ -18,6 +18,11 @@ export interface CollectionPreferencesProps<CustomPreferenceType = any> extends
|
|
|
18
18
|
* @i18n
|
|
19
19
|
*/
|
|
20
20
|
cancelLabel?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Adds an aria-label to the close button, for accessibility.
|
|
23
|
+
* @i18n
|
|
24
|
+
*/
|
|
25
|
+
closeAriaLabel?: string;
|
|
21
26
|
/**
|
|
22
27
|
* Determines whether the preferences trigger button is disabled.
|
|
23
28
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,WAAW,0BAA0B,CAAC,oBAAoB,GAAG,GAAG,CAAE,SAAQ,kBAAkB,EAAE,cAAc;IAChH;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;;;;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ACtC;IAED,MAAM,WAAW,mCAAmC;QAClD;;;WAGG;QACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;QAEpC;;;WAGG;QACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;QAElC;;;WAGG;QACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;QAErD;;;WAGG;QACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;QAEpC;;;WAGG;QACH,8BAA8B,CAAC,EAAE,MAAM,CAAC;KACzC;;CACF"}
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,WAAW,0BAA0B,CAAC,oBAAoB,GAAG,GAAG,CAAE,SAAQ,kBAAkB,EAAE,cAAc;IAChH;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;;;;;;;OAaG;IACH,kBAAkB,CAAC,EAAE,0BAA0B,CAAC,kBAAkB,CAAC;IACnE;;;;;;;;;;;OAWG;IACH,mBAAmB,CAAC,EAAE,0BAA0B,CAAC,mBAAmB,CAAC;IACrE;;;;;;;;;;;OAWG;IACH,qBAAqB,CAAC,EAAE,0BAA0B,CAAC,qBAAqB,CAAC;IACzE;;;;;;;;;;;OAWG;IACH,wBAAwB,CAAC,EAAE,0BAA0B,CAAC,wBAAwB,CAAC;I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AC,EAAE,MAAM,CAAC;KACzC;;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/collection-preferences/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { BaseModalProps } from '../modal/interfaces';\n\nexport interface CollectionPreferencesProps<CustomPreferenceType = any> extends BaseComponentProps, BaseModalProps {\n /**\n * Specifies the title of the preferences modal dialog. It is also used as an `aria-label` for the trigger button.\n * @i18n\n */\n title?: string;\n /**\n * Label of the confirm button in the modal footer.\n * @i18n\n */\n confirmLabel?: string;\n /**\n * Label of the cancel button in the modal footer.\n * @i18n\n */\n cancelLabel?: string;\n /**\n * Determines whether the preferences trigger button is disabled.\n */\n disabled?: boolean;\n /**\n * Configures the built-in \"page size selection\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of options for page size selection. Each entry contains:\n * - `value` (number) - The value for the radio button (that is, the number of items per page).\n * - `label` (string) - A label for the radio button (for example, \"10 resources\").\n *\n * You must set the current value in the `preferences.pageSize` property.\n * @i18n\n */\n pageSizePreference?: CollectionPreferencesProps.PageSizePreference;\n /**\n * Configures the built-in \"wrap lines\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.wrapLines` property.\n * @i18n\n */\n wrapLinesPreference?: CollectionPreferencesProps.WrapLinesPreference;\n /**\n * Configures the built-in \"striped rows\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.stripedRows` property.\n * @i18n\n */\n stripedRowsPreference?: CollectionPreferencesProps.StripedRowsPreference;\n /**\n * Configures the content density preference (Comfortable / Compact).\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.contentDensity` property.\n * @i18n\n */\n contentDensityPreference?: CollectionPreferencesProps.ContentDensityPreference;\n /**\n * Configures the sticky columns preference that can be set for both left and right columns.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for each radio group.\n * - `description` (string) - Specifies the text displayed below each radio group label.\n *\n * You must set the current value in the `preferences.stickyColumns` property.\n */\n stickyColumnsPreference?: CollectionPreferencesProps.StickyColumnsPreference;\n /**\n * Configures the built-in content display preference for order and visibility of the table columns.\n *\n * Recommended for table and not applicable for cards.\n *\n * Cannot be used together with `visibleContentPreference`.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `description` (string) - Specifies the description displayed below the title.\n * - `options` - Specifies an array of options for reordering and visible content selection.\n * - `enableColumnFiltering` (boolean) - Adds a columns filter.\n * - `liveAnnouncementDndStarted` ((position: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an option is picked.\n * - `liveAnnouncementDndDiscarded` (string) - (Optional) Adds a message to be announced by screen readers when a reordering action is canceled.\n * - `liveAnnouncementDndItemReordered` ((initialPosition: number, currentPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an item is being moved.\n * - `liveAnnouncementDndItemCommitted` ((initialPosition: number, finalPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when a reordering action is committed.\n * - `dragHandleAriaDescription` (string) - (Optional) Adds an ARIA description for the drag handle.\n * - `dragHandleAriaLabel` (string) - (Optional) Adds an ARIA label for the drag handle.\n *\n * Each option contains the following:\n * - `id` (string) - Corresponds to a table column `id`.\n * - `label` (string) - Specifies a short description of the content.\n * - `alwaysVisible` (boolean) - (Optional) Determines whether the visibility is always on and therefore cannot be toggled. This is set to `false` by default.\n *\n * You must provide an ordered list of the items to display in the `preferences.contentDisplay` property.\n * @i18n\n */\n contentDisplayPreference?: CollectionPreferencesProps.ContentDisplayPreference;\n /**\n * Configures the built-in visible sections preference for cards or visible columns for table.\n *\n * Recommended for cards. For table use `contentDisplayPreference` instead.\n *\n * Cannot be used together with `contentDisplayPreference`.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of groups of options for visible content selection.\n *\n * Each group of options contains the following:\n * - `label` (string) - The text to display as a title for the options group.\n * - `options` - Specifies an array of options in the group. Each option contains the following:\n * - `id` (string) - Corresponds to a column `id` for tables or to a section `id` for cards.\n * - `label` (string) - Specifies a short description of the content.\n * - `editable` (boolean) - (Optional) Determines whether the user is able to toggle its visibility. This is `true` by default.\n *\n * You must set the current list of visible content `id`s in the `preferences.visibleContent` property.\n *\n * **Deprecated** in table, replaced by `contentDisplayPreference`.\n */\n visibleContentPreference?: CollectionPreferencesProps.VisibleContentPreference;\n /**\n * Specifies the current preference values. This includes both built-in and custom preferences.\n *\n * It contains the following:\n * - `pageSize` (number) - (Optional)\n * - `wrapLines` (boolean) - (Optional)\n * - `contentDisplay` (ReadonlyArray<ContentDisplayItem>) - (Optional) Specifies the list of content and their visibility. The order of the elements influences the display.\n * - `visibleContent` (ReadonlyArray<string>) - Specifies the list of visible content `id`s. The order of the `id`s does not influence the display. If the `contentDisplay` property is set, this property is ignored.\n * - `custom` (CustomPreferenceType) - Specifies the value for your custom preference.\n */\n preferences?: CollectionPreferencesProps.Preferences<CustomPreferenceType>;\n /**\n * Configures custom preferences. The function receives two parameters:\n *\n * - `customValue` (CustomPreferenceType) - Current value for your custom preference. It is initialized using the value you provide in `preferences.custom`.\n * - `setCustomValue` - A function that is called to notify a state update.\n *\n * It should return the content of your custom preference, for example:\n * ```\n * (customValue, setCustomValue) => (\n * <Checkbox checked={customValue} onChange={({ detail }) => setCustomValue(detail.checked)} />\n * )\n * ```\n *\n * When the user confirms the changes, the new value is passed in the `detail.custom` property of the `onConfirm` listener.\n * When the user cancels the changes, the `customValue` is reset to the one present in `preferences.custom` property.\n *\n * **Display**\n * - If any of the built-in preferences (`pageSizePreference`, `wrapLinesPreference`, or `visibleContentPreference`) are displayed,\n * the custom content is displayed at the bottom of the left column within the modal.\n * - If no built-in preference is displayed, the custom content occupies the whole modal.\n */\n customPreference?: (\n customValue: CustomPreferenceType,\n setCustomValue: React.Dispatch<CustomPreferenceType>\n ) => React.ReactNode;\n /**\n * Called when the user cancels a preference change using the cancel button in the modal footer or by dismissing the modal.\n */\n onCancel?: NonCancelableEventHandler;\n /**\n * Called when the user confirms a preference change using the confirm button in the modal footer.\n *\n * The event `detail` contains the following:\n * - `contentDensity` (boolean) - (Optional) The current content density preference value. Available only if you specify the `contentDensityPreference` property.\n * - `contentDisplay` (ReadonlyArray<ContentDisplayItem>) - (Optional) The ordered list of table columns and their visibility. Available only if you specify the `contentDisplayPreference` property.\n * - `custom` (CustomPreferenceType) - (Optional) The selected value for your custom preference.\n * - `pageSize` (number) - (Optional) The selected page size value. Available only if you specify the `pageSizePreference` property.\n * - `stickyColumns` (CollectionPreferencesProps.StickyColumns) - (Optional) The current sticky columns preference value. Available only if you specify the `stickyColumnsPreference` property.\n * - `stripedRows` (boolean) - (Optional) The current striped rows preference value. Available only if you specify the `stripedRowsPreference` property.\n * - `visibleContent` (ReadonlyArray<string>) - (Optional) The list of selected content `id`s. Available only if you specify the `visibleContentPreference` property.\n * - `wrapLines` (boolean) - (Optional) The current line wrapping preference value. Available only if you specify the `wrapLinesPreference` property.\n *\n * The values for all configured preferences are present even if the user didn't change their values.\n */\n onConfirm?: NonCancelableEventHandler<CollectionPreferencesProps.Preferences<CustomPreferenceType>>;\n /**\n * Content displayed before the preferences. Use it to display additional information relating to the preferences.\n */\n contentBefore?: React.ReactNode;\n}\n\nexport namespace CollectionPreferencesProps {\n export interface Preferences<CustomPreferenceType = any> {\n pageSize?: number;\n wrapLines?: boolean;\n stripedRows?: boolean;\n contentDensity?: 'comfortable' | 'compact';\n visibleContent?: ReadonlyArray<string>;\n stickyColumns?: StickyColumns;\n contentDisplay?: ReadonlyArray<ContentDisplayItem>;\n custom?: CustomPreferenceType;\n }\n\n export interface ContentDisplayPreference {\n title?: string;\n description?: string;\n options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;\n liveAnnouncementDndStarted?: (position: number, total: number) => string;\n liveAnnouncementDndItemReordered?: (initialPosition: number, currentPosition: number, total: number) => string;\n liveAnnouncementDndItemCommitted?: (initialPosition: number, finalPosition: number, total: number) => string;\n liveAnnouncementDndDiscarded?: string;\n dragHandleAriaLabel?: string;\n dragHandleAriaDescription?: string;\n enableColumnFiltering?: boolean;\n i18nStrings?: ContentDisplayPreferenceI18nStrings;\n }\n\n export interface ContentDisplayOption {\n id: string;\n label: string;\n alwaysVisible?: boolean;\n }\n\n export interface ContentDisplayItem {\n id: string;\n visible: boolean;\n }\n\n export interface VisibleContentPreference {\n title: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOptionsGroup>;\n }\n\n export interface VisibleContentOptionsGroup {\n label: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOption>;\n }\n\n export interface VisibleContentOption {\n id: string;\n label: string;\n editable?: boolean;\n }\n\n export interface PageSizePreference {\n title?: string;\n options: ReadonlyArray<PageSizeOption>;\n }\n\n export interface PageSizeOption {\n value: number;\n label?: string;\n }\n\n export interface WrapLinesPreference {\n label?: string;\n description?: string;\n }\n\n export interface StripedRowsPreference {\n label?: string;\n description?: string;\n }\n\n export interface ContentDensityPreference {\n label?: string;\n description?: string;\n }\n\n interface StickyColumns {\n first?: number;\n last?: number;\n }\n\n interface StickyColumnPreference {\n title: string;\n description: string;\n options: ReadonlyArray<{\n label: string;\n value: number;\n }>;\n }\n export interface StickyColumnsPreference {\n firstColumns?: StickyColumnPreference;\n lastColumns?: StickyColumnPreference;\n }\n\n export interface ContentDisplayPreferenceI18nStrings {\n /**\n * Specifies a `placeholder` for the filtering input.\n * @i18n\n */\n columnFilteringPlaceholder?: string;\n\n /**\n * Specifies an `aria-label` for the filtering input.\n * @i18n\n */\n columnFilteringAriaLabel?: string;\n\n /**\n * Specifies the `count text` for the filtering input to reflect matches found.\n * @i18n\n */\n columnFilteringCountText?: (count: number) => string;\n\n /**\n * Specifies the `no match` text for when there are no matching options in the filtering.\n * @i18n\n */\n columnFilteringNoMatchText?: string;\n\n /**\n * Specifies both an `aria-label` for the clear filtering input action and the `clear filter button` text for the no match button.\n * @i18n\n */\n columnFilteringClearFilterText?: string;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/collection-preferences/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { BaseModalProps } from '../modal/interfaces';\n\nexport interface CollectionPreferencesProps<CustomPreferenceType = any> extends BaseComponentProps, BaseModalProps {\n /**\n * Specifies the title of the preferences modal dialog. It is also used as an `aria-label` for the trigger button.\n * @i18n\n */\n title?: string;\n /**\n * Label of the confirm button in the modal footer.\n * @i18n\n */\n confirmLabel?: string;\n /**\n * Label of the cancel button in the modal footer.\n * @i18n\n */\n cancelLabel?: string;\n /**\n * Adds an aria-label to the close button, for accessibility.\n * @i18n\n */\n closeAriaLabel?: string;\n /**\n * Determines whether the preferences trigger button is disabled.\n */\n disabled?: boolean;\n /**\n * Configures the built-in \"page size selection\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of options for page size selection. Each entry contains:\n * - `value` (number) - The value for the radio button (that is, the number of items per page).\n * - `label` (string) - A label for the radio button (for example, \"10 resources\").\n *\n * You must set the current value in the `preferences.pageSize` property.\n * @i18n\n */\n pageSizePreference?: CollectionPreferencesProps.PageSizePreference;\n /**\n * Configures the built-in \"wrap lines\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.wrapLines` property.\n * @i18n\n */\n wrapLinesPreference?: CollectionPreferencesProps.WrapLinesPreference;\n /**\n * Configures the built-in \"striped rows\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.stripedRows` property.\n * @i18n\n */\n stripedRowsPreference?: CollectionPreferencesProps.StripedRowsPreference;\n /**\n * Configures the content density preference (Comfortable / Compact).\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.contentDensity` property.\n * @i18n\n */\n contentDensityPreference?: CollectionPreferencesProps.ContentDensityPreference;\n /**\n * Configures the sticky columns preference that can be set for both left and right columns.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for each radio group.\n * - `description` (string) - Specifies the text displayed below each radio group label.\n *\n * You must set the current value in the `preferences.stickyColumns` property.\n */\n stickyColumnsPreference?: CollectionPreferencesProps.StickyColumnsPreference;\n /**\n * Configures the built-in content display preference for order and visibility of the table columns.\n *\n * Recommended for table and not applicable for cards.\n *\n * Cannot be used together with `visibleContentPreference`.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `description` (string) - Specifies the description displayed below the title.\n * - `options` - Specifies an array of options for reordering and visible content selection.\n * - `enableColumnFiltering` (boolean) - Adds a columns filter.\n * - `liveAnnouncementDndStarted` ((position: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an option is picked.\n * - `liveAnnouncementDndDiscarded` (string) - (Optional) Adds a message to be announced by screen readers when a reordering action is canceled.\n * - `liveAnnouncementDndItemReordered` ((initialPosition: number, currentPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an item is being moved.\n * - `liveAnnouncementDndItemCommitted` ((initialPosition: number, finalPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when a reordering action is committed.\n * - `dragHandleAriaDescription` (string) - (Optional) Adds an ARIA description for the drag handle.\n * - `dragHandleAriaLabel` (string) - (Optional) Adds an ARIA label for the drag handle.\n *\n * Each option contains the following:\n * - `id` (string) - Corresponds to a table column `id`.\n * - `label` (string) - Specifies a short description of the content.\n * - `alwaysVisible` (boolean) - (Optional) Determines whether the visibility is always on and therefore cannot be toggled. This is set to `false` by default.\n *\n * You must provide an ordered list of the items to display in the `preferences.contentDisplay` property.\n * @i18n\n */\n contentDisplayPreference?: CollectionPreferencesProps.ContentDisplayPreference;\n /**\n * Configures the built-in visible sections preference for cards or visible columns for table.\n *\n * Recommended for cards. For table use `contentDisplayPreference` instead.\n *\n * Cannot be used together with `contentDisplayPreference`.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of groups of options for visible content selection.\n *\n * Each group of options contains the following:\n * - `label` (string) - The text to display as a title for the options group.\n * - `options` - Specifies an array of options in the group. Each option contains the following:\n * - `id` (string) - Corresponds to a column `id` for tables or to a section `id` for cards.\n * - `label` (string) - Specifies a short description of the content.\n * - `editable` (boolean) - (Optional) Determines whether the user is able to toggle its visibility. This is `true` by default.\n *\n * You must set the current list of visible content `id`s in the `preferences.visibleContent` property.\n *\n * **Deprecated** in table, replaced by `contentDisplayPreference`.\n */\n visibleContentPreference?: CollectionPreferencesProps.VisibleContentPreference;\n /**\n * Specifies the current preference values. This includes both built-in and custom preferences.\n *\n * It contains the following:\n * - `pageSize` (number) - (Optional)\n * - `wrapLines` (boolean) - (Optional)\n * - `contentDisplay` (ReadonlyArray<ContentDisplayItem>) - (Optional) Specifies the list of content and their visibility. The order of the elements influences the display.\n * - `visibleContent` (ReadonlyArray<string>) - Specifies the list of visible content `id`s. The order of the `id`s does not influence the display. If the `contentDisplay` property is set, this property is ignored.\n * - `custom` (CustomPreferenceType) - Specifies the value for your custom preference.\n */\n preferences?: CollectionPreferencesProps.Preferences<CustomPreferenceType>;\n /**\n * Configures custom preferences. The function receives two parameters:\n *\n * - `customValue` (CustomPreferenceType) - Current value for your custom preference. It is initialized using the value you provide in `preferences.custom`.\n * - `setCustomValue` - A function that is called to notify a state update.\n *\n * It should return the content of your custom preference, for example:\n * ```\n * (customValue, setCustomValue) => (\n * <Checkbox checked={customValue} onChange={({ detail }) => setCustomValue(detail.checked)} />\n * )\n * ```\n *\n * When the user confirms the changes, the new value is passed in the `detail.custom` property of the `onConfirm` listener.\n * When the user cancels the changes, the `customValue` is reset to the one present in `preferences.custom` property.\n *\n * **Display**\n * - If any of the built-in preferences (`pageSizePreference`, `wrapLinesPreference`, or `visibleContentPreference`) are displayed,\n * the custom content is displayed at the bottom of the left column within the modal.\n * - If no built-in preference is displayed, the custom content occupies the whole modal.\n */\n customPreference?: (\n customValue: CustomPreferenceType,\n setCustomValue: React.Dispatch<CustomPreferenceType>\n ) => React.ReactNode;\n /**\n * Called when the user cancels a preference change using the cancel button in the modal footer or by dismissing the modal.\n */\n onCancel?: NonCancelableEventHandler;\n /**\n * Called when the user confirms a preference change using the confirm button in the modal footer.\n *\n * The event `detail` contains the following:\n * - `contentDensity` (boolean) - (Optional) The current content density preference value. Available only if you specify the `contentDensityPreference` property.\n * - `contentDisplay` (ReadonlyArray<ContentDisplayItem>) - (Optional) The ordered list of table columns and their visibility. Available only if you specify the `contentDisplayPreference` property.\n * - `custom` (CustomPreferenceType) - (Optional) The selected value for your custom preference.\n * - `pageSize` (number) - (Optional) The selected page size value. Available only if you specify the `pageSizePreference` property.\n * - `stickyColumns` (CollectionPreferencesProps.StickyColumns) - (Optional) The current sticky columns preference value. Available only if you specify the `stickyColumnsPreference` property.\n * - `stripedRows` (boolean) - (Optional) The current striped rows preference value. Available only if you specify the `stripedRowsPreference` property.\n * - `visibleContent` (ReadonlyArray<string>) - (Optional) The list of selected content `id`s. Available only if you specify the `visibleContentPreference` property.\n * - `wrapLines` (boolean) - (Optional) The current line wrapping preference value. Available only if you specify the `wrapLinesPreference` property.\n *\n * The values for all configured preferences are present even if the user didn't change their values.\n */\n onConfirm?: NonCancelableEventHandler<CollectionPreferencesProps.Preferences<CustomPreferenceType>>;\n /**\n * Content displayed before the preferences. Use it to display additional information relating to the preferences.\n */\n contentBefore?: React.ReactNode;\n}\n\nexport namespace CollectionPreferencesProps {\n export interface Preferences<CustomPreferenceType = any> {\n pageSize?: number;\n wrapLines?: boolean;\n stripedRows?: boolean;\n contentDensity?: 'comfortable' | 'compact';\n visibleContent?: ReadonlyArray<string>;\n stickyColumns?: StickyColumns;\n contentDisplay?: ReadonlyArray<ContentDisplayItem>;\n custom?: CustomPreferenceType;\n }\n\n export interface ContentDisplayPreference {\n title?: string;\n description?: string;\n options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;\n liveAnnouncementDndStarted?: (position: number, total: number) => string;\n liveAnnouncementDndItemReordered?: (initialPosition: number, currentPosition: number, total: number) => string;\n liveAnnouncementDndItemCommitted?: (initialPosition: number, finalPosition: number, total: number) => string;\n liveAnnouncementDndDiscarded?: string;\n dragHandleAriaLabel?: string;\n dragHandleAriaDescription?: string;\n enableColumnFiltering?: boolean;\n i18nStrings?: ContentDisplayPreferenceI18nStrings;\n }\n\n export interface ContentDisplayOption {\n id: string;\n label: string;\n alwaysVisible?: boolean;\n }\n\n export interface ContentDisplayItem {\n id: string;\n visible: boolean;\n }\n\n export interface VisibleContentPreference {\n title: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOptionsGroup>;\n }\n\n export interface VisibleContentOptionsGroup {\n label: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOption>;\n }\n\n export interface VisibleContentOption {\n id: string;\n label: string;\n editable?: boolean;\n }\n\n export interface PageSizePreference {\n title?: string;\n options: ReadonlyArray<PageSizeOption>;\n }\n\n export interface PageSizeOption {\n value: number;\n label?: string;\n }\n\n export interface WrapLinesPreference {\n label?: string;\n description?: string;\n }\n\n export interface StripedRowsPreference {\n label?: string;\n description?: string;\n }\n\n export interface ContentDensityPreference {\n label?: string;\n description?: string;\n }\n\n interface StickyColumns {\n first?: number;\n last?: number;\n }\n\n interface StickyColumnPreference {\n title: string;\n description: string;\n options: ReadonlyArray<{\n label: string;\n value: number;\n }>;\n }\n export interface StickyColumnsPreference {\n firstColumns?: StickyColumnPreference;\n lastColumns?: StickyColumnPreference;\n }\n\n export interface ContentDisplayPreferenceI18nStrings {\n /**\n * Specifies a `placeholder` for the filtering input.\n * @i18n\n */\n columnFilteringPlaceholder?: string;\n\n /**\n * Specifies an `aria-label` for the filtering input.\n * @i18n\n */\n columnFilteringAriaLabel?: string;\n\n /**\n * Specifies the `count text` for the filtering input to reflect matches found.\n * @i18n\n */\n columnFilteringCountText?: (count: number) => string;\n\n /**\n * Specifies the `no match` text for when there are no matching options in the filtering.\n * @i18n\n */\n columnFilteringNoMatchText?: string;\n\n /**\n * Specifies both an `aria-label` for the clear filtering input action and the `clear filter button` text for the no match button.\n * @i18n\n */\n columnFilteringClearFilterText?: string;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/drawer/implementation.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/drawer/implementation.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIlF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,KAAK,mBAAmB,GAAG,WAAW,GAAG,0BAA0B,CAAC;AAEpE,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,QAAQ,EACR,OAAO,EACP,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,GAAG,SAAS,EACb,EAAE,mBAAmB,eAgDrB;AAED,eAAO,MAAM,sBAAsB,mFAAkD,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { __rest } from "tslib";
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
+
import { useRuntimeDrawerContext } from '../app-layout/runtime-drawer/use-runtime-drawer-context';
|
|
6
7
|
import { useAppLayoutToolbarDesignEnabled } from '../app-layout/utils/feature-flags';
|
|
7
8
|
import { useInternalI18n } from '../i18n/context';
|
|
8
9
|
import { getBaseProps } from '../internal/base-component';
|
|
@@ -16,10 +17,12 @@ export function DrawerImplementation(_a) {
|
|
|
16
17
|
const isToolbar = useAppLayoutToolbarDesignEnabled();
|
|
17
18
|
const i18n = useInternalI18n('drawer');
|
|
18
19
|
const containerProps = Object.assign(Object.assign({}, baseProps), { className: clsx(baseProps.className, styles.drawer, isToolbar && styles['with-toolbar']) });
|
|
20
|
+
const runtimeDrawerContext = useRuntimeDrawerContext({ rootRef: __internalRootRef });
|
|
21
|
+
const hasAdditioalDrawerAction = !!(runtimeDrawerContext === null || runtimeDrawerContext === void 0 ? void 0 : runtimeDrawerContext.isExpandable);
|
|
19
22
|
return loading ? (React.createElement("div", Object.assign({}, containerProps, { className: clsx(containerProps.className, styles['content-with-paddings']), ref: __internalRootRef }),
|
|
20
23
|
React.createElement(InternalStatusIndicator, { type: "loading" },
|
|
21
24
|
React.createElement(InternalLiveRegion, { tagName: "span" }, i18n('i18nStrings.loadingText', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.loadingText))))) : (React.createElement("div", Object.assign({}, containerProps, { ref: __internalRootRef }),
|
|
22
|
-
header && (React.createElement("div", { className: styles.header },
|
|
25
|
+
header && (React.createElement("div", { className: clsx(styles.header, runtimeDrawerContext && styles['with-runtime-context'], hasAdditioalDrawerAction && styles['with-additional-action']) },
|
|
23
26
|
header,
|
|
24
27
|
headerActions && React.createElement("div", { className: styles['header-actions'] }, headerActions))),
|
|
25
28
|
React.createElement("div", { className: clsx(styles['test-utils-drawer-content'], !disableContentPaddings && styles['content-with-paddings']) }, children)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/drawer/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/drawer/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAClG,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAGnE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,UAAU,oBAAoB,CAAC,EASf;QATe,EACnC,MAAM,EACN,QAAQ,EACR,OAAO,EACP,WAAW,EACX,sBAAsB,EACt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BAAgB,CAAC,IAAG,aAAa,CAAO,CAC7E,CACP;QACD,6BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,2BAA2B,CAAC,EACnC,CAAC,sBAAsB,IAAI,MAAM,CAAC,uBAAuB,CAAC,CAC3D,IAEA,QAAQ,CACL,CACF,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC,oBAAoB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { RefObject } from 'react';\nimport clsx from 'clsx';\n\nimport { useRuntimeDrawerContext } from '../app-layout/runtime-drawer/use-runtime-drawer-context';\nimport { useAppLayoutToolbarDesignEnabled } from '../app-layout/utils/feature-flags';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { createWidgetizedComponent } from '../internal/widgets';\nimport InternalLiveRegion from '../live-region/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { DrawerProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ntype DrawerInternalProps = DrawerProps & InternalBaseComponentProps;\n\nexport function DrawerImplementation({\n header,\n children,\n loading,\n i18nStrings,\n disableContentPaddings,\n __internalRootRef,\n headerActions,\n ...restProps\n}: DrawerInternalProps) {\n const baseProps = getBaseProps(restProps);\n const isToolbar = useAppLayoutToolbarDesignEnabled();\n const i18n = useInternalI18n('drawer');\n const containerProps = {\n ...baseProps,\n className: clsx(baseProps.className, styles.drawer, isToolbar && styles['with-toolbar']),\n };\n\n const runtimeDrawerContext = useRuntimeDrawerContext({ rootRef: __internalRootRef as RefObject<HTMLElement> });\n const hasAdditioalDrawerAction = !!runtimeDrawerContext?.isExpandable;\n\n return loading ? (\n <div\n {...containerProps}\n className={clsx(containerProps.className, styles['content-with-paddings'])}\n ref={__internalRootRef}\n >\n <InternalStatusIndicator type=\"loading\">\n <InternalLiveRegion tagName=\"span\">\n {i18n('i18nStrings.loadingText', i18nStrings?.loadingText)}\n </InternalLiveRegion>\n </InternalStatusIndicator>\n </div>\n ) : (\n <div {...containerProps} ref={__internalRootRef}>\n {header && (\n <div\n className={clsx(\n styles.header,\n runtimeDrawerContext && styles['with-runtime-context'],\n hasAdditioalDrawerAction && styles['with-additional-action']\n )}\n >\n {header}\n {headerActions && <div className={styles['header-actions']}>{headerActions}</div>}\n </div>\n )}\n <div\n className={clsx(\n styles['test-utils-drawer-content'],\n !disableContentPaddings && styles['content-with-paddings']\n )}\n >\n {children}\n </div>\n </div>\n );\n}\n\nexport const createWidgetizedDrawer = createWidgetizedComponent(DrawerImplementation);\n"]}
|