@cloudscape-design/components-themeable 3.0.1311 → 3.0.1312
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/app-layout/visual-refresh/drawers.scss +16 -0
- package/lib/internal/scss/app-layout/visual-refresh/navigation.scss +1 -1
- package/lib/internal/scss/app-layout/visual-refresh/tools.scss +4 -0
- package/lib/internal/scss/app-layout/visual-refresh-toolbar/drawer/styles.scss +1 -1
- package/lib/internal/scss/app-layout/visual-refresh-toolbar/navigation/styles.scss +1 -1
- package/lib/internal/scss/button-dropdown/styles.scss +4 -0
- package/lib/internal/scss/expandable-section/styles.scss +17 -0
- package/lib/internal/scss/internal/components/button-trigger/styles.scss +7 -0
- package/lib/internal/scss/internal/components/drag-handle/styles.scss +5 -1
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/scss/status-indicator/styles.scss +36 -0
- package/lib/internal/scss/table/header-cell/styles.scss +1 -1
- package/lib/internal/scss/tree-view/tree-item/styles.scss +10 -0
- package/lib/internal/template/app-layout/runtime-drawer/index.js +1 -1
- package/lib/internal/template/app-layout/runtime-drawer/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/drawers.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/drawers.js +3 -0
- package/lib/internal/template/app-layout/visual-refresh/drawers.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/styles.css.js +87 -86
- package/lib/internal/template/app-layout/visual-refresh/styles.scoped.css +176 -164
- package/lib/internal/template/app-layout/visual-refresh/styles.selectors.js +87 -86
- package/lib/internal/template/app-layout/visual-refresh/tools.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/tools.js +2 -0
- package/lib/internal/template/app-layout/visual-refresh/tools.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.css.js +32 -32
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +84 -84
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +32 -32
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.css.js +4 -4
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.scoped.css +6 -6
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.selectors.js +4 -4
- package/lib/internal/template/breadcrumb-group/implementation.d.ts.map +1 -1
- package/lib/internal/template/breadcrumb-group/implementation.js +2 -2
- package/lib/internal/template/breadcrumb-group/implementation.js.map +1 -1
- package/lib/internal/template/breadcrumb-group/item/item.d.ts.map +1 -1
- package/lib/internal/template/breadcrumb-group/item/item.js +2 -1
- package/lib/internal/template/breadcrumb-group/item/item.js.map +1 -1
- package/lib/internal/template/button/internal.d.ts +3 -0
- package/lib/internal/template/button/internal.d.ts.map +1 -1
- package/lib/internal/template/button/internal.js +2 -2
- package/lib/internal/template/button/internal.js.map +1 -1
- package/lib/internal/template/button-dropdown/internal.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/internal.js +4 -3
- package/lib/internal/template/button-dropdown/internal.js.map +1 -1
- package/lib/internal/template/button-dropdown/styles.css.js +22 -21
- package/lib/internal/template/button-dropdown/styles.scoped.css +33 -29
- package/lib/internal/template/button-dropdown/styles.selectors.js +22 -21
- package/lib/internal/template/button-group/icon-toggle-button-item.js +1 -1
- package/lib/internal/template/button-group/icon-toggle-button-item.js.map +1 -1
- package/lib/internal/template/dropdown/internal.d.ts.map +1 -1
- package/lib/internal/template/dropdown/internal.js +14 -2
- package/lib/internal/template/dropdown/internal.js.map +1 -1
- package/lib/internal/template/expandable-section/expandable-section-header.d.ts.map +1 -1
- package/lib/internal/template/expandable-section/expandable-section-header.js +5 -5
- package/lib/internal/template/expandable-section/expandable-section-header.js.map +1 -1
- package/lib/internal/template/expandable-section/styles.css.js +36 -35
- package/lib/internal/template/expandable-section/styles.scoped.css +81 -66
- package/lib/internal/template/expandable-section/styles.selectors.js +36 -35
- package/lib/internal/template/icon/generated/icons.d.ts +1 -0
- package/lib/internal/template/icon/generated/icons.d.ts.map +1 -1
- package/lib/internal/template/icon/generated/icons.js +2 -0
- package/lib/internal/template/icon/generated/icons.js.map +1 -1
- package/lib/internal/template/icon-provider/interfaces.d.ts +1 -1
- package/lib/internal/template/icon-provider/interfaces.d.ts.map +1 -1
- package/lib/internal/template/icon-provider/interfaces.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +7 -1
- package/lib/internal/template/internal/components/button-trigger/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/button-trigger/index.js +3 -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 +15 -14
- package/lib/internal/template/internal/components/button-trigger/styles.scoped.css +35 -29
- package/lib/internal/template/internal/components/button-trigger/styles.selectors.js +15 -14
- package/lib/internal/template/internal/components/drag-handle/styles.css.js +14 -14
- package/lib/internal/template/internal/components/drag-handle/styles.scoped.css +20 -19
- package/lib/internal/template/internal/components/drag-handle/styles.selectors.js +14 -14
- 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 +6 -3
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.d.ts +2 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js +2 -2
- package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js.map +1 -1
- package/lib/internal/template/internal/components/expand-toggle-button/index.js +2 -2
- package/lib/internal/template/internal/components/expand-toggle-button/index.js.map +1 -1
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/internal/generated/styles/tokens.d.ts +1 -0
- package/lib/internal/template/internal/generated/styles/tokens.js +1 -0
- package/lib/internal/template/internal/generated/theming/index.cjs +33 -0
- package/lib/internal/template/internal/generated/theming/index.cjs.d.ts +9 -0
- package/lib/internal/template/internal/generated/theming/index.d.ts +9 -0
- package/lib/internal/template/internal/generated/theming/index.js +33 -0
- package/lib/internal/template/internal/hooks/use-mouse-down-target.js +2 -2
- package/lib/internal/template/internal/hooks/use-mouse-down-target.js.map +1 -1
- package/lib/internal/template/internal/hooks/use-portal-mode-classes/index.d.ts.map +1 -1
- package/lib/internal/template/internal/hooks/use-portal-mode-classes/index.js +4 -2
- package/lib/internal/template/internal/hooks/use-portal-mode-classes/index.js.map +1 -1
- package/lib/internal/template/internal/hooks/use-visual-mode/index.d.ts +1 -0
- package/lib/internal/template/internal/hooks/use-visual-mode/index.d.ts.map +1 -1
- package/lib/internal/template/internal/hooks/use-visual-mode/index.js +2 -1
- package/lib/internal/template/internal/hooks/use-visual-mode/index.js.map +1 -1
- package/lib/internal/template/status-indicator/internal.d.ts.map +1 -1
- package/lib/internal/template/status-indicator/internal.js +4 -3
- package/lib/internal/template/status-indicator/internal.js.map +1 -1
- package/lib/internal/template/status-indicator/styles.css.js +25 -24
- package/lib/internal/template/status-indicator/styles.scoped.css +75 -40
- package/lib/internal/template/status-indicator/styles.selectors.js +25 -24
- package/lib/internal/template/table/header-cell/group-header-cell.d.ts.map +1 -1
- package/lib/internal/template/table/header-cell/group-header-cell.js +3 -15
- package/lib/internal/template/table/header-cell/group-header-cell.js.map +1 -1
- package/lib/internal/template/table/header-cell/styles.css.js +33 -33
- package/lib/internal/template/table/header-cell/styles.scoped.css +73 -73
- package/lib/internal/template/table/header-cell/styles.selectors.js +33 -33
- package/lib/internal/template/table/header-cell/th-element.d.ts +6 -5
- package/lib/internal/template/table/header-cell/th-element.d.ts.map +1 -1
- package/lib/internal/template/table/header-cell/th-element.js +4 -3
- package/lib/internal/template/table/header-cell/th-element.js.map +1 -1
- package/lib/internal/template/table/sticky-columns/use-sticky-columns.d.ts +2 -1
- package/lib/internal/template/table/sticky-columns/use-sticky-columns.d.ts.map +1 -1
- package/lib/internal/template/table/sticky-columns/use-sticky-columns.js +31 -7
- package/lib/internal/template/table/sticky-columns/use-sticky-columns.js.map +1 -1
- package/lib/internal/template/table/thead.d.ts.map +1 -1
- package/lib/internal/template/table/thead.js +1 -1
- package/lib/internal/template/table/thead.js.map +1 -1
- package/lib/internal/template/test-utils/dom/table/index.js +1 -1
- package/lib/internal/template/test-utils/dom/table/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/table/index.js +1 -1
- package/lib/internal/template/test-utils/selectors/table/index.js.map +1 -1
- package/lib/internal/template/theming/index.d.ts +2 -0
- package/lib/internal/template/theming/index.d.ts.map +1 -1
- package/lib/internal/template/theming/index.js +55 -0
- package/lib/internal/template/theming/index.js.map +1 -1
- package/lib/internal/template/tree-view/tree-item/index.d.ts.map +1 -1
- package/lib/internal/template/tree-view/tree-item/index.js +2 -1
- package/lib/internal/template/tree-view/tree-item/index.js.map +1 -1
- package/lib/internal/template/tree-view/tree-item/styles.css.js +10 -9
- package/lib/internal/template/tree-view/tree-item/styles.scoped.css +19 -12
- package/lib/internal/template/tree-view/tree-item/styles.selectors.js +10 -9
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/button-trigger/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAsB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAyC,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAM7G,OAAO,kBAAkB,MAAM,oCAAoC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AM,EAAE;YACN,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB;KACF,CAAC;IAEF,OAAO,CACL,gCACE,GAAG,EAAE,GAAG,KACJ,UAAU,KACV,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,6BAA6B,CAAC,iBAAiB,CAAC,CAAC;QAEjF,QAAQ;QACR,CAAC,SAAS,IAAI,CACb,8BAAM,SAAS,EAAE,MAAM,CAAC,KAAK;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/button-trigger/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAsB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAyC,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAM7G,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AA0BrC,MAAM,aAAa,GAAG,CACpB,EACE,QAAQ,EACR,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,OAAO,GAAG,KAAK,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,YAAY,EACZ,SAAS,EACT,OAAO,EACP,WAAW,EACX,OAAO,EACP,OAAO,EACP,MAAM,EACN,gBAAgB,GAAG,KAAK,EACxB,SAAS,EACT,GAAG,SAAS,EACO,E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YAAY,IACX,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,mBAAmB,EACxE,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAC1D,OAAO,EAAE,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,GACrD,CACG,CACR,CACM,CACV,CAAC;AACJ,CAAC,CAAC;AAQF,eAAe,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ButtonHTMLAttributes } from 'react';\nimport clsx from 'clsx';\n\nimport { isThemeActive, Theme } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalIcon from '../../../icon/internal';\nimport { BaseComponentProps, getBaseProps } from '../../base-component';\nimport { BaseKeyDetail, CancelableEventHandler, fireCancelableEvent, fireKeyboardEvent } from '../../events';\nimport {\n GeneratedAnalyticsMetadataButtonTriggerCollapse,\n GeneratedAnalyticsMetadataButtonTriggerExpand,\n} from './analytics-metadata/interfaces';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nexport interface ButtonTriggerProps extends BaseComponentProps {\n children?: React.ReactNode;\n pressed?: boolean;\n hideCaret?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n invalid?: boolean;\n warning?: boolean;\n inFilteringToken?: 'root' | 'nested';\n inlineTokens?: boolean;\n ariaHasPopup?: 'true' | 'listbox' | 'dialog';\n ariaControls?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n onKeyDown?: CancelableEventHandler<BaseKeyDetail>;\n onKeyUp?: CancelableEventHandler<BaseKeyDetail>;\n onMouseDown?: CancelableEventHandler;\n onClick?: CancelableEventHandler;\n onFocus?: CancelableEventHandler;\n onBlur?: CancelableEventHandler<{ relatedTarget: Node | null }>;\n hasCustomContent?: boolean;\n autoFocus?: boolean;\n}\n\nconst ButtonTrigger = (\n {\n children,\n pressed,\n hideCaret = false,\n disabled = false,\n readOnly = false,\n invalid = false,\n warning = false,\n inlineTokens,\n inFilteringToken,\n ariaHasPopup,\n ariaLabelledby,\n ariaDescribedby,\n ariaControls,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onClick,\n onFocus,\n onBlur,\n hasCustomContent = false,\n autoFocus,\n ...restProps\n }: ButtonTriggerProps,\n ref: React.Ref<HTMLButtonElement>\n) => {\n const baseProps = getBaseProps(restProps);\n let attributes: ButtonHTMLAttributes<HTMLButtonElement> = {\n ...baseProps,\n type: 'button',\n className: clsx(\n styles['button-trigger'],\n analyticsSelectors['button-trigger'],\n baseProps.className,\n pressed && styles.pressed,\n disabled && styles.disabled,\n invalid && styles.invalid,\n warning && !invalid && styles.warning,\n !hideCaret && styles['has-caret'],\n readOnly && styles.readonly,\n inFilteringToken && styles['in-filtering-token'],\n inFilteringToken && styles[`in-filtering-token-${inFilteringToken}`],\n inlineTokens && styles['inline-tokens'],\n !!hasCustomContent && styles['custom-option']\n ),\n disabled: disabled,\n 'aria-expanded': pressed,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-haspopup': ariaHasPopup ?? 'listbox',\n 'aria-controls': ariaControls,\n 'aria-disabled': readOnly && !disabled ? 'true' : undefined,\n autoFocus,\n };\n\n if (!readOnly) {\n attributes = {\n ...attributes,\n onKeyDown: onKeyDown && (event => fireKeyboardEvent(onKeyDown, event)),\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n onMouseDown: onMouseDown && (event => fireCancelableEvent(onMouseDown, {}, event)),\n onClick: onClick && (event => fireCancelableEvent(onClick, {}, event)),\n onFocus: onFocus && (event => fireCancelableEvent(onFocus, {}, event)),\n onBlur: onBlur && (event => fireCancelableEvent(onBlur, { relatedTarget: event.relatedTarget }, event)),\n };\n }\n\n if (invalid) {\n attributes['aria-invalid'] = invalid;\n }\n\n const analyticsMetadata:\n | GeneratedAnalyticsMetadataButtonTriggerExpand\n | GeneratedAnalyticsMetadataButtonTriggerCollapse = {\n action: !pressed ? 'expand' : 'collapse',\n detail: {\n label: { root: 'self' },\n },\n };\n\n return (\n <button\n ref={ref}\n {...attributes}\n {...(disabled || readOnly ? {} : getAnalyticsMetadataAttribute(analyticsMetadata))}\n >\n {children}\n {!hideCaret && (\n <span className={clsx(styles.arrow, isThemeActive(Theme.OneTheme) && styles['one-theme'])}>\n <InternalIcon\n name={isThemeActive(Theme.OneTheme) ? 'angle-down' : 'caret-down-filled'}\n size={isThemeActive(Theme.OneTheme) ? 'x-small' : 'normal'}\n variant={disabled || readOnly ? 'disabled' : 'normal'}\n />\n </span>\n )}\n </button>\n );\n};\n\nexport namespace ButtonTriggerProps {\n export interface Ref {\n focus(): void;\n }\n}\n\nexport default React.forwardRef(ButtonTrigger);\n"]}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"button-trigger": "awsui_button-
|
|
5
|
-
"arrow": "
|
|
6
|
-
"in-filtering-token-root": "awsui_in-filtering-token-
|
|
7
|
-
"in-filtering-token-nested": "awsui_in-filtering-token-
|
|
8
|
-
"has-caret": "awsui_has-
|
|
9
|
-
"placeholder": "
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
4
|
+
"button-trigger": "awsui_button-trigger_18eso_6h2xj_161",
|
|
5
|
+
"arrow": "awsui_arrow_18eso_6h2xj_161",
|
|
6
|
+
"in-filtering-token-root": "awsui_in-filtering-token-root_18eso_6h2xj_221",
|
|
7
|
+
"in-filtering-token-nested": "awsui_in-filtering-token-nested_18eso_6h2xj_221",
|
|
8
|
+
"has-caret": "awsui_has-caret_18eso_6h2xj_257",
|
|
9
|
+
"placeholder": "awsui_placeholder_18eso_6h2xj_260",
|
|
10
|
+
"one-theme": "awsui_one-theme_18eso_6h2xj_270",
|
|
11
|
+
"pressed": "awsui_pressed_18eso_6h2xj_276",
|
|
12
|
+
"disabled": "awsui_disabled_18eso_6h2xj_282",
|
|
13
|
+
"in-filtering-token": "awsui_in-filtering-token_18eso_6h2xj_221",
|
|
14
|
+
"readonly": "awsui_readonly_18eso_6h2xj_303",
|
|
15
|
+
"invalid": "awsui_invalid_18eso_6h2xj_328",
|
|
16
|
+
"warning": "awsui_warning_18eso_6h2xj_337",
|
|
17
|
+
"custom-option": "awsui_custom-option_18eso_6h2xj_346",
|
|
18
|
+
"inline-tokens": "awsui_inline-tokens_18eso_6h2xj_351"
|
|
18
19
|
};
|
|
19
20
|
|
|
@@ -158,21 +158,21 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
158
158
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
159
159
|
SPDX-License-Identifier: Apache-2.0
|
|
160
160
|
*/
|
|
161
|
-
.awsui_button-
|
|
161
|
+
.awsui_button-trigger_18eso_6h2xj_161 > .awsui_arrow_18eso_6h2xj_161:not(#\9) {
|
|
162
162
|
transition: transform var(--motion-duration-rotate-180-4er9qu, 135ms) var(--motion-easing-rotate-180-xlspcm, cubic-bezier(0.165, 0.84, 0.44, 1));
|
|
163
163
|
}
|
|
164
164
|
@media (prefers-reduced-motion: reduce) {
|
|
165
|
-
.awsui_button-
|
|
165
|
+
.awsui_button-trigger_18eso_6h2xj_161 > .awsui_arrow_18eso_6h2xj_161:not(#\9) {
|
|
166
166
|
animation: none;
|
|
167
167
|
transition: none;
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
.awsui-motion-disabled .awsui_button-
|
|
170
|
+
.awsui-motion-disabled .awsui_button-trigger_18eso_6h2xj_161 > .awsui_arrow_18eso_6h2xj_161:not(#\9), .awsui-mode-entering .awsui_button-trigger_18eso_6h2xj_161 > .awsui_arrow_18eso_6h2xj_161:not(#\9) {
|
|
171
171
|
animation: none;
|
|
172
172
|
transition: none;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
.awsui_button-
|
|
175
|
+
.awsui_button-trigger_18eso_6h2xj_161:not(#\9) {
|
|
176
176
|
border-collapse: separate;
|
|
177
177
|
border-spacing: 0;
|
|
178
178
|
box-sizing: border-box;
|
|
@@ -218,7 +218,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
218
218
|
border-inline: var(--border-width-field-9k1tdz, 1px) solid var(--color-border-input-default-txli8y, #687078);
|
|
219
219
|
min-block-size: var(--size-vertical-input-8gzd1t, 32px);
|
|
220
220
|
}
|
|
221
|
-
.awsui_button-
|
|
221
|
+
.awsui_button-trigger_18eso_6h2xj_161.awsui_in-filtering-token-root_18eso_6h2xj_221:not(#\9), .awsui_button-trigger_18eso_6h2xj_161.awsui_in-filtering-token-nested_18eso_6h2xj_221:not(#\9) {
|
|
222
222
|
padding-block: 0px;
|
|
223
223
|
padding-inline: var(--space-field-horizontal-n5peob, 8px);
|
|
224
224
|
border-block-width: var(--border-width-token-cwl2sl, 1px);
|
|
@@ -229,14 +229,14 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
229
229
|
block-size: 100%;
|
|
230
230
|
min-block-size: unset;
|
|
231
231
|
}
|
|
232
|
-
body[data-awsui-focus-visible=true] .awsui_button-
|
|
232
|
+
body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_6h2xj_161.awsui_in-filtering-token-root_18eso_6h2xj_221:not(#\9):focus, body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_6h2xj_161.awsui_in-filtering-token-nested_18eso_6h2xj_221:not(#\9):focus {
|
|
233
233
|
position: relative;
|
|
234
234
|
}
|
|
235
|
-
body[data-awsui-focus-visible=true] .awsui_button-
|
|
235
|
+
body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_6h2xj_161.awsui_in-filtering-token-root_18eso_6h2xj_221:not(#\9):focus, body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_6h2xj_161.awsui_in-filtering-token-nested_18eso_6h2xj_221:not(#\9):focus {
|
|
236
236
|
outline: 2px dotted transparent;
|
|
237
237
|
outline-offset: calc(var(--space-filtering-token-operation-select-focus-outline-gutter-jo15dc, 0px) - 1px);
|
|
238
238
|
}
|
|
239
|
-
body[data-awsui-focus-visible=true] .awsui_button-
|
|
239
|
+
body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_6h2xj_161.awsui_in-filtering-token-root_18eso_6h2xj_221:not(#\9):focus::before, body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_6h2xj_161.awsui_in-filtering-token-nested_18eso_6h2xj_221:not(#\9):focus::before {
|
|
240
240
|
content: " ";
|
|
241
241
|
display: block;
|
|
242
242
|
position: absolute;
|
|
@@ -250,40 +250,46 @@ body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_1i5rk_161.awsui_
|
|
|
250
250
|
border-end-end-radius: var(--border-radius-control-default-focus-ring-9xsko1, 2px);
|
|
251
251
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-r5f6xl, #0073bb);
|
|
252
252
|
}
|
|
253
|
-
.awsui_button-
|
|
253
|
+
.awsui_button-trigger_18eso_6h2xj_161.awsui_in-filtering-token-nested_18eso_6h2xj_221:not(#\9) {
|
|
254
254
|
border-start-start-radius: calc(var(--border-radius-input-4vr9on, 2px) / 2);
|
|
255
255
|
border-end-start-radius: calc(var(--border-radius-input-4vr9on, 2px) / 2);
|
|
256
256
|
}
|
|
257
|
-
.awsui_button-
|
|
257
|
+
.awsui_button-trigger_18eso_6h2xj_161.awsui_has-caret_18eso_6h2xj_257:not(#\9) {
|
|
258
258
|
padding-inline-end: var(--space-field-icon-offset-ihoxql, 32px);
|
|
259
259
|
}
|
|
260
|
-
.awsui_button-
|
|
260
|
+
.awsui_button-trigger_18eso_6h2xj_161 > .awsui_placeholder_18eso_6h2xj_260:not(#\9) {
|
|
261
261
|
color: var(--color-text-input-placeholder-hvcry0, #687078);
|
|
262
262
|
font-style: italic;
|
|
263
263
|
}
|
|
264
|
-
.awsui_button-
|
|
264
|
+
.awsui_button-trigger_18eso_6h2xj_161 > .awsui_arrow_18eso_6h2xj_161:not(#\9) {
|
|
265
265
|
position: absolute;
|
|
266
266
|
inset-inline-end: var(--space-field-horizontal-n5peob, 8px);
|
|
267
267
|
inset-block-start: calc(50% - var(--line-height-body-m-bedeoh, 22px) / 2);
|
|
268
268
|
color: var(--color-text-button-inline-icon-default-4lrtb0, #545b64);
|
|
269
269
|
}
|
|
270
|
-
.awsui_button-
|
|
270
|
+
.awsui_button-trigger_18eso_6h2xj_161 > .awsui_arrow_18eso_6h2xj_161.awsui_one-theme_18eso_6h2xj_270:not(#\9) {
|
|
271
|
+
inset-block-start: calc(50% - var(--line-height-body-m-bedeoh, 22px) / 2 + var(--space-xxxs-3w1kr2, 2px));
|
|
272
|
+
}
|
|
273
|
+
.awsui_button-trigger_18eso_6h2xj_161:not(#\9):hover > .awsui_arrow_18eso_6h2xj_161 {
|
|
271
274
|
color: var(--color-text-button-inline-icon-hover-8fgg9l, #16191f);
|
|
272
275
|
}
|
|
273
|
-
.awsui_button-
|
|
276
|
+
.awsui_button-trigger_18eso_6h2xj_161.awsui_pressed_18eso_6h2xj_276 > .awsui_arrow_18eso_6h2xj_161:not(#\9) {
|
|
274
277
|
transform: rotate(-180deg);
|
|
275
278
|
}
|
|
276
|
-
.awsui_button-
|
|
279
|
+
.awsui_button-trigger_18eso_6h2xj_161.awsui_pressed_18eso_6h2xj_276 > .awsui_arrow_18eso_6h2xj_161.awsui_one-theme_18eso_6h2xj_270:not(#\9) {
|
|
280
|
+
inset-block-start: calc(50% - var(--line-height-body-m-bedeoh, 22px) / 2 - var(--space-xxxs-3w1kr2, 2px));
|
|
281
|
+
}
|
|
282
|
+
.awsui_button-trigger_18eso_6h2xj_161.awsui_disabled_18eso_6h2xj_282:not(#\9) {
|
|
277
283
|
background-color: var(--color-background-input-disabled-4vlau3, #eaeded);
|
|
278
284
|
border-block: var(--border-width-field-9k1tdz, 1px) solid var(--color-border-input-disabled-tz38ro, #eaeded);
|
|
279
285
|
border-inline: var(--border-width-field-9k1tdz, 1px) solid var(--color-border-input-disabled-tz38ro, #eaeded);
|
|
280
286
|
color: var(--color-text-input-disabled-y5t5v9, #879596);
|
|
281
287
|
cursor: auto;
|
|
282
288
|
}
|
|
283
|
-
.awsui_button-
|
|
289
|
+
.awsui_button-trigger_18eso_6h2xj_161.awsui_disabled_18eso_6h2xj_282 > .awsui_arrow_18eso_6h2xj_161:not(#\9) {
|
|
284
290
|
color: var(--color-text-button-inline-icon-disabled-o6nywg, #aab7b8);
|
|
285
291
|
}
|
|
286
|
-
.awsui_button-
|
|
292
|
+
.awsui_button-trigger_18eso_6h2xj_161.awsui_disabled_18eso_6h2xj_282.awsui_in-filtering-token_18eso_6h2xj_221:not(#\9) {
|
|
287
293
|
background-color: var(--color-background-input-disabled-4vlau3, #eaeded);
|
|
288
294
|
border-block: var(--border-width-token-cwl2sl, 1px) solid var(--color-border-input-disabled-tz38ro, #eaeded);
|
|
289
295
|
border-inline: var(--border-width-token-cwl2sl, 1px) solid var(--color-border-input-disabled-tz38ro, #eaeded);
|
|
@@ -291,23 +297,23 @@ body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_1i5rk_161.awsui_
|
|
|
291
297
|
cursor: auto;
|
|
292
298
|
border-color: var(--color-border-control-disabled-c9dn39, #d5dbdb);
|
|
293
299
|
}
|
|
294
|
-
.awsui_button-
|
|
300
|
+
.awsui_button-trigger_18eso_6h2xj_161.awsui_disabled_18eso_6h2xj_282 > .awsui_placeholder_18eso_6h2xj_260:not(#\9) {
|
|
295
301
|
color: var(--color-text-input-placeholder-disabled-x4lauf, #687078);
|
|
296
302
|
}
|
|
297
|
-
.awsui_button-
|
|
303
|
+
.awsui_button-trigger_18eso_6h2xj_161.awsui_readonly_18eso_6h2xj_303:not(#\9):not(.awsui_button-trigger_18eso_6h2xj_161.awsui_disabled_18eso_6h2xj_282):not(.awsui_button-trigger_18eso_6h2xj_161.awsui_in-filtering-token_18eso_6h2xj_221) {
|
|
298
304
|
background-color: var(--color-background-input-default-1z2buq, #ffffff);
|
|
299
305
|
border-block: var(--border-width-field-9k1tdz, 1px) solid var(--color-border-input-disabled-tz38ro, #eaeded);
|
|
300
306
|
border-inline: var(--border-width-field-9k1tdz, 1px) solid var(--color-border-input-disabled-tz38ro, #eaeded);
|
|
301
307
|
}
|
|
302
|
-
.awsui_button-
|
|
308
|
+
.awsui_button-trigger_18eso_6h2xj_161.awsui_readonly_18eso_6h2xj_303:not(#\9):not(.awsui_button-trigger_18eso_6h2xj_161.awsui_disabled_18eso_6h2xj_282) {
|
|
303
309
|
-webkit-user-select: text;
|
|
304
310
|
user-select: text;
|
|
305
311
|
}
|
|
306
|
-
.awsui_button-
|
|
312
|
+
.awsui_button-trigger_18eso_6h2xj_161:not(#\9):focus {
|
|
307
313
|
outline: none;
|
|
308
314
|
text-decoration: none;
|
|
309
315
|
}
|
|
310
|
-
body[data-awsui-focus-visible=true] .awsui_button-
|
|
316
|
+
body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_6h2xj_161:not(#\9):not(.awsui_in-filtering-token_18eso_6h2xj_221):focus {
|
|
311
317
|
outline: 2px dotted transparent;
|
|
312
318
|
border-block: var(--border-width-field-9k1tdz, 1px) solid var(--color-border-input-focused-lslq4r, #0073bb);
|
|
313
319
|
border-inline: var(--border-width-field-9k1tdz, 1px) solid var(--color-border-input-focused-lslq4r, #0073bb);
|
|
@@ -317,32 +323,32 @@ body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_1i5rk_161:not(#\
|
|
|
317
323
|
border-end-end-radius: var(--border-radius-input-4vr9on, 2px);
|
|
318
324
|
box-shadow: 0 0 0 var(--border-control-focus-ring-shadow-spread-ql2vj7, 1px) var(--color-border-item-focused-r5f6xl, #0073bb);
|
|
319
325
|
}
|
|
320
|
-
.awsui_button-
|
|
326
|
+
.awsui_button-trigger_18eso_6h2xj_161:not(#\9):not(.awsui_in-filtering-token_18eso_6h2xj_221):invalid {
|
|
321
327
|
box-shadow: none;
|
|
322
328
|
}
|
|
323
|
-
.awsui_button-
|
|
329
|
+
.awsui_button-trigger_18eso_6h2xj_161:not(#\9):not(.awsui_in-filtering-token_18eso_6h2xj_221).awsui_invalid_18eso_6h2xj_328, .awsui_button-trigger_18eso_6h2xj_161:not(#\9):not(.awsui_in-filtering-token_18eso_6h2xj_221).awsui_invalid_18eso_6h2xj_328:focus {
|
|
324
330
|
color: var(--color-text-status-error-aknuvu, #d13212);
|
|
325
331
|
border-color: var(--color-text-status-error-aknuvu, #d13212);
|
|
326
332
|
padding-inline-start: calc(var(--space-field-horizontal-n5peob, 8px) - (var(--border-invalid-width-z5cnpo, 4px) - var(--border-width-field-9k1tdz, 1px)));
|
|
327
333
|
border-inline-start-width: var(--border-invalid-width-z5cnpo, 4px);
|
|
328
334
|
}
|
|
329
|
-
.awsui_button-
|
|
335
|
+
.awsui_button-trigger_18eso_6h2xj_161:not(#\9):not(.awsui_in-filtering-token_18eso_6h2xj_221).awsui_invalid_18eso_6h2xj_328:focus, .awsui_button-trigger_18eso_6h2xj_161:not(#\9):not(.awsui_in-filtering-token_18eso_6h2xj_221).awsui_invalid_18eso_6h2xj_328:focus:focus {
|
|
330
336
|
box-shadow: 0 0 0 var(--border-control-invalid-focus-ring-shadow-spread-t0us6n, 1px) var(--color-border-item-focused-r5f6xl, #0073bb);
|
|
331
337
|
}
|
|
332
|
-
.awsui_button-
|
|
338
|
+
.awsui_button-trigger_18eso_6h2xj_161:not(#\9):not(.awsui_in-filtering-token_18eso_6h2xj_221).awsui_warning_18eso_6h2xj_337, .awsui_button-trigger_18eso_6h2xj_161:not(#\9):not(.awsui_in-filtering-token_18eso_6h2xj_221).awsui_warning_18eso_6h2xj_337:focus {
|
|
333
339
|
color: var(--color-text-status-warning-9b45qh, #906806);
|
|
334
340
|
border-color: var(--color-text-status-warning-9b45qh, #906806);
|
|
335
341
|
padding-inline-start: calc(var(--space-field-horizontal-n5peob, 8px) - (var(--border-invalid-width-z5cnpo, 4px) - var(--border-width-field-9k1tdz, 1px)));
|
|
336
342
|
border-inline-start-width: var(--border-invalid-width-z5cnpo, 4px);
|
|
337
343
|
}
|
|
338
|
-
.awsui_button-
|
|
344
|
+
.awsui_button-trigger_18eso_6h2xj_161:not(#\9):not(.awsui_in-filtering-token_18eso_6h2xj_221).awsui_warning_18eso_6h2xj_337:focus, .awsui_button-trigger_18eso_6h2xj_161:not(#\9):not(.awsui_in-filtering-token_18eso_6h2xj_221).awsui_warning_18eso_6h2xj_337:focus:focus {
|
|
339
345
|
box-shadow: 0 0 0 var(--border-control-invalid-focus-ring-shadow-spread-t0us6n, 1px) var(--color-border-item-focused-r5f6xl, #0073bb);
|
|
340
346
|
}
|
|
341
|
-
.awsui_button-
|
|
347
|
+
.awsui_button-trigger_18eso_6h2xj_161.awsui_custom-option_18eso_6h2xj_346:not(#\9) {
|
|
342
348
|
padding-block: 0;
|
|
343
349
|
padding-inline-start: 0;
|
|
344
350
|
overflow: clip;
|
|
345
351
|
}
|
|
346
|
-
.awsui_button-
|
|
352
|
+
.awsui_button-trigger_18eso_6h2xj_161.awsui_inline-tokens_18eso_6h2xj_351:not(#\9) {
|
|
347
353
|
padding-block: 0;
|
|
348
354
|
}
|
|
@@ -2,19 +2,20 @@
|
|
|
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
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
5
|
+
"button-trigger": "awsui_button-trigger_18eso_6h2xj_161",
|
|
6
|
+
"arrow": "awsui_arrow_18eso_6h2xj_161",
|
|
7
|
+
"in-filtering-token-root": "awsui_in-filtering-token-root_18eso_6h2xj_221",
|
|
8
|
+
"in-filtering-token-nested": "awsui_in-filtering-token-nested_18eso_6h2xj_221",
|
|
9
|
+
"has-caret": "awsui_has-caret_18eso_6h2xj_257",
|
|
10
|
+
"placeholder": "awsui_placeholder_18eso_6h2xj_260",
|
|
11
|
+
"one-theme": "awsui_one-theme_18eso_6h2xj_270",
|
|
12
|
+
"pressed": "awsui_pressed_18eso_6h2xj_276",
|
|
13
|
+
"disabled": "awsui_disabled_18eso_6h2xj_282",
|
|
14
|
+
"in-filtering-token": "awsui_in-filtering-token_18eso_6h2xj_221",
|
|
15
|
+
"readonly": "awsui_readonly_18eso_6h2xj_303",
|
|
16
|
+
"invalid": "awsui_invalid_18eso_6h2xj_328",
|
|
17
|
+
"warning": "awsui_warning_18eso_6h2xj_337",
|
|
18
|
+
"custom-option": "awsui_custom-option_18eso_6h2xj_346",
|
|
19
|
+
"inline-tokens": "awsui_inline-tokens_18eso_6h2xj_351"
|
|
19
20
|
};
|
|
20
21
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"handle": "
|
|
5
|
-
"handle-size-normal": "awsui_handle-size-
|
|
6
|
-
"handle-size-small": "awsui_handle-size-
|
|
7
|
-
"handle-drag-indicator": "awsui_handle-drag-
|
|
8
|
-
"handle-disabled": "awsui_handle-
|
|
9
|
-
"active": "
|
|
10
|
-
"handle-resize-area": "awsui_handle-resize-
|
|
11
|
-
"handle-resize-horizontal": "awsui_handle-resize-
|
|
12
|
-
"handle-resize-vertical": "awsui_handle-resize-
|
|
13
|
-
"hide-focus": "awsui_hide-
|
|
14
|
-
"resize-icon": "awsui_resize-
|
|
15
|
-
"resize-icon-vertical": "awsui_resize-icon-
|
|
16
|
-
"resize-icon-horizontal": "awsui_resize-icon-
|
|
17
|
-
"prevent-pointer": "awsui_prevent-
|
|
4
|
+
"handle": "awsui_handle_sdha6_51wrj_145",
|
|
5
|
+
"handle-size-normal": "awsui_handle-size-normal_sdha6_51wrj_153",
|
|
6
|
+
"handle-size-small": "awsui_handle-size-small_sdha6_51wrj_157",
|
|
7
|
+
"handle-drag-indicator": "awsui_handle-drag-indicator_sdha6_51wrj_160",
|
|
8
|
+
"handle-disabled": "awsui_handle-disabled_sdha6_51wrj_160",
|
|
9
|
+
"active": "awsui_active_sdha6_51wrj_163",
|
|
10
|
+
"handle-resize-area": "awsui_handle-resize-area_sdha6_51wrj_166",
|
|
11
|
+
"handle-resize-horizontal": "awsui_handle-resize-horizontal_sdha6_51wrj_173",
|
|
12
|
+
"handle-resize-vertical": "awsui_handle-resize-vertical_sdha6_51wrj_176",
|
|
13
|
+
"hide-focus": "awsui_hide-focus_sdha6_51wrj_186",
|
|
14
|
+
"resize-icon": "awsui_resize-icon_sdha6_51wrj_209",
|
|
15
|
+
"resize-icon-vertical": "awsui_resize-icon-vertical_sdha6_51wrj_215",
|
|
16
|
+
"resize-icon-horizontal": "awsui_resize-icon-horizontal_sdha6_51wrj_219",
|
|
17
|
+
"prevent-pointer": "awsui_prevent-pointer_sdha6_51wrj_223"
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
*/
|
|
143
143
|
/* Style used for links in slots/components that are text heavy, to help links stand out among
|
|
144
144
|
surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
|
|
145
|
-
.
|
|
145
|
+
.awsui_handle_sdha6_51wrj_145:not(#\9) {
|
|
146
146
|
appearance: none;
|
|
147
147
|
color: var(--color-text-interactive-default-qwoe3g, #545b64);
|
|
148
148
|
background: transparent;
|
|
@@ -150,47 +150,47 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
150
150
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
151
151
|
touch-action: none;
|
|
152
152
|
}
|
|
153
|
-
.awsui_handle-size-
|
|
153
|
+
.awsui_handle-size-normal_sdha6_51wrj_153:not(#\9) {
|
|
154
154
|
block-size: var(--line-height-body-m-bedeoh, 22px);
|
|
155
155
|
padding-inline: var(--space-scaled-xxxs-prgw5k, 2px);
|
|
156
156
|
}
|
|
157
|
-
.awsui_handle-size-
|
|
157
|
+
.awsui_handle-size-small_sdha6_51wrj_157:not(#\9) {
|
|
158
158
|
block-size: var(--line-height-body-s-otgtsr, 16px);
|
|
159
159
|
}
|
|
160
|
-
.awsui_handle-drag-
|
|
160
|
+
.awsui_handle-drag-indicator_sdha6_51wrj_160:not(#\9):not(.awsui_handle-disabled_sdha6_51wrj_160) {
|
|
161
161
|
cursor: grab;
|
|
162
162
|
}
|
|
163
|
-
.awsui_handle-drag-
|
|
163
|
+
.awsui_handle-drag-indicator_sdha6_51wrj_160:not(#\9):not(.awsui_handle-disabled_sdha6_51wrj_160).awsui_active_sdha6_51wrj_163 {
|
|
164
164
|
cursor: grabbing;
|
|
165
165
|
}
|
|
166
|
-
.awsui_handle-resize-
|
|
166
|
+
.awsui_handle-resize-area_sdha6_51wrj_166:not(#\9) {
|
|
167
167
|
cursor: nwse-resize;
|
|
168
168
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
169
169
|
}
|
|
170
|
-
.awsui_handle-resize-
|
|
170
|
+
.awsui_handle-resize-area_sdha6_51wrj_166:not(#\9):dir(rtl) {
|
|
171
171
|
cursor: nesw-resize;
|
|
172
172
|
}
|
|
173
|
-
.awsui_handle-resize-
|
|
173
|
+
.awsui_handle-resize-horizontal_sdha6_51wrj_173:not(#\9) {
|
|
174
174
|
cursor: ew-resize;
|
|
175
175
|
}
|
|
176
|
-
.awsui_handle-resize-
|
|
176
|
+
.awsui_handle-resize-vertical_sdha6_51wrj_176:not(#\9) {
|
|
177
177
|
cursor: ns-resize;
|
|
178
178
|
}
|
|
179
|
-
.
|
|
179
|
+
.awsui_handle_sdha6_51wrj_145:not(#\9):hover {
|
|
180
180
|
color: var(--color-text-interactive-hover-bu4gls, #16191f);
|
|
181
181
|
}
|
|
182
|
-
.
|
|
182
|
+
.awsui_handle_sdha6_51wrj_145:not(#\9):focus {
|
|
183
183
|
outline: none;
|
|
184
184
|
text-decoration: none;
|
|
185
185
|
}
|
|
186
|
-
body[data-awsui-focus-visible=true] .
|
|
186
|
+
body[data-awsui-focus-visible=true] .awsui_handle_sdha6_51wrj_145:not(#\9):focus:not(.awsui_hide-focus_sdha6_51wrj_186) {
|
|
187
187
|
position: relative;
|
|
188
188
|
}
|
|
189
|
-
body[data-awsui-focus-visible=true] .
|
|
189
|
+
body[data-awsui-focus-visible=true] .awsui_handle_sdha6_51wrj_145:not(#\9):focus:not(.awsui_hide-focus_sdha6_51wrj_186) {
|
|
190
190
|
outline: 2px dotted transparent;
|
|
191
191
|
outline-offset: calc(0px - 1px);
|
|
192
192
|
}
|
|
193
|
-
body[data-awsui-focus-visible=true] .
|
|
193
|
+
body[data-awsui-focus-visible=true] .awsui_handle_sdha6_51wrj_145:not(#\9):focus:not(.awsui_hide-focus_sdha6_51wrj_186)::before {
|
|
194
194
|
content: " ";
|
|
195
195
|
display: block;
|
|
196
196
|
position: absolute;
|
|
@@ -203,22 +203,23 @@ body[data-awsui-focus-visible=true] .awsui_handle_sdha6_13tiu_145:not(#\9):focus
|
|
|
203
203
|
border-end-start-radius: var(--border-radius-control-default-focus-ring-9xsko1, 2px);
|
|
204
204
|
border-end-end-radius: var(--border-radius-control-default-focus-ring-9xsko1, 2px);
|
|
205
205
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-r5f6xl, #0073bb);
|
|
206
|
+
z-index: 2;
|
|
206
207
|
}
|
|
207
208
|
|
|
208
|
-
.awsui_resize-
|
|
209
|
+
.awsui_resize-icon_sdha6_51wrj_209:not(#\9) {
|
|
209
210
|
stroke: var(--color-text-interactive-default-qwoe3g, #545b64);
|
|
210
211
|
}
|
|
211
|
-
.awsui_resize-
|
|
212
|
+
.awsui_resize-icon_sdha6_51wrj_209:not(#\9):hover {
|
|
212
213
|
stroke: var(--color-text-interactive-hover-bu4gls, #16191f);
|
|
213
214
|
}
|
|
214
|
-
.awsui_resize-icon-
|
|
215
|
+
.awsui_resize-icon-vertical_sdha6_51wrj_215:not(#\9) {
|
|
215
216
|
margin-block: auto;
|
|
216
217
|
margin-inline: auto;
|
|
217
218
|
}
|
|
218
|
-
.awsui_resize-icon-
|
|
219
|
+
.awsui_resize-icon-horizontal_sdha6_51wrj_219:not(#\9) {
|
|
219
220
|
transform: rotate(90deg);
|
|
220
221
|
}
|
|
221
222
|
|
|
222
|
-
.awsui_prevent-
|
|
223
|
+
.awsui_prevent-pointer_sdha6_51wrj_223:not(#\9) {
|
|
223
224
|
pointer-events: none;
|
|
224
225
|
}
|
|
@@ -2,19 +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
|
-
"handle": "
|
|
6
|
-
"handle-size-normal": "awsui_handle-size-
|
|
7
|
-
"handle-size-small": "awsui_handle-size-
|
|
8
|
-
"handle-drag-indicator": "awsui_handle-drag-
|
|
9
|
-
"handle-disabled": "awsui_handle-
|
|
10
|
-
"active": "
|
|
11
|
-
"handle-resize-area": "awsui_handle-resize-
|
|
12
|
-
"handle-resize-horizontal": "awsui_handle-resize-
|
|
13
|
-
"handle-resize-vertical": "awsui_handle-resize-
|
|
14
|
-
"hide-focus": "awsui_hide-
|
|
15
|
-
"resize-icon": "awsui_resize-
|
|
16
|
-
"resize-icon-vertical": "awsui_resize-icon-
|
|
17
|
-
"resize-icon-horizontal": "awsui_resize-icon-
|
|
18
|
-
"prevent-pointer": "awsui_prevent-
|
|
5
|
+
"handle": "awsui_handle_sdha6_51wrj_145",
|
|
6
|
+
"handle-size-normal": "awsui_handle-size-normal_sdha6_51wrj_153",
|
|
7
|
+
"handle-size-small": "awsui_handle-size-small_sdha6_51wrj_157",
|
|
8
|
+
"handle-drag-indicator": "awsui_handle-drag-indicator_sdha6_51wrj_160",
|
|
9
|
+
"handle-disabled": "awsui_handle-disabled_sdha6_51wrj_160",
|
|
10
|
+
"active": "awsui_active_sdha6_51wrj_163",
|
|
11
|
+
"handle-resize-area": "awsui_handle-resize-area_sdha6_51wrj_166",
|
|
12
|
+
"handle-resize-horizontal": "awsui_handle-resize-horizontal_sdha6_51wrj_173",
|
|
13
|
+
"handle-resize-vertical": "awsui_handle-resize-vertical_sdha6_51wrj_176",
|
|
14
|
+
"hide-focus": "awsui_hide-focus_sdha6_51wrj_186",
|
|
15
|
+
"resize-icon": "awsui_resize-icon_sdha6_51wrj_209",
|
|
16
|
+
"resize-icon-vertical": "awsui_resize-icon-vertical_sdha6_51wrj_215",
|
|
17
|
+
"resize-icon-horizontal": "awsui_resize-icon-horizontal_sdha6_51wrj_219",
|
|
18
|
+
"prevent-pointer": "awsui_prevent-pointer_sdha6_51wrj_223"
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,eAwPxB"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useEffect, 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
|
+
import { getLogicalBoundingClientRect, useUniqueId } from '@cloudscape-design/component-toolkit/internal';
|
|
7
7
|
import Tooltip from '../tooltip';
|
|
8
8
|
import DirectionButton from './direction-button';
|
|
9
9
|
import PortalOverlay from './portal-overlay';
|
|
@@ -17,6 +17,9 @@ const DIRECTIONS_ORDER = ['block-end', 'block-start', 'inline-end', 'inline-star
|
|
|
17
17
|
export default function DragHandleWrapper({ directions, tooltipText, children, onDirectionClick, triggerMode = 'focus', initialShowButtons = false, controlledShowButtons = false, wrapperClassName, hideButtonsOnDrag, clickDragThreshold, }) {
|
|
18
18
|
const wrapperRef = useRef(null);
|
|
19
19
|
const dragHandleRef = useRef(null);
|
|
20
|
+
// Links the portaled UAP buttons back to the drag handle's position in the regular DOM,
|
|
21
|
+
// so outside-click / focus detection treats them as belonging to the handle's container.
|
|
22
|
+
const referrerId = useUniqueId('drag-handle');
|
|
20
23
|
const [showTooltip, setShowTooltip] = useState(false);
|
|
21
24
|
const [uncontrolledShowButtons, setUncontrolledShowButtons] = useState(initialShowButtons);
|
|
22
25
|
const isPointerDown = useRef(false);
|
|
@@ -172,11 +175,11 @@ export default function DragHandleWrapper({ directions, tooltipText, children, o
|
|
|
172
175
|
return (React.createElement(React.Fragment, null,
|
|
173
176
|
React.createElement("div", { className: clsx(testUtilsStyles.root, styles.contents), ref: wrapperRef, onFocus: onWrapperFocusIn, onBlur: onWrapperFocusOut },
|
|
174
177
|
React.createElement("div", { className: styles.contents, onPointerEnter: onTooltipGroupPointerEnter, onPointerLeave: onTooltipGroupPointerLeave },
|
|
175
|
-
React.createElement("div", { className: clsx(styles['drag-handle'], wrapperClassName), ref: dragHandleRef, onPointerDown: onHandlePointerDown, onKeyDown: onDragHandleKeyDown }, children),
|
|
178
|
+
React.createElement("div", { className: clsx(styles['drag-handle'], wrapperClassName), ref: dragHandleRef, id: referrerId, onPointerDown: onHandlePointerDown, onKeyDown: onDragHandleKeyDown }, children),
|
|
176
179
|
!isDisabled && !showButtons && showTooltip && tooltipText && (
|
|
177
180
|
// Rendered in a portal but pointerenter/pointerleave events still propagate
|
|
178
181
|
// up the React DOM tree, which is why it's placed in this nested context.
|
|
179
182
|
React.createElement(Tooltip, { trackRef: dragHandleRef, value: tooltipText, onDismiss: () => setShowTooltip(false) })))),
|
|
180
|
-
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 }))))));
|
|
183
|
+
React.createElement(PortalOverlay, { track: dragHandleRef, isDisabled: !showButtons, referrerId: referrerId }, 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 }))))));
|
|
181
184
|
}
|
|
182
185
|
//# 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;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,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,+FAA+F;AAC/F,MAAM,4BAA4B,GAAG,EAAE,CAAC;AACxC,uEAAuE;AACvE,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,gBAAgB,GAAgB,CAAC,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;AAEjG,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,G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AGzB,6BACE,SAAS,EAAE,MAAM,CAAC,QAAQ,EAC1B,cAAc,EAAE,0BAA0B,EAC1C,cAAc,EAAE,0BAA0B;gBAI1C,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,gBAAgB,CAAC,EACxD,GAAG,EAAE,aAAa,EAClB,aAAa,EAAE,mBAAmB,EAClC,SAAS,EAAE,mBAAmB,IAE7B,QAAQ,CACL;gBAEL,CAAC,UAAU,IAAI,CAAC,WAAW,IAAI,WAAW,IAAI,WAAW,IAAI;gBAC5D,4EAA4E;gBAC5E,0EAA0E;gBAC1E,oBAAC,OAAO,IAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,GAAI,CACjG,CACG,CACF;QAEN,oBAAC,aAAa,IAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,WAAW,IAC1D,iBAAiB,CAAC,GAAG,CACpB,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,CACnB,UAAU,CAAC,SAAS,CAAC,IAAI,CACvB,oBAAC,eAAe,IACd,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,CAAC,UAAU,IAAI,WAAW,EAChC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,EAC5B,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAG,SAAS,CAAC,EAC5C,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,KAAK,GAClB,CACH,CACJ,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';\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 // Continuously monitor position while buttons are shown to handle CSS transitions/animations.\n // The position needs to be recalculated as the element may animate into its final position.\n useEffect(() => {\n if (!showButtons || !dragHandleRef.current) {\n if (forcedPosition !== null) {\n setForcedPosition(null);\n }\n return;\n }\n\n let frameId: number;\n\n const checkPosition = () => {\n if (!dragHandleRef.current) {\n return;\n }\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 frameId = requestAnimationFrame(checkPosition);\n };\n\n frameId = requestAnimationFrame(checkPosition);\n\n return () => {\n cancelAnimationFrame(frameId);\n };\n }, [forcedPosition, 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
|
+
{"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;AACxE,OAAO,EAAE,4BAA4B,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE1G,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,+FAA+F;AAC/F,MAAM,4BAA4B,GAAG,EAAE,CAAC;AACxC,uEAAuE;AACvE,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,gBAAgB,GAAgB,CAAC,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;AAEjG,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,UAAU,EACV,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,WAAW,GAAG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UAAU,CAAC,SAAS,CAAC,EAC5B,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAG,SAAS,CAAC,EAC5C,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,KAAK,GAClB,CACH,CACJ,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';\nimport { getLogicalBoundingClientRect, useUniqueId } 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 // Links the portaled UAP buttons back to the drag handle's position in the regular DOM,\n // so outside-click / focus detection treats them as belonging to the handle's container.\n const referrerId = useUniqueId('drag-handle');\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 // Continuously monitor position while buttons are shown to handle CSS transitions/animations.\n // The position needs to be recalculated as the element may animate into its final position.\n useEffect(() => {\n if (!showButtons || !dragHandleRef.current) {\n if (forcedPosition !== null) {\n setForcedPosition(null);\n }\n return;\n }\n\n let frameId: number;\n\n const checkPosition = () => {\n if (!dragHandleRef.current) {\n return;\n }\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 frameId = requestAnimationFrame(checkPosition);\n };\n\n frameId = requestAnimationFrame(checkPosition);\n\n return () => {\n cancelAnimationFrame(frameId);\n };\n }, [forcedPosition, 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 id={referrerId}\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} referrerId={referrerId}>\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"]}
|