@cloudscape-design/components 3.0.720 → 3.0.721
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app-layout/classic.js +15 -15
- package/app-layout/classic.js.map +1 -1
- package/app-layout/internal.d.ts.map +1 -1
- package/app-layout/internal.js +3 -2
- package/app-layout/internal.js.map +1 -1
- package/app-layout/utils/feature-flags.d.ts +1 -1
- package/app-layout/utils/feature-flags.d.ts.map +1 -1
- package/app-layout/utils/feature-flags.js +5 -1
- package/app-layout/utils/feature-flags.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/index.js +1 -1
- package/app-layout/visual-refresh-toolbar/index.js.map +1 -1
- package/drawer/implementation.d.ts.map +1 -1
- package/drawer/implementation.js +3 -2
- package/drawer/implementation.js.map +1 -1
- package/help-panel/implementation.d.ts.map +1 -1
- package/help-panel/implementation.js +3 -2
- package/help-panel/implementation.js.map +1 -1
- package/internal/components/tooltip/index.d.ts.map +1 -1
- package/internal/components/tooltip/index.js +2 -4
- package/internal/components/tooltip/index.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/internal/plugins/helpers/use-global-breadcrumbs.js +2 -2
- package/internal/plugins/helpers/use-global-breadcrumbs.js.map +1 -1
- package/package.json +1 -1
- package/popover/container.d.ts +1 -1
- package/popover/container.d.ts.map +1 -1
- package/popover/container.js.map +1 -1
- package/popover/internal.d.ts +2 -1
- package/popover/internal.d.ts.map +1 -1
- package/popover/internal.js.map +1 -1
- package/property-filter/filtering-token/index.d.ts +2 -0
- package/property-filter/filtering-token/index.d.ts.map +1 -1
- package/property-filter/filtering-token/index.js +2 -2
- package/property-filter/filtering-token/index.js.map +1 -1
- package/property-filter/index.d.ts.map +1 -1
- package/property-filter/index.js +5 -195
- package/property-filter/index.js.map +1 -1
- package/property-filter/internal.d.ts +26 -0
- package/property-filter/internal.d.ts.map +1 -0
- package/property-filter/internal.js +201 -0
- package/property-filter/internal.js.map +1 -0
- package/property-filter/styles.css.js +38 -38
- package/property-filter/styles.scoped.css +39 -39
- package/property-filter/styles.selectors.js +38 -38
- package/property-filter/token-editor.d.ts +2 -10
- package/property-filter/token-editor.d.ts.map +1 -1
- package/property-filter/token-editor.js +36 -29
- package/property-filter/token-editor.js.map +1 -1
- package/property-filter/token.d.ts +2 -1
- package/property-filter/token.d.ts.map +1 -1
- package/property-filter/token.js +4 -7
- package/property-filter/token.js.map +1 -1
- package/side-navigation/implementation.d.ts.map +1 -1
- package/side-navigation/implementation.js +3 -2
- package/side-navigation/implementation.js.map +1 -1
- package/split-panel/bottom.d.ts.map +1 -1
- package/split-panel/bottom.js +3 -2
- package/split-panel/bottom.js.map +1 -1
- package/split-panel/implementation.d.ts.map +1 -1
- package/split-panel/implementation.js +3 -2
- package/split-panel/implementation.js.map +1 -1
- package/split-panel/side.d.ts.map +1 -1
- package/split-panel/side.js +4 -3
- package/split-panel/side.js.map +1 -1
package/property-filter/token.js
CHANGED
|
@@ -7,8 +7,7 @@ import { TokenEditor } from './token-editor';
|
|
|
7
7
|
import { matchTokenValue } from './utils';
|
|
8
8
|
import styles from './styles.css.js';
|
|
9
9
|
const emptyHandler = () => { };
|
|
10
|
-
const
|
|
11
|
-
export const TokenButton = ({ token, operation = 'and', first, removeToken, setToken, setOperation, filteringProperties, filteringOptions, asyncProps, onLoadItems, i18nStrings, asyncProperties, hideOperations, customGroupsText, disabled, freeTextFiltering, expandToViewport, }) => {
|
|
10
|
+
export const TokenButton = ({ token, operation = 'and', first, removeToken, setToken, setOperation, filteringProperties, filteringOptions, asyncProps, onLoadItems, i18nStrings, asyncProperties, hideOperations, customGroupsText, disabled, freeTextFiltering, expandToViewport, enableTokenGroups, }) => {
|
|
12
11
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
13
12
|
const tokenRef = useRef(null);
|
|
14
13
|
const formattedToken = getFormattedToken(token, i18nStrings);
|
|
@@ -20,20 +19,18 @@ export const TokenButton = ({ token, operation = 'and', first, removeToken, setT
|
|
|
20
19
|
ariaLabel: `${formattedToken.propertyLabel} ${formattedToken.operator} ${formattedToken.value}`,
|
|
21
20
|
dismissAriaLabel: (_b = (_a = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.removeTokenButtonAriaLabel) === null || _a === void 0 ? void 0 : _a.call(i18nStrings, formattedToken)) !== null && _b !== void 0 ? _b : '',
|
|
22
21
|
},
|
|
23
|
-
], showOperation: !first && !hideOperations, operation: operation, andText: (_c = i18nStrings.operationAndText) !== null && _c !== void 0 ? _c : '', orText: (_d = i18nStrings.operationOrText) !== null && _d !== void 0 ? _d : '', operationAriaLabel: (_e = i18nStrings.tokenOperatorAriaLabel) !== null && _e !== void 0 ? _e : '', onChangeOperation: setOperation, onDismissToken: removeToken, disabled: disabled, editorContent: React.createElement(TokenEditor, { supportsGroups:
|
|
22
|
+
], showOperation: !first && !hideOperations, operation: operation, andText: (_c = i18nStrings.operationAndText) !== null && _c !== void 0 ? _c : '', orText: (_d = i18nStrings.operationOrText) !== null && _d !== void 0 ? _d : '', operationAriaLabel: (_e = i18nStrings.tokenOperatorAriaLabel) !== null && _e !== void 0 ? _e : '', onChangeOperation: setOperation, onDismissToken: removeToken, disabled: disabled, editorContent: React.createElement(TokenEditor, { supportsGroups: enableTokenGroups, filteringProperties: filteringProperties, filteringOptions: filteringOptions, tempGroup: [temporaryToken], onChangeTempGroup: newGroup => setTemporaryToken(newGroup[0]),
|
|
24
23
|
// This property will be needed when supportsGroups={true}
|
|
25
24
|
standaloneTokens: [],
|
|
26
25
|
// This property will be needed when supportsGroups={true}
|
|
27
|
-
onChangeStandalone: emptyHandler, asyncProps: asyncProps, onLoadItems: onLoadItems, i18nStrings:
|
|
28
|
-
// These properties will be needed when supportsGroups={true}
|
|
29
|
-
tokenEditorTokenActionsLabel: emptyLabel, tokenEditorTokenRemoveLabel: emptyLabel, tokenEditorTokenRemoveFromGroupLabel: emptyLabel, tokenEditorAddNewTokenLabel: '', tokenEditorAddTokenActionsLabel: '', tokenEditorAddExistingTokenLabel: emptyLabel }), asyncProperties: asyncProperties, customGroupsText: customGroupsText, freeTextFiltering: freeTextFiltering, onDismiss: () => { var _a; return (_a = tokenRef.current) === null || _a === void 0 ? void 0 : _a.closeEditor(); }, onSubmit: () => {
|
|
26
|
+
onChangeStandalone: emptyHandler, asyncProps: asyncProps, onLoadItems: onLoadItems, i18nStrings: i18nStrings, asyncProperties: asyncProperties, customGroupsText: customGroupsText, freeTextFiltering: freeTextFiltering, onDismiss: () => { var _a; return (_a = tokenRef.current) === null || _a === void 0 ? void 0 : _a.closeEditor(); }, onSubmit: () => {
|
|
30
27
|
var _a;
|
|
31
28
|
setToken(matchTokenValue(temporaryToken, filteringOptions));
|
|
32
29
|
(_a = tokenRef.current) === null || _a === void 0 ? void 0 : _a.closeEditor();
|
|
33
30
|
} }), editorHeader: (_f = i18nStrings.editTokenHeader) !== null && _f !== void 0 ? _f : '', editorDismissAriaLabel: (_g = i18nStrings.dismissAriaLabel) !== null && _g !== void 0 ? _g : '', editorExpandToViewport: !!expandToViewport, onEditorOpen: () => setTemporaryToken(token),
|
|
34
31
|
// The properties below are only relevant for grouped tokens that are not supported
|
|
35
32
|
// by the property filter component yet.
|
|
36
|
-
groupOperation: operation, groupAriaLabel: '', groupEditAriaLabel: '', onChangeGroupOperation: () => { }, hasGroups: false }));
|
|
33
|
+
groupOperation: operation, groupAriaLabel: '', groupEditAriaLabel: '', onChangeGroupOperation: () => { }, hasGroups: false, popoverSize: enableTokenGroups ? 'content' : 'large' }));
|
|
37
34
|
};
|
|
38
35
|
const TokenTrigger = ({ token: { propertyLabel, operator, value }, allProperties, }) => {
|
|
39
36
|
if (propertyLabel) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../src/property-filter/token.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,Q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CAAC,CAAC,CAAC,aAAa;QACnC,8BAAM,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,IAAG,YAAY,CAAQ;QAC/D,KAAK,CACL,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useRef, useState } from 'react';\n\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport FilteringToken, { FilteringTokenRef } from './filtering-token';\nimport { getFormattedToken } from './i18n-utils';\nimport {\n FormattedToken,\n GroupText,\n I18nStrings,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalFreeTextFiltering,\n InternalToken,\n JoinOperation,\n LoadItemsDetail,\n Token,\n} from './interfaces';\nimport { TokenEditor } from './token-editor';\nimport { matchTokenValue } from './utils';\n\nimport styles from './styles.css.js';\n\ninterface TokenProps {\n asyncProperties?: boolean;\n asyncProps: DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n disabled?: boolean;\n freeTextFiltering: InternalFreeTextFiltering;\n expandToViewport?: boolean;\n filteringProperties: readonly InternalFilteringProperty[];\n filteringOptions: readonly InternalFilteringOption[];\n first?: boolean;\n hideOperations?: boolean;\n i18nStrings: I18nStrings;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n operation: JoinOperation;\n removeToken: () => void;\n setOperation: (newOperation: JoinOperation) => void;\n setToken: (newToken: Token) => void;\n token: InternalToken;\n enableTokenGroups: boolean;\n}\n\nconst emptyHandler = () => {};\n\nexport const TokenButton = ({\n token,\n operation = 'and',\n first,\n removeToken,\n setToken,\n setOperation,\n filteringProperties,\n filteringOptions,\n asyncProps,\n onLoadItems,\n i18nStrings,\n asyncProperties,\n hideOperations,\n customGroupsText,\n disabled,\n freeTextFiltering,\n expandToViewport,\n enableTokenGroups,\n}: TokenProps) => {\n const tokenRef = useRef<FilteringTokenRef>(null);\n const formattedToken = getFormattedToken(token, i18nStrings);\n const [temporaryToken, setTemporaryToken] = useState<InternalToken>(token);\n return (\n <FilteringToken\n ref={tokenRef}\n tokens={[\n {\n content: (\n <span className={styles['token-trigger']}>\n <TokenTrigger token={formattedToken} allProperties={token.property === null} />\n </span>\n ),\n ariaLabel: `${formattedToken.propertyLabel} ${formattedToken.operator} ${formattedToken.value}`,\n dismissAriaLabel: i18nStrings?.removeTokenButtonAriaLabel?.(formattedToken) ?? '',\n },\n ]}\n showOperation={!first && !hideOperations}\n operation={operation}\n andText={i18nStrings.operationAndText ?? ''}\n orText={i18nStrings.operationOrText ?? ''}\n operationAriaLabel={i18nStrings.tokenOperatorAriaLabel ?? ''}\n onChangeOperation={setOperation}\n onDismissToken={removeToken}\n disabled={disabled}\n editorContent={\n <TokenEditor\n supportsGroups={enableTokenGroups}\n filteringProperties={filteringProperties}\n filteringOptions={filteringOptions}\n tempGroup={[temporaryToken]}\n onChangeTempGroup={newGroup => setTemporaryToken(newGroup[0])}\n // This property will be needed when supportsGroups={true}\n standaloneTokens={[]}\n // This property will be needed when supportsGroups={true}\n onChangeStandalone={emptyHandler}\n asyncProps={asyncProps}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n asyncProperties={asyncProperties}\n customGroupsText={customGroupsText}\n freeTextFiltering={freeTextFiltering}\n onDismiss={() => tokenRef.current?.closeEditor()}\n onSubmit={() => {\n setToken(matchTokenValue(temporaryToken, filteringOptions));\n tokenRef.current?.closeEditor();\n }}\n />\n }\n editorHeader={i18nStrings.editTokenHeader ?? ''}\n editorDismissAriaLabel={i18nStrings.dismissAriaLabel ?? ''}\n editorExpandToViewport={!!expandToViewport}\n onEditorOpen={() => setTemporaryToken(token)}\n // The properties below are only relevant for grouped tokens that are not supported\n // by the property filter component yet.\n groupOperation={operation}\n groupAriaLabel={''}\n groupEditAriaLabel={''}\n onChangeGroupOperation={() => {}}\n hasGroups={false}\n popoverSize={enableTokenGroups ? 'content' : 'large'}\n />\n );\n};\n\nconst TokenTrigger = ({\n token: { propertyLabel, operator, value },\n allProperties,\n}: {\n token: FormattedToken;\n allProperties: boolean;\n}) => {\n if (propertyLabel) {\n propertyLabel += ' ';\n }\n const freeTextContainsToken = operator === ':' && allProperties;\n const operatorText = freeTextContainsToken ? '' : operator + ' ';\n return (\n <>\n {allProperties ? '' : propertyLabel}\n <span className={styles['token-operator']}>{operatorText}</span>\n {value}\n </>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/side-navigation/implementation.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMnD,MAAM,MAAM,2BAA2B,GAAG,mBAAmB,GAAG,0BAA0B,CAAC;AAE3F,wBAAgB,4BAA4B,CAAC,EAC3C,MAAM,EACN,UAAU,EACV,KAAU,EACV,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,2BAA2B,
|
|
1
|
+
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/side-navigation/implementation.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMnD,MAAM,MAAM,2BAA2B,GAAG,mBAAmB,GAAG,0BAA0B,CAAC;AAE3F,wBAAgB,4BAA4B,CAAC,EAC3C,MAAM,EACN,UAAU,EACV,KAAU,EACV,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,2BAA2B,eAwD7B;AAED,eAAO,MAAM,8BAA8B,mGAA0D,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { __rest } from "tslib";
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import {
|
|
6
|
+
import { useAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags';
|
|
7
7
|
import { getBaseProps } from '../internal/base-component';
|
|
8
8
|
import { fireCancelableEvent, fireNonCancelableEvent } from '../internal/events';
|
|
9
9
|
import { isDevelopment } from '../internal/is-development';
|
|
@@ -14,6 +14,7 @@ import styles from './styles.css.js';
|
|
|
14
14
|
export function SideNavigationImplementation(_a) {
|
|
15
15
|
var { header, activeHref, items = [], onFollow, onChange, __internalRootRef } = _a, props = __rest(_a, ["header", "activeHref", "items", "onFollow", "onChange", "__internalRootRef"]);
|
|
16
16
|
const baseProps = getBaseProps(props);
|
|
17
|
+
const isToolbar = useAppLayoutToolbarEnabled();
|
|
17
18
|
const parentMap = useMemo(() => generateExpandableItemsMapping(items), [items]);
|
|
18
19
|
if (isDevelopment) {
|
|
19
20
|
// This code should be wiped in production anyway.
|
|
@@ -28,7 +29,7 @@ export function SideNavigationImplementation(_a) {
|
|
|
28
29
|
const onFollowHandler = useCallback((item, sourceEvent) => {
|
|
29
30
|
fireCancelableEvent(onFollow, item, sourceEvent);
|
|
30
31
|
}, [onFollow]);
|
|
31
|
-
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(styles.root, baseProps.className,
|
|
32
|
+
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(styles.root, baseProps.className, isToolbar && styles['with-toolbar']), ref: __internalRootRef }),
|
|
32
33
|
header && (React.createElement(Header, { definition: header, activeHref: activeHref, fireChange: onChangeHandler, fireFollow: onFollowHandler })),
|
|
33
34
|
items && (React.createElement("div", { className: styles['list-container'] },
|
|
34
35
|
React.createElement(NavigationItemsList, { variant: "root", items: items, fireFollow: onFollowHandler, fireChange: onChangeHandler, activeHref: activeHref })))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/side-navigation/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/side-navigation/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,QAAQ,CAAC;AAE7E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,UAAU,4BAA4B,CAAC,EAQf;QARe,EAC3C,MAAM,EACN,UAAU,EACV,KAAK,GAAG,EAAE,EACV,QAAQ,EACR,QAAQ,EACR,iBAAiB,OAEW,EADzB,KAAK,cAPmC,8EAQ5C,CADS;IAER,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,0BAA0B,EAAE,CAAC;IAC/C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,8BAA8B,CAAC,KAAK,CAAC,EAAE,CAAC,KA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AC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,8BAA8B,GAAG,yBAAyB,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport clsx from 'clsx';\n\nimport { useAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireCancelableEvent, fireNonCancelableEvent } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { isDevelopment } from '../internal/is-development';\nimport { createWidgetizedComponent } from '../internal/widgets';\nimport { SideNavigationProps } from './interfaces';\nimport { Header, NavigationItemsList } from './parts';\nimport { checkDuplicateHrefs, generateExpandableItemsMapping } from './util';\n\nimport styles from './styles.css.js';\n\nexport type SideNavigationInternalProps = SideNavigationProps & InternalBaseComponentProps;\n\nexport function SideNavigationImplementation({\n header,\n activeHref,\n items = [],\n onFollow,\n onChange,\n __internalRootRef,\n ...props\n}: SideNavigationInternalProps) {\n const baseProps = getBaseProps(props);\n const isToolbar = useAppLayoutToolbarEnabled();\n const parentMap = useMemo(() => generateExpandableItemsMapping(items), [items]);\n\n if (isDevelopment) {\n // This code should be wiped in production anyway.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => checkDuplicateHrefs(items), [items]);\n }\n\n const onChangeHandler = useCallback(\n (item: SideNavigationProps.Section | SideNavigationProps.ExpandableLinkGroup, expanded: boolean) => {\n // generateExpandableItemsMapping walks through the entire tree, so we're certain about getting a value.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n fireNonCancelableEvent(onChange, { item, expanded: expanded, expandableParents: parentMap.get(item)! });\n },\n [onChange, parentMap]\n );\n\n const onFollowHandler = useCallback(\n (\n item:\n | SideNavigationProps.Link\n | SideNavigationProps.Header\n | SideNavigationProps.LinkGroup\n | SideNavigationProps.ExpandableLinkGroup,\n sourceEvent: React.SyntheticEvent | Event\n ) => {\n fireCancelableEvent(onFollow, item, sourceEvent);\n },\n [onFollow]\n );\n\n return (\n <div\n {...baseProps}\n className={clsx(styles.root, baseProps.className, isToolbar && styles['with-toolbar'])}\n ref={__internalRootRef}\n >\n {header && (\n <Header definition={header} activeHref={activeHref} fireChange={onChangeHandler} fireFollow={onFollowHandler} />\n )}\n {items && (\n <div className={styles['list-container']}>\n <NavigationItemsList\n variant=\"root\"\n items={items}\n fireFollow={onFollowHandler}\n fireChange={onChangeHandler}\n activeHref={activeHref}\n />\n </div>\n )}\n </div>\n );\n}\n\nexport const createWidgetizedSideNavigation = createWidgetizedComponent(SideNavigationImplementation);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottom.d.ts","sourceRoot":"","sources":["../../../src/split-panel/bottom.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAMjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAKrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAKtD,UAAU,4BAA6B,SAAQ,sBAAsB;IACnE,KAAK,EAAE,gBAAgB,CAAC;IACxB,uBAAuB,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxC,iBAAiB,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC;CACpD;AAED,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,MAAM,EACN,KAAK,EACL,uBAAuB,EACvB,aAAa,EACb,UAAU,EACV,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACb,QAAQ,GACT,EAAE,4BAA4B,
|
|
1
|
+
{"version":3,"file":"bottom.d.ts","sourceRoot":"","sources":["../../../src/split-panel/bottom.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAMjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAKrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAKtD,UAAU,4BAA6B,SAAQ,sBAAsB;IACnE,KAAK,EAAE,gBAAgB,CAAC;IACxB,uBAAuB,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxC,iBAAiB,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC;CACpD;AAED,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,MAAM,EACN,KAAK,EACL,uBAAuB,EACvB,aAAa,EACb,UAAU,EACV,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACb,QAAQ,GACT,EAAE,4BAA4B,eAwD9B"}
|
package/split-panel/bottom.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useEffect, useRef } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';
|
|
6
|
-
import {
|
|
6
|
+
import { useAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags';
|
|
7
7
|
import { useSplitPanelContext } from '../internal/context/split-panel-context';
|
|
8
8
|
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
9
9
|
import { useMobile } from '../internal/hooks/use-mobile';
|
|
@@ -12,6 +12,7 @@ import styles from './styles.css.js';
|
|
|
12
12
|
import testUtilStyles from './test-classes/styles.css.js';
|
|
13
13
|
export function SplitPanelContentBottom({ baseProps, isOpen, state, transitioningElementRef, splitPanelRef, cappedSize, header, resizeHandle, children, appLayoutMaxWidth, panelHeaderId, onToggle, }) {
|
|
14
14
|
const isRefresh = useVisualRefresh();
|
|
15
|
+
const isToolbar = useAppLayoutToolbarEnabled();
|
|
15
16
|
const { bottomOffset, leftOffset, rightOffset, disableContentPaddings, contentWrapperPaddings, reportHeaderHeight } = useSplitPanelContext();
|
|
16
17
|
const transitionContentBottomRef = useMergeRefs(splitPanelRef || null, transitioningElementRef);
|
|
17
18
|
const isMobile = useMobile();
|
|
@@ -34,7 +35,7 @@ export function SplitPanelContentBottom({ baseProps, isOpen, state, transitionin
|
|
|
34
35
|
[styles['drawer-disable-content-paddings']]: disableContentPaddings,
|
|
35
36
|
[styles.animating]: isRefresh && (state === 'entering' || state === 'exiting'),
|
|
36
37
|
[styles.refresh]: isRefresh,
|
|
37
|
-
[styles['with-toolbar']]:
|
|
38
|
+
[styles['with-toolbar']]: isToolbar,
|
|
38
39
|
}), onClick: () => !isOpen && onToggle(), style: {
|
|
39
40
|
insetBlockEnd: bottomOffset,
|
|
40
41
|
insetInlineStart: leftOffset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottom.js","sourceRoot":"","sources":["../../../src/split-panel/bottom.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"bottom.js","sourceRoot":"","sources":["../../../src/split-panel/bottom.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,gBAAgB,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BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,uBAAuB,CAAC,iBAAe,CAAC,MAAM;gBAC3F,6BAAK,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,iBAAiB,IAChG,QAAQ,CACL,CACF,CACF,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags';\nimport { TransitionStatus } from '../internal/components/transition';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { SplitPanelContentProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\ninterface SplitPanelContentBottomProps extends SplitPanelContentProps {\n state: TransitionStatus;\n transitioningElementRef: React.Ref<any>;\n appLayoutMaxWidth: React.CSSProperties | undefined;\n}\n\nexport function SplitPanelContentBottom({\n baseProps,\n isOpen,\n state,\n transitioningElementRef,\n splitPanelRef,\n cappedSize,\n header,\n resizeHandle,\n children,\n appLayoutMaxWidth,\n panelHeaderId,\n onToggle,\n}: SplitPanelContentBottomProps) {\n const isRefresh = useVisualRefresh();\n const isToolbar = useAppLayoutToolbarEnabled();\n const { bottomOffset, leftOffset, rightOffset, disableContentPaddings, contentWrapperPaddings, reportHeaderHeight } =\n useSplitPanelContext();\n const transitionContentBottomRef = useMergeRefs(splitPanelRef || null, transitioningElementRef);\n const isMobile = useMobile();\n\n const headerRef = useRef<HTMLDivElement>(null);\n useResizeObserver(headerRef, entry => reportHeaderHeight(entry.borderBoxHeight));\n useEffect(() => {\n // report empty height when unmounting the panel\n return () => reportHeaderHeight(0);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const centeredMaxWidthClasses = clsx({\n [styles['pane-bottom-center-align']]: isRefresh,\n [styles['pane-bottom-content-nav-padding']]: contentWrapperPaddings?.closedNav,\n [styles['pane-bottom-content-tools-padding']]: contentWrapperPaddings?.closedTools,\n });\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.drawer, styles['position-bottom'], testUtilStyles.root, {\n [testUtilStyles['open-position-bottom']]: isOpen,\n [styles['drawer-closed']]: !isOpen,\n [styles['drawer-mobile']]: isMobile,\n [styles['drawer-disable-content-paddings']]: disableContentPaddings,\n [styles.animating]: isRefresh && (state === 'entering' || state === 'exiting'),\n [styles.refresh]: isRefresh,\n [styles['with-toolbar']]: isToolbar,\n })}\n onClick={() => !isOpen && onToggle()}\n style={{\n insetBlockEnd: bottomOffset,\n insetInlineStart: leftOffset,\n insetInlineEnd: rightOffset,\n blockSize: isOpen ? cappedSize : undefined,\n }}\n ref={transitionContentBottomRef}\n >\n {isOpen && <div className={styles['slider-wrapper-bottom']}>{resizeHandle}</div>}\n <div className={styles['drawer-content-bottom']} aria-labelledby={panelHeaderId} role=\"region\">\n <div className={clsx(styles['pane-header-wrapper-bottom'], centeredMaxWidthClasses)} ref={headerRef}>\n {header}\n </div>\n <div className={clsx(styles['content-bottom'], centeredMaxWidthClasses)} aria-hidden={!isOpen}>\n <div className={clsx({ [styles['content-bottom-max-width']]: isRefresh })} style={appLayoutMaxWidth}>\n {children}\n </div>\n </div>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAkB5E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAO/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAkB5E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAO/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,eAAO,MAAM,wBAAwB,qFAqOpC,CAAC;AAEF,eAAO,MAAM,0BAA0B,mMAIZ,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { __rest } from "tslib";
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import {
|
|
6
|
+
import { useAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags';
|
|
7
7
|
import { useKeyboardEvents } from '../app-layout/utils/use-keyboard-events';
|
|
8
8
|
import { usePointerEvents } from '../app-layout/utils/use-pointer-events';
|
|
9
9
|
import { InternalButton } from '../button/internal';
|
|
@@ -24,6 +24,7 @@ import testUtilStyles from './test-classes/styles.css.js';
|
|
|
24
24
|
export const SplitPanelImplementation = React.forwardRef((_a, __internalRootRef) => {
|
|
25
25
|
var { header, children, hidePreferencesButton = false, closeBehavior = 'collapse', i18nStrings = {} } = _a, restProps = __rest(_a, ["header", "children", "hidePreferencesButton", "closeBehavior", "i18nStrings"]);
|
|
26
26
|
const isRefresh = useVisualRefresh();
|
|
27
|
+
const isToolbar = useAppLayoutToolbarEnabled();
|
|
27
28
|
const { position, topOffset, bottomOffset, rightOffset, contentWidthStyles, isOpen, isForcedPosition, onPreferencesChange, onResize, onToggle, size, relativeSize, setSplitPanelToggle, refs, } = useSplitPanelContext();
|
|
28
29
|
const baseProps = getBaseProps(restProps);
|
|
29
30
|
const [isPreferencesOpen, setPreferencesOpen] = useState(false);
|
|
@@ -46,7 +47,7 @@ export const SplitPanelImplementation = React.forwardRef((_a, __internalRootRef)
|
|
|
46
47
|
[globalVars.stickyVerticalBottomOffset]: bottomOffset,
|
|
47
48
|
};
|
|
48
49
|
const panelHeaderId = useUniqueId('split-panel-header');
|
|
49
|
-
const wrappedHeader = (React.createElement("div", { className: clsx(styles.header,
|
|
50
|
+
const wrappedHeader = (React.createElement("div", { className: clsx(styles.header, isToolbar && styles['with-toolbar']), style: appLayoutMaxWidth },
|
|
50
51
|
React.createElement("h2", { className: clsx(styles['header-text'], testUtilStyles['header-text']), id: panelHeaderId }, header),
|
|
51
52
|
React.createElement("div", { className: styles['header-actions'] },
|
|
52
53
|
!hidePreferencesButton && isOpen && (React.createElement(React.Fragment, null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,iBAAiB,MAAM,4CAA4C,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,k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,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,GACD,CACH,CACA,CACJ,CACU,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,0BAA0B,CAIlE,wBAAwB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { isAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags';\nimport { SizeControlProps } from '../app-layout/utils/interfaces';\nimport { useKeyboardEvents } from '../app-layout/utils/use-keyboard-events';\nimport { usePointerEvents } from '../app-layout/utils/use-pointer-events';\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport PanelResizeHandle from '../internal/components/panel-resize-handle';\nimport { Transition } from '../internal/components/transition';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\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 globalVars from '../internal/styles/global-vars';\nimport { createWidgetizedForwardRef } from '../internal/widgets';\nimport { SplitPanelContentBottom } from './bottom';\nimport { SplitPanelProps } from './interfaces';\nimport PreferencesModal from './preferences-modal';\nimport { SplitPanelContentSide } from './side';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport { SplitPanelProps };\n\nexport const SplitPanelImplementation = React.forwardRef<HTMLElement, SplitPanelProps>(\n (\n { header, children, hidePreferencesButton = false, closeBehavior = 'collapse', i18nStrings = {}, ...restProps },\n __internalRootRef\n ) => {\n const isRefresh = useVisualRefresh();\n\n const {\n position,\n topOffset,\n bottomOffset,\n rightOffset,\n contentWidthStyles,\n isOpen,\n isForcedPosition,\n onPreferencesChange,\n onResize,\n onToggle,\n size,\n relativeSize,\n setSplitPanelToggle,\n refs,\n } = useSplitPanelContext();\n const baseProps = getBaseProps(restProps);\n const [isPreferencesOpen, setPreferencesOpen] = useState<boolean>(false);\n\n const appLayoutMaxWidth = isRefresh && position === 'bottom' ? contentWidthStyles : undefined;\n\n const openButtonAriaLabel = i18nStrings.openButtonAriaLabel;\n useEffect(() => {\n setSplitPanelToggle({ displayed: closeBehavior === 'collapse', ariaLabel: openButtonAriaLabel });\n }, [setSplitPanelToggle, openButtonAriaLabel, closeBehavior]);\n\n const splitPanelRefObject = useRef<HTMLDivElement>(null);\n\n const sizeControlProps: SizeControlProps = {\n position,\n panelRef: splitPanelRefObject,\n handleRef: refs.slider,\n onResize,\n };\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const contentStyle = {\n [globalVars.stickyVerticalTopOffset]: topOffset,\n [globalVars.stickyVerticalBottomOffset]: bottomOffset,\n };\n\n const panelHeaderId = useUniqueId('split-panel-header');\n\n const wrappedHeader = (\n <div\n className={clsx(styles.header, isAppLayoutToolbarEnabled() && styles['with-toolbar'])}\n style={appLayoutMaxWidth}\n >\n <h2 className={clsx(styles['header-text'], testUtilStyles['header-text'])} id={panelHeaderId}>\n {header}\n </h2>\n <div className={styles['header-actions']}>\n {!hidePreferencesButton && isOpen && (\n <>\n <InternalButton\n className={testUtilStyles['preferences-button']}\n iconName=\"settings\"\n variant=\"icon\"\n onClick={() => setPreferencesOpen(true)}\n formAction=\"none\"\n ariaLabel={i18nStrings.preferencesTitle}\n ref={refs.preferences}\n />\n <span className={styles.divider} />\n </>\n )}\n\n {isOpen ? (\n <InternalButton\n className={testUtilStyles['close-button']}\n iconName={\n isRefresh && closeBehavior === 'collapse'\n ? position === 'side'\n ? 'angle-right'\n : 'angle-down'\n : 'close'\n }\n variant=\"icon\"\n onClick={onToggle}\n formAction=\"none\"\n ariaLabel={i18nStrings.closeButtonAriaLabel}\n ariaExpanded={isOpen}\n />\n ) : position === 'side' ? null : (\n <InternalButton\n className={testUtilStyles['open-button']}\n iconName=\"angle-up\"\n variant=\"icon\"\n formAction=\"none\"\n ariaLabel={i18nStrings.openButtonAriaLabel}\n ref={refs.toggle}\n ariaExpanded={isOpen}\n />\n )}\n </div>\n </div>\n );\n\n const resizeHandle = (\n <PanelResizeHandle\n ref={refs.slider}\n className={testUtilStyles.slider}\n ariaLabel={i18nStrings.resizeHandleAriaLabel}\n // Allows us to use the logical left/right keys to move the slider left/right,\n // but match aria keyboard behavior of using left/right to decrease/increase\n // the slider value.\n ariaValuenow={position === 'bottom' ? relativeSize : 100 - relativeSize}\n position={position}\n onKeyDown={onKeyDown}\n onPointerDown={onSliderPointerDown}\n />\n );\n\n /*\n This effect forces the browser to recalculate the layout\n whenever the split panel might have moved.\n\n This is needed as a workaround for a bug in Safari, which does\n not automatically calculate the new position of the split panel\n _content_ when the split panel moves.\n */\n useLayoutEffect(() => {\n const root = splitPanelRefObject.current;\n\n if (root) {\n const property = 'transform';\n const temporaryValue = 'translateZ(0)';\n\n const valueBefore = root.style[property];\n root.style[property] = temporaryValue;\n\n // This line forces the browser to recalculate the layout\n void root.offsetHeight;\n\n root.style[property] = valueBefore;\n }\n }, [rightOffset, __internalRootRef]);\n\n const mergedRef = useMergeRefs(splitPanelRefObject, __internalRootRef);\n\n if (closeBehavior === 'hide' && !isOpen) {\n return <></>;\n }\n\n /**\n * The AppLayout factor moved the circular buttons out of the\n * SplitPanel and into the Tools component. This conditional\n * is still needed for the early return to prevent execution\n * of the following code.\n */\n if (isRefresh && !isOpen && position === 'side') {\n return <></>;\n }\n\n return (\n <Transition in={isOpen ?? false}>\n {(state, transitioningElementRef) => (\n <>\n {position === 'side' && (\n <SplitPanelContentSide\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n openButtonAriaLabel={openButtonAriaLabel}\n toggleRef={refs.toggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n >\n {children}\n </SplitPanelContentSide>\n )}\n\n {position === 'bottom' && (\n <SplitPanelContentBottom\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n state={state}\n transitioningElementRef={transitioningElementRef}\n appLayoutMaxWidth={appLayoutMaxWidth}\n >\n {children}\n </SplitPanelContentBottom>\n )}\n {isPreferencesOpen && (\n <PreferencesModal\n visible={true}\n preferences={{ position }}\n disabledSidePosition={position === 'bottom' && isForcedPosition}\n isRefresh={isRefresh}\n i18nStrings={{\n header: i18nStrings.preferencesTitle,\n confirm: i18nStrings.preferencesConfirm,\n cancel: i18nStrings.preferencesCancel,\n positionLabel: i18nStrings.preferencesPositionLabel,\n positionDescription: i18nStrings.preferencesPositionDescription,\n positionBottom: i18nStrings.preferencesPositionBottom,\n positionSide: i18nStrings.preferencesPositionSide,\n }}\n onConfirm={preferences => {\n onPreferencesChange({ ...preferences });\n setPreferencesOpen(false);\n }}\n onDismiss={() => {\n setPreferencesOpen(false);\n }}\n />\n )}\n </>\n )}\n </Transition>\n );\n }\n);\n\nexport const createWidgetizedSplitPanel = createWidgetizedForwardRef<\n SplitPanelProps,\n HTMLElement,\n typeof SplitPanelImplementation\n>(SplitPanelImplementation);\n"]}
|
|
1
|
+
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CA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CAAC,kBAAkB;gBACvC,MAAM,EAAE,WAAW,CAAC,iBAAiB;gBACrC,aAAa,EAAE,WAAW,CAAC,wBAAwB;gBACnD,mBAAmB,EAAE,WAAW,CAAC,8BAA8B;gBAC/D,cAAc,EAAE,WAAW,CAAC,yBAAyB;gBACrD,YAAY,EAAE,WAAW,CAAC,uBAAuB;aAClD,EACD,SAAS,EAAE,WAAW,CAAC,EAAE;gBACvB,mBAAmB,mBAAM,WAAW,EAAG,CAAC;gBACxC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,EACD,SAAS,EAAE,GAAG,EAAE;gBACd,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,GACD,CACH,CACA,CACJ,CACU,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,0BAA0B,CAIlE,wBAAwB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags';\nimport { SizeControlProps } from '../app-layout/utils/interfaces';\nimport { useKeyboardEvents } from '../app-layout/utils/use-keyboard-events';\nimport { usePointerEvents } from '../app-layout/utils/use-pointer-events';\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport PanelResizeHandle from '../internal/components/panel-resize-handle';\nimport { Transition } from '../internal/components/transition';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\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 globalVars from '../internal/styles/global-vars';\nimport { createWidgetizedForwardRef } from '../internal/widgets';\nimport { SplitPanelContentBottom } from './bottom';\nimport { SplitPanelProps } from './interfaces';\nimport PreferencesModal from './preferences-modal';\nimport { SplitPanelContentSide } from './side';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport { SplitPanelProps };\n\nexport const SplitPanelImplementation = React.forwardRef<HTMLElement, SplitPanelProps>(\n (\n { header, children, hidePreferencesButton = false, closeBehavior = 'collapse', i18nStrings = {}, ...restProps },\n __internalRootRef\n ) => {\n const isRefresh = useVisualRefresh();\n const isToolbar = useAppLayoutToolbarEnabled();\n\n const {\n position,\n topOffset,\n bottomOffset,\n rightOffset,\n contentWidthStyles,\n isOpen,\n isForcedPosition,\n onPreferencesChange,\n onResize,\n onToggle,\n size,\n relativeSize,\n setSplitPanelToggle,\n refs,\n } = useSplitPanelContext();\n const baseProps = getBaseProps(restProps);\n const [isPreferencesOpen, setPreferencesOpen] = useState<boolean>(false);\n\n const appLayoutMaxWidth = isRefresh && position === 'bottom' ? contentWidthStyles : undefined;\n\n const openButtonAriaLabel = i18nStrings.openButtonAriaLabel;\n useEffect(() => {\n setSplitPanelToggle({ displayed: closeBehavior === 'collapse', ariaLabel: openButtonAriaLabel });\n }, [setSplitPanelToggle, openButtonAriaLabel, closeBehavior]);\n\n const splitPanelRefObject = useRef<HTMLDivElement>(null);\n\n const sizeControlProps: SizeControlProps = {\n position,\n panelRef: splitPanelRefObject,\n handleRef: refs.slider,\n onResize,\n };\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const contentStyle = {\n [globalVars.stickyVerticalTopOffset]: topOffset,\n [globalVars.stickyVerticalBottomOffset]: bottomOffset,\n };\n\n const panelHeaderId = useUniqueId('split-panel-header');\n\n const wrappedHeader = (\n <div className={clsx(styles.header, isToolbar && styles['with-toolbar'])} style={appLayoutMaxWidth}>\n <h2 className={clsx(styles['header-text'], testUtilStyles['header-text'])} id={panelHeaderId}>\n {header}\n </h2>\n <div className={styles['header-actions']}>\n {!hidePreferencesButton && isOpen && (\n <>\n <InternalButton\n className={testUtilStyles['preferences-button']}\n iconName=\"settings\"\n variant=\"icon\"\n onClick={() => setPreferencesOpen(true)}\n formAction=\"none\"\n ariaLabel={i18nStrings.preferencesTitle}\n ref={refs.preferences}\n />\n <span className={styles.divider} />\n </>\n )}\n\n {isOpen ? (\n <InternalButton\n className={testUtilStyles['close-button']}\n iconName={\n isRefresh && closeBehavior === 'collapse'\n ? position === 'side'\n ? 'angle-right'\n : 'angle-down'\n : 'close'\n }\n variant=\"icon\"\n onClick={onToggle}\n formAction=\"none\"\n ariaLabel={i18nStrings.closeButtonAriaLabel}\n ariaExpanded={isOpen}\n />\n ) : position === 'side' ? null : (\n <InternalButton\n className={testUtilStyles['open-button']}\n iconName=\"angle-up\"\n variant=\"icon\"\n formAction=\"none\"\n ariaLabel={i18nStrings.openButtonAriaLabel}\n ref={refs.toggle}\n ariaExpanded={isOpen}\n />\n )}\n </div>\n </div>\n );\n\n const resizeHandle = (\n <PanelResizeHandle\n ref={refs.slider}\n className={testUtilStyles.slider}\n ariaLabel={i18nStrings.resizeHandleAriaLabel}\n // Allows us to use the logical left/right keys to move the slider left/right,\n // but match aria keyboard behavior of using left/right to decrease/increase\n // the slider value.\n ariaValuenow={position === 'bottom' ? relativeSize : 100 - relativeSize}\n position={position}\n onKeyDown={onKeyDown}\n onPointerDown={onSliderPointerDown}\n />\n );\n\n /*\n This effect forces the browser to recalculate the layout\n whenever the split panel might have moved.\n\n This is needed as a workaround for a bug in Safari, which does\n not automatically calculate the new position of the split panel\n _content_ when the split panel moves.\n */\n useLayoutEffect(() => {\n const root = splitPanelRefObject.current;\n\n if (root) {\n const property = 'transform';\n const temporaryValue = 'translateZ(0)';\n\n const valueBefore = root.style[property];\n root.style[property] = temporaryValue;\n\n // This line forces the browser to recalculate the layout\n void root.offsetHeight;\n\n root.style[property] = valueBefore;\n }\n }, [rightOffset, __internalRootRef]);\n\n const mergedRef = useMergeRefs(splitPanelRefObject, __internalRootRef);\n\n if (closeBehavior === 'hide' && !isOpen) {\n return <></>;\n }\n\n /**\n * The AppLayout factor moved the circular buttons out of the\n * SplitPanel and into the Tools component. This conditional\n * is still needed for the early return to prevent execution\n * of the following code.\n */\n if (isRefresh && !isOpen && position === 'side') {\n return <></>;\n }\n\n return (\n <Transition in={isOpen ?? false}>\n {(state, transitioningElementRef) => (\n <>\n {position === 'side' && (\n <SplitPanelContentSide\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n openButtonAriaLabel={openButtonAriaLabel}\n toggleRef={refs.toggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n >\n {children}\n </SplitPanelContentSide>\n )}\n\n {position === 'bottom' && (\n <SplitPanelContentBottom\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n state={state}\n transitioningElementRef={transitioningElementRef}\n appLayoutMaxWidth={appLayoutMaxWidth}\n >\n {children}\n </SplitPanelContentBottom>\n )}\n {isPreferencesOpen && (\n <PreferencesModal\n visible={true}\n preferences={{ position }}\n disabledSidePosition={position === 'bottom' && isForcedPosition}\n isRefresh={isRefresh}\n i18nStrings={{\n header: i18nStrings.preferencesTitle,\n confirm: i18nStrings.preferencesConfirm,\n cancel: i18nStrings.preferencesCancel,\n positionLabel: i18nStrings.preferencesPositionLabel,\n positionDescription: i18nStrings.preferencesPositionDescription,\n positionBottom: i18nStrings.preferencesPositionBottom,\n positionSide: i18nStrings.preferencesPositionSide,\n }}\n onConfirm={preferences => {\n onPreferencesChange({ ...preferences });\n setPreferencesOpen(false);\n }}\n onDismiss={() => {\n setPreferencesOpen(false);\n }}\n />\n )}\n </>\n )}\n </Transition>\n );\n }\n);\n\nexport const createWidgetizedSplitPanel = createWidgetizedForwardRef<\n SplitPanelProps,\n HTMLElement,\n typeof SplitPanelImplementation\n>(SplitPanelImplementation);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side.d.ts","sourceRoot":"","sources":["../../../src/split-panel/side.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAInD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAKtD,UAAU,0BAA2B,SAAQ,sBAAsB;IACjE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;CAC7C;AAED,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,SAAS,EACT,aAAa,EACb,SAAS,EACT,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,QAAQ,GACT,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"side.d.ts","sourceRoot":"","sources":["../../../src/split-panel/side.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAInD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAKtD,UAAU,0BAA2B,SAAQ,sBAAsB;IACjE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;CAC7C;AAED,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,SAAS,EACT,aAAa,EACb,SAAS,EACT,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,QAAQ,GACT,EAAE,0BAA0B,eAiD5B"}
|
package/split-panel/side.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import {
|
|
5
|
+
import { useAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags';
|
|
6
6
|
import InternalButton from '../button/internal';
|
|
7
7
|
import { useSplitPanelContext } from '../internal/context/split-panel-context';
|
|
8
8
|
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
@@ -11,17 +11,18 @@ import testUtilStyles from './test-classes/styles.css.js';
|
|
|
11
11
|
export function SplitPanelContentSide({ style, baseProps, splitPanelRef, toggleRef, header, children, resizeHandle, isOpen, cappedSize, openButtonAriaLabel, panelHeaderId, onToggle, }) {
|
|
12
12
|
const { topOffset, bottomOffset } = useSplitPanelContext();
|
|
13
13
|
const isRefresh = useVisualRefresh();
|
|
14
|
+
const isToolbar = useAppLayoutToolbarEnabled();
|
|
14
15
|
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles.drawer, styles['position-side'], testUtilStyles.root, {
|
|
15
16
|
[testUtilStyles['open-position-side']]: isOpen,
|
|
16
17
|
[styles['drawer-closed']]: !isOpen,
|
|
17
|
-
[styles['with-toolbar']]:
|
|
18
|
+
[styles['with-toolbar']]: isToolbar,
|
|
18
19
|
}), style: Object.assign({ width: isOpen && isRefresh ? cappedSize : undefined, maxWidth: isRefresh ? '100%' : undefined }, style), ref: splitPanelRef }),
|
|
19
20
|
React.createElement("div", { className: styles['drawer-content-side'], style: {
|
|
20
21
|
top: topOffset,
|
|
21
22
|
bottom: bottomOffset,
|
|
22
23
|
}, onClick: () => !isOpen && onToggle(), "aria-labelledby": panelHeaderId, role: "region" },
|
|
23
24
|
isOpen ? (React.createElement("div", { className: styles['slider-wrapper-side'] }, resizeHandle)) : (React.createElement(InternalButton, { className: clsx(testUtilStyles['open-button'], styles['open-button-side']), iconName: "angle-left", variant: "icon", formAction: "none", ariaLabel: openButtonAriaLabel, ariaExpanded: isOpen, ref: isRefresh ? null : toggleRef })),
|
|
24
|
-
React.createElement("div", { className: clsx(styles['content-side'],
|
|
25
|
+
React.createElement("div", { className: clsx(styles['content-side'], isToolbar && styles['with-toolbar']), "aria-hidden": !isOpen },
|
|
25
26
|
React.createElement("div", { className: styles['pane-header-wrapper-side'] }, header),
|
|
26
27
|
React.createElement("div", { className: styles['pane-content-wrapper-side'] }, children)))));
|
|
27
28
|
}
|
package/split-panel/side.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side.js","sourceRoot":"","sources":["../../../src/split-panel/side.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"side.js","sourceRoot":"","sources":["../../../src/split-panel/side.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAO1D,MAAM,UAAU,qBAAqB,CAAC,EACpC,KAAK,EACL,SAAS,EACT,aAAa,EACb,SAAS,EACT,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,QAAQ,GACmB;IAC3B,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,oBAAoB,EAAE,CAAC;I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GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,GACjC,CACH;YACD,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC,iBAAe,CAAC,MAAM;gBACrG,6BAAK,SAAS,EAAE,MAAM,CAAC,0BAA0B,CAAC,IAAG,MAAM,CAAO;gBAClE,6BAAK,SAAS,EAAE,MAAM,CAAC,2BAA2B,CAAC,IAAG,QAAQ,CAAO,CACjE,CACF,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { useAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags';\nimport { ButtonProps } from '../button/interfaces';\nimport InternalButton from '../button/internal';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { SplitPanelContentProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\ninterface SplitPanelContentSideProps extends SplitPanelContentProps {\n openButtonAriaLabel?: string;\n toggleRef: React.RefObject<ButtonProps.Ref>;\n}\n\nexport function SplitPanelContentSide({\n style,\n baseProps,\n splitPanelRef,\n toggleRef,\n header,\n children,\n resizeHandle,\n isOpen,\n cappedSize,\n openButtonAriaLabel,\n panelHeaderId,\n onToggle,\n}: SplitPanelContentSideProps) {\n const { topOffset, bottomOffset } = useSplitPanelContext();\n const isRefresh = useVisualRefresh();\n const isToolbar = useAppLayoutToolbarEnabled();\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.drawer, styles['position-side'], testUtilStyles.root, {\n [testUtilStyles['open-position-side']]: isOpen,\n [styles['drawer-closed']]: !isOpen,\n [styles['with-toolbar']]: isToolbar,\n })}\n style={{\n width: isOpen && isRefresh ? cappedSize : undefined,\n maxWidth: isRefresh ? '100%' : undefined,\n ...style,\n }}\n ref={splitPanelRef}\n >\n <div\n className={styles['drawer-content-side']}\n style={{\n top: topOffset,\n bottom: bottomOffset,\n }}\n onClick={() => !isOpen && onToggle()}\n aria-labelledby={panelHeaderId}\n role=\"region\"\n >\n {isOpen ? (\n <div className={styles['slider-wrapper-side']}>{resizeHandle}</div>\n ) : (\n <InternalButton\n className={clsx(testUtilStyles['open-button'], styles['open-button-side'])}\n iconName=\"angle-left\"\n variant=\"icon\"\n formAction=\"none\"\n ariaLabel={openButtonAriaLabel}\n ariaExpanded={isOpen}\n ref={isRefresh ? null : toggleRef}\n />\n )}\n <div className={clsx(styles['content-side'], isToolbar && styles['with-toolbar'])} aria-hidden={!isOpen}>\n <div className={styles['pane-header-wrapper-side']}>{header}</div>\n <div className={styles['pane-content-wrapper-side']}>{children}</div>\n </div>\n </div>\n </div>\n );\n}\n"]}
|