@cloudscape-design/components-themeable 3.0.1174 → 3.0.1176
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/internal/components/button-trigger/styles.scss +7 -0
- package/lib/internal/scss/internal/components/drag-handle-wrapper/styles.scss +28 -0
- package/lib/internal/scss/internal/components/option/styles.scss +4 -0
- package/lib/internal/scss/internal/components/selectable-item/styles.scss +1 -0
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/template/autosuggest/internal.d.ts.map +1 -1
- package/lib/internal/template/autosuggest/internal.js +5 -1
- package/lib/internal/template/autosuggest/internal.js.map +1 -1
- package/lib/internal/template/icon/interfaces.d.ts +1 -1
- package/lib/internal/template/icon/interfaces.d.ts.map +1 -1
- package/lib/internal/template/icon/interfaces.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/components/button-trigger/index.d.ts +1 -0
- package/lib/internal/template/internal/components/button-trigger/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/button-trigger/index.js +2 -2
- package/lib/internal/template/internal/components/button-trigger/index.js.map +1 -1
- package/lib/internal/template/internal/components/button-trigger/styles.css.js +14 -13
- package/lib/internal/template/internal/components/button-trigger/styles.scoped.css +32 -27
- package/lib/internal/template/internal/components/button-trigger/styles.selectors.js +14 -13
- package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.d.ts +3 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.js +2 -2
- package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.js +30 -7
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.css.js +30 -21
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.scoped.css +75 -39
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.selectors.js +30 -21
- package/lib/internal/template/internal/components/option/index.d.ts +1 -1
- package/lib/internal/template/internal/components/option/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/option/index.js +5 -1
- package/lib/internal/template/internal/components/option/index.js.map +1 -1
- package/lib/internal/template/internal/components/option/interfaces.d.ts +2 -1
- package/lib/internal/template/internal/components/option/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/components/option/interfaces.js.map +1 -1
- package/lib/internal/template/internal/components/option/styles.css.js +17 -16
- package/lib/internal/template/internal/components/option/styles.scoped.css +32 -28
- package/lib/internal/template/internal/components/option/styles.selectors.js +17 -16
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/multiselect/index.d.ts.map +1 -1
- package/lib/internal/template/multiselect/index.js +2 -2
- package/lib/internal/template/multiselect/index.js.map +1 -1
- package/lib/internal/template/multiselect/interfaces.d.ts +37 -0
- package/lib/internal/template/multiselect/interfaces.d.ts.map +1 -1
- package/lib/internal/template/multiselect/interfaces.js.map +1 -1
- package/lib/internal/template/multiselect/internal.d.ts.map +1 -1
- package/lib/internal/template/multiselect/internal.js +8 -4
- package/lib/internal/template/multiselect/internal.js.map +1 -1
- package/lib/internal/template/select/index.d.ts.map +1 -1
- package/lib/internal/template/select/index.js +2 -2
- package/lib/internal/template/select/index.js.map +1 -1
- package/lib/internal/template/select/interfaces.d.ts +31 -1
- package/lib/internal/template/select/interfaces.d.ts.map +1 -1
- package/lib/internal/template/select/interfaces.js.map +1 -1
- package/lib/internal/template/select/internal.d.ts.map +1 -1
- package/lib/internal/template/select/internal.js +8 -4
- package/lib/internal/template/select/internal.js.map +1 -1
- package/lib/internal/template/select/parts/item.d.ts +13 -2
- package/lib/internal/template/select/parts/item.d.ts.map +1 -1
- package/lib/internal/template/select/parts/item.js +62 -6
- package/lib/internal/template/select/parts/item.js.map +1 -1
- package/lib/internal/template/select/parts/multiselect-item.d.ts +9 -2
- package/lib/internal/template/select/parts/multiselect-item.d.ts.map +1 -1
- package/lib/internal/template/select/parts/multiselect-item.js +79 -5
- package/lib/internal/template/select/parts/multiselect-item.js.map +1 -1
- package/lib/internal/template/select/parts/plain-list.d.ts +3 -0
- package/lib/internal/template/select/parts/plain-list.d.ts.map +1 -1
- package/lib/internal/template/select/parts/plain-list.js +2 -1
- package/lib/internal/template/select/parts/plain-list.js.map +1 -1
- package/lib/internal/template/select/parts/trigger.d.ts +1 -0
- package/lib/internal/template/select/parts/trigger.d.ts.map +1 -1
- package/lib/internal/template/select/parts/trigger.js +17 -3
- package/lib/internal/template/select/parts/trigger.js.map +1 -1
- package/lib/internal/template/select/parts/virtual-list.d.ts.map +1 -1
- package/lib/internal/template/select/parts/virtual-list.js +2 -1
- package/lib/internal/template/select/parts/virtual-list.js.map +1 -1
- package/lib/internal/template/select/utils/render-options.d.ts +4 -1
- package/lib/internal/template/select/utils/render-options.d.ts.map +1 -1
- package/lib/internal/template/select/utils/render-options.js +15 -4
- package/lib/internal/template/select/utils/render-options.js.map +1 -1
- package/lib/internal/template/test-utils/dom/internal/option.d.ts +4 -0
- package/lib/internal/template/test-utils/dom/internal/option.js +10 -1
- package/lib/internal/template/test-utils/dom/internal/option.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/internal/option.d.ts +4 -0
- package/lib/internal/template/test-utils/selectors/internal/option.js +10 -1
- package/lib/internal/template/test-utils/selectors/internal/option.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"button-trigger": "awsui_button-
|
|
6
|
-
"arrow": "
|
|
7
|
-
"in-filtering-token-root": "awsui_in-filtering-token-
|
|
8
|
-
"in-filtering-token-nested": "awsui_in-filtering-token-
|
|
9
|
-
"has-caret": "awsui_has-
|
|
10
|
-
"placeholder": "
|
|
11
|
-
"pressed": "
|
|
12
|
-
"disabled": "
|
|
13
|
-
"in-filtering-token": "awsui_in-filtering-
|
|
14
|
-
"readonly": "
|
|
15
|
-
"invalid": "
|
|
16
|
-
"warning": "
|
|
17
|
-
"
|
|
5
|
+
"button-trigger": "awsui_button-trigger_18eso_wavwd_161",
|
|
6
|
+
"arrow": "awsui_arrow_18eso_wavwd_161",
|
|
7
|
+
"in-filtering-token-root": "awsui_in-filtering-token-root_18eso_wavwd_221",
|
|
8
|
+
"in-filtering-token-nested": "awsui_in-filtering-token-nested_18eso_wavwd_221",
|
|
9
|
+
"has-caret": "awsui_has-caret_18eso_wavwd_257",
|
|
10
|
+
"placeholder": "awsui_placeholder_18eso_wavwd_260",
|
|
11
|
+
"pressed": "awsui_pressed_18eso_wavwd_273",
|
|
12
|
+
"disabled": "awsui_disabled_18eso_wavwd_276",
|
|
13
|
+
"in-filtering-token": "awsui_in-filtering-token_18eso_wavwd_221",
|
|
14
|
+
"readonly": "awsui_readonly_18eso_wavwd_297",
|
|
15
|
+
"invalid": "awsui_invalid_18eso_wavwd_319",
|
|
16
|
+
"warning": "awsui_warning_18eso_wavwd_328",
|
|
17
|
+
"custom-option": "awsui_custom-option_18eso_wavwd_337",
|
|
18
|
+
"inline-tokens": "awsui_inline-tokens_18eso_wavwd_342"
|
|
18
19
|
};
|
|
19
20
|
|
|
@@ -5,7 +5,9 @@ interface DirectionButtonProps {
|
|
|
5
5
|
state: DirectionState;
|
|
6
6
|
onClick: React.MouseEventHandler;
|
|
7
7
|
show: boolean;
|
|
8
|
+
forcedPosition: null | 'top' | 'bottom';
|
|
9
|
+
forcedIndex: number;
|
|
8
10
|
}
|
|
9
|
-
export default function DirectionButton({ direction, state, show, onClick }: DirectionButtonProps): JSX.Element;
|
|
11
|
+
export default function DirectionButton({ direction, state, show, onClick, forcedPosition, forcedIndex, }: DirectionButtonProps): JSX.Element;
|
|
10
12
|
export {};
|
|
11
13
|
//# sourceMappingURL=direction-button.d.ts.map
|
package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"direction-button.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/direction-button.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAezD,UAAU,oBAAoB;IAC5B,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACjC,IAAI,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"direction-button.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/direction-button.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAezD,UAAU,oBAAoB;IAC5B,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,cAAc,EAAE,IAAI,GAAG,KAAK,GAAG,QAAQ,CAAC;IACxC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,SAAS,EACT,KAAK,EACL,IAAI,EACJ,OAAO,EACP,cAAc,EACd,WAAW,GACZ,EAAE,oBAAoB,eAqCtB"}
|
|
@@ -15,12 +15,12 @@ const ICON_LOGICAL_PROPERTY_MAP = {
|
|
|
15
15
|
'inline-start': 'arrow-left',
|
|
16
16
|
'inline-end': 'arrow-right',
|
|
17
17
|
};
|
|
18
|
-
export default function DirectionButton({ direction, state, show, onClick }) {
|
|
18
|
+
export default function DirectionButton({ direction, state, show, onClick, forcedPosition, forcedIndex, }) {
|
|
19
19
|
return (React.createElement(Transition, { in: show }, (transitionState, ref) => (
|
|
20
20
|
// The wrapper exists to provide a padding around each direction button that
|
|
21
21
|
// prevents any accidental presses around the button from propagating to any
|
|
22
22
|
// interactive elements behind the button.
|
|
23
|
-
React.createElement("span", { ref: ref, className: clsx(styles['direction-button-wrapper'], styles[`direction-button-wrapper-${direction}`], transitionState === 'exited' && styles['direction-button-wrapper-hidden'], styles[`direction-button-wrapper-motion-${transitionState}`]) },
|
|
23
|
+
React.createElement("span", { ref: ref, className: clsx(styles['direction-button-wrapper'], !forcedPosition && styles[`direction-button-wrapper-${direction}`], forcedPosition && styles['direction-button-wrapper-forced'], forcedPosition && styles[`direction-button-wrapper-forced-${forcedPosition}-${forcedIndex}`], transitionState === 'exited' && styles['direction-button-wrapper-hidden'], styles[`direction-button-wrapper-motion-${transitionState}`]) },
|
|
24
24
|
React.createElement("span", { className: clsx(styles['direction-button'], state === 'disabled' && styles['direction-button-disabled'], testUtilsStyles[`direction-button-${direction}`], !['exiting', 'exited'].includes(transitionState) && testUtilsStyles['direction-button-visible']), onClick: state !== 'disabled' ? onClick : undefined,
|
|
25
25
|
// This prevents focus from being lost to `document.body` on
|
|
26
26
|
// mouse/pointer press. This allows us to listen to onClick while
|
package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"direction-button.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/direction-button.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,+EAA+E;AAC/E,6EAA6E;AAC7E,+BAA+B;AAC/B,MAAM,yBAAyB,GAAsC;IACnE,aAAa,EAAE,UAAU;IACzB,WAAW,EAAE,YAAY;IACzB,cAAc,EAAE,YAAY;IAC5B,YAAY,EAAE,aAAa;CAC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"direction-button.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/direction-button.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,+EAA+E;AAC/E,6EAA6E;AAC7E,+BAA+B;AAC/B,MAAM,yBAAyB,GAAsC;IACnE,aAAa,EAAE,UAAU;IACzB,WAAW,EAAE,YAAY;IACzB,cAAc,EAAE,YAAY;IAC5B,YAAY,EAAE,aAAa;CAC5B,CAAC;AAWF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,SAAS,EACT,KAAK,EACL,IAAI,EACJ,OAAO,EACP,cAAc,EACd,WAAW,GACU;IACrB,OAAO,CACL,oBAAC,UAAU,IAAC,EAAE,EAAE,IAAI,IACjB,CAAC,eAAe,EAAE,GAAG,EAAE,EAAE,CAAC;IACzB,4EAA4E;IAC5E,4EAA4E;IAC5E,0CAA0C;IAC1C,8BACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,0BAA0B,CAAC,EAClC,CAAC,cAAc,IAAI,MAAM,CAAC,4BAA4B,SAAS,EAAE,CAAC,EAClE,cAAc,IAAI,MAAM,CAAC,iCAAiC,CAAC,EAC3D,cAAc,IAAI,MAAM,CAAC,mCAAmC,cAAc,IAAI,WAAW,EAAE,CAAC,EAC5F,eAAe,KAAK,QAAQ,IAAI,MAAM,CAAC,iCAAiC,CAAC,EACzE,MAAM,CAAC,mCAAmC,eAAe,EAAE,CAAC,CAC7D;QAED,8BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,kBAAkB,CAAC,EAC1B,KAAK,KAAK,UAAU,IAAI,MAAM,CAAC,2BAA2B,CAAC,EAC3D,eAAe,CAAC,oBAAoB,SAAS,EAAE,CAAC,EAChD,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,eAAe,CAAC,0BAA0B,CAAC,CAChG,EACD,OAAO,EAAE,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;YACnD,4DAA4D;YAC5D,iEAAiE;YACjE,+CAA+C;YAC/C,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE;YAE9C,oBAAC,YAAY,IAAC,IAAI,EAAE,yBAAyB,CAAC,SAAS,CAAC,EAAE,IAAI,EAAC,OAAO,GAAG,CACpE,CACF,CACR,CACU,CACd,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { IconProps } from '../../../icon/interfaces';\nimport InternalIcon from '../../../icon/internal';\nimport { Transition } from '../transition';\nimport { Direction, DirectionState } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testUtilsStyles from './test-classes/styles.css.js';\n\n// Mapping from CSS logical property direction to icon name. The icon component\n// already flips the left/right icons automatically based on RTL, so we don't\n// need to do anything special.\nconst ICON_LOGICAL_PROPERTY_MAP: Record<Direction, IconProps.Name> = {\n 'block-start': 'arrow-up',\n 'block-end': 'arrow-down',\n 'inline-start': 'arrow-left',\n 'inline-end': 'arrow-right',\n};\n\ninterface DirectionButtonProps {\n direction: Direction;\n state: DirectionState;\n onClick: React.MouseEventHandler;\n show: boolean;\n forcedPosition: null | 'top' | 'bottom';\n forcedIndex: number;\n}\n\nexport default function DirectionButton({\n direction,\n state,\n show,\n onClick,\n forcedPosition,\n forcedIndex,\n}: DirectionButtonProps) {\n return (\n <Transition in={show}>\n {(transitionState, ref) => (\n // The wrapper exists to provide a padding around each direction button that\n // prevents any accidental presses around the button from propagating to any\n // interactive elements behind the button.\n <span\n ref={ref}\n className={clsx(\n styles['direction-button-wrapper'],\n !forcedPosition && styles[`direction-button-wrapper-${direction}`],\n forcedPosition && styles['direction-button-wrapper-forced'],\n forcedPosition && styles[`direction-button-wrapper-forced-${forcedPosition}-${forcedIndex}`],\n transitionState === 'exited' && styles['direction-button-wrapper-hidden'],\n styles[`direction-button-wrapper-motion-${transitionState}`]\n )}\n >\n <span\n className={clsx(\n styles['direction-button'],\n state === 'disabled' && styles['direction-button-disabled'],\n testUtilsStyles[`direction-button-${direction}`],\n !['exiting', 'exited'].includes(transitionState) && testUtilsStyles['direction-button-visible']\n )}\n onClick={state !== 'disabled' ? onClick : undefined}\n // This prevents focus from being lost to `document.body` on\n // mouse/pointer press. This allows us to listen to onClick while\n // keeping this button pointer-accessible only.\n onPointerDown={event => event.preventDefault()}\n >\n <InternalIcon name={ICON_LOGICAL_PROPERTY_MAP[direction]} size=\"small\" />\n </span>\n </span>\n )}\n </Transition>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/index.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAa,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAYjE,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,UAAU,EACV,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,WAAqB,EACrB,kBAA0B,EAC1B,qBAA6B,EAC7B,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,GACnB,EAAE,sBAAsB,eA+NxB"}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { nodeContains } from '@cloudscape-design/component-toolkit/dom';
|
|
6
|
+
import { getLogicalBoundingClientRect } from '@cloudscape-design/component-toolkit/internal';
|
|
6
7
|
import Tooltip from '../tooltip';
|
|
7
8
|
import DirectionButton from './direction-button';
|
|
8
9
|
import PortalOverlay from './portal-overlay';
|
|
9
10
|
import styles from './styles.css.js';
|
|
10
11
|
import testUtilsStyles from './test-classes/styles.css.js';
|
|
12
|
+
// The UAP buttons are forced to top/bottom position if the handle is close to the screen edge.
|
|
13
|
+
const FORCED_POSITION_PROXIMITY_PX = 50;
|
|
14
|
+
// Approximate UAP button size with margins to decide forced direction.
|
|
15
|
+
const UAP_BUTTON_SIZE_PX = 40;
|
|
16
|
+
const DIRECTIONS_ORDER = ['block-end', 'block-start', 'inline-end', 'inline-start'];
|
|
11
17
|
export default function DragHandleWrapper({ directions, tooltipText, children, onDirectionClick, triggerMode = 'focus', initialShowButtons = false, controlledShowButtons = false, wrapperClassName, hideButtonsOnDrag, clickDragThreshold, }) {
|
|
12
18
|
const wrapperRef = useRef(null);
|
|
13
19
|
const dragHandleRef = useRef(null);
|
|
@@ -112,7 +118,7 @@ export default function DragHandleWrapper({ directions, tooltipText, children, o
|
|
|
112
118
|
}
|
|
113
119
|
else if (triggerMode === 'keyboard-activate' && (event.key === 'Enter' || event.key === ' ')) {
|
|
114
120
|
// toggle buttons when Enter or space is pressed in 'keyboard-activate' triggerMode
|
|
115
|
-
setUncontrolledShowButtons(
|
|
121
|
+
setUncontrolledShowButtons(prevShowButtons => !prevShowButtons);
|
|
116
122
|
}
|
|
117
123
|
else if (event.key !== 'Alt' &&
|
|
118
124
|
event.key !== 'Control' &&
|
|
@@ -125,6 +131,27 @@ export default function DragHandleWrapper({ directions, tooltipText, children, o
|
|
|
125
131
|
}
|
|
126
132
|
};
|
|
127
133
|
const showButtons = triggerMode === 'controlled' ? controlledShowButtons : uncontrolledShowButtons;
|
|
134
|
+
const [forcedPosition, setForcedPosition] = useState(null);
|
|
135
|
+
const directionsOrder = forcedPosition === 'bottom' ? [...DIRECTIONS_ORDER].reverse() : DIRECTIONS_ORDER;
|
|
136
|
+
const visibleDirections = directionsOrder.filter(dir => directions[dir]);
|
|
137
|
+
useLayoutEffect(() => {
|
|
138
|
+
if (showButtons && dragHandleRef.current) {
|
|
139
|
+
const rect = getLogicalBoundingClientRect(dragHandleRef.current);
|
|
140
|
+
const conflicts = {
|
|
141
|
+
'block-start': rect.insetBlockStart < FORCED_POSITION_PROXIMITY_PX,
|
|
142
|
+
'block-end': window.innerHeight - rect.insetBlockEnd < FORCED_POSITION_PROXIMITY_PX,
|
|
143
|
+
'inline-start': rect.insetInlineStart < FORCED_POSITION_PROXIMITY_PX,
|
|
144
|
+
'inline-end': window.innerWidth - rect.insetInlineEnd < FORCED_POSITION_PROXIMITY_PX,
|
|
145
|
+
};
|
|
146
|
+
if (visibleDirections.some(direction => conflicts[direction])) {
|
|
147
|
+
const hasEnoughSpaceAbove = rect.insetBlockStart > visibleDirections.length * UAP_BUTTON_SIZE_PX;
|
|
148
|
+
setForcedPosition(hasEnoughSpaceAbove ? 'top' : 'bottom');
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
setForcedPosition(null);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}, [showButtons, visibleDirections]);
|
|
128
155
|
return (React.createElement(React.Fragment, null,
|
|
129
156
|
React.createElement("div", { className: clsx(testUtilsStyles.root, styles.contents), ref: wrapperRef, onFocus: onWrapperFocusIn, onBlur: onWrapperFocusOut },
|
|
130
157
|
React.createElement("div", { className: styles.contents, onPointerEnter: onTooltipGroupPointerEnter, onPointerLeave: onTooltipGroupPointerLeave },
|
|
@@ -133,10 +160,6 @@ export default function DragHandleWrapper({ directions, tooltipText, children, o
|
|
|
133
160
|
// Rendered in a portal but pointerenter/pointerleave events still propagate
|
|
134
161
|
// up the React DOM tree, which is why it's placed in this nested context.
|
|
135
162
|
React.createElement(Tooltip, { trackRef: dragHandleRef, value: tooltipText, onDismiss: () => setShowTooltip(false) })))),
|
|
136
|
-
React.createElement(PortalOverlay, { track: dragHandleRef, isDisabled: !showButtons },
|
|
137
|
-
directions['block-start'] && (React.createElement(DirectionButton, { show: !isDisabled && showButtons, direction: "block-start", state: directions['block-start'], onClick: () => onDirectionClick === null || onDirectionClick === void 0 ? void 0 : onDirectionClick('block-start') })),
|
|
138
|
-
directions['block-end'] && (React.createElement(DirectionButton, { show: !isDisabled && showButtons, direction: "block-end", state: directions['block-end'], onClick: () => onDirectionClick === null || onDirectionClick === void 0 ? void 0 : onDirectionClick('block-end') })),
|
|
139
|
-
directions['inline-start'] && (React.createElement(DirectionButton, { show: !isDisabled && showButtons, direction: "inline-start", state: directions['inline-start'], onClick: () => onDirectionClick === null || onDirectionClick === void 0 ? void 0 : onDirectionClick('inline-start') })),
|
|
140
|
-
directions['inline-end'] && (React.createElement(DirectionButton, { show: !isDisabled && showButtons, direction: "inline-end", state: directions['inline-end'], onClick: () => onDirectionClick === null || onDirectionClick === void 0 ? void 0 : onDirectionClick('inline-end') })))));
|
|
163
|
+
React.createElement(PortalOverlay, { track: dragHandleRef, isDisabled: !showButtons }, visibleDirections.map((direction, index) => directions[direction] && (React.createElement(DirectionButton, { key: direction, show: !isDisabled && showButtons, direction: direction, state: directions[direction], onClick: () => onDirectionClick === null || onDirectionClick === void 0 ? void 0 : onDirectionClick(direction), forcedPosition: forcedPosition, forcedIndex: index }))))));
|
|
141
164
|
}
|
|
142
165
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAExE,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,eAAe,MAAM,oBAAoB,CAAC;AAEjD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,UAAU,EACV,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,WAAW,GAAG,OAAO,EACrB,kBAAkB,GAAG,KAAK,EAC1B,qBAAqB,GAAG,KAAK,EAC7B,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,GACK;IACvB,MAAM,UAAU,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IAC1D,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAE3F,MAAM,aAAa,GAAG,MAA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AC,IAAI,CAC5B,oBAAC,eAAe,IACd,IAAI,EAAE,CAAC,UAAU,IAAI,WAAW,EAChC,SAAS,EAAC,aAAa,EACvB,KAAK,EAAE,UAAU,CAAC,aAAa,CAAC,EAChC,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAG,aAAa,CAAC,GAChD,CACH;YACA,UAAU,CAAC,WAAW,CAAC,IAAI,CAC1B,oBAAC,eAAe,IACd,IAAI,EAAE,CAAC,UAAU,IAAI,WAAW,EAChC,SAAS,EAAC,WAAW,EACrB,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,EAC9B,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAG,WAAW,CAAC,GAC9C,CACH;YACA,UAAU,CAAC,cAAc,CAAC,IAAI,CAC7B,oBAAC,eAAe,IACd,IAAI,EAAE,CAAC,UAAU,IAAI,WAAW,EAChC,SAAS,EAAC,cAAc,EACxB,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,EACjC,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAG,cAAc,CAAC,GACjD,CACH;YACA,UAAU,CAAC,YAAY,CAAC,IAAI,CAC3B,oBAAC,eAAe,IACd,IAAI,EAAE,CAAC,UAAU,IAAI,WAAW,EAChC,SAAS,EAAC,YAAY,EACtB,KAAK,EAAE,UAAU,CAAC,YAAY,CAAC,EAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAG,YAAY,CAAC,GAC/C,CACH,CACa,CACf,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { nodeContains } from '@cloudscape-design/component-toolkit/dom';\n\nimport Tooltip from '../tooltip';\nimport DirectionButton from './direction-button';\nimport { DragHandleWrapperProps } from './interfaces';\nimport PortalOverlay from './portal-overlay';\n\nimport styles from './styles.css.js';\nimport testUtilsStyles from './test-classes/styles.css.js';\n\nexport default function DragHandleWrapper({\n directions,\n tooltipText,\n children,\n onDirectionClick,\n triggerMode = 'focus',\n initialShowButtons = false,\n controlledShowButtons = false,\n wrapperClassName,\n hideButtonsOnDrag,\n clickDragThreshold,\n}: DragHandleWrapperProps) {\n const wrapperRef = useRef<HTMLDivElement | null>(null);\n const dragHandleRef = useRef<HTMLDivElement | null>(null);\n const [showTooltip, setShowTooltip] = useState(false);\n const [uncontrolledShowButtons, setUncontrolledShowButtons] = useState(initialShowButtons);\n\n const isPointerDown = useRef(false);\n const initialPointerPosition = useRef<{ x: number; y: number } | undefined>();\n const didPointerDrag = useRef(false);\n\n // The tooltip (\"Drag or select to move/resize\") shouldn't show if clicking\n // on the handle wouldn't do anything.\n const isDisabled =\n !directions['block-start'] && !directions['block-end'] && !directions['inline-start'] && !directions['inline-end'];\n\n const onWrapperFocusIn: React.FocusEventHandler = event => {\n // The drag handle is focused when it's either tabbed to, or the pointer\n // is pressed on it. We exclude handling the pointer press in this handler,\n // since it could be the start of a drag event - the pointer stuff is\n // handled in the \"pointerup\" listener instead. In cases where focus is moved\n // to the button (by manually calling `.focus()`), the buttons should only appear\n // if the action that triggered the focus move was the result of a keypress.\n if (document.body.dataset.awsuiFocusVisible && !nodeContains(wrapperRef.current, event.relatedTarget)) {\n setShowTooltip(false);\n if (triggerMode === 'focus') {\n setUncontrolledShowButtons(true);\n }\n }\n };\n\n const onWrapperFocusOut: React.FocusEventHandler = event => {\n // Close the directional buttons when the focus leaves the drag handle.\n // \"focusout\" is also triggered when the user switches to another tab, but\n // since it'll be returned when they switch back anyway, we exclude that\n // case by checking for `document.hasFocus()`.\n if (document.hasFocus() && !nodeContains(wrapperRef.current, event.relatedTarget)) {\n setUncontrolledShowButtons(false);\n }\n };\n\n useEffect(() => {\n const controller = new AbortController();\n\n // We need to differentiate between a \"click\" and a \"drag\" action.\n // We can say a \"click\" happens when a \"pointerdown\" is followed by\n // a \"pointerup\" with no \"pointermove\" between the two.\n // However, it would be a poor usability experience if a \"click\" isn't\n // registered because, while pressing my mouse, I moved it by just one\n // pixel, making it a \"drag\" instead. So we allow the pointer to move by\n // `clickDragThreshold` pixels before setting `didPointerDrag` to true.\n document.addEventListener(\n 'pointermove',\n event => {\n if (\n isPointerDown.current &&\n initialPointerPosition.current &&\n (event.clientX > initialPointerPosition.current.x + clickDragThreshold ||\n event.clientX < initialPointerPosition.current.x - clickDragThreshold ||\n event.clientY > initialPointerPosition.current.y + clickDragThreshold ||\n event.clientY < initialPointerPosition.current.y - clickDragThreshold)\n ) {\n didPointerDrag.current = true;\n if (hideButtonsOnDrag) {\n setUncontrolledShowButtons(false);\n }\n }\n },\n { signal: controller.signal }\n );\n\n // Shared behavior when a \"pointerdown\" state ends. This is shared so it\n // can be called for both \"pointercancel\" and \"pointerup\" events.\n const resetPointerDownState = () => {\n isPointerDown.current = false;\n initialPointerPosition.current = undefined;\n };\n\n document.addEventListener(\n 'pointercancel',\n () => {\n resetPointerDownState();\n },\n { signal: controller.signal }\n );\n\n document.addEventListener(\n 'pointerup',\n () => {\n if (isPointerDown.current && !didPointerDrag.current) {\n // The cursor didn't move much between \"pointerdown\" and \"pointerup\".\n // Handle this as a \"click\" instead of a \"drag\".\n setUncontrolledShowButtons(true);\n }\n resetPointerDownState();\n },\n { signal: controller.signal }\n );\n\n return () => controller.abort();\n }, [clickDragThreshold, hideButtonsOnDrag]);\n\n const onHandlePointerDown: React.PointerEventHandler = event => {\n // Tooltip behavior: the tooltip should appear on hover, but disappear when\n // the pointer starts dragging (having the tooltip get in the way while\n // you're trying to drag upwards is annoying). Additionally, the tooltip\n // shouldn't reappear when dragging ends, but only when the pointer leaves\n // the drag handle and comes back.\n\n isPointerDown.current = true;\n didPointerDrag.current = false;\n initialPointerPosition.current = { x: event.clientX, y: event.clientY };\n setShowTooltip(false);\n };\n\n // Tooltip behavior: the tooltip should stay open when the cursor moves\n // from the drag handle into the tooltip content itself. This is why the\n // handler is set on the wrapper for both the drag handle and the tooltip.\n const onTooltipGroupPointerEnter: React.PointerEventHandler = () => {\n if (!isPointerDown.current) {\n setShowTooltip(true);\n }\n };\n const onTooltipGroupPointerLeave: React.PointerEventHandler = () => {\n setShowTooltip(false);\n };\n\n const onDragHandleKeyDown: React.KeyboardEventHandler = event => {\n // For accessibility reasons, pressing escape should always close the floating controls.\n if (event.key === 'Escape') {\n setUncontrolledShowButtons(false);\n } else if (triggerMode === 'keyboard-activate' && (event.key === 'Enter' || event.key === ' ')) {\n // toggle buttons when Enter or space is pressed in 'keyboard-activate' triggerMode\n setUncontrolledShowButtons(prevshowButtons => !prevshowButtons);\n } else if (\n event.key !== 'Alt' &&\n event.key !== 'Control' &&\n event.key !== 'Meta' &&\n event.key !== 'Shift' &&\n triggerMode === 'focus'\n ) {\n // Pressing any other key will display the focus-visible ring around the\n // drag handle if it's in focus, so we should also show the buttons now.\n setUncontrolledShowButtons(true);\n }\n };\n\n const showButtons = triggerMode === 'controlled' ? controlledShowButtons : uncontrolledShowButtons;\n\n return (\n <>\n {/* Wrapper for focus detection. The buttons are shown when any element inside this wrapper is\n focused, either via the keyboard or a pointer press. The UAP buttons will never receive focus. */}\n <div\n className={clsx(testUtilsStyles.root, styles.contents)}\n ref={wrapperRef}\n onFocus={onWrapperFocusIn}\n onBlur={onWrapperFocusOut}\n >\n {/* Wrapper for pointer detection. Determines whether or not the tooltip should be shown. */}\n <div\n className={styles.contents}\n onPointerEnter={onTooltipGroupPointerEnter}\n onPointerLeave={onTooltipGroupPointerLeave}\n >\n {/* Position tracking wrapper used to position the tooltip and drag buttons accurately.\n Its dimensions must match the inner button's dimensions. */}\n <div\n className={clsx(styles['drag-handle'], wrapperClassName)}\n ref={dragHandleRef}\n onPointerDown={onHandlePointerDown}\n onKeyDown={onDragHandleKeyDown}\n >\n {children}\n </div>\n\n {!isDisabled && !showButtons && showTooltip && tooltipText && (\n // Rendered in a portal but pointerenter/pointerleave events still propagate\n // up the React DOM tree, which is why it's placed in this nested context.\n <Tooltip trackRef={dragHandleRef} value={tooltipText} onDismiss={() => setShowTooltip(false)} />\n )}\n </div>\n </div>\n\n <PortalOverlay track={dragHandleRef} isDisabled={!showButtons}>\n {directions['block-start'] && (\n <DirectionButton\n show={!isDisabled && showButtons}\n direction=\"block-start\"\n state={directions['block-start']}\n onClick={() => onDirectionClick?.('block-start')}\n />\n )}\n {directions['block-end'] && (\n <DirectionButton\n show={!isDisabled && showButtons}\n direction=\"block-end\"\n state={directions['block-end']}\n onClick={() => onDirectionClick?.('block-end')}\n />\n )}\n {directions['inline-start'] && (\n <DirectionButton\n show={!isDisabled && showButtons}\n direction=\"inline-start\"\n state={directions['inline-start']}\n onClick={() => onDirectionClick?.('inline-start')}\n />\n )}\n {directions['inline-end'] && (\n <DirectionButton\n show={!isDisabled && showButtons}\n direction=\"inline-end\"\n state={directions['inline-end']}\n onClick={() => onDirectionClick?.('inline-end')}\n />\n )}\n </PortalOverlay>\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAE7F,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,eAAe,MAAM,oBAAoB,CAAC;AAEjD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,OAAO,M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affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { nodeContains } from '@cloudscape-design/component-toolkit/dom';\nimport { getLogicalBoundingClientRect } from '@cloudscape-design/component-toolkit/internal';\n\nimport Tooltip from '../tooltip';\nimport DirectionButton from './direction-button';\nimport { Direction, DragHandleWrapperProps } from './interfaces';\nimport PortalOverlay from './portal-overlay';\n\nimport styles from './styles.css.js';\nimport testUtilsStyles from './test-classes/styles.css.js';\n\n// The UAP buttons are forced to top/bottom position if the handle is close to the screen edge.\nconst FORCED_POSITION_PROXIMITY_PX = 50;\n// Approximate UAP button size with margins to decide forced direction.\nconst UAP_BUTTON_SIZE_PX = 40;\nconst DIRECTIONS_ORDER: Direction[] = ['block-end', 'block-start', 'inline-end', 'inline-start'];\n\nexport default function DragHandleWrapper({\n directions,\n tooltipText,\n children,\n onDirectionClick,\n triggerMode = 'focus',\n initialShowButtons = false,\n controlledShowButtons = false,\n wrapperClassName,\n hideButtonsOnDrag,\n clickDragThreshold,\n}: DragHandleWrapperProps) {\n const wrapperRef = useRef<HTMLDivElement | null>(null);\n const dragHandleRef = useRef<HTMLDivElement | null>(null);\n const [showTooltip, setShowTooltip] = useState(false);\n const [uncontrolledShowButtons, setUncontrolledShowButtons] = useState(initialShowButtons);\n\n const isPointerDown = useRef(false);\n const initialPointerPosition = useRef<{ x: number; y: number } | undefined>();\n const didPointerDrag = useRef(false);\n\n // The tooltip (\"Drag or select to move/resize\") shouldn't show if clicking\n // on the handle wouldn't do anything.\n const isDisabled =\n !directions['block-start'] && !directions['block-end'] && !directions['inline-start'] && !directions['inline-end'];\n\n const onWrapperFocusIn: React.FocusEventHandler = event => {\n // The drag handle is focused when it's either tabbed to, or the pointer\n // is pressed on it. We exclude handling the pointer press in this handler,\n // since it could be the start of a drag event - the pointer stuff is\n // handled in the \"pointerup\" listener instead. In cases where focus is moved\n // to the button (by manually calling `.focus()`), the buttons should only appear\n // if the action that triggered the focus move was the result of a keypress.\n if (document.body.dataset.awsuiFocusVisible && !nodeContains(wrapperRef.current, event.relatedTarget)) {\n setShowTooltip(false);\n if (triggerMode === 'focus') {\n setUncontrolledShowButtons(true);\n }\n }\n };\n\n const onWrapperFocusOut: React.FocusEventHandler = event => {\n // Close the directional buttons when the focus leaves the drag handle.\n // \"focusout\" is also triggered when the user switches to another tab, but\n // since it'll be returned when they switch back anyway, we exclude that\n // case by checking for `document.hasFocus()`.\n if (document.hasFocus() && !nodeContains(wrapperRef.current, event.relatedTarget)) {\n setUncontrolledShowButtons(false);\n }\n };\n\n useEffect(() => {\n const controller = new AbortController();\n\n // We need to differentiate between a \"click\" and a \"drag\" action.\n // We can say a \"click\" happens when a \"pointerdown\" is followed by\n // a \"pointerup\" with no \"pointermove\" between the two.\n // However, it would be a poor usability experience if a \"click\" isn't\n // registered because, while pressing my mouse, I moved it by just one\n // pixel, making it a \"drag\" instead. So we allow the pointer to move by\n // `clickDragThreshold` pixels before setting `didPointerDrag` to true.\n document.addEventListener(\n 'pointermove',\n event => {\n if (\n isPointerDown.current &&\n initialPointerPosition.current &&\n (event.clientX > initialPointerPosition.current.x + clickDragThreshold ||\n event.clientX < initialPointerPosition.current.x - clickDragThreshold ||\n event.clientY > initialPointerPosition.current.y + clickDragThreshold ||\n event.clientY < initialPointerPosition.current.y - clickDragThreshold)\n ) {\n didPointerDrag.current = true;\n if (hideButtonsOnDrag) {\n setUncontrolledShowButtons(false);\n }\n }\n },\n { signal: controller.signal }\n );\n\n // Shared behavior when a \"pointerdown\" state ends. This is shared so it\n // can be called for both \"pointercancel\" and \"pointerup\" events.\n const resetPointerDownState = () => {\n isPointerDown.current = false;\n initialPointerPosition.current = undefined;\n };\n\n document.addEventListener(\n 'pointercancel',\n () => {\n resetPointerDownState();\n },\n { signal: controller.signal }\n );\n\n document.addEventListener(\n 'pointerup',\n () => {\n if (isPointerDown.current && !didPointerDrag.current) {\n // The cursor didn't move much between \"pointerdown\" and \"pointerup\".\n // Handle this as a \"click\" instead of a \"drag\".\n setUncontrolledShowButtons(true);\n }\n resetPointerDownState();\n },\n { signal: controller.signal }\n );\n\n return () => controller.abort();\n }, [clickDragThreshold, hideButtonsOnDrag]);\n\n const onHandlePointerDown: React.PointerEventHandler = event => {\n // Tooltip behavior: the tooltip should appear on hover, but disappear when\n // the pointer starts dragging (having the tooltip get in the way while\n // you're trying to drag upwards is annoying). Additionally, the tooltip\n // shouldn't reappear when dragging ends, but only when the pointer leaves\n // the drag handle and comes back.\n\n isPointerDown.current = true;\n didPointerDrag.current = false;\n initialPointerPosition.current = { x: event.clientX, y: event.clientY };\n setShowTooltip(false);\n };\n\n // Tooltip behavior: the tooltip should stay open when the cursor moves\n // from the drag handle into the tooltip content itself. This is why the\n // handler is set on the wrapper for both the drag handle and the tooltip.\n const onTooltipGroupPointerEnter: React.PointerEventHandler = () => {\n if (!isPointerDown.current) {\n setShowTooltip(true);\n }\n };\n const onTooltipGroupPointerLeave: React.PointerEventHandler = () => {\n setShowTooltip(false);\n };\n\n const onDragHandleKeyDown: React.KeyboardEventHandler = event => {\n // For accessibility reasons, pressing escape should always close the floating controls.\n if (event.key === 'Escape') {\n setUncontrolledShowButtons(false);\n } else if (triggerMode === 'keyboard-activate' && (event.key === 'Enter' || event.key === ' ')) {\n // toggle buttons when Enter or space is pressed in 'keyboard-activate' triggerMode\n setUncontrolledShowButtons(prevShowButtons => !prevShowButtons);\n } else if (\n event.key !== 'Alt' &&\n event.key !== 'Control' &&\n event.key !== 'Meta' &&\n event.key !== 'Shift' &&\n triggerMode === 'focus'\n ) {\n // Pressing any other key will display the focus-visible ring around the\n // drag handle if it's in focus, so we should also show the buttons now.\n setUncontrolledShowButtons(true);\n }\n };\n\n const showButtons = triggerMode === 'controlled' ? controlledShowButtons : uncontrolledShowButtons;\n\n const [forcedPosition, setForcedPosition] = useState<null | 'top' | 'bottom'>(null);\n const directionsOrder = forcedPosition === 'bottom' ? [...DIRECTIONS_ORDER].reverse() : DIRECTIONS_ORDER;\n const visibleDirections = directionsOrder.filter(dir => directions[dir]);\n\n useLayoutEffect(() => {\n if (showButtons && dragHandleRef.current) {\n const rect = getLogicalBoundingClientRect(dragHandleRef.current);\n const conflicts = {\n 'block-start': rect.insetBlockStart < FORCED_POSITION_PROXIMITY_PX,\n 'block-end': window.innerHeight - rect.insetBlockEnd < FORCED_POSITION_PROXIMITY_PX,\n 'inline-start': rect.insetInlineStart < FORCED_POSITION_PROXIMITY_PX,\n 'inline-end': window.innerWidth - rect.insetInlineEnd < FORCED_POSITION_PROXIMITY_PX,\n };\n if (visibleDirections.some(direction => conflicts[direction])) {\n const hasEnoughSpaceAbove = rect.insetBlockStart > visibleDirections.length * UAP_BUTTON_SIZE_PX;\n setForcedPosition(hasEnoughSpaceAbove ? 'top' : 'bottom');\n } else {\n setForcedPosition(null);\n }\n }\n }, [showButtons, visibleDirections]);\n\n return (\n <>\n {/* Wrapper for focus detection. The buttons are shown when any element inside this wrapper is\n focused, either via the keyboard or a pointer press. The UAP buttons will never receive focus. */}\n <div\n className={clsx(testUtilsStyles.root, styles.contents)}\n ref={wrapperRef}\n onFocus={onWrapperFocusIn}\n onBlur={onWrapperFocusOut}\n >\n {/* Wrapper for pointer detection. Determines whether or not the tooltip should be shown. */}\n <div\n className={styles.contents}\n onPointerEnter={onTooltipGroupPointerEnter}\n onPointerLeave={onTooltipGroupPointerLeave}\n >\n {/* Position tracking wrapper used to position the tooltip and drag buttons accurately.\n Its dimensions must match the inner button's dimensions. */}\n <div\n className={clsx(styles['drag-handle'], wrapperClassName)}\n ref={dragHandleRef}\n onPointerDown={onHandlePointerDown}\n onKeyDown={onDragHandleKeyDown}\n >\n {children}\n </div>\n\n {!isDisabled && !showButtons && showTooltip && tooltipText && (\n // Rendered in a portal but pointerenter/pointerleave events still propagate\n // up the React DOM tree, which is why it's placed in this nested context.\n <Tooltip trackRef={dragHandleRef} value={tooltipText} onDismiss={() => setShowTooltip(false)} />\n )}\n </div>\n </div>\n\n <PortalOverlay track={dragHandleRef} isDisabled={!showButtons}>\n {visibleDirections.map(\n (direction, index) =>\n directions[direction] && (\n <DirectionButton\n key={direction}\n show={!isDisabled && showButtons}\n direction={direction}\n state={directions[direction]}\n onClick={() => onDirectionClick?.(direction)}\n forcedPosition={forcedPosition}\n forcedIndex={index}\n />\n )\n )}\n </PortalOverlay>\n </>\n );\n}\n"]}
|
|
@@ -1,26 +1,35 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"direction-button-wrapper": "awsui_direction-button-
|
|
5
|
-
"direction-button-wrapper-motion-enter": "awsui_direction-button-wrapper-motion-
|
|
6
|
-
"direction-button-wrapper-motion-entering": "awsui_direction-button-wrapper-motion-
|
|
7
|
-
"direction-button-wrapper-motion-exit": "awsui_direction-button-wrapper-motion-
|
|
8
|
-
"direction-button-wrapper-motion-exiting": "awsui_direction-button-wrapper-motion-
|
|
9
|
-
"drag-handle-entry": "awsui_drag-handle-
|
|
10
|
-
"awsui-motion-fade-in": "awsui_awsui-motion-fade-
|
|
11
|
-
"drag-handle-exit": "awsui_drag-handle-
|
|
12
|
-
"awsui-motion-fade-out-0": "awsui_awsui-motion-fade-out-
|
|
13
|
-
"direction-button-wrapper-block-start": "awsui_direction-button-wrapper-block-
|
|
14
|
-
"direction-button-wrapper-block-end": "awsui_direction-button-wrapper-block-
|
|
15
|
-
"direction-button-wrapper-inline-start": "awsui_direction-button-wrapper-inline-
|
|
16
|
-
"direction-button-wrapper-inline-end": "awsui_direction-button-wrapper-inline-
|
|
17
|
-
"contents": "
|
|
18
|
-
"portal-overlay": "awsui_portal-
|
|
19
|
-
"portal-overlay-disabled": "awsui_portal-overlay-
|
|
20
|
-
"portal-overlay-contents": "awsui_portal-overlay-
|
|
21
|
-
"drag-handle": "awsui_drag-
|
|
22
|
-
"direction-button-wrapper-hidden": "awsui_direction-button-wrapper-
|
|
23
|
-
"direction-button": "awsui_direction-
|
|
24
|
-
"direction-button-
|
|
4
|
+
"direction-button-wrapper": "awsui_direction-button-wrapper_155yk_1u2kp_169",
|
|
5
|
+
"direction-button-wrapper-motion-enter": "awsui_direction-button-wrapper-motion-enter_155yk_1u2kp_189",
|
|
6
|
+
"direction-button-wrapper-motion-entering": "awsui_direction-button-wrapper-motion-entering_155yk_1u2kp_189",
|
|
7
|
+
"direction-button-wrapper-motion-exit": "awsui_direction-button-wrapper-motion-exit_155yk_1u2kp_189",
|
|
8
|
+
"direction-button-wrapper-motion-exiting": "awsui_direction-button-wrapper-motion-exiting_155yk_1u2kp_189",
|
|
9
|
+
"drag-handle-entry": "awsui_drag-handle-entry_155yk_1u2kp_1",
|
|
10
|
+
"awsui-motion-fade-in": "awsui_awsui-motion-fade-in_155yk_1u2kp_1",
|
|
11
|
+
"drag-handle-exit": "awsui_drag-handle-exit_155yk_1u2kp_1",
|
|
12
|
+
"awsui-motion-fade-out-0": "awsui_awsui-motion-fade-out-0_155yk_1u2kp_1",
|
|
13
|
+
"direction-button-wrapper-block-start": "awsui_direction-button-wrapper-block-start_155yk_1u2kp_229",
|
|
14
|
+
"direction-button-wrapper-block-end": "awsui_direction-button-wrapper-block-end_155yk_1u2kp_233",
|
|
15
|
+
"direction-button-wrapper-inline-start": "awsui_direction-button-wrapper-inline-start_155yk_1u2kp_237",
|
|
16
|
+
"direction-button-wrapper-inline-end": "awsui_direction-button-wrapper-inline-end_155yk_1u2kp_248",
|
|
17
|
+
"contents": "awsui_contents_155yk_1u2kp_259",
|
|
18
|
+
"portal-overlay": "awsui_portal-overlay_155yk_1u2kp_263",
|
|
19
|
+
"portal-overlay-disabled": "awsui_portal-overlay-disabled_155yk_1u2kp_271",
|
|
20
|
+
"portal-overlay-contents": "awsui_portal-overlay-contents_155yk_1u2kp_275",
|
|
21
|
+
"drag-handle": "awsui_drag-handle_155yk_1u2kp_279",
|
|
22
|
+
"direction-button-wrapper-hidden": "awsui_direction-button-wrapper-hidden_155yk_1u2kp_292",
|
|
23
|
+
"direction-button-wrapper-forced": "awsui_direction-button-wrapper-forced_155yk_1u2kp_316",
|
|
24
|
+
"direction-button-wrapper-forced-top-0": "awsui_direction-button-wrapper-forced-top-0_155yk_1u2kp_320",
|
|
25
|
+
"direction-button-wrapper-forced-top-1": "awsui_direction-button-wrapper-forced-top-1_155yk_1u2kp_324",
|
|
26
|
+
"direction-button-wrapper-forced-top-2": "awsui_direction-button-wrapper-forced-top-2_155yk_1u2kp_328",
|
|
27
|
+
"direction-button-wrapper-forced-top-3": "awsui_direction-button-wrapper-forced-top-3_155yk_1u2kp_332",
|
|
28
|
+
"direction-button-wrapper-forced-bottom-0": "awsui_direction-button-wrapper-forced-bottom-0_155yk_1u2kp_336",
|
|
29
|
+
"direction-button-wrapper-forced-bottom-1": "awsui_direction-button-wrapper-forced-bottom-1_155yk_1u2kp_340",
|
|
30
|
+
"direction-button-wrapper-forced-bottom-2": "awsui_direction-button-wrapper-forced-bottom-2_155yk_1u2kp_344",
|
|
31
|
+
"direction-button-wrapper-forced-bottom-3": "awsui_direction-button-wrapper-forced-bottom-3_155yk_1u2kp_348",
|
|
32
|
+
"direction-button": "awsui_direction-button_155yk_1u2kp_169",
|
|
33
|
+
"direction-button-disabled": "awsui_direction-button-disabled_155yk_1u2kp_371"
|
|
25
34
|
};
|
|
26
35
|
|
|
@@ -150,7 +150,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
150
150
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
151
151
|
SPDX-License-Identifier: Apache-2.0
|
|
152
152
|
*/
|
|
153
|
-
@keyframes awsui_drag-handle-
|
|
153
|
+
@keyframes awsui_drag-handle-entry_155yk_1u2kp_1 {
|
|
154
154
|
from {
|
|
155
155
|
transform: translate(var(--awsui-drag-handle-animation-inline-offset-rhu47t), var(--awsui-drag-handle-animation-block-offset-rhu47t));
|
|
156
156
|
}
|
|
@@ -158,7 +158,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
158
158
|
transform: translate(0, 0);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
@keyframes awsui_drag-handle-
|
|
161
|
+
@keyframes awsui_drag-handle-exit_155yk_1u2kp_1 {
|
|
162
162
|
from {
|
|
163
163
|
transform: translate(0, 0);
|
|
164
164
|
}
|
|
@@ -166,11 +166,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
166
166
|
transform: translate(var(--awsui-drag-handle-animation-inline-offset-rhu47t), var(--awsui-drag-handle-animation-block-offset-rhu47t));
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
.awsui_direction-button-
|
|
169
|
+
.awsui_direction-button-wrapper_155yk_1u2kp_169:not(#\9) {
|
|
170
170
|
--awsui-drag-handle-animation-inline-offset-rhu47t: 0;
|
|
171
171
|
--awsui-drag-handle-animation-block-offset-rhu47t: 0;
|
|
172
172
|
}
|
|
173
|
-
@keyframes awsui_awsui-motion-fade-
|
|
173
|
+
@keyframes awsui_awsui-motion-fade-in_155yk_1u2kp_1 {
|
|
174
174
|
from {
|
|
175
175
|
opacity: 0.2;
|
|
176
176
|
}
|
|
@@ -178,7 +178,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
178
178
|
opacity: 1;
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
@keyframes awsui_awsui-motion-fade-out-
|
|
181
|
+
@keyframes awsui_awsui-motion-fade-out-0_155yk_1u2kp_1 {
|
|
182
182
|
from {
|
|
183
183
|
opacity: 1;
|
|
184
184
|
}
|
|
@@ -186,81 +186,81 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
186
186
|
opacity: 0;
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
.awsui_direction-button-wrapper-motion-
|
|
189
|
+
.awsui_direction-button-wrapper-motion-enter_155yk_1u2kp_189:not(#\9), .awsui_direction-button-wrapper-motion-entering_155yk_1u2kp_189:not(#\9), .awsui_direction-button-wrapper-motion-exit_155yk_1u2kp_189:not(#\9), .awsui_direction-button-wrapper-motion-exiting_155yk_1u2kp_189:not(#\9) {
|
|
190
190
|
pointer-events: none;
|
|
191
191
|
}
|
|
192
|
-
.awsui_direction-button-wrapper-motion-
|
|
193
|
-
animation: awsui_drag-handle-
|
|
192
|
+
.awsui_direction-button-wrapper-motion-entering_155yk_1u2kp_189:not(#\9) {
|
|
193
|
+
animation: awsui_drag-handle-entry_155yk_1u2kp_1 var(--motion-duration-complex-hv88cf, 270ms) var(--motion-easing-responsive-dxkfpl, ease-out), awsui_awsui-motion-fade-in_155yk_1u2kp_1 var(--motion-duration-complex-hv88cf, 270ms) var(--motion-easing-responsive-dxkfpl, ease-out);
|
|
194
194
|
}
|
|
195
195
|
@media (prefers-reduced-motion: reduce) {
|
|
196
|
-
.awsui_direction-button-wrapper-motion-
|
|
196
|
+
.awsui_direction-button-wrapper-motion-entering_155yk_1u2kp_189:not(#\9) {
|
|
197
197
|
animation: none;
|
|
198
198
|
transition: none;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
.awsui-motion-disabled .awsui_direction-button-wrapper-motion-
|
|
201
|
+
.awsui-motion-disabled .awsui_direction-button-wrapper-motion-entering_155yk_1u2kp_189:not(#\9), .awsui-mode-entering .awsui_direction-button-wrapper-motion-entering_155yk_1u2kp_189:not(#\9) {
|
|
202
202
|
animation: none;
|
|
203
203
|
transition: none;
|
|
204
204
|
}
|
|
205
|
-
.awsui_direction-button-wrapper-motion-
|
|
206
|
-
animation: awsui_drag-handle-
|
|
205
|
+
.awsui_direction-button-wrapper-motion-exiting_155yk_1u2kp_189:not(#\9) {
|
|
206
|
+
animation: awsui_drag-handle-exit_155yk_1u2kp_1 var(--motion-duration-complex-hv88cf, 270ms) var(--motion-easing-responsive-dxkfpl, ease-out) forwards, awsui_awsui-motion-fade-out-0_155yk_1u2kp_1 var(--motion-duration-complex-hv88cf, 270ms) var(--motion-easing-responsive-dxkfpl, ease-out) forwards;
|
|
207
207
|
}
|
|
208
208
|
@media (prefers-reduced-motion: reduce) {
|
|
209
|
-
.awsui_direction-button-wrapper-motion-
|
|
209
|
+
.awsui_direction-button-wrapper-motion-exiting_155yk_1u2kp_189:not(#\9) {
|
|
210
210
|
animation: none;
|
|
211
211
|
transition: none;
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
.awsui-motion-disabled .awsui_direction-button-wrapper-motion-
|
|
214
|
+
.awsui-motion-disabled .awsui_direction-button-wrapper-motion-exiting_155yk_1u2kp_189:not(#\9), .awsui-mode-entering .awsui_direction-button-wrapper-motion-exiting_155yk_1u2kp_189:not(#\9) {
|
|
215
215
|
animation: none;
|
|
216
216
|
transition: none;
|
|
217
217
|
}
|
|
218
218
|
@media (prefers-reduced-motion: reduce) {
|
|
219
|
-
.awsui_direction-button-
|
|
219
|
+
.awsui_direction-button-wrapper_155yk_1u2kp_169:not(#\9) {
|
|
220
220
|
animation: none;
|
|
221
221
|
transition: none;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
.awsui-motion-disabled .awsui_direction-button-
|
|
224
|
+
.awsui-motion-disabled .awsui_direction-button-wrapper_155yk_1u2kp_169:not(#\9), .awsui-mode-entering .awsui_direction-button-wrapper_155yk_1u2kp_169:not(#\9) {
|
|
225
225
|
animation: none;
|
|
226
226
|
transition: none;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
.awsui_direction-button-wrapper-block-
|
|
229
|
+
.awsui_direction-button-wrapper-block-start_155yk_1u2kp_229:not(#\9) {
|
|
230
230
|
--awsui-drag-handle-animation-block-offset-rhu47t: 20px;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
.awsui_direction-button-wrapper-block-
|
|
233
|
+
.awsui_direction-button-wrapper-block-end_155yk_1u2kp_233:not(#\9) {
|
|
234
234
|
--awsui-drag-handle-animation-block-offset-rhu47t: -20px;
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
.awsui_direction-button-wrapper-inline-
|
|
237
|
+
.awsui_direction-button-wrapper-inline-start_155yk_1u2kp_237:not(#\9) {
|
|
238
238
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
239
239
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
240
240
|
}
|
|
241
|
-
.awsui_direction-button-wrapper-inline-
|
|
241
|
+
.awsui_direction-button-wrapper-inline-start_155yk_1u2kp_237:not(#\9):dir(ltr) {
|
|
242
242
|
--awsui-drag-handle-animation-inline-offset-rhu47t: 20px;
|
|
243
243
|
}
|
|
244
|
-
.awsui_direction-button-wrapper-inline-
|
|
244
|
+
.awsui_direction-button-wrapper-inline-start_155yk_1u2kp_237:not(#\9):dir(rtl) {
|
|
245
245
|
--awsui-drag-handle-animation-inline-offset-rhu47t: -20px;
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
.awsui_direction-button-wrapper-inline-
|
|
248
|
+
.awsui_direction-button-wrapper-inline-end_155yk_1u2kp_248:not(#\9) {
|
|
249
249
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
250
250
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
251
251
|
}
|
|
252
|
-
.awsui_direction-button-wrapper-inline-
|
|
252
|
+
.awsui_direction-button-wrapper-inline-end_155yk_1u2kp_248:not(#\9):dir(ltr) {
|
|
253
253
|
--awsui-drag-handle-animation-inline-offset-rhu47t: -20px;
|
|
254
254
|
}
|
|
255
|
-
.awsui_direction-button-wrapper-inline-
|
|
255
|
+
.awsui_direction-button-wrapper-inline-end_155yk_1u2kp_248:not(#\9):dir(rtl) {
|
|
256
256
|
--awsui-drag-handle-animation-inline-offset-rhu47t: 20px;
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
.
|
|
259
|
+
.awsui_contents_155yk_1u2kp_259:not(#\9) {
|
|
260
260
|
display: contents;
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
.awsui_portal-
|
|
263
|
+
.awsui_portal-overlay_155yk_1u2kp_263:not(#\9) {
|
|
264
264
|
position: absolute;
|
|
265
265
|
inset-block-start: 0;
|
|
266
266
|
inset-inline-start: 0;
|
|
@@ -268,20 +268,20 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
268
268
|
z-index: 7000;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
.awsui_portal-overlay-
|
|
271
|
+
.awsui_portal-overlay-disabled_155yk_1u2kp_271:not(#\9) {
|
|
272
272
|
display: none;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
.awsui_portal-overlay-
|
|
275
|
+
.awsui_portal-overlay-contents_155yk_1u2kp_275:not(#\9) {
|
|
276
276
|
pointer-events: auto;
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
.awsui_drag-
|
|
279
|
+
.awsui_drag-handle_155yk_1u2kp_279:not(#\9) {
|
|
280
280
|
position: relative;
|
|
281
281
|
display: inline-flex;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
.awsui_direction-button-
|
|
284
|
+
.awsui_direction-button-wrapper_155yk_1u2kp_169:not(#\9) {
|
|
285
285
|
position: absolute;
|
|
286
286
|
block-size: var(--space-static-xl-pek4x1, 24px);
|
|
287
287
|
inline-size: var(--space-static-xl-pek4x1, 24px);
|
|
@@ -289,31 +289,67 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
289
289
|
padding-inline: var(--space-static-xxs-0cgyf1, 4px);
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
.awsui_direction-button-wrapper-
|
|
292
|
+
.awsui_direction-button-wrapper-hidden_155yk_1u2kp_292:not(#\9) {
|
|
293
293
|
display: none;
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
.awsui_direction-button-wrapper-block-
|
|
296
|
+
.awsui_direction-button-wrapper-block-start_155yk_1u2kp_229:not(#\9) {
|
|
297
297
|
inset-block-start: calc(-1 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
298
298
|
inset-inline-start: calc(50% - (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)) / 2);
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
.awsui_direction-button-wrapper-block-
|
|
301
|
+
.awsui_direction-button-wrapper-block-end_155yk_1u2kp_233:not(#\9) {
|
|
302
302
|
inset-block-end: calc(-1 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
303
303
|
inset-inline-start: calc(50% - (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)) / 2);
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
.awsui_direction-button-wrapper-inline-
|
|
306
|
+
.awsui_direction-button-wrapper-inline-start_155yk_1u2kp_237:not(#\9) {
|
|
307
307
|
inset-inline-start: calc(-1 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
308
308
|
inset-block-start: calc(50% - (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)) / 2);
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
.awsui_direction-button-wrapper-inline-
|
|
311
|
+
.awsui_direction-button-wrapper-inline-end_155yk_1u2kp_248:not(#\9) {
|
|
312
312
|
inset-inline-end: calc(-1 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
313
313
|
inset-block-start: calc(50% - (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)) / 2);
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
.awsui_direction-
|
|
316
|
+
.awsui_direction-button-wrapper-forced_155yk_1u2kp_316:not(#\9) {
|
|
317
|
+
inset-inline-start: calc(50% - (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)) / 2);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.awsui_direction-button-wrapper-forced-top-0_155yk_1u2kp_320:not(#\9) {
|
|
321
|
+
inset-block-start: calc(-1 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.awsui_direction-button-wrapper-forced-top-1_155yk_1u2kp_324:not(#\9) {
|
|
325
|
+
inset-block-start: calc(-2 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.awsui_direction-button-wrapper-forced-top-2_155yk_1u2kp_328:not(#\9) {
|
|
329
|
+
inset-block-start: calc(-3 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.awsui_direction-button-wrapper-forced-top-3_155yk_1u2kp_332:not(#\9) {
|
|
333
|
+
inset-block-start: calc(-4 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.awsui_direction-button-wrapper-forced-bottom-0_155yk_1u2kp_336:not(#\9) {
|
|
337
|
+
inset-block-start: calc(1 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)) - 50%);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.awsui_direction-button-wrapper-forced-bottom-1_155yk_1u2kp_340:not(#\9) {
|
|
341
|
+
inset-block-start: calc(2 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)) - 50%);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.awsui_direction-button-wrapper-forced-bottom-2_155yk_1u2kp_344:not(#\9) {
|
|
345
|
+
inset-block-start: calc(3 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)) - 50%);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.awsui_direction-button-wrapper-forced-bottom-3_155yk_1u2kp_348:not(#\9) {
|
|
349
|
+
inset-block-start: calc(4 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)) - 50%);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.awsui_direction-button_155yk_1u2kp_169:not(#\9) {
|
|
317
353
|
position: absolute;
|
|
318
354
|
border-width: 0;
|
|
319
355
|
cursor: pointer;
|
|
@@ -332,14 +368,14 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
332
368
|
color: var(--color-text-direction-button-default-dkices, #ffffff);
|
|
333
369
|
box-shadow: var(--shadow-dropdown-skxpuu, 0 1px 1px 0 rgba(0, 28, 36, 0.3), 1px 1px 1px 0 rgba(0, 28, 36, 0.15), -1px 1px 1px 0 rgba(0, 28, 36, 0.15));
|
|
334
370
|
}
|
|
335
|
-
.awsui_direction-
|
|
371
|
+
.awsui_direction-button_155yk_1u2kp_169:not(#\9):not(.awsui_direction-button-disabled_155yk_1u2kp_371):hover {
|
|
336
372
|
background-color: var(--color-background-direction-button-hover-v5bxfc, #414750);
|
|
337
373
|
}
|
|
338
|
-
.awsui_direction-
|
|
374
|
+
.awsui_direction-button_155yk_1u2kp_169:not(#\9):not(.awsui_direction-button-disabled_155yk_1u2kp_371):active {
|
|
339
375
|
background-color: var(--color-background-direction-button-active-wn6s2j, #2a2e33);
|
|
340
376
|
}
|
|
341
377
|
|
|
342
|
-
.awsui_direction-button-
|
|
378
|
+
.awsui_direction-button-disabled_155yk_1u2kp_371:not(#\9) {
|
|
343
379
|
cursor: default;
|
|
344
380
|
background-color: var(--color-background-direction-button-disabled-rcznmi, #eaeded);
|
|
345
381
|
color: var(--color-text-direction-button-disabled-596cgx, #aab7b8);
|