@cloudscape-design/board-components 3.0.111 → 3.0.112
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/board-item/interfaces.d.ts +4 -0
- package/board-item/interfaces.js.map +1 -1
- package/board-item/internal.d.ts +1 -1
- package/board-item/internal.js +18 -2
- package/board-item/internal.js.map +1 -1
- package/board-item/styles.css.js +11 -11
- package/board-item/styles.scoped.css +12 -14
- package/board-item/styles.selectors.js +11 -11
- package/internal/api-docs/components/board-item.js +11 -1
- package/internal/drag-handle/index.d.ts +7 -2
- package/internal/drag-handle/index.js +10 -4
- package/internal/drag-handle/index.js.map +1 -1
- package/internal/drag-handle/styles.css.js +2 -2
- package/internal/drag-handle/styles.scoped.css +13 -22
- package/internal/drag-handle/styles.selectors.js +2 -2
- package/internal/{handle → drag-handle/test-classes}/styles.css.js +1 -1
- package/internal/drag-handle/test-classes/styles.scoped.css +7 -0
- package/internal/{handle → drag-handle/test-classes}/styles.selectors.js +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/global-drag-state-styles/index.js +8 -3
- package/internal/global-drag-state-styles/index.js.map +1 -1
- package/internal/item-container/index.d.ts +67 -5
- package/internal/item-container/index.js +147 -118
- package/internal/item-container/index.js.map +1 -1
- package/internal/item-container/utils.d.ts +37 -0
- package/internal/item-container/utils.js +63 -0
- package/internal/item-container/utils.js.map +1 -0
- package/internal/manifest.json +1 -1
- package/internal/resize-handle/index.d.ts +6 -2
- package/internal/resize-handle/index.js +10 -4
- package/internal/resize-handle/index.js.map +1 -1
- package/internal/resize-handle/styles.css.js +2 -2
- package/internal/resize-handle/styles.scoped.css +13 -22
- package/internal/resize-handle/styles.selectors.js +2 -2
- package/internal/resize-handle/test-classes/styles.css.js +6 -0
- package/internal/resize-handle/test-classes/styles.scoped.css +7 -0
- package/internal/resize-handle/test-classes/styles.selectors.js +7 -0
- package/package.json +1 -1
- package/internal/handle/index.d.ts +0 -3
- package/internal/handle/index.js +0 -18
- package/internal/handle/index.js.map +0 -1
- package/internal/handle/styles.scoped.css +0 -15
|
@@ -29,6 +29,8 @@ export interface BoardItemProps {
|
|
|
29
29
|
* * `dragHandleAriaDescription` (string, optional) - the ARIA description for the drag handle.
|
|
30
30
|
* * `resizeHandleAriaLabel` (string) - the ARIA label for the resize handle.
|
|
31
31
|
* * `resizeHandleAriaDescription` (string, optional) - the ARIA description for the resize handle.
|
|
32
|
+
* * `dragHandleTooltipText` (string, optional) - the ARIA description for the resize handle.
|
|
33
|
+
* * `resizeHandleTooltipText` (string, optional) - the Text for the resize handle Tooltip.
|
|
32
34
|
*/
|
|
33
35
|
i18nStrings: BoardItemProps.I18nStrings;
|
|
34
36
|
}
|
|
@@ -38,5 +40,7 @@ export declare namespace BoardItemProps {
|
|
|
38
40
|
dragHandleAriaDescription?: string;
|
|
39
41
|
resizeHandleAriaLabel: string;
|
|
40
42
|
resizeHandleAriaDescription?: string;
|
|
43
|
+
dragHandleTooltipText?: string;
|
|
44
|
+
resizeHandleTooltipText?: string;
|
|
41
45
|
}
|
|
42
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/board-item/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ReactNode } from \"react\";\n\nexport interface BoardItemProps {\n /**\n * Heading element of the item. Use the [header component](/components/header/).\n */\n header?: ReactNode;\n\n /**\n * Main content of the item.\n */\n children?: ReactNode;\n\n /**\n * Determines whether the main content of the item has padding. If `true`, removes the default padding\n * from the content area.\n */\n disableContentPaddings?: boolean;\n\n /**\n * Footer of the item.\n */\n footer?: ReactNode;\n\n /**\n * Additional slot next to the heading. Use it to render an overflow actions menu in the form of a button dropdown.\n */\n settings?: ReactNode;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n *\n * ARIA labels:\n * * `dragHandleAriaLabel` (string) - the ARIA label for the drag handle.\n * * `dragHandleAriaDescription` (string, optional) - the ARIA description for the drag handle.\n * * `resizeHandleAriaLabel` (string) - the ARIA label for the resize handle.\n * * `resizeHandleAriaDescription` (string, optional) - the ARIA description for the resize handle.\n */\n i18nStrings: BoardItemProps.I18nStrings;\n}\n\nexport namespace BoardItemProps {\n export interface I18nStrings {\n dragHandleAriaLabel: string;\n dragHandleAriaDescription?: string;\n resizeHandleAriaLabel: string;\n resizeHandleAriaDescription?: string;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/board-item/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ReactNode } from \"react\";\n\nexport interface BoardItemProps {\n /**\n * Heading element of the item. Use the [header component](/components/header/).\n */\n header?: ReactNode;\n\n /**\n * Main content of the item.\n */\n children?: ReactNode;\n\n /**\n * Determines whether the main content of the item has padding. If `true`, removes the default padding\n * from the content area.\n */\n disableContentPaddings?: boolean;\n\n /**\n * Footer of the item.\n */\n footer?: ReactNode;\n\n /**\n * Additional slot next to the heading. Use it to render an overflow actions menu in the form of a button dropdown.\n */\n settings?: ReactNode;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n *\n * ARIA labels:\n * * `dragHandleAriaLabel` (string) - the ARIA label for the drag handle.\n * * `dragHandleAriaDescription` (string, optional) - the ARIA description for the drag handle.\n * * `resizeHandleAriaLabel` (string) - the ARIA label for the resize handle.\n * * `resizeHandleAriaDescription` (string, optional) - the ARIA description for the resize handle.\n * * `dragHandleTooltipText` (string, optional) - the ARIA description for the resize handle.\n * * `resizeHandleTooltipText` (string, optional) - the Text for the resize handle Tooltip.\n */\n i18nStrings: BoardItemProps.I18nStrings;\n}\n\nexport namespace BoardItemProps {\n export interface I18nStrings {\n dragHandleAriaLabel: string;\n dragHandleAriaDescription?: string;\n resizeHandleAriaLabel: string;\n resizeHandleAriaDescription?: string;\n dragHandleTooltipText?: string;\n resizeHandleTooltipText?: string;\n }\n}\n"]}
|
package/board-item/internal.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { InternalBaseComponentProps } from "../internal/base-component/use-base-component";
|
|
2
2
|
import type { BoardItemProps } from "./interfaces";
|
|
3
|
-
export declare function InternalBoardItem({ children, header, settings, disableContentPaddings, footer, i18nStrings, __internalRootRef, ...rest }: BoardItemProps & InternalBaseComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function InternalBoardItem({ children, header, settings, disableContentPaddings, footer, i18nStrings, __internalRootRef, ...rest }: BoardItemProps & InternalBaseComponentProps): import("react/jsx-runtime").JSX.Element | null;
|
package/board-item/internal.js
CHANGED
|
@@ -11,12 +11,28 @@ import ResizeHandle from "../internal/resize-handle";
|
|
|
11
11
|
import ScreenreaderOnly from "../internal/screenreader-only";
|
|
12
12
|
import WidgetContainerHeader from "./header";
|
|
13
13
|
import styles from "./styles.css.js";
|
|
14
|
+
const mapToKeyboardDirection = (direction) => {
|
|
15
|
+
const directionMap = {
|
|
16
|
+
"inline-start": "left",
|
|
17
|
+
"inline-end": "right",
|
|
18
|
+
"block-start": "up",
|
|
19
|
+
"block-end": "down",
|
|
20
|
+
};
|
|
21
|
+
return directionMap[direction];
|
|
22
|
+
};
|
|
14
23
|
export function InternalBoardItem({ children, header, settings, disableContentPaddings, footer, i18nStrings, __internalRootRef, ...rest }) {
|
|
15
|
-
const { dragHandle, resizeHandle, isActive } = useItemContext();
|
|
24
|
+
const { dragHandle, resizeHandle, isActive, isHidden } = useItemContext();
|
|
16
25
|
const dragHandleAriaLabelledBy = useId();
|
|
17
26
|
const dragHandleAriaDescribedBy = useId();
|
|
18
27
|
const resizeHandleAriaLabelledBy = useId();
|
|
19
28
|
const resizeHandleAriaDescribedBy = useId();
|
|
20
|
-
|
|
29
|
+
// A board item is hidden while moving a board item from the palette to the board via keyboard or UAP.
|
|
30
|
+
// The wrapping container is set to invisible, so we don't need to render anything.
|
|
31
|
+
if (isHidden) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return (_jsxs("div", { ref: __internalRootRef, className: styles.root, ...getDataAttributes(rest), children: [_jsx(Container, { fitHeight: true, disableHeaderPaddings: true, header: _jsx(WidgetContainerHeader, { handle: _jsx(DragHandle, { ref: dragHandle.ref, ariaLabelledBy: dragHandleAriaLabelledBy, ariaDescribedBy: dragHandleAriaDescribedBy, onPointerDown: dragHandle.onPointerDown, onKeyDown: dragHandle.onKeyDown, activeState: dragHandle.activeState, initialShowButtons: dragHandle.initialShowButtons, onDirectionClick: (direction) => dragHandle.onDirectionClick(mapToKeyboardDirection(direction), "drag"), dragHandleTooltipText: i18nStrings.dragHandleTooltipText }), settings: settings, children: header }), footer: footer, disableContentPaddings: disableContentPaddings, className: clsx(styles["container-override"], isActive && styles.active), children: children }), resizeHandle && (_jsx("div", { className: styles.resizer, children: _jsx(ResizeHandle, { ariaLabelledBy: resizeHandleAriaLabelledBy, ariaDescribedBy: resizeHandleAriaDescribedBy, onPointerDown: resizeHandle.onPointerDown, onKeyDown: resizeHandle.onKeyDown, activeState: resizeHandle.activeState, onDirectionClick: (direction) => {
|
|
35
|
+
resizeHandle.onDirectionClick(mapToKeyboardDirection(direction), "resize");
|
|
36
|
+
}, resizeHandleTooltipText: i18nStrings.resizeHandleTooltipText }) })), _jsx(ScreenreaderOnly, { id: dragHandleAriaLabelledBy, children: i18nStrings.dragHandleAriaLabel }), _jsx(ScreenreaderOnly, { id: dragHandleAriaDescribedBy, children: i18nStrings.dragHandleAriaDescription }), _jsx(ScreenreaderOnly, { id: resizeHandleAriaLabelledBy, children: i18nStrings.resizeHandleAriaLabel }), _jsx(ScreenreaderOnly, { id: resizeHandleAriaDescribedBy, children: i18nStrings.resizeHandleAriaDescription })] }));
|
|
21
37
|
}
|
|
22
38
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/board-item/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,SAAS,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/board-item/internal.tsx"],"names":[],"mappings":"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","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useId } from \"react\";\nimport clsx from \"clsx\";\n\nimport Container from \"@cloudscape-design/components/container\";\nimport { InternalDragHandleProps } from \"@cloudscape-design/components/internal/do-not-use/drag-handle\";\n\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport { InternalBaseComponentProps } from \"../internal/base-component/use-base-component\";\nimport DragHandle from \"../internal/drag-handle\";\nimport { Direction } from \"../internal/interfaces\";\nimport { useItemContext } from \"../internal/item-container\";\nimport ResizeHandle from \"../internal/resize-handle\";\nimport ScreenreaderOnly from \"../internal/screenreader-only\";\nimport WidgetContainerHeader from \"./header\";\nimport type { BoardItemProps } from \"./interfaces\";\n\nimport styles from \"./styles.css.js\";\n\nconst mapToKeyboardDirection = (direction: InternalDragHandleProps.Direction) => {\n const directionMap: Record<InternalDragHandleProps.Direction, Direction> = {\n \"inline-start\": \"left\",\n \"inline-end\": \"right\",\n \"block-start\": \"up\",\n \"block-end\": \"down\",\n };\n return directionMap[direction];\n};\n\nexport function InternalBoardItem({\n children,\n header,\n settings,\n disableContentPaddings,\n footer,\n i18nStrings,\n __internalRootRef,\n ...rest\n}: BoardItemProps & InternalBaseComponentProps) {\n const { dragHandle, resizeHandle, isActive, isHidden } = useItemContext();\n\n const dragHandleAriaLabelledBy = useId();\n const dragHandleAriaDescribedBy = useId();\n\n const resizeHandleAriaLabelledBy = useId();\n const resizeHandleAriaDescribedBy = useId();\n\n // A board item is hidden while moving a board item from the palette to the board via keyboard or UAP.\n // The wrapping container is set to invisible, so we don't need to render anything.\n if (isHidden) {\n return null;\n }\n\n return (\n <div ref={__internalRootRef} className={styles.root} {...getDataAttributes(rest)}>\n <Container\n fitHeight={true}\n disableHeaderPaddings={true}\n header={\n <WidgetContainerHeader\n handle={\n <DragHandle\n ref={dragHandle.ref}\n ariaLabelledBy={dragHandleAriaLabelledBy}\n ariaDescribedBy={dragHandleAriaDescribedBy}\n onPointerDown={dragHandle.onPointerDown}\n onKeyDown={dragHandle.onKeyDown}\n activeState={dragHandle.activeState}\n initialShowButtons={dragHandle.initialShowButtons}\n onDirectionClick={(direction) => dragHandle.onDirectionClick(mapToKeyboardDirection(direction), \"drag\")}\n dragHandleTooltipText={i18nStrings.dragHandleTooltipText}\n />\n }\n settings={settings}\n >\n {header}\n </WidgetContainerHeader>\n }\n footer={footer}\n disableContentPaddings={disableContentPaddings}\n className={clsx(styles[\"container-override\"], isActive && styles.active)}\n >\n {children}\n </Container>\n {resizeHandle && (\n <div className={styles.resizer}>\n <ResizeHandle\n ariaLabelledBy={resizeHandleAriaLabelledBy}\n ariaDescribedBy={resizeHandleAriaDescribedBy}\n onPointerDown={resizeHandle.onPointerDown}\n onKeyDown={resizeHandle.onKeyDown}\n activeState={resizeHandle.activeState}\n onDirectionClick={(direction) => {\n resizeHandle.onDirectionClick(mapToKeyboardDirection(direction), \"resize\");\n }}\n resizeHandleTooltipText={i18nStrings.resizeHandleTooltipText}\n />\n </div>\n )}\n\n <ScreenreaderOnly id={dragHandleAriaLabelledBy}>{i18nStrings.dragHandleAriaLabel}</ScreenreaderOnly>\n <ScreenreaderOnly id={dragHandleAriaDescribedBy}>{i18nStrings.dragHandleAriaDescription}</ScreenreaderOnly>\n\n <ScreenreaderOnly id={resizeHandleAriaLabelledBy}>{i18nStrings.resizeHandleAriaLabel}</ScreenreaderOnly>\n <ScreenreaderOnly id={resizeHandleAriaDescribedBy}>{i18nStrings.resizeHandleAriaDescription}</ScreenreaderOnly>\n </div>\n );\n}\n"]}
|
package/board-item/styles.css.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"container-override": "awsui_container-
|
|
6
|
-
"active": "
|
|
7
|
-
"header": "
|
|
8
|
-
"flexible": "
|
|
9
|
-
"handle": "
|
|
10
|
-
"refresh": "
|
|
11
|
-
"header-content": "awsui_header-
|
|
12
|
-
"settings": "
|
|
13
|
-
"fixed": "
|
|
14
|
-
"resizer": "
|
|
4
|
+
"root": "awsui_root_9ckv7_m9g0k_9",
|
|
5
|
+
"container-override": "awsui_container-override_9ckv7_m9g0k_14",
|
|
6
|
+
"active": "awsui_active_9ckv7_m9g0k_14",
|
|
7
|
+
"header": "awsui_header_9ckv7_m9g0k_34",
|
|
8
|
+
"flexible": "awsui_flexible_9ckv7_m9g0k_41",
|
|
9
|
+
"handle": "awsui_handle_9ckv7_m9g0k_45",
|
|
10
|
+
"refresh": "awsui_refresh_9ckv7_m9g0k_48",
|
|
11
|
+
"header-content": "awsui_header-content_9ckv7_m9g0k_52",
|
|
12
|
+
"settings": "awsui_settings_9ckv7_m9g0k_56",
|
|
13
|
+
"fixed": "awsui_fixed_9ckv7_m9g0k_64",
|
|
14
|
+
"resizer": "awsui_resizer_9ckv7_m9g0k_68"
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -6,21 +6,19 @@
|
|
|
6
6
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7
7
|
SPDX-License-Identifier: Apache-2.0
|
|
8
8
|
*/
|
|
9
|
-
.
|
|
9
|
+
.awsui_root_9ckv7_m9g0k_9:not(#\9) {
|
|
10
10
|
display: contents;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/* TODO: use container API instead of styles override */
|
|
14
|
-
.awsui_container-
|
|
14
|
+
.awsui_container-override_9ckv7_m9g0k_14.awsui_active_9ckv7_m9g0k_14:not(#\9) {
|
|
15
15
|
box-shadow: var(--shadow-container-active-ypjjoc, 0px 1px 1px 1px #e9ebed, 0px 6px 36px rgba(0, 7, 22, 0.1019607843));
|
|
16
|
-
}
|
|
17
|
-
[data-awsui-focus-visible] .awsui_container-override_9ckv7_zpa7v_14.awsui_active_9ckv7_zpa7v_14:not(#\9) {
|
|
18
16
|
position: relative;
|
|
19
17
|
box-sizing: border-box;
|
|
20
18
|
outline: 2px dotted transparent;
|
|
21
19
|
outline-offset: -1px;
|
|
22
20
|
}
|
|
23
|
-
|
|
21
|
+
.awsui_container-override_9ckv7_m9g0k_14.awsui_active_9ckv7_m9g0k_14:not(#\9)::before {
|
|
24
22
|
content: " ";
|
|
25
23
|
display: block;
|
|
26
24
|
position: absolute;
|
|
@@ -33,41 +31,41 @@
|
|
|
33
31
|
border: 2px solid var(--color-border-item-focused-uk47pl, #006ce0);
|
|
34
32
|
}
|
|
35
33
|
|
|
36
|
-
.
|
|
34
|
+
.awsui_header_9ckv7_m9g0k_34:not(#\9) {
|
|
37
35
|
display: flex;
|
|
38
36
|
justify-items: center;
|
|
39
37
|
padding-block: var(--space-scaled-s-8ozaad, 12px);
|
|
40
38
|
padding-inline: calc(var(--space-container-horizontal-nqrzyh, 20px) - var(--space-scaled-xs-xwoogq, 8px));
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
.
|
|
41
|
+
.awsui_flexible_9ckv7_m9g0k_41:not(#\9) {
|
|
44
42
|
flex: 1 1 min-content;
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
.
|
|
45
|
+
.awsui_handle_9ckv7_m9g0k_45:not(#\9) {
|
|
48
46
|
margin-block-start: calc(var(--space-scaled-xxs-pfm1nx, 4px) + 1px);
|
|
49
47
|
}
|
|
50
|
-
.
|
|
48
|
+
.awsui_refresh_9ckv7_m9g0k_48 > .awsui_handle_9ckv7_m9g0k_45:not(#\9) {
|
|
51
49
|
margin-block-start: calc(var(--space-static-xxxs-yidks1, 2px) + 1px);
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
.awsui_header-
|
|
52
|
+
.awsui_header-content_9ckv7_m9g0k_52:not(#\9) {
|
|
55
53
|
margin-inline-start: var(--space-scaled-xxs-pfm1nx, 4px);
|
|
56
54
|
}
|
|
57
55
|
|
|
58
|
-
.
|
|
56
|
+
.awsui_settings_9ckv7_m9g0k_56:not(#\9) {
|
|
59
57
|
margin-block-start: calc(var(--space-scaled-xxxs-oo06c7, 2px) + 1px);
|
|
60
58
|
margin-inline-start: var(--space-static-xs-gnm0mz, 8px);
|
|
61
59
|
}
|
|
62
|
-
.
|
|
60
|
+
.awsui_refresh_9ckv7_m9g0k_48 > .awsui_settings_9ckv7_m9g0k_56:not(#\9) {
|
|
63
61
|
margin-block-start: 0px;
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
.
|
|
64
|
+
.awsui_fixed_9ckv7_m9g0k_64:not(#\9) {
|
|
67
65
|
flex: 0 0 auto;
|
|
68
66
|
}
|
|
69
67
|
|
|
70
|
-
.
|
|
68
|
+
.awsui_resizer_9ckv7_m9g0k_68:not(#\9) {
|
|
71
69
|
position: absolute;
|
|
72
70
|
inset-block-end: calc(var(--space-static-xs-gnm0mz, 8px) - var(--space-static-xxxs-yidks1, 2px));
|
|
73
71
|
inset-inline-end: calc(var(--space-static-xs-gnm0mz, 8px) - var(--space-static-xxxs-yidks1, 2px));
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"container-override": "awsui_container-
|
|
7
|
-
"active": "
|
|
8
|
-
"header": "
|
|
9
|
-
"flexible": "
|
|
10
|
-
"handle": "
|
|
11
|
-
"refresh": "
|
|
12
|
-
"header-content": "awsui_header-
|
|
13
|
-
"settings": "
|
|
14
|
-
"fixed": "
|
|
15
|
-
"resizer": "
|
|
5
|
+
"root": "awsui_root_9ckv7_m9g0k_9",
|
|
6
|
+
"container-override": "awsui_container-override_9ckv7_m9g0k_14",
|
|
7
|
+
"active": "awsui_active_9ckv7_m9g0k_14",
|
|
8
|
+
"header": "awsui_header_9ckv7_m9g0k_34",
|
|
9
|
+
"flexible": "awsui_flexible_9ckv7_m9g0k_41",
|
|
10
|
+
"handle": "awsui_handle_9ckv7_m9g0k_45",
|
|
11
|
+
"refresh": "awsui_refresh_9ckv7_m9g0k_48",
|
|
12
|
+
"header-content": "awsui_header-content_9ckv7_m9g0k_52",
|
|
13
|
+
"settings": "awsui_settings_9ckv7_m9g0k_56",
|
|
14
|
+
"fixed": "awsui_fixed_9ckv7_m9g0k_64",
|
|
15
|
+
"resizer": "awsui_resizer_9ckv7_m9g0k_68"
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -49,6 +49,11 @@ module.exports = {
|
|
|
49
49
|
"type": "string",
|
|
50
50
|
"optional": false
|
|
51
51
|
},
|
|
52
|
+
{
|
|
53
|
+
"name": "dragHandleTooltipText",
|
|
54
|
+
"type": "string",
|
|
55
|
+
"optional": true
|
|
56
|
+
},
|
|
52
57
|
{
|
|
53
58
|
"name": "resizeHandleAriaDescription",
|
|
54
59
|
"type": "string",
|
|
@@ -58,11 +63,16 @@ module.exports = {
|
|
|
58
63
|
"name": "resizeHandleAriaLabel",
|
|
59
64
|
"type": "string",
|
|
60
65
|
"optional": false
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "resizeHandleTooltipText",
|
|
69
|
+
"type": "string",
|
|
70
|
+
"optional": true
|
|
61
71
|
}
|
|
62
72
|
]
|
|
63
73
|
},
|
|
64
74
|
"optional": false,
|
|
65
|
-
"description": "An object containing all the necessary localized strings required by the component.\n\nARIA labels:\n* `dragHandleAriaLabel` (string) - the ARIA label for the drag handle.\n* `dragHandleAriaDescription` (string, optional) - the ARIA description for the drag handle.\n* `resizeHandleAriaLabel` (string) - the ARIA label for the resize handle.\n* `resizeHandleAriaDescription` (string, optional) - the ARIA description for the resize handle."
|
|
75
|
+
"description": "An object containing all the necessary localized strings required by the component.\n\nARIA labels:\n* `dragHandleAriaLabel` (string) - the ARIA label for the drag handle.\n* `dragHandleAriaDescription` (string, optional) - the ARIA description for the drag handle.\n* `resizeHandleAriaLabel` (string) - the ARIA label for the resize handle.\n* `resizeHandleAriaDescription` (string, optional) - the ARIA description for the resize handle.\n* `dragHandleTooltipText` (string, optional) - the ARIA description for the resize handle.\n* `resizeHandleTooltipText` (string, optional) - the Text for the resize handle Tooltip."
|
|
66
76
|
}
|
|
67
77
|
],
|
|
68
78
|
"events": []
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { KeyboardEvent, PointerEvent } from "react";
|
|
2
|
+
import { InternalDragHandleProps } from "@cloudscape-design/components/internal/do-not-use/drag-handle";
|
|
3
|
+
import { HandleActiveState } from "../item-container";
|
|
2
4
|
export interface DragHandleProps {
|
|
3
5
|
ariaLabelledBy: string;
|
|
4
6
|
ariaDescribedBy: string;
|
|
5
7
|
onPointerDown: (event: PointerEvent) => void;
|
|
6
8
|
onKeyDown: (event: KeyboardEvent) => void;
|
|
7
|
-
|
|
9
|
+
activeState: HandleActiveState;
|
|
10
|
+
initialShowButtons?: boolean;
|
|
11
|
+
onDirectionClick: InternalDragHandleProps["onDirectionClick"];
|
|
12
|
+
dragHandleTooltipText?: string;
|
|
8
13
|
}
|
|
9
|
-
declare const _default: import("react").ForwardRefExoticComponent<DragHandleProps & import("react").RefAttributes<
|
|
14
|
+
declare const _default: import("react").ForwardRefExoticComponent<DragHandleProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
15
|
export default _default;
|
|
@@ -3,11 +3,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import { forwardRef } from "react";
|
|
5
5
|
import clsx from "clsx";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import { InternalDragHandle, } from "@cloudscape-design/components/internal/do-not-use/drag-handle";
|
|
7
|
+
import { CLICK_DRAG_THRESHOLD } from "../item-container";
|
|
8
8
|
import styles from "./styles.css.js";
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import testUtilsStyles from "./test-classes/styles.css.js";
|
|
10
|
+
function DragHandle({ ariaLabelledBy, ariaDescribedBy, onPointerDown, onKeyDown, activeState, initialShowButtons, onDirectionClick, dragHandleTooltipText, }, ref) {
|
|
11
|
+
return (_jsx(InternalDragHandle, { ref: ref, className: clsx(styles.handle, activeState === "pointer" && styles.active, activeState === "uap" && testUtilsStyles["active-uap"]), ariaLabelledBy: ariaLabelledBy, ariaDescribedby: ariaDescribedBy, variant: "drag-indicator", tooltipText: dragHandleTooltipText, onKeyDown: onKeyDown, onPointerDown: onPointerDown, directions: {
|
|
12
|
+
"block-start": "active",
|
|
13
|
+
"block-end": "active",
|
|
14
|
+
"inline-start": "active",
|
|
15
|
+
"inline-end": "active",
|
|
16
|
+
}, triggerMode: "keyboard-activate", onDirectionClick: onDirectionClick, initialShowButtons: initialShowButtons, hideButtonsOnDrag: true, clickDragThreshold: CLICK_DRAG_THRESHOLD }));
|
|
11
17
|
}
|
|
12
18
|
export default forwardRef(DragHandle);
|
|
13
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/drag-handle/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAgB,UAAU,EAA+B,MAAM,OAAO,CAAC;AAC9E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/drag-handle/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAgB,UAAU,EAA+B,MAAM,OAAO,CAAC;AAC9E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,kBAAkB,GAEnB,MAAM,+DAA+D,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAqB,MAAM,mBAAmB,CAAC;AAE5E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAa3D,SAAS,UAAU,CACjB,EACE,cAAc,EACd,eAAe,EACf,aAAa,EACb,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,GACL,EAClB,GAAiC;IAEjC,OAAO,CACL,KAAC,kBAAkB,IACjB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,MAAM,EACb,WAAW,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,EAC1C,WAAW,KAAK,KAAK,IAAI,eAAe,CAAC,YAAY,CAAC,CACvD,EACD,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,OAAO,EAAC,gBAAgB,EACxB,WAAW,EAAE,qBAAqB,EAClC,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE;YACV,aAAa,EAAE,QAAQ;YACvB,WAAW,EAAE,QAAQ;YACrB,cAAc,EAAE,QAAQ;YACxB,YAAY,EAAE,QAAQ;SACvB,EACD,WAAW,EAAC,mBAAmB,EAC/B,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,EACtC,iBAAiB,EAAE,IAAI,EACvB,kBAAkB,EAAE,oBAAoB,GACxC,CACH,CAAC;AACJ,CAAC;AAED,eAAe,UAAU,CAAC,UAAU,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ForwardedRef, forwardRef, KeyboardEvent, PointerEvent } from \"react\";\nimport clsx from \"clsx\";\n\nimport {\n InternalDragHandle,\n InternalDragHandleProps,\n} from \"@cloudscape-design/components/internal/do-not-use/drag-handle\";\n\nimport { CLICK_DRAG_THRESHOLD, HandleActiveState } from \"../item-container\";\n\nimport styles from \"./styles.css.js\";\nimport testUtilsStyles from \"./test-classes/styles.css.js\";\n\nexport interface DragHandleProps {\n ariaLabelledBy: string;\n ariaDescribedBy: string;\n onPointerDown: (event: PointerEvent) => void;\n onKeyDown: (event: KeyboardEvent) => void;\n activeState: HandleActiveState;\n initialShowButtons?: boolean;\n onDirectionClick: InternalDragHandleProps[\"onDirectionClick\"];\n dragHandleTooltipText?: string;\n}\n\nfunction DragHandle(\n {\n ariaLabelledBy,\n ariaDescribedBy,\n onPointerDown,\n onKeyDown,\n activeState,\n initialShowButtons,\n onDirectionClick,\n dragHandleTooltipText,\n }: DragHandleProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <InternalDragHandle\n ref={ref}\n className={clsx(\n styles.handle,\n activeState === \"pointer\" && styles.active,\n activeState === \"uap\" && testUtilsStyles[\"active-uap\"],\n )}\n ariaLabelledBy={ariaLabelledBy}\n ariaDescribedby={ariaDescribedBy}\n variant=\"drag-indicator\"\n tooltipText={dragHandleTooltipText}\n onKeyDown={onKeyDown}\n onPointerDown={onPointerDown}\n directions={{\n \"block-start\": \"active\",\n \"block-end\": \"active\",\n \"inline-start\": \"active\",\n \"inline-end\": \"active\",\n }}\n triggerMode=\"keyboard-activate\"\n onDirectionClick={onDirectionClick}\n initialShowButtons={initialShowButtons}\n hideButtonsOnDrag={true}\n clickDragThreshold={CLICK_DRAG_THRESHOLD}\n />\n );\n}\n\nexport default forwardRef(DragHandle);\n"]}
|
|
@@ -6,33 +6,24 @@
|
|
|
6
6
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7
7
|
SPDX-License-Identifier: Apache-2.0
|
|
8
8
|
*/
|
|
9
|
-
.
|
|
9
|
+
.awsui_handle_umbhe_1bpr9_9:not(#\9) {
|
|
10
10
|
cursor: grab;
|
|
11
|
+
appearance: none;
|
|
12
|
+
background: transparent;
|
|
13
|
+
border: none;
|
|
14
|
+
padding-block: var(--space-scaled-xxs-pfm1nx, 4px);
|
|
15
|
+
padding-inline: var(--space-scaled-xxs-pfm1nx, 4px);
|
|
16
|
+
block-size: auto;
|
|
17
|
+
color: var(--color-text-interactive-default-ugh9wp, #424650);
|
|
11
18
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
cursor: grabbing;
|
|
19
|
+
.awsui_handle_umbhe_1bpr9_9:not(#\9):hover {
|
|
20
|
+
color: var(--color-text-interactive-hover-6naf7i, #0f141a);
|
|
15
21
|
}
|
|
16
22
|
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
outline: 2px dotted transparent;
|
|
21
|
-
outline-offset: 3px;
|
|
22
|
-
}
|
|
23
|
-
.awsui_handle_umbhe_t9qqw_9:not(#\9):not(.awsui_active_umbhe_t9qqw_17):focus-visible::before {
|
|
24
|
-
content: " ";
|
|
25
|
-
display: block;
|
|
26
|
-
position: absolute;
|
|
27
|
-
box-sizing: border-box;
|
|
28
|
-
inset-inline-start: calc(-1 * 4px);
|
|
29
|
-
inset-block-start: calc(-1 * 4px);
|
|
30
|
-
inline-size: calc(100% + 2 * 4px);
|
|
31
|
-
block-size: calc(100% + 2 * 4px);
|
|
32
|
-
border-radius: var(--border-radius-control-default-focus-ring-1uabki, 4px);
|
|
33
|
-
border: 2px solid var(--color-border-item-focused-uk47pl, #006ce0);
|
|
23
|
+
.awsui_handle_umbhe_1bpr9_9:not(#\9):active {
|
|
24
|
+
cursor: grabbing;
|
|
34
25
|
}
|
|
35
26
|
|
|
36
|
-
.
|
|
27
|
+
.awsui_active_umbhe_1bpr9_27:not(#\9) {
|
|
37
28
|
outline: none;
|
|
38
29
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"handle": "
|
|
6
|
-
"active": "
|
|
5
|
+
"handle": "awsui_handle_umbhe_1bpr9_9",
|
|
6
|
+
"active": "awsui_active_umbhe_1bpr9_27"
|
|
7
7
|
};
|
|
8
8
|
|
package/internal/environment.js
CHANGED
|
@@ -6,19 +6,24 @@ function assertNever(value) {
|
|
|
6
6
|
throw new Error("Unexpected value: " + value);
|
|
7
7
|
}
|
|
8
8
|
function setup({ operation, interactionType }) {
|
|
9
|
+
const isPointerInteraction = interactionType === "pointer";
|
|
9
10
|
switch (operation) {
|
|
10
11
|
case "insert":
|
|
11
12
|
case "reorder":
|
|
12
|
-
|
|
13
|
+
if (isPointerInteraction) {
|
|
14
|
+
document.body.classList.add(styles["show-grab-cursor"]);
|
|
15
|
+
}
|
|
13
16
|
break;
|
|
14
17
|
case "resize":
|
|
15
|
-
|
|
18
|
+
if (isPointerInteraction) {
|
|
19
|
+
document.body.classList.add(styles["show-resize-cursor"]);
|
|
20
|
+
}
|
|
16
21
|
break;
|
|
17
22
|
default:
|
|
18
23
|
// there will be a type error if not all operation types are handled
|
|
19
24
|
assertNever(operation);
|
|
20
25
|
}
|
|
21
|
-
if (
|
|
26
|
+
if (isPointerInteraction) {
|
|
22
27
|
document.body.classList.add(styles["disable-selection"]);
|
|
23
28
|
}
|
|
24
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/global-drag-state-styles/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAmB,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEpF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,SAAS,WAAW,CAAC,KAAY;IAC/B,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,eAAe,EAAmB;IAC5D,QAAQ,SAAS,EAAE;QACjB,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/global-drag-state-styles/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAmB,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEpF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,SAAS,WAAW,CAAC,KAAY;IAC/B,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,eAAe,EAAmB;IAC5D,MAAM,oBAAoB,GAAG,eAAe,KAAK,SAAS,CAAC;IAC3D,QAAQ,SAAS,EAAE;QACjB,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,IAAI,oBAAoB,EAAE;gBACxB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC;aACzD;YACD,MAAM;QACR,KAAK,QAAQ;YACX,IAAI,oBAAoB,EAAE;gBACxB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC;aAC3D;YACD,MAAM;QACR;YACE,oEAAoE;YACpE,WAAW,CAAC,SAAS,CAAC,CAAC;KAC1B;IAED,IAAI,oBAAoB,EAAE;QACxB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC;KAC1D;AACH,CAAC;AAED,SAAS,QAAQ;IACf,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC;AACxH,CAAC;AAED,MAAM,UAAU,wBAAwB;IACtC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACpC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACzC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DragAndDropData, useDragSubscription } from \"../dnd-controller/controller\";\n\nimport styles from \"./styles.css.js\";\n\nfunction assertNever(value: never) {\n throw new Error(\"Unexpected value: \" + value);\n}\n\nfunction setup({ operation, interactionType }: DragAndDropData) {\n const isPointerInteraction = interactionType === \"pointer\";\n switch (operation) {\n case \"insert\":\n case \"reorder\":\n if (isPointerInteraction) {\n document.body.classList.add(styles[\"show-grab-cursor\"]);\n }\n break;\n case \"resize\":\n if (isPointerInteraction) {\n document.body.classList.add(styles[\"show-resize-cursor\"]);\n }\n break;\n default:\n // there will be a type error if not all operation types are handled\n assertNever(operation);\n }\n\n if (isPointerInteraction) {\n document.body.classList.add(styles[\"disable-selection\"]);\n }\n}\n\nfunction teardown() {\n document.body.classList.remove(styles[\"show-grab-cursor\"], styles[\"show-resize-cursor\"], styles[\"disable-selection\"]);\n}\n\nexport function useGlobalDragStateStyles() {\n useDragSubscription(\"start\", setup);\n useDragSubscription(\"discard\", teardown);\n useDragSubscription(\"submit\", teardown);\n}\n"]}
|
|
@@ -1,23 +1,84 @@
|
|
|
1
1
|
import { KeyboardEvent, PointerEvent as ReactPointerEvent, ReactNode, RefObject } from "react";
|
|
2
|
-
import { DropTargetContext } from "../dnd-controller/controller";
|
|
3
|
-
import { BoardItemDefinitionBase, Direction, Transform } from "../interfaces";
|
|
2
|
+
import { DropTargetContext, InteractionType, Operation } from "../dnd-controller/controller";
|
|
3
|
+
import { BoardItemDefinitionBase, Direction, ItemId, Transform } from "../interfaces";
|
|
4
4
|
export interface ItemContainerRef {
|
|
5
5
|
focusDragHandle(): void;
|
|
6
6
|
}
|
|
7
|
+
export type HandleActiveState = null | "pointer" | "uap";
|
|
7
8
|
interface ItemContextType {
|
|
9
|
+
/**
|
|
10
|
+
* Flag indicating if a drag or resize interaction is currently active.
|
|
11
|
+
*/
|
|
8
12
|
isActive: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Flag indicating if the item is currently hidden.
|
|
15
|
+
* (When a board item is moved from the palette to the board and the transition is not submitted)
|
|
16
|
+
*/
|
|
17
|
+
isHidden: boolean;
|
|
9
18
|
dragHandle: {
|
|
10
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Ref to the drag button. Used to focus the drag handle when moving an item
|
|
21
|
+
* from the palette to the board via keyboard or UAP actions.
|
|
22
|
+
*/
|
|
23
|
+
ref: RefObject<HTMLDivElement>;
|
|
24
|
+
/**
|
|
25
|
+
* Listen to pointerDown events on the drag handle.
|
|
26
|
+
* Used to start a transition and attach global event handlers.
|
|
27
|
+
*/
|
|
11
28
|
onPointerDown(event: ReactPointerEvent): void;
|
|
29
|
+
/**
|
|
30
|
+
* Listen to keyDown events on the drag handle.
|
|
31
|
+
*/
|
|
12
32
|
onKeyDown(event: KeyboardEvent): void;
|
|
13
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Indicating if drag handle is active.
|
|
35
|
+
*/
|
|
36
|
+
activeState: HandleActiveState;
|
|
37
|
+
/**
|
|
38
|
+
* Listen to UAP direction button clicks.
|
|
39
|
+
*/
|
|
40
|
+
onDirectionClick(direction: KeyboardEvent["key"], operation: HandleOperation): void;
|
|
41
|
+
/**
|
|
42
|
+
* Flag indicating if the UAP buttons should be shown. E.g. when a item is moved from
|
|
43
|
+
* the palette via keyboard or UAP to the board.
|
|
44
|
+
*/
|
|
45
|
+
initialShowButtons?: boolean;
|
|
14
46
|
};
|
|
15
47
|
resizeHandle: null | {
|
|
48
|
+
/**
|
|
49
|
+
* Listen to pointerDown events on the drag handle.
|
|
50
|
+
* Used to start a transition and attach global event handlers.
|
|
51
|
+
*/
|
|
16
52
|
onPointerDown(event: ReactPointerEvent): void;
|
|
53
|
+
/**
|
|
54
|
+
* Listen to keyDown events on the drag handle.
|
|
55
|
+
*/
|
|
17
56
|
onKeyDown(event: KeyboardEvent): void;
|
|
18
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Indicating if resize handle is active.
|
|
59
|
+
*/
|
|
60
|
+
activeState: HandleActiveState;
|
|
61
|
+
/**
|
|
62
|
+
* Listen to UAP direction button clicks.
|
|
63
|
+
*/
|
|
64
|
+
onDirectionClick(direction: KeyboardEvent["key"], operation: HandleOperation): void;
|
|
19
65
|
};
|
|
20
66
|
}
|
|
67
|
+
export interface Transition {
|
|
68
|
+
itemId: ItemId;
|
|
69
|
+
operation: Operation;
|
|
70
|
+
interactionType: InteractionType;
|
|
71
|
+
sizeTransform: null | {
|
|
72
|
+
width: number;
|
|
73
|
+
height: number;
|
|
74
|
+
};
|
|
75
|
+
positionTransform: null | {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
};
|
|
79
|
+
hasDropTarget?: boolean;
|
|
80
|
+
}
|
|
81
|
+
export type HandleOperation = "drag" | "resize";
|
|
21
82
|
export declare const ItemContext: import("react").Context<ItemContextType | null>;
|
|
22
83
|
export declare function useItemContext(): ItemContextType;
|
|
23
84
|
/**
|
|
@@ -50,4 +111,5 @@ export interface ItemContainerProps {
|
|
|
50
111
|
isRtl: () => boolean;
|
|
51
112
|
}
|
|
52
113
|
export declare const ItemContainer: import("react").ForwardRefExoticComponent<ItemContainerProps & import("react").RefAttributes<ItemContainerRef>>;
|
|
114
|
+
export declare const CLICK_DRAG_THRESHOLD = 3;
|
|
53
115
|
export {};
|