@cloudscape-design/components-themeable 3.0.936 → 3.0.937
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/code-editor/resizable-box/styles.scss +7 -15
- package/lib/internal/scss/internal/components/drag-handle-wrapper/motion.scss +190 -0
- package/lib/internal/scss/internal/components/drag-handle-wrapper/styles.scss +110 -0
- package/lib/internal/template/code-editor/index.d.ts.map +1 -1
- package/lib/internal/template/code-editor/index.js +2 -2
- package/lib/internal/template/code-editor/index.js.map +1 -1
- package/lib/internal/template/code-editor/interfaces.d.ts +2 -0
- package/lib/internal/template/code-editor/interfaces.d.ts.map +1 -1
- package/lib/internal/template/code-editor/interfaces.js.map +1 -1
- package/lib/internal/template/code-editor/pane.d.ts +3 -1
- package/lib/internal/template/code-editor/pane.d.ts.map +1 -1
- package/lib/internal/template/code-editor/pane.js +2 -2
- package/lib/internal/template/code-editor/pane.js.map +1 -1
- package/lib/internal/template/code-editor/resizable-box/index.d.ts +3 -1
- package/lib/internal/template/code-editor/resizable-box/index.d.ts.map +1 -1
- package/lib/internal/template/code-editor/resizable-box/index.js +40 -8
- package/lib/internal/template/code-editor/resizable-box/index.js.map +1 -1
- package/lib/internal/template/code-editor/resizable-box/styles.css.js +4 -3
- package/lib/internal/template/code-editor/resizable-box/styles.scoped.css +16 -37
- package/lib/internal/template/code-editor/resizable-box/styles.selectors.js +4 -3
- package/lib/internal/template/i18n/messages/all.all.js +1 -1
- package/lib/internal/template/i18n/messages/all.all.json +1 -1
- package/lib/internal/template/i18n/messages/all.ar.js +1 -1
- package/lib/internal/template/i18n/messages/all.ar.json +1 -1
- package/lib/internal/template/i18n/messages/all.de.js +1 -1
- package/lib/internal/template/i18n/messages/all.de.json +1 -1
- package/lib/internal/template/i18n/messages/all.en-GB.js +1 -1
- package/lib/internal/template/i18n/messages/all.en-GB.json +1 -1
- package/lib/internal/template/i18n/messages/all.en.js +1 -1
- package/lib/internal/template/i18n/messages/all.en.json +1 -1
- package/lib/internal/template/i18n/messages/all.es.js +1 -1
- package/lib/internal/template/i18n/messages/all.es.json +1 -1
- package/lib/internal/template/i18n/messages/all.fr.js +1 -1
- package/lib/internal/template/i18n/messages/all.fr.json +1 -1
- package/lib/internal/template/i18n/messages/all.id.js +1 -1
- package/lib/internal/template/i18n/messages/all.id.json +1 -1
- package/lib/internal/template/i18n/messages/all.it.js +1 -1
- package/lib/internal/template/i18n/messages/all.it.json +1 -1
- package/lib/internal/template/i18n/messages/all.ja.js +1 -1
- package/lib/internal/template/i18n/messages/all.ja.json +1 -1
- package/lib/internal/template/i18n/messages/all.ko.js +1 -1
- package/lib/internal/template/i18n/messages/all.ko.json +1 -1
- package/lib/internal/template/i18n/messages/all.pt-BR.js +1 -1
- package/lib/internal/template/i18n/messages/all.pt-BR.json +1 -1
- package/lib/internal/template/i18n/messages/all.tr.js +1 -1
- package/lib/internal/template/i18n/messages/all.tr.json +1 -1
- package/lib/internal/template/i18n/messages/all.zh-CN.js +1 -1
- package/lib/internal/template/i18n/messages/all.zh-CN.json +1 -1
- package/lib/internal/template/i18n/messages/all.zh-TW.js +1 -1
- package/lib/internal/template/i18n/messages/all.zh-TW.json +1 -1
- package/lib/internal/template/i18n/messages-types.d.ts +2 -0
- package/lib/internal/template/i18n/messages-types.d.ts.map +1 -1
- package/lib/internal/template/i18n/messages-types.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +29 -0
- package/lib/internal/template/internal/components/drag-handle/button.d.ts +5 -0
- package/lib/internal/template/internal/components/drag-handle/button.d.ts.map +1 -0
- package/lib/internal/template/internal/components/drag-handle/button.js +35 -0
- package/lib/internal/template/internal/components/drag-handle/button.js.map +1 -0
- package/lib/internal/template/internal/components/drag-handle/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/index.js +6 -30
- package/lib/internal/template/internal/components/drag-handle/index.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts +7 -1
- package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/interfaces.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.d.ts +11 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.d.ts.map +1 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.js +30 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/direction-button.js.map +1 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts +4 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts.map +1 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.js +138 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.js.map +1 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts +10 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts.map +1 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.js +4 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.js.map +1 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.d.ts +6 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.d.ts.map +1 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js +56 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js.map +1 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.css.js +32 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.scoped.css +508 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.selectors.js +33 -0
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/internal/environment.json +1 -1
- package/lib/internal/template/internal/generated/styles/tokens.d.ts +6 -0
- package/lib/internal/template/internal/generated/styles/tokens.js +6 -0
- package/lib/internal/template/internal/generated/theming/index.cjs +186 -0
- package/lib/internal/template/internal/generated/theming/index.js +186 -0
- package/lib/internal/template/internal/utils/pointer-events-mock.d.ts +5 -0
- package/lib/internal/template/internal/utils/pointer-events-mock.d.ts.map +1 -0
- package/lib/internal/template/internal/utils/pointer-events-mock.js +10 -0
- package/lib/internal/template/internal/utils/pointer-events-mock.js.map +1 -0
- package/package.json +1 -1
- package/lib/internal/scss/code-editor/assets/resize-handler.svg +0 -3
|
@@ -4,6 +4,8 @@ export interface ResizeBoxProps {
|
|
|
4
4
|
height: number;
|
|
5
5
|
minHeight: number;
|
|
6
6
|
onResize: (newHeight: number) => void;
|
|
7
|
+
handleAriaLabel?: string;
|
|
8
|
+
handleTooltipText?: string;
|
|
7
9
|
}
|
|
8
|
-
export declare function ResizableBox({ children, height, minHeight, onResize }: ResizeBoxProps): JSX.Element;
|
|
10
|
+
export declare function ResizableBox({ children, height, minHeight, onResize, handleAriaLabel, handleTooltipText, }: ResizeBoxProps): JSX.Element;
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAU3D,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAEtC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,MAAM,EACN,SAAS,EACT,QAAQ,EACR,eAAe,EACf,iBAAiB,GAClB,EAAE,cAAc,eAoFhB"}
|
|
@@ -2,42 +2,74 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React, { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { useStableCallback } from '@cloudscape-design/component-toolkit/internal';
|
|
5
|
+
import InternalDragHandle from '../../internal/components/drag-handle';
|
|
5
6
|
import styles from './styles.css.js';
|
|
6
|
-
|
|
7
|
+
const KEYBOARD_STEP_SIZE = 20;
|
|
8
|
+
export function ResizableBox({ children, height, minHeight, onResize, handleAriaLabel, handleTooltipText, }) {
|
|
7
9
|
const [dragOffset, setDragOffset] = useState(null);
|
|
8
10
|
const onResizeStable = useStableCallback(onResize);
|
|
9
11
|
const containerRef = useRef(null);
|
|
10
|
-
const
|
|
11
|
-
if (event.button !== 0 || !containerRef.current) {
|
|
12
|
+
const onPointerDown = event => {
|
|
13
|
+
if ((event.pointerType === 'mouse' && event.button !== 0) || !containerRef.current) {
|
|
12
14
|
return;
|
|
13
15
|
}
|
|
14
16
|
const containerBottom = containerRef.current.getBoundingClientRect().bottom;
|
|
15
17
|
setDragOffset(containerBottom - event.clientY);
|
|
16
18
|
};
|
|
19
|
+
const onKeyDown = event => {
|
|
20
|
+
switch (event.key) {
|
|
21
|
+
case 'ArrowDown':
|
|
22
|
+
case 'ArrowRight':
|
|
23
|
+
onResizeStable(height + KEYBOARD_STEP_SIZE);
|
|
24
|
+
break;
|
|
25
|
+
case 'ArrowUp':
|
|
26
|
+
case 'ArrowLeft':
|
|
27
|
+
onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
17
31
|
useEffect(() => {
|
|
18
32
|
if (dragOffset === null || !containerRef.current) {
|
|
19
33
|
return;
|
|
20
34
|
}
|
|
21
35
|
const container = containerRef.current;
|
|
22
|
-
const
|
|
36
|
+
const onPointerMove = (event) => {
|
|
23
37
|
const { top } = container.getBoundingClientRect();
|
|
24
38
|
const cursor = event.clientY;
|
|
25
39
|
onResizeStable(Math.max(cursor + dragOffset - top, minHeight));
|
|
26
40
|
};
|
|
27
|
-
const
|
|
41
|
+
const onPointerUp = () => {
|
|
28
42
|
setDragOffset(null);
|
|
29
43
|
};
|
|
30
44
|
const controller = new AbortController();
|
|
31
45
|
document.body.classList.add(styles['resize-active']);
|
|
32
|
-
|
|
33
|
-
document.addEventListener('
|
|
46
|
+
container.classList.add(styles['cursor-active']);
|
|
47
|
+
document.addEventListener('pointermove', onPointerMove, { signal: controller.signal });
|
|
48
|
+
document.addEventListener('pointerup', onPointerUp, { signal: controller.signal });
|
|
34
49
|
return () => {
|
|
35
50
|
controller.abort();
|
|
36
51
|
document.body.classList.remove(styles['resize-active']);
|
|
52
|
+
container.classList.remove(styles['cursor-active']);
|
|
37
53
|
};
|
|
38
54
|
}, [dragOffset, minHeight, onResizeStable]);
|
|
39
55
|
return (React.createElement("div", { ref: containerRef, className: styles['resizable-box'], style: { height } },
|
|
40
56
|
children,
|
|
41
|
-
React.createElement("
|
|
57
|
+
React.createElement("div", { className: styles['resizable-box-handle'] },
|
|
58
|
+
React.createElement(InternalDragHandle, { ariaLabel: handleAriaLabel, variant: "resize-area",
|
|
59
|
+
// Provide an arbitrary large value to valueMax since the editor can be
|
|
60
|
+
// resized to be infinitely large.
|
|
61
|
+
ariaValue: { valueMin: minHeight, valueMax: 1000000, valueNow: height }, tooltipText: handleTooltipText, onPointerDown: onPointerDown, onKeyDown: onKeyDown, directions: {
|
|
62
|
+
'block-start': height > minHeight ? 'active' : 'disabled',
|
|
63
|
+
'block-end': 'active',
|
|
64
|
+
}, onDirectionClick: direction => {
|
|
65
|
+
switch (direction) {
|
|
66
|
+
case 'block-end':
|
|
67
|
+
onResizeStable(height + KEYBOARD_STEP_SIZE);
|
|
68
|
+
break;
|
|
69
|
+
case 'block-start':
|
|
70
|
+
onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
} }))));
|
|
42
74
|
}
|
|
43
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,MAAM,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,kBAAkB,MAAM,uCAAuC,CAAC;AAEvE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAY9B,MAAM,UAAU,YAAY,CAAC,EAC3B,QAAQ,EACR,MAAM,EACN,SAAS,EACT,QAAQ,EACR,eAAe,EACf,iBAAiB,GACF;IACf,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAClE,MAAM,cAAc,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAElD,MAAM,aAAa,GAA8B,KAAK,CAAC,EAAE;QACvD,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,OAAO,IAAI,KAAK,CAAC,MAAM,KAAK,CA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QAAQ;iBACtB,EACD,gBAAgB,EAAE,SAAS,CAAC,EAAE;oBAC5B,QAAQ,SAAS,EAAE;wBACjB,KAAK,WAAW;4BACd,cAAc,CAAC,MAAM,GAAG,kBAAkB,CAAC,CAAC;4BAC5C,MAAM;wBACR,KAAK,aAAa;4BAChB,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,kBAAkB,EAAE,SAAS,CAAC,CAAC,CAAC;4BACjE,MAAM;qBACT;gBACH,CAAC,GACD,CACE,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { useStableCallback } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalDragHandle from '../../internal/components/drag-handle';\n\nimport styles from './styles.css.js';\n\nconst KEYBOARD_STEP_SIZE = 20;\n\nexport interface ResizeBoxProps {\n children: React.ReactNode;\n height: number;\n minHeight: number;\n onResize: (newHeight: number) => void;\n\n handleAriaLabel?: string;\n handleTooltipText?: string;\n}\n\nexport function ResizableBox({\n children,\n height,\n minHeight,\n onResize,\n handleAriaLabel,\n handleTooltipText,\n}: ResizeBoxProps) {\n const [dragOffset, setDragOffset] = useState<null | number>(null);\n const onResizeStable = useStableCallback(onResize);\n const containerRef = useRef<HTMLDivElement>(null);\n\n const onPointerDown: React.PointerEventHandler = event => {\n if ((event.pointerType === 'mouse' && event.button !== 0) || !containerRef.current) {\n return;\n }\n const containerBottom = containerRef.current.getBoundingClientRect().bottom;\n setDragOffset(containerBottom - event.clientY);\n };\n\n const onKeyDown: React.KeyboardEventHandler = event => {\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowRight':\n onResizeStable(height + KEYBOARD_STEP_SIZE);\n break;\n case 'ArrowUp':\n case 'ArrowLeft':\n onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));\n break;\n }\n };\n\n useEffect(() => {\n if (dragOffset === null || !containerRef.current) {\n return;\n }\n const container = containerRef.current;\n\n const onPointerMove = (event: PointerEvent) => {\n const { top } = container.getBoundingClientRect();\n const cursor = event.clientY;\n onResizeStable(Math.max(cursor + dragOffset - top, minHeight));\n };\n const onPointerUp = () => {\n setDragOffset(null);\n };\n const controller = new AbortController();\n document.body.classList.add(styles['resize-active']);\n container.classList.add(styles['cursor-active']);\n document.addEventListener('pointermove', onPointerMove, { signal: controller.signal });\n document.addEventListener('pointerup', onPointerUp, { signal: controller.signal });\n return () => {\n controller.abort();\n document.body.classList.remove(styles['resize-active']);\n container.classList.remove(styles['cursor-active']);\n };\n }, [dragOffset, minHeight, onResizeStable]);\n\n return (\n <div ref={containerRef} className={styles['resizable-box']} style={{ height }}>\n {children}\n\n <div className={styles['resizable-box-handle']}>\n <InternalDragHandle\n ariaLabel={handleAriaLabel}\n variant=\"resize-area\"\n // Provide an arbitrary large value to valueMax since the editor can be\n // resized to be infinitely large.\n ariaValue={{ valueMin: minHeight, valueMax: 1000000, valueNow: height }}\n tooltipText={handleTooltipText}\n onPointerDown={onPointerDown}\n onKeyDown={onKeyDown}\n directions={{\n 'block-start': height > minHeight ? 'active' : 'disabled',\n 'block-end': 'active',\n }}\n onDirectionClick={direction => {\n switch (direction) {\n case 'block-end':\n onResizeStable(height + KEYBOARD_STEP_SIZE);\n break;\n case 'block-start':\n onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));\n break;\n }\n }}\n />\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"resizable-box": "awsui_resizable-
|
|
5
|
-
"
|
|
6
|
-
"
|
|
4
|
+
"resizable-box": "awsui_resizable-box_cufu9_j3e9z_149",
|
|
5
|
+
"cursor-active": "awsui_cursor-active_cufu9_j3e9z_153",
|
|
6
|
+
"resizable-box-handle": "awsui_resizable-box-handle_cufu9_j3e9z_167",
|
|
7
|
+
"resize-active": "awsui_resize-active_cufu9_j3e9z_176"
|
|
7
8
|
};
|
|
8
9
|
|
|
@@ -146,55 +146,34 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
146
146
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
147
147
|
SPDX-License-Identifier: Apache-2.0
|
|
148
148
|
*/
|
|
149
|
-
.awsui_resizable-
|
|
149
|
+
.awsui_resizable-box_cufu9_j3e9z_149:not(#\9) {
|
|
150
150
|
position: relative;
|
|
151
151
|
inline-size: 100%;
|
|
152
152
|
}
|
|
153
|
+
.awsui_resizable-box_cufu9_j3e9z_149:not(#\9):not(.awsui_cursor-active_cufu9_j3e9z_153) {
|
|
154
|
+
transition: height var(--motion-duration-complex-wo6kj4, 270ms) var(--motion-easing-responsive-jm8d79, ease-out);
|
|
155
|
+
}
|
|
156
|
+
@media (prefers-reduced-motion: reduce) {
|
|
157
|
+
.awsui_resizable-box_cufu9_j3e9z_149:not(#\9):not(.awsui_cursor-active_cufu9_j3e9z_153) {
|
|
158
|
+
animation: none;
|
|
159
|
+
transition: none;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
.awsui-motion-disabled .awsui_resizable-box_cufu9_j3e9z_149:not(#\9):not(.awsui_cursor-active_cufu9_j3e9z_153), .awsui-mode-entering .awsui_resizable-box_cufu9_j3e9z_149:not(#\9):not(.awsui_cursor-active_cufu9_j3e9z_153) {
|
|
163
|
+
animation: none;
|
|
164
|
+
transition: none;
|
|
165
|
+
}
|
|
153
166
|
|
|
154
|
-
.awsui_resizable-box-
|
|
167
|
+
.awsui_resizable-box-handle_cufu9_j3e9z_167:not(#\9) {
|
|
155
168
|
position: absolute;
|
|
156
169
|
inset-inline-end: 0;
|
|
157
170
|
inset-block-end: 0;
|
|
158
171
|
z-index: 10;
|
|
159
172
|
inline-size: var(--space-l-eenfqd, 20px);
|
|
160
173
|
block-size: var(--space-l-eenfqd, 20px);
|
|
161
|
-
background-repeat: no-repeat;
|
|
162
|
-
background-origin: content-box;
|
|
163
|
-
box-sizing: border-box;
|
|
164
|
-
background-position: bottom right;
|
|
165
|
-
background-size: var(--space-l-eenfqd, 20px);
|
|
166
|
-
cursor: ns-resize;
|
|
167
|
-
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' stroke='%23687078' fill-opacity='0' stroke-width='1'%3E %3Cpath d='M 8 13 L 13 8 M 13 11 L 11 13 M 5 13 L 13 5'/%3E %3C/svg%3E");
|
|
168
|
-
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
169
|
-
}
|
|
170
|
-
@supports (--css-variable-support-check: #000) {
|
|
171
|
-
@media not print {
|
|
172
|
-
.awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9) {
|
|
173
|
-
/* stylelint-disable selector-combinator-disallowed-list, selector-class-pattern */
|
|
174
|
-
}
|
|
175
|
-
.awsui-polaris-dark-mode .awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9), .awsui-dark-mode .awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9) {
|
|
176
|
-
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' stroke='%23687078' fill-opacity='0' stroke-width='1'%3E %3Cpath d='M 8 13 L 13 8 M 13 11 L 11 13 M 5 13 L 13 5'/%3E %3C/svg%3E");
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
@supports (--css-variable-support-check: #000) {
|
|
181
|
-
.awsui-visual-refresh .awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9) {
|
|
182
|
-
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' stroke='%23424650' fill-opacity='0' stroke-width='1'%3E %3Cpath d='M 8 13 L 13 8 M 13 11 L 11 13 M 5 13 L 13 5'/%3E %3C/svg%3E");
|
|
183
|
-
}
|
|
184
|
-
@media not print {
|
|
185
|
-
.awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9) {
|
|
186
|
-
/* stylelint-disable selector-combinator-disallowed-list, selector-class-pattern */
|
|
187
|
-
}
|
|
188
|
-
.awsui-visual-refresh.awsui-polaris-dark-mode .awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9), .awsui-visual-refresh.awsui-dark-mode .awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9) {
|
|
189
|
-
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' stroke='%23dedee3' fill-opacity='0' stroke-width='1'%3E %3Cpath d='M 8 13 L 13 8 M 13 11 L 11 13 M 5 13 L 13 5'/%3E %3C/svg%3E");
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
.awsui_resizable-box-handle_cufu9_e8bsh_154:not(#\9):dir(rtl) {
|
|
194
|
-
transform: scaleX(-1);
|
|
195
174
|
}
|
|
196
175
|
|
|
197
|
-
.awsui_resize-
|
|
176
|
+
.awsui_resize-active_cufu9_j3e9z_176:not(#\9) {
|
|
198
177
|
-webkit-user-select: none;
|
|
199
178
|
user-select: none;
|
|
200
179
|
}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"resizable-box": "awsui_resizable-
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"resizable-box": "awsui_resizable-box_cufu9_j3e9z_149",
|
|
6
|
+
"cursor-active": "awsui_cursor-active_cufu9_j3e9z_153",
|
|
7
|
+
"resizable-box-handle": "awsui_resizable-box-handle_cufu9_j3e9z_167",
|
|
8
|
+
"resize-active": "awsui_resize-active_cufu9_j3e9z_176"
|
|
8
9
|
};
|
|
9
10
|
|