@cloudscape-design/components 3.0.1156 → 3.0.1157
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/alert/index.js +1 -1
- package/alert/interfaces.d.ts +1 -2
- package/app-layout/runtime-drawer/index.d.ts.map +1 -1
- package/app-layout/runtime-drawer/index.js +20 -18
- package/app-layout/runtime-drawer/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/styles.css.js +30 -30
- package/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +83 -83
- package/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +30 -30
- package/autosuggest/index.js +28 -11
- package/autosuggest/interfaces.d.ts +2 -1
- package/autosuggest/interfaces.js.map +1 -1
- package/badge/index.d.ts +2 -0
- package/badge/index.js +14 -13
- package/badge/interfaces.d.ts +3 -2
- package/box/index.js +18 -13
- package/box/interfaces.d.ts +2 -1
- package/button/index.js +12 -11
- package/button/interfaces.d.ts +4 -2
- package/button-dropdown/index.js +27 -11
- package/button-dropdown/interfaces.d.ts +6 -2
- package/button-group/index.js +42 -11
- package/button-group/interfaces.d.ts +10 -0
- package/button-group/interfaces.d.ts.map +1 -1
- package/button-group/interfaces.js.map +1 -1
- package/checkbox/index.js +9 -11
- package/checkbox/interfaces.d.ts +3 -2
- package/container/index.js +29 -13
- package/container/interfaces.d.ts +2 -1
- package/date-input/index.js +8 -10
- package/flashbar/index.js +10 -13
- package/flashbar/interfaces.d.ts +1 -0
- package/icon/index.js +8 -13
- package/icon/interfaces.d.ts +2 -1
- package/icon-provider/index.js +12 -2
- package/index.d.ts +4 -1
- package/index.js +4 -0
- package/input/index.js +53 -12
- package/input/interfaces.d.ts +3 -1
- package/internal/base-component/styles.scoped.css +1 -1
- package/internal/components/radio-button/interfaces.d.ts +3 -3
- package/internal/environment.js +3 -3
- package/internal/environment.json +3 -3
- package/internal/manifest.json +1 -1
- package/internal/plugins/controllers/drawers.d.ts +2 -2
- package/internal/plugins/controllers/drawers.d.ts.map +1 -1
- package/internal/plugins/controllers/drawers.js.map +1 -1
- package/internal/plugins/widget/interfaces.d.ts +2 -2
- package/internal/plugins/widget/interfaces.d.ts.map +1 -1
- package/internal/plugins/widget/interfaces.js.map +1 -1
- package/link/index.js +25 -11
- package/link/interfaces.d.ts +3 -2
- package/navigable-group/index.js +19 -4
- package/package.json +4 -1
- package/progress-bar/index.d.ts +1 -0
- package/progress-bar/index.js +52 -14
- package/progress-bar/interfaces.d.ts +1 -0
- package/prompt-input/index.js +19 -11
- package/prompt-input/interfaces.d.ts +4 -3
- package/radio-button/index.js +19 -4
- package/radio-group/index.js +20 -11
- package/radio-group/interfaces.d.ts +1 -1
- package/segmented-control/index.js +14 -13
- package/segmented-control/interfaces.d.ts +1 -0
- package/select/interfaces.d.ts +1 -1
- package/select/interfaces.js.map +1 -1
- package/space-between/index.js +10 -13
- package/space-between/interfaces.d.ts +2 -1
- package/spinner/index.js +10 -13
- package/spinner/interfaces.d.ts +2 -1
- package/status-indicator/index.js +10 -13
- package/status-indicator/interfaces.d.ts +2 -1
- package/steps/index.js +11 -11
- package/steps/interfaces.d.ts +6 -2
- package/table/header-cell/index.d.ts +1 -1
- package/table/header-cell/index.d.ts.map +1 -1
- package/table/header-cell/index.js +1 -1
- package/table/header-cell/index.js.map +1 -1
- package/table/header-cell/th-element.d.ts +1 -1
- package/table/header-cell/th-element.d.ts.map +1 -1
- package/table/header-cell/th-element.js.map +1 -1
- package/table/resizer/index.d.ts +3 -1
- package/table/resizer/index.d.ts.map +1 -1
- package/table/resizer/index.js +8 -5
- package/table/resizer/index.js.map +1 -1
- package/table/resizer/styles.css.js +13 -12
- package/table/resizer/styles.scoped.css +22 -22
- package/table/resizer/styles.selectors.js +13 -12
- package/table/thead.d.ts +1 -1
- package/table/thead.d.ts.map +1 -1
- package/table/thead.js.map +1 -1
- package/text-filter/index.js +17 -10
- package/text-filter/interfaces.d.ts +1 -0
- package/textarea/index.js +65 -12
- package/textarea/interfaces.d.ts +3 -2
- package/time-input/index.js +15 -11
- package/toggle/index.js +6 -10
- package/toggle/interfaces.d.ts +3 -2
- package/toggle-button/index.js +14 -11
- package/wizard/index.js +35 -13
- package/wizard/interfaces.d.ts +1 -1
- package/autosuggest/internal-do-not-use-core.js +0 -35
- package/badge/internal-do-not-use-core.js +0 -19
- package/box/internal-do-not-use-core.js +0 -23
- package/button/internal-do-not-use-core.js +0 -19
- package/button-dropdown/internal-do-not-use-core.js +0 -34
- package/button-group/internal-do-not-use-core.js +0 -49
- package/checkbox/internal-do-not-use-core.js +0 -16
- package/container/internal-do-not-use-core.js +0 -34
- package/date-input/internal-do-not-use-core.js +0 -16
- package/flashbar/internal-do-not-use-core.js +0 -15
- package/icon/internal-do-not-use-core.js +0 -13
- package/input/internal-do-not-use-core.js +0 -59
- package/link/internal-do-not-use-core.js +0 -32
- package/progress-bar/internal-do-not-use-core.js +0 -56
- package/prompt-input/internal-do-not-use-core.js +0 -26
- package/radio-group/internal-do-not-use-core.js +0 -27
- package/segmented-control/internal-do-not-use-core.js +0 -19
- package/space-between/internal-do-not-use-core.js +0 -15
- package/spinner/internal-do-not-use-core.js +0 -15
- package/status-indicator/internal-do-not-use-core.js +0 -15
- package/steps/internal-do-not-use-core.js +0 -18
- package/text-filter/internal-do-not-use-core.js +0 -25
- package/textarea/internal-do-not-use-core.js +0 -71
- package/time-input/internal-do-not-use-core.js +0 -22
- package/toggle/internal-do-not-use-core.js +0 -14
- package/toggle-button/internal-do-not-use-core.js +0 -21
- package/wizard/internal-do-not-use-core.js +0 -40
- /package/autosuggest/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/badge/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/box/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/button/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/button-dropdown/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/button-group/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/checkbox/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/container/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/date-input/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/flashbar/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/icon/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/input/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/link/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/progress-bar/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/prompt-input/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/radio-group/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/segmented-control/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/space-between/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/spinner/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/status-indicator/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/steps/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/text-filter/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/textarea/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/time-input/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/toggle/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/toggle-button/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/wizard/{internal-do-not-use-core.js.map → index.js.map} +0 -0
package/container/index.js
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import
|
|
5
|
+
import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
6
|
+
import { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';
|
|
7
|
+
import { getAnalyticsMetadataProps } from '../internal/base-component';
|
|
8
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
9
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
import { getExternalProps } from '../internal/utils/external-props';
|
|
11
|
+
import { InternalContainerAsSubstep } from './internal';
|
|
12
|
+
export default function Container({ variant = 'default', disableHeaderPaddings = false, disableContentPaddings = false, fitHeight = false, ...props }) {
|
|
13
|
+
const analyticsMetadata = getAnalyticsMetadataProps(props);
|
|
14
|
+
const baseComponentProps = useBaseComponent('Container', {
|
|
15
|
+
props: {
|
|
16
|
+
disableContentPaddings,
|
|
17
|
+
disableHeaderPaddings,
|
|
18
|
+
fitHeight,
|
|
19
|
+
variant,
|
|
20
|
+
},
|
|
21
|
+
metadata: {
|
|
22
|
+
hasInstanceIdentifier: Boolean(analyticsMetadata === null || analyticsMetadata === void 0 ? void 0 : analyticsMetadata.instanceIdentifier),
|
|
23
|
+
},
|
|
24
|
+
}, analyticsMetadata);
|
|
25
|
+
const externalProps = getExternalProps(props);
|
|
26
|
+
const analyticsComponentMetadata = {
|
|
27
|
+
name: 'awsui.Container',
|
|
28
|
+
label: { root: 'self' },
|
|
29
|
+
};
|
|
30
|
+
return (React.createElement(AnalyticsFunnelSubStep, { subStepIdentifier: analyticsMetadata === null || analyticsMetadata === void 0 ? void 0 : analyticsMetadata.instanceIdentifier, subStepErrorContext: analyticsMetadata === null || analyticsMetadata === void 0 ? void 0 : analyticsMetadata.errorContext },
|
|
31
|
+
React.createElement(InternalContainerAsSubstep, { variant: variant, disableContentPaddings: disableContentPaddings, disableHeaderPaddings: disableHeaderPaddings, fitHeight: fitHeight, ...props, ...externalProps, ...baseComponentProps, ...getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata }) })));
|
|
32
|
+
}
|
|
17
33
|
applyDisplayName(Container, 'Container');
|
|
18
|
-
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -59,7 +59,7 @@ export interface ContainerProps extends BaseComponentProps {
|
|
|
59
59
|
* Determines whether the container footer has padding. If `true`, removes the default padding from the footer.
|
|
60
60
|
* @awsuiSystem core
|
|
61
61
|
*/
|
|
62
|
-
|
|
62
|
+
disableFooterPaddings?: boolean;
|
|
63
63
|
/**
|
|
64
64
|
* Specify a container variant with one of the following:
|
|
65
65
|
* * `default` - Use this variant in standalone context.
|
|
@@ -71,6 +71,7 @@ export interface ContainerProps extends BaseComponentProps {
|
|
|
71
71
|
/**
|
|
72
72
|
* @awsuiSystem core
|
|
73
73
|
*/
|
|
74
|
+
style?: ContainerProps.Style;
|
|
74
75
|
}
|
|
75
76
|
export declare namespace ContainerProps {
|
|
76
77
|
interface AnalyticsMetadata {
|
package/date-input/index.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import CoreComponent from './internal-do-not-use-core';
|
|
5
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
6
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
import InternalDateInput from './internal';
|
|
11
8
|
const DateInput = React.forwardRef((props, ref) => {
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const baseComponentProps = useBaseComponent('DateInput', {
|
|
10
|
+
props: { autoFocus: props.autoFocus, readOnly: props.readOnly },
|
|
11
|
+
});
|
|
12
|
+
return React.createElement(InternalDateInput, { ...props, ...baseComponentProps, __injectAnalyticsComponentMetadata: true, ref: ref });
|
|
14
13
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
14
|
applyDisplayName(DateInput, 'DateInput');
|
|
18
15
|
export default DateInput;
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
package/flashbar/index.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import CoreComponent from './internal-do-not-use-core';
|
|
5
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
6
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
import { InternalFlashbar } from './internal';
|
|
8
|
+
export default function Flashbar(props) {
|
|
9
|
+
const { __internalRootRef } = useBaseComponent('Flashbar', {
|
|
10
|
+
props: { stackItems: props.stackItems },
|
|
11
|
+
});
|
|
12
|
+
return React.createElement(InternalFlashbar, { __internalRootRef: __internalRootRef, ...props });
|
|
13
|
+
}
|
|
17
14
|
applyDisplayName(Flashbar, 'Flashbar');
|
|
18
|
-
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
package/flashbar/interfaces.d.ts
CHANGED
package/icon/index.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import CoreComponent from './internal-do-not-use-core';
|
|
5
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
6
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
validateProps('Icon', props, ["nativeAttributes"], {}, 'console');
|
|
13
|
-
return React.createElement(CoreComponent, props);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
import InternalIcon from './internal';
|
|
8
|
+
export default function Icon({ size = 'normal', variant = 'normal', ...props }) {
|
|
9
|
+
const baseComponentProps = useBaseComponent('Icon', { props: { name: props.name, size, variant } });
|
|
10
|
+
return React.createElement(InternalIcon, { size: size, variant: variant, ...props, ...baseComponentProps });
|
|
11
|
+
}
|
|
17
12
|
applyDisplayName(Icon, 'Icon');
|
|
18
|
-
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
package/icon/interfaces.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { BaseComponentProps } from '../internal/base-component';
|
|
|
3
3
|
/**
|
|
4
4
|
* @awsuiSystem core
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
import { NativeAttributes } from '../internal/utils/with-native-attributes';
|
|
7
7
|
export interface IconProps extends BaseComponentProps {
|
|
8
8
|
/**
|
|
9
9
|
* Specifies the icon to be displayed.
|
|
@@ -73,6 +73,7 @@ export interface IconProps extends BaseComponentProps {
|
|
|
73
73
|
*
|
|
74
74
|
* @awsuiSystem core
|
|
75
75
|
*/
|
|
76
|
+
nativeAttributes?: NativeAttributes<React.HTMLAttributes<HTMLElement>>;
|
|
76
77
|
}
|
|
77
78
|
export declare namespace IconProps {
|
|
78
79
|
type Name = 'add-plus' | 'anchor-link' | 'angle-left-double' | 'angle-left' | 'angle-right-double' | 'angle-right' | 'angle-up' | 'angle-down' | 'arrow-left' | 'arrow-right' | 'arrow-up' | 'arrow-down' | 'at-symbol' | 'audio-full' | 'audio-half' | 'audio-off' | 'backward-10-seconds' | 'bug' | 'call' | 'calendar' | 'caret-down-filled' | 'caret-down' | 'caret-left-filled' | 'caret-right-filled' | 'caret-up-filled' | 'caret-up' | 'check' | 'contact' | 'close' | 'closed-caption' | 'closed-caption-unavailable' | 'copy' | 'command-prompt' | 'delete-marker' | 'download' | 'drag-indicator' | 'edit' | 'ellipsis' | 'envelope' | 'exit-full-screen' | 'expand' | 'external' | 'face-happy' | 'face-happy-filled' | 'face-neutral' | 'face-neutral-filled' | 'face-sad' | 'face-sad-filled' | 'file-open' | 'file' | 'filter' | 'flag' | 'folder-open' | 'folder' | 'forward-10-seconds' | 'full-screen' | 'gen-ai' | 'globe' | 'grid-view' | 'group-active' | 'group' | 'heart' | 'heart-filled' | 'history' | 'insert-row' | 'key' | 'keyboard' | 'list-view' | 'location-pin' | 'lock-private' | 'map' | 'menu' | 'microphone' | 'microphone-off' | 'mini-player' | 'multiscreen' | 'notification' | 'pause' | 'play' | 'redo' | 'refresh' | 'remove' | 'resize-area' | 'script' | 'search' | 'security' | 'settings' | 'send' | 'share' | 'shrink' | 'slash' | 'star-filled' | 'star-half' | 'star' | 'status-in-progress' | 'status-info' | 'status-negative' | 'status-not-started' | 'status-pending' | 'status-positive' | 'status-stopped' | 'status-warning' | 'stop-circle' | 'subtract-minus' | 'suggestions' | 'support' | 'thumbs-down-filled' | 'thumbs-down' | 'thumbs-up-filled' | 'thumbs-up' | 'ticket' | 'transcript' | 'treeview-collapse' | 'treeview-expand' | 'undo' | 'unlocked' | 'upload-download' | 'upload' | 'user-profile-active' | 'user-profile' | 'video-off' | 'video-on' | 'video-unavailable' | 'video-camera-off' | 'video-camera-on' | 'video-camera-unavailable' | 'view-full' | 'view-horizontal' | 'view-vertical' | 'zoom-in' | 'zoom-out' | 'zoom-to-fit';
|
package/icon-provider/index.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
3
|
+
'use client';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
|
+
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
+
import InternalIconProvider from './internal';
|
|
8
|
+
/**
|
|
9
|
+
* @awsuiSystem core
|
|
10
|
+
*/
|
|
4
11
|
export default function IconProvider(props) {
|
|
5
|
-
|
|
12
|
+
useBaseComponent('IconProvider');
|
|
13
|
+
return React.createElement(InternalIconProvider, { ...props });
|
|
6
14
|
}
|
|
15
|
+
applyDisplayName(IconProvider, 'IconProvider');
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
package/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export { default as Header, HeaderProps } from './header';
|
|
|
39
39
|
export { default as HelpPanel, HelpPanelProps } from './help-panel';
|
|
40
40
|
export { default as Hotspot, HotspotProps } from './hotspot';
|
|
41
41
|
export { default as Icon, IconProps } from './icon';
|
|
42
|
+
export { default as IconProvider, IconProviderProps } from './icon-provider';
|
|
42
43
|
export { default as Input, InputProps } from './input';
|
|
43
44
|
export { default as KeyValuePairs, KeyValuePairsProps } from './key-value-pairs';
|
|
44
45
|
export { default as LineChart, LineChartProps } from './line-chart';
|
|
@@ -48,12 +49,14 @@ export { default as LiveRegion, LiveRegionProps } from './live-region';
|
|
|
48
49
|
export { default as MixedLineBarChart, MixedLineBarChartProps } from './mixed-line-bar-chart';
|
|
49
50
|
export { default as Modal, ModalProps } from './modal';
|
|
50
51
|
export { default as Multiselect, MultiselectProps } from './multiselect';
|
|
52
|
+
export { default as NavigableGroup, NavigableGroupProps } from './navigable-group';
|
|
51
53
|
export { default as Pagination, PaginationProps } from './pagination';
|
|
52
54
|
export { default as PieChart, PieChartProps } from './pie-chart';
|
|
53
55
|
export { default as Popover, PopoverProps } from './popover';
|
|
54
56
|
export { default as ProgressBar, ProgressBarProps } from './progress-bar';
|
|
55
57
|
export { default as PromptInput, PromptInputProps } from './prompt-input';
|
|
56
58
|
export { default as PropertyFilter, PropertyFilterProps } from './property-filter';
|
|
59
|
+
export { default as RadioButton, RadioButtonProps } from './radio-button';
|
|
57
60
|
export { default as RadioGroup, RadioGroupProps } from './radio-group';
|
|
58
61
|
export { default as S3ResourceSelector, S3ResourceSelectorProps } from './s3-resource-selector';
|
|
59
62
|
export { default as SegmentedControl, SegmentedControlProps } from './segmented-control';
|
|
@@ -81,4 +84,4 @@ export { default as TopNavigation, TopNavigationProps } from './top-navigation';
|
|
|
81
84
|
export { default as TreeView, TreeViewProps } from './tree-view';
|
|
82
85
|
export { default as TutorialPanel, TutorialPanelProps } from './tutorial-panel';
|
|
83
86
|
export { default as Wizard, WizardProps } from './wizard';
|
|
84
|
-
export * from './interfaces';
|
|
87
|
+
export * from './interfaces';
|
package/index.js
CHANGED
|
@@ -39,6 +39,7 @@ export { default as Header } from './header';
|
|
|
39
39
|
export { default as HelpPanel } from './help-panel';
|
|
40
40
|
export { default as Hotspot } from './hotspot';
|
|
41
41
|
export { default as Icon } from './icon';
|
|
42
|
+
export { default as IconProvider } from './icon-provider';
|
|
42
43
|
export { default as Input } from './input';
|
|
43
44
|
export { default as KeyValuePairs } from './key-value-pairs';
|
|
44
45
|
export { default as LineChart } from './line-chart';
|
|
@@ -48,12 +49,14 @@ export { default as LiveRegion } from './live-region';
|
|
|
48
49
|
export { default as MixedLineBarChart } from './mixed-line-bar-chart';
|
|
49
50
|
export { default as Modal } from './modal';
|
|
50
51
|
export { default as Multiselect } from './multiselect';
|
|
52
|
+
export { default as NavigableGroup } from './navigable-group';
|
|
51
53
|
export { default as Pagination } from './pagination';
|
|
52
54
|
export { default as PieChart } from './pie-chart';
|
|
53
55
|
export { default as Popover } from './popover';
|
|
54
56
|
export { default as ProgressBar } from './progress-bar';
|
|
55
57
|
export { default as PromptInput } from './prompt-input';
|
|
56
58
|
export { default as PropertyFilter } from './property-filter';
|
|
59
|
+
export { default as RadioButton } from './radio-button';
|
|
57
60
|
export { default as RadioGroup } from './radio-group';
|
|
58
61
|
export { default as S3ResourceSelector } from './s3-resource-selector';
|
|
59
62
|
export { default as SegmentedControl } from './segmented-control';
|
|
@@ -82,3 +85,4 @@ export { default as TreeView } from './tree-view';
|
|
|
82
85
|
export { default as TutorialPanel } from './tutorial-panel';
|
|
83
86
|
export { default as Wizard } from './wizard';
|
|
84
87
|
export * from './interfaces';
|
|
88
|
+
//# sourceMappingURL=index.js.map
|
package/input/index.js
CHANGED
|
@@ -1,18 +1,59 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
3
|
+
'use client';
|
|
4
|
+
import React, { useImperativeHandle, useRef } from 'react';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { getBaseProps } from '../internal/base-component';
|
|
7
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
8
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import InternalInput from './internal';
|
|
10
|
+
import styles from './styles.css.js';
|
|
11
|
+
const Input = React.forwardRef(({ value, type = 'text', step, inputMode, autoComplete = true, spellcheck, disabled, readOnly, disableBrowserAutocorrect, onKeyDown, onKeyUp, onChange, onBlur, onFocus, ariaRequired, name, placeholder, autoFocus, ariaLabel, ariaLabelledby, ariaDescribedby, invalid, warning, controlId, clearAriaLabel, nativeInputAttributes, style, ...rest }, ref) => {
|
|
12
|
+
const baseComponentProps = useBaseComponent('Input', {
|
|
13
|
+
props: { autoComplete, autoFocus, disableBrowserAutocorrect, inputMode, readOnly, spellcheck, type },
|
|
14
|
+
});
|
|
15
|
+
const baseProps = getBaseProps(rest);
|
|
16
|
+
const inputRef = useRef(null);
|
|
17
|
+
useImperativeHandle(ref, () => ({
|
|
18
|
+
focus(...args) {
|
|
19
|
+
var _a;
|
|
20
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(...args);
|
|
21
|
+
},
|
|
22
|
+
select() {
|
|
23
|
+
var _a;
|
|
24
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.select();
|
|
25
|
+
},
|
|
26
|
+
}), [inputRef]);
|
|
27
|
+
return (React.createElement(InternalInput, { ref: inputRef, ...baseProps,
|
|
28
|
+
...baseComponentProps,
|
|
29
|
+
autoComplete,
|
|
30
|
+
ariaLabel,
|
|
31
|
+
ariaRequired,
|
|
32
|
+
autoFocus,
|
|
33
|
+
disabled,
|
|
34
|
+
disableBrowserAutocorrect,
|
|
35
|
+
name,
|
|
36
|
+
onKeyDown,
|
|
37
|
+
onKeyUp,
|
|
38
|
+
onChange,
|
|
39
|
+
onBlur,
|
|
40
|
+
onFocus,
|
|
41
|
+
placeholder,
|
|
42
|
+
readOnly,
|
|
43
|
+
type,
|
|
44
|
+
step,
|
|
45
|
+
inputMode,
|
|
46
|
+
spellcheck,
|
|
47
|
+
value,
|
|
48
|
+
ariaDescribedby,
|
|
49
|
+
ariaLabelledby,
|
|
50
|
+
invalid,
|
|
51
|
+
warning,
|
|
52
|
+
controlId,
|
|
53
|
+
clearAriaLabel,
|
|
54
|
+
nativeInputAttributes,
|
|
55
|
+
style, className: clsx(styles.root, baseProps.className), __inheritFormFieldProps: true, __injectAnalyticsComponentMetadata: true }));
|
|
14
56
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
57
|
applyDisplayName(Input, 'Input');
|
|
18
58
|
export default Input;
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
package/input/interfaces.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { BaseKeyDetail, CancelableEventHandler, NonCancelableEventHandler } from
|
|
|
4
4
|
/**
|
|
5
5
|
* @awsuiSystem core
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
import { NativeAttributes } from '../internal/utils/with-native-attributes';
|
|
8
8
|
export interface BaseInputProps {
|
|
9
9
|
/**
|
|
10
10
|
* Specifies the text entered into the form element.
|
|
@@ -74,6 +74,7 @@ export interface BaseInputProps {
|
|
|
74
74
|
*
|
|
75
75
|
* @awsuiSystem core
|
|
76
76
|
*/
|
|
77
|
+
nativeInputAttributes?: NativeAttributes<React.InputHTMLAttributes<HTMLInputElement>>;
|
|
77
78
|
}
|
|
78
79
|
export interface InputAutoCorrect {
|
|
79
80
|
/**
|
|
@@ -152,6 +153,7 @@ export interface InputProps extends BaseComponentProps, BaseInputProps, InputKey
|
|
|
152
153
|
/**
|
|
153
154
|
* @awsuiSystem core
|
|
154
155
|
*/
|
|
156
|
+
style?: InputProps.Style;
|
|
155
157
|
}
|
|
156
158
|
export declare namespace InputProps {
|
|
157
159
|
type Type = 'text' | 'password' | 'search' | 'number' | 'email' | 'url';
|
|
@@ -4,7 +4,7 @@ import { NonCancelableEventHandler } from '../../events';
|
|
|
4
4
|
/**
|
|
5
5
|
* @awsuiSystem core
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
import { NativeAttributes } from '../../utils/with-native-attributes';
|
|
8
8
|
export interface RadioButtonProps extends BaseComponentProps {
|
|
9
9
|
/**
|
|
10
10
|
* Specifies if the component is selected.
|
|
@@ -45,7 +45,7 @@ export interface RadioButtonProps extends BaseComponentProps {
|
|
|
45
45
|
*
|
|
46
46
|
* @awsuiSystem core
|
|
47
47
|
*/
|
|
48
|
-
|
|
48
|
+
nativeInputAttributes?: NativeAttributes<React.InputHTMLAttributes<HTMLInputElement>>;
|
|
49
49
|
/**
|
|
50
50
|
* Called when the user clicks on the radio button and it is not disabled or read-only.
|
|
51
51
|
*/
|
|
@@ -61,7 +61,7 @@ export interface RadioButtonProps extends BaseComponentProps {
|
|
|
61
61
|
/**
|
|
62
62
|
* @awsuiSystem core
|
|
63
63
|
*/
|
|
64
|
-
|
|
64
|
+
style?: RadioButtonProps.Style;
|
|
65
65
|
/**
|
|
66
66
|
* Sets the value attribute to the native control.
|
|
67
67
|
* If using native form submission, this value is sent to the server if the radio button is checked.
|
package/internal/environment.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export var PACKAGE_SOURCE = "components";
|
|
2
|
-
export var PACKAGE_VERSION = "3.0.0 (
|
|
3
|
-
export var GIT_SHA = "
|
|
2
|
+
export var PACKAGE_VERSION = "3.0.0 (1bfc081c)";
|
|
3
|
+
export var GIT_SHA = "1bfc081c";
|
|
4
4
|
export var THEME = "open-source-visual-refresh";
|
|
5
|
-
export var SYSTEM = "
|
|
5
|
+
export var SYSTEM = "core";
|
|
6
6
|
export var ALWAYS_VISUAL_REFRESH = true;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"PACKAGE_SOURCE": "components",
|
|
3
|
-
"PACKAGE_VERSION": "3.0.0 (
|
|
4
|
-
"GIT_SHA": "
|
|
3
|
+
"PACKAGE_VERSION": "3.0.0 (1bfc081c)",
|
|
4
|
+
"GIT_SHA": "1bfc081c",
|
|
5
5
|
"THEME": "open-source-visual-refresh",
|
|
6
|
-
"SYSTEM": "
|
|
6
|
+
"SYSTEM": "core",
|
|
7
7
|
"ALWAYS_VISUAL_REFRESH": true
|
|
8
8
|
}
|
package/internal/manifest.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonGroupProps } from '../../../button-group/interfaces';
|
|
1
|
+
import { ButtonGroupProps, ItemRuntime } from '../../../button-group/interfaces';
|
|
2
2
|
import { NonCancelableEventHandler } from '../../events';
|
|
3
3
|
type DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;
|
|
4
4
|
interface MountContentContext {
|
|
@@ -36,7 +36,7 @@ export interface DrawerConfig {
|
|
|
36
36
|
unmountContent: (container: HTMLElement) => void;
|
|
37
37
|
preserveInactiveContent?: boolean;
|
|
38
38
|
onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;
|
|
39
|
-
headerActions?: ReadonlyArray<
|
|
39
|
+
headerActions?: ReadonlyArray<ItemRuntime>;
|
|
40
40
|
onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;
|
|
41
41
|
}
|
|
42
42
|
declare const updatableProperties: readonly ["badge", "resizable", "defaultSize", "orderPriority", "defaultActive", "onResize"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"drawers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAGzD,KAAK,sBAAsB,GAAG,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAC;AAE/E,UAAU,mBAAmB;IAC3B,kBAAkB,EAAE,sBAAsB,CAAC;CAC5C;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,UAAU,EAAE;QACV,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,uBAAuB,CAAC,EAAE,MAAM,CAAC;QACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC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AAe,EAAC;QACrD,OAAO,WAAiC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonGroupProps } from '../../../button-group/interfaces';\nimport debounce from '../../debounce';\nimport { NonCancelableEventHandler } from '../../events';\nimport { reportRuntimeApiWarning } from '../helpers/metrics';\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\nexport interface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerConfig {\n id: string;\n type?: 'local' | 'global';\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n expandedModeButton?: string;\n };\n isExpandable?: boolean;\n badge?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n orderPriority?: number;\n defaultActive?: boolean;\n trigger?: {\n iconSvg?: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n headerActions?: ReadonlyArray<ButtonGroupProps.Item>;\n onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n}\n\nconst updatableProperties = [\n 'badge',\n 'resizable',\n 'defaultSize',\n 'orderPriority',\n 'defaultActive',\n 'onResize',\n] as const;\n\nexport type UpdateDrawerConfig = { id: DrawerConfig['id'] } & Partial<\n Pick<DrawerConfig, (typeof updatableProperties)[number]>\n>;\n\ntype DrawersRegistrationListener = (drawers: Array<DrawerConfig>) => void;\ntype DrawersUpdateListener = (drawers: Array<DrawerConfig>) => void;\n\nexport type DrawersToggledListener = (drawerId: string, params?: OpenCloseDrawerParams) => void;\ntype DrawersResizeListener = (drawerId: string, size: number) => void;\n\ninterface OpenCloseDrawerParams {\n initiatedByUserAction: boolean;\n}\n\nexport interface DrawersApiPublic {\n registerDrawer(config: DrawerConfig): void;\n updateDrawer(config: UpdateDrawerConfig): void;\n openDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n closeDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n resizeDrawer(drawerId: string, size: number): void;\n}\n\nexport interface DrawersApiInternal {\n clearRegisteredDrawers(): void;\n onDrawersRegistered(listener: DrawersRegistrationListener): () => void;\n onDrawerOpened(listener: DrawersToggledListener): () => void;\n onDrawerClosed(listener: DrawersToggledListener): () => void;\n onDrawerResize(listener: DrawersResizeListener): () => void;\n onDrawersUpdated(listener: DrawersUpdateListener): void;\n getDrawersState(): Array<DrawerConfig>;\n}\n\nexport class DrawersController {\n private drawers: Array<DrawerConfig> = [];\n private drawersRegistrationListener: DrawersRegistrationListener | null = null;\n private drawerOpenedListener: DrawersToggledListener | null = null;\n private drawerClosedListener: DrawersToggledListener | null = null;\n private drawersUpdateListeners: Array<DrawersUpdateListener> = [];\n private drawerResizeListener: DrawersResizeListener | null = null;\n\n scheduleUpdate = debounce(() => {\n this.drawersRegistrationListener?.(this.drawers);\n this.drawersUpdateListeners.forEach(drawersUpdateListeners => {\n drawersUpdateListeners?.(this.drawers);\n });\n }, 0);\n\n registerDrawer = (config: DrawerConfig) => {\n if (this.drawers.find(drawer => drawer.id === config.id)) {\n reportRuntimeApiWarning('app-layout-drawers', `drawer with id \"${config.id}\" is already registered`);\n }\n this.drawers = this.drawers.concat(config);\n this.scheduleUpdate();\n };\n\n updateDrawer = ({ id: drawerId, ...rest }: UpdateDrawerConfig) => {\n const drawerIndex = this.drawers.findIndex(({ id }) => id === drawerId);\n const oldDrawerConfig = this.drawers?.[drawerIndex];\n if (!oldDrawerConfig) {\n throw new Error(`[AwsUi] [runtime drawers] drawer with id ${drawerId} not found`);\n }\n const drawers = this.drawers.slice();\n const updatedDrawer = { ...oldDrawerConfig };\n for (const key of updatableProperties) {\n if (key in rest) {\n updatedDrawer[key] = (rest as any)[key];\n }\n }\n drawers[drawerIndex] = updatedDrawer;\n this.drawers = drawers;\n this.scheduleUpdate();\n };\n\n onDrawersRegistered = (listener: DrawersRegistrationListener) => {\n if (this.drawersRegistrationListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawersRegistered'\n );\n }\n this.drawersRegistrationListener = listener;\n this.scheduleUpdate();\n return () => {\n this.drawersRegistrationListener = null;\n this.drawersUpdateListeners = [];\n };\n };\n\n clearRegisteredDrawers = () => {\n this.drawers = [];\n };\n\n onDrawerOpened = (listener: DrawersToggledListener) => {\n if (this.drawerOpenedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerOpened'\n );\n }\n\n this.drawerOpenedListener = listener;\n\n return () => {\n this.drawerOpenedListener = null;\n };\n };\n\n onDrawerClosed = (listener: DrawersToggledListener) => {\n if (this.drawerClosedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerClosed'\n );\n }\n\n this.drawerClosedListener = listener;\n\n return () => {\n this.drawerClosedListener = null;\n };\n };\n\n openDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerOpenedListener?.(drawerId, params);\n };\n\n closeDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerClosedListener?.(drawerId, params);\n };\n\n onDrawersUpdated = (listener: DrawersUpdateListener) => {\n this.drawersUpdateListeners.push(listener);\n\n return () => {\n this.drawersUpdateListeners = this.drawersUpdateListeners.filter(item => item !== listener);\n };\n };\n\n onDrawerResize = (listener: DrawersResizeListener) => {\n if (this.drawerResizeListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerResize'\n );\n }\n\n this.drawerResizeListener = listener;\n\n return () => {\n this.drawerResizeListener = null;\n };\n };\n\n resizeDrawer = (drawerId: string, size: number) => {\n this.drawerResizeListener?.(drawerId, size);\n };\n\n getDrawersState = () => {\n return this.drawers;\n };\n\n installPublic(api: Partial<DrawersApiPublic> = {}): DrawersApiPublic {\n api.registerDrawer ??= this.registerDrawer;\n api.updateDrawer ??= this.updateDrawer;\n api.openDrawer ??= this.openDrawer;\n api.closeDrawer ??= this.closeDrawer;\n api.resizeDrawer ??= this.resizeDrawer;\n return api as DrawersApiPublic;\n }\n\n installInternal(internalApi: Partial<DrawersApiInternal> = {}): DrawersApiInternal {\n internalApi.clearRegisteredDrawers ??= this.clearRegisteredDrawers;\n internalApi.onDrawersRegistered ??= this.onDrawersRegistered;\n internalApi.onDrawerOpened ??= this.onDrawerOpened;\n internalApi.onDrawerClosed ??= this.onDrawerClosed;\n internalApi.onDrawerResize ??= this.onDrawerResize;\n internalApi.onDrawersUpdated ??= this.onDrawersUpdated;\n internalApi.getDrawersState ??= this.getDrawersState;\n return internalApi as DrawersApiInternal;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"drawers.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AA0C7D,MAAM,mBAAmB,GAAG;IAC1B,OAAO;IACP,WAAW;IACX,aAAa;IACb,eAAe;IACf,eAAe;IACf,UAAU;CACF,CAAC;AAkCX,MAAM,OAAO,iBAAiB;IAA9B;QACU,YAAO,GAAwB,EAAE,CAAC;QAClC,gCAA2B,GAAuC,IAAI,CAAC;QACvE,yBAAoB,GAAkC,IAAI,CAAC;QAC3D,yBAAoB,GAAkC,IAAI,CAAC;QAC3D,2BAAsB,GAAiC,EAAE,CAAC;QAC1D,yBAAoB,GAAiC,IAAI,CAAC;QAElE,mBAAc,GAAG,QAAQ,CAAC,GAAG,EAAE;;YAC7B,MAAA,IAAI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CAAC,eAAe,oCAA3B,WAAW,CAAC,eAAe,GAAK,IAAI,CAAC,eAAe,EAAC;QACrD,OAAO,WAAiC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonGroupProps, ItemRuntime } from '../../../button-group/interfaces';\nimport debounce from '../../debounce';\nimport { NonCancelableEventHandler } from '../../events';\nimport { reportRuntimeApiWarning } from '../helpers/metrics';\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\nexport interface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerConfig {\n id: string;\n type?: 'local' | 'global';\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n expandedModeButton?: string;\n };\n isExpandable?: boolean;\n badge?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n orderPriority?: number;\n defaultActive?: boolean;\n trigger?: {\n iconSvg?: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n headerActions?: ReadonlyArray<ItemRuntime>;\n onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n}\n\nconst updatableProperties = [\n 'badge',\n 'resizable',\n 'defaultSize',\n 'orderPriority',\n 'defaultActive',\n 'onResize',\n] as const;\n\nexport type UpdateDrawerConfig = { id: DrawerConfig['id'] } & Partial<\n Pick<DrawerConfig, (typeof updatableProperties)[number]>\n>;\n\ntype DrawersRegistrationListener = (drawers: Array<DrawerConfig>) => void;\ntype DrawersUpdateListener = (drawers: Array<DrawerConfig>) => void;\n\nexport type DrawersToggledListener = (drawerId: string, params?: OpenCloseDrawerParams) => void;\ntype DrawersResizeListener = (drawerId: string, size: number) => void;\n\ninterface OpenCloseDrawerParams {\n initiatedByUserAction: boolean;\n}\n\nexport interface DrawersApiPublic {\n registerDrawer(config: DrawerConfig): void;\n updateDrawer(config: UpdateDrawerConfig): void;\n openDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n closeDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n resizeDrawer(drawerId: string, size: number): void;\n}\n\nexport interface DrawersApiInternal {\n clearRegisteredDrawers(): void;\n onDrawersRegistered(listener: DrawersRegistrationListener): () => void;\n onDrawerOpened(listener: DrawersToggledListener): () => void;\n onDrawerClosed(listener: DrawersToggledListener): () => void;\n onDrawerResize(listener: DrawersResizeListener): () => void;\n onDrawersUpdated(listener: DrawersUpdateListener): void;\n getDrawersState(): Array<DrawerConfig>;\n}\n\nexport class DrawersController {\n private drawers: Array<DrawerConfig> = [];\n private drawersRegistrationListener: DrawersRegistrationListener | null = null;\n private drawerOpenedListener: DrawersToggledListener | null = null;\n private drawerClosedListener: DrawersToggledListener | null = null;\n private drawersUpdateListeners: Array<DrawersUpdateListener> = [];\n private drawerResizeListener: DrawersResizeListener | null = null;\n\n scheduleUpdate = debounce(() => {\n this.drawersRegistrationListener?.(this.drawers);\n this.drawersUpdateListeners.forEach(drawersUpdateListeners => {\n drawersUpdateListeners?.(this.drawers);\n });\n }, 0);\n\n registerDrawer = (config: DrawerConfig) => {\n if (this.drawers.find(drawer => drawer.id === config.id)) {\n reportRuntimeApiWarning('app-layout-drawers', `drawer with id \"${config.id}\" is already registered`);\n }\n this.drawers = this.drawers.concat(config);\n this.scheduleUpdate();\n };\n\n updateDrawer = ({ id: drawerId, ...rest }: UpdateDrawerConfig) => {\n const drawerIndex = this.drawers.findIndex(({ id }) => id === drawerId);\n const oldDrawerConfig = this.drawers?.[drawerIndex];\n if (!oldDrawerConfig) {\n throw new Error(`[AwsUi] [runtime drawers] drawer with id ${drawerId} not found`);\n }\n const drawers = this.drawers.slice();\n const updatedDrawer = { ...oldDrawerConfig };\n for (const key of updatableProperties) {\n if (key in rest) {\n updatedDrawer[key] = (rest as any)[key];\n }\n }\n drawers[drawerIndex] = updatedDrawer;\n this.drawers = drawers;\n this.scheduleUpdate();\n };\n\n onDrawersRegistered = (listener: DrawersRegistrationListener) => {\n if (this.drawersRegistrationListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawersRegistered'\n );\n }\n this.drawersRegistrationListener = listener;\n this.scheduleUpdate();\n return () => {\n this.drawersRegistrationListener = null;\n this.drawersUpdateListeners = [];\n };\n };\n\n clearRegisteredDrawers = () => {\n this.drawers = [];\n };\n\n onDrawerOpened = (listener: DrawersToggledListener) => {\n if (this.drawerOpenedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerOpened'\n );\n }\n\n this.drawerOpenedListener = listener;\n\n return () => {\n this.drawerOpenedListener = null;\n };\n };\n\n onDrawerClosed = (listener: DrawersToggledListener) => {\n if (this.drawerClosedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerClosed'\n );\n }\n\n this.drawerClosedListener = listener;\n\n return () => {\n this.drawerClosedListener = null;\n };\n };\n\n openDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerOpenedListener?.(drawerId, params);\n };\n\n closeDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerClosedListener?.(drawerId, params);\n };\n\n onDrawersUpdated = (listener: DrawersUpdateListener) => {\n this.drawersUpdateListeners.push(listener);\n\n return () => {\n this.drawersUpdateListeners = this.drawersUpdateListeners.filter(item => item !== listener);\n };\n };\n\n onDrawerResize = (listener: DrawersResizeListener) => {\n if (this.drawerResizeListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerResize'\n );\n }\n\n this.drawerResizeListener = listener;\n\n return () => {\n this.drawerResizeListener = null;\n };\n };\n\n resizeDrawer = (drawerId: string, size: number) => {\n this.drawerResizeListener?.(drawerId, size);\n };\n\n getDrawersState = () => {\n return this.drawers;\n };\n\n installPublic(api: Partial<DrawersApiPublic> = {}): DrawersApiPublic {\n api.registerDrawer ??= this.registerDrawer;\n api.updateDrawer ??= this.updateDrawer;\n api.openDrawer ??= this.openDrawer;\n api.closeDrawer ??= this.closeDrawer;\n api.resizeDrawer ??= this.resizeDrawer;\n return api as DrawersApiPublic;\n }\n\n installInternal(internalApi: Partial<DrawersApiInternal> = {}): DrawersApiInternal {\n internalApi.clearRegisteredDrawers ??= this.clearRegisteredDrawers;\n internalApi.onDrawersRegistered ??= this.onDrawersRegistered;\n internalApi.onDrawerOpened ??= this.onDrawerOpened;\n internalApi.onDrawerClosed ??= this.onDrawerClosed;\n internalApi.onDrawerResize ??= this.onDrawerResize;\n internalApi.onDrawersUpdated ??= this.onDrawersUpdated;\n internalApi.getDrawersState ??= this.getDrawersState;\n return internalApi as DrawersApiInternal;\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonGroupProps } from '../../../button-group/interfaces';
|
|
1
|
+
import { ButtonGroupProps, ItemRuntime } from '../../../button-group/interfaces';
|
|
2
2
|
import { NonCancelableEventHandler } from '../../events';
|
|
3
3
|
interface Message<Type, Payload> {
|
|
4
4
|
type: Type;
|
|
@@ -44,7 +44,7 @@ export interface DrawerPayload {
|
|
|
44
44
|
onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;
|
|
45
45
|
mountHeader?: (container: HTMLElement) => void;
|
|
46
46
|
unmountHeader?: (container: HTMLElement) => void;
|
|
47
|
-
headerActions?: ReadonlyArray<
|
|
47
|
+
headerActions?: ReadonlyArray<ItemRuntime>;
|
|
48
48
|
onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;
|
|
49
49
|
onToggleFocusMode?: NonCancelableEventHandler<{
|
|
50
50
|
isExpanded: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEzD,UAAU,OAAO,CAAC,IAAI,EAAE,OAAO;IAC7B,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,KAAK,sBAAsB,GAAG,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAC;AAE/E,UAAU,mBAAmB;IAC3B,kBAAkB,EAAE,sBAAsB,CAAC;CAC5C;AAED,UAAU,uBAAuB;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE;QACV,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,uBAAuB,CAAC,EAAE,MAAM,CAAC;QACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,sBAAsB,CAAC,EAAE,MAAM,CAAC;KACjC,CAAC;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CA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AAa,EAAE,cAAc,GAAG,gBAAgB,GAAG,aAAa,GAAG,eAAe,CAAC,CAAC,CACpG,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,YAAY,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AACtE,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,aAAa,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AACxE,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AACxF,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAC1E,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED,MAAM,MAAM,sBAAsB,GAC9B,yBAAyB,GACzB,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,GACnB,mBAAmB,GACnB,uBAAuB,CAAC;AAE5B,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonGroupProps } from '../../../button-group/interfaces';\nimport { NonCancelableEventHandler } from '../../events';\n\ninterface Message<Type, Payload> {\n type: Type;\n payload: Payload;\n}\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\ninterface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerPayload {\n id: string;\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n expandedModeButton?: string;\n exitExpandedModeButton?: string;\n };\n isExpandable?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n defaultActive?: boolean;\n trigger?: {\n iconSvg?: string;\n customIcon?: string;\n };\n exitExpandedModeTrigger?: {\n customIcon?: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n mountHeader?: (container: HTMLElement) => void;\n unmountHeader?: (container: HTMLElement) => void;\n headerActions?: ReadonlyArray<
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonGroupProps, ItemRuntime } from '../../../button-group/interfaces';\nimport { NonCancelableEventHandler } from '../../events';\n\ninterface Message<Type, Payload> {\n type: Type;\n payload: Payload;\n}\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\ninterface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerPayload {\n id: string;\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n expandedModeButton?: string;\n exitExpandedModeButton?: string;\n };\n isExpandable?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n defaultActive?: boolean;\n trigger?: {\n iconSvg?: string;\n customIcon?: string;\n };\n exitExpandedModeTrigger?: {\n customIcon?: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n mountHeader?: (container: HTMLElement) => void;\n unmountHeader?: (container: HTMLElement) => void;\n headerActions?: ReadonlyArray<ItemRuntime>;\n onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n onToggleFocusMode?: NonCancelableEventHandler<{ isExpanded: boolean }>;\n position?: 'side' | 'bottom';\n}\n\nexport type RegisterDrawerMessage = Message<'registerLeftDrawer' | 'registerBottomDrawer', DrawerPayload>;\nexport type UpdateDrawerConfigMessage = Message<\n 'updateDrawerConfig',\n Pick<DrawerPayload, 'id'> &\n Partial<Omit<DrawerPayload, 'mountContent' | 'unmountContent' | 'mountHeader' | 'unmountHeader'>>\n>;\nexport type OpenDrawerMessage = Message<'openDrawer', { id: string }>;\nexport type CloseDrawerMessage = Message<'closeDrawer', { id: string }>;\nexport type ResizeDrawerMessage = Message<'resizeDrawer', { id: string; size: number }>;\nexport type ExpandDrawerMessage = Message<'expandDrawer', { id: string }>;\nexport interface ExitExpandedModeMessage {\n type: 'exitExpandedMode';\n}\n\nexport type AppLayoutUpdateMessage =\n | UpdateDrawerConfigMessage\n | OpenDrawerMessage\n | CloseDrawerMessage\n | ResizeDrawerMessage\n | ExpandDrawerMessage\n | ExitExpandedModeMessage;\n\nexport type InitialMessage = RegisterDrawerMessage;\n\nexport type WidgetMessage = InitialMessage | AppLayoutUpdateMessage;\n"]}
|
package/link/index.js
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import
|
|
5
|
+
import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
6
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
7
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
import InternalLink from './internal';
|
|
9
|
+
const Link = React.forwardRef(({ fontSize = 'body-m', color = 'normal', external = false, style, ...props }, ref) => {
|
|
10
|
+
const baseComponentProps = useBaseComponent('Link', {
|
|
11
|
+
props: { color, external, fontSize, rel: props.rel, target: props.target, variant: props.variant },
|
|
12
|
+
});
|
|
13
|
+
const analyticsMetadata = {
|
|
14
|
+
action: 'click',
|
|
15
|
+
detail: {
|
|
16
|
+
label: { root: 'self' },
|
|
17
|
+
external: `${external}`,
|
|
18
|
+
},
|
|
19
|
+
component: {
|
|
20
|
+
name: 'awsui.Link',
|
|
21
|
+
label: { root: 'self' },
|
|
22
|
+
properties: { variant: props.variant || 'secondary' },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
if (props.href) {
|
|
26
|
+
analyticsMetadata.detail.href = props.href;
|
|
27
|
+
}
|
|
28
|
+
return (React.createElement(InternalLink, { fontSize: fontSize, color: color, external: external, ...props, ...baseComponentProps, ref: ref, ...getAnalyticsMetadataAttribute(analyticsMetadata), style: style }));
|
|
14
29
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
30
|
applyDisplayName(Link, 'Link');
|
|
18
31
|
export default Link;
|
|
32
|
+
//# sourceMappingURL=index.js.map
|