@cloudscape-design/components-themeable 3.0.998 → 3.0.1000
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/annotation-context/annotation/styles.scss +3 -3
- package/lib/internal/template/annotation-context/annotation/styles.css.js +24 -24
- package/lib/internal/template/annotation-context/annotation/styles.scoped.css +34 -34
- package/lib/internal/template/annotation-context/annotation/styles.selectors.js +24 -24
- package/lib/internal/template/button-group/analytics-metadata/interfaces.d.ts +10 -0
- package/lib/internal/template/button-group/analytics-metadata/interfaces.d.ts.map +1 -0
- package/lib/internal/template/button-group/analytics-metadata/interfaces.js +4 -0
- package/lib/internal/template/button-group/analytics-metadata/interfaces.js.map +1 -0
- package/lib/internal/template/button-group/index.d.ts.map +1 -1
- package/lib/internal/template/button-group/index.js +6 -1
- package/lib/internal/template/button-group/index.js.map +1 -1
- package/lib/internal/template/button-group/internal.d.ts.map +1 -1
- package/lib/internal/template/button-group/internal.js +2 -2
- package/lib/internal/template/button-group/internal.js.map +1 -1
- package/lib/internal/template/button-group/item-element.d.ts +1 -0
- package/lib/internal/template/button-group/item-element.d.ts.map +1 -1
- package/lib/internal/template/button-group/item-element.js +7 -4
- package/lib/internal/template/button-group/item-element.js.map +1 -1
- package/lib/internal/template/button-group/menu-dropdown-item.d.ts +1 -0
- package/lib/internal/template/button-group/menu-dropdown-item.d.ts.map +1 -1
- package/lib/internal/template/button-group/menu-dropdown-item.js +3 -2
- package/lib/internal/template/button-group/menu-dropdown-item.js.map +1 -1
- package/lib/internal/template/copy-to-clipboard/interfaces.d.ts +10 -0
- package/lib/internal/template/copy-to-clipboard/interfaces.d.ts.map +1 -1
- package/lib/internal/template/copy-to-clipboard/interfaces.js.map +1 -1
- package/lib/internal/template/copy-to-clipboard/internal.d.ts +1 -1
- package/lib/internal/template/copy-to-clipboard/internal.d.ts.map +1 -1
- package/lib/internal/template/copy-to-clipboard/internal.js +3 -3
- package/lib/internal/template/copy-to-clipboard/internal.js.map +1 -1
- package/lib/internal/template/file-input/analytics-metadata/interfaces.d.ts +11 -0
- package/lib/internal/template/file-input/analytics-metadata/interfaces.d.ts.map +1 -0
- package/lib/internal/template/file-input/analytics-metadata/interfaces.js +4 -0
- package/lib/internal/template/file-input/analytics-metadata/interfaces.js.map +1 -0
- package/lib/internal/template/file-input/index.d.ts.map +1 -1
- package/lib/internal/template/file-input/index.js +1 -1
- package/lib/internal/template/file-input/index.js.map +1 -1
- package/lib/internal/template/file-input/internal.d.ts +1 -0
- package/lib/internal/template/file-input/internal.d.ts.map +1 -1
- package/lib/internal/template/file-input/internal.js +12 -2
- package/lib/internal/template/file-input/internal.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +34 -0
- package/lib/internal/template/internal/components/drag-handle/button.js +1 -1
- package/lib/internal/template/internal/components/drag-handle/button.js.map +1 -1
- 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 +2 -0
- package/lib/internal/template/internal/generated/styles/tokens.js +2 -0
- package/lib/internal/template/internal/generated/theming/index.cjs +62 -0
- package/lib/internal/template/internal/generated/theming/index.js +62 -0
- package/lib/internal/template/popover/container.d.ts +1 -1
- package/lib/internal/template/popover/container.d.ts.map +1 -1
- package/lib/internal/template/popover/container.js +7 -1
- package/lib/internal/template/popover/container.js.map +1 -1
- package/lib/internal/template/test-utils/dom/autosuggest/index.js +2 -1
- package/lib/internal/template/test-utils/dom/autosuggest/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/internal/dropdown-host.js +2 -1
- package/lib/internal/template/test-utils/dom/internal/dropdown-host.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/autosuggest/index.js +2 -1
- package/lib/internal/template/test-utils/selectors/autosuggest/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/internal/dropdown-host.js +2 -1
- package/lib/internal/template/test-utils/selectors/internal/dropdown-host.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
+
import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
5
6
|
import InternalButton from '../button/internal';
|
|
6
7
|
import ButtonDropdown from '../button-dropdown/internal';
|
|
7
8
|
import Tooltip from '../internal/components/tooltip';
|
|
8
9
|
import { fireCancelableEvent } from '../internal/events';
|
|
9
10
|
import testUtilStyles from './test-classes/styles.css.js';
|
|
10
|
-
const MenuDropdownItem = React.forwardRef(({ item, showTooltip, onItemClick, onTooltipDismiss, expandToViewport }, ref) => {
|
|
11
|
+
const MenuDropdownItem = React.forwardRef(({ item, showTooltip, onItemClick, onTooltipDismiss, expandToViewport, position }, ref) => {
|
|
11
12
|
const containerRef = React.useRef(null);
|
|
12
13
|
const onClickHandler = (event) => {
|
|
13
14
|
fireCancelableEvent(onItemClick, { id: event.detail.id, checked: event.detail.checked }, event);
|
|
14
15
|
};
|
|
15
|
-
return (React.createElement(ButtonDropdown, { ref: ref, variant: "icon", items: item.items, onItemClick: onClickHandler, expandToViewport: expandToViewport, ariaLabel: item.text, className: testUtilStyles['button-group-item'], "data-testid": item.id, customTriggerBuilder: ({ onClick, isOpen, triggerRef, ariaLabel, ariaExpanded, testUtilsClass }) => (React.createElement("div", { ref: containerRef },
|
|
16
|
+
return (React.createElement(ButtonDropdown, { ref: ref, variant: "icon", items: item.items, onItemClick: onClickHandler, expandToViewport: expandToViewport, ariaLabel: item.text, className: testUtilStyles['button-group-item'], position: position, "data-testid": item.id, disabled: item.disabled, customTriggerBuilder: ({ onClick, isOpen, triggerRef, ariaLabel, ariaExpanded, testUtilsClass }) => (React.createElement("div", Object.assign({ ref: containerRef }, (item.disabled ? {} : getAnalyticsMetadataAttribute({ detail: { position } }))),
|
|
16
17
|
!isOpen && showTooltip && !item.disabled && !item.loading && (React.createElement(Tooltip, { trackRef: containerRef, trackKey: item.id, value: item.text, className: clsx(testUtilStyles.tooltip, testUtilStyles['button-group-tooltip']), onDismiss: onTooltipDismiss })),
|
|
17
18
|
React.createElement(InternalButton, { ref: triggerRef, variant: "icon", ariaLabel: ariaLabel, "data-itemid": item.id, ariaExpanded: ariaExpanded, className: clsx(testUtilStyles.item, testUtilsClass), iconName: "ellipsis", loading: item.loading, loadingText: item.loadingText, disabled: item.disabled, disabledReason: item.disabledReason, onClick: onClick, __title: "" }))) }));
|
|
18
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-dropdown-item.js","sourceRoot":"","sources":["../../../src/button-group/menu-dropdown-item.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAEhD,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,OAAO,OAAO,MAAM,gCAAgC,CAAC;AACrD,OAAO,EAA0B,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGjF,OAAO,cAAc,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"menu-dropdown-item.js","sourceRoot":"","sources":["../../../src/button-group/menu-dropdown-item.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAEhD,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,OAAO,OAAO,MAAM,gCAAgC,CAAC;AACrD,OAAO,EAA0B,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGjF,OAAO,c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AO,IACN,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,IAAI,CAAC,EAAE,EACjB,KAAK,EAAE,IAAI,CAAC,IAAI,EAChB,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC,EAC/E,SAAS,EAAE,gBAAgB,GAC3B,CACH;YACD,oBAAC,cAAc,IACb,GAAG,EAAE,UAAU,EACf,OAAO,EAAC,MAAM,EACd,SAAS,EAAE,SAAS,iBACP,IAAI,CAAC,EAAE,EACpB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,EACpD,QAAQ,EAAC,UAAU,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,cAAc,EAAE,IAAI,CAAC,cAAc,EACnC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAC,EAAE,GACV,CACE,CACP,GACD,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalButton from '../button/internal';\nimport { ButtonDropdownProps } from '../button-dropdown/interfaces';\nimport ButtonDropdown from '../button-dropdown/internal';\nimport Tooltip from '../internal/components/tooltip';\nimport { CancelableEventHandler, fireCancelableEvent } from '../internal/events';\nimport { ButtonGroupProps } from './interfaces';\n\nimport testUtilStyles from './test-classes/styles.css.js';\n\ninterface MenuDropdownItemProps {\n item: ButtonGroupProps.MenuDropdown;\n showTooltip: boolean;\n onTooltipDismiss: () => void;\n onItemClick?: CancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n expandToViewport?: boolean;\n position: string;\n}\n\nconst MenuDropdownItem = React.forwardRef(\n (\n { item, showTooltip, onItemClick, onTooltipDismiss, expandToViewport, position }: MenuDropdownItemProps,\n ref: React.Ref<ButtonDropdownProps.Ref>\n ) => {\n const containerRef = React.useRef<HTMLDivElement>(null);\n const onClickHandler = (event: CustomEvent<ButtonDropdownProps.ItemClickDetails>) => {\n fireCancelableEvent(onItemClick, { id: event.detail.id, checked: event.detail.checked }, event);\n };\n\n return (\n <ButtonDropdown\n ref={ref}\n variant=\"icon\"\n items={item.items}\n onItemClick={onClickHandler}\n expandToViewport={expandToViewport}\n ariaLabel={item.text}\n className={testUtilStyles['button-group-item']}\n position={position}\n data-testid={item.id}\n disabled={item.disabled}\n customTriggerBuilder={({ onClick, isOpen, triggerRef, ariaLabel, ariaExpanded, testUtilsClass }) => (\n <div ref={containerRef} {...(item.disabled ? {} : getAnalyticsMetadataAttribute({ detail: { position } }))}>\n {!isOpen && showTooltip && !item.disabled && !item.loading && (\n <Tooltip\n trackRef={containerRef}\n trackKey={item.id}\n value={item.text}\n className={clsx(testUtilStyles.tooltip, testUtilStyles['button-group-tooltip'])}\n onDismiss={onTooltipDismiss}\n />\n )}\n <InternalButton\n ref={triggerRef}\n variant=\"icon\"\n ariaLabel={ariaLabel}\n data-itemid={item.id}\n ariaExpanded={ariaExpanded}\n className={clsx(testUtilStyles.item, testUtilsClass)}\n iconName=\"ellipsis\"\n loading={item.loading}\n loadingText={item.loadingText}\n disabled={item.disabled}\n disabledReason={item.disabledReason}\n onClick={onClick}\n __title=\"\"\n />\n </div>\n )}\n />\n );\n }\n);\n\nexport default MenuDropdownItem;\n"]}
|
|
@@ -42,6 +42,16 @@ export interface CopyToClipboardProps extends BaseComponentProps {
|
|
|
42
42
|
* Enable this setting if you need the popover to ignore its parent stacking context.
|
|
43
43
|
*/
|
|
44
44
|
popoverRenderWithPortal?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Renders the copy to clipboard button as disabled and prevents clicks.
|
|
47
|
+
*/
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Provides a reason why the copy to clipboard button is disabled (only when `disabled` is `true`).
|
|
51
|
+
* If provided, the copy to clipboard button becomes focusable.
|
|
52
|
+
* Applicable for all variants except inline.
|
|
53
|
+
*/
|
|
54
|
+
disabledReason?: string;
|
|
45
55
|
}
|
|
46
56
|
export declare namespace CopyToClipboardProps {
|
|
47
57
|
type Variant = 'button' | 'icon' | 'inline';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/copy-to-clipboard/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC9D;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC;IAEvC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/copy-to-clipboard/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC9D;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC;IAEvC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,yBAAiB,oBAAoB,CAAC;IACpC,KAAY,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;CACpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/copy-to-clipboard/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface CopyToClipboardProps extends BaseComponentProps {\n /** Determines the general styling of the copy button as follows:\n *\n * * `button` to display a standalone secondary button with an icon, and `copyButtonText` as text.\n * * `icon` to display a standalone icon-only (no text) button.\n * * `inline` to display an icon-only (no text) button within a text context.\n *\n * Defaults to `button`.\n */\n variant?: CopyToClipboardProps.Variant;\n\n /**\n * The text of the copy button (for variant=\"button\").\n */\n copyButtonText?: string;\n\n /**\n * Adds `aria-label` to the copy button. Use this to provide an accessible name for buttons that don't have visible text,\n * and to distinguish between multiple buttons with identical visible text. The text will also be added to the `title` attribute of the button.\n */\n copyButtonAriaLabel?: string;\n\n /**\n * The text content to be copied. It is displayed next to the copy button when `variant=\"inline\"` unless when `content` is specified, and is not shown otherwise.\n */\n textToCopy: string;\n\n /**\n * The text content to display next to the copy button when `variant=\"inline\"`. If not provided, `textToCopy` will be displayed instead.\n */\n textToDisplay?: string;\n\n /**\n * The message shown when the text is copied successfully.\n */\n copySuccessText: string;\n\n /**\n * The message shown when the text is not copied due to an error, see [https://w3c.github.io/clipboard-apis/#dom-clipboard-writetext](https://w3c.github.io/clipboard-apis/#dom-clipboard-writetext).\n */\n copyErrorText: string;\n\n /**\n * By default, the popover is constrained to fit inside its parent\n * [stacking context](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context).\n * Enabling this property will allow the popover to be rendered in the root stack context using\n * [React Portals](https://reactjs.org/docs/portals.html).\n * Enable this setting if you need the popover to ignore its parent stacking context.\n */\n popoverRenderWithPortal?: boolean;\n}\n\nexport namespace CopyToClipboardProps {\n export type Variant = 'button' | 'icon' | 'inline';\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/copy-to-clipboard/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface CopyToClipboardProps extends BaseComponentProps {\n /** Determines the general styling of the copy button as follows:\n *\n * * `button` to display a standalone secondary button with an icon, and `copyButtonText` as text.\n * * `icon` to display a standalone icon-only (no text) button.\n * * `inline` to display an icon-only (no text) button within a text context.\n *\n * Defaults to `button`.\n */\n variant?: CopyToClipboardProps.Variant;\n\n /**\n * The text of the copy button (for variant=\"button\").\n */\n copyButtonText?: string;\n\n /**\n * Adds `aria-label` to the copy button. Use this to provide an accessible name for buttons that don't have visible text,\n * and to distinguish between multiple buttons with identical visible text. The text will also be added to the `title` attribute of the button.\n */\n copyButtonAriaLabel?: string;\n\n /**\n * The text content to be copied. It is displayed next to the copy button when `variant=\"inline\"` unless when `content` is specified, and is not shown otherwise.\n */\n textToCopy: string;\n\n /**\n * The text content to display next to the copy button when `variant=\"inline\"`. If not provided, `textToCopy` will be displayed instead.\n */\n textToDisplay?: string;\n\n /**\n * The message shown when the text is copied successfully.\n */\n copySuccessText: string;\n\n /**\n * The message shown when the text is not copied due to an error, see [https://w3c.github.io/clipboard-apis/#dom-clipboard-writetext](https://w3c.github.io/clipboard-apis/#dom-clipboard-writetext).\n */\n copyErrorText: string;\n\n /**\n * By default, the popover is constrained to fit inside its parent\n * [stacking context](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context).\n * Enabling this property will allow the popover to be rendered in the root stack context using\n * [React Portals](https://reactjs.org/docs/portals.html).\n * Enable this setting if you need the popover to ignore its parent stacking context.\n */\n popoverRenderWithPortal?: boolean;\n\n /**\n * Renders the copy to clipboard button as disabled and prevents clicks.\n */\n disabled?: boolean;\n /**\n * Provides a reason why the copy to clipboard button is disabled (only when `disabled` is `true`).\n * If provided, the copy to clipboard button becomes focusable.\n * Applicable for all variants except inline.\n */\n disabledReason?: string;\n}\n\nexport namespace CopyToClipboardProps {\n export type Variant = 'button' | 'icon' | 'inline';\n}\n"]}
|
|
@@ -3,6 +3,6 @@ import { InternalBaseComponentProps } from '../internal/hooks/use-base-component
|
|
|
3
3
|
import { CopyToClipboardProps } from './interfaces';
|
|
4
4
|
interface InternalCopyToClipboardProps extends CopyToClipboardProps, InternalBaseComponentProps {
|
|
5
5
|
}
|
|
6
|
-
export default function InternalCopyToClipboard({ variant, copyButtonAriaLabel, copyButtonText, copySuccessText, copyErrorText, textToCopy, textToDisplay, popoverRenderWithPortal, __internalRootRef, ...restProps }: InternalCopyToClipboardProps): JSX.Element;
|
|
6
|
+
export default function InternalCopyToClipboard({ variant, copyButtonAriaLabel, copyButtonText, copySuccessText, copyErrorText, textToCopy, textToDisplay, popoverRenderWithPortal, disabled, disabledReason, __internalRootRef, ...restProps }: InternalCopyToClipboardProps): JSX.Element;
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/copy-to-clipboard/internal.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAKpD,UAAU,4BAA6B,SAAQ,oBAAoB,EAAE,0BAA0B;CAAG;AAElG,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,EAC9C,OAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,iBAAwB,EACxB,GAAG,SAAS,EACb,EAAE,4BAA4B,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/copy-to-clipboard/internal.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAKpD,UAAU,4BAA6B,SAAQ,oBAAoB,EAAE,0BAA0B;CAAG;AAElG,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,EAC9C,OAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,QAAQ,EACR,cAAc,EACd,iBAAwB,EACxB,GAAG,SAAS,EACb,EAAE,4BAA4B,eAkF9B"}
|
|
@@ -10,7 +10,7 @@ import InternalStatusIndicator from '../status-indicator/internal';
|
|
|
10
10
|
import styles from './styles.css.js';
|
|
11
11
|
import testStyles from './test-classes/styles.css.js';
|
|
12
12
|
export default function InternalCopyToClipboard(_a) {
|
|
13
|
-
var { variant = 'button', copyButtonAriaLabel, copyButtonText, copySuccessText, copyErrorText, textToCopy, textToDisplay, popoverRenderWithPortal, __internalRootRef = null } = _a, restProps = __rest(_a, ["variant", "copyButtonAriaLabel", "copyButtonText", "copySuccessText", "copyErrorText", "textToCopy", "textToDisplay", "popoverRenderWithPortal", "__internalRootRef"]);
|
|
13
|
+
var { variant = 'button', copyButtonAriaLabel, copyButtonText, copySuccessText, copyErrorText, textToCopy, textToDisplay, popoverRenderWithPortal, disabled, disabledReason, __internalRootRef = null } = _a, restProps = __rest(_a, ["variant", "copyButtonAriaLabel", "copyButtonText", "copySuccessText", "copyErrorText", "textToCopy", "textToDisplay", "popoverRenderWithPortal", "disabled", "disabledReason", "__internalRootRef"]);
|
|
14
14
|
const [status, setStatus] = useState('pending');
|
|
15
15
|
const [statusText, setStatusText] = useState('');
|
|
16
16
|
const baseProps = getBaseProps(restProps);
|
|
@@ -40,8 +40,8 @@ export default function InternalCopyToClipboard(_a) {
|
|
|
40
40
|
inline: 'inline-icon',
|
|
41
41
|
}[variant];
|
|
42
42
|
const isInline = variant === 'inline';
|
|
43
|
-
const
|
|
44
|
-
|
|
43
|
+
const button = (React.createElement(InternalButton, { ariaLabel: copyButtonAriaLabel !== null && copyButtonAriaLabel !== void 0 ? copyButtonAriaLabel : copyButtonText, iconName: "copy", variant: triggerVariant, wrapText: false, formAction: "none", disabled: disabled, disabledReason: disabledReason }, copyButtonText));
|
|
44
|
+
const trigger = disabled ? (button) : (React.createElement(InternalPopover, { isInline: isInline, size: "medium", position: "top", triggerType: "custom", dismissButton: false, renderWithPortal: popoverRenderWithPortal, content: React.createElement(InternalStatusIndicator, { type: status }, statusText), __onOpen: onClick }, button));
|
|
45
45
|
return (React.createElement("span", Object.assign({}, baseProps, { ref: __internalRootRef, className: clsx(baseProps.className, styles.root, testStyles.root) }), isInline ? (React.createElement("span", { className: styles['inline-container'] },
|
|
46
46
|
React.createElement("span", { className: styles['inline-container-trigger'] }, trigger),
|
|
47
47
|
React.createElement("span", { className: clsx(testStyles['text-to-display'], testStyles['text-to-copy']) }, textToDisplay !== null && textToDisplay !== void 0 ? textToDisplay : textToCopy))) : (trigger)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/copy-to-clipboard/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,eAAe,MAAM,qBAAqB,CAAC;AAClD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAGnE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,UAAU,MAAM,8BAA8B,CAAC;AAItD,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/copy-to-clipboard/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,eAAe,MAAM,qBAAqB,CAAC;AAClD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAGnE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,UAAU,MAAM,8BAA8B,CAAC;AAItD,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,EAajB;QAbiB,EAC9C,OAAO,GAAG,QAAQ,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,QAAQ,EACR,cAAc,EACd,iBAAiB,GAAG,IAAI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,QAAQ,EAClB,cAAc,EAAE,cAAc,IAE7B,cAAc,CACA,CAClB,CAAC;IAEF,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CACzB,MAAM,CACP,CAAC,CAAC,CAAC,CACF,oBAAC,eAAe,IACd,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAC,KAAK,EACd,WAAW,EAAC,QAAQ,EACpB,aAAa,EAAE,KAAK,EACpB,gBAAgB,EAAE,uBAAuB,EACzC,OAAO,EAAE,oBAAC,uBAAuB,IAAC,IAAI,EAAE,MAAM,IAAG,UAAU,CAA2B,EACtF,QAAQ,EAAE,OAAO,IAEhB,MAAM,CACS,CACnB,CAAC;IAEF,OAAO,CACL,8CAAU,SAAS,IAAE,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,KAC5G,QAAQ,CAAC,CAAC,CAAC,CACV,8BAAM,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC;QACzC,8BAAM,SAAS,EAAE,MAAM,CAAC,0BAA0B,CAAC,IAAG,OAAO,CAAQ;QACrE,8BAAM,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC,IAC7E,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,UAAU,CACvB,CACF,CACR,CAAC,CAAC,CAAC,CACF,OAAO,CACR,CACI,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\n\nimport InternalButton from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport InternalPopover from '../popover/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { CopyToClipboardProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testStyles from './test-classes/styles.css.js';\n\ninterface InternalCopyToClipboardProps extends CopyToClipboardProps, InternalBaseComponentProps {}\n\nexport default function InternalCopyToClipboard({\n variant = 'button',\n copyButtonAriaLabel,\n copyButtonText,\n copySuccessText,\n copyErrorText,\n textToCopy,\n textToDisplay,\n popoverRenderWithPortal,\n disabled,\n disabledReason,\n __internalRootRef = null,\n ...restProps\n}: InternalCopyToClipboardProps) {\n const [status, setStatus] = useState<'pending' | 'success' | 'error'>('pending');\n const [statusText, setStatusText] = useState('');\n\n const baseProps = getBaseProps(restProps);\n const onClick = () => {\n if (!navigator.clipboard) {\n // The clipboard API is not available in insecure contexts.\n setStatus('error');\n setStatusText(copyErrorText);\n return;\n }\n\n setStatus('pending');\n setStatusText('');\n navigator.clipboard\n .writeText(textToCopy)\n .then(() => {\n setStatus('success');\n setStatusText(copySuccessText);\n })\n .catch(() => {\n setStatus('error');\n setStatusText(copyErrorText);\n });\n };\n\n const triggerVariant = (\n {\n button: 'normal',\n icon: 'icon',\n inline: 'inline-icon',\n } as const\n )[variant];\n\n const isInline = variant === 'inline';\n\n const button = (\n <InternalButton\n ariaLabel={copyButtonAriaLabel ?? copyButtonText}\n iconName=\"copy\"\n variant={triggerVariant}\n wrapText={false}\n formAction=\"none\"\n disabled={disabled}\n disabledReason={disabledReason}\n >\n {copyButtonText}\n </InternalButton>\n );\n\n const trigger = disabled ? (\n button\n ) : (\n <InternalPopover\n isInline={isInline}\n size=\"medium\"\n position=\"top\"\n triggerType=\"custom\"\n dismissButton={false}\n renderWithPortal={popoverRenderWithPortal}\n content={<InternalStatusIndicator type={status}>{statusText}</InternalStatusIndicator>}\n __onOpen={onClick}\n >\n {button}\n </InternalPopover>\n );\n\n return (\n <span {...baseProps} ref={__internalRootRef} className={clsx(baseProps.className, styles.root, testStyles.root)}>\n {isInline ? (\n <span className={styles['inline-container']}>\n <span className={styles['inline-container-trigger']}>{trigger}</span>\n <span className={clsx(testStyles['text-to-display'], testStyles['text-to-copy'])}>\n {textToDisplay ?? textToCopy}\n </span>\n </span>\n ) : (\n trigger\n )}\n </span>\n );\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface GeneratedAnalyticsMetadataFileInputClick {
|
|
2
|
+
action: 'click';
|
|
3
|
+
detail: {
|
|
4
|
+
label: string;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export interface GeneratedAnalyticsMetadataFileInputComponent {
|
|
8
|
+
name: 'awsui.FileInput';
|
|
9
|
+
label: string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/file-input/analytics-metadata/interfaces.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,wCAAwC;IACvD,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,4CAA4C;IAC3D,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/file-input/analytics-metadata/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport interface GeneratedAnalyticsMetadataFileInputClick {\n action: 'click';\n detail: {\n label: string;\n };\n}\n\nexport interface GeneratedAnalyticsMetadataFileInputComponent {\n name: 'awsui.FileInput';\n label: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/file-input/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,QAAA,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/file-input/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,QAAA,MAAM,SAAS,2FAmBd,CAAC;AAGF,eAAe,SAAS,CAAC"}
|
|
@@ -13,7 +13,7 @@ const FileInput = React.forwardRef((_a, ref) => {
|
|
|
13
13
|
variant,
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
|
-
return React.createElement(InternalFileInput, Object.assign({ multiple: multiple, variant: variant }, props, baseComponentProps, { ref: ref }));
|
|
16
|
+
return (React.createElement(InternalFileInput, Object.assign({ multiple: multiple, variant: variant }, props, baseComponentProps, { ref: ref, __injectAnalyticsComponentMetadata: true })));
|
|
17
17
|
});
|
|
18
18
|
applyDisplayName(FileInput, 'FileInput');
|
|
19
19
|
export default FileInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/file-input/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,iBAAiB,MAAM,YAAY,CAAC;AAI3C,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAChC,CAAC,EAA+C,EAAE,GAAkC,EAAE,EAAE;QAAvF,EAAE,QAAQ,EAAE,OAAO,OAA4B,EAAvB,KAAK,cAA7B,uBAA+B,CAAF;IAC5B,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,WAAW,EAAE;QACvD,KAAK,EAAE;YACL,QAAQ;YACR,OAAO;SACR;KACF,CAAC,CAAC;IACH,OAAO,oBAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/file-input/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,iBAAiB,MAAM,YAAY,CAAC;AAI3C,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAChC,CAAC,EAA+C,EAAE,GAAkC,EAAE,EAAE;QAAvF,EAAE,QAAQ,EAAE,OAAO,OAA4B,EAAvB,KAAK,cAA7B,uBAA+B,CAAF;IAC5B,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,WAAW,EAAE;QACvD,KAAK,EAAE;YACL,QAAQ;YACR,OAAO;SACR;KACF,CAAC,CAAC;IACH,OAAO,CACL,oBAAC,iBAAiB,kBAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,IACZ,KAAK,EACL,kBAAkB,IACtB,GAAG,EAAE,GAAG,EACR,kCAAkC,EAAE,IAAI,IACxC,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AACzC,eAAe,SAAS,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { FileInputProps } from './interfaces';\nimport InternalFileInput from './internal';\n\nexport { FileInputProps };\n\nconst FileInput = React.forwardRef(\n ({ multiple, variant, ...props }: FileInputProps, ref: React.Ref<FileInputProps.Ref>) => {\n const baseComponentProps = useBaseComponent('FileInput', {\n props: {\n multiple,\n variant,\n },\n });\n return (\n <InternalFileInput\n multiple={multiple}\n variant={variant}\n {...props}\n {...baseComponentProps}\n ref={ref}\n __injectAnalyticsComponentMetadata={true}\n />\n );\n }\n);\n\napplyDisplayName(FileInput, 'FileInput');\nexport default FileInput;\n"]}
|
|
@@ -4,6 +4,7 @@ import { FileInputProps } from './interfaces';
|
|
|
4
4
|
interface InternalFileInputProps {
|
|
5
5
|
__inputClassName?: string;
|
|
6
6
|
__inputNativeAttributes?: React.InputHTMLAttributes<HTMLInputElement> | Record<`data-${string}`, string>;
|
|
7
|
+
__injectAnalyticsComponentMetadata?: boolean;
|
|
7
8
|
}
|
|
8
9
|
declare const InternalFileInput: React.ForwardRefExoticComponent<FileInputProps & InternalBaseComponentProps<any> & InternalFileInputProps & React.RefAttributes<FileInputProps.Ref>>;
|
|
9
10
|
export default InternalFileInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/file-input/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAwD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/file-input/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAwD,MAAM,OAAO,CAAC;AAiB7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAI3F,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI9C,UAAU,sBAAsB;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uBAAuB,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC;IACzG,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED,QAAA,MAAM,iBAAiB,sJAuItB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { __rest } from "tslib";
|
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';
|
|
7
|
+
import { getAnalyticsMetadataAttribute, } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
7
8
|
import InternalButton from '../button/internal';
|
|
8
9
|
import { useFormFieldContext } from '../contexts/form-field';
|
|
9
10
|
import { getBaseProps } from '../internal/base-component/index.js';
|
|
@@ -17,7 +18,7 @@ import { joinStrings } from '../internal/utils/strings';
|
|
|
17
18
|
import styles from './styles.css.js';
|
|
18
19
|
const InternalFileInput = React.forwardRef((_a, ref) => {
|
|
19
20
|
var _b;
|
|
20
|
-
var { accept, ariaRequired, ariaLabel, multiple = false, value, onChange, variant = 'button', children, __internalRootRef = null, __inputClassName, __inputNativeAttributes } = _a, restProps = __rest(_a, ["accept", "ariaRequired", "ariaLabel", "multiple", "value", "onChange", "variant", "children", "__internalRootRef", "__inputClassName", "__inputNativeAttributes"]);
|
|
21
|
+
var { accept, ariaRequired, ariaLabel, multiple = false, value, onChange, variant = 'button', children, __internalRootRef = null, __inputClassName, __inputNativeAttributes, __injectAnalyticsComponentMetadata } = _a, restProps = __rest(_a, ["accept", "ariaRequired", "ariaLabel", "multiple", "value", "onChange", "variant", "children", "__internalRootRef", "__inputClassName", "__inputNativeAttributes", "__injectAnalyticsComponentMetadata"]);
|
|
21
22
|
const baseProps = getBaseProps(restProps);
|
|
22
23
|
const uploadInputRef = useRef(null);
|
|
23
24
|
const containerRef = useRef(null);
|
|
@@ -64,7 +65,16 @@ const InternalFileInput = React.forwardRef((_a, ref) => {
|
|
|
64
65
|
}
|
|
65
66
|
}, [value]);
|
|
66
67
|
const { tabIndex } = useSingleTabStopNavigation(uploadInputRef);
|
|
67
|
-
|
|
68
|
+
const analyticsLabel = variant === 'button' && children ? 'button' : 'input';
|
|
69
|
+
const componentAnalyticsMetadata = {
|
|
70
|
+
name: 'awsui.FileInput',
|
|
71
|
+
label: analyticsLabel,
|
|
72
|
+
};
|
|
73
|
+
const analyticsMetadata = { detail: { label: analyticsLabel } };
|
|
74
|
+
if (__injectAnalyticsComponentMetadata) {
|
|
75
|
+
analyticsMetadata.component = componentAnalyticsMetadata;
|
|
76
|
+
}
|
|
77
|
+
return (React.createElement("div", Object.assign({}, baseProps, { ref: mergedRef, className: clsx(baseProps.className, styles.root) }, getAnalyticsMetadataAttribute(analyticsMetadata)),
|
|
68
78
|
React.createElement("input", Object.assign({ id: controlId, ref: uploadInputRef, type: "file", hidden: false, multiple: multiple, accept: accept, onChange: onUploadInputChange, onFocus: onUploadInputFocus, onBlur: onUploadInputBlur, className: clsx(styles['file-input'], styles.hidden, __inputClassName), tabIndex: tabIndex }, nativeAttributes)),
|
|
69
79
|
React.createElement(InternalButton, { iconName: "upload", variant: variant === 'icon' ? 'icon' : undefined, formAction: "none", onClick: onUploadButtonClick, className: clsx(styles['file-input-button'], {
|
|
70
80
|
[styles['force-focus-outline-button']]: isFocused && variant === 'button',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/file-input/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAoB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,gBAAgB,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EAAE,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE;gBAC3C,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAC,EAAE,SAAS,IAAI,OAAO,KAAK,QAAQ;gBACzE,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,EAAE,SAAS,IAAI,OAAO,KAAK,MAAM;aACtE,CAAC,EACF,kBAAkB,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,IAExD,OAAO,KAAK,QAAQ,IAAI,QAAQ,CAClB;QAGjB,oBAAC,gBAAgB,IAAC,EAAE,EAAE,mBAAmB,IAAG,SAAS,IAAI,QAAQ,CAAoB,CACjF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { ChangeEvent, Ref, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalButton from '../button/internal';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport { getBaseProps } from '../internal/base-component/index.js';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { joinStrings } from '../internal/utils/strings';\nimport { FileInputProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface InternalFileInputProps {\n __inputClassName?: string;\n __inputNativeAttributes?: React.InputHTMLAttributes<HTMLInputElement> | Record<`data-${string}`, string>;\n}\n\nconst InternalFileInput = React.forwardRef(\n (\n {\n accept,\n ariaRequired,\n ariaLabel,\n multiple = false,\n value,\n onChange,\n variant = 'button',\n children,\n __internalRootRef = null,\n __inputClassName,\n __inputNativeAttributes,\n ...restProps\n }: FileInputProps & InternalBaseComponentProps & InternalFileInputProps,\n ref: Ref<FileInputProps.Ref>\n ) => {\n const baseProps = getBaseProps(restProps);\n const uploadInputRef = useRef<HTMLInputElement>(null);\n const containerRef = useRef<HTMLButtonElement>(null);\n const mergedRef = useMergeRefs(__internalRootRef, containerRef);\n\n const uploadButtonLabelId = useUniqueId('upload-button-label');\n const formFieldContext = useFormFieldContext(restProps);\n const selfControlId = useUniqueId('upload-input');\n const controlId = formFieldContext.controlId ?? selfControlId;\n\n useForwardFocus(ref, uploadInputRef);\n\n const [isFocused, setIsFocused] = useState(false);\n const onUploadButtonClick = () => uploadInputRef.current?.click();\n const onUploadInputFocus = () => {\n setIsFocused(true);\n containerRef.current?.scrollIntoView?.();\n };\n const onUploadInputBlur = () => setIsFocused(false);\n\n const onUploadInputChange = ({ target }: ChangeEvent<HTMLInputElement>) => {\n fireNonCancelableEvent(onChange, { value: target.files ? Array.from(target.files) : [] });\n };\n\n checkControlled('FileInput', 'value', value, 'onChange', onChange);\n\n const nativeAttributes: React.HTMLAttributes<HTMLInputElement> = {\n 'aria-label': ariaLabel || children,\n 'aria-labelledby': joinStrings(formFieldContext.ariaLabelledby, uploadButtonLabelId),\n 'aria-describedby': formFieldContext.ariaDescribedby,\n ...__inputNativeAttributes,\n };\n if (formFieldContext.invalid) {\n nativeAttributes['aria-invalid'] = true;\n }\n if (ariaRequired) {\n nativeAttributes['aria-required'] = true;\n }\n\n if (variant === 'icon' && !ariaLabel) {\n warnOnce('FileInput', 'Aria label is required with icon variant.');\n }\n\n // Synchronizing component's value with the native file input state.\n useEffect(() => {\n /* istanbul ignore next: The DataTransfer is not available in jsdom. */\n if (window.DataTransfer) {\n const dataTransfer = new DataTransfer();\n for (const file of value) {\n dataTransfer.items.add(file);\n }\n uploadInputRef.current!.files = dataTransfer.files;\n }\n if (uploadInputRef.current) {\n uploadInputRef.current.value = ''; // reset value to allow calling onChange when the same file is uploaded again\n }\n }, [value]);\n\n const { tabIndex } = useSingleTabStopNavigation(uploadInputRef);\n\n return (\n <div {...baseProps} ref={mergedRef} className={clsx(baseProps.className, styles.root)}>\n {/* This is the actual interactive and accessible file-upload element. */}\n {/* It is visually hidden to achieve the desired UX design. */}\n <input\n id={controlId}\n ref={uploadInputRef}\n type=\"file\"\n hidden={false}\n multiple={multiple}\n accept={accept}\n onChange={onUploadInputChange}\n onFocus={onUploadInputFocus}\n onBlur={onUploadInputBlur}\n className={clsx(styles['file-input'], styles.hidden, __inputClassName)}\n tabIndex={tabIndex}\n {...nativeAttributes}\n />\n\n {/* The button is decorative. It dispatches clicks to the file input and is ARIA-hidden. */}\n {/* When the input is focused the focus outline is forced on the button. */}\n <InternalButton\n iconName=\"upload\"\n variant={variant === 'icon' ? 'icon' : undefined}\n formAction=\"none\"\n onClick={onUploadButtonClick}\n className={clsx(styles['file-input-button'], {\n [styles['force-focus-outline-button']]: isFocused && variant === 'button',\n [styles['force-focus-outline-icon']]: isFocused && variant === 'icon',\n })}\n __nativeAttributes={{ tabIndex: -1, 'aria-hidden': true }}\n >\n {variant === 'button' && children}\n </InternalButton>\n\n {/* The file input needs to be labelled with provided content. Can't use the button because it is ARIA-hidden. */}\n <ScreenreaderOnly id={uploadButtonLabelId}>{ariaLabel || children}</ScreenreaderOnly>\n </div>\n );\n }\n);\n\nexport default InternalFileInput;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/file-input/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAoB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,+CAA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port React, { ChangeEvent, Ref, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport {\n GeneratedAnalyticsMetadataFragment,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalButton from '../button/internal';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport { getBaseProps } from '../internal/base-component/index.js';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { joinStrings } from '../internal/utils/strings';\nimport { GeneratedAnalyticsMetadataFileInputComponent } from './analytics-metadata/interfaces';\nimport { FileInputProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface InternalFileInputProps {\n __inputClassName?: string;\n __inputNativeAttributes?: React.InputHTMLAttributes<HTMLInputElement> | Record<`data-${string}`, string>;\n __injectAnalyticsComponentMetadata?: boolean;\n}\n\nconst InternalFileInput = React.forwardRef(\n (\n {\n accept,\n ariaRequired,\n ariaLabel,\n multiple = false,\n value,\n onChange,\n variant = 'button',\n children,\n __internalRootRef = null,\n __inputClassName,\n __inputNativeAttributes,\n __injectAnalyticsComponentMetadata,\n ...restProps\n }: FileInputProps & InternalBaseComponentProps & InternalFileInputProps,\n ref: Ref<FileInputProps.Ref>\n ) => {\n const baseProps = getBaseProps(restProps);\n const uploadInputRef = useRef<HTMLInputElement>(null);\n const containerRef = useRef<HTMLButtonElement>(null);\n const mergedRef = useMergeRefs(__internalRootRef, containerRef);\n\n const uploadButtonLabelId = useUniqueId('upload-button-label');\n const formFieldContext = useFormFieldContext(restProps);\n const selfControlId = useUniqueId('upload-input');\n const controlId = formFieldContext.controlId ?? selfControlId;\n\n useForwardFocus(ref, uploadInputRef);\n\n const [isFocused, setIsFocused] = useState(false);\n const onUploadButtonClick = () => uploadInputRef.current?.click();\n const onUploadInputFocus = () => {\n setIsFocused(true);\n containerRef.current?.scrollIntoView?.();\n };\n const onUploadInputBlur = () => setIsFocused(false);\n\n const onUploadInputChange = ({ target }: ChangeEvent<HTMLInputElement>) => {\n fireNonCancelableEvent(onChange, { value: target.files ? Array.from(target.files) : [] });\n };\n\n checkControlled('FileInput', 'value', value, 'onChange', onChange);\n\n const nativeAttributes: React.HTMLAttributes<HTMLInputElement> = {\n 'aria-label': ariaLabel || children,\n 'aria-labelledby': joinStrings(formFieldContext.ariaLabelledby, uploadButtonLabelId),\n 'aria-describedby': formFieldContext.ariaDescribedby,\n ...__inputNativeAttributes,\n };\n if (formFieldContext.invalid) {\n nativeAttributes['aria-invalid'] = true;\n }\n if (ariaRequired) {\n nativeAttributes['aria-required'] = true;\n }\n\n if (variant === 'icon' && !ariaLabel) {\n warnOnce('FileInput', 'Aria label is required with icon variant.');\n }\n\n // Synchronizing component's value with the native file input state.\n useEffect(() => {\n /* istanbul ignore next: The DataTransfer is not available in jsdom. */\n if (window.DataTransfer) {\n const dataTransfer = new DataTransfer();\n for (const file of value) {\n dataTransfer.items.add(file);\n }\n uploadInputRef.current!.files = dataTransfer.files;\n }\n if (uploadInputRef.current) {\n uploadInputRef.current.value = ''; // reset value to allow calling onChange when the same file is uploaded again\n }\n }, [value]);\n\n const { tabIndex } = useSingleTabStopNavigation(uploadInputRef);\n\n const analyticsLabel = variant === 'button' && children ? 'button' : 'input';\n const componentAnalyticsMetadata: GeneratedAnalyticsMetadataFileInputComponent = {\n name: 'awsui.FileInput',\n label: analyticsLabel,\n };\n\n const analyticsMetadata: GeneratedAnalyticsMetadataFragment = { detail: { label: analyticsLabel } };\n if (__injectAnalyticsComponentMetadata) {\n analyticsMetadata.component = componentAnalyticsMetadata;\n }\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(baseProps.className, styles.root)}\n {...getAnalyticsMetadataAttribute(analyticsMetadata)}\n >\n {/* This is the actual interactive and accessible file-upload element. */}\n {/* It is visually hidden to achieve the desired UX design. */}\n <input\n id={controlId}\n ref={uploadInputRef}\n type=\"file\"\n hidden={false}\n multiple={multiple}\n accept={accept}\n onChange={onUploadInputChange}\n onFocus={onUploadInputFocus}\n onBlur={onUploadInputBlur}\n className={clsx(styles['file-input'], styles.hidden, __inputClassName)}\n tabIndex={tabIndex}\n {...nativeAttributes}\n />\n\n {/* The button is decorative. It dispatches clicks to the file input and is ARIA-hidden. */}\n {/* When the input is focused the focus outline is forced on the button. */}\n <InternalButton\n iconName=\"upload\"\n variant={variant === 'icon' ? 'icon' : undefined}\n formAction=\"none\"\n onClick={onUploadButtonClick}\n className={clsx(styles['file-input-button'], {\n [styles['force-focus-outline-button']]: isFocused && variant === 'button',\n [styles['force-focus-outline-icon']]: isFocused && variant === 'icon',\n })}\n __nativeAttributes={{ tabIndex: -1, 'aria-hidden': true }}\n >\n {variant === 'button' && children}\n </InternalButton>\n\n {/* The file input needs to be labelled with provided content. Can't use the button because it is ARIA-hidden. */}\n <ScreenreaderOnly id={uploadButtonLabelId}>{ariaLabel || children}</ScreenreaderOnly>\n </div>\n );\n }\n);\n\nexport default InternalFileInput;\n"]}
|
|
@@ -418,6 +418,8 @@
|
|
|
418
418
|
--color-text-status-success-vmys4n:#1d8102;
|
|
419
419
|
--color-text-status-warning-75jmgn:#906806;
|
|
420
420
|
--color-text-top-navigation-title-50mcr5:#16191f;
|
|
421
|
+
--color-text-tutorial-hotspot-default-r59hr8:#0073bb;
|
|
422
|
+
--color-text-tutorial-hotspot-hover-r1skao:#0a4a74;
|
|
421
423
|
--color-board-placeholder-active-oe22ia:#d5dbdb;
|
|
422
424
|
--color-board-placeholder-hover-jxjr60:#99cbe4;
|
|
423
425
|
--color-drag-placeholder-active-mhklvu:#d5dbdb;
|
|
@@ -1035,6 +1037,8 @@
|
|
|
1035
1037
|
--color-text-status-success-vmys4n:#6aaf35;
|
|
1036
1038
|
--color-text-status-warning-75jmgn:#fbd332;
|
|
1037
1039
|
--color-text-top-navigation-title-50mcr5:#fafafa;
|
|
1040
|
+
--color-text-tutorial-hotspot-default-r59hr8:#44b9d6;
|
|
1041
|
+
--color-text-tutorial-hotspot-hover-r1skao:#99cbe4;
|
|
1038
1042
|
--color-board-placeholder-active-oe22ia:#687078;
|
|
1039
1043
|
--color-board-placeholder-hover-jxjr60:#0073bb;
|
|
1040
1044
|
--color-drag-placeholder-active-mhklvu:#687078;
|
|
@@ -1354,6 +1358,8 @@
|
|
|
1354
1358
|
--color-text-status-success-vmys4n:#6aaf35;
|
|
1355
1359
|
--color-text-status-warning-75jmgn:#fbd332;
|
|
1356
1360
|
--color-text-top-navigation-title-50mcr5:#fafafa;
|
|
1361
|
+
--color-text-tutorial-hotspot-default-r59hr8:#44b9d6;
|
|
1362
|
+
--color-text-tutorial-hotspot-hover-r1skao:#99cbe4;
|
|
1357
1363
|
--color-board-placeholder-active-oe22ia:#687078;
|
|
1358
1364
|
--color-board-placeholder-hover-jxjr60:#0073bb;
|
|
1359
1365
|
--color-drag-placeholder-active-mhklvu:#687078;
|
|
@@ -1386,6 +1392,8 @@
|
|
|
1386
1392
|
--color-text-expandable-section-default-15nt1e:#fafafa;
|
|
1387
1393
|
--color-text-expandable-section-hover-3n2kpp:#fafafa;
|
|
1388
1394
|
--color-text-heading-secondary-p3brnl:#fafafa;
|
|
1395
|
+
--color-text-tutorial-hotspot-default-r59hr8:#d5dbdb;
|
|
1396
|
+
--color-text-tutorial-hotspot-hover-r1skao:#fafafa;
|
|
1389
1397
|
}
|
|
1390
1398
|
|
|
1391
1399
|
.awsui-context-flashbar-warning:not(#\9) {
|
|
@@ -1409,6 +1417,8 @@
|
|
|
1409
1417
|
--color-text-interactive-inverted-hover-p0x69h:#16191f;
|
|
1410
1418
|
--color-text-link-inverted-hover-7jk1d1:#16191f;
|
|
1411
1419
|
--color-text-notification-default-fmebm4:#16191f;
|
|
1420
|
+
--color-text-tutorial-hotspot-default-r59hr8:#687078;
|
|
1421
|
+
--color-text-tutorial-hotspot-hover-r1skao:#131920;
|
|
1412
1422
|
}
|
|
1413
1423
|
|
|
1414
1424
|
.awsui-context-alert:not(#\9) {
|
|
@@ -1723,6 +1733,8 @@
|
|
|
1723
1733
|
--color-text-status-success-vmys4n:#00802f;
|
|
1724
1734
|
--color-text-status-warning-75jmgn:#855900;
|
|
1725
1735
|
--color-text-top-navigation-title-50mcr5:#0f141a;
|
|
1736
|
+
--color-text-tutorial-hotspot-default-r59hr8:#006ce0;
|
|
1737
|
+
--color-text-tutorial-hotspot-hover-r1skao:#002b66;
|
|
1726
1738
|
--color-board-placeholder-active-oe22ia:#ebebf0;
|
|
1727
1739
|
--color-board-placeholder-hover-jxjr60:#d1f1ff;
|
|
1728
1740
|
--color-drag-placeholder-active-mhklvu:#ebebf0;
|
|
@@ -2087,6 +2099,8 @@
|
|
|
2087
2099
|
--color-text-status-success-vmys4n:#2bb534;
|
|
2088
2100
|
--color-text-status-warning-75jmgn:#fbd332;
|
|
2089
2101
|
--color-text-top-navigation-title-50mcr5:#f9f9fa;
|
|
2102
|
+
--color-text-tutorial-hotspot-default-r59hr8:#42b4ff;
|
|
2103
|
+
--color-text-tutorial-hotspot-hover-r1skao:#75cfff;
|
|
2090
2104
|
--color-board-placeholder-active-oe22ia:#656871;
|
|
2091
2105
|
--color-board-placeholder-hover-jxjr60:#006ce0;
|
|
2092
2106
|
--color-drag-placeholder-active-mhklvu:#656871;
|
|
@@ -2375,6 +2389,8 @@
|
|
|
2375
2389
|
--color-text-status-info-q591kt:#42b4ff;
|
|
2376
2390
|
--color-text-status-success-vmys4n:#2bb534;
|
|
2377
2391
|
--color-text-top-navigation-title-50mcr5:#f9f9fa;
|
|
2392
|
+
--color-text-tutorial-hotspot-default-r59hr8:#42b4ff;
|
|
2393
|
+
--color-text-tutorial-hotspot-hover-r1skao:#75cfff;
|
|
2378
2394
|
--color-board-placeholder-active-oe22ia:#656871;
|
|
2379
2395
|
--color-board-placeholder-hover-jxjr60:#006ce0;
|
|
2380
2396
|
--color-drag-placeholder-active-mhklvu:#656871;
|
|
@@ -2583,6 +2599,8 @@
|
|
|
2583
2599
|
--color-text-status-success-vmys4n:#2bb534;
|
|
2584
2600
|
--color-text-status-warning-75jmgn:#fbd332;
|
|
2585
2601
|
--color-text-top-navigation-title-50mcr5:#f9f9fa;
|
|
2602
|
+
--color-text-tutorial-hotspot-default-r59hr8:#42b4ff;
|
|
2603
|
+
--color-text-tutorial-hotspot-hover-r1skao:#75cfff;
|
|
2586
2604
|
--color-board-placeholder-active-oe22ia:#656871;
|
|
2587
2605
|
--color-board-placeholder-hover-jxjr60:#006ce0;
|
|
2588
2606
|
--color-drag-placeholder-active-mhklvu:#656871;
|
|
@@ -2795,6 +2813,8 @@
|
|
|
2795
2813
|
--color-text-status-success-vmys4n:#2bb534;
|
|
2796
2814
|
--color-text-status-warning-75jmgn:#fbd332;
|
|
2797
2815
|
--color-text-top-navigation-title-50mcr5:#f9f9fa;
|
|
2816
|
+
--color-text-tutorial-hotspot-default-r59hr8:#42b4ff;
|
|
2817
|
+
--color-text-tutorial-hotspot-hover-r1skao:#75cfff;
|
|
2798
2818
|
--color-board-placeholder-active-oe22ia:#656871;
|
|
2799
2819
|
--color-board-placeholder-hover-jxjr60:#006ce0;
|
|
2800
2820
|
--color-drag-placeholder-active-mhklvu:#656871;
|
|
@@ -3019,6 +3039,8 @@
|
|
|
3019
3039
|
--color-text-status-success-vmys4n:#2bb534;
|
|
3020
3040
|
--color-text-status-warning-75jmgn:#fbd332;
|
|
3021
3041
|
--color-text-top-navigation-title-50mcr5:#f9f9fa;
|
|
3042
|
+
--color-text-tutorial-hotspot-default-r59hr8:#42b4ff;
|
|
3043
|
+
--color-text-tutorial-hotspot-hover-r1skao:#75cfff;
|
|
3022
3044
|
--color-board-placeholder-active-oe22ia:#656871;
|
|
3023
3045
|
--color-board-placeholder-hover-jxjr60:#006ce0;
|
|
3024
3046
|
--color-drag-placeholder-active-mhklvu:#656871;
|
|
@@ -3082,6 +3104,8 @@
|
|
|
3082
3104
|
--color-text-expandable-section-hover-3n2kpp:#ffffff;
|
|
3083
3105
|
--color-text-heading-secondary-p3brnl:#f9f9fa;
|
|
3084
3106
|
--color-text-segment-hover-bhj7qd:#ffffff;
|
|
3107
|
+
--color-text-tutorial-hotspot-default-r59hr8:#dedee3;
|
|
3108
|
+
--color-text-tutorial-hotspot-hover-r1skao:#f9f9fa;
|
|
3085
3109
|
}
|
|
3086
3110
|
|
|
3087
3111
|
.awsui-context-flashbar.awsui-visual-refresh:not(#\9) {
|
|
@@ -3115,6 +3139,8 @@
|
|
|
3115
3139
|
--color-text-expandable-section-hover-3n2kpp:#ffffff;
|
|
3116
3140
|
--color-text-heading-secondary-p3brnl:#f9f9fa;
|
|
3117
3141
|
--color-text-segment-hover-bhj7qd:#ffffff;
|
|
3142
|
+
--color-text-tutorial-hotspot-default-r59hr8:#dedee3;
|
|
3143
|
+
--color-text-tutorial-hotspot-hover-r1skao:#f9f9fa;
|
|
3118
3144
|
}
|
|
3119
3145
|
|
|
3120
3146
|
.awsui-visual-refresh .awsui-context-flashbar-warning:not(#\9) {
|
|
@@ -3155,6 +3181,7 @@
|
|
|
3155
3181
|
--color-text-link-inverted-hover-7jk1d1:#0f141a;
|
|
3156
3182
|
--color-text-notification-default-fmebm4:#0f141a;
|
|
3157
3183
|
--color-text-segment-hover-bhj7qd:#0f141a;
|
|
3184
|
+
--color-text-tutorial-hotspot-default-r59hr8:#656871;
|
|
3158
3185
|
}
|
|
3159
3186
|
|
|
3160
3187
|
.awsui-context-flashbar-warning.awsui-visual-refresh:not(#\9) {
|
|
@@ -3187,6 +3214,8 @@
|
|
|
3187
3214
|
--color-text-link-inverted-hover-7jk1d1:#0f141a;
|
|
3188
3215
|
--color-text-notification-default-fmebm4:#0f141a;
|
|
3189
3216
|
--color-text-segment-hover-bhj7qd:#0f141a;
|
|
3217
|
+
--color-text-tutorial-hotspot-default-r59hr8:#656871;
|
|
3218
|
+
--color-text-tutorial-hotspot-hover-r1skao:#131920;
|
|
3190
3219
|
}
|
|
3191
3220
|
|
|
3192
3221
|
.awsui-visual-refresh .awsui-context-alert:not(#\9) {
|
|
@@ -3455,6 +3484,8 @@
|
|
|
3455
3484
|
--color-text-status-success-vmys4n:#2bb534;
|
|
3456
3485
|
--color-text-status-warning-75jmgn:#fbd332;
|
|
3457
3486
|
--color-text-top-navigation-title-50mcr5:#f9f9fa;
|
|
3487
|
+
--color-text-tutorial-hotspot-default-r59hr8:#42b4ff;
|
|
3488
|
+
--color-text-tutorial-hotspot-hover-r1skao:#75cfff;
|
|
3458
3489
|
--color-board-placeholder-active-oe22ia:#656871;
|
|
3459
3490
|
--color-board-placeholder-hover-jxjr60:#006ce0;
|
|
3460
3491
|
--color-drag-placeholder-active-mhklvu:#656871;
|
|
@@ -3667,6 +3698,8 @@
|
|
|
3667
3698
|
--color-text-status-success-vmys4n:#2bb534;
|
|
3668
3699
|
--color-text-status-warning-75jmgn:#fbd332;
|
|
3669
3700
|
--color-text-top-navigation-title-50mcr5:#f9f9fa;
|
|
3701
|
+
--color-text-tutorial-hotspot-default-r59hr8:#42b4ff;
|
|
3702
|
+
--color-text-tutorial-hotspot-hover-r1skao:#75cfff;
|
|
3670
3703
|
--color-board-placeholder-active-oe22ia:#656871;
|
|
3671
3704
|
--color-board-placeholder-hover-jxjr60:#006ce0;
|
|
3672
3705
|
--color-drag-placeholder-active-mhklvu:#656871;
|
|
@@ -3716,6 +3749,7 @@
|
|
|
3716
3749
|
--color-border-input-focused-s42oju:#42b4ff;
|
|
3717
3750
|
--color-border-tabs-shadow-0fojr3:rgba(15, 20, 26, 1);
|
|
3718
3751
|
--color-text-body-default-1tki40:#0f141a;
|
|
3752
|
+
--color-text-tutorial-hotspot-hover-r1skao:#131920;
|
|
3719
3753
|
}
|
|
3720
3754
|
}
|
|
3721
3755
|
@media not print {
|
|
@@ -28,7 +28,7 @@ const DragHandleButton = forwardRef(({ variant = 'drag-indicator', size = 'norma
|
|
|
28
28
|
// (See https://bugs.webkit.org/show_bug.cgi?id=22261)
|
|
29
29
|
// Otherwise, we can't reliably catch keyboard events coming from the handle
|
|
30
30
|
// when it is being dragged.
|
|
31
|
-
React.createElement("div", { ref: useMergeRefs(ref, dragHandleRefObject), role: ariaValue ? 'slider' : '
|
|
31
|
+
React.createElement("div", { ref: useMergeRefs(ref, dragHandleRefObject), role: ariaValue ? 'slider' : 'application', tabIndex: 0, className: clsx(className, styles.handle, testUtilsStyles.root, styles[`handle-${variant}`], styles[`handle-size-${size}`], disabled && styles['handle-disabled']), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedby, "aria-disabled": disabled, "aria-valuemax": ariaValue === null || ariaValue === void 0 ? void 0 : ariaValue.valueMax, "aria-valuemin": ariaValue === null || ariaValue === void 0 ? void 0 : ariaValue.valueMin, "aria-valuenow": ariaValue === null || ariaValue === void 0 ? void 0 : ariaValue.valueNow, onPointerDown: onPointerDown, onKeyDown: onKeyDown },
|
|
32
32
|
React.createElement(InternalIcon, Object.assign({}, iconProps))));
|
|
33
33
|
});
|
|
34
34
|
export default DragHandleButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle/button.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAG7E,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,MAAM,gBAAgB,GAAG,UAAU,CACjC,CACE,EACE,OAAO,GAAG,gBAAgB,EAC1B,IAAI,GAAG,QAAQ,EACf,SAAS,EACT,SAAS,EACT,cAAc,EACd,eAAe,EACf,SAAS,EACT,QAAQ,EACR,aAAa,EACb,SAAS,GACO,EAClB,GAAuB,EACvB,EAAE;IACF,MAAM,mBAAmB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAEzD,MAAM,SAAS,GAAc,CAAC,GAAG,EAAE;QACjC,MAAM,MAAM,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAE,UAAoB,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC;QAC/E,QAAQ,OAAO,EAAE;YACf,KAAK,gBAAgB;gBACnB,uCAAY,MAAM,KAAE,IAAI,EAAE,gBAAgB,IAAG;YAC/C,KAAK,aAAa;gBAChB,uCAAY,MAAM,KAAE,IAAI,EAAE,aAAa,IAAG;YAC5C,KAAK,mBAAmB;gBACtB,uCAAY,MAAM,KAAE,GAAG,EAAE,oBAAC,UAAU,IAAC,OAAO,EAAC,YAAY,GAAG,IAAG;YACjE,KAAK,iBAAiB;gBACpB,uCAAY,MAAM,KAAE,GAAG,EAAE,oBAAC,UAAU,IAAC,OAAO,EAAC,UAAU,GAAG,IAAG;SAChE;IACH,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO;IACL,4DAA4D;IAC5D,oDAAoD;IACpD,sDAAsD;IACtD,4EAA4E;IAC5E,4BAA4B;IAC5B,6BACE,GAAG,EAAE,YAAY,CAAC,GAAG,EAAE,mBAAmB,CAAC,EAC3C,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle/button.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC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;IACtD,4EAA4E;IAC5E,4BAA4B;IAC5B,6BACE,GAAG,EAAE,YAAY,CAAC,GAAG,EAAE,mBAAmB,CAAC,EAC3C,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,EAC1C,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,IAAI,CACb,SAAS,EACT,MAAM,CAAC,MAAM,EACb,eAAe,CAAC,IAAI,EACpB,MAAM,CAAC,UAAU,OAAO,EAAE,CAAC,EAC3B,MAAM,CAAC,eAAe,IAAI,EAAE,CAAC,EAC7B,QAAQ,IAAI,MAAM,CAAC,iBAAiB,CAAC,CACtC,gBACW,SAAS,qBACJ,cAAc,sBACb,eAAe,mBAClB,QAAQ,mBACR,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ,mBACnB,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ,mBACnB,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ,EAClC,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS;QAEpB,oBAAC,YAAY,oBAAK,SAAS,EAAI,CAC3B,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\n\nimport { IconProps } from '../../../icon/interfaces';\nimport InternalIcon from '../../../icon/internal';\nimport { DragHandleProps } from './interfaces';\nimport { ResizeIcon } from './resize-icon';\n\nimport styles from './styles.css.js';\nimport testUtilsStyles from './test-classes/styles.css.js';\n\nconst DragHandleButton = forwardRef(\n (\n {\n variant = 'drag-indicator',\n size = 'normal',\n className,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedby,\n ariaValue,\n disabled,\n onPointerDown,\n onKeyDown,\n }: DragHandleProps,\n ref: React.Ref<Element>\n ) => {\n const dragHandleRefObject = useRef<HTMLDivElement>(null);\n\n const iconProps: IconProps = (() => {\n const shared = { variant: disabled ? ('disabled' as const) : undefined, size };\n switch (variant) {\n case 'drag-indicator':\n return { ...shared, name: 'drag-indicator' };\n case 'resize-area':\n return { ...shared, name: 'resize-area' };\n case 'resize-horizontal':\n return { ...shared, svg: <ResizeIcon variant=\"horizontal\" /> };\n case 'resize-vertical':\n return { ...shared, svg: <ResizeIcon variant=\"vertical\" /> };\n }\n })();\n\n return (\n // We need to use a div with button role instead of a button\n // so that Safari will focus on it when clicking it.\n // (See https://bugs.webkit.org/show_bug.cgi?id=22261)\n // Otherwise, we can't reliably catch keyboard events coming from the handle\n // when it is being dragged.\n <div\n ref={useMergeRefs(ref, dragHandleRefObject)}\n role={ariaValue ? 'slider' : 'application'}\n tabIndex={0}\n className={clsx(\n className,\n styles.handle,\n testUtilsStyles.root,\n styles[`handle-${variant}`],\n styles[`handle-size-${size}`],\n disabled && styles['handle-disabled']\n )}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedby}\n aria-disabled={disabled}\n aria-valuemax={ariaValue?.valueMax}\n aria-valuemin={ariaValue?.valueMin}\n aria-valuenow={ariaValue?.valueNow}\n onPointerDown={onPointerDown}\n onKeyDown={onKeyDown}\n >\n <InternalIcon {...iconProps} />\n </div>\n );\n }\n);\n\nexport default DragHandleButton;\n"]}
|
|
@@ -481,6 +481,8 @@ export const colorTextStatusInfo: string;
|
|
|
481
481
|
export const colorTextStatusSuccess: string;
|
|
482
482
|
export const colorTextStatusWarning: string;
|
|
483
483
|
export const colorTextTopNavigationTitle: string;
|
|
484
|
+
export const colorTextTutorialHotspotDefault: string;
|
|
485
|
+
export const colorTextTutorialHotspotHover: string;
|
|
484
486
|
export const colorBoardPlaceholderActive: string;
|
|
485
487
|
export const colorBoardPlaceholderHover: string;
|
|
486
488
|
export const colorDragPlaceholderActive: string;
|
|
@@ -481,6 +481,8 @@ export var colorTextStatusInfo = "var(--color-text-status-info-xbstx5, #006ce0)"
|
|
|
481
481
|
export var colorTextStatusSuccess = "var(--color-text-status-success-4f6v4h, #00802f)";
|
|
482
482
|
export var colorTextStatusWarning = "var(--color-text-status-warning-fa077b, #855900)";
|
|
483
483
|
export var colorTextTopNavigationTitle = "var(--color-text-top-navigation-title-kiop92, #0f141a)";
|
|
484
|
+
export var colorTextTutorialHotspotDefault = "var(--color-text-tutorial-hotspot-default-aq2wj8, #006ce0)";
|
|
485
|
+
export var colorTextTutorialHotspotHover = "var(--color-text-tutorial-hotspot-hover-93wlda, #002b66)";
|
|
484
486
|
export var colorBoardPlaceholderActive = "var(--color-board-placeholder-active-3nv7j5, #ebebf0)";
|
|
485
487
|
export var colorBoardPlaceholderHover = "var(--color-board-placeholder-hover-1hv3br, #d1f1ff)";
|
|
486
488
|
export var colorDragPlaceholderActive = "var(--color-drag-placeholder-active-7dewab, #ebebf0)";
|